mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-09 23:25:43 +01:00
Merge branch 'master' into ardour-merge
Conflicts: gtk2_ardour/time_axis_view_item.cc
This commit is contained in:
commit
33c2baa462
12 changed files with 295 additions and 63 deletions
|
|
@ -146,14 +146,7 @@ Editor::show_editor_mixer (bool yn)
|
|||
RouteTimeAxisView* atv;
|
||||
|
||||
if ((atv = dynamic_cast<RouteTimeAxisView*> (*i) ) != 0) {
|
||||
|
||||
AudioTrack* atr = dynamic_cast<AudioTrack*> (atv->route().get() );
|
||||
if (atr && atr->is_master_track() ) {
|
||||
r = master_bus;
|
||||
} else {
|
||||
r = atv->route();
|
||||
}
|
||||
|
||||
r = atv->route();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1590,16 +1590,17 @@ EditorRoutes::move_selected_tracks_relatively (const PBD::ID& source_track_id, c
|
|||
|
||||
boost::shared_ptr<Route> route = (*ri)[_columns.route];
|
||||
TimeAxisView* tv = (*ri)[_columns.tv];
|
||||
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(tv);
|
||||
|
||||
// selected tracks: add to the move list but if it's not a target
|
||||
if (selection.selected(tv) &&
|
||||
route->id() != target_track_id) {
|
||||
route->id() != target_track_id &&
|
||||
!rtv->is_master_track() ) {
|
||||
routes_to_move.push_back(route);
|
||||
continue;
|
||||
}
|
||||
|
||||
// master track should always be the first
|
||||
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(tv);
|
||||
if (rtv->is_master_track() ) {
|
||||
routes.push_front(route);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "pbd/enumwriter.h"
|
||||
#include "pbd/replace_all.h"
|
||||
#include "pbd/stacktrace.h"
|
||||
#include "pbd/whitespace.h"
|
||||
|
||||
#include <gtkmm2ext/gtk_ui.h>
|
||||
#include <gtkmm2ext/utils.h>
|
||||
|
|
@ -101,10 +102,14 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, const std::string& layout_s
|
|||
, panners (sess)
|
||||
, _visibility (X_("mixer-strip-visibility"))
|
||||
|
||||
,_editor (ARDOUR_UI::instance()->the_editor())
|
||||
|
||||
, gain_meter_home (get_box ("gain_meter_home"))
|
||||
, _comment_button (get_waves_button ("comment_button"))
|
||||
, midi_input_enable_button (get_waves_button ("midi_input_enable_button"))
|
||||
, name_button (get_waves_button ("name_button"))
|
||||
, _name_button_home (get_event_box("name_label_home"))
|
||||
, name_button (get_waves_button ("name_button"))
|
||||
, _name_entry (get_entry("name_entry"))
|
||||
, color_palette_button (get_waves_button ("color_palette_button"))
|
||||
, color_palette_home (get_container ("color_palette_home"))
|
||||
, color_buttons_home (get_container ("color_buttons_home"))
|
||||
|
|
@ -178,10 +183,15 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Route> rt
|
|||
, gpm (sess, xml_property(*xml_tree()->root(), "gainmeterscript", "default_gain_meter.xml"))
|
||||
, panners (sess)
|
||||
, _visibility (X_("mixer-strip-visibility"))
|
||||
|
||||
, _editor (ARDOUR_UI::instance()->the_editor())
|
||||
|
||||
, gain_meter_home (get_box ("gain_meter_home"))
|
||||
, _comment_button (get_waves_button ("comment_button"))
|
||||
, midi_input_enable_button (get_waves_button ("midi_input_enable_button"))
|
||||
, name_button (get_waves_button ("name_button"))
|
||||
, _name_button_home (get_event_box("name_label_home"))
|
||||
, name_button (get_waves_button ("name_button"))
|
||||
, _name_entry (get_entry ("name_entry"))
|
||||
, color_palette_button (get_waves_button ("color_palette_button"))
|
||||
, color_palette_home (get_container ("color_palette_home"))
|
||||
, color_buttons_home (get_container ("color_buttons_home"))
|
||||
|
|
@ -290,6 +300,24 @@ MixerStrip::init ()
|
|||
|
||||
gpm.LevelMeterButtonPress.connect_same_thread (_level_meter_connection, boost::bind (&MixerStrip::level_meter_button_press, this, _1));
|
||||
|
||||
_name_entry.signal_key_press_event().connect (sigc::mem_fun (*this, &MixerStrip::name_entry_key_press), false);
|
||||
_name_entry.signal_key_release_event().connect (sigc::mem_fun (*this, &MixerStrip::name_entry_key_release), false);
|
||||
_name_entry.signal_focus_out_event().connect (sigc::mem_fun (*this, &MixerStrip::name_entry_focus_out));
|
||||
|
||||
if( _route )
|
||||
_name_entry.set_text ( _route->name() );
|
||||
|
||||
_name_entry.signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &MixerStrip::end_name_edit), RESPONSE_OK));
|
||||
|
||||
_name_button_home.add_events (Gdk::BUTTON_PRESS_MASK|
|
||||
Gdk::BUTTON_RELEASE_MASK|
|
||||
Gdk::POINTER_MOTION_MASK);
|
||||
_name_button_home.set_flags (CAN_FOCUS);
|
||||
|
||||
/* note that this handler connects *before* the default handler */
|
||||
_name_button_home.signal_button_press_event().connect (sigc::mem_fun (*this, &MixerStrip::controls_ebox_button_press));
|
||||
_name_button_home.signal_button_release_event().connect (sigc::mem_fun (*this, &MixerStrip::controls_ebox_button_release));
|
||||
|
||||
Session* session = ARDOUR_UI::instance()->the_session();
|
||||
if( session )
|
||||
session->session_routes_reconnected.connect(_input_output_channels_update, invalidator (*this), boost::bind (&MixerStrip::update_inspector_info_panel, this), gui_context());
|
||||
|
|
@ -304,11 +332,149 @@ MixerStrip::~MixerStrip ()
|
|||
delete comment_window;
|
||||
}
|
||||
|
||||
Gdk::Color
|
||||
MixerStrip::palette_random_color()
|
||||
bool
|
||||
MixerStrip::controls_ebox_button_press (GdkEventButton* event)
|
||||
{
|
||||
int number_of_colors_in_palette = sizeof(MixerStrip::XMLColor)/sizeof(*MixerStrip::XMLColor);
|
||||
return (Gdk::Color)(MixerStrip::XMLColor[random() % number_of_colors_in_palette]);
|
||||
if ((event->button == 1 && event->type == GDK_2BUTTON_PRESS) || Keyboard::is_edit_event (event)) {
|
||||
/* see if it is inside the name label */
|
||||
if (name_button.is_ancestor (_name_button_home)) {
|
||||
int nlx;
|
||||
int nly;
|
||||
_name_button_home.translate_coordinates (name_button, event->x, event->y, nlx, nly);
|
||||
Gtk::Allocation a = name_button.get_allocation ();
|
||||
if (nlx > 0 && nlx < a.get_width() && nly > 0 && nly < a.get_height()) {
|
||||
begin_name_edit ();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
MixerStrip::controls_ebox_button_release (GdkEventButton* ev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
MixerStrip::selection_click (GdkEventButton* ev)
|
||||
{
|
||||
Selection::Operation op = ArdourKeyboard::selection_type (ev->state);
|
||||
}
|
||||
|
||||
bool
|
||||
MixerStrip::name_entry_key_press (GdkEventKey* ev)
|
||||
{
|
||||
/* steal escape, tabs from GTK */
|
||||
|
||||
switch (ev->keyval) {
|
||||
case GDK_Escape:
|
||||
case GDK_ISO_Left_Tab:
|
||||
case GDK_Tab:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
MixerStrip::name_entry_key_release (GdkEventKey* ev)
|
||||
{
|
||||
TrackViewList::iterator i;
|
||||
|
||||
switch (ev->keyval) {
|
||||
case GDK_Escape:
|
||||
end_name_edit (RESPONSE_CANCEL);
|
||||
return true;
|
||||
|
||||
/* Shift+Tab Keys Pressed. Note that for Shift+Tab, GDK actually
|
||||
* generates a different ev->keyval, rather than setting
|
||||
* ev->state.
|
||||
*/
|
||||
case GDK_ISO_Left_Tab:
|
||||
end_name_edit (RESPONSE_APPLY);
|
||||
return true;
|
||||
|
||||
case GDK_Tab:
|
||||
end_name_edit (RESPONSE_ACCEPT);
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
MixerStrip::name_entry_focus_out (GdkEventFocus*)
|
||||
{
|
||||
end_name_edit (RESPONSE_OK);
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
MixerStrip::begin_name_edit ()
|
||||
{
|
||||
if( _route->is_master () )
|
||||
return;
|
||||
|
||||
_name_entry.set_text ( _route->name() );
|
||||
name_button.hide();
|
||||
_name_entry.show ();
|
||||
|
||||
_name_entry.select_region (0, -1);
|
||||
_name_entry.set_state (STATE_SELECTED);
|
||||
_name_entry.grab_focus ();
|
||||
_name_entry.start_editing (0);
|
||||
}
|
||||
|
||||
void
|
||||
MixerStrip::end_name_edit (int response)
|
||||
{
|
||||
switch (response) {
|
||||
case RESPONSE_CANCEL:
|
||||
break;
|
||||
case RESPONSE_OK:
|
||||
name_entry_changed ();
|
||||
break;
|
||||
case RESPONSE_ACCEPT:
|
||||
name_entry_changed ();
|
||||
case RESPONSE_APPLY:
|
||||
name_entry_changed ();
|
||||
}
|
||||
|
||||
name_button.show ();
|
||||
_name_entry.hide ();
|
||||
}
|
||||
|
||||
void
|
||||
MixerStrip::name_entry_changed ()
|
||||
{
|
||||
string x = _name_entry.get_text ();
|
||||
|
||||
if (x == _route->name()) {
|
||||
return;
|
||||
}
|
||||
|
||||
strip_whitespace_edges (x);
|
||||
|
||||
if (x.length() == 0) {
|
||||
_name_entry.set_text ( cut_string(_route->name(), _max_name_size) );
|
||||
return;
|
||||
}
|
||||
|
||||
if (_session->route_name_internal (x)) {
|
||||
ARDOUR_UI::instance()->popup_error (string_compose (_("You cannot create a track with that name as it is reserved for %1"),
|
||||
PROGRAM_NAME));
|
||||
_name_entry.grab_focus ();
|
||||
} else if (RouteUI::verify_new_route_name (x)) {
|
||||
_route->set_name (x);
|
||||
} else {
|
||||
_name_entry.grab_focus ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -342,13 +508,17 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
|
|||
|
||||
if (route()->is_master()) {
|
||||
master_mute_button.show ();
|
||||
get_container ("track_buttons_home").hide ();
|
||||
//get_container ("track_buttons_home").hide ();
|
||||
color_buttons_home.set_visible (false);
|
||||
color_palette_button.set_visible (false);
|
||||
color_palette_button.set_active (false);
|
||||
//mute_button.hide ();
|
||||
//solo_button.hide ();
|
||||
//rec_enable_button.hide ();
|
||||
} else {
|
||||
master_mute_button.hide ();
|
||||
get_container ("track_buttons_home").show ();
|
||||
color_palette_button.set_visible (true);
|
||||
color_palette_home.set_visible (true);
|
||||
//mute_button.show ();
|
||||
//solo_button.show ();
|
||||
//rec_enable_button.show ();
|
||||
|
|
|
|||
|
|
@ -126,7 +126,6 @@ class MixerStrip : public RouteUI
|
|||
void toggle_processors ();
|
||||
void ab_plugins ();
|
||||
|
||||
static Gdk::Color palette_random_color();
|
||||
static const char* XMLColor[15];
|
||||
|
||||
protected:
|
||||
|
|
@ -136,7 +135,9 @@ class MixerStrip : public RouteUI
|
|||
|
||||
void set_selected(bool yn);
|
||||
void set_stuff_from_route ();
|
||||
|
||||
|
||||
PublicEditor& _editor;
|
||||
|
||||
private:
|
||||
Mixer_UI& _mixer;
|
||||
|
||||
|
|
@ -165,8 +166,22 @@ class MixerStrip : public RouteUI
|
|||
gint mark_update_safe ();
|
||||
guint32 mode_switch_in_progress;
|
||||
|
||||
WavesButton& name_button;
|
||||
|
||||
Gtk::Container& _name_button_home;
|
||||
bool controls_ebox_button_press (GdkEventButton*);
|
||||
bool controls_ebox_button_release (GdkEventButton* ev);
|
||||
void selection_click (GdkEventButton* ev);
|
||||
|
||||
WavesButton& name_button;
|
||||
|
||||
Gtk::Entry& _name_entry;
|
||||
void begin_name_edit ();
|
||||
void end_name_edit (int);
|
||||
|
||||
bool name_entry_key_release (GdkEventKey *ev);
|
||||
bool name_entry_key_press (GdkEventKey *ev);
|
||||
bool name_entry_focus_out (GdkEventFocus *ev);
|
||||
void name_entry_changed ();
|
||||
|
||||
WavesButton& color_palette_button;
|
||||
Gtk::Container& color_palette_home;
|
||||
Gtk::Container& color_buttons_home;
|
||||
|
|
|
|||
|
|
@ -62,8 +62,10 @@ using namespace Gtkmm2ext;
|
|||
// GZ: Should be moved to config
|
||||
#ifdef _WIN32
|
||||
Pango::FontDescription TimeAxisViewItem::NAME_FONT("Arial 8");
|
||||
const double TimeAxisViewItem::NAME_WIDTH_CORRECTION = 0;
|
||||
#else
|
||||
Pango::FontDescription TimeAxisViewItem::NAME_FONT("Helvetica 8");
|
||||
const double TimeAxisViewItem::NAME_WIDTH_CORRECTION = 7;
|
||||
#endif
|
||||
|
||||
const double TimeAxisViewItem::NAME_HIGHLIGHT_Y_INDENT = 1.0;
|
||||
|
|
@ -566,7 +568,7 @@ TimeAxisViewItem::set_name_text(const string& new_name)
|
|||
}
|
||||
// This is a workaround.
|
||||
// Pango returns incorrect width values 1.5*NAME_HIGHLIGHT_X_INDENT
|
||||
name_text_width = pixel_width (new_name, NAME_FONT) + 1.5*NAME_HIGHLIGHT_X_INDENT;
|
||||
name_text_width = pixel_width (new_name, NAME_FONT) + NAME_WIDTH_CORRECTION;
|
||||
name_text->set (new_name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
|
|||
bool name_active() const { return name_connected; }
|
||||
|
||||
// Default sizes, font and spacing
|
||||
static const double NAME_WIDTH_CORRECTION;
|
||||
static Pango::FontDescription NAME_FONT;
|
||||
static void set_constant_heights ();
|
||||
static const double NAME_HIGHLIGHT_Y_INDENT;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
<VBox>
|
||||
<HBox>
|
||||
<EventBox id="color_palette_home"
|
||||
noshowall="true"
|
||||
visible="false"
|
||||
bgnormal="#383838">
|
||||
<iconbutton id="color_palette_button"
|
||||
width="97"
|
||||
|
|
@ -242,14 +244,35 @@
|
|||
prelighticon="inspector_master_mute_prelight"
|
||||
visible="false"
|
||||
noshowall="true"/>
|
||||
<Button id="name_button"
|
||||
width="95"
|
||||
height="47"
|
||||
fgnormal="#D7D7D7"
|
||||
fghover="#D7D7D7"
|
||||
fgactive="#D7D7D7"
|
||||
winfont ="Arial 10"
|
||||
macfont ="Helvetica 10"/>
|
||||
|
||||
<EventBox id="name_label_home">
|
||||
<HBox>
|
||||
<Button id="name_button"
|
||||
width="95"
|
||||
height="47"
|
||||
fgnormal="#D7D7D7"
|
||||
fghover="#D7D7D7"
|
||||
fgactive="#D7D7D7"
|
||||
winfont ="Arial 10"
|
||||
macfont ="Helvetica 10"
|
||||
textcolornormal="#ffffff"
|
||||
textcoloractive="#ffffff"
|
||||
textcolorselected="#ffffff"/>
|
||||
<FocusEntry id="name_entry"
|
||||
width="57"
|
||||
height="28"
|
||||
fgnormal="#ffffff"
|
||||
winfont ="Arial 10"
|
||||
macfont ="Helvetica 10"
|
||||
cssname="EditorTrackNameDisplay"
|
||||
textcolornormal="#ffffff"
|
||||
textcoloractive="#ffffff"
|
||||
textcolorselected="#ffffff"
|
||||
noshowall="true"
|
||||
visible="false"/>
|
||||
</HBox>
|
||||
</EventBox>
|
||||
|
||||
</VBox>
|
||||
<HBox visible="false"
|
||||
noshowall="true">
|
||||
|
|
|
|||
|
|
@ -55,13 +55,32 @@
|
|||
<EventBox bgnormal="#000000"
|
||||
bgactive="#000000"
|
||||
height="1"/>
|
||||
<Button id="name_button"
|
||||
width="37"
|
||||
height="24"
|
||||
fgnormal="#ffffff"
|
||||
fgactive="#ffffff"
|
||||
winfont="Arial 8"
|
||||
macfont="Helvetica 8"/>
|
||||
|
||||
<EventBox id="name_label_home">
|
||||
<HBox>
|
||||
<Button id="name_button"
|
||||
width="37"
|
||||
height="24"
|
||||
fgnormal="#ffffff"
|
||||
fgactive="#ffffff"
|
||||
fghover="#ffffff"
|
||||
winfont="Arial 8"
|
||||
macfont="Helvetica 8"/>
|
||||
<FocusEntry id="name_entry"
|
||||
width="37"
|
||||
height="24"
|
||||
fgnormal="#ffffff"
|
||||
winfont ="Arial 8"
|
||||
macfont ="Helvetica 8"
|
||||
cssname="EditorTrackNameDisplay"
|
||||
textcolornormal="#ffffff"
|
||||
textcoloractive="#ffffff"
|
||||
textcolorselected="#ffffff"
|
||||
noshowall="true"
|
||||
visible="false"/>
|
||||
</HBox>
|
||||
</EventBox>
|
||||
|
||||
<EventBox bgnormal="#000000"
|
||||
bgactive="#000000"
|
||||
height="1"/>
|
||||
|
|
|
|||
|
|
@ -55,13 +55,32 @@
|
|||
<EventBox bgnormal="#000000"
|
||||
bgactive="#000000"
|
||||
height="1"/>
|
||||
<Button id="name_button"
|
||||
width="57"
|
||||
height="28"
|
||||
fgnormal="#ffffff"
|
||||
fgactive="#ffffff"
|
||||
winfont ="Arial 10"
|
||||
macfont ="Helvetica 10"/>
|
||||
|
||||
<EventBox id="name_label_home">
|
||||
<HBox>
|
||||
<Button id="name_button"
|
||||
width="57"
|
||||
height="28"
|
||||
fgnormal="#ffffff"
|
||||
fgactive="#ffffff"
|
||||
fghover="#ffffff"
|
||||
winfont ="Arial 10"
|
||||
macfont ="Helvetica 10"/>
|
||||
<FocusEntry id="name_entry"
|
||||
width="57"
|
||||
height="28"
|
||||
fgnormal="#ffffff"
|
||||
winfont ="Arial 10"
|
||||
macfont ="Helvetica 10"
|
||||
cssname="EditorTrackNameDisplay"
|
||||
textcolornormal="#ffffff"
|
||||
textcoloractive="#ffffff"
|
||||
textcolorselected="#ffffff"
|
||||
noshowall="true"
|
||||
visible="false"/>
|
||||
</HBox>
|
||||
</EventBox>
|
||||
|
||||
<EventBox bgnormal="#000000"
|
||||
bgactive="#000000"
|
||||
height="1"/>
|
||||
|
|
|
|||
|
|
@ -41,14 +41,18 @@ WavesDropdown::add_menu_item (const std::string& item, void* cookie)
|
|||
{
|
||||
Gtk::Menu_Helpers::MenuList& items = _menu.items ();
|
||||
|
||||
items.push_back (Gtk::Menu_Helpers::MenuElem (item, sigc::bind (sigc::mem_fun(*this, &WavesDropdown::_on_menu_item), cookie)));
|
||||
items.push_back (Gtk::Menu_Helpers::MenuElem (item, sigc::bind (sigc::mem_fun(*this, &WavesDropdown::_on_menu_item), items.size (), cookie)));
|
||||
|
||||
return _menu.items ().back ();
|
||||
}
|
||||
|
||||
void
|
||||
WavesDropdown::_on_menu_item (void* cookie)
|
||||
WavesDropdown::_on_menu_item (size_t item_number, void* cookie)
|
||||
{
|
||||
Gtk::Menu_Helpers::MenuList& items = _menu.items ();
|
||||
Gtk::Menu_Helpers::MenuList::iterator i = items.begin();
|
||||
std::advance (i, item_number);
|
||||
set_text ((*i).get_label());
|
||||
signal_menu_item_clicked (this, cookie);
|
||||
}
|
||||
|
||||
|
|
@ -71,18 +75,4 @@ WavesDropdown::_on_popup_menu_position (int& x, int& y, bool& push_in)
|
|||
x += xo;
|
||||
y += yo;
|
||||
}
|
||||
|
||||
/*
|
||||
if (get_window ()) {
|
||||
Gtk::Allocation a = get_allocation ();
|
||||
|
||||
int xo;
|
||||
int yo;
|
||||
|
||||
get_window ()->get_origin (xo, yo);
|
||||
|
||||
x = xo;
|
||||
y = yo + a.get_height ();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class WavesDropdown : public WavesIconButton
|
|||
|
||||
private:
|
||||
Gtk::Menu _menu;
|
||||
void _on_menu_item (void* cookie);
|
||||
void _on_menu_item (size_t item_number, void* cookie);
|
||||
void _on_popup_menu_position (int& x, int& y, bool& push_in);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -466,7 +466,6 @@ WavesUI::create_ui (const XMLNodeList& definition, const XMLNodeMap& styles, Gtk
|
|||
WavesDropdown* dropdown = dynamic_cast<WavesDropdown*> (&root);
|
||||
|
||||
if (dropdown) {
|
||||
dbg_msg ("launching dropdown->create_menu ()");
|
||||
add_dropdown_items (*dropdown, definition, styles);
|
||||
} else {
|
||||
for (XMLNodeList::const_iterator i = definition.begin (); i != definition.end (); ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue