When dragging a new tab, peek at the color it will be assigned

This commit is contained in:
Ben Loftis
2025-01-09 11:08:07 -06:00
committed by Robin Gareus
parent be74cf1c9c
commit 8dc50ac33c
5 changed files with 23 additions and 3 deletions

View File

@@ -22,6 +22,7 @@
#include "ardour/route_group.h"
#include "gtkmm2ext/colors.h"
#include "gtkmm2ext/rgb_macros.h"
#include "editor.h"
#include "editor_group_tabs.h"
@@ -29,6 +30,7 @@
#include "editor_routes.h"
#include "route_time_axis.h"
#include "ui_config.h"
#include "utils.h"
#include "pbd/i18n.h"
@@ -99,6 +101,10 @@ EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab)
if (tab.group && tab.group->is_active()) {
Gtkmm2ext::color_to_rgba (tab.color, r, g, b, a);
} else if (!tab.group && _dragging_new_tab) {
Gdk::Color col = ARDOUR_UI_UTILS::round_robin_palette_color (true);
color_t ct = Gtkmm2ext::gdk_color_to_rgba (col);
Gtkmm2ext::color_to_rgba (ct, r, g, b, a);
} else {
Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("inactive group tab"), r, g, b, a);
}

View File

@@ -49,9 +49,9 @@ using Gtkmm2ext::Keyboard;
list<Gdk::Color> GroupTabs::_used_colors;
GroupTabs::GroupTabs ()
: _menu (0)
: _dragging_new_tab (0)
, _menu (0)
, _dragging (0)
, _dragging_new_tab (0)
, _extent (-1)
, _offset (0)
, _hovering (false)

View File

@@ -91,6 +91,8 @@ protected:
/** @return Scroll offset of \ref visible_extent along the primary axis */
double offset () const { return _offset; }
bool _dragging_new_tab; ///< true if we're dragging a new tab
private:
static void emit_gui_changed_for_members (std::shared_ptr<ARDOUR::RouteList>);
@@ -164,7 +166,6 @@ private:
Tab* _dragging; ///< tab being dragged, or 0
/** routes that were in the tab that is being dragged when the drag started */
ARDOUR::RouteList _initial_dragging_routes;
bool _dragging_new_tab; ///< true if we're dragging a new tab
bool _drag_moved; ///< true if there has been movement during any current drag
double _drag_fixed; ///< the position of the fixed end of the tab being dragged
double _drag_moving; ///< the position of the moving end of the tab being dragged

View File

@@ -25,6 +25,7 @@
#include "ardour/route_group.h"
#include "gtkmm2ext/colors.h"
#include "gtkmm2ext/rgb_macros.h"
#include "mixer_group_tabs.h"
#include "mixer_strip.h"
@@ -115,6 +116,10 @@ MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab)
if (tab.group && tab.group->is_active()) {
Gtkmm2ext::color_to_rgba (tab.color, r, g, b, a);
} else if (!tab.group && _dragging_new_tab) {
Gdk::Color col = ARDOUR_UI_UTILS::round_robin_palette_color (true);
color_t ct = Gtkmm2ext::gdk_color_to_rgba (col);
Gtkmm2ext::color_to_rgba (ct, r, g, b, a);
} else {
Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("inactive group tab"), r, g, b, a);
}

View File

@@ -16,11 +16,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "gtkmm2ext/rgb_macros.h"
#include "recorder_group_tabs.h"
#include "recorder_ui.h"
#include "track_record_axis.h"
#include "ui_config.h"
#include "utils.h"
#ifdef WAF_BUILD
#include "gtk2ardour-config.h"
#endif
@@ -117,6 +121,10 @@ RecorderGroupTabs::draw_tab (cairo_t* cr, Tab const& tab)
if (tab.group && tab.group->is_active ()) {
Gtkmm2ext::color_to_rgba (tab.color, r, g, b, a);
} else if (!tab.group && _dragging_new_tab) {
Gdk::Color col = ARDOUR_UI_UTILS::round_robin_palette_color (true);
color_t ct = Gtkmm2ext::gdk_color_to_rgba (col);
Gtkmm2ext::color_to_rgba (ct, r, g, b, a);
} else {
Gtkmm2ext::color_to_rgba (UIConfiguration::instance ().color ("inactive group tab"), r, g, b, a);
}