From c72c7e65759616d5e91716e286071f3fff24d2d0 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Mon, 22 Apr 2013 19:19:33 +0200 Subject: [PATCH 01/27] Fix license in fastlog. Date: Mon, 22 Apr 2013 19:09:04 +0200 From: Laurent de Soras To: Adrian Knoth Subject: Re: License of FastLog Hi Adrian, > Several open-source projects like Ardour use the code below which has > no explicit license. > > If you agree (read: reply), we'd like to add the MIT license to this > file, that is, change the copyright statement to the following text: Nowadays I license my code under the WTFPL, which should be compatible with the traditional open source licenses. So please use this one instead: -- Laurent de Soras | Ohm Force DSP developer & Software designer | Digital Audio Software http://ldesoras.free.fr | http://www.ohmforce.com --- libs/pbd/pbd/fastlog.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/pbd/pbd/fastlog.h b/libs/pbd/pbd/fastlog.h index 9897da773a..f64ad996cf 100644 --- a/libs/pbd/pbd/fastlog.h +++ b/libs/pbd/pbd/fastlog.h @@ -1,6 +1,10 @@ -/* Copyright unknown. Code by Laurent de Soras . - */ +/* +Copyright © 2013 Laurent de Soras +This work is free. You can redistribute it and/or modify it under the +terms of the Do What The Fuck You Want To Public License, Version 2, +as published by Sam Hocevar. See http://www.wtfpl.net/ for more details. +*/ #ifndef __pbd_fastlog_h__ #define __pbd_fastlog_h__ From 55e07a7243f27d96e72eb95558b2aa1026886527 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Mon, 22 Apr 2013 19:33:19 +0200 Subject: [PATCH 02/27] Drop obsolete powermate code from libs/surface --- libs/surfaces/powermate/README | 21 --- libs/surfaces/powermate/i18n.h | 16 -- libs/surfaces/powermate/interface.cc | 57 ------ libs/surfaces/powermate/powermate.cc | 258 --------------------------- libs/surfaces/powermate/powermate.h | 34 ---- libs/surfaces/powermate/wscript | 37 ---- libs/surfaces/wscript | 4 - 7 files changed, 427 deletions(-) delete mode 100644 libs/surfaces/powermate/README delete mode 100644 libs/surfaces/powermate/i18n.h delete mode 100644 libs/surfaces/powermate/interface.cc delete mode 100644 libs/surfaces/powermate/powermate.cc delete mode 100644 libs/surfaces/powermate/powermate.h delete mode 100644 libs/surfaces/powermate/wscript diff --git a/libs/surfaces/powermate/README b/libs/surfaces/powermate/README deleted file mode 100644 index d786b1d898..0000000000 --- a/libs/surfaces/powermate/README +++ /dev/null @@ -1,21 +0,0 @@ - -This module works with the Griffin Powermate and allows some basic transport control. - -It autodetects the Powermate on any input device of the form "/dev/input/event*". This means you must have the powermate module in your kernel. It works out-of-the-box with 64Studio and presumably lots of other modern distributions. - -Turning the wheel left and right will act as a "Shuttle" wheel, adjusting playback speed up and down -Pushing the knob will switch between play and stop -Pushing the knob while turning will jump to the next or previous markers - - -In order for the powermate to work, you have to have permission to open the input device for reading. -In debian, I changed /etc/udev/rules.d/0_permissions.rules to have the line: -KERNEL=="event[0-9]*", MODE="0666" -but there are other ways to achieve this - - -Feedback, tweaks, bug fixes and feature ideas are encouraged - --Ben Loftis, ben@benloftis.com - - \ No newline at end of file diff --git a/libs/surfaces/powermate/i18n.h b/libs/surfaces/powermate/i18n.h deleted file mode 100644 index dcbbfcf52e..0000000000 --- a/libs/surfaces/powermate/i18n.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __i18n_h__ -#define __i18n_h__ - -#include "pbd/compose.h" -#include "pbd/convert.h" -#include "gettext.h" - -#include -#include - -#define _(Text) dgettext (PACKAGE,Text) -#define N_(Text) gettext_noop (Text) -#define X_(Text) Text -#define I18N(Array) PBD::internationalize (PACKAGE, Array) - -#endif // __i18n_h__ diff --git a/libs/surfaces/powermate/interface.cc b/libs/surfaces/powermate/interface.cc deleted file mode 100644 index 02ddf97722..0000000000 --- a/libs/surfaces/powermate/interface.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - Ardour9pin interface file - Ben Loftis - Created: 05/18/06 11:07:56 - Copyright Harrison Audio, LLC, 2007 -*/ - -#include "powermate.h" - -using namespace ARDOUR; - -ControlProtocol* -new_powermate_protocol (ControlProtocolDescriptor* /*descriptor*/, Session* s) -{ - PowermateControlProtocol* pcp = new PowermateControlProtocol (*s); - - if (pcp->set_active (true)) { - delete pcp; - return 0; - } - - return pcp; - -} - -void -delete_powermate_protocol (ControlProtocolDescriptor* /*descriptor*/, ControlProtocol* cp) -{ - delete cp; -} - -bool -probe_powermate_protocol (ControlProtocolDescriptor* /*descriptor*/) -{ - return PowermateControlProtocol::probe (); -} - -static ControlProtocolDescriptor powermate_descriptor = { - name : "powermate", - id : "uri://ardour.org/ardour/powermate:0", - ptr : 0, - module : 0, - mandatory : 0, - supports_feedback : false, - probe : probe_powermate_protocol, - initialize : new_powermate_protocol, - destroy : delete_powermate_protocol -}; - - -extern "C" { -ControlProtocolDescriptor* -protocol_descriptor () { - return &powermate_descriptor; -} -} - diff --git a/libs/surfaces/powermate/powermate.cc b/libs/surfaces/powermate/powermate.cc deleted file mode 100644 index 0475603a51..0000000000 --- a/libs/surfaces/powermate/powermate.cc +++ /dev/null @@ -1,258 +0,0 @@ -/* - powermate.cc - Ben Loftis - Created: 03/26/07 20:07:56 -*/ - - -#include -#include -#include -#include -#include -#include - -#include - -#include "pbd/pthread_utils.h" -#include "pbd/xml++.h" -#include "pbd/error.h" - -#include "ardour/debug.h" - -#include "powermate.h" -#include "i18n.h" - -using namespace ARDOUR; -using namespace std; -using namespace sigc; -using namespace PBD; - -#define NUM_VALID_PREFIXES 2 - -static const char *valid_prefix[NUM_VALID_PREFIXES] = { - "Griffin PowerMate", - "Griffin SoundKnob" -}; - -#define NUM_EVENT_DEVICES 16 - -int open_powermate (const char *dev, int mode) -{ - if (!Glib::file_test (dev, Glib::FILE_TEST_EXISTS)) { - return -1; - } - - int fd = open(dev, mode); - int i; - char name[255]; - - if (fd < 0) { - if (errno != EACCES) { - error << string_compose ("Unable to open \"%1\": %2", dev, strerror(errno)) << endmsg; - } - return -1; - } - - /* placate valgrind */ - name[0] = '\0'; - - if (ioctl (fd, EVIOCGNAME (sizeof(name)), name) < 0) { - error << string_compose ("\"%1\": EVIOCGNAME failed: %2", dev, strerror(errno)) << endmsg; - close (fd); - return -1; - } - - // it's the correct device if the prefix matches what we expect it to be: - for (i = 0; i < NUM_VALID_PREFIXES; ++i) { - if (!strncasecmp (name, valid_prefix[i], strlen (valid_prefix[i]))) { - return fd; - } - } - - close (fd); - return -1; -} - -int find_powermate(int mode) -{ - char devname[256]; - int i, r; - - for (i = 0; i < NUM_EVENT_DEVICES; i++) { - sprintf (devname, "/dev/input/event%d", i); - r = open_powermate (devname, mode); - if (r >= 0) { - return r; - } - } - - return -1; -} - -PowermateControlProtocol::PowermateControlProtocol (Session& s) - : ControlProtocol (s, "powermate") -{ -} - -PowermateControlProtocol::~PowermateControlProtocol () -{ - set_active (false); -} - -bool -PowermateControlProtocol::probe () -{ - int port = find_powermate( O_RDONLY ); - - if (port < 0) { - if (errno == ENOENT) { - DEBUG_TRACE (DEBUG::ControlProtocols, "Powermate device not found; perhaps you have no powermate connected"); - } else { - DEBUG_TRACE (DEBUG::ControlProtocols, string_compose ("powermate: Opening of powermate failed - %1\n", strerror(errno))); - } - return false; - } - - close (port); - return true; -} - -int -PowermateControlProtocol::set_active (bool inActivate) -{ - if (inActivate != _active) { - - if (inActivate) { - - mPort = find_powermate(O_RDONLY); - - if ( mPort < 0 ) { - return -1; - } - - if (pthread_create_and_store ("Powermate", &mThread, SerialThreadEntry, this) == 0) { - _active = true; - } else { - return -1; - } - - printf("Powermate Control Protocol activated\n"); - - } else { - pthread_cancel (mThread); - close (mPort); - _active = false; - printf("Powermate Control Protocol deactivated\n"); - } - } - - return 0; -} - -XMLNode& -PowermateControlProtocol::get_state () -{ - XMLNode* node = new XMLNode (X_("Protocol")); - node->add_property (X_("name"), _name); - return *node; -} - -int -PowermateControlProtocol::set_state (const XMLNode& /*node*/, int /*version*/) -{ - return 0; -} - - -void* -PowermateControlProtocol::SerialThreadEntry (void* arg) -{ - static_cast(arg)->register_thread ("Powermate"); - return static_cast(arg)->SerialThread (); -} - -#define BUFFER_SIZE 32 - -bool held = false; -bool skippingMarkers = false; - -void -PowermateControlProtocol::ProcessEvent(struct input_event *ev) -{ -#ifdef VERBOSE - fprintf(stderr, "type=0x%04x, code=0x%04x, value=%d\n", - ev->type, ev->code, (int)ev->value); -#endif - - switch(ev->type){ - case EV_MSC: - printf("The LED pulse settings were changed; code=0x%04x, value=0x%08x\n", ev->code, ev->value); - break; - case EV_REL: - if(ev->code != REL_DIAL) - fprintf(stderr, "Warning: unexpected rotation event; ev->code = 0x%04x\n", ev->code); - else{ - if (held) { - //click and hold to skip forward and back by markers - skippingMarkers = true;; - if (ev->value > 0) - next_marker(); - else - prev_marker(); - } else { - //scale the range so that we can go from +/-8x within 180 degrees, with less precision at the higher speeds - float speed = get_transport_speed(); - speed += (float)ev->value * 0.05; - if (speed > 1.5 || speed < -1.5 ) - speed += ev->value; - set_transport_speed( speed ); - } - } - break; - case EV_KEY: - if(ev->code != BTN_0) - fprintf(stderr, "Warning: unexpected key event; ev->code = 0x%04x\n", ev->code); - else - if (ev->value) - held = true; - else { - held = false; - if (skippingMarkers) { - skippingMarkers = false; - } else { - if (get_transport_speed() == 0.0) { - set_transport_speed(1.0); - } else { - set_transport_speed(0.0); - } - } - } - break; - } - - fflush(stdout); -} - -void* -PowermateControlProtocol::SerialThread () -{ - struct input_event ibuffer[BUFFER_SIZE]; - int r, events, i; - - while(1){ - r = read(mPort, ibuffer, sizeof(struct input_event) * BUFFER_SIZE); - if( r > 0 ){ - events = r / sizeof(struct input_event); - for(i=0; i -#include - -#include "control_protocol/control_protocol.h" - -class PowermateControlProtocol : public ARDOUR::ControlProtocol -{ - public: - PowermateControlProtocol (ARDOUR::Session&); - virtual ~PowermateControlProtocol(); - - int set_active (bool yn); - static bool probe (); - - XMLNode& get_state (); - int set_state (const XMLNode&, int version); - - private: - - static void* SerialThreadEntry (void* arg); - void* SerialThread (); - - void ProcessEvent(struct input_event *ev); - - int mPort; - pthread_t mThread; - -}; - - -#endif diff --git a/libs/surfaces/powermate/wscript b/libs/surfaces/powermate/wscript deleted file mode 100644 index fb97607169..0000000000 --- a/libs/surfaces/powermate/wscript +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python -from waflib.extras import autowaf as autowaf -import os - -# Library version (UNIX style major, minor, micro) -# major increment <=> incompatible changes -# minor increment <=> compatible changes (additions) -# micro increment <=> no interface changes -LIBARDOUR_POWERMATE_LIB_VERSION = '4.1.0' - -# Mandatory variables -top = '.' -out = 'build' - -def options(opt): - autowaf.set_options(opt) - -def configure(conf): - autowaf.configure(conf) - -def build(bld): - obj = bld(features = 'cxx cxxshlib') - obj.source = ''' - interface.cc - powermate.cc - ''' - obj.export_includes = ['.'] - obj.cxxflags = '-DPACKAGE="ardour_powermate"' - obj.includes = ['.' ] - obj.name = 'libpowermate' - obj.target = 'powermate' - obj.use = 'libardour libardour_cp' - obj.vnum = LIBARDOUR_POWERMATE_LIB_VERSION - obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3', 'surfaces') - -def shutdown(): - autowaf.shutdown() diff --git a/libs/surfaces/wscript b/libs/surfaces/wscript index 20ad07d60f..3a4b562629 100644 --- a/libs/surfaces/wscript +++ b/libs/surfaces/wscript @@ -25,7 +25,6 @@ children = [ 'generic_midi', 'mackie', 'osc', - 'powermate', 'tranzport', 'wiimote' ] @@ -48,7 +47,6 @@ def configure(conf): #if Options.options.tranzport and conf.is_defined('HAVE_USB'): # conf.define('BUILD_TRANZPORT', 1) - conf.check_cc (header_name='linux/input.h', define_name='BUILD_POWERMATE',mandatory=False) autowaf.check_pkg (conf, 'liblo', mandatory=False, uselib_store="LO", atleast_version="0.24") conf.check_cc (header_name='cwiid.h', define_name='HAVE_CWIID_H',mandatory=False) @@ -68,8 +66,6 @@ def build(bld): bld.recurse('mackie') if bld.is_defined ('HAVE_LO'): bld.recurse('osc') - if bld.is_defined('BUILD_POWERMATE'): - bld.recurse('powermate') if bld.is_defined('BUILD_WIIMOTE'): bld.recurse('wiimote') if bld.is_defined('BUILD_TRANZPORT'): From 5aa8e8598c2a5928b6bcc6be05cec99772164eeb Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Tue, 19 Mar 2013 23:49:50 +0100 Subject: [PATCH 03/27] Delete *.bak files --- .../rec_enabled/rec_enabled.ardour.bak | 158 -- .../rec_enabled/rec_enabled.history.bak | 2 - .../sessions/1region/1region.ardour.bak | 148 -- .../sessions/1region/1region.history.bak | 2 - .../sessions/32tracks/32tracks.ardour.bak | 1716 ----------------- .../sessions/32tracks/32tracks.history.bak | 2 - 6 files changed, 2028 deletions(-) delete mode 100644 libs/ardour/test/data/sessions/rec_enabled/rec_enabled.ardour.bak delete mode 100644 libs/ardour/test/data/sessions/rec_enabled/rec_enabled.history.bak delete mode 100644 libs/ardour/test/profiling/sessions/1region/1region.ardour.bak delete mode 100644 libs/ardour/test/profiling/sessions/1region/1region.history.bak delete mode 100644 libs/ardour/test/profiling/sessions/32tracks/32tracks.ardour.bak delete mode 100644 libs/ardour/test/profiling/sessions/32tracks/32tracks.history.bak diff --git a/libs/ardour/test/data/sessions/rec_enabled/rec_enabled.ardour.bak b/libs/ardour/test/data/sessions/rec_enabled/rec_enabled.ardour.bak deleted file mode 100644 index 106de1153d..0000000000 --- a/libs/ardour/test/data/sessions/rec_enabled/rec_enabled.ardour.bak +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/ardour/test/data/sessions/rec_enabled/rec_enabled.history.bak b/libs/ardour/test/data/sessions/rec_enabled/rec_enabled.history.bak deleted file mode 100644 index 6dd2506a89..0000000000 --- a/libs/ardour/test/data/sessions/rec_enabled/rec_enabled.history.bak +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/libs/ardour/test/profiling/sessions/1region/1region.ardour.bak b/libs/ardour/test/profiling/sessions/1region/1region.ardour.bak deleted file mode 100644 index 4a3e63f351..0000000000 --- a/libs/ardour/test/profiling/sessions/1region/1region.ardour.bak +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/ardour/test/profiling/sessions/1region/1region.history.bak b/libs/ardour/test/profiling/sessions/1region/1region.history.bak deleted file mode 100644 index 6dd2506a89..0000000000 --- a/libs/ardour/test/profiling/sessions/1region/1region.history.bak +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/libs/ardour/test/profiling/sessions/32tracks/32tracks.ardour.bak b/libs/ardour/test/profiling/sessions/32tracks/32tracks.ardour.bak deleted file mode 100644 index 6794c67bc9..0000000000 --- a/libs/ardour/test/profiling/sessions/32tracks/32tracks.ardour.bak +++ /dev/null @@ -1,1716 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/ardour/test/profiling/sessions/32tracks/32tracks.history.bak b/libs/ardour/test/profiling/sessions/32tracks/32tracks.history.bak deleted file mode 100644 index 6dd2506a89..0000000000 --- a/libs/ardour/test/profiling/sessions/32tracks/32tracks.history.bak +++ /dev/null @@ -1,2 +0,0 @@ - - From ef1fb4161af256e4a0047315d999531abb6382eb Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Mon, 22 Apr 2013 20:16:09 +0200 Subject: [PATCH 04/27] Disable obsolete compilation of libs/pds/dmalloc.cc The file relies on -DDEBUG_MALLOC and references #include "/usr/local/src/dmalloc-4.1.2/return.h" It is safe to assume that it's dead code. --- libs/pbd/wscript | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/pbd/wscript b/libs/pbd/wscript index 4d0c09f410..64dd2a332f 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -43,7 +43,6 @@ libpbd_sources = [ 'debug.cc', 'enumwriter.cc', 'event_loop.cc', - 'dmalloc.cc', 'enums.cc', 'epa.cc', 'error.cc', From 13ad68c73c9c162c9fc48daab1d2b05ec27a3786 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Mon, 22 Apr 2013 20:15:46 +0200 Subject: [PATCH 05/27] Drop obsolete dmalloc.cc from libs/pbd. The file relies on -DDEBUG_MALLOC and references i #include "/usr/local/src/dmalloc-4.1.2/return.h" It is safe to assume that it's dead code. --- libs/pbd/dmalloc.cc | 102 -------------------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 libs/pbd/dmalloc.cc diff --git a/libs/pbd/dmalloc.cc b/libs/pbd/dmalloc.cc deleted file mode 100644 index 0e730946c8..0000000000 --- a/libs/pbd/dmalloc.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* - * file that facilitates C++ program debugging. - * - * Copyright 1995 by Gray Watson - * - * This file is part of the dmalloc package. - * - * Permission to use, copy, modify, and distribute this software for any - * NON-COMMERCIAL purpose and without fee is hereby granted, provided - * that the above copyright notice and this permission notice appear - * in all copies, and that the name of Gray Watson not be used in - * advertising or publicity pertaining to distribution of the document - * or software without specific, written prior permission. - * - * Please see the PERMISSIONS file or contact the author for information - * about commercial licenses. - * - * Gray Watson makes no representations about the suitability of the - * software described herein for any purpose. It is provided "as is" - * without express or implied warranty. - * - * The author may be contacted via http://www.letters.com/~gray/ - * - * $Id$ - */ - -/* - * This file is used to effectively redirect new to the more familiar - * malloc and delete to the more familiar free so they can be debugged - * with the debug malloc library.. They also give the known error - * behavior, too. - * - * Compile and link this in with the C++ program you want to debug. - * - * NOTE: I am not a C++ hacker so feedback in the form of other hints - * and ideas for C++ users would be much appreciated. - */ - -#ifdef DEBUG_MALLOC - -extern "C" { -#include -#include -#include "/usr/local/src/dmalloc-4.1.2/return.h" -} - -/* - * An overload function for the C++ new. - */ -void * -operator new(size_t size) -{ - char *file; - GET_RET_ADDR(file); - - /* handle correct C++ semantics for an alloc of size 0 */ - - if (size == 0) size = 1; - - return _malloc_leap(file, 0, size); -} - -/* - * An overload function for the C++ new[]. - */ -void * -operator new[](size_t size) -{ - char *file; - GET_RET_ADDR(file); - - /* handle correct C++ semantics for an alloc of size 0 */ - - if (size == 0) size = 1; - - return _malloc_leap(file, 0, size); -} - -/* - * An overload function for the C++ delete. - */ -void -operator delete(void *pnt) -{ - char *file; - GET_RET_ADDR(file); - _free_leap(file, 0, pnt); -} - -/* - * An overload function for the C++ delete[]. Thanks to Jens Krinke - * - */ -void -operator delete[](void *pnt) -{ - char *file; - GET_RET_ADDR(file); - _free_leap(file, 0, pnt); -} - -#endif From 61153f7b87694b394cde528c50673577df3546a3 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Mon, 22 Apr 2013 20:43:02 +0200 Subject: [PATCH 06/27] Drop obsolete gtk2_ardour/canvas-imageframe.c The code is not referenced in the build system anymore. --- gtk2_ardour/canvas-imageframe.c | 586 -------------------------------- 1 file changed, 586 deletions(-) delete mode 100644 gtk2_ardour/canvas-imageframe.c diff --git a/gtk2_ardour/canvas-imageframe.c b/gtk2_ardour/canvas-imageframe.c deleted file mode 100644 index 3654836c79..0000000000 --- a/gtk2_ardour/canvas-imageframe.c +++ /dev/null @@ -1,586 +0,0 @@ -/* Image item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is - * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena - */ - - -#include /* for memcpy() */ -#include -#include -#include "libart_lgpl/art_misc.h" -#include "libart_lgpl/art_affine.h" -#include "libart_lgpl/art_pixbuf.h" -#include "libart_lgpl/art_rgb_pixbuf_affine.h" -#include "canvas-imageframe.h" -#include -#include "gettext.h" -#define _(Text) dgettext (PACKAGE,Text) - -//GTK2FIX -//#include - - -enum { - PROP_0, - PROP_PIXBUF, - PROP_X, - PROP_Y, - PROP_WIDTH, - PROP_HEIGHT, - PROP_DRAWWIDTH, - PROP_ANCHOR -}; - - -static void gnome_canvas_imageframe_class_init(GnomeCanvasImageFrameClass* class) ; -static void gnome_canvas_imageframe_init(GnomeCanvasImageFrame* image) ; -static void gnome_canvas_imageframe_destroy(GtkObject* object) ; -static void gnome_canvas_imageframe_set_property(GObject* object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void gnome_canvas_imageframe_get_property(GObject* object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void gnome_canvas_imageframe_update(GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) ; -static void gnome_canvas_imageframe_realize(GnomeCanvasItem *item) ; -static void gnome_canvas_imageframe_unrealize(GnomeCanvasItem *item) ; -static void gnome_canvas_imageframe_draw(GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) ; -static double gnome_canvas_imageframe_point(GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item) ; -static void gnome_canvas_imageframe_bounds(GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) ; -static void gnome_canvas_imageframe_render(GnomeCanvasItem *item, GnomeCanvasBuf *buf) ; - -static GnomeCanvasItemClass *parent_class; - - -GType -gnome_canvas_imageframe_get_type (void) -{ - static GType imageframe_type = 0; - - if (!imageframe_type) { - GtkTypeInfo imageframe_info = { - "GnomeCanvasImageFrame", - sizeof (GnomeCanvasImageFrame), - sizeof (GnomeCanvasImageFrameClass), - (GtkClassInitFunc) gnome_canvas_imageframe_class_init, - (GtkObjectInitFunc) gnome_canvas_imageframe_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - imageframe_type = gtk_type_unique (gnome_canvas_item_get_type (), &imageframe_info); - } - - return imageframe_type; -} - -static void -gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class) -{ - GObjectClass *gobject_class; - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - gobject_class = (GObjectClass *) class; - object_class = (GtkObjectClass *) class; - item_class = (GnomeCanvasItemClass *) class; - - parent_class = gtk_type_class (gnome_canvas_item_get_type ()); - - gobject_class->set_property = gnome_canvas_imageframe_set_property; - gobject_class->get_property = gnome_canvas_imageframe_get_property; - - g_object_class_install_property (gobject_class, - PROP_PIXBUF, - g_param_spec_pointer ("pixbuf", - _("pixbuf"), - _("the pixbuf"), - G_PARAM_WRITABLE)); - g_object_class_install_property (gobject_class, - PROP_X, - g_param_spec_double ("x", - _("x"), - _("x coordinate of upper left corner of rect"), - -G_MAXDOUBLE, - G_MAXDOUBLE, - 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, - PROP_Y, - g_param_spec_double ("y", - _("y"), - _("y coordinate of upper left corner of rect "), - -G_MAXDOUBLE, - G_MAXDOUBLE, - 0.0, - G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, - PROP_WIDTH, - g_param_spec_double ("width", - _("width"), - _("the width"), - -G_MAXDOUBLE, - G_MAXDOUBLE, - 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, - PROP_DRAWWIDTH, - g_param_spec_double ("drawwidth", - _("drawwidth"), - _("drawn width"), - -G_MAXDOUBLE, - G_MAXDOUBLE, - 0.0, - G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, - PROP_HEIGHT, - g_param_spec_double ("height", - _("height"), - _("the height"), - -G_MAXDOUBLE, - G_MAXDOUBLE, - 0.0, - G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, - PROP_ANCHOR, - g_param_spec_enum ("anchor", - _("anchor"), - _("the anchor"), - GTK_TYPE_ANCHOR_TYPE, - GTK_ANCHOR_NW, - G_PARAM_READWRITE)); - - object_class->destroy = gnome_canvas_imageframe_destroy; - - item_class->update = gnome_canvas_imageframe_update; - item_class->realize = gnome_canvas_imageframe_realize; - item_class->unrealize = gnome_canvas_imageframe_unrealize; - item_class->draw = gnome_canvas_imageframe_draw; - item_class->point = gnome_canvas_imageframe_point; - item_class->bounds = gnome_canvas_imageframe_bounds; - item_class->render = gnome_canvas_imageframe_render; -} - -static void -gnome_canvas_imageframe_init (GnomeCanvasImageFrame *image) -{ - image->x = 0.0; - image->y = 0.0; - image->width = 0.0; - image->height = 0.0; - image->drawwidth = 0.0; - image->anchor = GTK_ANCHOR_CENTER; -} - -static void -gnome_canvas_imageframe_destroy (GtkObject *object) -{ - GnomeCanvasImageFrame *image; - - g_return_if_fail (object != NULL); - g_return_if_fail (GNOME_CANVAS_IS_CANVAS_IMAGEFRAME (object)); - - image = GNOME_CANVAS_IMAGEFRAME (object); - - image->cwidth = 0; - image->cheight = 0; - - if (image->pixbuf) - { - art_pixbuf_free (image->pixbuf); - image->pixbuf = NULL; - } - - if(GTK_OBJECT_CLASS (parent_class)->destroy) - { - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); - } -} - -/* Get's the image bounds expressed as item-relative coordinates. */ -static void -get_bounds_item_relative (GnomeCanvasImageFrame *image, double *px1, double *py1, double *px2, double *py2) -{ - GnomeCanvasItem *item; - double x, y; - - item = GNOME_CANVAS_ITEM (image); - - /* Get item coordinates */ - - x = image->x; - y = image->y; - - /* Anchor image */ - - switch (image->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_W: - case GTK_ANCHOR_SW: - break; - - case GTK_ANCHOR_N: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_S: - x -= image->width / 2; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - x -= image->width; - break; - } - - switch (image->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_N: - case GTK_ANCHOR_NE: - break; - - case GTK_ANCHOR_W: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_E: - y -= image->height / 2; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - y -= image->height; - break; - } - - /* Bounds */ - - *px1 = x; - *py1 = y; - *px2 = x + image->width; - *py2 = y + image->height; -} - -static void -gnome_canvas_imageframe_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GnomeCanvasItem *item; - GnomeCanvasImageFrame *image; - int update; - int calc_bounds; - - item = GNOME_CANVAS_ITEM (object); - image = GNOME_CANVAS_IMAGEFRAME (object); - - update = FALSE; - calc_bounds = FALSE; - - switch (prop_id) { - case PROP_PIXBUF: - if (item->canvas->aa && g_value_get_pointer (value)) { - if (image->pixbuf != NULL) - art_pixbuf_free (image->pixbuf); - image->pixbuf = g_value_get_pointer (value); - } - update = TRUE; - break; - - case PROP_X: - image->x = g_value_get_double (value); - update = TRUE; - break; - - case PROP_Y: - image->y = g_value_get_double (value); - update = TRUE; - break; - - case PROP_WIDTH: - image->width = fabs (g_value_get_double (value)); - update = TRUE; - break; - - case PROP_HEIGHT: - image->height = fabs (g_value_get_double (value)); - update = TRUE; - break; - - case PROP_DRAWWIDTH: - image->drawwidth = fabs (g_value_get_double (value)); - update = TRUE; - break; - - case PROP_ANCHOR: - image->anchor = g_value_get_enum (value); - update = TRUE; - break; - - default: - break; - } - - if (update) - gnome_canvas_item_request_update (item); -} - -static void -gnome_canvas_imageframe_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GnomeCanvasImageFrame *image; - - image = GNOME_CANVAS_IMAGEFRAME (object); - - switch (prop_id) { - - case PROP_X: - g_value_set_double (value, image->x); - break; - - case PROP_Y: - g_value_set_double (value, image->y); - break; - - case PROP_WIDTH: - g_value_set_double (value, image->width); - break; - - case PROP_HEIGHT: - g_value_set_double (value, image->height); - break; - - case PROP_DRAWWIDTH: - g_value_set_double (value, image->drawwidth); - break; - - case PROP_ANCHOR: - g_value_set_enum (value, image->anchor); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gnome_canvas_imageframe_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - GnomeCanvasImageFrame *image; - ArtDRect i_bbox, c_bbox; - int w = 0; - int h = 0; - - image = GNOME_CANVAS_IMAGEFRAME (item); - - if (parent_class->update) - (* parent_class->update) (item, affine, clip_path, flags); - - /* only works for non-rotated, non-skewed transforms */ - image->cwidth = (int) (image->width * affine[0] + 0.5); - image->cheight = (int) (image->height * affine[3] + 0.5); - - if (image->pixbuf) { - image->need_recalc = TRUE ; - } - - get_bounds_item_relative (image, &i_bbox.x0, &i_bbox.y0, &i_bbox.x1, &i_bbox.y1); - art_drect_affine_transform (&c_bbox, &i_bbox, affine); - - /* these values only make sense in the non-rotated, non-skewed case */ - image->cx = c_bbox.x0; - image->cy = c_bbox.y0; - - /* add a fudge factor */ - c_bbox.x0--; - c_bbox.y0--; - c_bbox.x1++; - c_bbox.y1++; - - gnome_canvas_update_bbox (item, c_bbox.x0, c_bbox.y0, c_bbox.x1, c_bbox.y1); - - if (image->pixbuf) { - w = image->pixbuf->width; - h = image->pixbuf->height; - } - - image->affine[0] = (affine[0] * image->width) / w; - image->affine[1] = (affine[1] * image->height) / h; - image->affine[2] = (affine[2] * image->width) / w; - image->affine[3] = (affine[3] * image->height) / h; - image->affine[4] = i_bbox.x0 * affine[0] + i_bbox.y0 * affine[2] + affine[4]; - image->affine[5] = i_bbox.x0 * affine[1] + i_bbox.y0 * affine[3] + affine[5]; -} - -static void -gnome_canvas_imageframe_realize (GnomeCanvasItem *item) -{ - GnomeCanvasImageFrame *image; - - image = GNOME_CANVAS_IMAGEFRAME (item); - - if (parent_class->realize) - (* parent_class->realize) (item); - -} - -static void -gnome_canvas_imageframe_unrealize (GnomeCanvasItem *item) -{ - GnomeCanvasImageFrame *image; - - image = GNOME_CANVAS_IMAGEFRAME(item); - - if (parent_class->unrealize) - (* parent_class->unrealize) (item); -} - -static void -recalc_if_needed (GnomeCanvasImageFrame *image) -{} - -static void -gnome_canvas_imageframe_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ -} - -static double -gnome_canvas_imageframe_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) -{ - GnomeCanvasImageFrame *image; - int x1, y1, x2, y2; - int dx, dy; - - image = GNOME_CANVAS_IMAGEFRAME (item); - - *actual_item = item; - - recalc_if_needed (image); - - x1 = image->cx - item->canvas->close_enough; - y1 = image->cy - item->canvas->close_enough; - x2 = image->cx + image->cwidth - 1 + item->canvas->close_enough; - y2 = image->cy + image->cheight - 1 + item->canvas->close_enough; - - /* Hard case: is point inside image's gravity region? */ - - //if ((cx >= x1) && (cy >= y1) && (cx <= x2) && (cy <= y2)) - //return dist_to_mask (image, cx, cy) / item->canvas->pixels_per_unit; - - /* Point is outside image */ - - x1 += item->canvas->close_enough; - y1 += item->canvas->close_enough; - x2 -= item->canvas->close_enough; - y2 -= item->canvas->close_enough; - - if (cx < x1) - dx = x1 - cx; - else if (cx > x2) - dx = cx - x2; - else - dx = 0; - - if (cy < y1) - dy = y1 - cy; - else if (cy > y2) - dy = cy - y2; - else - dy = 0; - - return sqrt (dx * dx + dy * dy) / item->canvas->pixels_per_unit; -} - -static void -gnome_canvas_imageframe_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) -{ - GnomeCanvasImageFrame *image; - - image = GNOME_CANVAS_IMAGEFRAME (item); - - *x1 = image->x; - *y1 = image->y; - - switch (image->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_W: - case GTK_ANCHOR_SW: - break; - - case GTK_ANCHOR_N: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_S: - *x1 -= image->width / 2.0; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - *x1 -= image->width; - break; - } - - switch (image->anchor) { - case GTK_ANCHOR_NW: - case GTK_ANCHOR_N: - case GTK_ANCHOR_NE: - break; - - case GTK_ANCHOR_W: - case GTK_ANCHOR_CENTER: - case GTK_ANCHOR_E: - *y1 -= image->height / 2.0; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - *y1 -= image->height; - break; - } - - *x2 = *x1 + image->width; - *y2 = *y1 + image->height; -} - -static void -gnome_canvas_imageframe_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) -{ - GnomeCanvasImageFrame *image; - - image = GNOME_CANVAS_IMAGEFRAME (item); - - gnome_canvas_buf_ensure_buf (buf); - -#ifdef VERBOSE - { - char str[128]; - art_affine_to_string (str, image->affine); - g_print ("gnome_canvas_imageframe_render %s\n", str); - } -#endif - - art_rgb_pixbuf_affine (buf->buf, - buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1, - buf->buf_rowstride, - image->pixbuf, - image->affine, - ART_FILTER_NEAREST, NULL); - - buf->is_bg = 0; -} From 7ca29e7c7572a0a367b12ee39ea70a88388d0372 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Mon, 22 Apr 2013 20:47:52 +0200 Subject: [PATCH 07/27] Add proper GPL license to gtk2_ardour/canvas-imageframe.h Since the file has been part of libgnomecanvas, it is GPL, too. --- gtk2_ardour/canvas-imageframe.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gtk2_ardour/canvas-imageframe.h b/gtk2_ardour/canvas-imageframe.h index 8cfb6e273a..63775dbe3c 100644 --- a/gtk2_ardour/canvas-imageframe.h +++ b/gtk2_ardour/canvas-imageframe.h @@ -4,8 +4,25 @@ * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties. * * Copyright (C) 1998 The Free Software Foundation + * All rights reserved. * * Author: Federico Mena + * + * + * The Gnome 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. + * + * The Gnome 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 the Gnome Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. */ From e2d8f25d0c43ff416937640f09fcad2c07787265 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Mon, 22 Apr 2013 20:48:40 +0200 Subject: [PATCH 08/27] Merge important bits from canvas-image.h into imageframe.h --- gtk2_ardour/imageframe.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/imageframe.h b/gtk2_ardour/imageframe.h index 466d0804f5..a752cdbce0 100644 --- a/gtk2_ardour/imageframe.h +++ b/gtk2_ardour/imageframe.h @@ -27,10 +27,23 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include #include #include -#include "canvas-imageframe.h" + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +#include +#ifdef __cplusplus +} +#endif + +#include #ifndef DOXYGEN_SHOULD_SKIP_THIS From 7d8ada01d201dbd7c042678986c910e68d87f705 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Mon, 22 Apr 2013 20:48:25 +0200 Subject: [PATCH 09/27] Drop obsolete file canvas-imageframe.h --- gtk2_ardour/canvas-imageframe.h | 104 -------------------------------- 1 file changed, 104 deletions(-) delete mode 100644 gtk2_ardour/canvas-imageframe.h diff --git a/gtk2_ardour/canvas-imageframe.h b/gtk2_ardour/canvas-imageframe.h deleted file mode 100644 index 63775dbe3c..0000000000 --- a/gtk2_ardour/canvas-imageframe.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Image item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is - * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * All rights reserved. - * - * Author: Federico Mena - * - * - * The Gnome 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. - * - * The Gnome 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 the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GNOME_CANVAS_IMAGEFRAME_H__ -#define __GNOME_CANVAS_IMAGEFRAME_H__ - -#include - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -#include -#ifdef __cplusplus -} -#endif - -#include - - -G_BEGIN_DECLS - - -/* Image item for the canvas. Images are positioned by anchoring them to a point. - * The following arguments are available: - * - * name type read/write description - * ------------------------------------------------------------------------------------------ - * pixbuf ArtPixBuf* W Pointer to an ArtPixBuf (aa-mode) - * x double RW X coordinate of anchor point - * y double RW Y coordinate of anchor point - * width double RW Width to scale image to, in canvas units - * height double RW Height to scale image to, in canvas units - * drawwidth double RW Width to scale image to, in canvas units - * anchor GtkAnchorType RW Anchor side for the image - */ - - -#define GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME (gnome_canvas_imageframe_get_type ()) -#define GNOME_CANVAS_IMAGEFRAME(obj) (GTK_CHECK_CAST ((obj), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME, GnomeCanvasImageFrame)) -#define GNOME_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME, GnomeCanvasImageFrameClass)) -#define GNOME_CANVAS_IS_CANVAS_IMAGEFRAME(obj) (GTK_CHECK_TYPE ((obj), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME)) -#define GNOME_CANVAS_IS_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME)) - - -typedef struct _GnomeCanvasImageFrame GnomeCanvasImageFrame; -typedef struct _GnomeCanvasImageFrameClass GnomeCanvasImageFrameClass; - -struct _GnomeCanvasImageFrame { - GnomeCanvasItem item; - - double x, y; /* Position at anchor, item relative */ - double width, height; /* Size of image, item relative */ - double drawwidth ; /* the amount of the image we draw width-wise (0-drawwidth)*/ - GtkAnchorType anchor; /* Anchor side for image */ - - int cx, cy; /* Top-left canvas coordinates for display */ - int cwidth, cheight; /* Rendered size in pixels */ - - uint32_t need_recalc : 1; /* Do we need to rescale the image? */ - - ArtPixBuf *pixbuf; /* A pixbuf, for aa rendering */ - double affine[6]; /* The item -> canvas affine */ -}; - -struct _GnomeCanvasImageFrameClass { - GnomeCanvasItemClass parent_class; -}; - - -/* Standard Gtk function */ -GtkType gnome_canvas_imageframe_get_type (void); - - -G_END_DECLS - -#endif From 5e2e8e2cae0f807ba071d564d3a74086933afca1 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Mon, 22 Apr 2013 20:50:21 +0200 Subject: [PATCH 10/27] Drop obsolete file gtk2_ardour/imageframe.cc --- gtk2_ardour/imageframe.cc | 190 -------------------------------------- 1 file changed, 190 deletions(-) delete mode 100644 gtk2_ardour/imageframe.cc diff --git a/gtk2_ardour/imageframe.cc b/gtk2_ardour/imageframe.cc deleted file mode 100644 index ac30511864..0000000000 --- a/gtk2_ardour/imageframe.cc +++ /dev/null @@ -1,190 +0,0 @@ -// Generated by gtkmmproc -- DO NOT MODIFY! - -#include "imageframe.h" -#include "imageframe_p.h" -#include - - -/* rect.c - * - * Copyright (C) 1998 EMC Capital Management Inc. - * Developed by Havoc Pennington - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -namespace Gnome -{ - -namespace Canvas -{ - -ImageFrame::ImageFrame(Group& parentx, ArtPixBuf* pbuf, double x, double y, Gtk::AnchorType anchor, double w, double h) -: Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0))) -{ - item_construct(parentx); - set("pixbuf", pbuf, "x", x,"y", y,"width", w,"height", h, 0); -} - -ImageFrame::ImageFrame(Group& parentx) -: Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0))) -{ - item_construct(parentx); -} - -} /* namespace Canvas */ -} /* namespace Gnome */ - - -namespace -{ -} // anonymous namespace - - -namespace Glib -{ - -Gnome::Canvas::ImageFrame* wrap(GnomeCanvasImageFrame* object, bool take_copy) -{ - return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); -} - -} /* namespace Glib */ - -namespace Gnome -{ - -namespace Canvas -{ - - -/* The *_Class implementation: */ - -const Glib::Class& ImageFrame_Class::init() -{ - if(!gtype_) // create the GType if necessary - { - // Glib::Class has to know the class init function to clone custom types. - class_init_func_ = &ImageFrame_Class::class_init_function; - - // This is actually just optimized away, apparently with no harm. - // Make sure that the parent type has been created. - //CppClassParent::CppObjectType::get_type(); - - // Create the wrapper type, with the same class/instance size as the base type. - register_derived_type(gnome_canvas_imageframe_get_type()); - - // Add derived versions of interfaces, if the C type implements any interfaces: - } - - return *this; -} - -void ImageFrame_Class::class_init_function(void* g_class, void* class_data) -{ - BaseClassType *const klass = static_cast(g_class); - CppClassParent::class_init_function(klass, class_data); - -} - -Glib::ObjectBase* ImageFrame_Class::wrap_new(GObject* o) -{ - return manage(new ImageFrame((GnomeCanvasImageFrame*)(o))); - -} - -/* The implementation: */ - -ImageFrame::ImageFrame(const Glib::ConstructParams& construct_params) -: Item(construct_params) -{ - } - -ImageFrame::ImageFrame(GnomeCanvasImageFrame* castitem) -: Item ((GnomeCanvasItem*)(castitem)) -{ -} - -ImageFrame::~ImageFrame() -{ - destroy_(); -} - -ImageFrame::CppClassType ImageFrame::rect_class_; // initialize static member - -GType ImageFrame::get_type() -{ - return rect_class_.init().get_type(); -} - -GType ImageFrame::get_base_type() -{ - return gnome_canvas_imageframe_get_type(); -} - -Glib::PropertyProxy ImageFrame::property_x() -{ - return Glib::PropertyProxy (this, "x"); -} -Glib::PropertyProxy_ReadOnly ImageFrame::property_x() const -{ - return Glib::PropertyProxy_ReadOnly (this, "x"); -} -Glib::PropertyProxy ImageFrame::property_y() -{ - return Glib::PropertyProxy (this, "y"); -} -Glib::PropertyProxy_ReadOnly ImageFrame::property_y() const -{ - return Glib::PropertyProxy_ReadOnly (this, "y"); -} -Glib::PropertyProxy ImageFrame::property_width() -{ - return Glib::PropertyProxy (this, "width"); -} -Glib::PropertyProxy_ReadOnly ImageFrame::property_width() const -{ - return Glib::PropertyProxy_ReadOnly (this, "width"); -} -Glib::PropertyProxy ImageFrame::property_drawwidth() -{ - return Glib::PropertyProxy (this, "drawwidth"); -} -Glib::PropertyProxy_ReadOnly ImageFrame::property_drawwidth() const -{ - return Glib::PropertyProxy_ReadOnly (this, "drawwidth"); -} -Glib::PropertyProxy ImageFrame::property_height() -{ - return Glib::PropertyProxy (this, "height"); -} -Glib::PropertyProxy_ReadOnly ImageFrame::property_height() const -{ - return Glib::PropertyProxy_ReadOnly (this, "height"); -} -Glib::PropertyProxy ImageFrame::property_anchor() -{ - return Glib::PropertyProxy(this, "anchor"); -} -Glib::PropertyProxy_ReadOnly ImageFrame::property_anchor() const -{ - return Glib::PropertyProxy_ReadOnly(this, "anchor"); -} - - - -} // namespace Canvas - -} // namespace Gnome From 63b02a265a6d5e821198b5e3fcc1f6ba6d83a129 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 28 Apr 2013 20:31:25 -0400 Subject: [PATCH 11/27] Revert "fix LXVST support for plugins that make audioMaster callbacks from within effOpen (e.g. glitch)" This patch broke just about all other LVXST plugins. Glitch is doing something wrong, or there is more magic about VST that we have yet to understand. This reverts commit 56bc98f78bd3b1e5ba5c6ce902b2805d40a6cc53. --- libs/ardour/ardour/vst_plugin.h | 1 - libs/ardour/linux_vst_support.cc | 29 ++++++++++------------------- libs/ardour/lxvst_plugin.cc | 4 ++-- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index d9cfd87bad..7ca973cbb7 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -73,7 +73,6 @@ public: AEffect * plugin () const { return _plugin; } VSTState * state () const { return _state; } - void set_state (VSTState* s) { _state = s; } int set_state (XMLNode const &, int); diff --git a/libs/ardour/linux_vst_support.cc b/libs/ardour/linux_vst_support.cc index 9106d69009..99251f08e4 100644 --- a/libs/ardour/linux_vst_support.cc +++ b/libs/ardour/linux_vst_support.cc @@ -34,8 +34,6 @@ #include #include "ardour/linux_vst_support.h" -#include "ardour/vst_plugin.h" - #include "pbd/basename.h" #include "pbd/error.h" @@ -295,43 +293,36 @@ vstfx_unload (VSTHandle* fhandle) return 0; } -/** - Instantiates a VST plugin and also set _state of its plugin argument - */ +/*This instantiates a plugin*/ -VSTState* -vstfx_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void *ptr) +VSTState * +vstfx_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr) { VSTState* vstfx = vstfx_new (); - ARDOUR::VSTPlugin* plugin = reinterpret_cast (ptr); - if (fhandle == 0) { + if(fhandle == 0) + { vstfx_error( "** ERROR ** VSTFX : The handle was 0\n" ); return 0; } - if ((vstfx->plugin = fhandle->main_entry (amc)) == 0) { + if ((vstfx->plugin = fhandle->main_entry (amc)) == 0) + { vstfx_error ("** ERROR ** VSTFX : %s could not be instantiated :(\n", fhandle->name); free (vstfx); return 0; } vstfx->handle = fhandle; - vstfx->plugin->user = plugin; + vstfx->plugin->user = userptr; - if (vstfx->plugin->magic != kEffectMagic) { + if (vstfx->plugin->magic != kEffectMagic) + { vstfx_error ("** ERROR ** VSTFX : %s is not a VST plugin\n", fhandle->name); free (vstfx); return 0; } - - /* need to set this here because some plugins make audioMaster - * callbacks from within effOpen, and _state must be set for - * that to work. - */ - plugin->set_state (vstfx); - vstfx->plugin->dispatcher (vstfx->plugin, effOpen, 0, 0, 0, 0); /*May or May not need to 'switch the plugin on' here - unlikely diff --git a/libs/ardour/lxvst_plugin.cc b/libs/ardour/lxvst_plugin.cc index 80e6b9c286..6e30e0c443 100755 --- a/libs/ardour/lxvst_plugin.cc +++ b/libs/ardour/lxvst_plugin.cc @@ -32,7 +32,7 @@ LXVSTPlugin::LXVSTPlugin (AudioEngine& e, Session& session, VSTHandle* h) { /* Instantiate the plugin and return a VSTState* */ - if (vstfx_instantiate (_handle, Session::vst_callback, this) == 0) { + if ((_state = vstfx_instantiate (_handle, Session::vst_callback, this)) == 0) { throw failed_constructor(); } @@ -44,7 +44,7 @@ LXVSTPlugin::LXVSTPlugin (const LXVSTPlugin &other) { _handle = other._handle; - if (vstfx_instantiate (_handle, Session::vst_callback, this) == 0) { + if ((_state = vstfx_instantiate (_handle, Session::vst_callback, this)) == 0) { throw failed_constructor(); } _plugin = _state->plugin; From 03310a587c1157d2287c43f9f2aea97263606880 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 30 Apr 2013 03:28:11 +0200 Subject: [PATCH 12/27] zero/reset closed file-descriptors should fix issues with LinuxDSP plugins (X11 thread) & xjadeo --- gtk2_ardour/system_exec.cc | 51 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/gtk2_ardour/system_exec.cc b/gtk2_ardour/system_exec.cc index 1f178a6c68..566c87dfbb 100644 --- a/gtk2_ardour/system_exec.cc +++ b/gtk2_ardour/system_exec.cc @@ -38,6 +38,8 @@ using namespace std; void * interposer_thread (void *arg); +static void close_fd (int* fd) { if (!fd) return; if (*fd >= 0) ::close (*fd); *fd = -1; } + SystemExec::SystemExec (std::string c, std::string a) : cmd(c) { @@ -483,18 +485,18 @@ SystemExec::start (int stderr_mode) pid=r; /* check if execve was successful. */ - ::close(pok[1]); + close_fd(&pok[1]); char buf; for ( ;; ) { ssize_t n = ::read(pok[0], &buf, 1 ); if ( n==1 ) { /* child process returned from execve */ pid=0; - ::close(pok[0]); - ::close(pin[1]); - ::close(pin[0]); - ::close(pout[1]); - ::close(pout[0]); + close_fd(&pok[0]); + close_fd(&pin[1]); + close_fd(&pin[0]); + close_fd(&pout[1]); + close_fd(&pout[0]); pin[1] = -1; return -3; } else if ( n==-1 ) { @@ -503,7 +505,7 @@ SystemExec::start (int stderr_mode) } break; } - ::close(pok[0]); + close_fd(&pok[0]); /* child started successfully */ #if 0 @@ -519,17 +521,17 @@ SystemExec::start (int stderr_mode) } if (r == 0) { /* 2nd child process - catch stdout */ - ::close(pin[1]); - ::close(pout[1]); + close_fd(&pin[1]); + close_fd(&pout[1]); output_interposer(); exit(0); } - ::close(pout[1]); - ::close(pin[0]); - ::close(pout[0]); + close_fd(&pout[1]); + close_fd(&pin[0]); + close_fd(&pout[0]); #else /* use pthread */ - ::close(pout[1]); - ::close(pin[0]); + close_fd(&pout[1]); + close_fd(&pin[0]); int rv = pthread_create(&thread_id_tt, NULL, interposer_thread, this); thread_active=true; @@ -543,15 +545,15 @@ SystemExec::start (int stderr_mode) } /* child process - exec external process */ - ::close(pok[0]); + close_fd(&pok[0]); ::fcntl(pok[1], F_SETFD, FD_CLOEXEC); - ::close(pin[1]); + close_fd(&pin[1]); if (pin[0] != STDIN_FILENO) { ::dup2(pin[0], STDIN_FILENO); } - ::close(pin[0]); - ::close(pout[0]); + close_fd(&pin[0]); + close_fd(&pout[0]); if (pout[1] != STDOUT_FILENO) { ::dup2(pout[1], STDOUT_FILENO); } @@ -569,7 +571,7 @@ SystemExec::start (int stderr_mode) } if (pout[1] != STDOUT_FILENO && pout[1] != STDERR_FILENO) { - ::close(pout[1]); + close_fd(&pout[1]); } if (nicelevel !=0) { @@ -596,7 +598,7 @@ SystemExec::start (int stderr_mode) /* if we reach here something went wrong.. */ char buf = 0; (void) ::write(pok[1], &buf, 1 ); - (void) ::close(pok[1]); + close_fd(&pok[1]); exit(-1); return -1; } @@ -631,11 +633,10 @@ void SystemExec::close_stdin() { if (pin[1]<0) return; - ::close(pin[0]); - ::close(pin[1]); - ::close(pout[0]); - ::close(pout[1]); - pin[1] = - 1; // mark as closed + close_fd(&pin[0]); + close_fd(&pin[1]); + close_fd(&pout[0]); + close_fd(&pout[1]); } int From c40accda42bd470b7083fba6fcbba0fe68e96bb6 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 30 Apr 2013 11:12:27 -0400 Subject: [PATCH 13/27] don't print stacktraces to the supplied ostream AND cerr - a remnant from debugging wierd problems with stacktrace() on paul's system --- libs/pbd/stacktrace.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/pbd/stacktrace.cc b/libs/pbd/stacktrace.cc index ca614509a5..805b9a2e84 100644 --- a/libs/pbd/stacktrace.cc +++ b/libs/pbd/stacktrace.cc @@ -85,7 +85,6 @@ PBD::stacktrace (std::ostream& out, int levels) for (i = 0; i < size && (levels == 0 || i < size_t(levels)); i++) { out << " " << demangle (strings[i]) << std::endl; - std::cerr << " " << demangle (strings[i]) << std::endl; } free (strings); From 07a5372eea6b70dd9f3224aa3aead904e2eef72c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 30 Apr 2013 11:14:06 -0400 Subject: [PATCH 14/27] fixups for building on OS X where apple define silly macros --- gtk2_ardour/automation_controller.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gtk2_ardour/automation_controller.h b/gtk2_ardour/automation_controller.h index 88e6d87e01..29635c8488 100644 --- a/gtk2_ardour/automation_controller.h +++ b/gtk2_ardour/automation_controller.h @@ -21,6 +21,13 @@ #ifndef __ardour_gtk_automation_controller_h__ #define __ardour_gtk_automation_controller_h__ +#ifdef YES +#undef YES +#endif +#ifdef NO +#undef NO +#endif + #include #include From d54a35a6718e4791ef57d0ad86dc2f41a1ec46a2 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 30 Apr 2013 11:15:23 -0400 Subject: [PATCH 15/27] cleanup AU GUI support, which was broken because prefheight and prefwidth were left unset after a cleanup attempt some months ago. add a few more tweaks based on current 2.x code and some tricks found elsewhere that dont' change behaviour but are just better --- gtk2_ardour/au_pluginui.h | 2 +- gtk2_ardour/au_pluginui.mm | 35 +++++++++++++++++++++-------------- gtk2_ardour/plugin_ui.cc | 10 ++++++++++ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index 6f90480457..cbf83d5d92 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -93,7 +93,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox int prefwidth; Gtk::HBox top_box; - Gtk::EventBox low_box; + Gtk::HBox low_box; Gtk::VBox vpacker; Gtk::Label automation_mode_label; Gtk::ComboBoxText automation_mode_selector; diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm index f394e305c8..16d4e7e6fc 100644 --- a/gtk2_ardour/au_pluginui.mm +++ b/gtk2_ardour/au_pluginui.mm @@ -1,5 +1,3 @@ -#include - #undef Marker #define Marker FuckYouAppleAndYourLackOfNameSpaces @@ -170,13 +168,16 @@ AUPluginUI::AUPluginUI (boost::shared_ptr insert) top_box.show (); low_box.show (); - _activating_from_app = false; cocoa_parent = 0; - _notify = 0; cocoa_window = 0; - carbon_window = 0; + +#ifdef WITH_CARBBON + _activating_from_app = false; + _notify = 0; au_view = 0; editView = 0; + carbon_window = 0; +#endif /* prefer cocoa, fall back to cocoa, but use carbon if its there */ @@ -227,6 +228,7 @@ AUPluginUI::~AUPluginUI () bool AUPluginUI::test_carbon_view_support () { +#ifdef WITH_CARBON bool ret = false; carbon_descriptor.componentType = kAudioUnitCarbonViewComponentType; @@ -253,6 +255,9 @@ AUPluginUI::test_carbon_view_support () } return ret; +#else + return false; +#endif } bool @@ -282,7 +287,7 @@ AUPluginUI::plugin_class_valid (Class pluginClass) int AUPluginUI::create_cocoa_view () { - BOOL wasAbleToLoadCustomView = NO; + bool wasAbleToLoadCustomView = false; AudioUnitCocoaViewInfo* cocoaViewInfo = NULL; UInt32 numberOfClasses = 0; UInt32 dataSize; @@ -380,7 +385,7 @@ AUPluginUI::create_cocoa_view () free (cocoaViewInfo); } - wasAbleToLoadCustomView = YES; + wasAbleToLoadCustomView = true; } } @@ -390,14 +395,16 @@ AUPluginUI::create_cocoa_view () au->get_au())); au_view = [[AUGenericView alloc] initWithAudioUnit:*au->get_au()]; DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("view created @ %1\n", au_view)); - [(AUGenericView *)au_view setShowsExpertParameters:YES]; + [(AUGenericView *)au_view setShowsExpertParameters:1]; } // Get the initial size of the new AU View's frame NSRect rect = [au_view frame]; + prefheight = rect.size.height; + prefwidth = rect.size.width; low_box.set_size_request (rect.size.width, rect.size.height); - + return 0; } @@ -409,7 +416,7 @@ AUPluginUI::cocoa_view_resized () NSSize oldContentSize= [window contentRectForFrameRect:[window frame]].size; NSSize newContentSize= [au_view frame].size; NSRect windowFrame= [window frame]; - + oldContentSize.height -= topsize.height; float dy = oldContentSize.height - newContentSize.height; @@ -427,7 +434,7 @@ AUPluginUI::cocoa_view_resized () NSUInteger old_auto_resize = [au_view autoresizingMask]; [au_view setAutoresizingMask:NSViewNotSizable]; - [window setFrame:windowFrame display:YES]; + [window setFrame:windowFrame display:1]; [au_view setAutoresizingMask:old_auto_resize]; [[NSNotificationCenter defaultCenter] addObserver:_notify @@ -603,7 +610,7 @@ AUPluginUI::parent_cocoa_window () return -1; } - [win setAutodisplay:YES]; // turn of GTK stuff for this window + [win setAutodisplay:1]; // turn of GTK stuff for this window Gtk::Container* toplevel = get_toplevel(); @@ -620,7 +627,7 @@ AUPluginUI::parent_cocoa_window () NSPoint origin = { 0, a.height }; [au_view setFrameOrigin:origin]; - [view addSubview:au_view positioned:NSWindowBelow relativeTo:nil]; + [view addSubview:au_view positioned:NSWindowBelow relativeTo:nil]; // watch for size changes of the view @@ -681,7 +688,7 @@ AUPluginUI::on_realize () NSWindow* win = get_nswindow (); if (win) { - [win setShowsResizeIndicator:NO]; + [win setShowsResizeIndicator:0]; } } diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index 2dd8741a13..5b281f33ab 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -226,6 +226,12 @@ PluginUIWindow::on_show () } if (_pluginui) { +#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX) + if (pre_deactivate_x >= 0) { + move (pre_deactivate_x, pre_deactivate_y); + } +#endif + if (_pluginui->on_window_show (_title)) { Window::on_show (); } @@ -239,6 +245,10 @@ PluginUIWindow::on_show () void PluginUIWindow::on_hide () { +#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX) + get_position (pre_deactivate_x, pre_deactivate_y); +#endif + Window::on_hide (); if (_pluginui) { From 0b8712268e4935e69fa5604407ee0f7753027fdd Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 30 Apr 2013 17:45:22 +0200 Subject: [PATCH 16/27] fix version detection in OSX build script --- tools/osx_packaging/osx_build | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/osx_packaging/osx_build b/tools/osx_packaging/osx_build index d750674d36..af582ff3bf 100755 --- a/tools/osx_packaging/osx_build +++ b/tools/osx_packaging/osx_build @@ -62,9 +62,13 @@ while [ $# -gt 0 ] ; do esac done -#release_version=`grep -m 1 '[^A-Za-z_]OSX_VERSION = ' ../../wscript | cut -d' ' -f 3 | sed "s/'//g"` -release_version=3.0 -revision=`grep -m 1 'revision =' ../../libs/ardour/revision.cc | cut -d' ' -f 8 | sed 's/[^0-9]//g'` +if test -z "$PRODUCT_PKG_DIR" -o -z "$APPNAME"; then + echo "application or product-name was not specified" + exit 1 +fi + +release_version=`grep -m 1 '[^A-Za-z_]OSX_VERSION = ' ../../wscript | cut -d"'" -f2` +revision=`grep -m 1 'revision =' ../../libs/ardour/revision.cc | cut -d'"' -f 2 | sed 's/^.*-//g'` echo "Version is $release_version / $revision" info_string="$release_version/$revision built on `hostname` by `whoami` on `date`" echo "Info string is $info_string" From 63e4c37deffbedacf0a81359fd4615774c227556 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 30 Apr 2013 13:48:55 -0400 Subject: [PATCH 17/27] remove unnecessary sigc++ header --- gtk2_ardour/editor_markers.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 070ce4bc6e..3bca0ad935 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -17,7 +17,6 @@ */ -#include #include #include From a9341bd5f03dad86161786c1f764471b23273601 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 30 Apr 2013 13:50:15 -0400 Subject: [PATCH 18/27] improve relationship between ArdourDialog and Splash on OS X, where window restacking doesn't really work the way we need it to. more complex than anticipated because it seems that destroying a Gtk::Dialog does not emit its hide() or unmap() or unmap_event() signals --- gtk2_ardour/ardour_dialog.cc | 16 +++++++++++++--- gtk2_ardour/ardour_dialog.h | 1 + gtk2_ardour/ardour_ui.cc | 6 ++++-- gtk2_ardour/splash.cc | 24 +++++++++++++++++++++++- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/ardour_dialog.cc b/gtk2_ardour/ardour_dialog.cc index c0e1708781..6775a70953 100644 --- a/gtk2_ardour/ardour_dialog.cc +++ b/gtk2_ardour/ardour_dialog.cc @@ -34,12 +34,14 @@ sigc::signal ArdourDialog::CloseAllDialogs; ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator) : Dialog (title, modal, use_seperator) + , _splash_pushed (false) { init (); } ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool use_seperator) : Dialog (title, parent, modal, use_seperator) + , _splash_pushed (false) { init (); set_position (Gtk::WIN_POS_CENTER_ON_PARENT); @@ -47,6 +49,13 @@ ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool ArdourDialog::~ArdourDialog () { + if (_splash_pushed) { + Splash* spl = Splash::instance(); + + if (spl) { + spl->pop_front(); + } + } } bool @@ -73,15 +82,16 @@ ArdourDialog::on_unmap () void ArdourDialog::on_show () { + Dialog::on_show (); + // never allow the splash screen to obscure any dialog Splash* spl = Splash::instance(); - if (spl) { + if (spl && spl->is_visible()) { spl->pop_back_for (*this); + _splash_pushed = true; } - - Dialog::on_show (); } void diff --git a/gtk2_ardour/ardour_dialog.h b/gtk2_ardour/ardour_dialog.h index 4f53662c23..1008f63000 100644 --- a/gtk2_ardour/ardour_dialog.h +++ b/gtk2_ardour/ardour_dialog.h @@ -46,6 +46,7 @@ class ArdourDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr static void close_all_dialogs () { CloseAllDialogs(); } private: + bool _splash_pushed; void init (); static sigc::signal CloseAllDialogs; diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index eebd35aefb..7e972b8032 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -3771,12 +3771,14 @@ audio may be played at the wrong sample rate.\n"), desired, PROGRAM_NAME, actual image->show(); hbox->show(); - switch (dialog.run ()) { + switch (dialog.run()) { case RESPONSE_ACCEPT: return 0; default: - return 1; + break; } + + return 1; } diff --git a/gtk2_ardour/splash.cc b/gtk2_ardour/splash.cc index 0922ec75ba..99adff68e9 100644 --- a/gtk2_ardour/splash.cc +++ b/gtk2_ardour/splash.cc @@ -25,6 +25,10 @@ #include "ardour/ardour.h" #include "ardour/filesystem_paths.h" +#ifdef check +#undef check +#endif + #include "gui_thread.h" #include "splash.h" @@ -96,15 +100,33 @@ Splash::~Splash () void Splash::pop_back_for (Gtk::Window& win) { +#ifdef __APPLE__ + /* April 2013: window layering on OS X is a bit different to X Window. at present, + the "restack()" functionality in GDK will only operate on windows in the same + "level" (e.g. two normal top level windows, or two utility windows) and will not + work across them. The splashscreen is on its own "StatusWindowLevel" so restacking + is not going to work. + + So for OS X, we just hide ourselves. + */ + hide(); +#else set_keep_above (false); get_window()->restack (win.get_window(), false); - win.signal_hide().connect (sigc::mem_fun (*this, &Splash::pop_front)); +#endif } void Splash::pop_front () { + +#ifdef __APPLE__ + if (get_window()) { + show (); + } +#else set_keep_above (true); +#endif } void From 35842fd5eed8b28f2a89c5d88895351dc8511c76 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 30 Apr 2013 16:38:48 -0400 Subject: [PATCH 19/27] forward port recent mixbus change so that side-scroll is now shift-wheel and height adjustment is alt-wheel, rather than vice versa, to match OS X convention --- gtk2_ardour/editor_canvas_events.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index 4c49dd1a9b..fd44ed3f2e 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -73,10 +73,10 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) temporal_zoom_step (false); zoom_focus = temp_focus; return true; - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { direction = GDK_SCROLL_LEFT; goto retry; - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { if (!current_stepping_trackview) { step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500); std::pair const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value() - canvas_timebars_vsize); @@ -102,10 +102,10 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) temporal_zoom_step (true); zoom_focus = temp_focus; return true; - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { direction = GDK_SCROLL_RIGHT; goto retry; - } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { + } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { if (!current_stepping_trackview) { step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500); std::pair const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value() - canvas_timebars_vsize); From 88f752411876323d5966fad447d441b7613638f0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 1 May 2013 18:41:28 -0400 Subject: [PATCH 20/27] hack up AU GUI support to handle AUSampler resizing better. Note that this is still one buggy plugin --- gtk2_ardour/au_pluginui.h | 4 +- gtk2_ardour/au_pluginui.mm | 96 ++++++++++++++++++++------------------ 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index cbf83d5d92..424d81e901 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -76,9 +76,6 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox void lower_box_realized (); void cocoa_view_resized (); void on_realize (); - bool on_map_event (GdkEventAny*); - bool on_focus_in_event (GdkEventFocus*); - bool on_focus_out_event (GdkEventFocus*); void forward_key_event (GdkEventKey*); bool on_window_show (const std::string& /*title*/); @@ -105,6 +102,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox NSWindow* cocoa_window; NSView* au_view; + NSRect last_au_frame; /* Carbon */ diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm index 16d4e7e6fc..7bebcee84f 100644 --- a/gtk2_ardour/au_pluginui.mm +++ b/gtk2_ardour/au_pluginui.mm @@ -48,6 +48,26 @@ static const gchar* _automation_mode_strings[] = { 0 }; +static void +dump_view_tree (NSView* view, int depth) +{ + NSArray* subviews = [view subviews]; + unsigned long cnt = [subviews count]; + + for (int d = 0; d < depth; d++) { + cerr << '\t'; + } + NSRect frame = [view frame]; + cerr << " view @ " << frame.origin.x << ", " << frame.origin.y + << ' ' << frame.size.width << " x " << frame.size.height + << endl; + + for (unsigned long i = 0; i < cnt; ++i) { + NSView* subview = [subviews objectAtIndex:i]; + dump_view_tree (subview, depth+1); + } +} + @implementation NotificationObject - (NotificationObject*) initWithPluginUI: (AUPluginUI*) apluginui andCocoaParent: (NSWindow*) cp andTopLevelParent: (NSWindow*) tlp @@ -413,14 +433,11 @@ AUPluginUI::cocoa_view_resized () { GtkRequisition topsize = top_box.size_request (); NSWindow* window = get_nswindow (); - NSSize oldContentSize= [window contentRectForFrameRect:[window frame]].size; - NSSize newContentSize= [au_view frame].size; NSRect windowFrame= [window frame]; + NSRect new_frame = [au_view frame]; - oldContentSize.height -= topsize.height; - - float dy = oldContentSize.height - newContentSize.height; - float dx = oldContentSize.width - newContentSize.width; + float dy = last_au_frame.size.height - new_frame.size.height; + float dx = last_au_frame.size.width - new_frame.size.width; windowFrame.origin.y += dy; windowFrame.origin.x += dx; @@ -435,11 +452,29 @@ AUPluginUI::cocoa_view_resized () [au_view setAutoresizingMask:NSViewNotSizable]; [window setFrame:windowFrame display:1]; + + /* Some stupid AU Views change the origin of the original AU View + when they are resized (I'm looking at you AUSampler). If the origin + has been moved, move it back. + */ + + if (last_au_frame.origin.x != new_frame.origin.x || + last_au_frame.origin.y != new_frame.origin.y) { + new_frame.origin = last_au_frame.origin; + [au_view setFrame:new_frame]; + /* also be sure to redraw the topbox because this can + also go wrong. + */ + top_box.queue_draw (); + } + [au_view setAutoresizingMask:old_auto_resize]; [[NSNotificationCenter defaultCenter] addObserver:_notify selector:@selector(auViewResized:) name:NSViewFrameDidChangeNotification object:au_view]; + + last_au_frame = new_frame; } int @@ -533,7 +568,6 @@ AUPluginUI::activate () #ifdef WITH_CARBON ActivateWindow (carbon_window, TRUE); #endif - // [cocoa_parent makeKeyAndOrderFront:nil]; } void @@ -629,6 +663,8 @@ AUPluginUI::parent_cocoa_window () [au_view setFrameOrigin:origin]; [view addSubview:au_view positioned:NSWindowBelow relativeTo:nil]; + last_au_frame = [au_view frame]; + // watch for size changes of the view _notify = [ [NotificationObject alloc] initWithPluginUI:this andCocoaParent:nil andTopLevelParent:win ]; @@ -640,23 +676,6 @@ AUPluginUI::parent_cocoa_window () return 0; } -static void -dump_view_tree (NSView* view, int depth) -{ - NSArray* subviews = [view subviews]; - unsigned long cnt = [subviews count]; - - for (int d = 0; d < depth; d++) { - cerr << '\t'; - } - cerr << " view @ " << view << endl; - - for (unsigned long i = 0; i < cnt; ++i) { - NSView* subview = [subviews objectAtIndex:i]; - dump_view_tree (subview, depth+1); - } -} - void AUPluginUI::forward_key_event (GdkEventKey* ev) { @@ -702,12 +721,6 @@ AUPluginUI::lower_box_realized () } } -bool -AUPluginUI::on_map_event (GdkEventAny*) -{ - return false; -} - void AUPluginUI::on_window_hide () { @@ -717,8 +730,14 @@ AUPluginUI::on_window_hide () ActivateWindow (carbon_window, FALSE); } #endif - hide_all (); + +#if 0 + NSArray* wins = [NSApp windows]; + for (uint32_t i = 0; i < [wins count]; i++) { + id win = [wins objectAtIndex:i]; + } +#endif } bool @@ -760,19 +779,4 @@ create_au_gui (boost::shared_ptr plugin_insert, VBox** box) return aup; } -bool -AUPluginUI::on_focus_in_event (GdkEventFocus*) -{ - //cerr << "au plugin focus in\n"; - //Keyboard::magic_widget_grab_focus (); - return false; -} - -bool -AUPluginUI::on_focus_out_event (GdkEventFocus*) -{ - //cerr << "au plugin focus out\n"; - //Keyboard::magic_widget_drop_focus (); - return false; -} From d88999312a97a04548d2fc457d11a3303789c171 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 2 May 2013 10:10:05 -0400 Subject: [PATCH 21/27] force ArdourWindows to be TYPE_UTILITY so that they float "with" TYPE_DIALOG windows (at least on OS X - still to be tested on X Window --- gtk2_ardour/ardour_window.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gtk2_ardour/ardour_window.cc b/gtk2_ardour/ardour_window.cc index 616cfbcb66..6217946940 100644 --- a/gtk2_ardour/ardour_window.cc +++ b/gtk2_ardour/ardour_window.cc @@ -75,5 +75,15 @@ void ArdourWindow::init () { set_border_width (10); + + /* ArdourWindows are not dialogs (they have no "OK" or "Close" button) but + they should be considered part of the same "window level" as a dialog. This + works on X11 and Quartz, in that: + + (a) utility & dialog windows are considered to be part of the same level + (b) they will float above normal windows without any particular effort + */ + + set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY); } From e1d331761f20e650bfdf59b62a93baa789678ec0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 2 May 2013 10:11:06 -0400 Subject: [PATCH 22/27] don't do debug trace output for every Render (process) call on an AU plugin --- libs/ardour/audio_unit.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 89aa99bac8..399ce8aba7 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -1299,8 +1299,8 @@ AUPlugin::render_callback(AudioUnitRenderActionFlags*, { /* not much to do with audio - the data is already in the buffers given to us in connect_and_run() */ - DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1: render callback, frames %2 bufs %3\n", - name(), inNumberFrames, ioData->mNumberBuffers)); + // DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1: render callback, frames %2 bufs %3\n", + // name(), inNumberFrames, ioData->mNumberBuffers)); if (input_maxbuf == 0) { error << _("AUPlugin: render callback called illegally!") << endmsg; From f04c35cb1c3e89380c53eb95ce62091e1d7d7e76 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 2 May 2013 10:11:31 -0400 Subject: [PATCH 23/27] reduce verbosity of DEBUG::Sequence traces --- libs/evoral/src/Sequence.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp index 738d5a19c9..b56c234d75 100644 --- a/libs/evoral/src/Sequence.cpp +++ b/libs/evoral/src/Sequence.cpp @@ -257,7 +257,6 @@ Sequence