Merge branch 'cairocanvas'

This commit is contained in:
Paul Davis 2014-10-16 05:12:52 -04:00
commit ad017365f7
1975 changed files with 293012 additions and 211882 deletions

68
.gitignore vendored
View file

@ -31,6 +31,8 @@ depcomp
*.kdev4
.gdb_history
core
core.*
vgcore.*
cscope.files
cscope.out
tags
@ -49,7 +51,10 @@ tags
/gtk2_ardour/po/*.mo
/gtk2_ardour/*.pot
/libs/ardour/po/*.mo
/libs/ardour/ardour3.pot
/libs/ardour/libardour.pot
/libs/gtkmm2ext/po/*.mo
/libs/gtkmm2ext/libgtkmm2ext.pot
# /gtk2_ardour/
/gtk2_ardour/ardour.sh
@ -65,6 +70,10 @@ tags
/libs/ardour/revision.cc
/libs/ardour/config_text.cc
# /libs/canvas
/libs/canvas/version.cc
/libs/canvas/canvas/version.h
# /libs/gtkmm2ext/
/libs/gtkmm2ext/*.pot
/libs/gtkmm2ext/*.mo
@ -79,3 +88,62 @@ tags
# /libs/pbd/
/libs/pbd/version.cc
/libs/pbd/pbd/version.h
/libs/taglib/taglib/flacproperties.h
/libs/taglib/taglib/apefooter.h
/libs/taglib/taglib/apeitem.h
/libs/taglib/taglib/apetag.h
/libs/taglib/taglib/attachedpictureframe.h
/libs/taglib/taglib/commentsframe.h
/libs/taglib/taglib/flacfile.h
/libs/taglib/taglib/id3v2tag.h
/libs/taglib/taglib/generalencapsulatedobjectframe.h
/libs/taglib/taglib/id3v1genres.h
/libs/taglib/taglib/id3v1tag.h
/libs/taglib/taglib/id3v2extendedheader.h
/libs/taglib/taglib/id3v2footer.h
/libs/taglib/taglib/id3v2frame.h
/libs/taglib/taglib/id3v2framefactory.h
/libs/taglib/taglib/id3v2header.h
/libs/taglib/taglib/id3v2synchdata.h
/libs/taglib/taglib/oggpageheader.h
/libs/taglib/taglib/mpcfile.h
/libs/taglib/taglib/mpcproperties.h
/libs/taglib/taglib/mpegfile.h
/libs/taglib/taglib/mpegheader.h
/libs/taglib/taglib/mpegproperties.h
/libs/taglib/taglib/oggfile.h
/libs/taglib/taglib/oggflacfile.h
/libs/taglib/taglib/oggpage.h
/libs/taglib/taglib/textidentificationframe.h
/libs/taglib/taglib/relativevolumeframe.h
/libs/taglib/taglib/speexfile.h
/libs/taglib/taglib/speexproperties.h
/libs/taglib/taglib/taglib.h
/libs/taglib/taglib/tbytevector.h
/libs/taglib/taglib/tbytevectorlist.h
/libs/taglib/taglib/tdebug.h
/libs/taglib/taglib/tlist.h
/libs/taglib/taglib/tmap.h
/libs/taglib/taglib/trueaudiofile.h
/libs/taglib/taglib/trueaudioproperties.h
/libs/taglib/taglib/tstring.h
/libs/taglib/taglib/tstringlist.h
/libs/taglib/taglib/tfile.h
/libs/taglib/taglib/urllinkframe.h
/libs/taglib/taglib/unicode.h
/libs/taglib/taglib/uniquefileidentifierframe.h
/libs/taglib/taglib/unknownframe.h
/libs/taglib/taglib/unsynchronizedlyricsframe.h
/libs/taglib/taglib/xiphcomment.h
/libs/taglib/taglib/vorbisfile.h
/libs/taglib/taglib/vorbisproperties.h
/libs/taglib/taglib/wavpackfile.h
/libs/taglib/taglib/wavpackproperties.h
/libs/taglib/taglib/xingheader.h
/libs/taglib/taglib/tlist.tcc
/libs/taglib/taglib/tmap.tcc
/MSVCMixbus3/MSVCMixbus3.vsprops
/MSVCardour3/MSVCMixbus3.vsprops
/icons/win32/msvc_resources.rc

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioPropertySheet
ProjectType="Visual C++"
Version="8.00"
Name="MSVCMixbus3"
>
<UserMacro
Name="GlibApiVersion"
Value="@GLIB_API_VERSION@"
/>
<UserMacro
Name="GdkPixbufApiVersion"
Value="@GDK_PIXBUF_API_VERSION@"
/>
<UserMacro
Name="DllPrefix"
Value="lib"
/>
<UserMacro
Name="DllSuffix"
Value="@DLL_SUFFIX@"
/>
<UserMacro
Name="GlibDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="AtkDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="CairoDllSuffix"
Value="-2"
/>
<UserMacro
Name="PangoDllSuffix"
Value="-1.0-0"
/>
<UserMacro
Name="GtkDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="GdkPixbufDllSuffix"
Value="-@GDK_PIXBUF_API_VERSION@-@LT_CURRENT_MINUS_AGE@"
/>
<UserMacro
Name="GlibmmDllSuffix"
Value="-2.4-0"
/>
<UserMacro
Name="AtkmmDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="CairommDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="PangommDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="GtkmmDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="GtkBuildProjectFolder"
Value="@GtkBuildProjectFolder@"
/>
<UserMacro
Name="GlibBuildRootFolder"
Value="@GlibBuildRootFolder@"
/>
<UserMacro
Name="GdkPixbufBuildRootFolder"
Value="@GdkPixbufBuildRootFolder@"
/>
<UserMacro
Name="JackBuildRootFolder"
Value="@JackBuildRootFolder@"
/>
<UserMacro
Name="GenericIncludeFolder"
Value="@GenericIncludeFolder@"
/>
<UserMacro
Name="GenericLibraryFolder"
Value="@GenericLibraryFolder@"
/>
<UserMacro
Name="GenericWin32LibraryFolder"
Value="@GenericWin32LibraryFolder@"
/>
<UserMacro
Name="GenericWin32BinaryFolder"
Value="@GenericWin32BinaryFolder@"
/>
<UserMacro
Name="PackagerFolderLocal"
Value="@PackagerFolderLocal@"
/>
<UserMacro
Name="Debug32TestSuiteFolder"
Value="@Debug32TestSuiteFolder@"
/>
<UserMacro
Name="Release32TestSuiteFolder"
Value="@Release32TestSuiteFolder@"
/>
<UserMacro
Name="Debug32TargetFolder"
Value="@Debug32TargetFolder@"
/>
<UserMacro
Name="Release32TargetFolder"
Value="@Release32TargetFolder@"
/>
<UserMacro
Name="Debug32PixbufLoadersFolder"
Value="@Debug32PixbufLoadersFolder@"
/>
<UserMacro
Name="Release32PixbufLoadersFolder"
Value="@Release32PixbufLoadersFolder@"
/>
<UserMacro
Name="TargetSxSFolder"
Value="@TargetSxSFolder@"
/>
</VisualStudioPropertySheet>

2206
MSVCardour3/Ardour3.vcproj Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioPropertySheet
ProjectType="Visual C++"
Version="8.00"
Name="MSVCMixbus3"
>
<UserMacro
Name="GlibApiVersion"
Value="@GLIB_API_VERSION@"
/>
<UserMacro
Name="GdkPixbufApiVersion"
Value="@GDK_PIXBUF_API_VERSION@"
/>
<UserMacro
Name="DllPrefix"
Value="lib"
/>
<UserMacro
Name="DllSuffix"
Value="@DLL_SUFFIX@"
/>
<UserMacro
Name="GlibDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="AtkDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="CairoDllSuffix"
Value="-2"
/>
<UserMacro
Name="PangoDllSuffix"
Value="-1.0-0"
/>
<UserMacro
Name="GtkDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="GdkPixbufDllSuffix"
Value="-@GDK_PIXBUF_API_VERSION@-@LT_CURRENT_MINUS_AGE@"
/>
<UserMacro
Name="GlibmmDllSuffix"
Value="-2.4-0"
/>
<UserMacro
Name="AtkmmDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="CairommDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="PangommDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="GtkmmDllSuffix"
Value="-2.0-0"
/>
<UserMacro
Name="GtkBuildProjectFolder"
Value="@GtkBuildProjectFolder@"
/>
<UserMacro
Name="GlibBuildRootFolder"
Value="@GlibBuildRootFolder@"
/>
<UserMacro
Name="GdkPixbufBuildRootFolder"
Value="@GdkPixbufBuildRootFolder@"
/>
<UserMacro
Name="JackBuildRootFolder"
Value="@JackBuildRootFolder@"
/>
<UserMacro
Name="GenericIncludeFolder"
Value="@GenericIncludeFolder@"
/>
<UserMacro
Name="GenericLibraryFolder"
Value="@GenericLibraryFolder@"
/>
<UserMacro
Name="GenericWin32LibraryFolder"
Value="@GenericWin32LibraryFolder@"
/>
<UserMacro
Name="GenericWin32BinaryFolder"
Value="@GenericWin32BinaryFolder@"
/>
<UserMacro
Name="PackagerFolderLocal"
Value="@PackagerFolderLocal@"
/>
<UserMacro
Name="Debug32TestSuiteFolder"
Value="@Debug32TestSuiteFolder@"
/>
<UserMacro
Name="Release32TestSuiteFolder"
Value="@Release32TestSuiteFolder@"
/>
<UserMacro
Name="Debug32TargetFolder"
Value="@Debug32TargetFolder@"
/>
<UserMacro
Name="Release32TargetFolder"
Value="@Release32TargetFolder@"
/>
<UserMacro
Name="Debug32PixbufLoadersFolder"
Value="@Debug32PixbufLoadersFolder@"
/>
<UserMacro
Name="Release32PixbufLoadersFolder"
Value="@Release32PixbufLoadersFolder@"
/>
<UserMacro
Name="TargetSxSFolder"
Value="@TargetSxSFolder@"
/>
</VisualStudioPropertySheet>

20
MSVCardour3/resource Normal file
View file

@ -0,0 +1,20 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by test_app.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_MFC_TEST_PROJ_DIALOG 102
#define IDR_MAINFRAME 128
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 103
#endif
#endif

View file

@ -1,71 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Ardour>
<MIDI-port tag="ardour" device="ardour" type="coremidi" mode="duplex"/>
<MIDI-port tag="mcu" device="ardour" type="coremidi" mode="duplex"/>
<Config>
<Option name="minimum-disk-io-bytes" value="262144"/>
<Option name="track-buffer-seconds" value="5.000000"/>
<Option name="mute-affects-pre-fader" value="yes"/>
<Option name="mute-affects-post-fader" value="yes"/>
<Option name="mute-affects-control-outs" value="yes"/>
<Option name="mute-affects-main-outs" value="yes"/>
<Option name="solo-latch" value="yes"/>
<Option name="mtc-port" value="ardour"/>
<Option name="mmc-port" value="ardour"/>
<Option name="midi-port" value="ardour"/>
<Option name="use-mmc" value="yes"/>
<Option name="send-mmc" value="yes"/>
<Option name="jack-time-master" value="yes"/>
<Option name="trace-midi-input" value="no"/>
<Option name="trace-midi-output" value="no"/>
<Option name="plugins-stop-with-transport" value="no"/>
<Option name="no-sw-monitoring" value="no"/>
<Option name="stop-recording-on-xrun" value="no"/>
<Option name="create-xrun-marker" value="yes"/>
<Option name="stop-at-session-end" value="no"/>
<Option name="auto-xfade" value="yes"/>
<Option name="crossfades-active" value="1"/>
<Option name="crossfades-visible" value="1"/>
<Option name="xfade-model" value="0"/>
<Option name="no-new-session-dialog" value="yes"/>
<Option name="timecode-source-is-synced" value="yes"/>
<Option name="auditioner-left-out" value="coreaudio:Built-in Audio:in1"/>
<Option name="auditioner-right-out" value="coreaudio:Built-in Audio:in2"/>
<Option name="quieten-at-speed" value="1.000000"/>
<Option name="use-vst" value="yes"/>
<Option name="use-tranzport" value="yes"/>
<Option name="disk-choice-space-threshold" value="57600000"/>
<Option name="destructive-xfade-msecs" value="20"/>
<Option name="periodic-safety-backups" value="1"/>
<Option name="periodic-safety-backup-interval" value="120"/>
<Option name="show-track-meters" value="1"/>
<Option name="default-narrow_ms" value="0"/>
<Option name="smpte-format" value="6"/>
<Option name="font-scale" value="102400"/>
<Option name="auto-return" value="1"/>
<Option name="solo-latched" value="0"/>
<Option name="link-region-and-track-selection" value="1"/>
<Option name="send-mtc" value="1"/>
<Option name="tape-machine-mode" value="1"/>
<Option name="monitoring-model" value="1"/>
</Config>
<extra>
<RulerVisibility smpte="yes" bbt="yes" frames="no" minsec="no" tempo="yes" meter="yes" marker="yes" rangemarker="no" transportmarker="yes" cdmarker="no"/>
<Keyboard edit-button="3" edit-modifier="4" delete-button="3" delete-modifier="1" snap-modifier="32"/>
<AudioSetup>
<periods val="2"/>
<priority val="60"/>
<ports val="256"/>
<realtime val="1"/>
<samplerate val="44100Hz"/>
<periodsize val="256"/>
<driver val="CoreAudio"/>
<interface val="Aggregate Device"/>
<inputdevice val="Aggregate Device"/>
<outputdevice val="Aggregate Device"/>
</AudioSetup>
</extra>
</Ardour>

49
doc/using_callgrind.txt Normal file
View file

@ -0,0 +1,49 @@
Profiling Ardour with Callgrind
===============================
Prerequisites
-------------
* valgrind version 3.7.0 or later (current 3.9.0)
* kcachegrind 0.6 or later (current: 0.7.4)
Basic Profiling
---------------
1. Compile ardour with debug symbols [1].
2. `cd gtk2_ardour`
3. start ardour using `./arcall`
Load a session, ideally use the 'Dummy' (non realtime) backend.
The `arcall` script does not start profiling immediately,
to start profiling, in a second terminal run
4. `callgrind_control -i on`
[do operations in Ardour that should be profiled]
5. `callgrind_control -i off`
6. quit ardour
7. run `kcachegrind calgringd.out.<PID>`
NB. There will be multiple files calgringd.out.<PID>-<Thread-ID> for every run,
only load the main file without the dash into
8. clean-up: `rm calgringd.out.*`
Advanced Usage
--------------
Edit gtk2_ardour/arcall, add/remove options as needed.
see http://valgrind.org/docs/manual/cl-manual.html for further information.
---
[1] ideally an optimized built with debug-symbols (-g) is used for profiling,
however the ardour wscript does not yet offer that configuration option.
However, a default (non optimized build) does contain debug-symbols.

View file

@ -11,7 +11,7 @@ def configure(conf):
def build(bld):
presets = bld.path.ant_glob ('*.preset')
formats = bld.path.ant_glob ('*.format')
bld.install_files (os.path.join(bld.env['DATADIR'], 'ardour3', 'export'),
bld.install_files (os.path.join(bld.env['DATADIR'], 'export'),
presets + formats)
def options(opt):

View file

@ -20,7 +20,6 @@
#include <algorithm>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <cstdio>
#include <ctime>
#include <cstdlib>
@ -31,7 +30,6 @@
#include "ardour/version.h"
#include "ardour/filesystem_paths.h"
#include "utils.h"
#include "version.h"
#include "about.h"
@ -41,6 +39,10 @@
#include "i18n.h"
#ifdef WAF_BUILD
#include "gtk2ardour-version.h"
#endif
using namespace Gtk;
using namespace Gdk;
using namespace std;
@ -266,7 +268,7 @@ patent must be licensed for everyone's free use or not licensed at all.\n\
The precise terms and conditions for copying, distribution and\n\
modification follow.\n\
\n\
GNU GENERAL PUBLIC LICENSE\n\
"" GNU GENERAL PUBLIC LICENSE\n\
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\
\n\
0. This License applies to any program or other work which contains\n\
@ -548,7 +550,9 @@ proprietary programs. If your program is a subroutine library, you may\n\
consider it more useful to permit linking proprietary applications with the\n\
library. If this is what you want to do, use the GNU Library General\n\
Public License instead of this License.\n\
");
"); /* Note that at the start of (approximately) line 265, the above license
text has been split into two concatenated tokens (to satisfy compilation
under MSVC). Hopefully this won't affect gcc */
About::About ()
: config_info (0)
@ -562,9 +566,9 @@ About::About ()
std::string splash_file;
SearchPath spath(ardour_data_search_path());
Searchpath spath(ardour_data_search_path());
if (find_file_in_search_path (spath, "splash.png", splash_file)) {
if (find_file (spath, "splash.png", splash_file)) {
set_logo (Gdk::Pixbuf::create_from_file (splash_file));
} else {
error << "Could not find splash file" << endmsg;

View file

@ -36,7 +36,6 @@
#include "gtkmm2ext/actions.h"
#include "utils.h"
#include "actions.h"
#include "i18n.h"
@ -72,11 +71,11 @@ ActionManager::init ()
}
void
ActionManager::load_menus ()
ActionManager::load_menus (const string& menus_file)
{
std::string ui_file;
find_file_in_search_path (ardour_config_search_path(), "ardour.menus", ui_file);
find_file (ardour_config_search_path(), menus_file, ui_file);
bool loaded = false;
@ -85,15 +84,15 @@ ActionManager::load_menus ()
info << string_compose (_("Loading menus from %1"), ui_file) << endmsg;
loaded = true;
} catch (Glib::MarkupError& err) {
error << string_compose (_("badly formatted UI definition file: %1"), err.what()) << endmsg;
cerr << string_compose (_("badly formatted UI definition file: %1"), err.what()) << endl;
error << string_compose (_("badly formatted menu definition file: %1"), err.what()) << endmsg;
cerr << string_compose (_("badly formatted menu definition file: %1"), err.what()) << endl;
} catch (...) {
error << string_compose (_("%1 menu definition file not found"), PROGRAM_NAME) << endmsg;
}
if (!loaded) {
cerr << string_compose (_("%1 will not work without a valid ardour.menus file"), PROGRAM_NAME) << endl;
error << string_compose (_("%1 will not work without a valid ardour.menus file"), PROGRAM_NAME) << endmsg;
cerr << string_compose (_("%1 will not work without a valid menu definition file"), PROGRAM_NAME) << endl;
error << string_compose (_("%1 will not work without a valid menu definition file"), PROGRAM_NAME) << endmsg;
exit(1);
}
}

View file

@ -30,7 +30,7 @@ namespace ActionManager {
/* Ardour specific */
extern void init ();
extern void load_menus ();
extern void load_menus (const std::string& menus_file_name); /* not path, just name */
extern std::vector<Glib::RefPtr<Gtk::Action> > session_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > write_sensitive_actions;

View file

@ -46,6 +46,7 @@ using namespace Gtkmm2ext;
using namespace std;
using namespace PBD;
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
std::vector<std::string> AddRouteDialog::channel_combo_strings;

View file

@ -33,7 +33,6 @@
#include "ardour/session.h"
#include "ardour_ui.h"
#include "utils.h"
#include "add_video_dialog.h"
#include "utils_videotl.h"
#include "i18n.h"
@ -66,6 +65,8 @@ AddVideoDialog::AddVideoDialog (Session* s)
, harvid_reset (_("Reload docroot"))
, harvid_list (ListStore::create(harvid_list_columns))
, harvid_list_view (harvid_list)
, show_advanced(false)
, loaded_docroot(false)
{
set_session (s);
set_name ("AddVideoDialog");
@ -77,43 +78,33 @@ AddVideoDialog::AddVideoDialog (Session* s)
harvid_initialized = false;
std::string dstdir = video_dest_dir(_session->session_directory().video_path(), video_get_docroot(Config));
if (Config->get_video_advanced_setup()) {
/* Harvid Browser */
harvid_list_view.append_column("", pixBufRenderer);
harvid_list_view.append_column(_("Filename"), harvid_list_columns.filename);
/* Harvid Browser */
harvid_list_view.append_column("", pixBufRenderer);
harvid_list_view.append_column(_("Filename"), harvid_list_columns.filename);
harvid_list_view.get_column(0)->set_alignment(0.5);
harvid_list_view.get_column(0)->add_attribute(pixBufRenderer, "stock-id", harvid_list_columns.id);
harvid_list_view.get_column(1)->set_expand(true);
harvid_list_view.get_column(1)->set_sort_column(harvid_list_columns.filename);
harvid_list_view.set_enable_search(true);
harvid_list_view.set_search_column(1);
harvid_list_view.get_column(0)->set_alignment(0.5);
harvid_list_view.get_column(0)->add_attribute(pixBufRenderer, "stock-id", harvid_list_columns.id);
harvid_list_view.get_column(1)->set_expand(true);
harvid_list_view.get_column(1)->set_sort_column(harvid_list_columns.filename);
harvid_list_view.set_enable_search(true);
harvid_list_view.set_search_column(1);
harvid_list_view.get_selection()->set_mode (SELECTION_SINGLE);
harvid_list_view.get_selection()->set_mode (SELECTION_SINGLE);
harvid_list_view.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &AddVideoDialog::harvid_list_view_selected));
harvid_list_view.signal_row_activated().connect (sigc::mem_fun (*this, &AddVideoDialog::harvid_list_view_activated));
harvid_list_view.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &AddVideoDialog::harvid_list_view_selected));
harvid_list_view.signal_row_activated().connect (sigc::mem_fun (*this, &AddVideoDialog::harvid_list_view_activated));
Gtk::ScrolledWindow *scroll = manage(new ScrolledWindow);
scroll->add(harvid_list_view);
scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
VBox* vbox = manage (new VBox);
Gtk::ScrolledWindow *scroll = manage(new ScrolledWindow);
scroll->add(harvid_list_view);
scroll->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
HBox* hbox = manage (new HBox);
harvid_path.set_alignment (0, 0.5);
hbox->pack_start (harvid_path, true, true);
hbox->pack_start (harvid_reset, false, false);
HBox* hbox = manage (new HBox);
harvid_path.set_alignment (0, 0.5);
hbox->pack_start (harvid_path, true, true);
hbox->pack_start (harvid_reset, false, false);
vbox->pack_start (*hbox, false, false);
vbox->pack_start (*scroll, true, true);
notebook.append_page (*vbox, _("VideoServerIndex"));
} else {
/* dummy entry */
VBox* vbox = manage (new VBox);
notebook.append_page (*vbox, _("VideoServerIndex"));
}
server_index_box.pack_start (*hbox, false, false);
server_index_box.pack_start (*scroll, true, true);
/* file chooser */
chooser.set_border_width (4);
@ -135,13 +126,7 @@ AddVideoDialog::AddVideoDialog (Session* s)
chooser.add_filter (matchall_filter);
chooser.set_select_multiple (false);
VBox* vboxfb = manage (new VBox);
vboxfb->pack_start (chooser, true, true, 0);
if (video_get_docroot(Config).size() > 0 &&
Config->get_video_advanced_setup()) {
notebook.append_page (*vboxfb, _("Browse Files"));
}
file_chooser_box.pack_start (chooser, true, true, 0);
/* Global Options*/
Gtk::Label* l;
@ -184,7 +169,7 @@ AddVideoDialog::AddVideoDialog (Session* s)
preview_image->set(imgbuf);
seek_slider.set_draw_value(false);
HBox* hbox = manage (new HBox);
hbox = manage (new HBox);
hbox->pack_start (*table, true, false);
Gtk::Alignment *al = manage(new Gtk::Alignment());
@ -195,20 +180,16 @@ AddVideoDialog::AddVideoDialog (Session* s)
previewpane->pack_start (*al, false, false);
previewpane->pack_start (*hbox, true, true, 6);
/* Overall layout */
/* Prepare Overall layout */
hbox = manage (new HBox);
if (Config->get_video_advanced_setup()) {
hbox->pack_start (notebook, true, true);
} else {
hbox->pack_start (*vboxfb, true, true);
}
hbox->pack_start (browser_container, true, true);
hbox->pack_start (*previewpane, false, false);
get_vbox()->set_spacing (4);
get_vbox()->pack_start (*hbox, true, true);
get_vbox()->pack_start (*options_box, false, false);
/* xjadeo checkbox */
if (ARDOUR_UI::instance()->video_timeline->found_xjadeo()
/* TODO xjadeo setup w/ xjremote */
@ -236,8 +217,6 @@ AddVideoDialog::AddVideoDialog (Session* s)
notebook.signal_switch_page().connect (sigc::hide_return (sigc::hide (sigc::hide (sigc::mem_fun (*this, &AddVideoDialog::page_switch)))));
seek_slider.signal_value_changed().connect(sigc::mem_fun(*this, &AddVideoDialog::seek_preview));
harvid_reset.signal_clicked().connect (sigc::mem_fun (*this, &AddVideoDialog::harvid_load_docroot));
show_all_children ();
}
AddVideoDialog::~AddVideoDialog ()
@ -247,6 +226,38 @@ AddVideoDialog::~AddVideoDialog ()
void
AddVideoDialog::on_show ()
{
/* overall layout depending on get_video_advanced_setup() and docroot */
for (int i = notebook.get_n_pages(); i > 0 ; --i) {
notebook.remove_page(i);
}
if (server_index_box.get_parent()) {
server_index_box.get_parent()->remove(server_index_box);
}
if (file_chooser_box.get_parent()) {
file_chooser_box.get_parent()->remove(file_chooser_box);
}
if (notebook.get_parent()) {
notebook.get_parent()->remove(notebook);
}
if (Config->get_video_advanced_setup()) {
notebook.append_page (server_index_box, _("VideoServerIndex"));
if (video_get_docroot(Config).size() > 0) {
notebook.append_page (file_chooser_box, _("Browse Files"));
}
browser_container.pack_start (notebook, true, true);
show_advanced = true;
if (!loaded_docroot) {
harvid_load_docroot();
}
} else {
browser_container.pack_start (file_chooser_box, true, true);
show_advanced = false;
loaded_docroot = false;
}
show_all_children ();
Dialog::on_show ();
}
@ -259,7 +270,8 @@ static bool check_video_file_extension(std::string file)
".ogv" , ".OGV" ,
".mpg" , ".MPG" ,
".mpeg" , ".MPEG" ,
".mts" , ".MTS" ,
".mts" , ".MTS" ,
".mov" , ".MOV" ,
".mp4" , ".MP4" ,
".mkv" , ".MKV" ,
".vob" , ".VOB" ,
@ -273,8 +285,8 @@ static bool check_video_file_extension(std::string file)
".dv" , ".DV" ,
".dirac" , ".DIRAC" ,
".webm" , ".WEBM" ,
".wmv" , ".wmv" ,
".ts" , ".ts" ,
".wmv" , ".WMV" ,
".ts" , ".TS" ,
};
for (size_t n = 0; n < sizeof(suffixes)/sizeof(suffixes[0]); ++n) {
@ -296,7 +308,7 @@ std::string
AddVideoDialog::file_name (bool &local_file)
{
int n = notebook.get_current_page ();
if (n == 1 || ! Config->get_video_advanced_setup()) {
if (n == 1 || !show_advanced) {
local_file = true;
return chooser.get_filename();
} else {
@ -316,6 +328,10 @@ AddVideoDialog::file_name (bool &local_file)
CURL *curl;
curl = curl_easy_init();
char *ue = curl_easy_unescape(curl, uri.c_str(), uri.length(), &plen);
#ifdef PLATFORM_WINDOWS
char *tmp;
while (tmp = strchr(ue, '/')) *tmp = '\\';
#endif
std::string path = video_get_docroot(Config) + ue;
if (!::access(path.c_str(), R_OK)) {
uri = path;
@ -332,7 +348,7 @@ enum VtlImportOption
AddVideoDialog::import_option ()
{
int n = notebook.get_current_page ();
if (n == 0 && Config->get_video_advanced_setup()) { return VTL_IMPORT_NONE; }
if (n == 0 && show_advanced) { return VTL_IMPORT_NONE; }
return VTL_IMPORT_TRANSCODE;
}
@ -451,6 +467,7 @@ AddVideoDialog::harvid_list_view_activated (const Gtk::TreeModel::Path& path, Gt
void
AddVideoDialog::harvid_load_docroot() {
set_action_ok(false);
loaded_docroot = true;
std::string video_server_url = video_get_server_url(Config);
char url[2048];
@ -463,7 +480,7 @@ AddVideoDialog::harvid_load_docroot() {
bool
AddVideoDialog::page_switch() {
if (notebook.get_current_page () == 1 || Config->get_video_advanced_setup()) {
if (notebook.get_current_page () == 1 || show_advanced) {
file_selection_changed();
return true;
}

View file

@ -22,6 +22,10 @@
#include <string>
#ifdef interface
#undef interface
#endif
#include <gtkmm.h>
#include "ardour/types.h"
@ -76,6 +80,10 @@ class AddVideoDialog : public ArdourDialog
Gtk::Notebook notebook;
Gtk::Button *ok_button;
Gtk::VBox server_index_box;
Gtk::VBox file_chooser_box;
Gtk::HBox browser_container;
/* Harvid Browser related */
class HarvidColumns : public Gtk::TreeModel::ColumnRecord
{
@ -104,6 +112,9 @@ class AddVideoDialog : public ArdourDialog
HarvidColumns harvid_list_columns;
Glib::RefPtr<Gtk::ListStore> harvid_list;
Gtk::TreeView harvid_list_view;
bool show_advanced;
bool loaded_docroot;
};
#endif /* __gtk_ardour_add_video_dialog_h__ */

View file

@ -374,6 +374,7 @@ AnalysisWindow::analyze_data (Gtk::Button * /*button*/)
free(buf);
free(mixbuf);
free(gain);
track_list_ready = true;
} /* end lock */

View file

@ -2,4 +2,12 @@
. `dirname "$0"`/../build/gtk2_ardour/ardev_common_waf.sh
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export ARDOUR_RUNNING_UNDER_VALGRIND=TRUE
exec valgrind --error-limit=no --num-callers=50 --tool=callgrind $TOP/$EXECUTABLE --novst "$@"
exec valgrind \
--error-limit=no --num-callers=50 \
--tool=callgrind \
--separate-callers=3 \
--separate-threads=yes \
--collect-systime=yes \
--collect-jumps=yes \
--instr-atstart=no \
$TOP/$EXECUTABLE --novst "$@"

View file

@ -2,4 +2,11 @@
. `dirname "$0"`/../build/gtk2_ardour/ardev_common_waf.sh
LD_LIBRARY_PATH=$LD_LIBRARY_PATH
export ARDOUR_INSIDE_GDB=1
exec gdb --args $TOP/$EXECUTABLE $@
if test -n "`which gdb`"; then
exec gdb --args $TOP/$EXECUTABLE $@
fi
if test -n "`which lldb`"; then
exec lldb -- $TOP/$EXECUTABLE $@
fi
echo "neither gdb nor lldb was found."

View file

@ -17,7 +17,7 @@ export ARDOUR_DATA_PATH=$TOP:$TOP/build:$TOP/gtk2_ardour:$TOP/build/gtk2_ardour:
export ARDOUR_MIDIMAPS_PATH=$TOP/midi_maps:.
export ARDOUR_MCP_PATH=$TOP/mcp:.
export ARDOUR_EXPORT_FORMATS_PATH=$TOP/export:.
export ARDOUR_BACKEND_PATH=$libs/backends/jack
export ARDOUR_BACKEND_PATH=$libs/backends/jack:$libs/backends/wavesaudio:$libs/backends/dummy:$libs/backends/alsa
export ARDOUR_TEST_PATH=$libs/ardour/test/data
#
@ -31,7 +31,7 @@ export ARDOUR_DLL_PATH=$libs
export GTK_PATH=~/.ardour3:$libs/clearlooks-newer
export VAMP_PATH=$libs/vamp-plugins${VAMP_PATH:+:$VAMP_PATH}
export LD_LIBRARY_PATH=$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/gnomecanvas:$libs/libsndfile:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/gnomecanvas:$libs/libsndfile:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc:$libs/canvas:$libs/ardouralsautil${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
# DYLD_LIBRARY_PATH is for darwin.
export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH

View file

@ -297,9 +297,6 @@
<menu action="LatchMenu">
<menuitem action='LatchedSolo'/>
</menu>
<menu action="Link">
<menuitem action='link-region-and-track-selection'/>
</menu>
<menu action='ZoomFocusMenu'>
<menuitem action='zoom-focus-playhead'/>
<menuitem action='zoom-focus-edit'/>

View file

@ -1,18 +1,4 @@
<ui>
<accelerator action='set-mouse-mode-object'/>
<accelerator action='set-mouse-mode-range'/>
<accelerator action='set-mouse-mode-gain'/>
<accelerator action='set-mouse-mode-draw'/>
<accelerator action='set-mouse-mode-zoom'/>
<accelerator action='set-mouse-mode-timefx'/>
<accelerator action='set-mouse-mode-object-range'/>
<accelerator action='toggle-internal-edit'/>
<accelerator action='focus-on-clock'/>
<accelerator action='track-solo-toggle'/>
<accelerator action='track-mute-toggle'/>
<accelerator action='toggle-edit-mode'/>
<accelerator action='toggle-midi-input-active'/>
<menubar name='Main' action='MainMenu'>
<menu name='Session' action='Session'>
<menuitem action='New'/>
@ -39,10 +25,11 @@
<menuitem action='CloseVideo'/>
<menu name='Export' action='Export'>
<menuitem action='ExportAudio'/>
<menuitem action='ExportAudio'/>
<menuitem action='StemExport'/>
<menuitem action='ExportVideo'/>
</menu>
<menuitem action='bring-into-session'/>
<menu name='Cleanup' action='Cleanup'>
<menuitem action='CleanupUnused'/>
<menuitem action='FlushWastebasket'/>
@ -53,6 +40,8 @@
<menuitem action='toggle-about'/>
<menuitem action='toggle-rc-options-editor'/>
#endif
<separator/>
<menuitem action='lock'/>
#ifndef GTKOSX
<separator/>
<menuitem action='Quit'/>
@ -73,6 +62,7 @@
<menuitem action='Record'/>
<menuitem action='ToggleRollMaybe'/>
<menuitem action='ToggleRollForgetCapture'/>
<menuitem action='toggle-skip-playback'/>
<menu action="SetLoopMenu">
<menuitem action='set-loop-from-edit-range'/>
<menuitem action='set-loop-from-region'/>
@ -125,13 +115,11 @@
<menuitem action='selected-marker-to-previous-region-boundary'/>
<menuitem action='edit-cursor-to-next-region-sync'/>
<menuitem action='edit-cursor-to-previous-region-sync'/>
<separator/>
<menuitem action='edit-to-playhead'/>
<menuitem action='set-edit-point'/>
</menu>
<menu action="MarkerMenu">
<menuitem action='add-location-from-playhead'/>
<menuitem action='remove-location-from-playhead'/>
<separator/>
<menuitem action='goto-mark-1'/>
<menuitem action='goto-mark-2'/>
@ -168,7 +156,8 @@
<menuitem action='editor-paste'/>
<separator/>
<menu action="SelectMenu">
<menuitem action='select-all'/>
<menuitem action='select-all-objects'/>
<menuitem action='select-all-tracks'/>
<menuitem action='deselect-all'/>
<menuitem action='invert-selection'/>
<menuitem action='select-all-after-edit-cursor'/>
@ -178,14 +167,13 @@
<menuitem action='select-all-in-punch-range'/>
<menuitem action='select-all-in-loop-range'/>
<separator/>
<menuitem action='select-range-between-cursors'/>
<menuitem action='move-range-start-to-previous-region-boundary'/>
<menuitem action='move-range-start-to-next-region-boundary'/>
<menuitem action='move-range-end-to-previous-region-boundary'/>
<menuitem action='move-range-end-to-next-region-boundary'/>
<separator/>
<menuitem action='start-range'/>
<menuitem action='finish-range'/>
<menuitem action='finish-add-range'/>
<separator/>
<menuitem action='select-next-route'/>
<menuitem action='select-prev-route'/>
@ -245,8 +233,6 @@
<menuitem action='combine-regions'/>
<menuitem action='uncombine-regions'/>
<menuitem action='analyze-region'/>
<menuitem action='toggle-opaque-region'/>
<menuitem action='toggle-region-mute'/>
<menuitem action='pitch-shift-region'/>
<menuitem action='split-region'/>
<menuitem action='split-multichannel-region'/>
@ -270,6 +256,8 @@
<menuitem action='show-region-list-editor'/>
</menu>
<menu action='RegionMenuGain'>
<menuitem action='toggle-opaque-region'/>
<menuitem action='toggle-region-mute'/>
<menuitem action='normalize-region'/>
<menuitem action='boost-region-gain'/>
<menuitem action='cut-region-gain'/>
@ -288,6 +276,7 @@
<menuitem action='nudge-backward'/>
<menuitem action='nudge-forward-by-capture-offset'/>
<menuitem action='nudge-backward-by-capture-offset'/>
<menuitem action='sequence-regions'/>
</menu>
<menu action='RegionMenuTrim'>
<menuitem action='trim-front'/>
@ -323,6 +312,11 @@
<menu action='TrackMenu'>
<menuitem action='AddTrackBus'/>
<separator/>
<menuitem action='track-record-enable-toggle'/>
<menuitem action='track-solo-toggle'/>
<menuitem action='track-mute-toggle'/>
<separator/>
<menuitem action='insert-time'/>
<menuitem action="move-selected-tracks-up"/>
<menuitem action="move-selected-tracks-down"/>
@ -334,8 +328,8 @@
<menuitem action='track-height-normal'/>
<menuitem action='track-height-small'/>
</menu>
<menuitem action='track-record-enable-toggle'/>
<menuitem action='toggle-track-active'/>
<separator/>
<menuitem action='toggle-track-active'/>
<menuitem action='remove-track'/>
</menu>
@ -347,6 +341,7 @@
<separator/>
<menu action="PrimaryClockMenu">
<menuitem action='focus-on-clock'/>
<menuitem action="primary-clock-timecode"/>
<menuitem action="primary-clock-bbt"/>
<menuitem action="primary-clock-minsec"/>
@ -367,6 +362,8 @@
<menuitem action='zoom-to-session'/>
<menuitem action='zoom-to-region'/>
<menuitem action='zoom-to-region-both-axes'/>
<menuitem action='zoom-to-range'/>
<menuitem action='zoom-to-range-both-axes'/>
<menuitem action='toggle-zoom'/>
<menuitem action='expand-tracks'/>
<menuitem action='shrink-tracks'/>
@ -489,6 +486,10 @@
<menuitem action='ToggleSummary'/>
<menuitem action='ToggleGroupTabs'/>
<menuitem action='show-marker-lines'/>
<separator/>
<menuitem action='show-ui-prefs'/>
</menu>
<menu action = 'WindowMenu'>
<menuitem action='toggle-audio-midi-setup'/>
@ -619,8 +620,6 @@
<menuitem action='uncombine-regions'/>
<menuitem action='split-region'/>
<menuitem action='split-multichannel-region'/>
<menuitem action='toggle-opaque-region'/>
<menuitem action='toggle-region-mute'/>
<menuitem action='pitch-shift-region'/>
<menuitem action='reverse-region'/>
<menuitem action='close-region-gaps'/>
@ -647,6 +646,7 @@
<menuitem action='nudge-backward'/>
<menuitem action='nudge-forward-by-capture-offset'/>
<menuitem action='nudge-backward-by-capture-offset'/>
<menuitem action='sequence-regions'/>
</menu>
<menu action='RegionMenuTrim'>
<menuitem action='trim-front'/>
@ -670,6 +670,8 @@
<menuitem action='set-selection-from-region'/>
</menu>
<menu action='RegionMenuGain'>
<menuitem action='toggle-opaque-region'/>
<menuitem action='toggle-region-mute'/>
<menuitem action='normalize-region'/>
<menuitem action='boost-region-gain'/>
<menuitem action='cut-region-gain'/>

View file

@ -5,9 +5,9 @@
# and does a few checks before exec'ing the real executable.
#
export GTK_PATH=@SYSCONFDIR@/ardour3:@LIBDIR@/ardour3${GTK_PATH:+:$GTK_PATH}
export GTK_PATH=@CONFDIR@:@LIBDIR@${GTK_PATH:+:$GTK_PATH}
export LD_LIBRARY_PATH=@LIBDIR@/ardour3${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=@LIBDIR@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
## Memlock check
@ -23,7 +23,7 @@ fi
## Glib atomic test
GLIB=$(ldd @LIBDIR@/ardour3/ardour-@VERSION@ 2> /dev/null | grep glib-2.0 | sed 's/.*=> \([^ ]*\) .*/\1/')
GLIB=$(ldd @LIBDIR@/ardour-@VERSION@ 2> /dev/null | grep glib-2.0 | sed 's/.*=> \([^ ]*\) .*/\1/')
if [ "$GLIB" = "" ]; then
echo "WARNING: Could not check your glib-2.0 for mutex locking atomic operations."
@ -43,15 +43,15 @@ fi
# Running Ardour requires these 3 variables to be set
#
export ARDOUR_DATA_PATH=@DATADIR@/ardour3
export ARDOUR_CONFIG_PATH=@SYSCONFDIR@/ardour3
export ARDOUR_DLL_PATH=@LIBDIR@/ardour3
export ARDOUR_DATA_PATH=@DATADIR@
export ARDOUR_CONFIG_PATH=@CONFDIR@
export ARDOUR_DLL_PATH=@LIBDIR@
#
# VAMP has its own lookup path
#
export VAMP_PATH=@LIBDIR@/ardour3/vamp
export VAMP_PATH=@LIBDIR@/vamp
if [ $# -gt 0 ] ; then
case $1 in
@ -59,6 +59,6 @@ if [ $# -gt 0 ] ; then
esac
fi
exec $GDB @LIBDIR@/ardour3/ardour-@VERSION@ "$@"
exec $GDB @LIBDIR@/ardour-@VERSION@ "$@"

File diff suppressed because it is too large Load diff

View file

@ -31,30 +31,32 @@
class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
{
public:
public:
enum Element {
Edge = 0x1,
Body = 0x2,
Text = 0x4,
Indicator = 0x8,
FlatFace = 0x10,
unused = 0x10,
Menu = 0x20,
Inactive = 0x40, // no _action is defined AND state is not used
RecButton = 0x80, // tentative, see commit message
RecTapeMode = 0x100, // tentative
CloseCross = 0x200, // tentative
};
static Element default_elements;
static Element led_default_elements;
static Element just_led_default_elements;
static void set_flat_buttons (bool yn);
static bool flat_buttons() { return _flat_buttons; }
ArdourButton (Element e = default_elements);
ArdourButton (const std::string&, Element e = default_elements);
virtual ~ArdourButton ();
enum Tweaks {
ShowClick = 0x1,
NoModel = 0x2,
ImplicitUsesSolidColor = 0x4,
Square = 0x1,
TrackHeader = 0x2,
unused3 = 0x4,
};
Tweaks tweaks() const { return _tweaks; }
@ -63,16 +65,16 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
void set_active_state (Gtkmm2ext::ActiveState);
void set_visual_state (Gtkmm2ext::VisualState);
void set_act_on_release (bool onRelease) { _act_on_release = onRelease; }
Element elements() const { return _elements; }
void set_elements (Element);
void add_elements (Element);
void set_corner_radius (float);
void set_rounded_corner_mask (int);
void set_diameter (float);
void set_text (const std::string&);
void set_markup (const std::string&);
const std::string& get_text () {return _text;}
void set_angle (const double);
void set_alignment (const float, const float);
void get_alignment (float& xa, float& ya) {xa = _xalign; ya = _yalign;};
@ -80,13 +82,14 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
void set_led_left (bool yn);
void set_distinct_led_click (bool yn);
Glib::RefPtr<Pango::Layout> layout() const { return _layout; }
void set_layout_ellisize_width (int w);
void set_text_ellipsize (Pango::EllipsizeMode);
sigc::signal<void> signal_led_clicked;
sigc::signal<void> signal_clicked;
boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
void set_controllable (boost::shared_ptr<PBD::Controllable> c);
void set_controllable (boost::shared_ptr<PBD::Controllable> c);
void watch ();
void set_related_action (Glib::RefPtr<Gtk::Action>);
@ -96,18 +99,31 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
void set_image (const Glib::RefPtr<Gdk::Pixbuf>&);
protected:
void render (cairo_t *);
void set_fixed_colors (const uint32_t active_color, const uint32_t inactive_color);
void set_fallthrough_to_parent(bool fall) { _fallthrough_to_parent = fall; }
unsigned int char_pixel_width() { if (_char_pixel_width < 1) recalc_char_pixel_geometry() ; return _char_pixel_width; }
unsigned int char_pixel_height() { if (_char_pixel_height < 1) recalc_char_pixel_geometry() ; return _char_pixel_height; }
float char_avg_pixel_width() { if (_char_pixel_width < 1) recalc_char_pixel_geometry() ; return _char_avg_pixel_width; }
protected:
void render (cairo_t *, cairo_rectangle_t *);
void on_size_request (Gtk::Requisition* req);
void on_size_allocate (Gtk::Allocation&);
void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
void on_name_changed ();
void on_realize ();
bool on_enter_notify_event (GdkEventCrossing*);
bool on_leave_notify_event (GdkEventCrossing*);
bool on_focus_in_event (GdkEventFocus*);
bool on_focus_out_event (GdkEventFocus*);
bool on_key_release_event (GdkEventKey *);
void controllable_changed ();
PBD::ScopedConnection watch_connection;
private:
protected:
Glib::RefPtr<Pango::Layout> _layout;
Glib::RefPtr<Gdk::Pixbuf> _pixbuf;
std::string _text;
@ -115,6 +131,11 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
Tweaks _tweaks;
BindingProxy binding_proxy;
void recalc_char_pixel_geometry ();
unsigned int _char_pixel_width;
unsigned int _char_pixel_height;
float _char_avg_pixel_width;
int _text_width;
int _text_height;
float _diameter;
@ -124,47 +145,39 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
double _angle;
float _xalign, _yalign;
uint32_t bg_color;
uint32_t border_color;
uint32_t fill_color_active;
uint32_t fill_color_inactive;
cairo_pattern_t* fill_pattern;
cairo_pattern_t* fill_pattern_active;
cairo_pattern_t* shine_pattern;
uint32_t fill_inactive_color;
uint32_t fill_active_color;
uint32_t text_active_color;
uint32_t text_inactive_color;
uint32_t led_active_color;
uint32_t led_inactive_color;
cairo_pattern_t* convex_pattern;
cairo_pattern_t* concave_pattern;
cairo_pattern_t* led_inset_pattern;
cairo_pattern_t* reflection_pattern;
cairo_rectangle_t* _led_rect;
double text_r;
double text_g;
double text_b;
double text_a;
double led_r;
double led_g;
double led_b;
double led_a;
double active_r;
double active_g;
double active_b;
double active_a;
bool _act_on_release;
bool _led_left;
bool _fixed_diameter;
bool _distinct_led_click;
bool _hovering;
static bool _flat_buttons;
bool _focused;
bool _fixed_colors_set;
bool _fallthrough_to_parent;
int _layout_ellipsize_width;
Pango::EllipsizeMode _ellipsis;
bool _update_colors;
int _pattern_height;
void setup_led_rect ();
void set_colors ();
void color_handler ();
void build_patterns ();
void ensure_layout ();
void action_toggled ();
void action_sensitivity_changed ();
void action_visibility_changed ();
void action_tooltip_changed ();

View file

@ -32,6 +32,7 @@
using namespace std;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace ARDOUR_UI_UTILS;
ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator)
: Dialog (title, modal, use_seperator)
@ -65,7 +66,10 @@ ArdourDialog::~ArdourDialog ()
bool
ArdourDialog::on_key_press_event (GdkEventKey* ev)
{
return relay_key_press (ev, this);
if (!relay_key_press (ev, this)) {
return Gtk::Window::on_key_press_event(ev);
}
return true;
}
bool

View file

@ -0,0 +1,147 @@
/*
Copyright (C) 2014 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 <iostream>
#include <cmath>
#include <algorithm>
#include <pangomm/layout.h>
#include "pbd/compose.h"
#include "pbd/error.h"
#include "pbd/stacktrace.h"
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/rgb_macros.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/keyboard.h"
#include "ardour/rc_configuration.h" // for widget prelight preference
#include "ardour_display.h"
#include "ardour_ui.h"
#include "global_signals.h"
#include "i18n.h"
using namespace Gtkmm2ext;
using namespace Gdk;
using namespace Gtk;
using namespace Glib;
using namespace PBD;
using std::max;
using std::min;
using namespace std;
ArdourDisplay::ArdourDisplay (Element e)
{
add_elements(e);
add_elements(ArdourButton::Menu);
add_elements(ArdourButton::Text);
}
ArdourDisplay::~ArdourDisplay ()
{
}
bool
ArdourDisplay::on_button_press_event (GdkEventButton*)
{
_menu.popup (1, gtk_get_current_event_time());
return true;
}
bool
ArdourDisplay::on_scroll_event (GdkEventScroll* ev)
{
/* mouse wheel */
float scale = 1.0;
if (ev->state & Keyboard::GainFineScaleModifier) {
if (ev->state & Keyboard::GainExtraFineScaleModifier) {
scale *= 0.01;
} else {
scale *= 0.10;
}
}
boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
if (c) {
float val = c->get_interface();
if ( ev->direction == GDK_SCROLL_UP )
val += 0.05 * scale; //by default, we step in 1/20ths of the knob travel
else
val -= 0.05 * scale;
c->set_interface(val);
}
return true;
}
void
ArdourDisplay::add_controllable_preset (const char *txt, float val)
{
using namespace Menu_Helpers;
MenuList& items = _menu.items ();
items.push_back (MenuElem (txt, sigc::bind (sigc::mem_fun(*this, &ArdourDisplay::handle_controllable_preset), val)));
}
void
ArdourDisplay::handle_controllable_preset (float p)
{
boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
if (!c) return;
c->set_user(p);
}
void
ArdourDisplay::set_controllable (boost::shared_ptr<Controllable> c)
{
watch_connection.disconnect (); //stop watching the old controllable
if (!c) return;
binding_proxy.set_controllable (c);
c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourDisplay::controllable_changed, this), gui_context());
controllable_changed();
}
void
ArdourDisplay::controllable_changed ()
{
boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
if (!c) return;
set_text(c->get_user_string());
set_dirty();
}

View file

@ -0,0 +1,62 @@
/*
Copyright (C) 2014 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 __gtk2_ardour_ardour_display_h__
#define __gtk2_ardour_ardour_display_h__
#include <list>
#include <stdint.h>
#include <gtkmm/action.h>
#include <gtkmm/menu.h>
#include <gtkmm/menuitem.h>
#include "ardour_button.h"
class ArdourDisplay : public ArdourButton
{
public:
ArdourDisplay (Element e = default_elements);
virtual ~ArdourDisplay ();
boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
void set_controllable (boost::shared_ptr<PBD::Controllable> c);
bool on_button_press_event (GdkEventButton*); //mousedown will pop up our preset menu
// bool on_button_press_event (GdkEventButton*);
// bool on_button_release_event (GdkEventButton*);
bool on_scroll_event (GdkEventScroll* ev);
// bool on_motion_notify_event (GdkEventMotion *ev) ;
void add_controllable_preset (const char*, float);
void handle_controllable_preset (float p);
void controllable_changed ();
PBD::ScopedConnection watch_connection;
private:
Gtk::Menu _menu;
bool _hovering;
bool _grabbed;
float _grabbed_y;
};
#endif /* __gtk2_ardour_ardour_menu_h__ */

View file

@ -0,0 +1,83 @@
/*
Copyright (C) 2014 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 <iostream>
#include <cmath>
#include <algorithm>
#include <pangomm/layout.h>
#include "pbd/compose.h"
#include "pbd/error.h"
#include "pbd/stacktrace.h"
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/rgb_macros.h"
#include "gtkmm2ext/gui_thread.h"
#include "ardour/rc_configuration.h" // for widget prelight preference
#include "ardour_dropdown.h"
#include "ardour_ui.h"
#include "global_signals.h"
#include "i18n.h"
#define REFLECTION_HEIGHT 2
using namespace Gdk;
using namespace Gtk;
using namespace Glib;
using namespace PBD;
using std::max;
using std::min;
using namespace std;
ArdourDropdown::ArdourDropdown (Element e)
{
// signal_button_press_event().connect (sigc::mem_fun(*this, &ArdourDropdown::on_mouse_pressed));
add_elements(e);
add_elements(ArdourButton::Menu);
}
ArdourDropdown::~ArdourDropdown ()
{
}
bool
ArdourDropdown::on_button_press_event (GdkEventButton*)
{
_menu.popup (1, gtk_get_current_event_time());
return true;
}
void
ArdourDropdown::AddMenuElem (Menu_Helpers::MenuElem e)
{
using namespace Menu_Helpers;
MenuList& items = _menu.items ();
items.push_back (e);
}

View file

@ -0,0 +1,47 @@
/*
Copyright (C) 2014 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 __gtk2_ardour_ardour_dropdown_h__
#define __gtk2_ardour_ardour_dropdown_h__
#include <list>
#include <stdint.h>
#include <gtkmm/action.h>
#include <gtkmm/menu.h>
#include <gtkmm/menuitem.h>
#include "ardour_button.h"
class ArdourDropdown : public ArdourButton
{
public:
ArdourDropdown (Element e = default_elements);
virtual ~ArdourDropdown ();
bool on_button_press_event (GdkEventButton*);
void AddMenuElem (Gtk::Menu_Helpers::MenuElem e);
private:
Gtk::Menu _menu;
};
#endif /* __gtk2_ardour_ardour_menu_h__ */

458
gtk2_ardour/ardour_knob.cc Normal file
View file

@ -0,0 +1,458 @@
/*
Copyright (C) 2010 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 <iostream>
#include <cmath>
#include <algorithm>
#include <pangomm/layout.h>
#include "pbd/compose.h"
#include "pbd/error.h"
#include "pbd/stacktrace.h"
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/rgb_macros.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/keyboard.h"
#include "ardour/rc_configuration.h" // for widget prelight preference
#include "ardour_knob.h"
#include "ardour_ui.h"
#include "global_signals.h"
#include "canvas/utils.h"
#include "i18n.h"
using namespace Gtkmm2ext;
using namespace Gdk;
using namespace Gtk;
using namespace Glib;
using namespace PBD;
using std::max;
using std::min;
using namespace std;
ArdourKnob::Element ArdourKnob::default_elements = ArdourKnob::Element (ArdourKnob::Arc);
ArdourKnob::ArdourKnob (Element e)
: _elements (e)
, _hovering (false)
{
ARDOUR_UI_UTILS::ColorsChanged.connect (sigc::mem_fun (*this, &ArdourKnob::color_handler));
}
ArdourKnob::~ArdourKnob()
{
}
void
ArdourKnob::render (cairo_t* cr, cairo_rectangle_t *)
{
cairo_pattern_t* shade_pattern;
float width = get_width();
float height = get_height();
const float scale = min(width, height);
const float pointer_thickness = 3.0 * (scale/80); //(if the knob is 80 pixels wide, we want a 3-pix line on it)
float start_angle = ((180 - 65) * G_PI) / 180;
float end_angle = ((360 + 65) * G_PI) / 180;
float value_angle = start_angle + (_val * (end_angle - start_angle));
float value_x = cos (value_angle);
float value_y = sin (value_angle);
float xc = 0.5 + width/ 2.0;
float yc = 0.5 + height/ 2.0;
cairo_translate (cr, xc, yc); //after this, everything is based on the center of the knob
//get the knob color from the theme
ArdourCanvas::Color knob_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1", get_name()));
float center_radius = 0.48*scale;
float border_width = 0.8;
bool arc = (_elements & Arc)==Arc;
bool bevel = (_elements & Bevel)==Bevel;
bool flat = _flat_buttons;
if ( arc ) {
center_radius = scale*0.30;
float inner_progress_radius = scale*0.30;
float outer_progress_radius = scale*0.48;
float progress_width = (outer_progress_radius-inner_progress_radius);
float progress_radius = inner_progress_radius + progress_width/2.0;
float start_angle_x = cos (start_angle);
float start_angle_y = sin (start_angle);
float end_angle_x = cos (end_angle);
float end_angle_y = sin (end_angle);
//dark arc background
cairo_set_source_rgb (cr, 0.3, 0.3, 0.3 );
cairo_set_line_width (cr, progress_width);
cairo_arc (cr, 0, 0, progress_radius, start_angle, end_angle);
cairo_stroke (cr);
//look up the arc colors from the config
double red_start, green_start, blue_start, unused;
ArdourCanvas::Color arc_start_color = ARDOUR_UI::config()->color_by_name ( string_compose ("%1: arc start", get_name()));
ArdourCanvas::color_to_rgba( arc_start_color, red_start, green_start, blue_start, unused );
double red_end, green_end, blue_end;
ArdourCanvas::Color arc_end_color = ARDOUR_UI::config()->color_by_name ( string_compose ("%1: arc end", get_name()) );
ArdourCanvas::color_to_rgba( arc_end_color, red_end, green_end, blue_end, unused );
//vary the arc color over the travel of the knob
float r = (1.0-_val) * red_end + _val * red_start;
float g = (1.0-_val) * green_end + _val * green_start;
float b = (1.0-_val) * blue_end + _val * blue_start;
//draw the arc
cairo_set_source_rgb (cr, r,g,b);
cairo_set_line_width (cr, progress_width);
cairo_arc (cr, 0, 0, progress_radius, start_angle, value_angle);
cairo_stroke (cr);
//shade the arc
if (!flat) {
shade_pattern = cairo_pattern_create_linear (0.0, -yc, 0.0, yc); //note we have to offset the pattern from our centerpoint
cairo_pattern_add_color_stop_rgba (shade_pattern, 0.0, 1,1,1, 0.15);
cairo_pattern_add_color_stop_rgba (shade_pattern, 0.5, 1,1,1, 0.0);
cairo_pattern_add_color_stop_rgba (shade_pattern, 1.0, 1,1,1, 0.0);
cairo_set_source (cr, shade_pattern);
cairo_arc (cr, 0, 0, outer_progress_radius-1, 0, 2.0*G_PI);
cairo_fill (cr);
cairo_pattern_destroy (shade_pattern);
}
//black border
cairo_set_source_rgb (cr, 0, 0, 0 );
cairo_set_line_width (cr, border_width);
cairo_move_to (cr, (outer_progress_radius * start_angle_x), (outer_progress_radius * start_angle_y));
cairo_line_to (cr, (inner_progress_radius * start_angle_x), (inner_progress_radius * start_angle_y));
cairo_stroke (cr);
cairo_move_to (cr, (outer_progress_radius * end_angle_x), (outer_progress_radius * end_angle_y));
cairo_line_to (cr, (inner_progress_radius * end_angle_x), (inner_progress_radius * end_angle_y));
cairo_stroke (cr);
cairo_arc (cr, 0, 0, outer_progress_radius, start_angle, end_angle);
cairo_stroke (cr);
}
if (!flat) {
//knob shadow
cairo_save(cr);
cairo_translate(cr, pointer_thickness+1, pointer_thickness+1 );
cairo_set_source_rgba (cr, 0, 0, 0, 0.1 );
cairo_arc (cr, 0, 0, center_radius-1, 0, 2.0*G_PI);
cairo_fill (cr);
cairo_restore(cr);
//inner circle
ArdourCanvas::set_source_rgba(cr, knob_color);
cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
cairo_fill (cr);
//gradient
if (bevel) {
//knob gradient
shade_pattern = cairo_pattern_create_linear (0.0, -yc, 0.0, yc); //note we have to offset the gradient from our centerpoint
cairo_pattern_add_color_stop_rgba (shade_pattern, 0.0, 1,1,1, 0.2);
cairo_pattern_add_color_stop_rgba (shade_pattern, 0.2, 1,1,1, 0.2);
cairo_pattern_add_color_stop_rgba (shade_pattern, 0.8, 0,0,0, 0.2);
cairo_pattern_add_color_stop_rgba (shade_pattern, 1.0, 0,0,0, 0.2);
cairo_set_source (cr, shade_pattern);
cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
cairo_fill (cr);
cairo_pattern_destroy (shade_pattern);
//flat top over beveled edge
ArdourCanvas::set_source_rgb_a (cr, knob_color, 0.5 );
cairo_arc (cr, 0, 0, center_radius-pointer_thickness, 0, 2.0*G_PI);
cairo_fill (cr);
} else {
//radial gradient
shade_pattern = cairo_pattern_create_radial ( -center_radius, -center_radius, 1, -center_radius, -center_radius, center_radius*2.5 ); //note we have to offset the gradient from our centerpoint
cairo_pattern_add_color_stop_rgba (shade_pattern, 0.0, 1,1,1, 0.2);
cairo_pattern_add_color_stop_rgba (shade_pattern, 1.0, 0,0,0, 0.3);
cairo_set_source (cr, shade_pattern);
cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
cairo_fill (cr);
cairo_pattern_destroy (shade_pattern);
}
} else {
//inner circle
ArdourCanvas::set_source_rgba(cr, knob_color);
cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
cairo_fill (cr);
}
//black knob border
cairo_set_line_width (cr, border_width);
cairo_set_source_rgba (cr, 0,0,0, 1 );
cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
cairo_stroke (cr);
//line shadow
if (!flat) {
cairo_save(cr);
cairo_translate(cr, 1, 1 );
cairo_set_source_rgba (cr, 0,0,0,0.3 );
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_width (cr, pointer_thickness);
cairo_move_to (cr, (center_radius * value_x), (center_radius * value_y));
cairo_line_to (cr, ((center_radius*0.4) * value_x), ((center_radius*0.4) * value_y));
cairo_stroke (cr);
cairo_restore(cr);
}
//line
cairo_set_source_rgba (cr, 1,1,1, 1 );
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_width (cr, pointer_thickness);
cairo_move_to (cr, (center_radius * value_x), (center_radius * value_y));
cairo_line_to (cr, ((center_radius*0.4) * value_x), ((center_radius*0.4) * value_y));
cairo_stroke (cr);
//highlight if grabbed or if mouse is hovering over me
if ( _grabbed || (_hovering && ARDOUR::Config->get_widget_prelight() ) ) {
cairo_set_source_rgba (cr, 1,1,1, 0.12 );
cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
cairo_fill (cr);
}
cairo_identity_matrix(cr);
}
void
ArdourKnob::on_size_request (Gtk::Requisition* req)
{
CairoWidget::on_size_request (req);
//perhaps render the knob base into a cached image here?
}
bool
ArdourKnob::on_scroll_event (GdkEventScroll* ev)
{
/* mouse wheel */
float scale = 0.05; //by default, we step in 1/20ths of the knob travel
if (ev->state & Keyboard::GainFineScaleModifier) {
if (ev->state & Keyboard::GainExtraFineScaleModifier) {
scale *= 0.01;
} else {
scale *= 0.10;
}
}
boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
if (c) {
float val = c->get_interface();
if ( ev->direction == GDK_SCROLL_UP )
val += scale;
else
val -= scale;
c->set_interface(val);
}
return true;
}
bool
ArdourKnob::on_motion_notify_event (GdkEventMotion *ev)
{
//scale the adjustment based on keyboard modifiers
float scale = 0.0025;
if (ev->state & Keyboard::GainFineScaleModifier) {
if (ev->state & Keyboard::GainExtraFineScaleModifier) {
scale *= 0.01;
} else {
scale *= 0.10;
}
}
//calculate the travel of the mouse
int y_delta = 0;
if (ev->state & Gdk::BUTTON1_MASK) {
y_delta = _grabbed_y - ev->y;
_grabbed_y = ev->y;
if (y_delta == 0) return TRUE;
}
//step the value of the controllable
boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
if (c) {
float val = c->get_interface();
val += y_delta * scale;
c->set_interface(val);
}
return true;
}
bool
ArdourKnob::on_button_press_event (GdkEventButton *ev)
{
_grabbed_y = ev->y;
_grabbed = true;
set_active_state (Gtkmm2ext::ExplicitActive);
if (binding_proxy.button_press_handler (ev)) {
return true;
}
return false;
}
bool
ArdourKnob::on_button_release_event (GdkEventButton *ev)
{
if ( (_grabbed_y == ev->y) && Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { //no move, shift-click sets to default
boost::shared_ptr<PBD::Controllable> c = binding_proxy.get_controllable();
if (!c) return false;
c->set_value (c->normal());
return true;
}
_grabbed = false;
unset_active_state ();
return false;
}
void
ArdourKnob::color_handler ()
{
set_dirty ();
}
void
ArdourKnob::on_size_allocate (Allocation& alloc)
{
CairoWidget::on_size_allocate (alloc);
}
void
ArdourKnob::set_controllable (boost::shared_ptr<Controllable> c)
{
watch_connection.disconnect (); //stop watching the old controllable
if (!c) return;
binding_proxy.set_controllable (c);
c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourKnob::controllable_changed, this), gui_context());
controllable_changed();
}
void
ArdourKnob::controllable_changed ()
{
_val = binding_proxy.get_controllable()->get_interface(); //% of knob travel
_val = min( max(0.0f, _val), 1.0f); //range check
set_dirty();
}
void
ArdourKnob::on_style_changed (const RefPtr<Gtk::Style>&)
{
set_dirty ();
}
void
ArdourKnob::on_name_changed ()
{
set_dirty ();
}
void
ArdourKnob::set_active_state (Gtkmm2ext::ActiveState s)
{
if (_active_state != s)
CairoWidget::set_active_state (s);
}
void
ArdourKnob::set_visual_state (Gtkmm2ext::VisualState s)
{
if (_visual_state != s)
CairoWidget::set_visual_state (s);
}
bool
ArdourKnob::on_focus_in_event (GdkEventFocus* ev)
{
set_dirty ();
return CairoWidget::on_focus_in_event (ev);
}
bool
ArdourKnob::on_focus_out_event (GdkEventFocus* ev)
{
set_dirty ();
return CairoWidget::on_focus_out_event (ev);
}
bool
ArdourKnob::on_enter_notify_event (GdkEventCrossing* ev)
{
_hovering = true;
set_dirty ();
return CairoWidget::on_enter_notify_event (ev);
}
bool
ArdourKnob::on_leave_notify_event (GdkEventCrossing* ev)
{
_hovering = false;
set_dirty ();
return CairoWidget::on_leave_notify_event (ev);
}
void
ArdourKnob::set_elements (Element e)
{
_elements = e;
}
void
ArdourKnob::add_elements (Element e)
{
_elements = (ArdourKnob::Element) (_elements | e);
}

96
gtk2_ardour/ardour_knob.h Normal file
View file

@ -0,0 +1,96 @@
/*
Copyright (C) 2014 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 __gtk2_ardour_ardour_knob_h__
#define __gtk2_ardour_ardour_knob_h__
#include <list>
#include <stdint.h>
#include <gtkmm/action.h>
#include "pbd/signals.h"
#include "gtkmm2ext/binding_proxy.h"
#include "gtkmm2ext/activatable.h"
#include "gtkmm2ext/cairo_widget.h"
class ArdourKnob : public CairoWidget , public Gtkmm2ext::Activatable
{
public:
enum Element {
Arc = 0x1,
Bevel = 0x2,
unused2 = 0x4,
unused3 = 0x8,
unused4 = 0x10,
unused5 = 0x20,
};
ArdourKnob (Element e = default_elements);
virtual ~ArdourKnob ();
void set_active_state (Gtkmm2ext::ActiveState);
void set_visual_state (Gtkmm2ext::VisualState);
Element elements() const { return _elements; }
void set_elements (Element);
void add_elements (Element);
static Element default_elements;
boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
void set_controllable (boost::shared_ptr<PBD::Controllable> c);
bool on_button_press_event (GdkEventButton*);
bool on_button_release_event (GdkEventButton*);
bool on_scroll_event (GdkEventScroll* ev);
bool on_motion_notify_event (GdkEventMotion *ev) ;
void color_handler ();
protected:
void render (cairo_t *, cairo_rectangle_t *);
void on_size_request (Gtk::Requisition* req);
void on_size_allocate (Gtk::Allocation&);
void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
void on_name_changed ();
bool on_enter_notify_event (GdkEventCrossing*);
bool on_leave_notify_event (GdkEventCrossing*);
bool on_focus_in_event (GdkEventFocus*);
bool on_focus_out_event (GdkEventFocus*);
void controllable_changed ();
PBD::ScopedConnection watch_connection;
private:
Element _elements;
BindingProxy binding_proxy;
bool _hovering;
float _grabbed_y;
float _val; //percent of knob travel
void action_sensitivity_changed ();
void action_visibility_changed ();
void action_tooltip_changed ();
};
#endif /* __gtk2_ardour_ardour_knob_h__ */

View file

@ -19,6 +19,7 @@
#ifdef WAF_BUILD
#include "gtk2ardour-config.h"
#include "gtk2ardour-version.h"
#endif
#include <algorithm>
@ -27,15 +28,18 @@
#include <cerrno>
#include <fstream>
#ifndef PLATFORM_WINDOWS
#include <sys/resource.h>
#endif
#include <stdint.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <time.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <gtkmm/messagedialog.h>
#include <gtkmm/accelmap.h>
@ -47,7 +51,10 @@
#include "pbd/enumwriter.h"
#include "pbd/memento_command.h"
#include "pbd/openuri.h"
#include "pbd/stl_delete.h"
#include "pbd/file_utils.h"
#include "pbd/localtime_r.h"
#include "pbd/pthread_utils.h"
#include "gtkmm2ext/application.h"
#include "gtkmm2ext/bindings.h"
@ -67,6 +74,7 @@
#include "ardour/filename_extensions.h"
#include "ardour/filesystem_paths.h"
#include "ardour/port.h"
#include "ardour/plugin_manager.h"
#include "ardour/process_thread.h"
#include "ardour/profile.h"
#include "ardour/recent_sessions.h"
@ -75,6 +83,11 @@
#include "ardour/session_state_utils.h"
#include "ardour/session_utils.h"
#include "ardour/slave.h"
#include "ardour/system_exec.h"
#ifdef WINDOWS_VST_SUPPORT
#include <fst.h>
#endif
#include "timecode/time.h"
@ -123,11 +136,11 @@ typedef uint64_t microseconds_t;
#include "video_server_dialog.h"
#include "add_video_dialog.h"
#include "transcode_video_dialog.h"
#include "system_exec.h"
#include "i18n.h"
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
using namespace PBD;
using namespace Gtkmm2ext;
using namespace Gtk;
@ -139,6 +152,7 @@ UIConfiguration *ARDOUR_UI::ui_config = 0;
sigc::signal<void,bool> ARDOUR_UI::Blink;
sigc::signal<void> ARDOUR_UI::RapidScreenUpdate;
sigc::signal<void> ARDOUR_UI::SuperRapidScreenUpdate;
sigc::signal<void> ARDOUR_UI::FPSUpdate;
sigc::signal<void, framepos_t, bool, framepos_t> ARDOUR_UI::Clock;
sigc::signal<void> ARDOUR_UI::CloseAllDialogs;
@ -178,9 +192,9 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, follow_edits_button (ArdourButton::led_default_elements)
, auto_input_button (ArdourButton::led_default_elements)
, auditioning_alert_button (_("audition"))
, solo_alert_button (_("solo"))
, feedback_alert_button (_("feedback"))
, auditioning_alert_button (_("Audition"))
, solo_alert_button (_("Solo"))
, feedback_alert_button (_("Feedback"))
, editor_meter(0)
, editor_meter_peak_display()
@ -210,12 +224,18 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
splash = 0;
_numpad_locate_happening = false;
if (theArdourUI == 0) {
theArdourUI = this;
}
ui_config = new UIConfiguration();
ui_config->ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed));
boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
ui_config->map_parameters (pc);
editor = 0;
mixer = 0;
meterbridge = 0;
@ -247,10 +267,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
rec_button.set_name ("transport recenable button");
midi_panic_button.set_name ("transport button");
goto_start_button.set_tweaks (ArdourButton::ShowClick);
goto_end_button.set_tweaks (ArdourButton::ShowClick);
midi_panic_button.set_tweaks (ArdourButton::ShowClick);
last_configure_time= 0;
last_peak_grab = 0;
@ -290,7 +306,16 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
/* and ambiguous files */
ARDOUR::FileSource::AmbiguousFileName.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::ambiguous_file, this, _1, _2, _3));
ARDOUR::FileSource::AmbiguousFileName.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::ambiguous_file, this, _1, _2));
/* also plugin scan messages */
ARDOUR::PluginScanMessage.connect (forever_connections, MISSING_INVALIDATOR, boost::bind(&ARDOUR_UI::plugin_scan_dialog, this, _1, _2, _3), gui_context());
ARDOUR::PluginScanTimeout.connect (forever_connections, MISSING_INVALIDATOR, boost::bind(&ARDOUR_UI::plugin_scan_timeout, this, _1), gui_context());
ARDOUR::GUIIdle.connect (forever_connections, MISSING_INVALIDATOR, boost::bind(&ARDOUR_UI::gui_idle_handler, this), gui_context());
Config->ParameterChanged.connect ( forever_connections, MISSING_INVALIDATOR, boost::bind(&ARDOUR_UI::set_flat_buttons, this), gui_context() );
set_flat_buttons();
/* lets get this party started */
@ -469,8 +494,6 @@ ARDOUR_UI::post_engine ()
_tooltips.enable();
ActionManager::load_menus ();
if (setup_windows ()) {
throw failed_constructor ();
}
@ -531,9 +554,12 @@ ARDOUR_UI::post_engine ()
Glib::signal_timeout().connect_seconds (sigc::mem_fun(*this, &ARDOUR_UI::update_wall_clock), 1);
#endif
Config->ParameterChanged.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::parameter_changed, this, _1), gui_context());
boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
Config->map_parameters (pc);
{
DisplaySuspender ds;
Config->ParameterChanged.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::parameter_changed, this, _1), gui_context());
boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
Config->map_parameters (pc);
}
}
ARDOUR_UI::~ARDOUR_UI ()
@ -542,12 +568,17 @@ ARDOUR_UI::~ARDOUR_UI ()
ui_config->save_state();
}
delete keyboard;
delete editor;
delete mixer;
delete meterbridge;
stop_video_server();
if (getenv ("ARDOUR_RUNNING_UNDER_VALGRIND")) {
// don't bother at 'real' exit. the OS cleans up for us.
delete big_clock;
delete primary_clock;
delete secondary_clock;
delete _process_thread;
delete gui_object_state;
FastMeter::flush_pattern_cache ();
}
}
void
@ -741,6 +772,7 @@ ARDOUR_UI::starting ()
try {
audio_midi_setup.get (true);
} catch (...) {
std::cerr << "audio-midi engine setup failed."<< std::endl;
return -1;
}
@ -753,7 +785,8 @@ ARDOUR_UI::starting ()
// wait for announce reply from nsm server
for ( i = 0; i < 5000; ++i) {
nsm->check ();
usleep (i);
Glib::usleep (i);
if (nsm->is_active()) {
break;
}
@ -765,7 +798,7 @@ ARDOUR_UI::starting ()
// wait for open command from nsm server
for ( i = 0; i < 5000; ++i) {
nsm->check ();
usleep (1000);
Glib::usleep (1000);
if (nsm->client_id ()) {
break;
}
@ -826,6 +859,7 @@ ARDOUR_UI::starting ()
const bool new_session_required = (ARDOUR_COMMAND_LINE::new_session || brand_new_user);
if (get_session_parameters (false, new_session_required, ARDOUR_COMMAND_LINE::load_template)) {
std::cerr << "Cannot get session parameters."<< std::endl;
return -1;
}
}
@ -848,7 +882,7 @@ ARDOUR_UI::starting ()
void
ARDOUR_UI::check_memory_locking ()
{
#ifdef __APPLE__
#if defined(__APPLE__) || defined(PLATFORM_WINDOWS)
/* OS X doesn't support mlockall(2), and so testing for memory locking capability there is pointless */
return;
#else // !__APPLE__
@ -973,6 +1007,7 @@ If you still wish to quit, please use the\n\n\
second_connection.disconnect ();
point_one_second_connection.disconnect ();
point_zero_something_second_connection.disconnect();
fps_connection.disconnect();
}
delete ARDOUR_UI::instance()->video_timeline;
@ -987,8 +1022,6 @@ If you still wish to quit, please use the\n\n\
close_all_dialogs ();
loading_message (string_compose (_("Please wait while %1 cleans up..."), PROGRAM_NAME));
if (_session) {
// _session->set_deletion_in_progress ();
_session->set_clean ();
@ -999,6 +1032,9 @@ If you still wish to quit, please use the\n\n\
halt_connection.disconnect ();
AudioEngine::instance()->stop ();
#ifdef WINDOWS_VST_SUPPORT
fst_stop_threading();
#endif
quit ();
}
@ -1112,14 +1148,42 @@ ARDOUR_UI::every_point_zero_something_seconds ()
float mpeak = editor_meter->update_meters();
if (mpeak > editor_meter_max_peak) {
if (mpeak >= Config->get_meter_peak()) {
editor_meter_peak_display.set_name ("meterbridge peakindicator on");
editor_meter_peak_display.set_elements((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body));
editor_meter_peak_display.set_active_state ( Gtkmm2ext::ExplicitActive );
}
}
}
return TRUE;
}
gint
ARDOUR_UI::every_fps ()
{
FPSUpdate(); /* EMIT_SIGNAL */
return TRUE;
}
void
ARDOUR_UI::set_fps_timeout_connection ()
{
unsigned int interval = 40;
if (!_session) return;
if (_session->timecode_frames_per_second() != 0) {
/* ideally we'll use a select() to sleep and not accumulate
* idle time to provide a regular periodic signal.
* See linux_vst_gui_support.cc 'elapsed_time_ms'.
* However, that'll require a dedicated thread and cross-thread
* signals to the GUI Thread..
*/
interval = floor(500. /* update twice per FPS, since Glib::signal_timeout is very irregular */
* _session->frame_rate() / _session->nominal_frame_rate()
/ _session->timecode_frames_per_second()
);
interval = std::max(8u, interval); // at most 120Hz.
}
fps_connection.disconnect();
fps_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ARDOUR_UI::every_fps), interval);
}
void
ARDOUR_UI::update_sample_rate (framecnt_t)
{
@ -1397,7 +1461,7 @@ ARDOUR_UI::redisplay_recent_sessions ()
get_state_files_in_directory (*i, state_file_paths);
vector<string*>* states;
vector<string> states;
vector<const gchar*> item;
string fullpath = *i;
@ -1414,8 +1478,9 @@ ARDOUR_UI::redisplay_recent_sessions ()
}
/* now get available states for this session */
states = Session::possible_states (fullpath);
if ((states = Session::possible_states (fullpath)) == 0) {
if (states.empty()) {
/* no state file? */
continue;
}
@ -1424,14 +1489,14 @@ ARDOUR_UI::redisplay_recent_sessions ()
Gtk::TreeModel::Row row = *(recent_session_model->append());
row[recent_session_columns.visible_name] = Glib::path_get_basename (fullpath);
row[recent_session_columns.fullpath] = fullpath;
row[recent_session_columns.tip] = Glib::Markup::escape_text (fullpath);
if (state_file_names.size() > 1) {
// multiple session files in the session directory - show the directory name.
row[recent_session_columns.visible_name] = Glib::path_get_basename (fullpath);
// add the children
for (std::vector<std::string>::iterator i2 = state_file_names.begin();
i2 != state_file_names.end(); ++i2)
{
@ -1442,6 +1507,9 @@ ARDOUR_UI::redisplay_recent_sessions ()
child_row[recent_session_columns.fullpath] = fullpath;
child_row[recent_session_columns.tip] = Glib::Markup::escape_text (fullpath);
}
} else {
// only a single session file in the directory - show its actual name.
row[recent_session_columns.visible_name] = state_file_names.front ();
}
}
@ -1640,10 +1708,10 @@ ARDOUR_UI::session_add_mixed_track (const ChanCount& input, const ChanCount& out
catch (...) {
MessageDialog msg (*editor,
string_compose (_("There are insufficient JACK ports available\n\
string_compose (_("There are insufficient ports available\n\
to create a new track or bus.\n\
You should save %1, exit and\n\
restart JACK with more ports."), PROGRAM_NAME));
restart with more ports."), PROGRAM_NAME));
msg.run ();
}
}
@ -1701,10 +1769,10 @@ ARDOUR_UI::session_add_audio_route (
catch (...) {
MessageDialog msg (*editor,
string_compose (_("There are insufficient JACK ports available\n\
string_compose (_("There are insufficient ports available\n\
to create a new track or bus.\n\
You should save %1, exit and\n\
restart JACK with more ports."), PROGRAM_NAME));
restart with more ports."), PROGRAM_NAME));
pop_back_splash (msg);
msg.run ();
}
@ -1809,10 +1877,39 @@ ARDOUR_UI::transport_stop ()
_session->request_stop (false, true);
}
/** Check if any tracks are record enabled. If none are, record enable all of them.
* @return true if track record-enabled status was changed, false otherwise.
*/
bool
ARDOUR_UI::trx_record_enable_all_tracks ()
{
if (!_session) {
return false;
}
boost::shared_ptr<RouteList> rl = _session->get_tracks ();
bool none_record_enabled = true;
for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> (*r);
assert (t);
if (t->record_enabled()) {
none_record_enabled = false;
break;
}
}
if (none_record_enabled) {
_session->set_record_enabled (rl, true, Session::rt_cleanup);
}
return none_record_enabled;
}
void
ARDOUR_UI::transport_record (bool roll)
{
if (_session) {
switch (_session->record_status()) {
case Session::Disabled:
@ -1821,6 +1918,9 @@ ARDOUR_UI::transport_record (bool roll)
msg.run ();
return;
}
if (Profile->get_trx()) {
roll = trx_record_enable_all_tracks ();
}
_session->maybe_enable_record ();
if (roll) {
transport_roll ();
@ -1866,13 +1966,26 @@ ARDOUR_UI::transport_roll ()
bool rolling = _session->transport_rolling();
if (_session->get_play_loop()) {
/* XXX it is not possible to just leave seamless loop and keep
playing at present (nov 4th 2009)
/* If loop playback is not a mode, then we should cancel
it when this action is requested. If it is a mode
we just leave it in place.
*/
if (!Config->get_seamless_loop()) {
_session->request_play_loop (false, true);
if (!Config->get_loop_is_mode()) {
/* XXX it is not possible to just leave seamless loop and keep
playing at present (nov 4th 2009)
*/
if (!Config->get_seamless_loop()) {
/* stop loop playback and stop rolling */
_session->request_play_loop (false, true);
} else if (rolling) {
/* stop loop playback but keep rolling */
_session->request_play_loop (false, false);
}
}
} else if (_session->get_play_range () && !Config->get_always_play_range()) {
} else if (_session->get_play_range () ) {
/* stop playing a range if we currently are */
_session->request_play_range (0, true);
}
@ -1928,7 +2041,7 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
/* disk buffers are normal, so we can keep playing */
affect_transport = false;
}
_session->request_play_loop (false, true);
_session->request_play_loop (false, affect_transport);
} else if (_session->get_play_range ()) {
affect_transport = false;
_session->request_play_range (0, true);
@ -1939,10 +2052,10 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode)
if (rolling) {
_session->request_stop (with_abort, true);
} else {
if ( Config->get_always_play_range() ) {
if ( Config->get_follow_edits() && ( editor->get_selection().time.front().start == _session->transport_frame() ) ) { //if playhead is exactly at the start of a range, we can assume it was placed there by follow_edits
_session->request_play_range (&editor->get_selection().time, true);
_session->set_requested_return_frame( editor->get_selection().time.front().start ); //force an auto-return here
}
_session->request_transport_speed (1.0f);
}
}
@ -1959,16 +2072,23 @@ ARDOUR_UI::toggle_session_auto_loop ()
if (_session->get_play_loop()) {
if (_session->transport_rolling()) {
/* looping enabled, our job is to disable it */
_session->request_locate (looploc->start(), true);
_session->request_play_loop (false);
_session->request_play_loop (false);
} else {
_session->request_play_loop (false);
}
} else {
_session->request_play_loop (true);
/* looping not enabled, our job is to enable it.
loop-is-NOT-mode: this action always starts the transport rolling.
loop-IS-mode: this action simply sets the loop play mechanism, but
does not start transport.
*/
if (Config->get_loop_is_mode()) {
_session->request_play_loop (true, false);
} else {
_session->request_play_loop (true, true);
}
}
//show the loop markers
@ -2096,7 +2216,11 @@ ARDOUR_UI::map_transport_state ()
auto_loop_button.set_active (true);
play_selection_button.set_active (false);
roll_button.set_active (false);
if (Config->get_loop_is_mode()) {
roll_button.set_active (true);
} else {
roll_button.set_active (false);
}
} else {
@ -2105,7 +2229,7 @@ ARDOUR_UI::map_transport_state ()
auto_loop_button.set_active (false);
}
if (Config->get_always_play_range()) {
if (Config->get_follow_edits()) {
/* light up both roll and play-selection if they are joined */
roll_button.set_active (true);
play_selection_button.set_active (true);
@ -2118,7 +2242,11 @@ ARDOUR_UI::map_transport_state ()
stop_button.set_active (true);
roll_button.set_active (false);
play_selection_button.set_active (false);
auto_loop_button.set_active (false);
if (Config->get_loop_is_mode ()) {
auto_loop_button.set_active (_session->get_play_loop());
} else {
auto_loop_button.set_active (false);
}
update_disk_space ();
}
}
@ -2135,7 +2263,7 @@ void
ARDOUR_UI::start_clocking ()
{
if (Config->get_super_rapid_clock_update()) {
clock_signal_connection = SuperRapidScreenUpdate.connect (sigc::mem_fun(*this, &ARDOUR_UI::update_clocks));
clock_signal_connection = FPSUpdate.connect (sigc::mem_fun(*this, &ARDOUR_UI::update_clocks));
} else {
clock_signal_connection = RapidScreenUpdate.connect (sigc::mem_fun(*this, &ARDOUR_UI::update_clocks));
}
@ -2397,7 +2525,7 @@ ARDOUR_UI::transport_rec_enable_blink (bool onoff)
if (onoff) {
rec_button.set_active_state (Gtkmm2ext::ExplicitActive);
} else {
rec_button.set_active_state (Gtkmm2ext::ImplicitActive);
rec_button.set_active_state (Gtkmm2ext::Off);
}
} else if (r == Session::Recording && h) {
rec_button.set_active_state (Gtkmm2ext::ExplicitActive);
@ -2634,6 +2762,13 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
break;
default:
if (quit_on_cancel) {
// JE - Currently (July 2014) this section can only get reached if the
// user quits from the main 'Session Setup' dialog (i.e. reaching this
// point does NOT indicate an abnormal termination). Therefore, let's
// behave gracefully (i.e. let's do some cleanup) before we call exit()
ARDOUR::cleanup ();
pthread_cancel_all ();
exit (1);
} else {
return ret;
@ -2907,7 +3042,15 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
_session->set_clean ();
}
#ifdef WINDOWS_VST_SUPPORT
fst_stop_threading();
#endif
flush_pending ();
#ifdef WINDOWS_VST_SUPPORT
fst_start_threading();
#endif
retval = 0;
out:
@ -3102,13 +3245,13 @@ require some unused files to continue to exist."));
space_adjusted = rep.space;
} else if (rep.space < 1000000) {
bprefix = _("kilo");
space_adjusted = truncf((float)rep.space / 1000.0);
space_adjusted = floorf((float)rep.space / 1000.0);
} else if (rep.space < 1000000 * 1000) {
bprefix = _("mega");
space_adjusted = truncf((float)rep.space / (1000.0 * 1000.0));
space_adjusted = floorf((float)rep.space / (1000.0 * 1000.0));
} else {
bprefix = _("giga");
space_adjusted = truncf((float)rep.space / (1000.0 * 1000 * 1000.0));
space_adjusted = floorf((float)rep.space / (1000.0 * 1000 * 1000.0));
}
if (msg_delete) {
@ -3332,13 +3475,8 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
setup_order_hint();
PBD::ScopedConnection idle_connection;
if (count > 8) {
ARDOUR::GUIIdle.connect (idle_connection, MISSING_INVALIDATOR, boost::bind (&Gtkmm2ext::UI::flush_pending, this), gui_context());
}
string template_path = add_route_dialog->track_template();
DisplaySuspender ds;
if (!template_path.empty()) {
if (add_route_dialog->name_template_is_default()) {
@ -3379,15 +3517,13 @@ ARDOUR_UI::add_route (Gtk::Window* float_window)
session_add_audio_bus (input_chan.n_audio(), output_chan.n_audio(), route_group, count, name_template);
break;
}
/* idle connection will end at scope end */
}
void
ARDOUR_UI::stop_video_server (bool ask_confirm)
{
if (!video_server_process && ask_confirm) {
warning << _("Video-Server was not launched by Ardour. The request to stop it is ignored.") << endmsg;
warning << string_compose (_("Video-Server was not launched by %1. The request to stop it is ignored."), PROGRAM_NAME) << endmsg;
}
if (video_server_process) {
if(ask_confirm) {
@ -3453,16 +3589,24 @@ ARDOUR_UI::start_video_server (Gtk::Window* float_window, bool popup_msg)
std::string icsd_docroot = video_server_dialog->get_docroot();
if (icsd_docroot.empty()) {icsd_docroot = X_("/");}
struct stat sb;
if (!lstat (icsd_docroot.c_str(), &sb) == 0 || !S_ISDIR(sb.st_mode)) {
GStatBuf sb;
if (!g_lstat (icsd_docroot.c_str(), &sb) == 0 || !S_ISDIR(sb.st_mode)) {
warning << _("Specified docroot is not an existing directory.") << endmsg;
continue;
}
if ( (!lstat (icsd_exec.c_str(), &sb) == 0)
#ifndef PLATFORM_WINDOWS
if ( (!g_lstat (icsd_exec.c_str(), &sb) == 0)
|| (sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) == 0 ) {
warning << _("Given Video Server is not an executable file.") << endmsg;
continue;
}
#else
if ( (!g_lstat (icsd_exec.c_str(), &sb) == 0)
|| (sb.st_mode & (S_IXUSR)) == 0 ) {
warning << _("Given Video Server is not an executable file.") << endmsg;
continue;
}
#endif
char **argp;
argp=(char**) calloc(9,sizeof(char*));
@ -3491,14 +3635,15 @@ ARDOUR_UI::start_video_server (Gtk::Window* float_window, bool popup_msg)
delete video_server_process;
}
video_server_process = new SystemExec(icsd_exec, argp);
video_server_process = new ARDOUR::SystemExec(icsd_exec, argp);
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);
Glib::usleep (50000);
gui_idle_handler();
if (--timeout <= 0 || !video_server_process->is_running()) break;
}
if (timeout <= 0) {
@ -3764,6 +3909,116 @@ quickly enough to keep up with recording.\n"), PROGRAM_NAME));
}
}
/* TODO: this is getting elaborate enough to warrant being split into a dedicated class */
static MessageDialog *scan_dlg = NULL;
static ProgressBar *scan_pbar = NULL;
static HBox *scan_tbox = NULL;
void
ARDOUR_UI::cancel_plugin_scan ()
{
PluginManager::instance().cancel_plugin_scan();
}
void
ARDOUR_UI::cancel_plugin_timeout ()
{
PluginManager::instance().cancel_plugin_timeout();
scan_tbox->hide();
}
void
ARDOUR_UI::plugin_scan_timeout (int timeout)
{
if (!scan_dlg || !scan_dlg->is_mapped() || !scan_pbar) {
return;
}
if (timeout > 0) {
scan_pbar->set_fraction ((float) timeout / (float) Config->get_vst_scan_timeout());
scan_tbox->show();
} else {
scan_tbox->hide();
}
gui_idle_handler();
}
void
ARDOUR_UI::plugin_scan_dialog (std::string type, std::string plugin, bool can_cancel)
{
if (type == X_("closeme") && !(scan_dlg && scan_dlg->is_mapped())) {
return;
}
const bool cancelled = PluginManager::instance().cancelled();
if (type != X_("closeme") && !Config->get_show_plugin_scan_window()) {
if (cancelled && scan_dlg->is_mapped()) {
scan_dlg->hide();
gui_idle_handler();
return;
}
if (cancelled || !can_cancel) {
return;
}
}
static Gtk::Button *cancel_button;
static Gtk::Button *timeout_button;
if (!scan_dlg) {
scan_dlg = new MessageDialog("", false, MESSAGE_INFO, BUTTONS_NONE); // TODO manage
VBox* vbox = scan_dlg->get_vbox();
vbox->set_size_request(400,-1);
scan_dlg->set_title (_("Scanning for plugins"));
cancel_button = manage(new Gtk::Button(_("Cancel plugin scan")));
cancel_button->set_name ("EditorGTKButton");
cancel_button->signal_clicked().connect ( mem_fun (*this, &ARDOUR_UI::cancel_plugin_scan) );
cancel_button->show();
scan_dlg->get_vbox()->pack_start ( *cancel_button, PACK_SHRINK);
scan_tbox = manage( new HBox() );
timeout_button = manage(new Gtk::Button(_("Stop Timeout")));
timeout_button->set_name ("EditorGTKButton");
timeout_button->signal_clicked().connect ( mem_fun (*this, &ARDOUR_UI::cancel_plugin_timeout) );
timeout_button->show();
scan_pbar = manage(new ProgressBar());
scan_pbar->set_orientation(Gtk::PROGRESS_RIGHT_TO_LEFT);
scan_pbar->set_text(_("Scan Timeout"));
scan_pbar->show();
scan_tbox->pack_start (*scan_pbar, PACK_EXPAND_WIDGET, 4);
scan_tbox->pack_start (*timeout_button, PACK_SHRINK, 4);
scan_dlg->get_vbox()->pack_start (*scan_tbox, PACK_SHRINK, 4);
}
if (type == X_("closeme")) {
scan_dlg->hide();
} else {
scan_dlg->set_message(type + ": " + Glib::path_get_basename(plugin));
scan_dlg->show();
}
if (!can_cancel || !cancelled) {
scan_tbox->hide();
}
cancel_button->set_sensitive(can_cancel && !cancelled);
gui_idle_handler();
}
void
ARDOUR_UI::gui_idle_handler ()
{
int timeout = 30;
/* due to idle calls, gtk_events_pending() may always return true */
while (gtk_events_pending() && --timeout) {
gtk_main_iteration ();
}
}
void
ARDOUR_UI::disk_underrun_handler ()
{
@ -4096,10 +4351,18 @@ ARDOUR_UI::setup_profile ()
Profile->set_small_screen ();
}
if (getenv ("ARDOUR_SAE")) {
if (g_getenv ("ARDOUR_SAE")) {
Profile->set_sae ();
Profile->set_single_package ();
}
if (g_getenv ("TRX")) {
Profile->set_trx ();
}
if (g_getenv ("MIXBUS")) {
Profile->set_mixbus ();
}
}
int
@ -4126,7 +4389,7 @@ ARDOUR_UI::missing_file (Session*s, std::string str, DataType type)
}
int
ARDOUR_UI::ambiguous_file (std::string file, std::string /*path*/, std::vector<std::string> hits)
ARDOUR_UI::ambiguous_file (std::string file, std::vector<std::string> hits)
{
AmbiguousFileDialog dialog (file, hits);
@ -4196,8 +4459,7 @@ ARDOUR_UI::reset_peak_display ()
if (!_session || !_session->master_out() || !editor_meter) return;
editor_meter->clear_meters();
editor_meter_max_peak = -INFINITY;
editor_meter_peak_display.set_name ("meterbridge peakindicator");
editor_meter_peak_display.set_elements((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body));
editor_meter_peak_display.set_active_state ( Gtkmm2ext::Off );
}
void
@ -4235,3 +4497,53 @@ ARDOUR_UI::do_audio_midi_setup (uint32_t desired_sample_rate)
}
gint
ARDOUR_UI::transport_numpad_timeout ()
{
_numpad_locate_happening = false;
if (_numpad_timeout_connection.connected() )
_numpad_timeout_connection.disconnect();
return 1;
}
void
ARDOUR_UI::transport_numpad_decimal ()
{
_numpad_timeout_connection.disconnect();
if (_numpad_locate_happening) {
if (editor) editor->goto_nth_marker(_pending_locate_num - 1);
_numpad_locate_happening = false;
} else {
_pending_locate_num = 0;
_numpad_locate_happening = true;
_numpad_timeout_connection = Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::transport_numpad_timeout), 2*1000);
}
}
void
ARDOUR_UI::transport_numpad_event (int num)
{
if ( _numpad_locate_happening ) {
_pending_locate_num = _pending_locate_num*10 + num;
} else {
switch (num) {
case 0: toggle_roll(false, false); break;
case 1: transport_rewind(1); break;
case 2: transport_forward(1); break;
case 3: transport_record(true); break;
case 4: toggle_session_auto_loop(); break;
case 5: transport_record(false); toggle_session_auto_loop(); break;
case 6: toggle_punch(); break;
case 7: toggle_click(); break;
case 8: toggle_auto_return(); break;
case 9: toggle_follow_edits(); break;
}
}
}
void
ARDOUR_UI::set_flat_buttons ()
{
CairoWidget::set_flat_buttons( config()->get_flat_buttons() );
}

View file

@ -35,7 +35,6 @@
#include <list>
#include <cmath>
#include <libgnomecanvasmm/canvas.h>
#include "pbd/xml++.h"
#include "pbd/controllable.h"
@ -64,33 +63,40 @@
#include "ardour/utils.h"
#include "ardour/plugin.h"
#include "ardour/session_handle.h"
#include "ardour/system_exec.h"
#include "video_timeline.h"
#include "about.h"
#include "ardour_button.h"
#include "ardour_dialog.h"
#include "ardour_window.h"
#include "editing.h"
#include "engine_dialog.h"
#include "meterbridge.h"
#include "ui_config.h"
#include "enums.h"
#include "visibility_group.h"
#include "window_manager.h"
class About;
class AddRouteDialog;
class AddVideoDialog;
#include "add_route_dialog.h"
#include "add_video_dialog.h"
#include "big_clock_window.h"
#include "bundle_manager.h"
#include "global_port_matrix.h"
#include "keyeditor.h"
#include "location_ui.h"
#include "rc_option_editor.h"
#include "route_params_ui.h"
#include "session_option_editor.h"
#include "speaker_dialog.h"
#include "theme_manager.h"
class VideoTimeLine;
class SystemExec;
class ArdourKeyboard;
class AudioClock;
class BigClockWindow;
class BundleManager;
class ButtonJoiner;
class ConnectionEditor;
class EngineControl;
class KeyEditor;
class LocationUIWindow;
class MainClock;
class Mixer_UI;
class PublicEditor;
@ -100,13 +106,10 @@ class SessionDialog;
class SessionOptionEditor;
class ShuttleControl;
class Splash;
class SpeakerDialog;
class ThemeManager;
class TimeInfoBox;
class MidiTracer;
class NSM_Client;
class LevelMeterHBox;
class GlobalPortMatrixWindow;
class GUIObjectState;
namespace Gtkmm2ext {
@ -187,6 +190,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
/** point_zero_something_seconds -- currently 25Hz ^= 40ms */
static sigc::signal<void> SuperRapidScreenUpdate;
/** every_fps -- see set_fps_timeout_connection() 25Hz < x < 120Hz */
static sigc::signal<void> FPSUpdate;
/** Emitted frequently with the audible frame, false, and the edit point as
* parameters respectively.
*
@ -274,6 +280,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void maximise_editing_space ();
void restore_editing_space ();
void show_ui_prefs ();
void update_tearoff_visibility ();
void setup_profile ();
@ -421,7 +429,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
boost::shared_ptr<TransportControllable> play_selection_controllable;
boost::shared_ptr<TransportControllable> rec_controllable;
void toggle_always_play_range ();
void toggle_follow_edits ();
void set_transport_controllable_state (const XMLNode&);
XMLNode& get_transport_controllable_state ();
@ -462,6 +470,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void audition_blink (bool);
void feedback_blink (bool);
void set_flat_buttons();
void soloing_changed (bool);
void auditioning_changed (bool);
void _auditioning_changed (bool);
@ -504,7 +514,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
struct RecentSessionsSorter {
bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
return cmp_nocase(a.first, b.first) == -1;
return ARDOUR::cmp_nocase(a.first, b.first) == -1;
}
};
@ -541,10 +551,14 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
gint every_second ();
gint every_point_one_seconds ();
gint every_point_zero_something_seconds ();
gint every_fps ();
sigc::connection second_connection;
sigc::connection point_one_second_connection;
sigc::connection point_zero_something_second_connection;
sigc::connection fps_connection;
void set_fps_timeout_connection ();
void open_session ();
void open_recent_session ();
@ -558,6 +572,15 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void set_transport_sensitivity (bool);
//stuff for ProTools-style numpad
void transport_numpad_event (int num);
void transport_numpad_decimal ();
bool _numpad_locate_happening;
int _pending_locate_num;
gint transport_numpad_timeout ();
sigc::connection _numpad_timeout_connection;
void transport_goto_nth_marker (int nth);
void transport_goto_zero ();
void transport_goto_start ();
void transport_goto_end ();
@ -571,6 +594,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void transport_rewind (int option);
void transport_loop ();
void toggle_roll (bool with_abort, bool roll_out_of_bounded_mode);
bool trx_record_enable_all_tracks ();
bool _session_is_new;
void set_session (ARDOUR::Session *);
@ -624,7 +648,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
static UIConfiguration *ui_config;
SystemExec *video_server_process;
ARDOUR::SystemExec *video_server_process;
void handle_locations_change (ARDOUR::Location*);
@ -664,6 +688,12 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void disk_speed_dialog_gone (int ignored_response, Gtk::MessageDialog*);
void disk_overrun_handler ();
void disk_underrun_handler ();
void gui_idle_handler ();
void cancel_plugin_scan ();
void cancel_plugin_timeout ();
void plugin_scan_dialog (std::string type, std::string plugin, bool);
void plugin_scan_timeout (int);
void session_format_mismatch (std::string, std::string);
@ -723,7 +753,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void fontconfig_dialog ();
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);
int ambiguous_file (std::string file, std::vector<std::string> hits);
bool click_button_clicked (GdkEventButton *);

View file

@ -64,6 +64,7 @@ using namespace PBD;
using namespace Gtkmm2ext;
using namespace Gtk;
using namespace Glib;
using namespace ARDOUR_UI_UTILS;
int
ARDOUR_UI::setup_windows ()
@ -111,9 +112,9 @@ ARDOUR_UI::setup_windows ()
top_packer.pack_start (menu_bar_base, false, false);
#endif
top_packer.pack_start (transport_frame, false, false);
editor->add_toplevel_menu (top_packer);
editor->add_toplevel_controls (top_packer);
editor->add_transport_frame (transport_frame);
setup_transport();
@ -144,7 +145,7 @@ ARDOUR_UI::setup_tooltips ()
set_tip (feedback_alert_button, _("When active, there is a feedback loop."));
set_tip (primary_clock, _("<b>Primary Clock</b> right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite <tt>Esc</tt>: cancel; <tt>Enter</tt>: confirm; postfix the edit with '+' or '-' to enter delta times.\n"));
set_tip (secondary_clock, _("<b>Secondary Clock</b> right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite <tt>Esc</tt>: cancel; <tt>Enter</tt>: confirm; postfix the edit with '+' or '-' to enter delta times.\n"));
set_tip (editor_meter_peak_display, _("Reset Level Meter"));
set_tip (editor_meter_peak_display, _("Reset All Peak Indicators"));
synchronize_sync_source_and_video_pullup ();
@ -222,7 +223,7 @@ ARDOUR_UI::setup_transport ()
transport_tearoff->set_name ("TransportBase");
transport_tearoff->tearoff_window().signal_key_press_event().connect (sigc::bind (sigc::ptr_fun (relay_key_press), &transport_tearoff->tearoff_window()), false);
if (Profile->get_sae()) {
if (Profile->get_sae() || Profile->get_mixbus()) {
transport_tearoff->set_can_be_torn_off (false);
}
@ -271,9 +272,10 @@ ARDOUR_UI::setup_transport ()
roll_button.set_image (get_icon (X_("transport_play")));
stop_button.set_image (get_icon (X_("transport_stop")));
play_selection_button.set_image (get_icon (X_("transport_range")));
rec_button.set_image (get_icon (X_("transport_record")));
auto_loop_button.set_image (get_icon (X_("transport_loop")));
rec_button.set_elements ((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body|ArdourButton::RecButton));
midi_panic_button.set_image (get_icon (X_("midi_panic")));
/* the icon for this has an odd aspect ratio, so fatten up the button */
midi_panic_button.set_size_request (25, -1);
@ -324,9 +326,11 @@ ARDOUR_UI::setup_transport ()
feedback_alert_button.set_name ("feedback alert");
feedback_alert_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::feedback_alert_press), false);
alert_box.pack_start (solo_alert_button, true, false);
alert_box.pack_start (auditioning_alert_button, true, false);
alert_box.pack_start (feedback_alert_button, true, false);
alert_box.set_homogeneous (true);
alert_box.set_spacing (2);
alert_box.pack_start (solo_alert_button, true, true);
alert_box.pack_start (auditioning_alert_button, true, true);
alert_box.pack_start (feedback_alert_button, true, true);
/* all transport buttons should be the same size vertically and
* horizontally
@ -357,13 +361,18 @@ ARDOUR_UI::setup_transport ()
tbox2->set_spacing (2);
tbox->set_spacing (2);
tbox1->pack_start (midi_panic_button, false, false, 5);
tbox1->pack_start (click_button, false, false, 5);
if (!Profile->get_trx()) {
tbox1->pack_start (midi_panic_button, false, false, 5);
tbox1->pack_start (click_button, false, false, 5);
}
tbox1->pack_start (goto_start_button, false, false);
tbox1->pack_start (goto_end_button, false, false);
tbox1->pack_start (auto_loop_button, false, false);
tbox2->pack_start (play_selection_button, false, false);
if (!Profile->get_trx()) {
tbox2->pack_start (play_selection_button, false, false);
}
tbox2->pack_start (roll_button, false, false);
tbox2->pack_start (stop_button, false, false);
tbox2->pack_start (rec_button, false, false, 5);
@ -382,12 +391,12 @@ ARDOUR_UI::setup_transport ()
HBox* clock_box = manage (new HBox);
clock_box->pack_start (*primary_clock, false, false);
if (!ARDOUR::Profile->get_small_screen()) {
if (!ARDOUR::Profile->get_small_screen() && !ARDOUR::Profile->get_trx()) {
clock_box->pack_start (*secondary_clock, false, false);
}
clock_box->set_spacing (3);
shuttle_box = new ShuttleControl;
shuttle_box = manage (new ShuttleControl);
shuttle_box->show ();
VBox* transport_vbox = manage (new VBox);
@ -395,7 +404,16 @@ ARDOUR_UI::setup_transport ()
transport_vbox->set_border_width (0);
transport_vbox->set_spacing (3);
transport_vbox->pack_start (*tbox, true, true, 0);
transport_vbox->pack_start (*shuttle_box, false, false, 0);
if (!Profile->get_trx()) {
transport_vbox->pack_start (*shuttle_box, false, false, 0);
}
time_info_box = manage (new TimeInfoBox);
if (ARDOUR::Profile->get_trx()) {
transport_tearoff_hbox.pack_start (*time_info_box, false, false);
}
transport_tearoff_hbox.pack_start (*transport_vbox, false, false);
@ -404,22 +422,34 @@ ARDOUR_UI::setup_transport ()
VBox* auto_box = manage (new VBox);
auto_box->set_homogeneous (true);
auto_box->set_spacing (2);
auto_box->pack_start (sync_button, false, false);
auto_box->pack_start (follow_edits_button, false, false);
auto_box->pack_start (auto_return_button, false, false);
auto_box->pack_start (sync_button, true, true);
if (!ARDOUR::Profile->get_trx()) {
auto_box->pack_start (follow_edits_button, true, true);
auto_box->pack_start (auto_return_button, true, true);
}
transport_tearoff_hbox.pack_start (*auto_box, false, false);
if (!ARDOUR::Profile->get_trx()) {
transport_tearoff_hbox.pack_start (*auto_box, false, false);
}
transport_tearoff_hbox.pack_start (*clock_box, true, true);
time_info_box = manage (new TimeInfoBox);
transport_tearoff_hbox.pack_start (*time_info_box, false, false);
if (ARDOUR::Profile->get_trx()) {
transport_tearoff_hbox.pack_start (*auto_box, false, false);
}
if (Profile->get_small_screen()) {
if (!ARDOUR::Profile->get_trx()) {
transport_tearoff_hbox.pack_start (*time_info_box, false, false);
}
if (ARDOUR::Profile->get_small_screen()) {
transport_tearoff_hbox.pack_start (_editor_transport_box, false, false);
}
transport_tearoff_hbox.pack_start (alert_box, false, false);
transport_tearoff_hbox.pack_start (meter_box, false, false);
transport_tearoff_hbox.pack_start (editor_meter_peak_display, false, false);
if (!ARDOUR::Profile->get_trx()) {
transport_tearoff_hbox.pack_start (alert_box, false, false);
transport_tearoff_hbox.pack_start (meter_box, false, false);
transport_tearoff_hbox.pack_start (editor_meter_peak_display, false, false);
}
if (Profile->get_sae()) {
Image* img = manage (new Image ((::get_icon (X_("sae")))));
@ -612,6 +642,18 @@ ARDOUR_UI::restore_editing_space ()
}
}
void
ARDOUR_UI::show_ui_prefs ()
{
RefPtr<Action> act = ActionManager::get_action (X_("Window"), X_("toggle-rc-options-editor"));
assert (act);
act->activate();
rc_option_editor->set_current_page (_("GUI"));
}
bool
ARDOUR_UI::click_button_clicked (GdkEventButton* ev)
{
@ -630,7 +672,7 @@ ARDOUR_UI::click_button_clicked (GdkEventButton* ev)
}
void
ARDOUR_UI::toggle_always_play_range ()
ARDOUR_UI::toggle_follow_edits ()
{
RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
assert (act);
@ -638,7 +680,7 @@ ARDOUR_UI::toggle_always_play_range ()
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
assert (tact);
Config->set_always_play_range (tact->get_active ());
Config->set_follow_edits (tact->get_active ());
}

View file

@ -31,6 +31,7 @@
#include "ardour/session.h"
#include "actions.h"
#include "ardour_ui.h"
#include "public_editor.h"
#include "mixer_ui.h"
@ -59,6 +60,11 @@ ARDOUR_UI::we_have_dependents ()
editor->setup_tooltips ();
editor->UpdateAllTransportClocks.connect (sigc::mem_fun (*this, &ARDOUR_UI::update_transport_clocks));
/* all actions are defined */
ActionManager::enable_accelerators ();
ActionManager::load_menus (ARDOUR_COMMAND_LINE::menus_file);
editor->track_mixer_selection ();
mixer->track_editor_selection ();
}
@ -66,6 +72,7 @@ ARDOUR_UI::we_have_dependents ()
void
ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s)
{
DisplaySuspender ds;
BootMessage (_("Setup Editor"));
editor->set_session (s);
BootMessage (_("Setup Mixer"));

View file

@ -23,9 +23,12 @@
This is to cut down on the compile times. It also helps with my sanity.
*/
#include "ardour/session.h"
#include "ardour/audioengine.h"
#include "ardour/automation_watch.h"
#include "ardour/control_protocol_manager.h"
#include "ardour/profile.h"
#include "ardour/session.h"
#include "control_protocol/control_protocol.h"
#include "actions.h"
#include "add_route_dialog.h"
@ -68,7 +71,6 @@ ARDOUR_UI::set_session (Session *s)
{
SessionHandlePtr::set_session (s);
if (!_session) {
WM::Manager::instance().set_session (s);
/* Session option editor cannot exist across change-of-session */
@ -183,6 +185,7 @@ ARDOUR_UI::set_session (Session *s)
second_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ARDOUR_UI::every_second), 1000);
point_one_second_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ARDOUR_UI::every_point_one_seconds), 100);
point_zero_something_second_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ARDOUR_UI::every_point_zero_something_seconds), 40);
set_fps_timeout_connection();
update_format ();
@ -198,31 +201,38 @@ ARDOUR_UI::set_session (Session *s)
editor_meter_peak_display.hide();
}
if (_session
&& _session->master_out()
&& _session->master_out()->n_outputs().n(DataType::AUDIO) > 0) {
editor_meter = new LevelMeterHBox(_session);
editor_meter->set_meter (_session->master_out()->shared_peak_meter().get());
editor_meter->clear_meters();
editor_meter->set_type (_session->master_out()->meter_type());
editor_meter->setup_meters (30, 12, 6);
editor_meter->show();
meter_box.pack_start(*editor_meter);
if (meter_box.get_parent()) {
transport_tearoff_hbox.remove (meter_box);
transport_tearoff_hbox.remove (editor_meter_peak_display);
}
if (_session &&
_session->master_out() &&
_session->master_out()->n_outputs().n(DataType::AUDIO) > 0) {
if (!ARDOUR::Profile->get_trx()) {
editor_meter = new LevelMeterHBox(_session);
editor_meter->set_meter (_session->master_out()->shared_peak_meter().get());
editor_meter->clear_meters();
editor_meter->set_type (_session->master_out()->meter_type());
editor_meter->setup_meters (30, 12, 6);
editor_meter->show();
meter_box.pack_start(*editor_meter);
}
ArdourMeter::ResetAllPeakDisplays.connect (sigc::mem_fun(*this, &ARDOUR_UI::reset_peak_display));
ArdourMeter::ResetRoutePeakDisplays.connect (sigc::mem_fun(*this, &ARDOUR_UI::reset_route_peak_display));
ArdourMeter::ResetGroupPeakDisplays.connect (sigc::mem_fun(*this, &ARDOUR_UI::reset_group_peak_display));
editor_meter_peak_display.set_name ("meterbridge peakindicator");
editor_meter_peak_display.set_elements((ArdourButton::Element) (ArdourButton::Edge|ArdourButton::Body));
editor_meter_peak_display.unset_flags (Gtk::CAN_FOCUS);
editor_meter_peak_display.set_size_request(6, -1);
editor_meter_peak_display.set_corner_radius(2);
editor_meter_peak_display.set_size_request(8, -1);
editor_meter_peak_display.set_corner_radius(3);
editor_meter_max_peak = -INFINITY;
editor_meter_peak_display.signal_button_release_event().connect (sigc::mem_fun(*this, &ARDOUR_UI::editor_meter_peak_button_release), false);
if (Config->get_show_editor_meter()) {
if (Config->get_show_editor_meter() && !ARDOUR::Profile->get_trx()) {
transport_tearoff_hbox.pack_start (meter_box, false, false);
transport_tearoff_hbox.pack_start (editor_meter_peak_display, false, false);
meter_box.show();
@ -254,6 +264,16 @@ ARDOUR_UI::unload_session (bool hide_stuff)
}
}
{
// tear down session specific CPI (owned by rc_config_editor which can remain)
ControlProtocolManager& m = ControlProtocolManager::instance ();
for (std::list<ControlProtocolInfo*>::iterator i = m.control_protocol_info.begin(); i != m.control_protocol_info.end(); ++i) {
if (*i && (*i)->protocol && (*i)->protocol->has_editor ()) {
(*i)->protocol->tear_down_gui ();
}
}
}
if (hide_stuff) {
editor->hide ();
mixer->hide ();
@ -267,6 +287,7 @@ ARDOUR_UI::unload_session (bool hide_stuff)
second_connection.disconnect ();
point_one_second_connection.disconnect ();
point_zero_something_second_connection.disconnect();
fps_connection.disconnect();
if (editor_meter) {
meter_box.remove(*editor_meter);
@ -563,7 +584,7 @@ ARDOUR_UI::editor_meter_peak_button_release (GdkEventButton* ev)
} else if (_session->master_out()) {
ArdourMeter::ResetRoutePeakDisplays (_session->master_out().get());
}
return true;
return false;
}
void

View file

@ -51,7 +51,6 @@
#include "actions.h"
#include "mixer_ui.h"
#include "startup.h"
#include "utils.h"
#include "window_manager.h"
#include "global_port_matrix.h"
#include "location_ui.h"
@ -195,6 +194,8 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_toggle_action (common_actions, X_("KeepTearoffs"), _("Show Toolbars"), mem_fun (*this, &ARDOUR_UI::toggle_keep_tearoffs));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::register_action (common_actions, X_("show-ui-prefs"), _("Show more UI preferences"), sigc::mem_fun (*this, &ARDOUR_UI::show_ui_prefs));
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_("toggle-meterbridge"), S_("Window|Meterbridge"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_meterbridge));
@ -230,6 +231,9 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_action (transport_actions, X_("ToggleRoll"), _("Start/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, false));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("alternate-ToggleRoll"), _("Start/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, false));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("ToggleRollMaybe"), _("Start/Continue/Stop"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::toggle_roll), false, true));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
@ -268,6 +272,10 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::write_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("alternate-record-roll"), _("Start Recording"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), true));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::write_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("Rewind"), _("Rewind"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_rewind), 0));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
@ -292,6 +300,9 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_action (transport_actions, X_("GotoStart"), _("Goto Start"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_start));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("alternate-GotoStart"), _("Goto Start"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_start));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("GotoEnd"), _("Goto End"), sigc::mem_fun(*this, &ARDOUR_UI::transport_goto_end));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
@ -299,6 +310,41 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
//these actions handle the numpad events, ProTools style
act = ActionManager::register_action (transport_actions, X_("numpad-decimal"), _("Numpad Decimal"), mem_fun(*this, &ARDOUR_UI::transport_numpad_decimal));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("numpad-0"), _("Numpad 0"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 0));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("numpad-1"), _("Numpad 1"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 1));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("numpad-2"), _("Numpad 2"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 2));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("numpad-3"), _("Numpad 3"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 3));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("numpad-4"), _("Numpad 4"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 4));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("numpad-5"), _("Numpad 5"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 5));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("numpad-6"), _("Numpad 6"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 6));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("numpad-7"), _("Numpad 7"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 7));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("numpad-8"), _("Numpad 8"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 8));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("numpad-9"), _("Numpad 9"), bind (mem_fun(*this, &ARDOUR_UI::transport_numpad_event), 9));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_action (transport_actions, X_("focus-on-clock"), _("Focus On Clock"), sigc::mem_fun(*this, &ARDOUR_UI::focus_on_clock));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
@ -345,7 +391,7 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_toggle_action (transport_actions, X_("ToggleAutoReturn"), _("Auto Return"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_auto_return));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = ActionManager::register_toggle_action (transport_actions, X_("ToggleFollowEdits"), _("Follow Edits"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_always_play_range));
act = ActionManager::register_toggle_action (transport_actions, X_("ToggleFollowEdits"), _("Follow Edits"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_follow_edits));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
@ -586,6 +632,7 @@ ARDOUR_UI::save_ardour_state ()
Config->add_instant_xml (location_ui->ui().get_state ());
}
}
delete &enode;
Keyboard::save_keybindings ();
}

View file

@ -29,6 +29,8 @@
#include "ardour/rc_configuration.h"
#include "ardour/session.h"
#include "canvas/wave_view.h"
#include "audio_clock.h"
#include "ardour_ui.h"
#include "actions.h"
@ -307,8 +309,6 @@ ARDOUR_UI::setup_session_options ()
void
ARDOUR_UI::parameter_changed (std::string p)
{
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::parameter_changed, p)
if (p == "external-sync") {
ActionManager::map_some_state ("Transport", "ToggleExternalSync", sigc::mem_fun (_session->config, &SessionConfiguration::get_external_sync));
@ -326,9 +326,9 @@ ARDOUR_UI::parameter_changed (std::string p)
ActionManager::get_action ("Transport", "ToggleFollowEdits")->set_sensitive (false);
}
} else if (p == "always-play-range") {
} else if (p == "follow-edits") {
ActionManager::map_some_state ("Transport", "ToggleFollowEdits", &RCConfiguration::get_always_play_range);
ActionManager::map_some_state ("Transport", "ToggleFollowEdits", &RCConfiguration::get_follow_edits);
} else if (p == "send-mtc") {
@ -364,15 +364,10 @@ ARDOUR_UI::parameter_changed (std::string p)
ActionManager::map_some_state ("Transport", "ToggleClick", &RCConfiguration::get_clicking);
} else if (p == "use-video-sync") {
ActionManager::map_some_state ("Transport", "ToggleVideoSync", sigc::mem_fun (_session->config, &SessionConfiguration::get_use_video_sync));
} else if (p == "video-pullup" || p == "timecode-format") {
synchronize_sync_source_and_video_pullup ();
reset_main_clocks ();
editor->queue_visual_videotimeline_update();
} else if (p == "sync-source") {
synchronize_sync_source_and_video_pullup ();
set_fps_timeout_connection ();
} else if (p == "show-track-meters") {
editor->toggle_meter_updating();
@ -397,8 +392,12 @@ ARDOUR_UI::parameter_changed (std::string p)
secondary_clock->set_widget_name ("secondary");
}
} else if (p == "super-rapid-clock-update") {
stop_clocking ();
start_clocking ();
if (_session) {
stop_clocking ();
start_clocking ();
}
} else if (p == "waveform-gradient-depth") {
ArdourCanvas::WaveView::set_global_gradient_depth (config()->get_waveform_gradient_depth());
} else if (p == "show-editor-meter") {
bool show = Config->get_show_editor_meter();
@ -415,6 +414,13 @@ ARDOUR_UI::parameter_changed (std::string p)
editor_meter_peak_display.show();
}
}
} else if (p == "waveform-scale") {
ArdourCanvas::WaveView::set_global_logscaled (Config->get_waveform_scale() == Logarithmic);
} else if (p == "waveform-shape") {
ArdourCanvas::WaveView::set_global_shape (Config->get_waveform_shape() == Rectified
? ArdourCanvas::WaveView::Rectified : ArdourCanvas::WaveView::Normal);
} else if (p == "show-waveform-clipping") {
ArdourCanvas::WaveView::set_global_show_waveform_clipping (ARDOUR_UI::config()->get_show_waveform_clipping());
}
}
@ -423,6 +429,21 @@ ARDOUR_UI::session_parameter_changed (std::string p)
{
if (p == "native-file-data-format" || p == "native-file-header-format") {
update_format ();
} else if (p == "timecode-format") {
set_fps_timeout_connection ();
} else if (p == "video-pullup" || p == "timecode-format") {
set_fps_timeout_connection ();
synchronize_sync_source_and_video_pullup ();
reset_main_clocks ();
editor->queue_visual_videotimeline_update();
} else if (p == "track-name-number") {
/* DisplaySuspender triggers _route->redisplay() when going out of scope
* which eventually calls reset_controls_layout_width() and re-sets the
* track-header width.
* see also RouteTimeAxisView::update_track_number_visibility()
*/
DisplaySuspender ds;
}
}

View file

@ -30,6 +30,7 @@
using namespace std;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace ARDOUR_UI_UTILS;
ArdourWindow::ArdourWindow (string title)
: Window ()
@ -102,7 +103,7 @@ ArdourWindow::init ()
vice versa.
*/
if (ARDOUR_UI::instance()->config()->all_floating_windows_are_dialogs.get()) {
if (ARDOUR_UI::instance()->config()->get_all_floating_windows_are_dialogs()) {
set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
} else {
set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY);

11
gtk2_ardour/armass Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
. `dirname "$0"`/../build/gtk2_ardour/ardev_common_waf.sh
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export ARDOUR_RUNNING_UNDER_VALGRIND=TRUE
exec valgrind \
--tool=massif \
$TOP/$EXECUTABLE --novst "$@"
# analyse output with
# ms_print massif.out.<PID>
# or check out https://projects.kde.org/projects/extragear/sdk/massif-visualizer

31
gtk2_ardour/arprof Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
# Ardour profiler using callgrind
# intended for use with the 'Dummy' backend engine.
#
# inspect data with kcachegrind
# see http://valgrind.org/docs/manual/cl-manual.html and
# http://log.fundamental-code.com/2013/09/07/profiling-realtime-code
. `dirname "$0"`/../build/gtk2_ardour/ardev_common_waf.sh
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export ARDOUR_RUNNING_UNDER_VALGRIND=TRUE
# depending on options, there can be many files (one per thread,
# one per process cycle,..) dump them in a dedicated place.
mkdir -p /tmp/ardour_profile/
## some options to drop in
# --zero-before="ARDOUR::AudioEngine::process_callback*" \
# --dump-after="ARDOUR::AudioEngine::process_callback*" \
## and/or
# --toggle-collect="ARDOUR::AudioEngine::process_callback*" \
exec valgrind --tool=callgrind \
--dump-instr=yes --collect-jumps=yes\
--separate-threads=yes \
--collect-systime=yes --collect-bus=yes \
--callgrind-out-file=/tmp/ardour_profile/ardour-%p.log \
--toggle-collect="ARDOUR::AudioEngine::process_callback*" \
$TOP/$EXECUTABLE --novst "$@"

View file

@ -1,6 +1,9 @@
#undef Marker
#define Marker FuckYouAppleAndYourLackOfNameSpaces
#include <gtkmm/button.h>
#include <gdk/gdkquartz.h>
#include "pbd/convert.h"
#include "pbd/error.h"
@ -10,9 +13,6 @@
#undef check // stupid gtk, stupid apple
#include <gtkmm/button.h>
#include <gdk/gdkquartz.h>
#include <gtkmm2ext/utils.h>
#include "au_pluginui.h"
@ -34,7 +34,6 @@
using namespace ARDOUR;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace sigc;
using namespace std;
using namespace PBD;
@ -84,12 +83,12 @@ dump_view_tree (NSView* view, int depth)
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(cocoaParentActivationHandler:)
name:NSWindowDidBecomeMainNotification
object:nil];
object:NULL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(cocoaParentBecameKeyHandler:)
name:NSWindowDidBecomeKeyNotification
object:nil];
object:NULL];
}
}
@ -366,7 +365,7 @@ AUPluginUI::create_cocoa_view ()
DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("tried to create bundle, result = %1\n", viewBundle));
if (viewBundle == nil) {
if (viewBundle == NULL) {
error << _("AUPluginUI: error loading AU view's bundle") << endmsg;
return -1;
} else {
@ -384,7 +383,7 @@ AUPluginUI::create_cocoa_view ()
}
// make a factory
id factory = [[[factoryClass alloc] init] autorelease];
if (factory == nil) {
if (factory == NULL) {
error << _("AUPluginUI: Could not create an instance of the AU view factory") << endmsg;
return -1;
}
@ -661,13 +660,13 @@ AUPluginUI::parent_cocoa_window ()
NSPoint origin = { 0, static_cast<CGFloat> (a.height) };
[au_view setFrameOrigin:origin];
[view addSubview:au_view positioned:NSWindowBelow relativeTo:nil];
[view addSubview:au_view positioned:NSWindowBelow relativeTo:NULL];
last_au_frame = [au_view frame];
// watch for size changes of the view
_notify = [ [NotificationObject alloc] initWithPluginUI:this andCocoaParent:nil andTopLevelParent:win ];
_notify = [ [NotificationObject alloc] initWithPluginUI:this andCocoaParent:NULL andTopLevelParent:win ];
[[NSNotificationCenter defaultCenter] addObserver:_notify
selector:@selector(auViewResized:) name:NSViewFrameDidChangeNotification

View file

@ -45,6 +45,7 @@
#include "i18n.h"
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
using namespace PBD;
using namespace Gtk;
using namespace std;
@ -259,12 +260,14 @@ AudioClock::set_colors ()
r = lrint ((r/255.0) * 65535.0);
g = lrint ((g/255.0) * 65535.0);
b = lrint ((b/255.0) * 65535.0);
delete foreground_attr;
foreground_attr = new Pango::AttrColor (Pango::Attribute::create_attr_foreground (r, g, b));
UINT_TO_RGBA (editing_color, &r, &g, &b, &a);
r = lrint ((r/255.0) * 65535.0);
g = lrint ((g/255.0) * 65535.0);
b = lrint ((b/255.0) * 65535.0);
delete editing_attr;
editing_attr = new Pango::AttrColor (Pango::Attribute::create_attr_foreground (r, g, b));
normal_attributes.change (*foreground_attr);
@ -282,7 +285,7 @@ AudioClock::set_colors ()
}
void
AudioClock::render (cairo_t* cr)
AudioClock::render (cairo_t* cr, cairo_rectangle_t*)
{
/* main layout: rounded rect, plus the text */
@ -775,31 +778,31 @@ AudioClock::parse_as_timecode_distance (const std::string& str)
case 1:
case 2:
sscanf (str.c_str(), "%" PRId32, &frames);
return lrint ((frames/(float)fps) * sr);
return llrint ((frames/(float)fps) * sr);
case 3:
sscanf (str.c_str(), "%1" PRId32 "%" PRId32, &secs, &frames);
return (secs * sr) + lrint ((frames/(float)fps) * sr);
return (secs * sr) + llrint ((frames/(float)fps) * sr);
case 4:
sscanf (str.c_str(), "%2" PRId32 "%" PRId32, &secs, &frames);
return (secs * sr) + lrint ((frames/(float)fps) * sr);
return (secs * sr) + llrint ((frames/(float)fps) * sr);
case 5:
sscanf (str.c_str(), "%1" PRId32 "%2" PRId32 "%" PRId32, &mins, &secs, &frames);
return (mins * 60 * sr) + (secs * sr) + lrint ((frames/(float)fps) * sr);
return (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
case 6:
sscanf (str.c_str(), "%2" PRId32 "%2" PRId32 "%" PRId32, &mins, &secs, &frames);
return (mins * 60 * sr) + (secs * sr) + lrint ((frames/(float)fps) * sr);
return (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
case 7:
sscanf (str.c_str(), "%1" PRId32 "%2" PRId32 "%2" PRId32 "%" PRId32, &hrs, &mins, &secs, &frames);
return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + lrint ((frames/(float)fps) * sr);
return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
case 8:
sscanf (str.c_str(), "%2" PRId32 "%2" PRId32 "%2" PRId32 "%" PRId32, &hrs, &mins, &secs, &frames);
return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + lrint ((frames/(float)fps) * sr);
return (hrs * 3600 * sr) + (mins * 60 * sr) + (secs * sr) + llrint ((frames/(float)fps) * sr);
default:
break;
@ -944,12 +947,24 @@ AudioClock::set (framepos_t when, bool force, framecnt_t offset)
}
if (when == last_when && !force) {
#if 0 // XXX return if no change and no change forced. verify Aug/2014
if (_mode != Timecode && _mode != MinSec) {
/* may need to force display of TC source
* time, so don't return early.
*/
/* ^^ Why was that?, delta times?
* Timecode FPS, pull-up/down, etc changes
* trigger a 'session_property_changed' which
* eventually calls set(last_when, true)
*
* re-rendering the clock every 40ms or so just
* because we can is not ideal.
*/
return;
}
#else
return;
#endif
}
if (!editing) {
@ -1099,15 +1114,43 @@ AudioClock::set_frames (framepos_t when, bool /*force*/)
}
void
AudioClock::set_minsec (framepos_t when, bool /*force*/)
AudioClock::print_minsec (framepos_t when, char* buf, size_t bufsize, float frame_rate)
{
char buf[32];
framecnt_t left;
int hrs;
int mins;
int secs;
int millisecs;
bool negative = false;
bool negative;
if (when < 0) {
when = -when;
negative = true;
} else {
negative = false;
}
left = when;
hrs = (int) floor (left / (frame_rate * 60.0f * 60.0f));
left -= (framecnt_t) floor (hrs * frame_rate * 60.0f * 60.0f);
mins = (int) floor (left / (frame_rate * 60.0f));
left -= (framecnt_t) floor (mins * frame_rate * 60.0f);
secs = (int) floor (left / (float) frame_rate);
left -= (framecnt_t) floor ((double)(secs * frame_rate));
millisecs = floor (left * 1000.0 / (float) frame_rate);
if (negative) {
snprintf (buf, bufsize, "-%02" PRId32 ":%02" PRId32 ":%02" PRId32 ".%03" PRId32, hrs, mins, secs, millisecs);
} else {
snprintf (buf, bufsize, " %02" PRId32 ":%02" PRId32 ":%02" PRId32 ".%03" PRId32, hrs, mins, secs, millisecs);
}
}
void
AudioClock::set_minsec (framepos_t when, bool /*force*/)
{
char buf[32];
if (_off) {
_layout->set_text (" --:--:--.---");
@ -1120,25 +1163,7 @@ AudioClock::set_minsec (framepos_t when, bool /*force*/)
return;
}
if (when < 0) {
when = -when;
negative = true;
}
left = when;
hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f));
left -= (framecnt_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f);
mins = (int) floor (left / (_session->frame_rate() * 60.0f));
left -= (framecnt_t) floor (mins * _session->frame_rate() * 60.0f);
secs = (int) floor (left / (float) _session->frame_rate());
left -= (framecnt_t) floor (secs * _session->frame_rate());
millisecs = floor (left * 1000.0 / (float) _session->frame_rate());
if (negative) {
snprintf (buf, sizeof (buf), "-%02" PRId32 ":%02" PRId32 ":%02" PRId32 ".%03" PRId32, hrs, mins, secs, millisecs);
} else {
snprintf (buf, sizeof (buf), " %02" PRId32 ":%02" PRId32 ":%02" PRId32 ".%03" PRId32, hrs, mins, secs, millisecs);
}
print_minsec (when, buf, sizeof (buf), _session->frame_rate());
_layout->set_text (buf);
set_slave_info();
@ -1742,7 +1767,7 @@ AudioClock::on_motion_notify_event (GdkEventMotion *ev)
drag_y = ev->y;
if (trunc (drag_accum) != 0) {
if (floor (drag_accum) != 0) {
framepos_t frames;
framepos_t pos;

View file

@ -77,6 +77,8 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
void set_session (ARDOUR::Session *s);
void set_negative_allowed (bool yn);
static void print_minsec (framepos_t, char* buf, size_t bufsize, float frame_rate);
sigc::signal<void> ValueChanged;
sigc::signal<void> mode_changed;
sigc::signal<void> ChangeAborted;
@ -85,7 +87,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
static std::vector<AudioClock*> clocks;
protected:
void render (cairo_t*);
void render (cairo_t*, cairo_rectangle_t*);
virtual void build_ops_menu ();
Gtk::Menu *ops_menu;

View file

@ -32,7 +32,6 @@
#include "audio_region_editor.h"
#include "audio_region_view.h"
#include "ardour_ui.h"
#include "utils.h"
#include "gui_thread.h"
#include "i18n.h"
@ -54,7 +53,9 @@ AudioRegionEditor::AudioRegionEditor (Session* s, boost::shared_ptr<AudioRegion>
: RegionEditor (s, r)
, _audio_region (r)
, gain_adjustment(accurate_coefficient_to_dB(_audio_region->scale_amplitude()), -40.0, +40.0, 0.1, 1.0, 0)
#ifndef PLATFORM_WINDOWS
, _peak_channel (false)
#endif
{
Gtk::HBox* b = Gtk::manage (new Gtk::HBox);
@ -91,7 +92,7 @@ AudioRegionEditor::AudioRegionEditor (Session* s, boost::shared_ptr<AudioRegion>
PeakAmplitudeFound.connect (_peak_amplitude_connection, invalidator (*this), boost::bind (&AudioRegionEditor::peak_amplitude_found, this, _1), gui_context ());
pthread_create_and_store (X_("peak-amplitude"), &_peak_amplitude_thread_handle, _peak_amplitude_thread, this);
_peak_channel.deliver ('c');
signal_peak_thread ();
}
AudioRegionEditor::~AudioRegionEditor ()
@ -112,7 +113,7 @@ AudioRegionEditor::region_changed (const PBD::PropertyChange& what_changed)
if (what_changed.contains (ARDOUR::Properties::start) || what_changed.contains (ARDOUR::Properties::length)) {
/* ask the peak thread to run again */
_peak_channel.deliver ('c');
signal_peak_thread ();
}
}
void
@ -133,13 +134,33 @@ AudioRegionEditor::gain_adjustment_changed ()
}
}
void
AudioRegionEditor::signal_peak_thread ()
{
#ifdef PLATFORM_WINDOWS
m_peak_sem.post ();
#else
_peak_channel.deliver ('c');
#endif
}
void
AudioRegionEditor::wait_for_signal ()
{
#ifdef PLATFORM_WINDOWS
m_peak_sem.wait ();
#else
char msg;
_peak_channel.receive (msg);
#endif
}
void
AudioRegionEditor::peak_amplitude_thread ()
{
while (1) {
/* await instructions to run */
char msg;
_peak_channel.receive (msg);
wait_for_signal ();
/* compute peak amplitude and signal the fact */
PeakAmplitudeFound (accurate_coefficient_to_dB (_audio_region->maximum_amplitude ())); /* EMIT SIGNAL */

View file

@ -34,10 +34,13 @@
#include <gtkmm/separator.h>
#include <gtkmm/spinbutton.h>
#include <libgnomecanvas/libgnomecanvas.h>
#include "pbd/signals.h"
#ifdef PLATFORM_WINDOWS
#include "pbd/glib_semaphore.h"
#else
#include "pbd/crossthread.h"
#endif
#include "audio_clock.h"
#include "ardour_dialog.h"
@ -74,11 +77,17 @@ class AudioRegionEditor : public RegionEditor
Gtk::Label _peak_amplitude_label;
Gtk::Entry _peak_amplitude;
void signal_peak_thread ();
void wait_for_signal ();
pthread_t _peak_amplitude_thread_handle;
void peak_amplitude_found (double);
PBD::Signal1<void, double> PeakAmplitudeFound;
PBD::ScopedConnection _peak_amplitude_connection;
#ifdef PLATFORM_WINDOWS
PBD::GlibSemaphore m_peak_sem;
#else
CrossThreadChannel _peak_channel;
#endif
};
#endif /* __gtk_ardour_audio_region_edit_h__ */

File diff suppressed because it is too large Load diff

View file

@ -19,19 +19,23 @@
#ifndef __gtk_ardour_audio_region_view_h__
#define __gtk_ardour_audio_region_view_h__
#ifdef interface
#undef interface
#endif
#include <vector>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
#include <sigc++/signal.h>
#include "ardour/audioregion.h"
#include "canvas/fwd.h"
#include "canvas/wave_view.h"
#include "canvas/xfade_curve.h"
#include "region_view.h"
#include "time_axis_view_item.h"
#include "automation_line.h"
#include "enums.h"
#include "waveview.h"
#include "canvas.h"
namespace ARDOUR {
class AudioRegion;
@ -47,17 +51,17 @@ class RouteTimeAxisView;
class AudioRegionView : public RegionView
{
public:
AudioRegionView (ArdourCanvas::Group *,
AudioRegionView (ArdourCanvas::Container *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::AudioRegion>,
double initial_samples_per_unit,
Gdk::Color const & basic_color);
double initial_samples_per_pixel,
uint32_t base_color);
AudioRegionView (ArdourCanvas::Group *,
AudioRegionView (ArdourCanvas::Container *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::AudioRegion>,
double samples_per_unit,
Gdk::Color const & basic_color,
double samples_per_pixel,
uint32_t base_color,
bool recording,
TimeAxisViewItem::Visibility);
@ -65,14 +69,14 @@ class AudioRegionView : public RegionView
~AudioRegionView ();
virtual void init (Gdk::Color const & base_color, bool wait_for_data);
void init (bool wait_for_data);
boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const;
void create_waves ();
void set_height (double);
void set_samples_per_unit (double);
void set_samples_per_pixel (double);
void set_amplitude_above_axis (gdouble spp);
@ -91,8 +95,8 @@ class AudioRegionView : public RegionView
GhostRegion* add_ghost (TimeAxisView&);
void reset_fade_in_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, framecnt_t);
void reset_fade_out_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, framecnt_t);
void reset_fade_in_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, framecnt_t, bool drag_active = false);
void reset_fade_out_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, framecnt_t, bool drag_active = false);
framepos_t get_fade_in_shape_width ();
framepos_t get_fade_out_shape_width ();
@ -113,8 +117,8 @@ class AudioRegionView : public RegionView
void drag_start ();
void drag_end ();
void redraw_start_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t);
void redraw_end_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t);
void redraw_start_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t, ArdourCanvas::Points&, double, double);
void redraw_end_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t, ArdourCanvas::Points&, double, double, double);
void redraw_start_xfade ();
void redraw_end_xfade ();
@ -151,28 +155,24 @@ class AudioRegionView : public RegionView
std::list<std::pair<framepos_t, ArdourCanvas::Line*> > feature_lines;
ArdourCanvas::Polygon* sync_mark; ///< polgyon for sync position
ArdourCanvas::Polygon* fade_in_shape;
ArdourCanvas::Polygon* fade_out_shape;
ArdourCanvas::SimpleRect* fade_in_handle; ///< fade in handle, or 0
ArdourCanvas::SimpleRect* fade_out_handle; ///< fade out handle, or 0
ArdourCanvas::Polygon* sync_mark; ///< polgyon for sync position
ArdourCanvas::Rectangle* fade_in_handle; ///< fade in handle, or 0
ArdourCanvas::Rectangle* fade_out_handle; ///< fade out handle, or 0
ArdourCanvas::Rectangle* fade_in_trim_handle; ///< fade in trim handle, or 0
ArdourCanvas::Rectangle* fade_out_trim_handle; ///< fade out trim handle, or 0
ArdourCanvas::Line *start_xfade_in;
ArdourCanvas::Line *start_xfade_out;
ArdourCanvas::SimpleRect* start_xfade_rect;
ArdourCanvas::XFadeCurve* start_xfade_curve;
ArdourCanvas::Rectangle* start_xfade_rect;
bool _start_xfade_visible;
ArdourCanvas::Line *end_xfade_in;
ArdourCanvas::Line *end_xfade_out;
ArdourCanvas::SimpleRect* end_xfade_rect;
ArdourCanvas::XFadeCurve* end_xfade_curve;
ArdourCanvas::Rectangle* end_xfade_rect;
bool _end_xfade_visible;
boost::shared_ptr<AudioRegionGainLine> gain_line;
double _amplitude_above_axis;
uint32_t fade_color;
void reset_fade_shapes ();
void reset_fade_in_shape ();
void reset_fade_out_shape ();
@ -190,15 +190,12 @@ class AudioRegionView : public RegionView
void peaks_ready_handler (uint32_t);
void set_colors ();
void compute_colors (Gdk::Color const &);
void set_waveform_colors ();
void reset_width_dependent_items (double pixel_width);
void set_waveview_data_src();
void set_frame_color ();
void color_handler ();
std::vector<GnomeCanvasWaveViewCache*> wave_caches;
void transients_changed();
AutomationLine::VisibleAspects automation_line_visibility () const;
@ -208,8 +205,7 @@ private:
void parameter_changed (std::string const &);
void setup_waveform_visibility ();
void setup_waveform_shape ();
void setup_waveform_scale ();
void set_some_waveform_colors (std::vector<ArdourCanvas::WaveView*>& waves_to_color);
/** A ScopedConnection for each PeaksReady callback (one per channel). Each member
* may be 0 if no connection exists.
@ -220,6 +216,9 @@ private:
* first list is for start xfades, second list is for end xfades.
*/
std::pair<std::list<AudioRegionView*>, std::list<AudioRegionView*> > _hidden_xfades;
bool trim_fade_in_drag_active;
bool trim_fade_out_drag_active;
};
#endif /* __gtk_ardour_audio_region_view_h__ */

View file

@ -34,19 +34,18 @@
#include "ardour/rc_configuration.h"
#include "ardour/session.h"
#include "canvas/rectangle.h"
#include "audio_streamview.h"
#include "audio_region_view.h"
#include "tape_region_view.h"
#include "audio_time_axis.h"
#include "canvas-waveview.h"
#include "canvas-simplerect.h"
#include "region_selection.h"
#include "selection.h"
#include "public_editor.h"
#include "ardour_ui.h"
#include "rgb_macros.h"
#include "gui_thread.h"
#include "utils.h"
#include "i18n.h"
@ -98,27 +97,27 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_
case Normal:
if (recording) {
region_view = new AudioRegionView (_canvas_group, _trackview, region,
_samples_per_unit, region_color, recording, TimeAxisViewItem::Visibility(
TimeAxisViewItem::ShowFrame |
TimeAxisViewItem::HideFrameRight |
TimeAxisViewItem::HideFrameLeft |
TimeAxisViewItem::HideFrameTB));
_samples_per_pixel, region_color, recording, TimeAxisViewItem::Visibility(
TimeAxisViewItem::ShowFrame |
TimeAxisViewItem::HideFrameRight |
TimeAxisViewItem::HideFrameLeft |
TimeAxisViewItem::HideFrameTB));
} else {
region_view = new AudioRegionView (_canvas_group, _trackview, region,
_samples_per_unit, region_color);
_samples_per_pixel, region_color);
}
break;
case Destructive:
region_view = new TapeAudioRegionView (_canvas_group, _trackview, region,
_samples_per_unit, region_color);
_samples_per_pixel, region_color);
break;
default:
fatal << string_compose (_("programming error: %1"), "illegal track mode in ::add_region_view_internal") << endmsg;
fatal << string_compose (_("programming error: %1"), "illegal track mode in ::create_region_view()") << endmsg;
/*NOTREACHED*/
}
region_view->init (region_color, wait_for_waves);
region_view->init (wait_for_waves);
region_view->set_amplitude_above_axis(_amplitude_above_axis);
region_view->set_height (child_height ());
@ -142,27 +141,6 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai
return 0;
}
// if(!recording){
// for (list<RegionView *>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
// if ((*i)->region() == r) {
// cerr << "audio_streamview in add_region_view_internal region found" << endl;
/* great. we already have a AudioRegionView for this Region. use it again. */
// (*i)->set_valid (true);
// this might not be necessary
// AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
// if (arv) {
// arv->set_waveform_scale (_waveform_scale);
// arv->set_waveform_shape (_waveform_shape);
// }
// return NULL;
// }
// }
// }
region_views.push_front (region_view);
if (_trackview.editor().internal_editing()) {
@ -263,20 +241,20 @@ AudioStreamView::setup_rec_box ()
at = _trackview.audio_track(); /* we know what it is already */
framepos_t const frame_pos = at->current_capture_start ();
gdouble xstart = _trackview.editor().frame_to_pixel (frame_pos);
gdouble xend;
gdouble xstart = _trackview.editor().sample_to_pixel (frame_pos);
gdouble xend = xstart; /* keeps gcc optimized happy, really set in switch() below */
uint32_t fill_color;
switch (_trackview.audio_track()->mode()) {
case Normal:
case NonLayered:
xend = xstart;
fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
break;
case Destructive:
xend = xstart + 2;
fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
/* make the recording rect translucent to allow
the user to see the peak data coming in, etc.
*/
@ -284,19 +262,23 @@ AudioStreamView::setup_rec_box ()
break;
}
ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*_canvas_group);
rec_rect->property_x1() = xstart;
rec_rect->property_y1() = 1.0;
rec_rect->property_x2() = xend;
rec_rect->property_y2() = child_height ();
rec_rect->property_outline_what() = 0x0;
rec_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
rec_rect->property_fill_color_rgba() = fill_color;
rec_rect->lower_to_bottom();
ArdourCanvas::Rectangle * rec_rect = new ArdourCanvas::Rectangle (_canvas_group);
rec_rect->set_x0 (xstart);
rec_rect->set_y0 (0);
rec_rect->set_x1 (xend);
rec_rect->set_y1 (child_height ());
rec_rect->set_outline_what (ArdourCanvas::Rectangle::What (0));
rec_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame());
rec_rect->set_fill_color (fill_color);
RecBoxInfo recbox;
recbox.rectangle = rec_rect;
recbox.start = _trackview.session()->transport_frame();
if (rec_rects.empty()) {
recbox.start = _trackview.session()->record_location ();
} else {
recbox.start = _trackview.session()->transport_frame ();
}
recbox.length = 0;
rec_rects.push_back (recbox);
@ -397,7 +379,7 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt)
assert (n < rec_rects.size());
if (!canvas_item_visible (rec_rects[n].rectangle)) {
if (!rec_rects[n].rectangle->visible()) {
/* rect already hidden, this region is done */
iter = tmp;
continue;
@ -434,9 +416,9 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt)
check_record_layers (region, (region->position() - region->start() + start + cnt));
/* also update rect */
ArdourCanvas::SimpleRect * rect = rec_rects[n].rectangle;
gdouble xend = _trackview.editor().frame_to_pixel (region->position() + region->length());
rect->property_x2() = xend;
ArdourCanvas::Rectangle * rect = rec_rects[n].rectangle;
gdouble xend = _trackview.editor().sample_to_pixel (region->position() + region->length());
rect->set_x1 (xend);
}
} else {
@ -529,15 +511,15 @@ AudioStreamView::color_handler ()
{
//case cAudioTrackBase:
if (_trackview.is_track()) {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioTrackBase.get();
canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_AudioTrackBase());
}
//case cAudioBusBase:
if (!_trackview.is_track()) {
if (Profile->get_sae() && _trackview.route()->is_master()) {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioMasterBusBase.get();
canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_AudioMasterBusBase());
} else {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioBusBase.get();
canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_AudioBusBase());
}
}
}

View file

@ -27,7 +27,6 @@
#include "ardour/location.h"
#include "editing.h"
#include "simplerect.h"
#include "streamview.h"
namespace Gdk {

View file

@ -45,7 +45,6 @@
#include "ardour_ui.h"
#include "audio_time_axis.h"
#include "automation_line.h"
#include "canvas_impl.h"
#include "enums.h"
#include "gui_thread.h"
#include "automation_time_axis.h"
@ -54,7 +53,6 @@
#include "prompter.h"
#include "public_editor.h"
#include "audio_region_view.h"
#include "simplerect.h"
#include "audio_streamview.h"
#include "utils.h"
@ -62,11 +60,12 @@
using namespace std;
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
using namespace PBD;
using namespace Gtk;
using namespace Editing;
AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session* sess, Canvas& canvas)
AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanvas::Canvas& canvas)
: AxisView(sess)
, RouteTimeAxisView(ed, sess, canvas)
{
@ -85,7 +84,7 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
RouteTimeAxisView::set_route (rt);
_view->apply_color (color (), StreamView::RegionColor);
_view->apply_color (gdk_color_to_rgba (color()), StreamView::RegionColor);
// Make sure things are sane...
assert(!is_track() || is_audio_track());
@ -96,8 +95,10 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
if (is_audio_track()) {
controls_ebox.set_name ("AudioTrackControlsBaseUnselected");
time_axis_frame.set_name ("AudioTrackControlsBaseUnselected");
} else { // bus
controls_ebox.set_name ("AudioBusControlsBaseUnselected");
time_axis_frame.set_name ("AudioBusControlsBaseUnselected");
}
/* if set_state above didn't create a gain automation child, we need to make one */
@ -105,6 +106,11 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
create_automation_child (GainAutomation, false);
}
/* if set_state above didn't create a mute automation child, we need to make one */
if (automation_child (MuteAutomation) == 0) {
create_automation_child (MuteAutomation, false);
}
if (_route->panner_shell()) {
_route->panner_shell()->Changed.connect (*this, invalidator (*this),
boost::bind (&AudioTimeAxisView::ensure_pan_views, this, false), gui_context());
@ -203,6 +209,11 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
/* handled elsewhere */
} else if (param.type() == MuteAutomation) {
create_mute_automation_child (param, show);
} else {
error << "AudioTimeAxisView: unknown automation child " << EventTypeMap::instance().to_symbol(param) << endmsg;
}
@ -284,6 +295,22 @@ AudioTimeAxisView::update_gain_track_visibility ()
}
}
void
AudioTimeAxisView::update_mute_track_visibility ()
{
bool const showit = mute_automation_item->get_active();
if (showit != string_is_affirmative (mute_track->gui_property ("visible"))) {
mute_track->set_marked_for_display (showit);
/* now trigger a redisplay */
if (!no_redraw) {
_route->gui_changed (X_("visible_tracks"), (void *) 0); /* EMIT_SIGNAL */
}
}
}
void
AudioTimeAxisView::update_pan_track_visibility ()
{
@ -384,8 +411,10 @@ AudioTimeAxisView::update_control_names ()
if (get_selected()) {
controls_ebox.set_name (controls_base_selected_name);
time_axis_frame.set_name (controls_base_selected_name);
} else {
controls_ebox.set_name (controls_base_unselected_name);
time_axis_frame.set_name (controls_base_unselected_name);
}
}
@ -399,20 +428,27 @@ AudioTimeAxisView::build_automation_action_menu (bool for_selection)
MenuList& automation_items = automation_action_menu->items ();
automation_items.push_back (CheckMenuElem (_("Fader"), sigc::mem_fun (*this, &AudioTimeAxisView::update_gain_track_visibility)));
gain_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
gain_automation_item = dynamic_cast<Gtk::CheckMenuItem*> (&automation_items.back ());
gain_automation_item->set_active ((!for_selection || _editor.get_selection().tracks.size() == 1) &&
(gain_track && string_is_affirmative (gain_track->gui_property ("visible"))));
_main_automation_menu_map[Evoral::Parameter(GainAutomation)] = gain_automation_item;
automation_items.push_back (CheckMenuElem (_("Mute"), sigc::mem_fun (*this, &AudioTimeAxisView::update_mute_track_visibility)));
mute_automation_item = dynamic_cast<Gtk::CheckMenuItem*> (&automation_items.back ());
mute_automation_item->set_active ((!for_selection || _editor.get_selection().tracks.size() == 1) &&
(mute_track && string_is_affirmative (mute_track->gui_property ("visible"))));
_main_automation_menu_map[Evoral::Parameter(MuteAutomation)] = mute_automation_item;
if (!pan_tracks.empty()) {
automation_items.push_back (CheckMenuElem (_("Pan"), sigc::mem_fun (*this, &AudioTimeAxisView::update_pan_track_visibility)));
pan_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
pan_automation_item = dynamic_cast<Gtk::CheckMenuItem*> (&automation_items.back ());
pan_automation_item->set_active ((!for_selection || _editor.get_selection().tracks.size() == 1) &&
(!pan_tracks.empty() && string_is_affirmative (pan_tracks.front()->gui_property ("visible"))));
set<Evoral::Parameter> const & params = _route->pannable()->what_can_be_automated ();
for (set<Evoral::Parameter>::iterator p = params.begin(); p != params.end(); ++p) {
for (set<Evoral::Parameter>::const_iterator p = params.begin(); p != params.end(); ++p) {
_main_automation_menu_map[*p] = pan_automation_item;
}
}

View file

@ -38,7 +38,6 @@
#include "enums.h"
#include "editing.h"
#include "route_time_axis.h"
#include "canvas.h"
namespace ARDOUR {
class Session;
@ -106,9 +105,11 @@ class AudioTimeAxisView : public RouteTimeAxisView
void update_control_names ();
void update_gain_track_visibility ();
void update_mute_track_visibility ();
void update_pan_track_visibility ();
Gtk::CheckMenuItem* gain_automation_item;
Gtk::CheckMenuItem* mute_automation_item;
std::list<boost::shared_ptr<AutomationTimeAxisView> > pan_tracks;
Gtk::CheckMenuItem* pan_automation_item;
};

View file

@ -28,7 +28,6 @@
#include "ardour/session.h"
#include "ardour_ui.h"
#include "utils.h"
#include "automation_controller.h"
#include "gui_thread.h"
@ -46,9 +45,7 @@ AutomationController::AutomationController(boost::shared_ptr<Automatable> printe
{
assert (_printer);
set_name (X_("PluginSlider")); // FIXME: get yer own name!
set_style (BarController::LeftToRight);
set_use_parent (true);
set_name (X_("ProcessorControlSlider"));
StartGesture.connect (sigc::mem_fun(*this, &AutomationController::start_touch));
StopGesture.connect (sigc::mem_fun(*this, &AutomationController::end_touch));
@ -74,9 +71,9 @@ AutomationController::create(
{
Gtk::Adjustment* adjustment = manage (
new Gtk::Adjustment (
ac->internal_to_interface (param.normal()),
ac->internal_to_interface (param.min()),
ac->internal_to_interface (param.max()),
param.normal(),
param.min(),
param.max(),
(param.max() - param.min()) / 100.0,
(param.max() - param.min()) / 10.0
)
@ -97,7 +94,7 @@ AutomationController::get_label (double& xpos)
void
AutomationController::display_effective_value()
{
double const interface_value = _controllable->internal_to_interface (_controllable->get_value());
double const interface_value = _controllable->get_value();
if (_adjustment->get_value () != interface_value) {
_ignore_change = true;
@ -110,7 +107,7 @@ void
AutomationController::value_adjusted ()
{
if (!_ignore_change) {
_controllable->set_value (_controllable->interface_to_internal (_adjustment->get_value()));
_controllable->set_value (_adjustment->get_value());
}
}

View file

@ -17,6 +17,13 @@
*/
#ifdef COMPILER_MSVC
#include <float.h>
/* isinf() & isnan() are C99 standards, which older MSVC doesn't provide */
#define isinf(val) !((bool)_finite((double)val))
#define isnan(val) (bool)_isnan((double)val)
#endif
#include <cmath>
#include <climits>
#include <vector>
@ -32,17 +39,18 @@
#include "ardour/automation_list.h"
#include "ardour/dB.h"
#include "ardour/debug.h"
#include "ardour/tempo.h"
#include "evoral/Curve.hpp"
#include "simplerect.h"
#include "canvas/debug.h"
#include "automation_line.h"
#include "control_point.h"
#include "gui_thread.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
#include "public_editor.h"
#include "utils.h"
#include "selection.h"
#include "time_axis_view.h"
#include "point_selection.h"
@ -57,12 +65,11 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
using namespace Editing;
using namespace Gnome; // for Canvas
/** @param converter A TimeConverter whose origin_b is the start time of the AutomationList in session frames.
* This will not be deleted by AutomationLine.
*/
AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanvas::Group& parent,
AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanvas::Item& parent,
boost::shared_ptr<AutomationList> al,
Evoral::TimeConverter<double, framepos_t>* converter)
: trackview (tv)
@ -74,10 +81,8 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv
, _maximum_time (max_framepos)
{
if (converter) {
_time_converter = converter;
_our_time_converter = false;
} else {
_time_converter = new Evoral::IdentityConverter<double, framepos_t>;
_our_time_converter = true;
}
@ -91,15 +96,16 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv
terminal_points_can_slide = true;
_height = 0;
group = new ArdourCanvas::Group (parent);
group->property_x() = 0.0;
group->property_y() = 0.0;
group = new ArdourCanvas::Container (&parent);
CANVAS_DEBUG_NAME (group, "region gain envelope group");
line = new ArdourCanvas::Line (*group);
line->property_width_pixels() = (guint)1;
line = new ArdourCanvas::PolyLine (group);
CANVAS_DEBUG_NAME (line, "region gain envelope line");
line->set_data ("line", this);
line->set_outline_width (2.0);
line->set_covers_threshold (4.0);
line->signal_event().connect (sigc::mem_fun (*this, &AutomationLine::event_handler));
line->Event.connect (sigc::mem_fun (*this, &AutomationLine::event_handler));
trackview.session()->register_with_memento_command_factory(alist->id(), this);
@ -130,7 +136,7 @@ AutomationLine::event_handler (GdkEvent* event)
}
void
AutomationLine::show ()
AutomationLine::update_visibility ()
{
if (_visible & Line) {
/* Only show the line there are some points, otherwise we may show an out-of-date line
@ -142,30 +148,42 @@ AutomationLine::show ()
} else {
line->hide ();
}
if (_visible & ControlPoints) {
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->show ();
}
} else if (_visible & SelectedControlPoints) {
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
if ((*i)->get_selected()) {
(*i)->show ();
} else {
(*i)->hide ();
}
}
} else {
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->hide ();
}
}
} else {
line->hide();
line->hide ();
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->hide ();
}
}
if (_visible & ControlPoints) {
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->set_visible (true);
(*i)->show ();
}
} else if (_visible & SelectedControlPoints) {
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->set_visible ((*i)->get_selected());
}
} else {
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->set_visible (false);
}
}
}
void
AutomationLine::hide ()
{
set_visibility (VisibleAspects (0));
/* leave control points setting unchanged, we are just hiding the
overall line
*/
set_visibility (AutomationLine::VisibleAspects (_visible & ~Line));
}
double
@ -204,7 +222,7 @@ void
AutomationLine::set_line_color (uint32_t color)
{
_line_color = color;
line->property_fill_color_rgba() = color;
line->set_outline_color (color);
}
void
@ -247,7 +265,7 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
y = min (1.0, y);
y = _height - (y * _height);
double const x = trackview.editor().frame_to_unit_unrounded (_time_converter->to((*cp.model())->when) - _offset);
double const x = trackview.editor().sample_to_pixel_unrounded (_time_converter->to((*cp.model())->when) - _offset);
trackview.editor().session()->begin_reversible_command (_("automation event move"));
trackview.editor().session()->add_command (
@ -258,7 +276,7 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
reset_line_coords (cp);
if (line_points.size() > 1) {
line->property_points() = line_points;
line->set (line_points);
}
alist->freeze ();
@ -278,8 +296,8 @@ void
AutomationLine::reset_line_coords (ControlPoint& cp)
{
if (cp.view_index() < line_points.size()) {
line_points[cp.view_index()].set_x (cp.get_x());
line_points[cp.view_index()].set_y (cp.get_y());
line_points[cp.view_index()].x = cp.get_x ();
line_points[cp.view_index()].y = cp.get_y ();
}
}
@ -500,11 +518,12 @@ AutomationLine::ContiguousControlPoints::ContiguousControlPoints (AutomationLine
}
void
AutomationLine::ContiguousControlPoints::compute_x_bounds ()
AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e)
{
uint32_t sz = size();
if (sz > 0 && sz < line.npoints()) {
const TempoMap& map (e.session()->tempo_map());
/* determine the limits on x-axis motion for this
contiguous range of control points
@ -512,14 +531,30 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds ()
if (front()->view_index() > 0) {
before_x = line.nth (front()->view_index() - 1)->get_x();
const framepos_t pos = e.pixel_to_sample(before_x);
const Meter& meter = map.meter_at (pos);
const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at (pos), e.session()->frame_rate())
/ (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()) );
const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len);
before_x += one_tick_in_pixels;
}
/* if our last point has a point after it in the line,
we have an "after" bound
*/
if (back()->view_index() < (line.npoints() - 2)) {
if (back()->view_index() < (line.npoints() - 1)) {
after_x = line.nth (back()->view_index() + 1)->get_x();
const framepos_t pos = e.pixel_to_sample(after_x);
const Meter& meter = map.meter_at (pos);
const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at (pos), e.session()->frame_rate())
/ (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()));
const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len);
after_x -= one_tick_in_pixels;
}
}
}
@ -623,7 +658,7 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
}
for (vector<CCP>::iterator ccp = contiguous_points.begin(); ccp != contiguous_points.end(); ++ccp) {
(*ccp)->compute_x_bounds ();
(*ccp)->compute_x_bounds (trackview.editor());
}
}
@ -678,7 +713,7 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
*/
if (line_points.size() > 1) {
line->property_points() = line_points;
line->set (line_points);
}
}
@ -737,10 +772,10 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp)
/* if xval has not changed, set it directly from the model to avoid rounding errors */
if (view_x == trackview.editor().frame_to_unit_unrounded (_time_converter->to ((*cp.model())->when)) - _offset) {
if (view_x == trackview.editor().sample_to_pixel_unrounded (_time_converter->to ((*cp.model())->when)) - _offset) {
view_x = (*cp.model())->when - _offset;
} else {
view_x = trackview.editor().unit_to_frame (view_x);
view_x = trackview.editor().pixel_to_sample (view_x);
view_x = _time_converter->from (view_x + _offset);
}
@ -758,7 +793,7 @@ AutomationLine::control_points_adjacent (double xval, uint32_t & before, uint32_
ControlPoint *acp = 0;
double unit_xval;
unit_xval = trackview.editor().frame_to_unit_unrounded (xval);
unit_xval = trackview.editor().sample_to_pixel_unrounded (xval);
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
@ -877,7 +912,7 @@ AutomationLine::set_selected_points (PointSelection const & points)
void AutomationLine::set_colors ()
{
set_line_color (ARDOUR_UI::config()->canvasvar_AutomationLine.get());
set_line_color (ARDOUR_UI::config()->get_canvasvar_AutomationLine());
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->set_color ();
}
@ -930,7 +965,7 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
model_to_view_coord (tx, ty);
if (std::isnan (tx) || std::isnan (ty)) {
if (isnan (tx) || isnan (ty)) {
warning << string_compose (_("Ignoring illegal points on AutomationLine \"%1\""),
_name) << endmsg;
continue;
@ -944,7 +979,7 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
* zoom and scroll into account).
*/
tx = trackview.editor().frame_to_unit_unrounded (tx);
tx = trackview.editor().sample_to_pixel_unrounded (tx);
/* convert from canonical view height (0..1.0) to actual
* height coordinates (using X11's top-left rooted system)
@ -973,7 +1008,7 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
/* reset the line coordinates given to the CanvasLine */
while (line_points.size() < vp) {
line_points.push_back (Art::Point (0,0));
line_points.push_back (ArdourCanvas::Duple (0,0));
}
while (line_points.size() > vp) {
@ -981,15 +1016,13 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
}
for (uint32_t n = 0; n < vp; ++n) {
line_points[n].set_x (control_points[n]->get_x());
line_points[n].set_y (control_points[n]->get_y());
line_points[n].x = control_points[n]->get_x();
line_points[n].y = control_points[n]->get_y();
}
line->property_points() = line_points;
line->set (line_points);
if (_visible && alist->interpolation() != AutomationList::Discrete) {
line->show();
}
update_visibility ();
}
set_selected_points (trackview.editor().get_selection().points);
@ -1057,22 +1090,34 @@ AutomationLine::set_list (boost::shared_ptr<ARDOUR::AutomationList> list)
void
AutomationLine::add_visibility (VisibleAspects va)
{
VisibleAspects old = _visible;
_visible = VisibleAspects (_visible | va);
show ();
if (old != _visible) {
update_visibility ();
}
}
void
AutomationLine::set_visibility (VisibleAspects va)
{
_visible = va;
show ();
if (_visible != va) {
_visible = va;
update_visibility ();
}
}
void
AutomationLine::remove_visibility (VisibleAspects va)
{
VisibleAspects old = _visible;
_visible = VisibleAspects (_visible & ~va);
show ();
if (old != _visible) {
update_visibility ();
}
}
void
@ -1208,9 +1253,8 @@ AutomationLine::add_visible_control_point (uint32_t view_index, uint32_t pi, dou
if (_visible & ControlPoints) {
control_points[view_index]->show ();
control_points[view_index]->set_visible (true);
} else {
control_points[view_index]->set_visible (false);
control_points[view_index]->hide ();
}
}

View file

@ -25,10 +25,7 @@
#include <string>
#include <sys/types.h>
#include <libgnomecanvasmm/line.h>
#include <sigc++/signal.h>
#include "canvas.h"
#include "simplerect.h"
#include "evoral/TimeConverter.hpp"
@ -39,6 +36,10 @@
#include "ardour/automation_list.h"
#include "ardour/types.h"
#include "canvas/types.h"
#include "canvas/container.h"
#include "canvas/poly_line.h"
class AutomationLine;
class ControlPoint;
class PointSelection;
@ -46,12 +47,8 @@ class TimeAxisView;
class AutomationTimeAxisView;
class Selectable;
class Selection;
class PublicEditor;
namespace Gnome {
namespace Canvas {
class SimpleRect;
}
}
/** A GUI representation of an ARDOUR::AutomationList */
class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
@ -63,7 +60,7 @@ public:
SelectedControlPoints = 0x4
};
AutomationLine (const std::string& name, TimeAxisView&, ArdourCanvas::Group&,
AutomationLine (const std::string& name, TimeAxisView&, ArdourCanvas::Item&,
boost::shared_ptr<ARDOUR::AutomationList>,
Evoral::TimeConverter<double, ARDOUR::framepos_t>* converter = 0);
virtual ~AutomationLine ();
@ -108,7 +105,7 @@ public:
TimeAxisView& trackview;
ArdourCanvas::Group& canvas_group() const { return *group; }
ArdourCanvas::Container& canvas_group() const { return *group; }
ArdourCanvas::Item& parent_group() const { return _parent_group; }
ArdourCanvas::Item& grab_item() const { return *line; }
@ -176,9 +173,9 @@ protected:
/** true if we did a push at any point during the current drag */
bool did_push;
ArdourCanvas::Group& _parent_group;
ArdourCanvas::Group* group;
ArdourCanvas::Line* line; /* line */
ArdourCanvas::Item& _parent_group;
ArdourCanvas::Container* group;
ArdourCanvas::PolyLine* line; /* line */
ArdourCanvas::Points line_points; /* coordinates for canvas line */
std::vector<ControlPoint*> control_points; /* visible control points */
@ -187,7 +184,7 @@ public:
ContiguousControlPoints (AutomationLine& al);
double clamp_dx (double dx);
void move (double dx, double dy);
void compute_x_bounds ();
void compute_x_bounds (PublicEditor& e);
private:
AutomationLine& line;
double before_x;
@ -222,7 +219,7 @@ private:
*/
ARDOUR::framecnt_t _offset;
void show ();
void update_visibility ();
void reset_line_coords (ControlPoint&);
void add_visible_control_point (uint32_t, uint32_t, double, double, ARDOUR::AutomationList::iterator, uint32_t);
double control_point_box_size ();

View file

@ -39,13 +39,13 @@
#include "i18n.h"
AutomationRegionView::AutomationRegionView (ArdourCanvas::Group* parent,
AutomationRegionView::AutomationRegionView (ArdourCanvas::Container* parent,
AutomationTimeAxisView& time_axis,
boost::shared_ptr<ARDOUR::Region> region,
const Evoral::Parameter& param,
boost::shared_ptr<ARDOUR::AutomationList> list,
double spu,
Gdk::Color const & basic_color)
uint32_t basic_color)
: RegionView(parent, time_axis, region, spu, basic_color, true)
, _parameter(param)
{
@ -54,7 +54,7 @@ AutomationRegionView::AutomationRegionView (ArdourCanvas::Group*
create_line(list);
}
group->signal_event().connect (sigc::mem_fun (this, &AutomationRegionView::canvas_event), false);
group->Event.connect (sigc::mem_fun (this, &AutomationRegionView::canvas_event));
group->raise_to_top();
}
@ -63,15 +63,13 @@ AutomationRegionView::~AutomationRegionView ()
}
void
AutomationRegionView::init (Gdk::Color const & basic_color, bool /*wfd*/)
AutomationRegionView::init (bool /*wfd*/)
{
_enable_display = false;
RegionView::init(basic_color, false);
RegionView::init (false);
compute_colors (basic_color);
reset_width_dependent_items ((double) _region->length() / samples_per_unit);
reset_width_dependent_items ((double) _region->length() / samples_per_pixel);
set_height (trackview.current_height());
@ -116,17 +114,15 @@ AutomationRegionView::canvas_event (GdkEvent* ev)
double y = ev->button.y;
/* convert to item coordinates in the time axis view */
automation_view()->canvas_display()->w2i (x, y);
automation_view()->canvas_display()->canvas_to_item (x, y);
/* clamp y */
y = std::max (y, 0.0);
y = std::min (y, _height - NAME_HIGHLIGHT_SIZE);
/* guard points only if primary modifier is used */
bool with_guard_points = Gtkmm2ext::Keyboard::modifier_state_equals (ev->button.state, Gtkmm2ext::Keyboard::PrimaryModifier);
add_automation_event (ev, trackview.editor().pixel_to_frame (x) - _region->position() + _region->start(), y, with_guard_points);
add_automation_event (ev, trackview.editor().pixel_to_sample (x) - _region->position() + _region->start(), y, with_guard_points);
}
return false;

View file

@ -26,7 +26,6 @@
#include "automation_time_axis.h"
#include "automation_line.h"
#include "enums.h"
#include "canvas.h"
namespace ARDOUR {
class AutomationList;
@ -38,17 +37,17 @@ class TimeAxisView;
class AutomationRegionView : public RegionView
{
public:
AutomationRegionView(ArdourCanvas::Group*,
AutomationRegionView(ArdourCanvas::Container*,
AutomationTimeAxisView&,
boost::shared_ptr<ARDOUR::Region>,
const Evoral::Parameter& parameter,
boost::shared_ptr<ARDOUR::AutomationList>,
double initial_samples_per_unit,
Gdk::Color const & basic_color);
double initial_samples_per_pixel,
uint32_t basic_color);
~AutomationRegionView();
void init (Gdk::Color const & basic_color, bool wfd);
void init (bool wfd);
inline AutomationTimeAxisView* automation_view() const
{ return dynamic_cast<AutomationTimeAxisView*>(&trackview); }
@ -56,7 +55,7 @@ public:
boost::shared_ptr<AutomationLine> line() { return _line; }
// We are a ghost. Meta ghosts? Crazy talk.
virtual GhostRegion* add_ghost(TimeAxisView&) { return NULL; }
virtual GhostRegion* add_ghost(TimeAxisView&) { return 0; }
void set_height (double);
void reset_width_dependent_items(double pixel_width);

View file

@ -22,7 +22,10 @@
#include <gtkmm.h>
#include <gtkmm2ext/gtk_ui.h>
#include "gtkmm2ext/gtk_ui.h"
#include "pbd/compose.h"
#include "canvas/debug.h"
#include "ardour/midi_region.h"
#include "ardour/midi_source.h"
@ -31,16 +34,12 @@
#include "region_view.h"
#include "automation_region_view.h"
#include "automation_time_axis.h"
#include "canvas-simplerect.h"
#include "region_selection.h"
#include "selection.h"
#include "public_editor.h"
#include "ardour_ui.h"
#include "rgb_macros.h"
#include "gui_thread.h"
#include "utils.h"
#include "simplerect.h"
#include "simpleline.h"
using namespace std;
using namespace ARDOUR;
@ -49,13 +48,15 @@ using namespace Editing;
AutomationStreamView::AutomationStreamView (AutomationTimeAxisView& tv)
: StreamView (*dynamic_cast<RouteTimeAxisView*>(tv.get_parent()),
new ArdourCanvas::Group(*tv.canvas_background()),
new ArdourCanvas::Group(*tv.canvas_display()))
tv.canvas_display())
, _automation_view(tv)
, _pending_automation_state (Off)
{
//canvas_rect->property_fill_color_rgba() = stream_base_color;
canvas_rect->property_outline_color_rgba() = RGBA_BLACK;
CANVAS_DEBUG_NAME (_canvas_group, string_compose ("SV canvas group auto %1", tv.name()));
CANVAS_DEBUG_NAME (canvas_rect, string_compose ("SV canvas rectangle auto %1", tv.name()));
canvas_rect->set_fill (false);
canvas_rect->set_outline_color (RGBA_BLACK);
}
AutomationStreamView::~AutomationStreamView ()
@ -64,11 +65,11 @@ AutomationStreamView::~AutomationStreamView ()
RegionView*
AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region, bool wfd, bool /*recording*/)
AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region, bool wait_for_data, bool /*recording*/)
{
assert (region);
if (wfd) {
if (wait_for_data) {
boost::shared_ptr<MidiRegion> mr = boost::dynamic_pointer_cast<MidiRegion>(region);
if (mr) {
mr->midi_source()->load_model();
@ -98,7 +99,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
arv->line()->set_list (list);
}
(*i)->set_valid (true);
(*i)->enable_display(wfd);
(*i)->enable_display (wait_for_data);
display_region(arv);
return 0;
@ -108,20 +109,20 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
region_view = new AutomationRegionView (
_canvas_group, _automation_view, region,
_automation_view.parameter (), list,
_samples_per_unit, region_color
_samples_per_pixel, region_color
);
region_view->init (region_color, false);
region_view->init (false);
region_views.push_front (region_view);
/* follow global waveform setting */
if (wfd) {
if (wait_for_data) {
region_view->enable_display(true);
//region_view->midi_region()->midi_source(0)->load_model();
// region_view->midi_region()->midi_source(0)->load_model();
}
display_region(region_view);
display_region (region_view);
/* catch regionview going away */
region->DropReferences.connect (*this, invalidator (*this), boost::bind (&AutomationStreamView::remove_region_view, this, boost::weak_ptr<Region>(region)), gui_context());
@ -191,11 +192,11 @@ void
AutomationStreamView::color_handler ()
{
/*if (_trackview.is_midi_track()) {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiTrackBase.get();
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->get_canvasvar_MidiTrackBase();
}
if (!_trackview.is_midi_track()) {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiBusBase.get();;
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->get_canvasvar_MidiBusBase();;
}*/
}

View file

@ -24,7 +24,6 @@
#include "ardour/location.h"
#include "enums.h"
#include "simplerect.h"
#include "streamview.h"
#include "time_axis_view_item.h"
#include "route_time_axis.h"

View file

@ -28,9 +28,12 @@
#include "ardour/automation_control.h"
#include "ardour/event_type_map.h"
#include "ardour/profile.h"
#include "ardour/route.h"
#include "ardour/session.h"
#include "canvas/debug.h"
#include "ardour_ui.h"
#include "automation_time_axis.h"
#include "automation_streamview.h"
@ -39,11 +42,9 @@
#include "route_time_axis.h"
#include "automation_line.h"
#include "public_editor.h"
#include "simplerect.h"
#include "selection.h"
#include "rgb_macros.h"
#include "point_selection.h"
#include "canvas_impl.h"
#include "control_point.h"
#include "utils.h"
@ -51,6 +52,7 @@
using namespace std;
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
using namespace PBD;
using namespace Gtk;
using namespace Gtkmm2ext;
@ -84,12 +86,17 @@ AutomationTimeAxisView::AutomationTimeAxisView (
, _control (c)
, _automatable (a)
, _parameter (p)
, _base_rect (0)
, _view (show_regions ? new AutomationStreamView (*this) : 0)
, _base_rect (new ArdourCanvas::Rectangle (_canvas_display))
, _name (nom)
, _view (show_regions ? new AutomationStreamView (*this) : 0)
, auto_button (X_("")) /* force addition of a label */
, _show_regions (show_regions)
{
CANVAS_DEBUG_NAME (_canvas_display, string_compose ("main for auto %2/%1", _name, r->name()));
CANVAS_DEBUG_NAME (selection_group, string_compose ("selections for auto %2/%1", _name, r->name()));
CANVAS_DEBUG_NAME (_ghost_group, string_compose ("ghosts for auto %2/%1", _name, r->name()));
if (!have_name_font) {
name_font = get_font_for_style (X_("AutomationTrackName"));
have_name_font = true;
@ -110,33 +117,22 @@ AutomationTimeAxisView::AutomationTimeAxisView (
ignore_state_request = false;
first_call_to_set_height = true;
_base_rect = new SimpleRect(*_canvas_display);
_base_rect->property_x1() = 0.0;
_base_rect->property_y1() = 0.0;
/** gnomecanvas sometimes converts this value to int or adds 2 to it, so it must be
set correctly to avoid overflow.
*/
_base_rect->property_x2() = INT_MAX - 2;
_base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_AutomationTrackOutline.get();
/* outline ends and bottom */
_base_rect->property_outline_what() = (guint32) (0x1|0x2|0x8);
_base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AutomationTrackFill.get();
CANVAS_DEBUG_NAME (_base_rect, string_compose ("base rect for %1", _name));
_base_rect->set_x1 (ArdourCanvas::COORD_MAX);
_base_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_AutomationTrackOutline());
_base_rect->set_outline_what (ArdourCanvas::Rectangle::BOTTOM); // bottom separator
_base_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_AutomationTrackFill());
_base_rect->set_data ("trackview", this);
_base_rect->signal_event().connect (sigc::bind (
sigc::mem_fun (_editor, &PublicEditor::canvas_automation_track_event),
_base_rect, this));
_base_rect->Event.connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_automation_track_event), _base_rect, this));
if (!a) {
_base_rect->lower_to_bottom();
}
hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
hide_button.set_elements ((ArdourButton::Element)(ArdourButton::Edge|ArdourButton::Body|ArdourButton::CloseCross));
hide_button.set_tweaks(ArdourButton::TrackHeader);
auto_button.set_name ("TrackVisualButton");
hide_button.set_name ("TrackRemoveButton");
auto_button.set_name ("route button");
hide_button.set_name ("route button");
auto_button.unset_flags (Gtk::CAN_FOCUS);
hide_button.unset_flags (Gtk::CAN_FOCUS);
@ -153,6 +149,9 @@ AutomationTimeAxisView::AutomationTimeAxisView (
set_height (preset_height (HeightNormal));
}
//name label isn't editable on an automation track; remove the tooltip
ARDOUR_UI::instance()->set_tip (name_label, X_(""));
/* repack the name label */
if (name_label.get_parent()) {
@ -160,8 +159,8 @@ AutomationTimeAxisView::AutomationTimeAxisView (
}
name_label.set_text (_name);
name_label.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
name_label.set_name (X_("TrackParameterName"));
name_label.set_alignment (Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
name_label.set_name (X_("TrackParameterName"));
name_label.set_ellipsize (Pango::ELLIPSIZE_END);
string tipname = nomparent;
@ -172,28 +171,66 @@ AutomationTimeAxisView::AutomationTimeAxisView (
ARDOUR_UI::instance()->set_tip(controls_ebox, tipname);
/* add the buttons */
controls_table.attach (hide_button, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.attach (name_label, 0, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.attach (auto_button, 6, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.set_border_width (1);
controls_table.remove (name_hbox);
controls_table.attach (hide_button, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
controls_table.attach (name_label, 2, 3, 1, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 2, 0);
controls_table.attach (auto_button, 3, 4, 2, 3, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
Gtk::DrawingArea *blank0 = manage (new Gtk::DrawingArea());
Gtk::DrawingArea *blank1 = manage (new Gtk::DrawingArea());
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(&parent);
// TODO use rtv->controls_base_unselected_name
// subscribe to route_active_changed, ...
if (rtv && rtv->is_audio_track()) {
blank0->set_name ("AudioTrackControlsBaseUnselected");
}
else if (rtv && rtv->is_midi_track()) {
blank0->set_name ("MidiTrackControlsBaseUnselected");
}
else {
blank0->set_name ("AudioBusControlsBaseUnselected");
}
blank0->set_size_request (-1, -1);
blank1->set_size_request (1, 0);
VSeparator* separator = manage (new VSeparator());
separator->set_name("TrackSeparator");
separator->set_size_request (1, -1);
controls_button_size_group->add_widget(hide_button);
controls_button_size_group->add_widget(*blank0);
time_axis_hbox.pack_start (*blank0, false, false);
time_axis_hbox.pack_start (*separator, false, false);
time_axis_hbox.reorder_child (*blank0, 0);
time_axis_hbox.reorder_child (*separator, 1);
time_axis_hbox.reorder_child (time_axis_vbox, 2);
if (!ARDOUR::Profile->get_mixbus() ) {
time_axis_hbox.pack_start (*blank1, false, false);
}
blank0->show();
separator->show();
name_label.show ();
hide_button.show ();
if (_controller) {
_controller.get()->set_size_request(-1, 24);
/* add bar controller */
controls_table.attach (*_controller.get(), 1, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
/* note that this handler connects *before* the default handler */
_controller->event_widget().signal_scroll_event().connect (mem_fun (*this, &AutomationTimeAxisView::controls_ebox_scroll), false);
_controller.get()->set_tweaks (PixFader::Tweaks(_controller.get()->tweaks() | PixFader::NoVerticalScroll));
controls_table.attach (*_controller.get(), 2, 4, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
}
controls_table.show_all ();
hide_button.signal_clicked().connect (sigc::mem_fun(*this, &AutomationTimeAxisView::hide_clicked));
auto_button.signal_clicked().connect (sigc::mem_fun(*this, &AutomationTimeAxisView::auto_clicked));
hide_button.signal_clicked.connect (sigc::mem_fun(*this, &AutomationTimeAxisView::hide_clicked));
auto_button.signal_clicked.connect (sigc::mem_fun(*this, &AutomationTimeAxisView::auto_clicked));
controls_base_selected_name = X_("AutomationTrackControlsBaseSelected");
controls_base_unselected_name = X_("AutomationTrackControlsBase");
controls_ebox.set_name (controls_base_unselected_name);
time_axis_frame.set_name (controls_base_unselected_name);
/* ask for notifications of any new RegionViews */
if (show_regions) {
@ -216,7 +253,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (
)
);
line->set_line_color (ARDOUR_UI::config()->canvasvar_ProcessorAutomationLine.get());
line->set_line_color (ARDOUR_UI::config()->get_canvasvar_ProcessorAutomationLine());
line->queue_reset ();
add_line (line);
}
@ -304,7 +341,7 @@ AutomationTimeAxisView::automation_state_changed ()
switch (state & (ARDOUR::Off|Play|Touch|Write)) {
case ARDOUR::Off:
auto_button.set_label (S_("Automation|Manual"));
auto_button.set_text (S_("Automation|Manual"));
if (auto_off_item) {
ignore_state_request = true;
auto_off_item->set_active (true);
@ -315,7 +352,7 @@ AutomationTimeAxisView::automation_state_changed ()
}
break;
case Play:
auto_button.set_label (_("Play"));
auto_button.set_text (_("Play"));
if (auto_play_item) {
ignore_state_request = true;
auto_play_item->set_active (true);
@ -326,7 +363,7 @@ AutomationTimeAxisView::automation_state_changed ()
}
break;
case Write:
auto_button.set_label (_("Write"));
auto_button.set_text (_("Write"));
if (auto_write_item) {
ignore_state_request = true;
auto_write_item->set_active (true);
@ -337,7 +374,7 @@ AutomationTimeAxisView::automation_state_changed ()
}
break;
case Touch:
auto_button.set_label (_("Touch"));
auto_button.set_text (_("Touch"));
if (auto_touch_item) {
ignore_state_request = true;
auto_touch_item->set_active (true);
@ -348,7 +385,7 @@ AutomationTimeAxisView::automation_state_changed ()
}
break;
default:
auto_button.set_label (_("???"));
auto_button.set_text (_("???"));
break;
}
}
@ -410,7 +447,7 @@ AutomationTimeAxisView::set_height (uint32_t h)
TimeAxisView::set_height (h);
_base_rect->property_y2() = h;
_base_rect->set_y1 (h);
if (_line) {
_line->set_height(h);
@ -427,16 +464,18 @@ AutomationTimeAxisView::set_height (uint32_t h)
if (h >= preset_height (HeightNormal)) {
auto_button.show();
hide_button.show_all();
name_label.show();
hide_button.show();
} else if (h >= preset_height (HeightSmall)) {
controls_table.hide_all ();
auto_button.hide();
name_label.hide();
}
}
if (changed) {
if (canvas_item_visible (_canvas_display) && _route) {
if (_canvas_display->visible() && _route) {
/* only emit the signal if the height really changed and we were visible */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
@ -444,16 +483,16 @@ AutomationTimeAxisView::set_height (uint32_t h)
}
void
AutomationTimeAxisView::set_samples_per_unit (double spu)
AutomationTimeAxisView::set_samples_per_pixel (double fpp)
{
TimeAxisView::set_samples_per_unit (spu);
TimeAxisView::set_samples_per_pixel (fpp);
if (_line) {
_line->reset ();
}
if (_view) {
_view->set_samples_per_unit (spu);
_view->set_samples_per_pixel (fpp);
}
}
@ -496,22 +535,22 @@ AutomationTimeAxisView::build_display_menu ()
as_items.push_back (CheckMenuElem (S_("Automation|Manual"), sigc::bind (
sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state),
(AutoState) ARDOUR::Off)));
auto_off_item = dynamic_cast<CheckMenuItem*>(&as_items.back());
auto_off_item = dynamic_cast<Gtk::CheckMenuItem*>(&as_items.back());
as_items.push_back (CheckMenuElem (_("Play"), sigc::bind (
sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state),
(AutoState) Play)));
auto_play_item = dynamic_cast<CheckMenuItem*>(&as_items.back());
auto_play_item = dynamic_cast<Gtk::CheckMenuItem*>(&as_items.back());
as_items.push_back (CheckMenuElem (_("Write"), sigc::bind (
sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state),
(AutoState) Write)));
auto_write_item = dynamic_cast<CheckMenuItem*>(&as_items.back());
auto_write_item = dynamic_cast<Gtk::CheckMenuItem*>(&as_items.back());
as_items.push_back (CheckMenuElem (_("Touch"), sigc::bind (
sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state),
(AutoState) Touch)));
auto_touch_item = dynamic_cast<CheckMenuItem*>(&as_items.back());
auto_touch_item = dynamic_cast<Gtk::CheckMenuItem*>(&as_items.back());
items.push_back (MenuElem (_("State"), *auto_state_menu));
@ -531,13 +570,13 @@ AutomationTimeAxisView::build_display_menu ()
am_items.push_back (RadioMenuElem (group, _("Discrete"), sigc::bind (
sigc::mem_fun(*this, &AutomationTimeAxisView::set_interpolation),
AutomationList::Discrete)));
mode_discrete_item = dynamic_cast<CheckMenuItem*>(&am_items.back());
mode_discrete_item = dynamic_cast<Gtk::CheckMenuItem*>(&am_items.back());
mode_discrete_item->set_active (s == AutomationList::Discrete);
am_items.push_back (RadioMenuElem (group, _("Linear"), sigc::bind (
sigc::mem_fun(*this, &AutomationTimeAxisView::set_interpolation),
AutomationList::Linear)));
mode_line_item = dynamic_cast<CheckMenuItem*>(&am_items.back());
mode_line_item = dynamic_cast<Gtk::CheckMenuItem*>(&am_items.back());
mode_line_item->set_active (s == AutomationList::Linear);
items.push_back (MenuElem (_("Mode"), *auto_mode_menu));
@ -567,7 +606,7 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when,
double x = 0;
_canvas_display->w2i (x, y);
_canvas_display->canvas_to_item (x, y);
/* compute vertical fractional position */

View file

@ -30,10 +30,11 @@
#include "ardour/automatable.h"
#include "ardour/automation_list.h"
#include "canvas.h"
#include "canvas/rectangle.h"
#include "time_axis_view.h"
#include "simplerect.h"
#include "automation_controller.h"
#include "ardour_button.h"
namespace ARDOUR {
class Session;
@ -69,7 +70,7 @@ class AutomationTimeAxisView : public TimeAxisView {
~AutomationTimeAxisView();
virtual void set_height (uint32_t);
void set_samples_per_unit (double);
void set_samples_per_pixel (double);
std::string name() const { return _name; }
void add_automation_event (GdkEvent *, framepos_t, double, bool with_guard_points);
@ -132,19 +133,19 @@ class AutomationTimeAxisView : public TimeAxisView {
boost::shared_ptr<AutomationController> _controller;
Evoral::Parameter _parameter;
ArdourCanvas::SimpleRect* _base_rect;
ArdourCanvas::Rectangle* _base_rect;
boost::shared_ptr<AutomationLine> _line;
std::string _name;
/** AutomationStreamView if we are editing region-based automation (for MIDI), otherwise 0 */
AutomationStreamView* _view;
std::string _name;
bool ignore_toggle;
bool first_call_to_set_height;
Gtk::Button hide_button;
Gtk::Button auto_button;
ArdourButton hide_button;
ArdourButton auto_button;
Gtk::Menu* automation_menu;
Gtk::Label* plugname;
bool plugname_packed;
@ -165,6 +166,8 @@ class AutomationTimeAxisView : public TimeAxisView {
void hide_clicked ();
void auto_clicked ();
virtual bool can_edit_name() const {return false;}
void build_display_menu ();
void cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp);

View file

@ -43,6 +43,7 @@ using namespace std;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
list<Gdk::Color> AxisView::used_colors;
@ -65,7 +66,14 @@ AxisView::unique_random_color()
string
AxisView::gui_property (const string& property_name) const
{
return gui_object_state().get_string (state_id(), property_name);
if (property_hashtable.count(property_name)) {
return property_hashtable[property_name];
} else {
string rv = gui_object_state().get_string (state_id(), property_name);
property_hashtable.erase(property_name);
property_hashtable.emplace(property_name, rv);
return rv;
}
}
bool
@ -83,7 +91,6 @@ AxisView::set_marked_for_display (bool yn)
set_gui_property ("visible", yn);
return true; // things changed
}
return false;
}

View file

@ -21,6 +21,7 @@
#define __ardour_gtk_axis_view_h__
#include <list>
#include <boost/unordered_map.hpp>
#include <gtkmm/label.h>
#include <gdkmm/color.h>
@ -63,6 +64,10 @@ class AxisView : public virtual Selectable, public PBD::ScopedConnectionList, pu
std::string gui_property (const std::string& property_name) const;
template<typename T> void set_gui_property (const std::string& property_name, const T& value) {
std::stringstream s;
s << value;
property_hashtable.erase(property_name);
property_hashtable.emplace(property_name, s.str());
gui_object_state().set_property<T> (state_id(), property_name, value);
}
@ -83,14 +88,13 @@ class AxisView : public virtual Selectable, public PBD::ScopedConnectionList, pu
*/
static Gdk::Color unique_random_color();
Gdk::Color _color;
static std::list<Gdk::Color> used_colors;
Gtk::Label name_label;
bool _marked_for_display;
mutable boost::unordered_map<std::string, std::string> property_hashtable;
uint32_t _old_order_key;
}; /* class AxisView */

View file

@ -19,6 +19,7 @@
#include <algorithm>
#include <string>
#include <vector>
#include "ardour_ui.h"
#include "audio_clock.h"
@ -30,6 +31,7 @@
using std::min;
using std::string;
using namespace ARDOUR_UI_UTILS;
BigClockWindow::BigClockWindow (AudioClock& c)
: ArdourWindow (_("Big Clock"))
@ -138,11 +140,11 @@ BigClockWindow::text_resizer (int, int)
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);
std::vector<char> buf(family.length()+16);
snprintf (&buf[0], family.length()+16, "%s %d", family.c_str(), size);
try {
Pango::FontDescription fd (buf);
Pango::FontDescription fd (&buf[0]);
Glib::RefPtr<Gtk::RcStyle> rcstyle = clock.get_modifier_style ();
rcstyle->set_font (fd);
clock.modify_style (rcstyle);

35
gtk2_ardour/bundle_env.h Normal file
View file

@ -0,0 +1,35 @@
/*
Copyright (C) 2001-2012 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 __gtk2_ardour_bundle_env_h__
#define __gtk2_ardour_bundle_env_h__
/** This function must do whatever is necessary to create the right runtime
* environment for the GTK2 version of ardour, on a per-platform basis.
*/
void fixup_bundle_environment (int, char* [], const char** localedir);
/** Load any fonts required by the GTK2 version of ardour, on a per-platform
* basis.
*/
void load_custom_fonts();
#endif /* __gtk2_ardour_bundle_env_h__ */

View file

@ -0,0 +1,172 @@
/*
Copyright (C) 2001-2012 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 <fstream>
#include <string>
#include <vector>
#include <cerrno>
#include <cstring>
#include <glib.h>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
#include <fontconfig/fontconfig.h>
#include "ardour/ardour.h"
#include "ardour/filesystem_paths.h"
#include "pbd/epa.h"
#include "pbd/search_path.h"
#include "pbd/pathexpand.h"
#include "pbd/file_utils.h"
#include "bundle_env.h"
#include "i18n.h"
#include <Carbon/Carbon.h>
#include <mach-o/dyld.h>
#include <sys/param.h>
using namespace PBD;
using namespace ARDOUR;
using namespace std;
extern void set_language_preference (); // cocoacarbon.mm
void
fixup_bundle_environment (int, char* [], const char** localedir)
{
if (!g_getenv ("ARDOUR_BUNDLED")) {
return;
}
EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true, "PREBUNDLE_ENV"));
set_language_preference ();
char execpath[MAXPATHLEN+1];
uint32_t pathsz = sizeof (execpath);
_NSGetExecutablePath (execpath, &pathsz);
std::string path;
std::string exec_dir = Glib::path_get_dirname (execpath);
std::string bundle_dir;
std::string userconfigdir = user_config_directory();
bundle_dir = Glib::path_get_dirname (exec_dir);
#ifdef ENABLE_NLS
if (!ARDOUR::translations_are_enabled ()) {
(*localedir) = "/this/cannot/exist";
} else {
/* force localedir into the bundle */
vector<string> lpath;
lpath.push_back (bundle_dir);
lpath.push_back ("Resources");
lpath.push_back ("locale");
(*localedir) = strdup (Glib::build_filename (lpath).c_str());
}
#endif
export_search_path (bundle_dir, "ARDOUR_DLL_PATH", "/lib");
/* inside an OS X .app bundle, there is no difference
between DATA and CONFIG locations, since OS X doesn't
attempt to do anything to expose the notion of
machine-independent shared data.
*/
export_search_path (bundle_dir, "ARDOUR_DATA_PATH", "/Resources");
export_search_path (bundle_dir, "ARDOUR_CONFIG_PATH", "/Resources");
export_search_path (bundle_dir, "ARDOUR_INSTANT_XML_PATH", "/Resources");
export_search_path (bundle_dir, "LADSPA_PATH", "/Plugins");
export_search_path (bundle_dir, "VAMP_PATH", "/lib");
export_search_path (bundle_dir, "GTK_PATH", "/lib/gtkengines");
g_setenv ("SUIL_MODULE_DIR", (bundle_dir + "/lib").c_str(), 1);
g_setenv ("PATH", (bundle_dir + "/MacOS:" + std::string(g_getenv ("PATH"))).c_str(), 1);
/* unset GTK_RC_FILES so that we only load the RC files that we define
*/
g_unsetenv ("GTK_RC_FILES");
/* write a pango.rc file and tell pango to use it. we'd love
to put this into the PROGRAM_NAME.app bundle and leave it there,
but the user may not have write permission. so ...
we also have to make sure that the user ardour directory
actually exists ...
*/
if (g_mkdir_with_parents (userconfigdir.c_str(), 0755) < 0) {
error << string_compose (_("cannot create user %3 folder %1 (%2)"), userconfigdir, strerror (errno), PROGRAM_NAME)
<< endmsg;
} else {
path = Glib::build_filename (userconfigdir, "pango.rc");
std::ofstream pangorc (path.c_str());
if (!pangorc) {
error << string_compose (_("cannot open pango.rc file %1") , path) << endmsg;
} else {
pangorc << "[Pango]\nModuleFiles="
<< Glib::build_filename (bundle_dir, "Resources/pango.modules")
<< endl;
pangorc.close ();
g_setenv ("PANGO_RC_FILE", path.c_str(), 1);
}
}
g_setenv ("CHARSETALIASDIR", bundle_dir.c_str(), 1);
g_setenv ("FONTCONFIG_FILE", Glib::build_filename (bundle_dir, "Resources/fonts.conf").c_str(), 1);
g_setenv ("GDK_PIXBUF_MODULE_FILE", Glib::build_filename (bundle_dir, "Resources/gdk-pixbuf.loaders").c_str(), 1);
}
void load_custom_fonts()
{
/* this code will only compile on OS X 10.6 and above, and we currently do not
* need it for earlier versions since we fall back on a non-monospace,
* non-custom font.
*/
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
std::string ardour_mono_file;
if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
cerr << _("Cannot find ArdourMono TrueType font") << endl;
}
CFStringRef ttf;
CFURLRef fontURL;
CFErrorRef error;
ttf = CFStringCreateWithBytes(
kCFAllocatorDefault, (UInt8*) ardour_mono_file.c_str(),
ardour_mono_file.length(),
kCFStringEncodingUTF8, FALSE);
fontURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, ttf, kCFURLPOSIXPathStyle, TRUE);
if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error) != true) {
cerr << _("Cannot load ArdourMono TrueType font.") << endl;
}
#endif
}

View file

@ -0,0 +1,170 @@
/*
Copyright (C) 2001-2012 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 <fstream>
#include <string>
#include <vector>
#include <cerrno>
#include <cstring>
#include <glib.h>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
#include <fontconfig/fontconfig.h>
#include "ardour/ardour.h"
#include "ardour/filesystem_paths.h"
#include "pbd/epa.h"
#include "pbd/search_path.h"
#include "pbd/pathexpand.h"
#include "pbd/file_utils.h"
#include "bundle_env.h"
#include "i18n.h"
using namespace PBD;
using namespace ARDOUR;
using namespace std;
void
fixup_bundle_environment (int /*argc*/, char* argv[], const char** localedir)
{
/* THIS IS FOR LINUX - its just about the only place where its
* acceptable to build paths directly using '/'.
*/
if (!g_getenv ("ARDOUR_BUNDLED")) {
return;
}
EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true, "PREBUNDLE_ENV"));
std::string path;
std::string dir_path = Glib::path_get_dirname (Glib::path_get_dirname (argv[0]));
std::string userconfigdir = user_config_directory();
#ifdef ENABLE_NLS
if (!ARDOUR::translations_are_enabled ()) {
(*localedir) = "/this/cannot/exist";
} else {
/* force localedir into the bundle */
vector<string> lpath;
lpath.push_back (dir_path);
lpath.push_back ("share");
lpath.push_back ("locale");
(*localedir) = canonical_path (Glib::build_filename (lpath)).c_str();
}
#endif
/* note that this function is POSIX/Linux specific, so using / as
a dir separator in this context is just fine.
*/
export_search_path (dir_path, "ARDOUR_DLL_PATH", "/lib");
export_search_path (dir_path, "ARDOUR_CONFIG_PATH", "/etc");
export_search_path (dir_path, "ARDOUR_INSTANT_XML_PATH", "/share");
export_search_path (dir_path, "ARDOUR_DATA_PATH", "/share");
export_search_path (dir_path, "LADSPA_PATH", "/plugins");
export_search_path (dir_path, "VAMP_PATH", "/lib");
export_search_path (dir_path, "GTK_PATH", "/lib/gtkengines");
g_setenv ("SUIL_MODULE_DIR", (dir_path + "/lib").c_str(), 1);
g_setenv ("PATH", (dir_path + "/bin:" + std::string(g_getenv ("PATH"))).c_str(), 1);
/* unset GTK_RC_FILES so that we only load the RC files that we define
*/
g_unsetenv ("GTK_RC_FILES");
/* Tell fontconfig where to find fonts.conf. Use the system version
if it exists, otherwise use the stuff we included in the bundle
*/
if (Glib::file_test ("/etc/fonts/fonts.conf", Glib::FILE_TEST_EXISTS)) {
g_setenv ("FONTCONFIG_FILE", "/etc/fonts/fonts.conf", 1);
g_setenv ("FONTCONFIG_PATH", "/etc/fonts", 1);
} else {
error << _("No fontconfig file found on your system. Things may looked very odd or ugly") << endmsg;
}
/* write a pango.rc file and tell pango to use it. we'd love
to put this into the Ardour.app bundle and leave it there,
but the user may not have write permission. so ...
we also have to make sure that the user ardour directory
actually exists ...
*/
if (g_mkdir_with_parents (userconfigdir.c_str(), 0755) < 0) {
error << string_compose (_("cannot create user %3 folder %1 (%2)"), userconfigdir, strerror (errno), PROGRAM_NAME)
<< endmsg;
} else {
path = Glib::build_filename (userconfigdir, "pango.rc");
std::ofstream pangorc (path.c_str());
if (!pangorc) {
error << string_compose (_("cannot open pango.rc file %1") , path) << endmsg;
} else {
pangorc << "[Pango]\nModuleFiles="
<< Glib::build_filename (userconfigdir, "pango.modules")
<< endl;
pangorc.close ();
}
g_setenv ("PANGO_RC_FILE", path.c_str(), 1);
/* similar for GDK pixbuf loaders, but there's no RC file required
to specify where it lives.
*/
g_setenv ("GDK_PIXBUF_MODULE_FILE", Glib::build_filename (userconfigdir, "gdk-pixbuf.loaders").c_str(), 1);
}
/* this doesn't do much but setting it should prevent various parts of the GTK/GNU stack
from looking outside the bundle to find the charset.alias file.
*/
g_setenv ("CHARSETALIASDIR", dir_path.c_str(), 1);
}
void
load_custom_fonts()
{
std::string ardour_mono_file;
if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
cerr << _("Cannot find ArdourMono TrueType font") << endl;
}
FcConfig *config = FcInitLoadConfigAndFonts();
FcBool ret = FcConfigAppFontAddFile(config, reinterpret_cast<const FcChar8*>(ardour_mono_file.c_str()));
if (ret == FcFalse) {
cerr << _("Cannot load ArdourMono TrueType font.") << endl;
}
ret = FcConfigSetCurrent(config);
if (ret == FcFalse) {
cerr << _("Failed to set fontconfig configuration.") << endl;
}
}

View file

@ -0,0 +1,157 @@
/*
Copyright (C) 2001-2012 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 <stdlib.h>
#include "bundle_env.h"
#include "i18n.h"
#include <glibmm.h>
#include <fontconfig/fontconfig.h>
#include <pango/pangoft2.h>
#include <pango/pangocairo.h>
#include <windows.h>
#include <wingdi.h>
#include <shlobj.h> // CSIDL_*
#include "ardour/ardour.h"
#include "ardour/search_paths.h"
#include "ardour/filesystem_paths.h"
#include "pbd/file_utils.h"
#include "pbd/epa.h"
#include "pbd/windows_special_dirs.h"
using namespace std;
using namespace PBD;
using namespace ARDOUR;
/* query top-level Ardour installation path.
* Typically, this will be somehwere like
* "C:\Program Files (x86)\Ardour"
*/
const std::string
get_install_path ()
{
const gchar* pExeRoot = g_win32_get_package_installation_directory_of_module (0);
if (0 == pExeRoot) {
HKEY key;
DWORD size = PATH_MAX;
char tmp[PATH_MAX+1];
if (
#ifdef __MINGW64__
(ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\Ardour\\ardour3\\w64", 0, KEY_READ, &key))
#else
(ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\Ardour\\ardour3\\w32", 0, KEY_READ, &key))
#endif
&&(ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
)
{
pExeRoot = Glib::locale_to_utf8(tmp).c_str();
}
}
if (0 == pExeRoot) {
const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES);
if (program_files) {
pExeRoot = g_build_filename(program_files, PROGRAM_NAME, NULL);
}
}
if (pExeRoot && Glib::file_test(pExeRoot, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_DIR)) {
return std::string (pExeRoot);
}
return "";
}
void
fixup_bundle_environment (int, char* [], const char** localedir)
{
EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true));
/* what to do ? */
// we should at least set ARDOUR_DATA_PATH to prevent the warning message.
// setting a FONTCONFIG_FILE won't hurt either see bundle_env_msvc.cc
// (pangocairo prefers the windows gdi backend unless PANGOCAIRO_BACKEND=fc is set)
// Unset GTK_RC_FILES so that only ardour specific files are loaded
Glib::unsetenv ("GTK_RC_FILES");
std::string path;
const char *cstr;
cstr = getenv ("VAMP_PATH");
if (cstr) {
path = cstr;
path += G_SEARCHPATH_SEPARATOR;
} else {
path = "";
}
path += Glib::build_filename(get_install_path(), "lib", "ardour3", "vamp");
path += G_SEARCHPATH_SEPARATOR;
path += "%ProgramFiles%\\Vamp Plugins"; // default vamp path
path += G_SEARCHPATH_SEPARATOR;
path += "%COMMONPROGRAMFILES%\\Vamp Plugins";
Glib::setenv ("VAMP_PATH", path, true);
}
static __cdecl void
unload_custom_fonts()
{
std::string ardour_mono_file;
if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
return;
}
RemoveFontResource(ardour_mono_file.c_str());
}
void
load_custom_fonts()
{
std::string ardour_mono_file;
if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
cerr << _("Cannot find ArdourMono TrueType font") << endl;
return;
}
if (pango_font_map_get_type() == PANGO_TYPE_FT2_FONT_MAP) {
FcConfig *config = FcInitLoadConfigAndFonts();
FcBool ret = FcConfigAppFontAddFile(config, reinterpret_cast<const FcChar8*>(ardour_mono_file.c_str()));
if (ret == FcFalse) {
cerr << _("Cannot load ArdourMono TrueType font.") << endl;
}
ret = FcConfigSetCurrent(config);
if (ret == FcFalse) {
cerr << _("Failed to set fontconfig configuration.") << endl;
}
} else {
// pango with win32 backend
if (0 == AddFontResource(ardour_mono_file.c_str())) {
cerr << _("Cannot register ArdourMono TrueType font with windows gdi.") << endl;
} else {
atexit (&unload_custom_fonts);
}
}
}

View file

@ -0,0 +1,504 @@
/*
Copyright (C) 2014 John Emmas
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 "bundle_env.h"
#include "i18n.h"
#include <shlobj.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <glibmm.h>
#include <glib/gstdio.h>
#include <fontconfig/fontconfig.h>
#include "ardour/ardour.h"
#include "ardour/search_paths.h"
#include "ardour/filesystem_paths.h"
#include "pbd/file_utils.h"
#include "pbd/epa.h"
using namespace std;
using namespace PBD;
using namespace ARDOUR;
std::string
get_windows_drive_volume_letter()
{
static std::string ret;
char path[PATH_MAX+1];
LPITEMIDLIST pidl = 0;
if (!ret.length()) {
if (S_OK == SHGetSpecialFolderLocation (0, CSIDL_WINDOWS, &pidl))
{
if (SHGetPathFromIDListA (pidl, path)) {
path[2] = '\0'; // Gives us just the drive letter and colon
ret = path;
}
CoTaskMemFree (pidl);
}
// The above should never fail - but just in case...
else if (char *env_path = getenv ("windir"))
{
strcpy (path, env_path);
path[2] = '\0'; // Gives us just the drive letter and colon
ret = path;
}
}
return ret;
}
const string
get_module_folder ()
{
std::string ret;
// Gives the top-level Ardour installation folder (on Windows)
// Typically, this will be somehwere like "C:\Program Files"
gchar* pExeRoot = g_win32_get_package_installation_directory_of_module (0);
if (0 == pExeRoot) {
pExeRoot = g_build_filename("C:\\", "Program Files", PROGRAM_NAME, 0);
}
if (pExeRoot) {
gchar tmp[PATH_MAX+1];
gchar* p;
strcpy(tmp, pExeRoot);
if (0 != (p = strrchr (tmp, G_DIR_SEPARATOR))) {
*p = '\0';
if (0 != (p = g_build_filename(tmp, 0))) {
ret = p;
g_free (p);
}
}
g_free (pExeRoot);
}
return (ret);
}
bool
fixup_config_file (Glib::ustring str_file_to_fix)
{
FILE* fd;
char buf[4096];
bool conversion_needed = false;
bool succeeded = false;
fstream file_to_fix (fd = g_fopen(str_file_to_fix.c_str(), "r+b"));
if (file_to_fix.is_open()) {
vector<std::string> lines;
std::string line;
file_to_fix.seekg (0, std::ios::beg);
file_to_fix.seekp (0, std::ios::beg);
try {
while (!file_to_fix.eof() && file_to_fix.getline (buf, sizeof(buf))) {
line = buf;
if (!conversion_needed && (std::string::npos != line.find("$(")))
conversion_needed = true;
lines.push_back(line);
}
if (conversion_needed) {
bool error = false;
std::string::size_type token_begin, token_end;
vector<string>::iterator i;
for (i = lines.begin(); i != lines.end(); ++i) {
if (string::npos != (token_begin = i->find("$("))) {
if (string::npos != (token_end = i->find(")", token_begin))) {
std::string str_replace_with;
std::string str_to_replace = i->substr(token_begin, ((token_end+1)-token_begin));
if (0 == str_to_replace.compare("$(CWD)")) {
// Replace our token with the current working directory
if (getcwd(buf, sizeof(buf))) {
if (buf[strlen(buf)-1] == G_DIR_SEPARATOR)
buf[strlen(buf)-1] = '\0';
str_replace_with = buf;
// Replace the first occurrence of our token with the required string
i->erase(token_begin, ((token_end+1)-token_begin));
i->insert(token_begin, str_replace_with);
} else {
error = true;
}
} else if (0 == str_to_replace.compare("$(WINDRIVE)")){
// Replace our token with the drive letter (and colon) for the user's Windows volume
str_replace_with = get_windows_drive_volume_letter();
// Replace the first occurrence of our token with the required string
i->erase(token_begin, ((token_end+1)-token_begin));
i->insert(token_begin, str_replace_with);
} else if (0 == str_to_replace.compare("$(LOCALCACHEDIR)")){
// Replace our token with the path to our Ardour cache directory
str_replace_with = user_cache_directory();
// Replace the first occurrence of our token with the required string
i->erase(token_begin, ((token_end+1)-token_begin));
i->insert(token_begin, str_replace_with);
} else {
// Assume that our token represents an environment variable
std::string envvar_name = str_to_replace.substr(2, str_to_replace.length()-3);
if (const char *envvar_value = getenv(envvar_name.c_str())) {
strcpy(buf, envvar_value);
if (buf[strlen(buf)-1] == G_DIR_SEPARATOR)
buf[strlen(buf)-1] = '\0';
str_replace_with = buf;
// Replace the first occurrence of our token with the required string
i->erase(token_begin, ((token_end+1)-token_begin));
i->insert(token_begin, str_replace_with);
} else {
error = true;
cerr << _("ERROR: unknown environment variable") << endl;
}
}
}
}
}
if (!error) {
file_to_fix.clear (); // Clear the EOF flag etc
file_to_fix.seekg (0, std::ios::beg); // Seek our 'get' ptr to the file start pos
// (our 'put' ptr shouldn't have moved yet).
chsize(fileno (fd), 0); // Truncate the file, ready for re-writing
for (i = lines.begin(); i != lines.end(); ++i) {
// Write the converted contents to our file
file_to_fix << (*i).c_str() << endl;
}
try {
file_to_fix.close();
succeeded = true;
} catch (...) {}
}
} else {
file_to_fix.close();
succeeded = true;
}
} catch (...) {
file_to_fix.close();
succeeded = false;
}
} else {
cerr << _("ERROR: Could not open config file '") << str_file_to_fix << "'" << endl;
}
return succeeded;
}
void
fixup_fonts_config ()
{
string fonts_conf_file;
#ifdef DEBUG
fonts_conf_file = get_module_folder();
if (!fonts_conf_file.empty()) {
fonts_conf_file += "\\";
fonts_conf_file += PROGRAM_NAME;
fonts_conf_file += FONTS_CONF_LOCATION;
#else
if (PBD::find_file (ARDOUR::ardour_config_search_path(), "fonts.conf", fonts_conf_file)) {
#endif
Glib::setenv ("FONTCONFIG_FILE", fonts_conf_file, true);
if (0 == fixup_config_file (fonts_conf_file))
cerr << _("ERROR: processing error for 'fonts.conf' file") << endl;
} else {
cerr << _("ERROR: Malformed module folder (fonts.conf)") << endl;
}
}
void
fixup_pango_config ()
{
string pango_modules_file;
#if defined(DEBUG) || defined(RDC_BUILD)
// Make sure we pick up the debuggable DLLs !!!
pango_modules_file = get_module_folder();
if (!pango_modules_file.empty()) {
pango_modules_file += "\\";
pango_modules_file += PROGRAM_NAME;
pango_modules_file += PANGO_CONF_LOCATION;
#if 0
// JE - handy for non-English locale testing (Greek, in this case)
Glib::ustring pango_modules_path = Glib::locale_to_utf8("C:\\Program Files\\Mixbus3\\etc\\ÄÇÌÇÔÑÇÓ\\pango.modules");
/**/
#else
Glib::ustring pango_modules_path = pango_modules_file;
#endif
pango_modules_path.resize (pango_modules_path.size()-14); // Remove "/pango.modules" from the end
#else
if (PBD::find_file (ARDOUR::ardour_config_search_path(), "pango.modules", pango_modules_file)) {
Glib::ustring pango_modules_path = pango_modules_file;
pango_modules_path.resize (pango_modules_path.size()-14); // Remove "/pango.modules" from the end
#endif
// Set an environment variable so we can find our pango modules. Note
// that this requires a modified version of libpango (pango-utils.c)
Glib::setenv ("PANGO_MODULE_PATH", Glib::filename_from_utf8(pango_modules_path), true);
if (0 == fixup_config_file (pango_modules_file))
cerr << _("ERROR: processing error for 'pango.modules' file") << endl;
} else {
cerr << _("ERROR: Malformed module folder (pango.modules)") << endl;
}
}
void
fixup_pixbuf_loaders_config ()
{
string gdk_pixbuf_loaders_file;
#if defined(DEBUG) || defined(RDC_BUILD)
// Make sure we pick up the debuggable DLLs !!!
gdk_pixbuf_loaders_file = get_module_folder();
if (!gdk_pixbuf_loaders_file.empty()) {
gdk_pixbuf_loaders_file += "\\";
gdk_pixbuf_loaders_file += PROGRAM_NAME;
gdk_pixbuf_loaders_file += PIXBUFLOADERS_CONF_LOCATION;
#else
if (PBD::find_file (ARDOUR::ardour_config_search_path(), "gdk-pixbuf.loaders", gdk_pixbuf_loaders_file)) {
#endif
// Set an environment variable so we can find our pixbuf modules.
Glib::setenv ("GDK_PIXBUF_MODULE_FILE", Glib::filename_from_utf8(gdk_pixbuf_loaders_file), true);
if (0 == fixup_config_file (gdk_pixbuf_loaders_file))
cerr << _("ERROR: processing error for 'gdk-pixbuf.loaders' file") << endl;
} else {
cerr << _("ERROR: Malformed module folder (gdk-pixbuf.loaders)") << endl;
}
}
void
fixup_clearlooks_config ()
{
string clearlooks_la_file;
#if defined(DEBUG) || defined(RDC_BUILD)
// Make sure we pick up the debuggable DLLs !!!
clearlooks_la_file = get_module_folder();
if (!clearlooks_la_file.empty()) {
clearlooks_la_file += "\\";
clearlooks_la_file += PROGRAM_NAME;
clearlooks_la_file += CLEARLOOKS_CONF_LOCATION;
#else
if (PBD::find_file (ARDOUR::ardour_config_search_path(), "libclearlooks.la", clearlooks_la_file)) {
#endif
// Set an environment variable so we can find our clearlooks engine.
// Note that this requires a modified version of libgtk (gtkthemes.c)
Glib::setenv ("GTK_THEME_ENGINE_FILE", Glib::filename_from_utf8(clearlooks_la_file).c_str(), true);
if (0 == fixup_config_file (clearlooks_la_file))
cerr << _("ERROR: processing error for 'clearlooks.la' file") << endl;
} else {
cerr << _("ERROR: Malformed module folder (clearlooks.la)") << endl;
}
}
void
fixup_bundle_environment (int argc, char* argv[], const char** localedir)
{
std::string exec_path = argv[0];
std::string dir_path = Glib::path_get_dirname (exec_path);
// Make sure that our runtime CWD is set to Mixbus's install
// folder, regardless of where the caller's CWD was set to.
g_chdir (dir_path.c_str());
EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true));
// Now set 'dir_path' so we can append some relative paths
dir_path = Glib::path_get_dirname (dir_path);
std::string path;
const char *cstr;
// First, set up 'ARDOUR_DLL_PATH'
path = dir_path;
path += "\\lib\\ardour3\\surfaces;";
path += dir_path;
path += "\\lib\\ardour3\\panners;";
path += dir_path;
path += "\\lib\\ardour3\\backends;";
path += dir_path;
path += "\\bin";
Glib::setenv ("ARDOUR_DLL_PATH", path, true);
// Next, set up 'ARDOUR_DATA_PATH'
path = get_module_folder() + "\\";
path += PROGRAM_NAME;
path += "\\share";
Glib::setenv ("ARDOUR_DATA_PATH", path, true);
// Next, set up 'ARDOUR_CONFIG_PATH'
#ifdef _WIN64
path = user_config_directory() + "\\win64;";
#else
path = user_config_directory() + "\\win32;";
#endif
Glib::setenv ("ARDOUR_CONFIG_PATH", path, true);
// Next, set up 'ARDOUR_PATH'
path = user_config_directory();
path = Glib::path_get_dirname (path);
path += G_SEARCHPATH_SEPARATOR;
path += windows_search_path().to_string();
path += "\\icons;";
path += windows_search_path().to_string();
path += "\\pixmaps;";
path += ardour_data_search_path().to_string(); // In fact, adds both the 'data' search
path += G_SEARCHPATH_SEPARATOR; // path and our 'config' search path
path += dir_path;
path += "\\etc";
Glib::setenv ("ARDOUR_PATH", path, true);
// Next, set up 'ARDOUR_INSTANT_XML_PATH'
path = user_config_directory();
Glib::setenv ("ARDOUR_INSTANT_XML_PATH", path, true);
// Next, set up 'LADSPA_PATH'
path = ladspa_search_path().to_string();
Glib::setenv ("LADSPA_PATH", path, true);
// Next, set up 'VAMP_PATH'
cstr = getenv ("VAMP_PATH");
if (cstr) {
path = cstr;
path += G_SEARCHPATH_SEPARATOR;
} else {
path = "";
}
path += get_module_folder() + "\\";
path += PROGRAM_NAME;
path += "\\bin\\vamp";
path += G_SEARCHPATH_SEPARATOR;
path += "%ProgramFiles%\\Vamp Plugins";
Glib::setenv ("VAMP_PATH", path, true);
// Next, set up 'ARDOUR_CONTROL_SURFACE_PATH'
cstr = getenv ("ARDOUR_CONTROL_SURFACE_PATH");
if (cstr) {
path = cstr;
path += G_SEARCHPATH_SEPARATOR;
} else {
path = "";
}
path += control_protocol_search_path().to_string();
Glib::setenv ("ARDOUR_CONTROL_SURFACE_PATH", path, true);
// Next, set up 'GTK_LOCALEDIR'
if (ARDOUR::translations_are_enabled ()) {
path = windows_search_path().to_string();
path += "\\locale";
Glib::setenv ("GTK_LOCALEDIR", path, true);
// and return the same path to our caller
(*localedir) = strdup (path.c_str());
}
// Next, set up 'GTK_PATH'
cstr = getenv ("GTK_PATH");
if (cstr) {
path = cstr;
path += G_SEARCHPATH_SEPARATOR;
} else {
path = "";
}
path += user_config_directory();
path += "\\.gtk-2.0";
Glib::setenv ("GTK_PATH", path, true);
// Unset GTK_RC_FILES so that we only load the RC files that we define
Glib::unsetenv ("GTK_RC_FILES");
// and set a '$HOME' environment variable. This variable changes the value returned
// by 'g_get_home_dir()' so to prevent that function from unexpectedly changing its
// mind, we'll set '$HOME' to whatever 'g_get_home_dir()' is already returning!!
if (NULL == getenv("HOME")) {
Glib::setenv ("HOME", Glib::locale_from_utf8(g_get_home_dir()), true);
}
fixup_fonts_config();
fixup_pango_config();
fixup_clearlooks_config();
fixup_pixbuf_loaders_config();
}
void load_custom_fonts()
{
std::string ardour_mono_file;
if (!find_file (ardour_data_search_path(), "ArdourMono.ttf", ardour_mono_file)) {
cerr << _("Cannot find ArdourMono TrueType font") << endl;
}
FcConfig *config = FcInitLoadConfigAndFonts();
FcBool ret = FcConfigAppFontAddFile(config, reinterpret_cast<const FcChar8*>(ardour_mono_file.c_str()));
if (ret == FcFalse) {
cerr << _("Cannot load ArdourMono TrueType font.") << endl;
}
ret = FcConfigSetCurrent(config);
if (ret == FcFalse) {
cerr << _("Failed to set fontconfig configuration.") << endl;
}
}

View file

@ -34,6 +34,7 @@
using namespace std;
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
BundleEditorMatrix::BundleEditorMatrix (Gtk::Window* parent, Session* session, boost::shared_ptr<Bundle> bundle)
: PortMatrix (parent, session, DataType::NIL)
@ -286,7 +287,7 @@ BundleManager::BundleManager (Session* session)
edit_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::EDIT, Gtk::ICON_SIZE_BUTTON)));
edit_button.signal_clicked().connect (sigc::mem_fun (*this, &BundleManager::edit_clicked));
buttons->pack_start (edit_button, false, false);
delete_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::DELETE, Gtk::ICON_SIZE_BUTTON)));
delete_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::StockID(GTK_STOCK_DELETE), Gtk::ICON_SIZE_BUTTON)));
delete_button.signal_clicked().connect (sigc::mem_fun (*this, &BundleManager::delete_clicked));
buttons->pack_start (delete_button, false, false);

View file

@ -99,7 +99,7 @@ ButtonJoiner::~ButtonJoiner ()
}
void
ButtonJoiner::render (cairo_t* cr)
ButtonJoiner::render (cairo_t* cr, cairo_rectangle_t*)
{
double h = get_height();

View file

@ -36,7 +36,7 @@ class ButtonJoiner : public CairoWidget, public Gtkmm2ext::Activatable {
void set_active_state (Gtkmm2ext::ActiveState);
protected:
void render (cairo_t*);
void render (cairo_t*, cairo_rectangle_t*);
bool on_button_release_event (GdkEventButton*);
void on_size_request (Gtk::Requisition*);
void on_size_allocate (Gtk::Allocation&);

View file

@ -1,65 +0,0 @@
/* libgnomecanvas/gnome-canvas-curve.h: GnomeCanvas item for constrained spline curves
*
* Copyright (C) 2003 Paul Davis <pbd@op.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __GNOME_CANVAS_CURVE_H__
#define __GNOME_CANVAS_CURVE_H__
#include <libgnomecanvas/libgnomecanvas.h>
G_BEGIN_DECLS
/* Wave viewer item for canvas.
*/
#define GNOME_CANVAS_TYPE_CANVAS_CURVE (gnome_canvas_curve_get_type ())
#define GNOME_CANVAS_CURVE(obj) (GTK_CHECK_CAST ((obj), GNOME_CANVAS_TYPE_CANVAS_CURVE, GnomeCanvasCurve))
#define GNOME_CANVAS_CURVE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_CANVAS_TYPE_CANVAS_CURVE, GnomeCanvasCurveClass))
#define GNOME_CANVAS_IS_CANVAS_CURVE(obj) (GTK_CHECK_TYPE ((obj), GNOME_CANVAS_TYPE_CANVAS_CURVE))
#define GNOME_CANVAS_IS_CANVAS_CURVE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_CANVAS_TYPE_CANVAS_CURVE))
typedef struct _GnomeCanvasCurve GnomeCanvasCurve;
typedef struct _GnomeCanvasCurveClass GnomeCanvasCurveClass;
struct _GnomeCanvasCurve
{
GnomeCanvasItem item;
double x1, y1, x2, y2;
void* curve_arg;
float* vector;
size_t veclen;
uint32_t color;
/* cached values set during update/used during render */
unsigned char r, b, g, a;
guint32 bbox_ulx, bbox_uly;
guint32 bbox_lrx, bbox_lry;
};
struct _GnomeCanvasCurveClass {
GnomeCanvasItemClass parent_class;
};
GtkType gnome_canvas_curve_get_type (void);
G_END_DECLS
#endif /* __GNOME_CANVAS_CURVE_H__ */

View file

@ -1,105 +0,0 @@
/*
Copyright (C) 2012 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 <iostream>
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/rgb_macros.h"
#include "ardour_ui.h"
#include "canvas-flag.h"
#include "canvas-noevent-pixbuf.h"
#include "time_axis_view_item.h"
#include "utils.h"
using namespace Gnome::Canvas;
using namespace std;
CanvasFlag::CanvasFlag (MidiRegionView& region,
Group& parent,
double height,
guint outline_color_rgba,
guint fill_color_rgba,
double x,
double y)
: Group(parent, x, y)
, _name_pixbuf(0)
, _height(height)
, _outline_color_rgba(outline_color_rgba)
, _fill_color_rgba(fill_color_rgba)
, _region(region)
, name_pixbuf_width (0)
, _line(0)
, _rect(0)
{
}
void
CanvasFlag::delete_allocated_objects()
{
delete _name_pixbuf;
_name_pixbuf = 0;
delete _line;
_line = 0;
delete _rect;
_rect = 0;
}
void
CanvasFlag::set_text (const string& text)
{
delete_allocated_objects();
_name_pixbuf = new ArdourCanvas::NoEventPixbuf (*this);
name_pixbuf_width = Gtkmm2ext::pixel_width (text, TimeAxisViewItem::NAME_FONT) + 2;
Gdk::Color c;
set_color (c, _outline_color_rgba);
_name_pixbuf->property_pixbuf() = Gtkmm2ext::pixbuf_from_string (text, TimeAxisViewItem::NAME_FONT, name_pixbuf_width,
TimeAxisViewItem::NAME_HEIGHT, c);
_name_pixbuf->property_x() = 10.0;
_name_pixbuf->property_y() = 2.0;
_name_pixbuf->show();
double flagwidth = name_pixbuf_width + 8.0;
double flagheight = TimeAxisViewItem::NAME_HEIGHT + 3.0;
_line = new SimpleLine(*this, 0.0, 0.0, 0.0, _height);
_line->property_color_rgba() = _outline_color_rgba;
_rect = new SimpleRect(*this, 0.0, 0.0, flagwidth, flagheight);
_rect->property_outline_color_rgba() = _outline_color_rgba;
_rect->property_fill_color_rgba() = _fill_color_rgba;
_name_pixbuf->raise_to_top();
}
CanvasFlag::~CanvasFlag()
{
delete_allocated_objects();
}
void
CanvasFlag::set_height (double h)
{
_height = h;
if (_line) {
_line->property_y2() = _height;
}
}

View file

@ -1,74 +0,0 @@
/*
Copyright (C) 2012 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 CANVASFLAG_H_
#define CANVASFLAG_H_
#include <string>
#include <libgnomecanvasmm/pixbuf.h>
#include <libgnomecanvasmm/group.h>
#include <libgnomecanvasmm/widget.h>
#include "simplerect.h"
#include "simpleline.h"
#include "canvas.h"
class MidiRegionView;
namespace Gnome {
namespace Canvas {
class CanvasFlag : public Group
{
public:
CanvasFlag (MidiRegionView& region,
Group& parent,
double height,
guint outline_color_rgba = 0xc0c0c0ff,
guint fill_color_rgba = 0x07070707,
double x = 0.0,
double y = 0.0);
virtual ~CanvasFlag();
virtual void set_text(const std::string& a_text);
virtual void set_height (double);
int width () const { return name_pixbuf_width + 10.0; }
protected:
ArdourCanvas::Pixbuf* _name_pixbuf;
double _height;
guint _outline_color_rgba;
guint _fill_color_rgba;
MidiRegionView& _region;
int name_pixbuf_width;
private:
void delete_allocated_objects();
SimpleLine* _line;
SimpleRect* _rect;
};
} // namespace Canvas
} // namespace Gnome
#endif /*CANVASFLAG_H_*/

View file

@ -1,60 +0,0 @@
/*
Copyright (C) 2012 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 "canvas-note.h"
#include "midi_region_view.h"
#include "public_editor.h"
#include "evoral/Note.hpp"
#include "utils.h"
using namespace ARDOUR;
namespace Gnome {
namespace Canvas {
CanvasHit::CanvasHit (MidiRegionView& region,
Group& group,
double size,
const boost::shared_ptr<NoteType> note,
bool with_events)
: Diamond(group, size)
, CanvasNoteEvent(region, this, note)
{
if (with_events) {
signal_event().connect (sigc::mem_fun (*this, &CanvasHit::on_event));
}
}
bool
CanvasHit::on_event(GdkEvent* ev)
{
if (!CanvasNoteEvent::on_event (ev)) {
return _region.get_time_axis_view().editor().canvas_note_event (ev, this);
}
return true;
}
void
CanvasHit::move_event(double dx, double dy)
{
move_by (dx, dy);
}
} // namespace Gnome
} // namespace Canvas

View file

@ -1,59 +0,0 @@
/*
Copyright (C) 2007 Paul Davis
Author: David Robillard
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_canvas_hit_h__
#define __gtk_ardour_canvas_hit_h__
#include <iostream>
#include "simplerect.h"
#include "diamond.h"
namespace Gnome {
namespace Canvas {
class CanvasHit : public Diamond, public CanvasNoteEvent {
public:
typedef Evoral::Note<double> NoteType;
CanvasHit(
MidiRegionView& region,
Group& group,
double size,
const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>(),
bool with_events = true);
void show() { Diamond::show(); }
void hide() { Diamond::hide(); }
double x1() const { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return x1; }
double y1() const { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return y1; }
double x2() const { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return x2; }
double y2() const { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return y2; }
void set_outline_color(uint32_t c) { property_outline_color_rgba() = c; }
void set_fill_color(uint32_t c) { property_fill_color_rgba() = c; }
bool on_event(GdkEvent* ev);
void move_event(double dx, double dy);
};
} // namespace Gnome
} // namespace Canvas
#endif /* __gtk_ardour_canvas_hit_h__ */

View file

@ -1,41 +0,0 @@
/*
* Copyright (C) 2009 Paul Davis <paul@linuxaudiosystems.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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __gtk2_ardour_canvas_noevent_pixbuf_h__
#define __gtk2_ardour_canvas_noevent_pixbuf_h__
#include <libgnomecanvasmm/pixbuf.h>
namespace Gnome { namespace Canvas {
class NoEventPixbuf : public Pixbuf
{
public:
NoEventPixbuf(Group& parent) : Pixbuf (parent) {}
double point_vfunc(double, double, int, int, GnomeCanvasItem**) {
/* return a huge value to tell the canvas that we're never the item for an event */
return 9999999999999.0;
}
};
} } /* namespaces */
#endif /* __gtk2_ardour_canvas_noevent_pixbuf_h__ */

View file

@ -1,44 +0,0 @@
/*
* Copyright (C) 2009 Paul Davis <paul@linuxaudiosystems.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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __gtk2_ardour_canvas_noevent_rect_h__
#define __gtk2_ardour_canvas_noevent_rect_h__
#include "simplerect.h"
namespace Gnome { namespace Canvas {
class NoEventSimpleRect : public SimpleRect
{
public:
NoEventSimpleRect(Group& parent, double x1, double y1, double x2, double y2)
: SimpleRect (parent, x1, y1, x2, y2) {}
NoEventSimpleRect(Group& parent)
: SimpleRect (parent) {}
double point_vfunc(double, double, int, int, GnomeCanvasItem**) {
/* return a huge value to tell the canvas that we're never the item for an event */
return 9999999999999.0;
}
};
} } /* namespaces */
#endif /* __gtk2_ardour_canvas_noevent_text_h__ */

View file

@ -1,44 +0,0 @@
/*
* Copyright (C) 2009 Paul Davis <paul@linuxaudiosystems.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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __gtk2_ardour_canvas_noevent_text_h__
#define __gtk2_ardour_canvas_noevent_text_h__
#include <libgnomecanvasmm/text.h>
namespace Gnome { namespace Canvas {
class NoEventText : public Text
{
public:
NoEventText(Group& parent, double x, double y, const std::string& text)
: Text (parent, x, y, text) {}
NoEventText(Group& parent)
: Text (parent) {}
double point_vfunc(double, double, int, int, GnomeCanvasItem**) {
/* return a huge value to tell the canvas that we're never the item for an event */
return 9999999999999.0;
}
};
} } /* namespaces */
#endif /* __gtk2_ardour_canvas_noevent_text_h__ */

View file

@ -1,75 +0,0 @@
/*
Copyright (C) 2012 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 "canvas-note.h"
#include "midi_region_view.h"
#include "public_editor.h"
#include "evoral/Note.hpp"
using namespace ARDOUR;
namespace Gnome {
namespace Canvas {
CanvasNote::CanvasNote (MidiRegionView& region,
Group& group,
const boost::shared_ptr<NoteType> note,
bool with_events)
: SimpleRect(group), CanvasNoteEvent(region, this, note)
{
if (with_events) {
signal_event().connect (sigc::mem_fun (*this, &CanvasNote::on_event));
}
}
bool
CanvasNote::on_event(GdkEvent* ev)
{
bool r = true;
if (!CanvasNoteEvent::on_event (ev)) {
r = _region.get_time_axis_view().editor().canvas_note_event (ev, this);
}
if (ev->type == GDK_BUTTON_RELEASE) {
_region.note_button_release ();
}
return r;
}
void
CanvasNote::move_event(double dx, double dy)
{
property_x1() = property_x1() + dx;
property_y1() = property_y1() + dy;
property_x2() = property_x2() + dx;
property_y2() = property_y2() + dy;
if (_text) {
_text->hide();
_text->property_x() = _text->property_x() + dx;
_text->property_y() = _text->property_y() + dy;
_text->show();
}
}
} // namespace Gnome
} // namespace Canvas

View file

@ -1,74 +0,0 @@
/*
Copyright (C) 2007 Paul Davis
Author: David Robillard
Author: Hans Baier
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_canvas_note_h__
#define __gtk_ardour_canvas_note_h__
#include <iostream>
#include "simplerect.h"
#include "canvas-note-event.h"
#include "midi_util.h"
namespace Gnome {
namespace Canvas {
class CanvasNote : public SimpleRect, public CanvasNoteEvent
{
public:
typedef Evoral::Note<Evoral::MusicalTime> NoteType;
CanvasNote (MidiRegionView& region,
Group& group,
const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>(),
bool with_events = true);
double x1() const { return property_x1(); }
double y1() const { return property_y1(); }
double x2() const { return property_x2(); }
double y2() const { return property_y2(); }
void set_outline_color(uint32_t c) { property_outline_color_rgba() = c; hide(); show(); }
void set_fill_color(uint32_t c) { property_fill_color_rgba() = c; hide(); show(); }
void show() { SimpleRect::show(); }
void hide() { SimpleRect::hide(); }
bool on_event(GdkEvent* ev);
void move_event(double dx, double dy);
};
class NoEventCanvasNote : public CanvasNote
{
public:
NoEventCanvasNote (MidiRegionView& region,
Group& group,
const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>())
: CanvasNote (region, group, note, false) {}
double point_vfunc(double, double, int, int, GnomeCanvasItem**) {
/* return a huge value to tell the canvas that we're never the item for an event */
return 9999999999999.0;
}
};
} // namespace Gnome
} // namespace Canvas
#endif /* __gtk_ardour_canvas_note_h__ */

View file

@ -1,64 +0,0 @@
/* libgnomecanvas/gnome-canvas-simpleline.h: GnomeCanvas item for simple rects
*
* Copyright (C) 2001 Paul Davis <pbd@op.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __GNOME_CANVAS_SIMPLELINE_H__
#define __GNOME_CANVAS_SIMPLELINE_H__
#include <stdint.h>
#include <libgnomecanvas/libgnomecanvas.h>
G_BEGIN_DECLS
/* Wave viewer item for canvas.
*/
#define GNOME_TYPE_CANVAS_SIMPLELINE (gnome_canvas_simpleline_get_type ())
#define GNOME_CANVAS_SIMPLELINE(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CANVAS_SIMPLELINE, GnomeCanvasSimpleLine))
#define GNOME_CANVAS_SIMPLELINE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_SIMPLELINE, GnomeCanvasSimpleLineClass))
#define GNOME_IS_CANVAS_SIMPLELINE(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_SIMPLELINE))
#define GNOME_IS_CANVAS_SIMPLELINE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_SIMPLELINE))
#define GNOME_CANVAS_SIMPLELINE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_CANVAS_SIMPLELINE, GnomeCanvasSimpleLineClass))
typedef struct _GnomeCanvasSimpleLine GnomeCanvasSimpleLine;
typedef struct _GnomeCanvasSimpleLineClass GnomeCanvasSimpleLineClass;
struct _GnomeCanvasSimpleLine
{
GnomeCanvasItem item;
double x1, y1, x2, y2; /* parent-relative, world coordinates */
gint32 cx1, cy1, cx2, cy2; /* global, canvas coordinates */
uint32_t color;
/* cached values set during update/used during render */
unsigned char r, b, g, a;
};
struct _GnomeCanvasSimpleLineClass {
GnomeCanvasItemClass parent_class;
};
GType gnome_canvas_simpleline_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GNOME_CANVAS_SIMPLELINE_H__ */

View file

@ -1,72 +0,0 @@
/* libgnomecanvas/gnome-canvas-simplerect.h: GnomeCanvas item for simple rects
*
* Copyright (C) 2001 Paul Davis <pbd@op.net>
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __GNOME_CANVAS_SIMPLERECT_H__
#define __GNOME_CANVAS_SIMPLERECT_H__
#include <stdint.h>
#include <libgnomecanvas/libgnomecanvas.h>
G_BEGIN_DECLS
/* Wave viewer item for canvas.
*/
#define GNOME_TYPE_CANVAS_SIMPLERECT (gnome_canvas_simplerect_get_type ())
#define GNOME_CANVAS_SIMPLERECT(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CANVAS_SIMPLERECT, GnomeCanvasSimpleRect))
#define GNOME_CANVAS_SIMPLERECT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_SIMPLERECT, GnomeCanvasSimpleRectClass))
#define GNOME_IS_CANVAS_SIMPLERECT(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_SIMPLERECT))
#define GNOME_IS_CANVAS_SIMPLERECT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_SIMPLERECT))
#define GNOME_CANVAS_SIMPLERECT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_CANVAS_SIMPLERECT, GnomeCanvasSimpleRectClass))
typedef struct _GnomeCanvasSimpleRect GnomeCanvasSimpleRect;
typedef struct _GnomeCanvasSimpleRectClass GnomeCanvasSimpleRectClass;
struct _GnomeCanvasSimpleRect
{
GnomeCanvasItem item;
double x1, y1, x2, y2;
gboolean fill;
gboolean draw;
gboolean full_draw_on_update;
uint32_t fill_color;
uint32_t outline_color;
uint32_t outline_pixels;
/* cached values set during update/used during render */
unsigned char fill_r, fill_b, fill_g, fill_a;
unsigned char outline_r, outline_b, outline_g, outline_a;
unsigned char outline_what;
gint32 bbox_ulx, bbox_uly;
gint32 bbox_lrx, bbox_lry;
};
struct _GnomeCanvasSimpleRectClass {
GnomeCanvasItemClass parent_class;
};
GType gnome_canvas_simplerect_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GNOME_CANVAS_SIMPLERECT_H__ */

View file

@ -35,7 +35,7 @@
/* POSIX guarantees casting between void* and function pointers, ISO C doesn't
* We can work around warnings by going one step deeper in our casts
*/
#ifdef _POSIX_VERSION
#if defined(_POSIX_VERSION) || defined(COMPILER_MINGW)
#define POSIX_FUNC_PTR_CAST(type, object) *((type*) &(object))
#endif // _POSIX_VERSION

View file

@ -55,11 +55,11 @@ CanvasPatchChange::CanvasPatchChange(
parent,
height,
(active_channel
? ARDOUR_UI::config()->canvasvar_MidiPatchChangeOutline.get()
: ARDOUR_UI::config()->canvasvar_MidiPatchChangeInactiveChannelOutline.get()),
? ARDOUR_UI::config()->get_canvasvar_MidiPatchChangeOutline()
: ARDOUR_UI::config()->get_canvasvar_MidiPatchChangeInactiveChannelOutline()),
(active_channel
? ARDOUR_UI::config()->canvasvar_MidiPatchChangeFill.get()
: ARDOUR_UI::config()->canvasvar_MidiPatchChangeInactiveChannelFill.get()),
? ARDOUR_UI::config()->get_canvasvar_MidiPatchChangeFill()
: ARDOUR_UI::config()->get_canvasvar_MidiPatchChangeInactiveChannelFill()),
x,
y)
, _info (info)

View file

@ -51,6 +51,8 @@ CANVAS_VARIABLE(canvasvar_GhostTrackWaveClip, "ghost track wave clip")
CANVAS_VARIABLE(canvasvar_GhostTrackZeroLine, "ghost track zero line")
CANVAS_VARIABLE(canvasvar_ImageTrack, "image track")
CANVAS_VARIABLE(canvasvar_InactiveCrossfade, "inactive crossfade")
CANVAS_VARIABLE(canvasvar_InactiveFadeHandle, "inactive fade handle")
CANVAS_VARIABLE(canvasvar_InactiveGroupTab, "inactive group tab")
CANVAS_VARIABLE(canvasvar_LocationCDMarker, "location cd marker")
CANVAS_VARIABLE(canvasvar_LocationLoop, "location loop")
CANVAS_VARIABLE(canvasvar_LocationMarker, "location marker")
@ -88,13 +90,6 @@ CANVAS_VARIABLE(canvasvar_MidiMeterColor8, "midi meter fill: 8")
CANVAS_VARIABLE(canvasvar_MidiMeterColor9, "midi meter fill: 9")
CANVAS_VARIABLE(canvasvar_MeterBackgroundBot, "meter background: bottom")
CANVAS_VARIABLE(canvasvar_MeterBackgroundTop, "meter background: top")
CANVAS_VARIABLE(canvasvar_MeterBridgePeakindicatorOffFillStart, "meterbridge peakindicator: fill start")
CANVAS_VARIABLE(canvasvar_MeterBridgePeakindicatorOffFillEnd, "meterbridge peakindicator: fill end")
CANVAS_VARIABLE(canvasvar_MeterBridgePeakindicatorOnFillStart, "meterbridge peakindicator on: fill start")
CANVAS_VARIABLE(canvasvar_MeterBridgePeakindicatorOnFillEnd, "meterbridge peakindicator on: fill end")
CANVAS_VARIABLE(canvasvar_MeterBridgeLabelFillStart, "meterbridge label: fill start")
CANVAS_VARIABLE(canvasvar_MeterBridgeLabelFillEnd, "meterbridge label: fill end")
CANVAS_VARIABLE(canvasvar_MeterBridgeLabelText, "meterbridge label: text")
CANVAS_VARIABLE(canvasvar_MeterMarker, "meter marker")
CANVAS_VARIABLE(canvasvar_MidiBusBase, "midi bus base")
CANVAS_VARIABLE(canvasvar_MidiFrameBase, "midi frame base")
@ -131,6 +126,8 @@ CANVAS_VARIABLE(canvasvar_RecordingRect, "recording rect")
CANVAS_VARIABLE(canvasvar_RecWaveFormFill, "recorded waveform fill")
CANVAS_VARIABLE(canvasvar_RecWaveForm, "recorded waveform outline")
CANVAS_VARIABLE(canvasvar_RubberBandRect, "rubber band rect")
CANVAS_VARIABLE(canvasvar_RulerBase, "ruler base")
CANVAS_VARIABLE(canvasvar_RulerText, "ruler text")
CANVAS_VARIABLE(canvasvar_SelectedCrossfadeEditorLine, "selected crossfade editor line")
CANVAS_VARIABLE(canvasvar_SelectedCrossfadeEditorWave, "selected crossfade editor wave")
CANVAS_VARIABLE(canvasvar_SelectedFrameBase, "selected region base")
@ -166,6 +163,8 @@ CANVAS_VARIABLE(canvasvar_TimeAxisFrame, "time axis frame")
CANVAS_VARIABLE(canvasvar_SelectedTimeAxisFrame, "selected time axis frame")
CANVAS_VARIABLE(canvasvar_TimeStretchFill, "time stretch fill")
CANVAS_VARIABLE(canvasvar_TimeStretchOutline, "time stretch outline")
CANVAS_VARIABLE(canvasvar_MonitorKnobArcStart, "monitor knob: arc start")
CANVAS_VARIABLE(canvasvar_MonitorKnobArcEnd, "monitor knob: arc end")
CANVAS_VARIABLE(canvasvar_TransportDragRect, "transport drag rect")
CANVAS_VARIABLE(canvasvar_TransportLoopRect, "transport loop rect")
CANVAS_VARIABLE(canvasvar_TransportMarkerBar, "transport marker bar")
@ -186,10 +185,8 @@ CANVAS_VARIABLE(canvasvar_MonitorSectionKnob, "monitor knob")
CANVAS_VARIABLE(canvasvar_ButtonBorder, "border color")
#define BUTTON_VARS(root,name) \
CANVAS_VARIABLE(canvasvar_ ## root ## FillStart, name ": fill start") \
CANVAS_VARIABLE(canvasvar_ ## root ## FillEnd, name ": fill end") \
CANVAS_VARIABLE(canvasvar_ ## root ## FillStartActive, name ": fill start active") \
CANVAS_VARIABLE(canvasvar_ ## root ## FillEndActive, name ": fill end active") \
CANVAS_VARIABLE(canvasvar_ ## root ## Fill, name ": fill") \
CANVAS_VARIABLE(canvasvar_ ## root ## FillActive, name ": fill active") \
CANVAS_VARIABLE(canvasvar_ ## root ## LED, name ": led") \
CANVAS_VARIABLE(canvasvar_ ## root ## LEDActive, name ": led active") \
CANVAS_VARIABLE(canvasvar_ ## root ## Text, name ": text") \
@ -202,6 +199,9 @@ BUTTON_VARS(ProcessorControlButton, "processor control button")
BUTTON_VARS(MonitorButton, "monitor button")
BUTTON_VARS(SoloIsolateButton, "solo isolate")
BUTTON_VARS(SoloSafeButton, "solo safe")
BUTTON_VARS(MidiDeviceButton, "midi device")
BUTTON_VARS(MeterBridgePeakIndicator, "meterbridge peakindicator")
BUTTON_VARS(MeterBridgeLabel, "meterbridge label")
BUTTON_VARS(MonitorSectionCutButton, "monitor section cut")
BUTTON_VARS(MonitorSectionDimButton, "monitor section dim")
BUTTON_VARS(MonitorSectionSoloButton, "monitor section solo")
@ -223,14 +223,19 @@ BUTTON_VARS(TransportButton, "transport button")
BUTTON_VARS(TransportRecenableButton, "transport recenable button")
BUTTON_VARS(TransportOptionButton, "transport option button")
BUTTON_VARS(TransportActiveOptionButton, "transport active option button")
BUTTON_VARS(TrackNumberLabel, "tracknumber label")
BUTTON_VARS(PluginBypassButton, "plugin bypass button")
BUTTON_VARS(PunchButton, "punch button")
BUTTON_VARS(MouseModeButton, "mouse mode button")
BUTTON_VARS(NudgeButton, "nudge button")
BUTTON_VARS(ZoomButton, "zoom button")
BUTTON_VARS(ZoomMenu, "zoom menu")
BUTTON_VARS(RouteButton, "route button")
BUTTON_VARS(MixerStripButton, "mixer strip button")
BUTTON_VARS(MixerStripNameButton, "mixer strip name button")
BUTTON_VARS(MidiInputButton, "midi input button")
BUTTON_VARS(LockButton, "lock button")
BUTTON_VARS(GenericButton, "generic button")
#define CLOCK_VARS(root,name) \
CANVAS_VARIABLE(canvasvar_ ## root ## Background, name ": background") \
@ -248,3 +253,44 @@ CLOCK_VARS(PunchClock, "punch clock")
CLOCK_VARS(SelectionClock, "selection clock")
CLOCK_VARS(NudgeClock, "nudge clock")
CLOCK_VARS(GenericClock, "clock")
CANVAS_FONT_VARIABLE(canvasvar_SmallFont, "small font")
CANVAS_FONT_VARIABLE(canvasvar_SmallerFont, "smaller font")
CANVAS_FONT_VARIABLE(canvasvar_NormalFont, "normal font")
CANVAS_FONT_VARIABLE(canvasvar_BigFont, "big font")
CANVAS_FONT_VARIABLE(canvasvar_LargeFont, "large font")
CANVAS_FONT_VARIABLE(canvasvar_LargerFont, "larger font")
CANVAS_FONT_VARIABLE(canvasvar_HugerFont, "huger font")
CANVAS_FONT_VARIABLE(canvasvar_MassiveFont, "massive font")
CANVAS_FONT_VARIABLE(canvasvar_SmallBoldFont, "small bold font")
CANVAS_FONT_VARIABLE(canvasvar_SmallerBoldFont, "smaller bold font")
CANVAS_FONT_VARIABLE(canvasvar_NormalBoldFont, "normal bold font")
CANVAS_FONT_VARIABLE(canvasvar_BigBoldFont, "big bold font")
CANVAS_FONT_VARIABLE(canvasvar_LargeBoldFont, "large bold font")
CANVAS_FONT_VARIABLE(canvasvar_LargerBoldFont, "larger bold font")
CANVAS_FONT_VARIABLE(canvasvar_HugerBoldFont, "huger bold font")
CANVAS_FONT_VARIABLE(canvasvar_MassiveBoldFont, "massive bold font")
CANVAS_FONT_VARIABLE(canvasvar_SmallItalicFont, "small italic font")
CANVAS_FONT_VARIABLE(canvasvar_SmallerItalicFont, "smaller italic font")
CANVAS_FONT_VARIABLE(canvasvar_NormalItalicFont, "normal italic font")
CANVAS_FONT_VARIABLE(canvasvar_BigItalicFont, "big italic font")
CANVAS_FONT_VARIABLE(canvasvar_LargeItalicFont, "large italic font")
CANVAS_FONT_VARIABLE(canvasvar_LargerItalicFont, "larger italic font")
CANVAS_FONT_VARIABLE(canvasvar_HugerItalicFont, "huger italic font")
CANVAS_FONT_VARIABLE(canvasvar_MassiveItalicFont, "massive italic font")
CANVAS_FONT_VARIABLE(canvasvar_SmallMonospaceFont, "small monospace font")
CANVAS_FONT_VARIABLE(canvasvar_SmallerMonospaceFont, "smaller monospace font")
CANVAS_FONT_VARIABLE(canvasvar_NormalMonospaceFont, "normal monospace font")
CANVAS_FONT_VARIABLE(canvasvar_BigMonospaceFont, "big monospace font")
CANVAS_FONT_VARIABLE(canvasvar_LargeMonospaceFont, "large monospace font")
CANVAS_FONT_VARIABLE(canvasvar_LargerMonospaceFont, "larger monospace font")
CANVAS_FONT_VARIABLE(canvasvar_HugerMonospaceFont, "huger monospace font")
CANVAS_FONT_VARIABLE(canvasvar_MassiveMonospaceFont, "massive monospace font")
CANVAS_FONT_VARIABLE(canvasvar_SmallBoldMonospaceFont, "small bold monospace font")
CANVAS_FONT_VARIABLE(canvasvar_SmallerBoldMonospaceFont, "smaller bold monospace font")
CANVAS_FONT_VARIABLE(canvasvar_NormalBoldMonospaceFont, "normal bold monospace font")
CANVAS_FONT_VARIABLE(canvasvar_BigBoldMonospaceFont, "big bold monospace font")
CANVAS_FONT_VARIABLE(canvasvar_LargeBoldMonospaceFont, "large bold monospace font")
CANVAS_FONT_VARIABLE(canvasvar_LargerBoldMonospaceFont, "larger bold monospace font")
CANVAS_FONT_VARIABLE(canvasvar_HugerBoldMonospaceFont, "huger bold monospace font")
CANVAS_FONT_VARIABLE(canvasvar_MassiveBoldMonospaceFont, "massive bold monospace font")

View file

@ -18,17 +18,17 @@
*/
#include "control_point.h"
#include "diamond.h"
#include "automation_line.h"
#include "ardour_ui.h"
#include "public_editor.h"
#include "canvas/rectangle.h"
#include "i18n.h"
using namespace std;
using namespace ARDOUR;
using namespace PBD;
using namespace Gnome; // for Canvas
PBD::Signal1<void, ControlPoint *> ControlPoint::CatchDeletion;
@ -43,17 +43,14 @@ ControlPoint::ControlPoint (AutomationLine& al)
_shape = Full;
_size = 4.0;
_item = new Canvas::SimpleRect (_line.canvas_group());
_item->property_draw() = true;
_item->property_fill() = false;
_item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointFill.get();
_item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get();
_item->property_outline_pixels() = 1;
_item = new ArdourCanvas::Rectangle (&_line.canvas_group());
_item->set_fill (true);
_item->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ControlPointFill());
_item->set_outline_color (ARDOUR_UI::config()->get_canvasvar_ControlPointOutline());
_item->set_data ("control_point", this);
_item->signal_event().connect (sigc::mem_fun (this, &ControlPoint::event_handler));
_item->Event.connect (sigc::mem_fun (this, &ControlPoint::event_handler));
hide ();
set_visible (false);
}
ControlPoint::ControlPoint (const ControlPoint& other, bool /*dummy_arg_to_force_special_copy_constructor*/)
@ -71,15 +68,13 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool /*dummy_arg_to_force
_shape = other._shape;
_size = other._size;
_item = new Canvas::SimpleRect (_line.canvas_group());
_item->property_fill() = false;
_item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get();
_item->property_outline_pixels() = 1;
_item = new ArdourCanvas::Rectangle (&_line.canvas_group());
_item->set_fill (true);
_item->set_outline_color (ARDOUR_UI::config()->get_canvasvar_ControlPointOutline());
/* NOTE: no event handling in copied ControlPoints */
hide ();
set_visible (false);
}
ControlPoint::~ControlPoint ()
@ -107,29 +102,15 @@ ControlPoint::show()
_item->show();
}
void
ControlPoint::set_visible (bool yn)
{
_item->property_draw() = (gboolean) yn;
}
bool
ControlPoint::visible () const
{
return _item->property_draw ();
return _item->visible ();
}
void
ControlPoint::reset (double x, double y, AutomationList::iterator mi, uint32_t vi, ShapeType shape)
{
/* If this is too big, libart will confuse itself and segfault after it casts the bounding box
of this automation line to ints. Sigh.
*/
if (x > INT32_MAX) {
x = INT32_MAX;
}
_model = mi;
_view_index = vi;
move_to (x, y, shape);
@ -141,13 +122,13 @@ ControlPoint::set_color ()
uint32_t color = 0;
if (_selected) {
color = ARDOUR_UI::config()->canvasvar_ControlPointSelected.get();
color = ARDOUR_UI::config()->get_canvasvar_ControlPointSelected();
} else {
color = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get();
color = ARDOUR_UI::config()->get_canvasvar_ControlPointOutline();
}
_item->property_outline_color_rgba() = color;
_item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointFill.get();
_item->set_outline_color (color);
_item->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ControlPointFill());
}
void
@ -179,18 +160,15 @@ ControlPoint::move_to (double x, double y, ShapeType shape)
break;
}
_item->property_x1() = x1;
_item->property_x2() = x2;
_item->property_y1() = y - half_size;
_item->property_y2() = y + half_size;
_item->set (ArdourCanvas::Rect (x1, y - half_size, x2, y + half_size));
_x = x;
_y = y;
_shape = shape;
}
void
ControlPoint::i2w (double& x, double& y) const
ArdourCanvas::Item&
ControlPoint::item() const
{
_item->i2w (x, y);
return *_item;
}

View file

@ -21,11 +21,10 @@
#define __ardour_control_point_h__
#include <sys/types.h>
#include <gdk/gdkevents.h>
#include "ardour/automation_list.h"
#include "canvas.h"
#include "simplerect.h"
#include "selectable.h"
class AutomationLine;
@ -36,11 +35,10 @@ class AutomationTimeAxisView;
class Selectable;
class Selection;
namespace Gnome {
namespace Canvas {
class SimpleRect;
class Diamond;
}
namespace ArdourCanvas {
class Rectangle;
class Diamond;
class Item;
}
class ControlPoint : public Selectable
@ -63,22 +61,21 @@ class ControlPoint : public Selectable
void hide ();
void show ();
void set_color ();
bool visible () const;
double size () const {
return _size;
}
void set_size (double);
void set_visible (bool);
bool visible () const;
void set_color ();
bool can_slide() const { return _can_slide; }
void set_can_slide(bool yn) { _can_slide = yn; }
uint32_t view_index() const { return _view_index; }
void set_view_index(uint32_t i) { _view_index = i; }
void i2w (double &, double &) const;
ArdourCanvas::Item& item() const;
ARDOUR::AutomationList::iterator model() const { return _model; }
AutomationLine& line() const { return _line; }
@ -86,7 +83,7 @@ class ControlPoint : public Selectable
static PBD::Signal1<void, ControlPoint *> CatchDeletion;
private:
ArdourCanvas::SimpleRect* _item;
ArdourCanvas::Rectangle* _item;
AutomationLine& _line;
ARDOUR::AutomationList::iterator _model;
uint32_t _view_index;

View file

@ -25,7 +25,6 @@
#include <gtkmm/image.h>
#include <gtkmm/scrolledwindow.h>
#include <libgnomecanvasmm/line.h>
#include "pbd/memento_command.h"
#include "ardour/automation_list.h"
@ -41,15 +40,16 @@
#include <gtkmm2ext/gtk_ui.h>
#include "canvas/rectangle.h"
#include "canvas/wave_view.h"
#include "canvas/line.h"
#include "canvas/polygon.h"
#include "ardour_ui.h"
#include "crossfade_edit.h"
#include "rgb_macros.h"
#include "keyboard.h"
#include "utils.h"
#include "gui_thread.h"
#include "canvas_impl.h"
#include "simplerect.h"
#include "waveview.h"
#include "actions.h"
using namespace std;
@ -127,38 +127,33 @@ CrossfadeEditor::CrossfadeEditor (Session* s, boost::shared_ptr<Crossfade> xf, d
point_grabbed = false;
toplevel = 0;
canvas = new ArdourCanvas::CanvasAA ();
canvas = new ArdourCanvas::GtkCanvas ();
canvas->signal_size_allocate().connect (sigc::mem_fun(*this, &CrossfadeEditor::canvas_allocation));
canvas->set_size_request (425, 200);
toplevel = new ArdourCanvas::SimpleRect (*(canvas->root()));
toplevel->property_x1() = 0.0;
toplevel->property_y1() = 0.0;
toplevel->property_x2() = 10.0;
toplevel->property_y2() = 10.0;
toplevel->property_fill() = true;
toplevel->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorBase.get();
toplevel->property_outline_pixels() = 0;
toplevel->signal_event().connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
toplevel = new ArdourCanvas::Rectangle (canvas->root());
toplevel->set (ArdourCanvas::Rect (0, 0, 10, 10));
toplevel->set_fill (true);
toplevel->set_fill_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorBase());
toplevel->set_outline (false);
toplevel->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[Out].line = new ArdourCanvas::Line (*(canvas->root()));
fade[Out].line->property_width_pixels() = 1;
fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[Out].line = new ArdourCanvas::PolyLine (canvas->root());
fade[Out].line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorLine());
fade[Out].shading = new ArdourCanvas::Polygon (*(canvas->root()));
fade[Out].shading->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLineShading.get();
fade[Out].shading = new ArdourCanvas::Polygon (canvas->root());
fade[Out].shading->set_fill_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorLineShading());
fade[In].line = new ArdourCanvas::Line (*(canvas->root()));
fade[In].line->property_width_pixels() = 1;
fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[In].line = new ArdourCanvas::PolyLine (canvas->root());
fade[In].line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorLine());
fade[In].shading = new ArdourCanvas::Polygon (*(canvas->root()));
fade[In].shading->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLineShading.get();
fade[In].shading = new ArdourCanvas::Polygon (canvas->root());
fade[In].shading->set_fill_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorLineShading());
fade[In].shading->signal_event().connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[In].line->signal_event().connect (sigc::mem_fun (*this, &CrossfadeEditor::curve_event));
fade[Out].shading->signal_event().connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[Out].line->signal_event().connect (sigc::mem_fun (*this, &CrossfadeEditor::curve_event));
fade[In].shading->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[In].line->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::curve_event));
fade[Out].shading->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[Out].line->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::curve_event));
select_in_button.set_name (X_("CrossfadeEditCurveButton"));
select_out_button.set_name (X_("CrossfadeEditCurveButton"));
@ -465,15 +460,14 @@ CrossfadeEditor::make_point ()
{
Point* p = new Point;
p->box = new ArdourCanvas::SimpleRect (*(canvas->root()));
p->box->property_fill() = true;
p->box->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorPointFill.get();
p->box->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorPointOutline.get();
p->box->property_outline_pixels() = 1;
p->box = new ArdourCanvas::Rectangle (canvas->root());
p->box->set_fill (true);
p->box->set_fill_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorPointFill());
p->box->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorPointOutline());
p->curve = fade[current].line;
p->box->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &CrossfadeEditor::point_event), p));
p->box->Event.connect (sigc::bind (sigc::mem_fun (*this, &CrossfadeEditor::point_event), p));
return p;
}
@ -520,11 +514,7 @@ CrossfadeEditor::Point::move_to (double nx, double ny, double xfract, double yfr
double x1 = nx - half_size;
double x2 = nx + half_size;
box->property_x1() = x1;
box->property_x2() = x2;
box->property_y1() = ny - half_size;
box->property_y2() = ny + half_size;
box->set (ArdourCanvas::Rect (x1, ny - half_size, x2, ny + half_size));
x = xfract;
y = yfract;
@ -534,15 +524,20 @@ void
CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/)
{
if (toplevel) {
toplevel->property_x1() = 0.0;
toplevel->property_y1() = 0.0;
toplevel->property_x2() = (double) canvas->get_allocation().get_width() + canvas_border;
toplevel->property_y2() = (double) canvas->get_allocation().get_height() + canvas_border;
toplevel->set (
ArdourCanvas::Rect (
0,
0,
canvas->get_allocation().get_width() + canvas_border,
canvas->get_allocation().get_height() + canvas_border
)
);
}
canvas->set_scroll_region (0.0, 0.0,
canvas->get_allocation().get_width(),
canvas->get_allocation().get_height());
/* XXX: CANVAS */
// canvas->set_scroll_region (0.0, 0.0,
// canvas->get_allocation().get_width(),
// canvas->get_allocation().get_height());
Point* end = make_point ();
PointSorter cmp;
@ -622,9 +617,9 @@ CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/)
yoff = n * ht;
(*i)->property_y() = yoff;
(*i)->property_height() = ht;
(*i)->property_samples_per_unit() = spu;
(*i)->set_y_position (yoff);
(*i)->set_height (ht);
(*i)->set_samples_per_pixel (spu);
}
ht = canvas->get_allocation().get_height() / xfade->out()->n_channels();
@ -634,9 +629,9 @@ CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/)
yoff = n * ht;
(*i)->property_y() = yoff;
(*i)->property_height() = ht;
(*i)->property_samples_per_unit() = spu;
(*i)->set_y_position (yoff);
(*i)->set_height (ht);
(*i)->set_samples_per_pixel (spu);
}
}
@ -681,11 +676,11 @@ CrossfadeEditor::redraw ()
ArdourCanvas::Points spts;
while (pts.size() < npoints) {
pts.push_back (Gnome::Art::Point (0,0));
pts.push_back (ArdourCanvas::Duple (0,0));
}
while (spts.size() < npoints + 3) {
spts.push_back (Gnome::Art::Point (0,0));
spts.push_back (ArdourCanvas::Duple (0,0));
}
/* the shade coordinates *MUST* be in anti-clockwise order.
@ -695,36 +690,36 @@ CrossfadeEditor::redraw ()
/* lower left */
spts[0].set_x (canvas_border);
spts[0].set_y (effective_height() + canvas_border);
spts[0].x = canvas_border;
spts[0].y = effective_height() + canvas_border;
/* lower right */
spts[1].set_x (effective_width() + canvas_border);
spts[1].set_y (effective_height() + canvas_border);
spts[1].x = effective_width() + canvas_border;
spts[1].y = effective_height() + canvas_border;
/* upper right */
spts[2].set_x (effective_width() + canvas_border);
spts[2].set_y (canvas_border);
spts[2].x = effective_width() + canvas_border;
spts[2].y = canvas_border;
} else {
/* upper left */
spts[0].set_x (canvas_border);
spts[0].set_y (canvas_border);
spts[0].x = canvas_border;
spts[0].y = canvas_border;
/* lower left */
spts[1].set_x (canvas_border);
spts[1].set_y (effective_height() + canvas_border);
spts[1].x = canvas_border;
spts[1].y = effective_height() + canvas_border;
/* lower right */
spts[2].set_x (effective_width() + canvas_border);
spts[2].set_y (effective_height() + canvas_border);
spts[2].x = effective_width() + canvas_border;
spts[2].y = effective_height() + canvas_border;
}
@ -734,15 +729,15 @@ CrossfadeEditor::redraw ()
double y = vec[i];
pts[i].set_x (canvas_border + i);
pts[i].set_y (y_coordinate (y));
pts[i].x = canvas_border + i;
pts[i].y = y_coordinate (y);
spts[last_spt - i].set_x (canvas_border + i);
spts[last_spt - i].set_y (pts[i].get_y());
spts[last_spt - i].x = canvas_border + i;
spts[last_spt - i].y = pts[i].y;
}
fade[current].line->property_points() = pts;
fade[current].shading->property_points() = spts;
fade[current].line->set (pts);
fade[current].shading->set (pts);
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[current].waves.begin(); i != fade[current].waves.end(); ++i) {
(*i)->property_gain_src() = static_cast<Evoral::Curve*>(&fade[current].gain_curve.curve());
@ -1069,17 +1064,17 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf)
if (wf == In) {
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
(*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
(*i)->set_outline_color (ARDOUR_UI::config()->get_canvasvar_SelectedCrossfadeEditorWave());
(*i)->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectedCrossfadeEditorWave());
}
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
(*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
(*i)->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorWave());
(*i)->set_fill_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorWave());
}
fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get();
fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[In].line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_SelectedCrossfadeEditorLine());
fade[Out].line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorLine());
fade[Out].shading->hide();
fade[In].shading->show();
@ -1094,17 +1089,17 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf)
} else {
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
(*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
(*i)->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorWave());
(*i)->set_fill_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorWave());
}
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
(*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
(*i)->set_outline_color (ARDOUR_UI::config()->get_canvasvar_SelectedCrossfadeEditorWave());
(*i)->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectedCrossfadeEditorWave());
}
fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get();
fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[Out].line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_SelectedCrossfadeEditorLine());
fade[In].line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorLine());
fade[In].shading->hide();
fade[Out].shading->show();
@ -1146,9 +1141,9 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh
double spu;
if (which == In) {
color = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
color = ARDOUR_UI::config()->get_canvasvar_SelectedCrossfadeEditorWave();
} else {
color = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
color = ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorWave();
}
ht = canvas->get_allocation().get_height() / (double) nchans;
@ -1162,29 +1157,22 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh
gdouble yoff = n * ht;
if (region->audio_source(n)->peaks_ready (boost::bind (&CrossfadeEditor::peaks_ready, this, boost::weak_ptr<AudioRegion>(region), which), &_peaks_ready_connection, gui_context())) {
WaveView* waveview = new WaveView (*(canvas->root()));
ArdourCanvas::WaveView* waveview = new ArdourCanvas::WaveView (canvas->root(), region);
waveview->property_data_src() = region.get();
waveview->property_cache_updater() = true;
waveview->property_cache() = WaveView::create_cache();
waveview->property_channel() = n;
waveview->property_length_function() = (void*) region_length_from_c;
waveview->property_sourcefile_length_function() = (void*) sourcefile_length_from_c;
waveview->property_peak_function() = (void*) region_read_peaks_from_c;
waveview->set_channel (n);
waveview->property_gain_function() = (void*) curve_get_vector_from_c;
waveview->property_gain_src() = static_cast<Evoral::Curve*>(&fade[which].gain_curve.curve());
waveview->property_x() = canvas_border;
waveview->property_y() = yoff;
waveview->property_height() = ht;
waveview->property_samples_per_unit() = spu;
waveview->set_x_position (canvas_border);
waveview->set_y_position (yoff);
waveview->set_height (ht);
waveview->set_samples_per_pixel (spu);
waveview->property_amplitude_above_axis() = 2.0;
waveview->property_wave_color() = color;
waveview->property_fill_color() = color;
waveview->set_outline_color (color);
waveview->set_fill_color (color);
if (which==In)
waveview->property_region_start() = region->start();
else
waveview->property_region_start() = region->start()+region->length()-xfade->length();
if (which != In) {
waveview->set_region_start (region->start() + region->length() - xfade->length());
}
waveview->lower_to_bottom();
fade[which].waves.push_back (waveview);

View file

@ -26,11 +26,12 @@
#include <gtkmm/button.h>
#include <gtkmm/radiobutton.h>
#include "canvas/canvas.h"
#include "evoral/Curve.hpp"
#include "ardour/session_handle.h"
#include "ardour_dialog.h"
#include "canvas.h"
namespace ARDOUR
{
@ -39,6 +40,13 @@ namespace ARDOUR
class Crossfade;
}
namespace ArdourCanvas {
class Rectangle;
class Line;
class Polygon;
class WaveView;
}
class CrossfadeEditor : public ArdourDialog
{
public:
@ -87,8 +95,8 @@ class CrossfadeEditor : public ArdourDialog
struct Point {
~Point();
ArdourCanvas::SimpleRect* box;
ArdourCanvas::Line* curve;
ArdourCanvas::Rectangle* box;
ArdourCanvas::PolyLine* curve;
double x;
double y;
@ -103,11 +111,11 @@ class CrossfadeEditor : public ArdourDialog
}
};
ArdourCanvas::SimpleRect* toplevel;
ArdourCanvas::Canvas* canvas;
ArdourCanvas::Rectangle* toplevel;
ArdourCanvas::GtkCanvas* canvas;
struct Half {
ArdourCanvas::Line* line;
ArdourCanvas::PolyLine* line;
ArdourCanvas::Polygon* shading;
std::list<Point*> points;
ARDOUR::AutomationList normative_curve; /* 0 - 1.0, linear */

View file

@ -21,7 +21,6 @@
#define __gtk_ardour_crossfade_view_h__
#include <vector>
#include <libgnomecanvasmm.h>
#include "pbd/signals.h"
#include "ardour/crossfade.h"
@ -30,13 +29,17 @@
class RouteTimeAxisView;
class AudioRegionView;
namespace ArdourCanvas {
class PolyLine;
}
class CrossfadeView : public TimeAxisViewItem
{
public:
CrossfadeView (ArdourCanvas::Group*,
CrossfadeView (ArdourCanvas::Container*,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::Crossfade>,
double initial_samples_per_unit,
double initial_samples_per_pixel,
Gdk::Color& basic_color,
AudioRegionView& leftview,
AudioRegionView& rightview);
@ -70,8 +73,8 @@ private:
bool _all_in_view;
double _child_height;
ArdourCanvas::Line *fade_in;
ArdourCanvas::Line *fade_out;
ArdourCanvas::PolyLine *fade_in;
ArdourCanvas::PolyLine *fade_out;
void crossfade_changed (const PBD::PropertyChange&);
void crossfade_fades_changed ();

View file

@ -1,10 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<Ardour>
<UI>
<Option name="ui-rc-file" value="ardour3_ui_dark.rc"/>
<Option name="icon-set" value="default"/>
<Option name="ui-rc-file" value="ui_dark.rc"/>
<Option name="flat-buttons" value="0"/>
<Option name="blink-rec-arm" value="0"/>
<Option name="waveform-gradient-depth" value="0"/>
<Option name="timeline-item-gradient-depth" value="0.5"/>
<Option name="all-floating-windows-are-dialogs" value="0"/>
<Option name="color-regions-using-track-color" value="0"/>
<Option name="show-waveform-clipping" value="1"/>
<Option name="lock-gui-after-seconds" value="0"/>
<Option name="draggable-playhead" value="1"/>
</UI>
<Canvas>
<Option name="active crossfade" value="3967af79"/>
<Option name="active crossfade" value="20b2af2e"/>
<Option name="audio bus base" value="73829968"/>
<Option name="audio master bus base" value="00000000"/>
<Option name="audio track base" value="9daac468"/>
@ -30,14 +40,16 @@
<Option name="frame handle" value="7c00ff96"/>
<Option name="gain line" value="00bc20ff"/>
<Option name="gain line inactive" value="9fbca4c5"/>
<Option name="ghost track base" value="44007c7f"/>
<Option name="ghost track base" value="603e7cc6"/>
<Option name="ghost track midi outline" value="00000000"/>
<Option name="ghost track wave" value="02fd004c"/>
<Option name="ghost track wave fill" value="00000000"/>
<Option name="ghost track wave clip" value="ff000000"/>
<Option name="ghost track wave" value="202020d9"/>
<Option name="ghost track wave fill" value="20202060"/>
<Option name="ghost track wave clip" value="202020d9"/>
<Option name="ghost track zero line" value="e500e566"/>
<Option name="image track" value="ddddd8ff"/>
<Option name="inactive crossfade" value="e8ed3d77"/>
<Option name="inactive fade handle" value="bbbbbbaa"/>
<Option name="inactive group tab" value="434343ff"/>
<Option name="location cd marker" value="1ee8c4ff"/>
<Option name="location loop" value="35964fff"/>
<Option name="location marker" value="c4f411ff"/>
@ -52,7 +64,7 @@
<Option name="measure line beat" value="a29e9e76"/>
<Option name="meter bar" value="626470cc"/>
<Option name="meter fill: 0" value="008800ff"/>
<Option name="meter fill: 1" value="008800ff"/>
<Option name="meter fill: 1" value="00aa00ff"/>
<Option name="meter fill: 2" value="00ff00ff"/>
<Option name="meter fill: 3" value="00ff00ff"/>
<Option name="meter fill: 4" value="fff000ff"/>
@ -73,6 +85,11 @@
<Option name="midi meter fill: 7" value="8fc78eff"/>
<Option name="midi meter fill: 8" value="8fc78eff"/>
<Option name="midi meter fill: 9" value="00f45600"/>
<Option name="meterbridge peakindicator: fill" value="444444ff"/>
<Option name="meterbridge peakindicator: fill active" value="ff0000ff"/>
<Option name="meterbridge label: fill" value="444444ff"/>
<Option name="meterbridge label: fill active" value="333333ff"/>
<Option name="meterbridge label: text" value="c7c7d8ff"/>
<Option name="meter marker" value="f2425bff"/>
<Option name="midi bus base" value="00000000"/>
<Option name="midi frame base" value="393d3766"/>
@ -85,10 +102,10 @@
<Option name="selected midi note color max" value="8383deff"/>
<Option name="midi note selected" value="b2b2ffff"/>
<Option name="midi note velocity text" value="f4f214bc"/>
<Option name="midi patch change fill" value="50555AA0"/>
<Option name="midi patch change outline" value="C0C5CAFF"/>
<Option name="midi patch change inactive channel fill" value="50555AC0"/>
<Option name="midi patch change inactive channel outline" value="20252AC0"/>
<Option name="midi patch change fill" value="50555aa0"/>
<Option name="midi patch change outline" value="c0c5caff"/>
<Option name="midi patch change inactive channel fill" value="50555ac0"/>
<Option name="midi patch change inactive channel outline" value="20252ac0"/>
<Option name="midi sysex fill" value="f1e139a0"/>
<Option name="midi sysex outline" value="a7a7d4ff"/>
<Option name="midi select rect fill" value="8888ff88"/>
@ -106,13 +123,15 @@
<Option name="range drag rect" value="82c696c6"/>
<Option name="range marker bar" value="7d7f8ccc"/>
<Option name="recording rect" value="cc2828ff"/>
<Option name="recorded waveform fill" value="ffffffff"/>
<Option name="recorded waveform fill" value="ffffffd9"/>
<Option name="recorded waveform outline" value="0f0f1fff"/>
<Option name="rubber band rect" value="c6c6c659"/>
<Option name="ruler base" value="2c2121ff"/>
<Option name="ruler text" value="e5e5e5ff"/>
<Option name="selected crossfade editor line" value="00dbdbff"/>
<Option name="selected crossfade editor wave" value="f9ea14a0"/>
<Option name="selected region base" value="51518a97"/>
<Option name="selected waveform fill" value="51518ac8"/>
<Option name="selected region base" value="596559ff"/>
<Option name="selected waveform fill" value="ffa500d9"/>
<Option name="selected waveform outline" value="0f0f0fcc"/>
<Option name="selection rect" value="e8f4d377"/>
<Option name="selection" value="636363b2"/>
@ -141,9 +160,12 @@
<Option name="tempo bar" value="70727fcc"/>
<Option name="tempo marker" value="f2425bff"/>
<Option name="time axis frame" value="000000ff"/>
<Option name="selected time axis frame" value="000000ff"/>
<Option name="selected time axis frame" value="ee0000ff"/>
<Option name="time stretch fill" value="e2b5b596"/>
<Option name="time stretch outline" value="63636396"/>
<Option name="tracknumber label: fill" value="444444ff"/>
<Option name="tracknumber label: fill active" value="333333ff"/>
<Option name="tracknumber label: text" value="c7c7d8ff"/>
<Option name="transport drag rect" value="969696c6"/>
<Option name="transport loop rect" value="1e7728f9"/>
<Option name="transport marker bar" value="8c8e98cc"/>
@ -153,307 +175,256 @@
<Option name="verbose canvas cursor" value="fffd2ebc"/>
<Option name="vestigial frame" value="0000000f"/>
<Option name="video timeline bar" value="303030ff"/>
<Option name="region base" value="99a7b5a0"/>
<Option name="region base" value="b1c9b1ff"/>
<Option name="region area covered by another region" value="505050b0"/>
<Option name="waveform outline" value="0f0f0fc8"/>
<Option name="waveform outline" value="000000ff"/>
<Option name="clipped waveform" value="ff0000e5"/>
<Option name="waveform fill" value="3d4753dc"/>
<Option name="zero line" value="b5b5b525"/>
<Option name="waveform fill" value="ffffffd9"/>
<Option name="zero line" value="7f7f7fe0"/>
<Option name="zoom rect" value="c6d1b26d"/>
<Option name="monitor knob" value="329edfff"/>
<Option name="monitor knob" value="555050ff"/>
<Option name="monitor knob: arc start" value="5d90b0ff"/>
<Option name="monitor knob: arc end" value="154c6eff"/>
<Option name="button border" value="000000f0"/>
<Option name="processor prefader: fill start" value="873c3cff"/>
<Option name="processor prefader: fill end" value="542525ff"/>
<Option name="processor prefader: fill start active" value="774c4cff"/>
<Option name="processor prefader: fill end active" value="603535ff"/>
<Option name="border color" value="00000000"/>
<Option name="processor prefader: fill" value="873c3cff"/>
<Option name="processor prefader: fill active" value="603535ff"/>
<Option name="processor prefader: led" value="26550eff"/>
<Option name="processor prefader: led active" value="78cb4eff"/>
<Option name="processor prefader: text" value="aaaaa3ff"/>
<Option name="processor prefader: text active" value="eeeeecff"/>
<Option name="processor fader: fill start" value="5d90b0ff"/>
<Option name="processor fader: fill end" value="154c6eff"/>
<Option name="processor fader: fill start active" value="5d90b0ff"/>
<Option name="processor fader: fill end active" value="256d8fff"/>
<Option name="processor fader: fill" value="5d90b0ff"/>
<Option name="processor fader: fill active" value="256d8fff"/>
<Option name="processor fader: led" value="26550eff"/>
<Option name="processor fader: led active" value="78cb4eff"/>
<Option name="processor fader: text" value="aaaaa3ff"/>
<Option name="processor fader: text active" value="eeeeecff"/>
<Option name="processor postfader: fill start" value="354537ff"/>
<Option name="processor postfader: fill end" value="202823ff"/>
<Option name="processor postfader: fill start active" value="466452ff"/>
<Option name="processor postfader: fill end active" value="254528ff"/>
<Option name="processor postfader: fill" value="455a3cff"/>
<Option name="processor postfader: fill active" value="254528ff"/>
<Option name="processor postfader: led" value="26550eff"/>
<Option name="processor postfader: led active" value="78cb4eff"/>
<Option name="processor postfader: text" value="aaaaa3ff"/>
<Option name="processor postfader: text active" value="eeeeecff"/>
<Option name="processor control button: fill start" value="222222ff"/>
<Option name="processor control button: fill end" value="333333ff"/>
<Option name="processor control button: fill start active" value="444444ff"/>
<Option name="processor control button: fill end active" value="333333ff"/>
<Option name="processor control button: led" value="224400ff"/>
<Option name="processor control button: led active" value="99cc00ff"/>
<Option name="processor control button: fill" value="222222ff"/>
<Option name="processor control button: fill active" value="333333ff"/>
<Option name="processor control button: led" value="101010ff"/>
<Option name="processor control button: led active" value="5d90b0ff"/>
<Option name="processor control button: text" value="ffffffff"/>
<Option name="processor control button: text active" value="ffffffff"/>
<Option name="monitor button: fill start" value="5f5a58ff"/>
<Option name="monitor button: fill end" value="4f4a48ff"/>
<Option name="monitor button: fill start active" value="553500ff"/>
<Option name="monitor button: fill end active" value="e58505ff"/>
<Option name="midi device: fill" value="54555dff"/>
<Option name="midi device: fill active" value="45464cff"/>
<Option name="midi device: led" value="006600ff"/>
<Option name="midi device: led active" value="00ff00ff"/>
<Option name="midi device: text" value="c7c7d8ff"/>
<Option name="midi device: text active" value="eeeeecff"/>
<Option name="monitor button: fill" value="616268ff"/>
<Option name="monitor button: fill active" value="c56505ff"/>
<Option name="monitor button: led" value="660000ff"/>
<Option name="monitor button: led active" value="ff0000ff"/>
<Option name="monitor button: text" value="aaaaa3ff"/>
<Option name="monitor button: text" value="c7c7d8ff"/>
<Option name="monitor button: text active" value="1a1a1aff"/>
<Option name="meterbridge label: fill start" value="444444ff"/>
<Option name="meterbridge label: fill end" value="333333ff"/>
<Option name="meterbridge label: text" value="c7c7d8ff"/>
<Option name="solo isolate: fill start" value="5f5a58ff"/>
<Option name="solo isolate: fill end" value="504442ff"/>
<Option name="solo isolate: fill start active" value="5d5856ff"/>
<Option name="solo isolate: fill end active" value="564d48ff"/>
<Option name="solo isolate: fill" value="616268ff"/>
<Option name="solo isolate: fill active" value="564d48ff"/>
<Option name="solo isolate: led" value="660000ff"/>
<Option name="solo isolate: led active" value="ff0000ff"/>
<Option name="solo isolate: text" value="c7c7d8ff"/>
<Option name="solo isolate: text active" value="c8c8d9ff"/>
<Option name="solo safe: fill start" value="5f5a58ff"/>
<Option name="solo safe: fill end" value="504442ff"/>
<Option name="solo safe: fill start active" value="5d5856ff"/>
<Option name="solo safe: fill end active" value="564d48ff"/>
<Option name="solo safe: fill" value="616268ff"/>
<Option name="solo safe: fill active" value="564d48ff"/>
<Option name="solo safe: led" value="660000ff"/>
<Option name="solo safe: led active" value="ff0000ff"/>
<Option name="solo safe: text" value="c7c7d8ff"/>
<Option name="solo safe: text active" value="c8c8d9ff"/>
<Option name="meterbridge peaklabel" value="ff1111ff"/>
<Option name="meter color BBC" value="ffa500ff"/>
<Option name="meterbridge peakindicator: fill start" value="444444ff"/>
<Option name="meterbridge peakindicator: fill end" value="333333ff"/>
<Option name="meterbridge peakindicator on: fill start" value="ff0000ff"/>
<Option name="meterbridge peakindicator on: fill end" value="880000ff"/>
<Option name="monitor section cut: fill start" value="5f5a58ff"/>
<Option name="monitor section cut: fill end" value="4f4a48ff"/>
<Option name="monitor section cut: fill start active" value="5f4943ff"/>
<Option name="monitor section cut: fill end active" value="ffa500ff"/>
<Option name="monitor section cut: fill" value="5f5a58ff"/>
<Option name="monitor section cut: fill active" value="ffa500ff"/>
<Option name="monitor section cut: led" value="473812ff"/>
<Option name="monitor section cut: led active" value="78cb4eff"/>
<Option name="monitor section cut: text" value="c7c7d8ff"/>
<Option name="monitor section cut: text active" value="000000ff"/>
<Option name="monitor section dim: fill start" value="5f5a58ff"/>
<Option name="monitor section dim: fill end" value="4f4a48ff"/>
<Option name="monitor section dim: fill start active" value="553500ff"/>
<Option name="monitor section dim: fill end active" value="e58505ff"/>
<Option name="monitor section dim: fill" value="5f5a58ff"/>
<Option name="monitor section dim: fill active" value="e58505ff"/>
<Option name="monitor section dim: led" value="00000000"/>
<Option name="monitor section dim: led active" value="78cb4eff"/>
<Option name="monitor section dim: text" value="c8c8d9ff"/>
<Option name="monitor section dim: text active" value="c8c8d9ff"/>
<Option name="monitor section solo: fill start" value="5f5a58ff"/>
<Option name="monitor section solo: fill end" value="4f4a48ff"/>
<Option name="monitor section solo: fill start active" value="104506ff"/>
<Option name="monitor section solo: fill end active" value="4dbb00ff"/>
<Option name="monitor section solo: fill" value="5f5a58ff"/>
<Option name="monitor section solo: fill active" value="4dbb00ff"/>
<Option name="monitor section solo: led" value="473812ff"/>
<Option name="monitor section solo: led active" value="ffa500ff"/>
<Option name="monitor section solo: text" value="00000000"/>
<Option name="monitor section solo: text active" value="00000000"/>
<Option name="monitor section invert: fill start" value="5f5a58ff"/>
<Option name="monitor section invert: fill end" value="4f4a48ff"/>
<Option name="monitor section invert: fill start active" value="222260ff"/>
<Option name="monitor section invert: fill end active" value="4242d0ff"/>
<Option name="monitor section invert: fill" value="5f5a58ff"/>
<Option name="monitor section invert: fill active" value="4242d0ff"/>
<Option name="monitor section invert: led" value="473812ff"/>
<Option name="monitor section invert: led active" value="78cb4eff"/>
<Option name="monitor section invert: text" value="00000000"/>
<Option name="monitor section invert: text active" value="00000000"/>
<Option name="monitor section mono: fill start" value="5f5a58ff"/>
<Option name="monitor section mono: fill end" value="4f4a48ff"/>
<Option name="monitor section mono: fill start active" value="222260ff"/>
<Option name="monitor section mono: fill end active" value="3232c0ff"/>
<Option name="monitor section mono: fill" value="5f5a58ff"/>
<Option name="monitor section mono: fill active" value="3232c0ff"/>
<Option name="monitor section mono: led" value="473812ff"/>
<Option name="monitor section mono: led active" value="78cb4eff"/>
<Option name="monitor section mono: text" value="c7c7d8ff"/>
<Option name="monitor section mono: text active" value="c8c8d9ff"/>
<Option name="monitor section solo model: fill start" value="5d5856ff"/>
<Option name="monitor section solo model: fill end" value="564d48ff"/>
<Option name="monitor section solo model: fill start active" value="5d5856ff"/>
<Option name="monitor section solo model: fill end active" value="564d48ff"/>
<Option name="monitor section solo model: fill" value="5d5856ff"/>
<Option name="monitor section solo model: fill active" value="564d48ff"/>
<Option name="monitor section solo model: led" value="4f3300ff"/>
<Option name="monitor section solo model: led active" value="ffa500ff"/>
<Option name="monitor section solo model: text" value="c7c7d8ff"/>
<Option name="monitor section solo model: text active" value="c8c8d9ff"/>
<Option name="monitor solo override: fill start" value="5d5856ff"/>
<Option name="monitor solo override: fill end" value="564d48ff"/>
<Option name="monitor solo override: fill start active" value="5d5856ff"/>
<Option name="monitor solo override: fill end active" value="564d48ff"/>
<Option name="monitor solo override: fill" value="5d5856ff"/>
<Option name="monitor solo override: fill active" value="564d48ff"/>
<Option name="monitor solo override: led" value="4f3300ff"/>
<Option name="monitor solo override: led active" value="ffa500ff"/>
<Option name="monitor solo override: text" value="c7c7d8ff"/>
<Option name="monitor solo override: text active" value="c8c8d9ff"/>
<Option name="monitor solo exclusive: fill start" value="5d5856ff"/>
<Option name="monitor solo exclusive: fill end" value="564d48ff"/>
<Option name="monitor solo exclusive: fill start active" value="5d5856ff"/>
<Option name="monitor solo exclusive: fill end active" value="564c47ff"/>
<Option name="monitor solo exclusive: fill" value="5d5856ff"/>
<Option name="monitor solo exclusive: fill active" value="564c47ff"/>
<Option name="monitor solo exclusive: led" value="4f3300ff"/>
<Option name="monitor solo exclusive: led active" value="ffa500ff"/>
<Option name="monitor solo exclusive: text" value="c7c7d8ff"/>
<Option name="monitor solo exclusive: text active" value="c8c8d9ff"/>
<Option name="rude solo: fill start" value="684d4dff"/>
<Option name="rude solo: fill end" value="513c3cff"/>
<Option name="rude solo: fill start active" value="ff1f1fff"/>
<Option name="rude solo: fill end active" value="e21b1bff"/>
<Option name="rude solo: fill" value="684d4dff"/>
<Option name="rude solo: fill active" value="e21b1bff"/>
<Option name="rude solo: led" value="00000000"/>
<Option name="rude solo: led active" value="00000000"/>
<Option name="rude solo: text" value="969696ff"/>
<Option name="rude solo: text active" value="e5e5e5ff"/>
<Option name="rude isolate: fill start" value="21414fff"/>
<Option name="rude isolate: fill end" value="192930ff"/>
<Option name="rude isolate: fill start active" value="e5f7ffff"/>
<Option name="rude isolate: fill end active" value="b6e5fdff"/>
<Option name="rude isolate: fill" value="21414fff"/>
<Option name="rude isolate: fill active" value="b6e5fdff"/>
<Option name="rude isolate: led" value="00000000"/>
<Option name="rude isolate: led active" value="000000ff"/>
<Option name="rude isolate: text" value="979797ff"/>
<Option name="rude isolate: text active" value="000000ff"/>
<Option name="rude audition: fill start" value="684d4dff"/>
<Option name="rude audition: fill end" value="513c3cff"/>
<Option name="rude audition: fill start active" value="ff1f1fff"/>
<Option name="rude audition: fill end active" value="e21b1bff"/>
<Option name="rude audition: fill" value="684d4dff"/>
<Option name="rude audition: fill active" value="e21b1bff"/>
<Option name="rude audition: led" value="00000000"/>
<Option name="rude audition: led active" value="00000000"/>
<Option name="rude audition: text" value="979797ff"/>
<Option name="rude audition: text active" value="ffffffff"/>
<Option name="feedback alert: fill start" value="684d4dff"/>
<Option name="feedback alert: fill end" value="513c3cff"/>
<Option name="feedback alert: fill start active" value="ff1f1fff"/>
<Option name="feedback alert: fill end active" value="e21b1bff"/>
<Option name="feedback alert: fill" value="684d4dff"/>
<Option name="feedback alert: fill active" value="e21b1bff"/>
<Option name="feedback alert: led" value="00000000"/>
<Option name="feedback alert: led active" value="00000000"/>
<Option name="feedback alert: text" value="969696ff"/>
<Option name="feedback alert: text active" value="e5e5e5ff"/>
<Option name="mute button: fill start" value="565659ff"/>
<Option name="mute button: fill end" value="484853ff"/>
<Option name="mute button: fill start active" value="5f4943ff"/>
<Option name="mute button: fill end active" value="ffff00ff"/>
<Option name="mute button: fill" value="616268ff"/>
<Option name="mute button: fill active" value="bbbb00ff"/>
<Option name="mute button: led" value="00000000"/>
<Option name="mute button: led active" value="00000000"/>
<Option name="mute button: text" value="bfbfafff"/>
<Option name="mute button: text" value="c7c7d8ff"/>
<Option name="mute button: text active" value="191919ff"/>
<Option name="solo button: fill start" value="565659ff"/>
<Option name="solo button: fill end" value="484853ff"/>
<Option name="solo button: fill start active" value="1d7a05ff"/>
<Option name="solo button: fill end active" value="4dbb00ff"/>
<Option name="solo button: fill" value="616268ff"/>
<Option name="solo button: fill active" value="4dbb00ff"/>
<Option name="solo button: led" value="00000000"/>
<Option name="solo button: led active" value="00000000"/>
<Option name="solo button: text" value="afbfafff"/>
<Option name="solo button: text" value="c7c7d8ff"/>
<Option name="solo button: text active" value="191919ff"/>
<Option name="invert button: fill start" value="565659ff"/>
<Option name="invert button: fill end" value="484853ff"/>
<Option name="invert button: fill start active" value="222260ff"/>
<Option name="invert button: fill end active" value="4242d0ff"/>
<Option name="invert button: fill" value="616268ff"/>
<Option name="invert button: fill active" value="4242d0ff"/>
<Option name="invert button: led" value="473812ff"/>
<Option name="invert button: led active" value="78cb4eff"/>
<Option name="invert button: text" value="bfbfbfff"/>
<Option name="invert button: text" value="d7d7e8ff"/>
<Option name="invert button: text active" value="bfbfbfff"/>
<Option name="record enable button: fill start" value="3e312fff"/>
<Option name="record enable button: fill end" value="3f312fff"/>
<Option name="record enable button: fill start active" value="c10b0bff"/>
<Option name="record enable button: fill end active" value="fd0000ff"/>
<Option name="record enable button: fill" value="616268ff"/>
<Option name="record enable button: fill active" value="b50e0eff"/>
<Option name="record enable button: led" value="7b3541ff"/>
<Option name="record enable button: led active" value="ffa3b3ff"/>
<Option name="record enable button: text" value="a5a5a5ff"/>
<Option name="record enable button: text active" value="000000ff"/>
<Option name="send alert button: fill start" value="4e5647ff"/>
<Option name="send alert button: fill end" value="43493cff"/>
<Option name="send alert button: fill start active" value="91f928ff"/>
<Option name="send alert button: fill end active" value="85e524ff"/>
<Option name="generic button: fill" value="616268ff"/>
<Option name="generic button: fill active" value="fd0000ff"/>
<Option name="generic button: led" value="22224fff"/>
<Option name="generic button: led active" value="2222ffff"/>
<Option name="generic button: text" value="c7c7d8ff"/>
<Option name="generic button: text active" value="191919ff"/>
<Option name="send alert button: fill" value="4e5647ff"/>
<Option name="send alert button: fill active" value="85e524ff"/>
<Option name="send alert button: led" value="00000000"/>
<Option name="send alert button: led active" value="00000000"/>
<Option name="send alert button: text" value="ccccccff"/>
<Option name="send alert button: text active" value="000000ff"/>
<Option name="transport button: fill start" value="616268ff"/>
<Option name="transport button: fill end" value="505159ff"/>
<Option name="transport button: fill start active" value="1d7a05ff"/>
<Option name="transport button: fill end active" value="00a300ff"/>
<Option name="transport button: fill" value="616268ff"/>
<Option name="transport button: fill active" value="00a300ff"/>
<Option name="transport button: led" value="00000000"/>
<Option name="transport button: led active" value="00000000"/>
<Option name="transport button: text" value="00000000"/>
<Option name="transport button: text active" value="00000000"/>
<Option name="transport recenable button: fill start" value="5f3f3fff"/>
<Option name="transport recenable button: fill end" value="3d2828ff"/>
<Option name="transport recenable button: fill start active" value="6a0404ff"/>
<Option name="transport recenable button: fill end active" value="b50e0eff"/>
<Option name="transport recenable button: fill" value="5f3f3fff"/>
<Option name="transport recenable button: fill active" value="b50e0eff"/>
<Option name="transport recenable button: led" value="00000000"/>
<Option name="transport recenable button: led active" value="00000000"/>
<Option name="transport recenable button: text" value="00000000"/>
<Option name="transport recenable button: text active" value="00000000"/>
<Option name="transport option button: fill start" value="636470ff"/>
<Option name="transport option button: fill end" value="54555dff"/>
<Option name="transport option button: fill start active" value="636470ff"/>
<Option name="transport option button: fill end active" value="4a4b51ff"/>
<Option name="transport option button: fill" value="616268ff"/>
<Option name="transport option button: fill active" value="4a4b51ff"/>
<Option name="transport option button: led" value="4f3300ff"/>
<Option name="transport option button: led active" value="ffa500ff"/>
<Option name="transport option button: text" value="c7c7d8ff"/>
<Option name="transport option button: text" value="d7d7e8ff"/>
<Option name="transport option button: text active" value="c8c8d9ff"/>
<Option name="transport active option button: fill start" value="606b60ff"/>
<Option name="transport active option button: fill end" value="495348ff"/>
<Option name="transport active option button: fill start active" value="154515ff"/>
<Option name="transport active option button: fill end active" value="20a320ff"/>
<Option name="transport active option button: fill" value="616268ff"/>
<Option name="transport active option button: fill active" value="00a300ff"/>
<Option name="transport active option button: led" value="4f3300ff"/>
<Option name="transport active option button: led active" value="ffa500ff"/>
<Option name="transport active option button: text" value="c7c7d8ff"/>
<Option name="transport active option button: text" value="d7d7e8ff"/>
<Option name="transport active option button: text active" value="000000ff"/>
<Option name="plugin bypass button: fill start" value="5d5856ff"/>
<Option name="plugin bypass button: fill end" value="564d48ff"/>
<Option name="plugin bypass button: fill start active" value="5d5856ff"/>
<Option name="plugin bypass button: fill end active" value="564d48ff"/>
<Option name="plugin bypass button: fill" value="5d5856ff"/>
<Option name="plugin bypass button: fill active" value="564d48ff"/>
<Option name="plugin bypass button: led" value="660000ff"/>
<Option name="plugin bypass button: led active" value="ff0000ff"/>
<Option name="plugin bypass button: text" value="c7c7d8ff"/>
<Option name="plugin bypass button: text active" value="c8c8d9ff"/>
<Option name="punch button: fill start" value="603f3fff"/>
<Option name="punch button: fill end" value="3d2828ff"/>
<Option name="punch button: fill start active" value="503010ff"/>
<Option name="punch button: fill end active" value="f03020ff"/>
<Option name="punch button: fill" value="603f3fff"/>
<Option name="punch button: fill active" value="f03020ff"/>
<Option name="punch button: led" value="00000000"/>
<Option name="punch button: led active" value="00000000"/>
<Option name="punch button: text" value="a5a5a5ff"/>
<Option name="punch button: text active" value="d8d8d8ff"/>
<Option name="mouse mode button: fill start" value="636470ff"/>
<Option name="mouse mode button: fill end" value="54555dff"/>
<Option name="mouse mode button: fill start active" value="1d7a05ff"/>
<Option name="mouse mode button: fill end active" value="14ae08ff"/>
<Option name="mouse mode button: fill" value="616268ff"/>
<Option name="mouse mode button: fill active" value="00b200ff"/>
<Option name="mouse mode button: led" value="4f3300ff"/>
<Option name="mouse mode button: led active" value="ffa500ff"/>
<Option name="mouse mode button: text" value="f2f2f2ff"/>
<Option name="mouse mode button: text" value="d7d7e8ff"/>
<Option name="mouse mode button: text active" value="000000ff"/>
<Option name="zoom button: fill start" value="626370ff"/>
<Option name="zoom button: fill end" value="54555dff"/>
<Option name="zoom button: fill start active" value="202025ff"/>
<Option name="zoom button: fill end active" value="404045ff"/>
<Option name="nudge button: fill" value="684744ff"/>
<Option name="nudge button: fill active" value="404045ff"/>
<Option name="nudge button: led" value="4f3300ff"/>
<Option name="nudge button: led active" value="ffa500ff"/>
<Option name="nudge button: text" value="c7c7d8ff"/>
<Option name="nudge button: text active" value="c8c8d9ff"/>
<Option name="zoom menu: fill" value="99997950"/>
<Option name="zoom menu: fill active" value="404045ff"/>
<Option name="zoom menu: led" value="4f3300ff"/>
<Option name="zoom menu: led active" value="ffa500ff"/>
<Option name="zoom menu: text" value="d7d7e8ff"/>
<Option name="zoom menu: text active" value="c8c8d9ff"/>
<Option name="zoom button: fill" value="616268ff"/>
<Option name="zoom button: fill active" value="00a300ff"/>
<Option name="zoom button: led" value="4f3300ff"/>
<Option name="zoom button: led active" value="ffa500ff"/>
<Option name="zoom button: text" value="c7c7d8ff"/>
<Option name="zoom button: text active" value="c8c8d9ff"/>
<Option name="route button: fill start" value="565659ff"/>
<Option name="route button: fill end" value="484853ff"/>
<Option name="route button: fill start active" value="4d4d4dff"/>
<Option name="route button: fill end active" value="121212ff"/>
<Option name="zoom button: text" value="d7d7e8ff"/>
<Option name="zoom button: text active" value="000000ff"/>
<Option name="route button: fill" value="616268ff"/>
<Option name="route button: fill active" value="121212ff"/>
<Option name="route button: led" value="4f3300ff"/>
<Option name="route button: led active" value="ffa500ff"/>
<Option name="route button: text" value="bfbfbfff"/>
<Option name="route button: text" value="d7d7e8ff"/>
<Option name="route button: text active" value="191919ff"/>
<Option name="mixer strip button: fill start" value="565659ff"/>
<Option name="mixer strip button: fill end" value="484853ff"/>
<Option name="mixer strip button: fill start active" value="5f4943ff"/>
<Option name="mixer strip button: fill end active" value="ffa500ff"/>
<Option name="mixer strip button: fill" value="616268ff"/>
<Option name="mixer strip button: fill active" value="ffa500ff"/>
<Option name="mixer strip button: led" value="4f3300ff"/>
<Option name="mixer strip button: led active" value="ffa500ff"/>
<Option name="mixer strip button: text" value="c7c7d8ff"/>
<Option name="mixer strip button: text" value="d7d7e8ff"/>
<Option name="mixer strip button: text active" value="000000ff"/>
<Option name="mixer strip name button: fill start" value="565659ff"/>
<Option name="mixer strip name button: fill end" value="484853ff"/>
<Option name="mixer strip name button: fill start active" value="4d4d4dff"/>
<Option name="mixer strip name button: fill end active" value="121212ff"/>
<Option name="mixer strip name button: fill" value="616268ff"/>
<Option name="mixer strip name button: fill active" value="121212ff"/>
<Option name="mixer strip name button: led" value="4f3300ff"/>
<Option name="mixer strip name button: led active" value="ffa500ff"/>
<Option name="mixer strip name button: text" value="c7c7d8ff"/>
<Option name="mixer strip name button: text" value="d7d7e8ff"/>
<Option name="mixer strip name button: text active" value="c8c8d9ff"/>
<Option name="midi input button: fill start" value="656867ff"/>
<Option name="midi input button: fill end" value="333333ff"/>
<Option name="midi input button: fill start active" value="a1ff43ff"/>
<Option name="midi input button: fill end active" value="00a300ff"/>
<Option name="midi input button: fill" value="656867ff"/>
<Option name="midi input button: fill active" value="00a300ff"/>
<Option name="midi input button: led" value="00000000"/>
<Option name="midi input button: led active" value="00000000"/>
<Option name="midi input button: text" value="00000000"/>
@ -498,5 +469,52 @@
<Option name="clock: text" value="6bb620ff"/>
<Option name="clock: edited text" value="ffa500ff"/>
<Option name="clock: cursor" value="ffa500ff"/>
<Option name="lock button: fill" value="616268ff"/>
<Option name="lock button: fill active" value="404045ff"/>
<Option name="lock button: led" value="00000000"/>
<Option name="lock button: led active" value="00000000"/>
<Option name="lock button: text" value="000024ff"/>
<Option name="lock button: text active" value="c8c8d9ff"/>
<Option name="small font" value="@FONT_SMALL@"/>
<Option name="smaller font" value="@FONT_SMALLER@"/>
<Option name="normal font" value="@FONT_NORMAL@"/>
<Option name="big font" value="@FONT_BIG@"/>
<Option name="large font" value="@FONT_LARGE@"/>
<Option name="larger font" value="@FONT_LARGER@"/>
<Option name="huger font" value="@FONT_HUGER@"/>
<Option name="massive font" value="@FONT_MASSIVE@"/>
<Option name="small bold font" value="bold @FONT_SMALL@"/>
<Option name="smaller bold font" value="bold @FONT_SMALLER@"/>
<Option name="normal bold font" value="bold @FONT_NORMAL@"/>
<Option name="big bold font" value="bold @FONT_BIG@"/>
<Option name="large bold font" value="bold @FONT_LARGE@"/>
<Option name="larger bold font" value="bold @FONT_LARGER@"/>
<Option name="huger bold font" value="bold @FONT_HUGER@"/>
<Option name="massive bold font" value="bold @FONT_MASSIVE@"/>
<Option name="small italic font" value="italic @FONT_SMALL@"/>
<Option name="smaller italic font" value="italic @FONT_SMALLER@"/>
<Option name="normal italic font" value="italic @FONT_NORMAL@"/>
<Option name="big italic font" value="italic @FONT_BIG@"/>
<Option name="large italic font" value="italic @FONT_LARGE@"/>
<Option name="larger italic font" value="italic @FONT_LARGER@"/>
<Option name="huger italic font" value="italic @FONT_HUGER@"/>
<Option name="massive italic font" value="italic @FONT_MASSIVE@"/>
<Option name="small monospace font" value="@MONOSPACE@ @FONT_SMALL@"/>
<Option name="smaller monospace font" value="@MONOSPACE@ @FONT_SMALLER@"/>
<Option name="normal monospace font" value="@MONOSPACE@ @FONT_NORMAL@"/>
<Option name="big monospace font" value="@MONOSPACE@ @FONT_BIG@"/>
<Option name="large monospace font" value="@MONOSPACE@ @FONT_LARGE@"/>
<Option name="larger monospace font" value="@MONOSPACE@ @FONT_LARGER@"/>
<Option name="huger monospace font" value="@MONOSPACE@ @FONT_HUGER@"/>
<Option name="massive monospace font" value="@MONOSPACE@ @FONT_MASSIVE@"/>
<Option name="small bold monospace font" value="bold @MONOSPACE@ @FONT_SMALL@"/>
<Option name="smaller bold monospace font" value="bold @MONOSPACE@ @FONT_SMALLER@"/>
<Option name="normal bold monospace font" value="bold @MONOSPACE@ @FONT_NORMAL@"/>
<Option name="big bold monospace font" value="bold @MONOSPACE@ @FONT_BIG@"/>
<Option name="large bold monospace font" value="bold @MONOSPACE@ @FONT_LARGE@"/>
<Option name="larger bold monospace font" value="bold @MONOSPACE@ @FONT_LARGER@"/>
<Option name="huger bold monospace font" value="bold @MONOSPACE@ @FONT_HUGER@"/>
<Option name="massive bold monospace font" value="bold @MONOSPACE@ @FONT_MASSIVE@"/>
</Canvas>
</Ardour>

View file

@ -1,84 +0,0 @@
/*
Copyright (C) 2007 Paul Davis
Author: David Robillard
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 "diamond.h"
using namespace Gnome::Canvas;
using namespace Gnome::Art;
Diamond::Diamond(Group& group, double height)
: Polygon(group)
, _x (0)
, _y (0)
, _h (height)
{
points = gnome_canvas_points_new (4);
move_to (0, 0);
}
Diamond::~Diamond ()
{
gnome_canvas_points_free (points);
}
void
Diamond::set_height (double height)
{
_h = height;
move_to (_x, _y);
}
void
Diamond::move_to (double x, double y)
{
_x = x;
_y = y;
points->coords[0] = _x;
points->coords[1] = _y + (_h * 2.0);
points->coords[2] = _x + _h;
points->coords[3] = _y + _h;
points->coords[4] = _x;
points->coords[5] = _y;
points->coords[6] = _x - _h;
points->coords[7] = _y + _h;
g_object_set (gobj(), "points", points, NULL);
}
void
Diamond::move_by (double dx, double dy)
{
points->coords[0] += dx;
points->coords[1] += dy;
points->coords[2] += dx;
points->coords[3] += dy;
points->coords[4] += dx;
points->coords[5] += dy;
points->coords[6] += dx;
points->coords[7] += dy;
g_object_set (gobj(), "points", points, NULL);
}

View file

@ -22,9 +22,9 @@
#include "gtkmm2ext/utils.h"
#include "canvas-note-event.h"
#include "edit_note_dialog.h"
#include "midi_region_view.h"
#include "note_base.h"
#include "i18n.h"
@ -38,7 +38,7 @@ using namespace Gtkmm2ext;
* @param n Notes to edit.
*/
EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<ArdourCanvas::CanvasNoteEvent*> n)
EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n)
: ArdourDialog (_("Note"))
, _region_view (rv)
, _events (n)
@ -119,7 +119,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<ArdourCanvas::CanvasNote
double test_time = (*_events.begin())->note()->time ();
double test_length = (*_events.begin())->note()->length ();
for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if ((*i)->note()->channel() != test_channel) {
_channel_all.set_sensitive (true);
}
@ -167,7 +167,7 @@ EditNoteDialog::done (int r)
bool had_change = false;
if (!_channel_all.get_sensitive() || _channel_all.get_active ()) {
for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (_channel.get_value_as_int() - 1 != (*i)->note()->channel()) {
_region_view->change_note_channel (*i, _channel.get_value_as_int () - 1);
had_change = true;
@ -176,7 +176,7 @@ EditNoteDialog::done (int r)
}
if (!_pitch_all.get_sensitive() || _pitch_all.get_active ()) {
for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (_pitch.get_value_as_int() != (*i)->note()->note()) {
_region_view->change_note_note (*i, _pitch.get_value_as_int ());
had_change = true;
@ -185,7 +185,7 @@ EditNoteDialog::done (int r)
}
if (!_velocity_all.get_sensitive() || _velocity_all.get_active ()) {
for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (_velocity.get_value_as_int() != (*i)->note()->velocity()) {
_region_view->change_note_velocity (*i, _velocity.get_value_as_int ());
had_change = true;
@ -196,7 +196,7 @@ EditNoteDialog::done (int r)
double const t = _region_view->source_relative_time_converter().from (_time_clock.current_time ());
if (!_time_all.get_sensitive() || _time_all.get_active ()) {
for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (t != (*i)->note()->time()) {
_region_view->change_note_time (*i, t);
had_change = true;
@ -207,7 +207,7 @@ EditNoteDialog::done (int r)
double const d = _region_view->region_relative_time_converter().from (_length_clock.current_duration ());
if (!_length_all.get_sensitive() || _length_all.get_active ()) {
for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (d != (*i)->note()->length()) {
_region_view->change_note_length (*i, d);
had_change = true;
@ -221,7 +221,7 @@ EditNoteDialog::done (int r)
_region_view->apply_diff ();
for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
(*i)->set_selected ((*i)->selected()); // change color
}
}

View file

@ -23,23 +23,18 @@
#include "audio_clock.h"
class MidiRegionView;
namespace Gnome {
namespace Canvas {
class CanvasNoteEvent;
}
}
class NoteBase;
class EditNoteDialog : public ArdourDialog
{
public:
EditNoteDialog (MidiRegionView *, std::set<Gnome::Canvas::CanvasNoteEvent*>);
public:
EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n);
void done (int);
private:
MidiRegionView* _region_view;
std::set<Gnome::Canvas::CanvasNoteEvent*> _events;
std::set<NoteBase*> _events;
Gtk::SpinButton _channel;
Gtk::CheckButton _channel_all;
Gtk::SpinButton _pitch;

View file

@ -72,6 +72,7 @@ MOUSEMODE(MouseDraw)
MOUSEMODE(MouseTimeFX)
MOUSEMODE(MouseZoom)
MOUSEMODE(MouseAudition)
MOUSEMODE(MouseCut)
/* Changing this order will break the menu */
ZOOMFOCUS(ZoomFocusLeft)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -30,6 +30,9 @@
#include "ardour/session.h"
#include "ardour/types.h"
#include "canvas/canvas.h"
#include "canvas/pixbuf.h"
#include "actions.h"
#include "ardour_ui.h"
#include "editing.h"
@ -47,6 +50,7 @@ using namespace Gtk;
using namespace Glib;
using namespace std;
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
using namespace PBD;
using namespace Editing;
@ -147,6 +151,11 @@ Editor::register_actions ()
ActionManager::register_action (editor_actions, "escape", _("Break drag or deselect all"), sigc::mem_fun (*this, &Editor::escape));
/* We don't bother registering "unlock" because it would be insensitive
when required. Editor::unlock() must be invoked directly.
*/
ActionManager::register_action (editor_actions, "lock", _("Lock"), sigc::mem_fun (*this, &Editor::lock));
toggle_reg_sens (editor_actions, "show-editor-mixer", _("Show Editor Mixer"), sigc::mem_fun (*this, &Editor::editor_mixer_button_toggled));
toggle_reg_sens (editor_actions, "show-editor-list", _("Show Editor List"), sigc::mem_fun (*this, &Editor::editor_list_button_toggled));
@ -182,11 +191,15 @@ Editor::register_actions ()
reg_sens (editor_actions, "playhead-to-range-start", _("Playhead to Range Start"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_to_selection_start), playhead_cursor));
reg_sens (editor_actions, "playhead-to-range-end", _("Playhead to Range End"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_to_selection_end), playhead_cursor));
reg_sens (editor_actions, "select-all", _("Select All"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all), Selection::Set));
reg_sens (editor_actions, "select-all-objects", _("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), Selection::Set));
reg_sens (editor_actions, "select-all-tracks", _("Select All Tracks"), sigc::mem_fun(*this, &Editor::select_all_tracks));
reg_sens (editor_actions, "deselect-all", _("Deselect All"), sigc::mem_fun(*this, &Editor::deselect_all));
reg_sens (editor_actions, "invert-selection", _("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection));
reg_sens (editor_actions, "select-all-after-edit-cursor", _("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true));
reg_sens (editor_actions, "alternate-select-all-after-edit-cursor", _("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true));
reg_sens (editor_actions, "select-all-before-edit-cursor", _("Select All Before Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false));
reg_sens (editor_actions, "alternate-select-all-before-edit-cursor", _("Select All Before Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false));
reg_sens (editor_actions, "select-all-between-cursors", _("Select All Overlapping Edit Range"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), false));
reg_sens (editor_actions, "select-all-within-cursors", _("Select All Inside Edit Range"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), true));
@ -227,8 +240,15 @@ Editor::register_actions ()
}
reg_sens (editor_actions, "jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark));
reg_sens (editor_actions, "alternate-jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*this, &Editor::jump_forward_to_mark));
reg_sens (editor_actions, "jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark));
reg_sens (editor_actions, "alternate-jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark));
reg_sens (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(*this, &Editor::add_location_from_playhead_cursor));
reg_sens (editor_actions, "alternate-add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(*this, &Editor::add_location_from_playhead_cursor));
reg_sens (editor_actions, "remove-location-from-playhead", _("Remove Mark at Playhead"), sigc::mem_fun(*this, &Editor::remove_location_at_playhead_cursor));
reg_sens (editor_actions, "alternate-remove-location-from-playhead", _("Remove Mark at Playhead"), sigc::mem_fun(*this, &Editor::remove_location_at_playhead_cursor));
reg_sens (editor_actions, "nudge-next-forward", _("Nudge Next Later"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_forward), true, false));
reg_sens (editor_actions, "nudge-next-backward", _("Nudge Next Earlier"), sigc::bind (sigc::mem_fun(*this, &Editor::nudge_backward), true, false));
@ -243,6 +263,8 @@ Editor::register_actions ()
reg_sens (editor_actions, "zoom-to-session", _("Zoom to Session"), sigc::mem_fun(*this, &Editor::temporal_zoom_session));
reg_sens (editor_actions, "zoom-to-region", _("Zoom to Region"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_to_region), false));
reg_sens (editor_actions, "zoom-to-region-both-axes", _("Zoom to Region (Width and Height)"), sigc::bind (sigc::mem_fun(*this, &Editor::zoom_to_region), true));
reg_sens (editor_actions, "zoom-to-range", _("Zoom to Range"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), false));
reg_sens (editor_actions, "zoom-to-range-both-axes", _("Zoom to Range (Width and Height)"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), true));
reg_sens (editor_actions, "toggle-zoom", _("Toggle Zoom State"), sigc::mem_fun(*this, &Editor::swap_visual_state));
reg_sens (editor_actions, "expand-tracks", _("Expand Track Height"), sigc::bind (sigc::mem_fun (*this, &Editor::tav_zoom_step), false));
@ -273,6 +295,8 @@ Editor::register_actions ()
reg_sens (editor_actions, "playhead-to-edit", _("Playhead to Active Mark"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_align), true));
reg_sens (editor_actions, "edit-to-playhead", _("Active Mark to Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_align), false));
toggle_reg_sens (editor_actions, "toggle-skip-playback", _("Use Skip Ranges"), sigc::mem_fun(*this, &Editor::toggle_skip_playback));
reg_sens (editor_actions, "set-loop-from-edit-range", _("Set Loop from Edit Range"), sigc::bind (sigc::mem_fun(*this, &Editor::set_loop_from_edit_range), false));
reg_sens (editor_actions, "set-punch-from-edit-range", _("Set Punch from Edit Range"), sigc::mem_fun(*this, &Editor::set_punch_from_edit_range));
@ -289,7 +313,10 @@ Editor::register_actions ()
reg_sens (editor_actions, "duplicate-range", _("Duplicate Range"), sigc::bind (sigc::mem_fun(*this, &Editor::duplicate_range), false));
undo_action = reg_sens (editor_actions, "undo", S_("Command|Undo"), sigc::bind (sigc::mem_fun(*this, &Editor::undo), 1U));
redo_action = reg_sens (editor_actions, "redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
redo_action = reg_sens (editor_actions, "alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
redo_action = reg_sens (editor_actions, "alternate-alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U));
reg_sens (editor_actions, "export-audio", _("Export Audio"), sigc::mem_fun(*this, &Editor::export_audio));
reg_sens (editor_actions, "export-range", _("Export Range"), sigc::mem_fun(*this, &Editor::export_range));
@ -308,23 +335,32 @@ Editor::register_actions ()
reg_sens (editor_actions, "editor-cut", _("Cut"), sigc::mem_fun(*this, &Editor::cut));
reg_sens (editor_actions, "editor-delete", _("Delete"), sigc::mem_fun(*this, &Editor::delete_));
reg_sens (editor_actions, "alternate-editor-delete", _("Delete"), sigc::mem_fun(*this, &Editor::delete_));
reg_sens (editor_actions, "editor-copy", _("Copy"), sigc::mem_fun(*this, &Editor::copy));
reg_sens (editor_actions, "editor-paste", _("Paste"), sigc::mem_fun(*this, &Editor::keyboard_paste));
reg_sens (editor_actions, "editor-fade-range", _("Fade Range Selection"), sigc::mem_fun(*this, &Editor::fade_range));
reg_sens (editor_actions, "set-tempo-from-edit-range", _("Set Tempo from Edit Range = Bar"), sigc::mem_fun(*this, &Editor::use_range_as_bar));
toggle_reg_sens (editor_actions, "toggle-log-window", _("Log"),
sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::toggle_errors));
reg_sens (editor_actions, "tab-to-transient-forwards", _("Move Later to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true));
reg_sens (editor_actions, "tab-to-transient-backwards", _("Move Earlier to Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false));
reg_sens (editor_actions, "alternate-tab-to-transient-forwards", _("Move to Next Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true));
reg_sens (editor_actions, "alternate-tab-to-transient-backwards", _("Move to Previous Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false));
reg_sens (editor_actions, "tab-to-transient-forwards", _("Move to Next Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), true));
reg_sens (editor_actions, "tab-to-transient-backwards", _("Move to Previous Transient"), sigc::bind (sigc::mem_fun(*this, &Editor::tab_to_transient), false));
reg_sens (editor_actions, "crop", _("Crop"), sigc::mem_fun(*this, &Editor::crop_region_to_selection));
reg_sens (editor_actions, "start-range", _("Start Range"), sigc::mem_fun(*this, &Editor::keyboard_selection_begin));
reg_sens (editor_actions, "finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), false));
reg_sens (editor_actions, "finish-add-range", _("Finish Add Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), true));
reg_sens (editor_actions, "alt-start-range", _("Start Range"), sigc::mem_fun(*this, &Editor::keyboard_selection_begin));
reg_sens (editor_actions, "alt-finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), false));
// reg_sens (editor_actions, "finish-add-range", _("Finish Add Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), true));
reg_sens (
editor_actions,
@ -371,7 +407,8 @@ Editor::register_actions ()
}
ActionManager::track_selection_sensitive_actions.push_back (act);
reg_sens (editor_actions, "fit-tracks", _("Fit Selected Tracks"), sigc::mem_fun(*this, &Editor::fit_selected_tracks));
act = reg_sens (editor_actions, "fit-tracks", _("Fit Selected Tracks"), sigc::mem_fun(*this, &Editor::fit_selected_tracks));
ActionManager::track_selection_sensitive_actions.push_back (act);
act = reg_sens (editor_actions, "track-height-largest", _("Largest"), sigc::bind (
sigc::mem_fun(*this, &Editor::set_track_height), HeightLargest));
@ -411,72 +448,72 @@ Editor::register_actions ()
smart_mode_action = Glib::RefPtr<ToggleAction>::cast_static (act);
smart_mode_button.set_related_action (smart_mode_action);
smart_mode_button.set_text (_("Smart"));
smart_mode_button.add_elements ( ArdourButton::FlatFace );
smart_mode_button.set_name ("mouse mode button");
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("Object Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseObject));
mouse_move_button.set_related_action (act);
mouse_move_button.set_image (::get_icon("tool_object"));
mouse_move_button.add_elements ( ArdourButton::FlatFace );
mouse_move_button.set_name ("mouse mode button");
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-range", _("Range Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseRange));
mouse_select_button.set_related_action (act);
mouse_select_button.set_image (::get_icon("tool_range"));
mouse_select_button.add_elements ( ArdourButton::FlatFace );
mouse_select_button.set_name ("mouse mode button");
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-draw", _("Note Drawing Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseDraw));
mouse_draw_button.set_related_action (act);
mouse_draw_button.set_image (::get_icon("midi_tool_pencil"));
mouse_draw_button.add_elements ( ArdourButton::FlatFace );
mouse_draw_button.set_name ("mouse mode button");
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-gain", _("Gain Tool"), sigc::bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseGain));
mouse_gain_button.set_related_action (act);
mouse_gain_button.set_image (::get_icon("tool_gain"));
mouse_gain_button.add_elements ( ArdourButton::FlatFace );
mouse_gain_button.set_name ("mouse mode button");
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-zoom", _("Zoom Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseZoom));
mouse_zoom_button.set_related_action (act);
mouse_zoom_button.set_image (::get_icon("tool_zoom"));
mouse_zoom_button.add_elements ( ArdourButton::FlatFace );
mouse_zoom_button.set_name ("mouse mode button");
if(!Profile->get_mixbus()) {
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-zoom", _("Zoom Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseZoom));
mouse_zoom_button.set_related_action (act);
mouse_zoom_button.set_image (::get_icon("tool_zoom"));
mouse_zoom_button.set_name ("mouse mode button");
}
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-audition", _("Audition Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseAudition));
mouse_audition_button.set_related_action (act);
mouse_audition_button.set_image (::get_icon("tool_audition"));
mouse_audition_button.add_elements ( ArdourButton::FlatFace );
mouse_audition_button.set_name ("mouse mode button");
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-timefx", _("Time FX Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseTimeFX));
mouse_timefx_button.set_related_action (act);
mouse_timefx_button.set_image (::get_icon("tool_stretch"));
mouse_timefx_button.add_elements ( ArdourButton::FlatFace );
mouse_timefx_button.set_name ("mouse mode button");
if(!Profile->get_mixbus()) {
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-cut", _("Cut Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseCut));
mouse_cut_button.set_related_action (act);
mouse_cut_button.set_image (::get_icon("tool_cut"));
mouse_cut_button.set_name ("mouse mode button");
}
ActionManager::register_action (editor_actions, "step-mouse-mode", _("Step Mouse Mode"), sigc::bind (sigc::mem_fun(*this, &Editor::step_mouse_mode), true));
act = ActionManager::register_toggle_action (mouse_mode_actions, "toggle-internal-edit", _("Edit MIDI"), sigc::mem_fun(*this, &Editor::toggle_internal_editing));
internal_edit_button.set_related_action (act);
internal_edit_button.set_image (::get_icon("tool_note"));
internal_edit_button.add_elements ( ArdourButton::FlatFace );
internal_edit_button.set_name ("mouse mode button");
RadioAction::Group edit_point_group;
ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-playhead"), _("Playhead"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-mouse"), _("Mouse"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-selected-marker"), _("Marker"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtPlayhead)));
ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-mouse"), _("Mouse"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtMouse)));
ActionManager::register_radio_action (editor_actions, edit_point_group, X_("edit-at-selected-marker"), _("Marker"), (sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_chosen), Editing::EditAtSelectedMarker)));
ActionManager::register_action (editor_actions, "cycle-edit-point", _("Change Edit Point"), sigc::bind (sigc::mem_fun (*this, &Editor::cycle_edit_point), false));
ActionManager::register_action (editor_actions, "cycle-edit-point-with-marker", _("Change Edit Point Including Marker"), sigc::bind (sigc::mem_fun (*this, &Editor::cycle_edit_point), true));
if (!Profile->get_sae()) {
ActionManager::register_action (editor_actions, "set-edit-splice", _("Splice"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Splice));
}
// ActionManager::register_action (editor_actions, "set-edit-splice", _("Splice"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Splice));
ActionManager::register_action (editor_actions, "set-edit-ripple", _("Ripple"), bind (mem_fun (*this, &Editor::set_edit_mode), Ripple));
ActionManager::register_action (editor_actions, "set-edit-slide", _("Slide"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Slide));
ActionManager::register_action (editor_actions, "set-edit-lock", _("Lock"), sigc::bind (sigc::mem_fun (*this, &Editor::set_edit_mode), Lock));
ActionManager::register_action (editor_actions, "toggle-edit-mode", _("Toggle Edit Mode"), sigc::mem_fun (*this, &Editor::cycle_edit_mode));
ActionManager::register_action (editor_actions, "cycle-edit-mode", _("Cycle Edit Mode"), sigc::mem_fun (*this, &Editor::cycle_edit_mode));
ActionManager::register_action (editor_actions, X_("SnapTo"), _("Snap to"));
ActionManager::register_action (editor_actions, X_("SnapMode"), _("Snap Mode"));
@ -560,12 +597,30 @@ Editor::register_actions ()
/* set defaults here */
no_ruler_shown_update = true;
ruler_meter_action->set_active (true);
ruler_tempo_action->set_active (true);
ruler_marker_action->set_active (true);
ruler_range_action->set_active (true);
ruler_loop_punch_action->set_active (true);
ruler_loop_punch_action->set_active (true);
if (Profile->get_trx()) {
ruler_marker_action->set_active (true);
ruler_meter_action->set_active (false);
ruler_tempo_action->set_active (false);
ruler_range_action->set_active (false);
ruler_loop_punch_action->set_active (false);
ruler_loop_punch_action->set_active (false);
ruler_bbt_action->set_active (true);
ruler_cd_marker_action->set_active (false);
ruler_timecode_action->set_active (false);
ruler_minsec_action->set_active (true);
} else {
ruler_marker_action->set_active (true);
ruler_meter_action->set_active (true);
ruler_tempo_action->set_active (true);
ruler_range_action->set_active (true);
ruler_loop_punch_action->set_active (true);
ruler_loop_punch_action->set_active (true);
ruler_bbt_action->set_active (false);
ruler_cd_marker_action->set_active (true);
ruler_timecode_action->set_active (true);
ruler_minsec_action->set_active (false);
}
ruler_video_action->set_active (false);
xjadeo_proc_action->set_active (false);
@ -584,17 +639,6 @@ Editor::register_actions ()
xjadeo_letterbox_action->set_sensitive (false);
xjadeo_zoom_100->set_sensitive (false);
if (Profile->get_sae()) {
ruler_bbt_action->set_active (true);
ruler_cd_marker_action->set_active (false);
ruler_timecode_action->set_active (false);
ruler_minsec_action->set_active (true);
} else {
ruler_bbt_action->set_active (false);
ruler_cd_marker_action->set_active (true);
ruler_timecode_action->set_active (true);
ruler_minsec_action->set_active (false);
}
ruler_samples_action->set_active (false);
no_ruler_shown_update = false;
@ -658,6 +702,10 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, X_("importFromSession"), _("Import From Session"), sigc::mem_fun(*this, &Editor::session_import_dialog));
ActionManager::write_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, X_("bring-into-session"), _("Bring all media into session folder"), sigc::mem_fun(*this, &Editor::bring_all_sources_into_session));
ActionManager::write_sensitive_actions.push_back (act);
ActionManager::register_toggle_action (editor_actions, X_("ToggleSummary"), _("Show Summary"), sigc::mem_fun (*this, &Editor::set_summary));
ActionManager::register_toggle_action (editor_actions, X_("ToggleGroupTabs"), _("Show Group Tabs"), sigc::mem_fun (*this, &Editor::set_group_tabs));
@ -691,7 +739,7 @@ Editor::load_bindings ()
std::string binding_file;
if (find_file_in_search_path (ardour_config_search_path(), "editor.bindings", binding_file)) {
if (find_file (ardour_config_search_path(), "editor.bindings", binding_file)) {
key_bindings.load (binding_file);
info << string_compose (_("Loaded editor bindings from %1"), binding_file) << endmsg;
} else {
@ -699,6 +747,20 @@ Editor::load_bindings ()
}
}
void
Editor::toggle_skip_playback ()
{
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), "toggle-skip-playback");
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
bool s = Config->get_skip_playback ();
if (tact->get_active() != s) {
Config->set_skip_playback (tact->get_active());
}
}
}
void
Editor::toggle_ruler_visibility (RulerType rt)
{
@ -1597,17 +1659,17 @@ Editor::parameter_changed (std::string p)
ENSURE_GUI_THREAD (*this, &Editor::parameter_changed, p)
if (p == "auto-loop") {
update_loop_range_view (true);
update_loop_range_view ();
} else if (p == "punch-in") {
update_punch_range_view (true);
update_punch_range_view ();
} else if (p == "punch-out") {
update_punch_range_view (true);
update_punch_range_view ();
} else if (p == "timecode-format") {
update_just_timecode ();
} else if (p == "show-region-fades") {
update_region_fade_visibility ();
} else if (p == "edit-mode") {
edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
edit_mode_selector.set_text (edit_mode_to_string (Config->get_edit_mode()));
} else if (p == "show-track-meters") {
toggle_meter_updating();
} else if (p == "show-summary") {
@ -1647,7 +1709,9 @@ Editor::parameter_changed (std::string p)
} else if (p == "timecode-offset" || p == "timecode-offset-negative") {
update_just_timecode ();
} else if (p == "show-zoom-tools") {
_zoom_tearoff->set_visible (Config->get_show_zoom_tools(), true);
if (_zoom_tearoff) {
_zoom_tearoff->set_visible (Config->get_show_zoom_tools(), true);
}
} else if (p == "sound-midi-notes") {
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("sound-midi-notes"));
@ -1673,13 +1737,23 @@ Editor::parameter_changed (std::string p)
} else {
Gtkmm2ext::disable_tooltips ();
}
} else if (p == "skip-playback") {
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-skip-playback"));
if (act) {
bool s = Config->get_skip_playback ();
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
if (tact->get_active () != s) {
tact->set_active (s);
}
}
}
}
void
Editor::reset_focus ()
{
track_canvas->grab_focus();
_track_canvas->grab_focus();
}
void
@ -1846,7 +1920,10 @@ Editor::register_region_actions ()
);
reg_sens (_region_actions, "set-fade-in-length", _("Set Fade In Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), true));
reg_sens (_region_actions, "alternate-set-fade-in-length", _("Set Fade In Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), true));
reg_sens (_region_actions, "set-fade-out-length", _("Set Fade Out Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), false));
reg_sens (_region_actions, "alternate-set-fade-out-length", _("Set Fade Out Length"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_length), false));
reg_sens (_region_actions, "set-tempo-from-region", _("Set Tempo from Region = Bar"), sigc::mem_fun (*this, &Editor::set_tempo_from_region));
reg_sens (
@ -1890,7 +1967,11 @@ Editor::register_region_actions ()
reg_sens (_region_actions, "set-selection-from-region", _("Set Range Selection"), sigc::mem_fun (*this, &Editor::set_selection_from_region));
reg_sens (_region_actions, "nudge-forward", _("Nudge Later"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false));
reg_sens (_region_actions, "alternate-nudge-forward", _("Nudge Later"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_forward), false, false));
reg_sens (_region_actions, "nudge-backward", _("Nudge Earlier"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false));
reg_sens (_region_actions, "alternate-nudge-backward", _("Nudge Earlier"), sigc::bind (sigc::mem_fun (*this, &Editor::nudge_backward), false, false));
reg_sens (_region_actions, "sequence-regions", _("Sequence Regions"), sigc::mem_fun (*this, &Editor::sequence_regions));
reg_sens (
_region_actions,

View file

@ -52,7 +52,6 @@
#include "audio_time_axis.h"
#include "midi_time_axis.h"
#include "session_import_dialog.h"
#include "utils.h"
#include "gui_thread.h"
#include "interthread_progress_window.h"
#include "mouse_cursors.h"
@ -528,8 +527,8 @@ Editor::embed_sndfiles (vector<string> paths, bool multifile,
SoundFileInfo finfo;
int ret = 0;
set_canvas_cursor (_cursors->wait);
gdk_flush ();
push_canvas_cursor (_cursors->wait);
gdk_flush ();
for (vector<string>::iterator p = paths.begin(); p != paths.end(); ++p) {
@ -601,8 +600,6 @@ Editor::embed_sndfiles (vector<string> paths, bool multifile,
}
}
set_canvas_cursor (_cursors->wait);
for (int n = 0; n < finfo.channels; ++n) {
try {
@ -632,7 +629,7 @@ Editor::embed_sndfiles (vector<string> paths, bool multifile,
goto out;
}
ARDOUR_UI::instance()->flush_pending ();
gtk_main_iteration();
}
}
@ -644,7 +641,7 @@ Editor::embed_sndfiles (vector<string> paths, bool multifile,
ret = add_sources (paths, sources, pos, disposition, mode, target_regions, target_tracks, track, true);
out:
set_canvas_cursor (current_canvas_cursor);
pop_canvas_cursor ();
return ret;
}
@ -749,7 +746,12 @@ Editor::add_sources (vector<string> paths, SourceList& sources, framepos_t& pos,
region_name = (*x)->name();
}
track_names.push_back (PBD::basename_nosuffix (paths[n]));
if (SMFSource::safe_midi_file_extension (paths.front())) {
string track_name = string_compose ("%1-t%2", PBD::basename_nosuffix (fs->path()), (n + 1));
track_names.push_back (track_name);
} else {
track_names.push_back (PBD::basename_nosuffix (paths[n]));
}
}
PropertyList plist;
@ -896,6 +898,9 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region, uint32_t
boost::shared_ptr<Region> copy (RegionFactory::create (region, region->properties()));
playlist->clear_changes ();
playlist->add_region (copy, pos);
if (Config->get_edit_mode() == Ripple)
playlist->ripple (pos, copy->length(), copy);
_session->add_command (new StatefulDiffCommand (playlist));
break;
}

Some files were not shown because too many files have changed in this diff Show more