forward port 2.X changes up to and including rev 6842

git-svn-id: svn://localhost/ardour2/branches/3.0@7637 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-08-17 02:48:24 +00:00
parent f5c4c8a293
commit 54d00408c3
12 changed files with 219 additions and 36 deletions

View file

@ -2656,6 +2656,15 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na
goto out; goto out;
} }
/* Now the session been created, add the transport controls */
new_session->add_controllable(roll_controllable);
new_session->add_controllable(stop_controllable);
new_session->add_controllable(goto_start_controllable);
new_session->add_controllable(goto_end_controllable);
new_session->add_controllable(auto_loop_controllable);
new_session->add_controllable(play_selection_controllable);
new_session->add_controllable(rec_controllable);
set_session (new_session); set_session (new_session);
session_loaded = true; session_loaded = true;
@ -2752,6 +2761,18 @@ ARDOUR_UI::show_about ()
about->show_all (); about->show_all ();
} }
void
ARDOUR_UI::launch_manual ()
{
PBD::open_uri("http://ardour.org/flossmanual");
}
void
ARDOUR_UI::launch_reference ()
{
PBD::open_uri("http://ardour.org/refmanual");
}
void void
ARDOUR_UI::hide_about () ARDOUR_UI::hide_about ()
{ {

View file

@ -117,6 +117,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void hide_splash (); void hide_splash ();
void launch_chat (); void launch_chat ();
void launch_manual ();
void launch_reference ();
void show_about (); void show_about ();
void hide_about (); void hide_about ();

View file

@ -48,9 +48,7 @@
#include "startup.h" #include "startup.h"
#include "utils.h" #include "utils.h"
#ifdef GTKOSX #include <gtkmm2ext/application.h>
#include <gtkmm2ext/sync-menu.h>
#endif
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/profile.h" #include "ardour/profile.h"
@ -231,6 +229,8 @@ ARDOUR_UI::install_actions ()
ActionManager::session_sensitive_actions.push_back (act); ActionManager::session_sensitive_actions.push_back (act);
ActionManager::register_action (common_actions, X_("About"), _("About"), sigc::mem_fun(*this, &ARDOUR_UI::show_about)); ActionManager::register_action (common_actions, X_("About"), _("About"), sigc::mem_fun(*this, &ARDOUR_UI::show_about));
ActionManager::register_action (common_actions, X_("Chat"), _("Chat"), sigc::mem_fun(*this, &ARDOUR_UI::launch_chat)); ActionManager::register_action (common_actions, X_("Chat"), _("Chat"), sigc::mem_fun(*this, &ARDOUR_UI::launch_chat));
ActionManager::register_action (common_actions, X_("Manual"), _("Manual"), mem_fun(*this, &ARDOUR_UI::launch_manual));
ActionManager::register_action (common_actions, X_("Reference"), _("Reference"), mem_fun(*this, &ARDOUR_UI::launch_reference));
ActionManager::register_toggle_action (common_actions, X_("ToggleThemeManager"), _("Theme Manager"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_theme_manager)); ActionManager::register_toggle_action (common_actions, X_("ToggleThemeManager"), _("Theme Manager"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_theme_manager));
ActionManager::register_toggle_action (common_actions, X_("ToggleKeyEditor"), _("Key Bindings"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_key_editor)); ActionManager::register_toggle_action (common_actions, X_("ToggleKeyEditor"), _("Key Bindings"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_key_editor));
ActionManager::register_toggle_action (common_actions, X_("ToggleBundleManager"), _("Bundle Manager"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_bundle_manager)); ActionManager::register_toggle_action (common_actions, X_("ToggleBundleManager"), _("Bundle Manager"), sigc::mem_fun(*this, &ARDOUR_UI::toggle_bundle_manager));
@ -547,10 +547,7 @@ ARDOUR_UI::build_menu_bar ()
void void
ARDOUR_UI::use_menubar_as_top_menubar () ARDOUR_UI::use_menubar_as_top_menubar ()
{ {
#ifdef GTKOSX gtk_application_set_menu_bar ((GtkMenuShell*) menu_bar->gobj());
ige_mac_menu_set_menu_bar ((GtkMenuShell*) menu_bar->gobj());
// ige_mac_menu_set_quit_menu_item (some_item->gobj());
#endif
} }
void void

View file

@ -419,15 +419,16 @@ CrossfadeEditor::point_event (GdkEvent* event, Point* point)
if (point_grabbed) { if (point_grabbed) {
double new_x, new_y; double new_x, new_y;
/* can't drag first or last points horizontally */ /* can't drag first or last points horizontally or vertically */
if (point == fade[current].points.front() || point == fade[current].points.back()) { if (point == fade[current].points.front() || point == fade[current].points.back()) {
new_x = point->x; new_x = point->x;
new_y = point->y;
} else { } else {
new_x = (event->motion.x - canvas_border)/effective_width(); new_x = (event->motion.x - canvas_border)/effective_width();
new_y = 1.0 - ((event->motion.y - canvas_border)/effective_height());
} }
new_y = 1.0 - ((event->motion.y - canvas_border)/effective_height());
point->move_to (x_coordinate (new_x), y_coordinate (new_y), point->move_to (x_coordinate (new_x), y_coordinate (new_y),
new_x, new_y); new_x, new_y);
redraw (); redraw ();

View file

@ -39,6 +39,7 @@
#include "ardour/filesystem_paths.h" #include "ardour/filesystem_paths.h"
#include <gtkmm/main.h> #include <gtkmm/main.h>
#include <gtkmm2ext/application.h>
#include <gtkmm2ext/popup.h> #include <gtkmm2ext/popup.h>
#include <gtkmm2ext/utils.h> #include <gtkmm2ext/utils.h>
@ -439,6 +440,7 @@ int main (int argc, char *argv[])
} }
ui->run (text_receiver); ui->run (text_receiver);
Gtkmm2ext::Application::instance()->cleanup();
ui = 0; ui = 0;
ARDOUR::cleanup (); ARDOUR::cleanup ();

View file

@ -837,6 +837,9 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
} }
} }
_fade_in.front()->value = 0.0;
_fade_in.back()->value = 1.0;
_fade_in.thaw (); _fade_in.thaw ();
/* fade out */ /* fade out */
@ -862,6 +865,9 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
} }
} }
_fade_out.front()->value = 1.0;
_fade_out.back()->value = 0.0;
_fade_out.thaw (); _fade_out.thaw ();
PropertyChanged (what_changed); /* EMIT SIGNAL */ PropertyChanged (what_changed); /* EMIT SIGNAL */

View file

@ -0,0 +1,84 @@
/* GTK+ Integration with platform-specific application-wide features
* such as the OS X menubar and application delegate concepts.
*
* Copyright (C) 2007 Pioneer Research Center USA, Inc.
* Copyright (C) 2007 Imendio AB
* Copyright (C) 2009 Paul Davis
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1
* of the License.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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.
*/
#include <gtkmm/menushell.h>
#include <gtkmm/menuitem.h>
#include "gtkmm2ext/application.h"
#include "gtkmm2ext/gtkapplication.h"
using namespace Gtk;
using namespace Gtkmm2ext;
Application* Application::_instance = 0;
Application*
Application::instance ()
{
if (!_instance) {
_instance = new Application;
}
return _instance;
}
Application::Application ()
{
gtk_application_init ();
}
Application::~Application ()
{
_instance = 0;
gtk_application_cleanup ();
}
void
Application::ready ()
{
gtk_application_ready ();
}
void
Application::cleanup ()
{
gtk_application_cleanup ();
}
void
Application::set_menu_bar (MenuShell& shell)
{
gtk_application_set_menu_bar (shell.gobj());
}
GtkApplicationMenuGroup*
Application::add_app_menu_group ()
{
return gtk_application_add_app_menu_group ();
}
void
Application::add_app_menu_item (GtkApplicationMenuGroup* group,
MenuItem* item)
{
gtk_application_add_app_menu_item (group, item->gobj());
}

View file

@ -33,6 +33,7 @@
#include <pbd/pthread_utils.h> #include <pbd/pthread_utils.h>
#include <pbd/stacktrace.h> #include <pbd/stacktrace.h>
#include <gtkmm2ext/application.h>
#include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/textviewer.h> #include <gtkmm2ext/textviewer.h>
#include <gtkmm2ext/popup.h> #include <gtkmm2ext/popup.h>
@ -107,6 +108,10 @@ UI::UI (string namestr, int *argc, char ***argv)
errors->set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY); errors->set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY);
//load_rcfile (rcfile); //load_rcfile (rcfile);
/* instantiate the Application singleton */
Application::instance();
} }
UI::~UI () UI::~UI ()
@ -633,31 +638,10 @@ UI::popup_error (const string& text)
pup->touch (); pup->touch ();
} }
#ifdef GTKOSX
extern "C" {
int gdk_quartz_in_carbon_menu_event_handler ();
}
#endif
void void
UI::flush_pending () UI::flush_pending ()
{ {
#ifdef GTKOSX
/* as of february 11th 2008, gtk/osx has a problem in that mac menu events
are handled using Carbon with an "internal" event handling system that
doesn't pass things back to the glib/gtk main loop. this makes
gtk_main_iteration() block if we call it while in a menu event handler
because glib gets confused and thinks there are two threads running
g_main_poll_func().
this hack (relies on code in gtk2_ardour/sync-menu.c) works
around that.
*/
if (gdk_quartz_in_carbon_menu_event_handler()) {
return;
}
#endif
if (!caller_is_ui_thread()) { if (!caller_is_ui_thread()) {
error << "non-UI threads cannot call UI::flush_pending()" error << "non-UI threads cannot call UI::flush_pending()"
<< endmsg; << endmsg;

View file

@ -50,6 +50,8 @@
* *
*/ */
static gint _exiting = 0;
static guint static guint
gdk_quartz_keyval_to_ns_keyval (guint keyval) gdk_quartz_keyval_to_ns_keyval (guint keyval)
{ {
@ -891,9 +893,13 @@ cocoa_menu_item_accel_changed (GtkAccelGroup *accel_group,
GClosure *accel_closure, GClosure *accel_closure,
GtkWidget *widget) GtkWidget *widget)
{ {
GNSMenuItem *cocoa_item = cocoa_menu_item_get (widget); GNSMenuItem *cocoa_item;
GtkWidget *label; GtkWidget *label;
if (_exiting)
return;
cocoa_item = cocoa_menu_item_get (widget);
get_menu_label_text (widget, &label); get_menu_label_text (widget, &label);
if (GTK_IS_ACCEL_LABEL (label) && if (GTK_IS_ACCEL_LABEL (label) &&
@ -945,7 +951,12 @@ cocoa_menu_item_notify_label (GObject *object,
GParamSpec *pspec, GParamSpec *pspec,
gpointer data) gpointer data)
{ {
GNSMenuItem *cocoa_item = cocoa_menu_item_get (GTK_WIDGET (object)); GNSMenuItem *cocoa_item;
if (_exiting)
return;
cocoa_item = cocoa_menu_item_get (GTK_WIDGET (object));
if (!strcmp (pspec->name, "label")) if (!strcmp (pspec->name, "label"))
{ {
@ -964,6 +975,9 @@ cocoa_menu_item_notify (GObject *object,
GParamSpec *pspec, GParamSpec *pspec,
NSMenuItem *cocoa_item) NSMenuItem *cocoa_item)
{ {
if (_exiting)
return;
if (!strcmp (pspec->name, "sensitive") || if (!strcmp (pspec->name, "sensitive") ||
!strcmp (pspec->name, "visible")) !strcmp (pspec->name, "visible"))
{ {
@ -1449,10 +1463,18 @@ gtk_application_ready ()
extern "C" void extern "C" void
gtk_application_cleanup() gtk_application_cleanup()
{ {
if (_window_menu) _exiting = 1;
if (_window_menu) {
[ _window_menu release ]; [ _window_menu release ];
if (_app_menu) _window_menu = 0;
}
if (_app_menu) {
[ _app_menu release ]; [ _app_menu release ];
if (_main_menubar) _app_menu = 0;
}
if (_main_menubar) {
[ _main_menubar release ]; [ _main_menubar release ];
_main_menubar = 0;
}
} }

View file

@ -0,0 +1,63 @@
/* GTK+ Integration with platform-specific application-wide features
* such as the OS X menubar and application delegate concepts.
*
* Copyright (C) 2009 Paul Davis
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1
* of the License.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 __GTK_APPLICATION_MM_H__
#define __GTK_APPLICATION_MM_H__
#include <gtkmm2ext/gtkapplication.h> // for GtkApplicationGroup typedef
#include <sigc++/signal.h>
namespace Gtk {
class MenuItem;
class MenuShell;
}
namespace Glib {
class ustring;
}
namespace Gtkmm2ext {
class Application
{
public:
static Application* instance();
~Application ();
void ready ();
void cleanup ();
void set_menu_bar (Gtk::MenuShell&);
GtkApplicationMenuGroup* add_app_menu_group ();
void add_app_menu_item (GtkApplicationMenuGroup*, Gtk::MenuItem*);
sigc::signal<void,bool> ActivationChanged;
sigc::signal<void,const Glib::ustring&> ShouldLoad;
sigc::signal<void> ShouldQuit;
private:
Application ();
static Application* _instance;
};
}
#endif /* __GTK_APPLICATION_MM_H__ */

View file

@ -20,6 +20,7 @@ VERSION = GTKMM2EXT_VERSION
gtkmm2ext_sources = [ gtkmm2ext_sources = [
'actions.cc', 'actions.cc',
'application.cc',
'auto_spin.cc', 'auto_spin.cc',
'barcontroller.cc', 'barcontroller.cc',
'binding_proxy.cc', 'binding_proxy.cc',

View file

@ -384,7 +384,7 @@ def configure(conf):
autowaf.configure(conf) autowaf.configure(conf)
gcc_versions = fetch_gcc_version() gcc_versions = fetch_gcc_version()
if Options.options.debug and gcc_versions[0] == '4' and gcc_versions[1] > '4': if not Options.options.debug and gcc_versions[0] == '4' and gcc_versions[1] > '4':
print 'Version 4.5 of gcc is not ready for use when compiling Ardour with optimization.' print 'Version 4.5 of gcc is not ready for use when compiling Ardour with optimization.'
print 'Please use a different version or re-configure with --debug' print 'Please use a different version or re-configure with --debug'
exit (1) exit (1)