summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandros Theodotou <alex@zrythm.org>2019-09-05 08:44:30 +0100
committerAlexandros Theodotou <alex@zrythm.org>2019-09-05 08:44:30 +0100
commit934f65c1feb5ae7194797055696e1a832686b109 (patch)
tree67fb41955662da1119d620da64ec9c686987448d
parent5fed102ab0a8bf674088fbc92eb1ade4a234d4b0 (diff)
downloadzrythm-934f65c1feb5ae7194797055696e1a832686b109.zip
zrythm-934f65c1feb5ae7194797055696e1a832686b109.tar.gz
zrythm-934f65c1feb5ae7194797055696e1a832686b109.tar.bz2
fix tracks getting deselected when clicking on empty space
-rw-r--r--TRANSLATORS3
-rw-r--r--doc/user/credits/intro.rst3
-rw-r--r--inc/audio/channel.h5
-rw-r--r--inc/audio/track.h14
-rw-r--r--inc/audio/track_lane.h2
-rw-r--r--inc/gui/backend/tracklist_selections.h12
-rw-r--r--inc/gui/widgets/track.h8
-rw-r--r--inc/gui/widgets/tracklist.h20
-rw-r--r--src/actions/actions.c5
-rw-r--r--src/audio/fader.c2
-rw-r--r--src/audio/port.c100
-rw-r--r--src/audio/track.c84
-rw-r--r--src/audio/track_lane.c2
-rw-r--r--src/audio/tracklist.c4
-rw-r--r--src/gui/backend/tracklist_selections.c42
-rw-r--r--src/gui/widgets/channel.c4
-rw-r--r--src/gui/widgets/drag_dest_box.c25
-rw-r--r--src/gui/widgets/fader.c6
-rw-r--r--src/gui/widgets/main_window.c1
-rw-r--r--src/gui/widgets/track.c97
-rw-r--r--src/gui/widgets/tracklist.c86
21 files changed, 267 insertions, 258 deletions
diff --git a/TRANSLATORS b/TRANSLATORS
index 081ad14..6eb2875 100644
--- a/TRANSLATORS
+++ b/TRANSLATORS
@@ -20,6 +20,9 @@ Polish:
Portuguese:
* Silvério Santos <ssantos@web.de>
+Italian:
+ * Swann Martinet
+
----
Copyright (C) 2019 Alexandros Theodotou
diff --git a/doc/user/credits/intro.rst b/doc/user/credits/intro.rst
index e24719f..e8d6c99 100644
--- a/doc/user/credits/intro.rst
+++ b/doc/user/credits/intro.rst
@@ -36,3 +36,6 @@ Polish
Portuguese:
* Silvério Santos
+
+Italian:
+ * Swann Martinet
diff --git a/inc/audio/channel.h b/inc/audio/channel.h
index 9da28cb..ef99d9e 100644
--- a/inc/audio/channel.h
+++ b/inc/audio/channel.h
@@ -231,6 +231,11 @@ channel_fields_schema[] =
Channel, midi_in,
port_fields_schema),
CYAML_FIELD_MAPPING_PTR (
+ "midi_out",
+ CYAML_FLAG_POINTER | CYAML_FLAG_OPTIONAL,
+ Channel, midi_out,
+ port_fields_schema),
+ CYAML_FIELD_MAPPING_PTR (
"piano_roll",
CYAML_FLAG_POINTER | CYAML_FLAG_OPTIONAL,
Channel, piano_roll,
diff --git a/inc/audio/track.h b/inc/audio/track.h
index 2af7d94..5fe4076 100644
--- a/inc/audio/track.h
+++ b/inc/audio/track.h
@@ -476,6 +476,20 @@ track_add_region (
int gen_name);
/**
+ * Appends the Track to the selections.
+ *
+ * @param exclusive Select only this track.
+ * @param fire_events Fire events to update the
+ * UI.
+ */
+void
+track_select (
+ Track * self,
+ int select,
+ int exclusive,
+ int fire_events);
+
+/**
* Removes the region from the track.
*
* @pararm free Also free the Region.
diff --git a/inc/audio/track_lane.h b/inc/audio/track_lane.h
index 531d128..75ac867 100644
--- a/inc/audio/track_lane.h
+++ b/inc/audio/track_lane.h
@@ -98,7 +98,7 @@ track_lane_fields_schema[] =
"solo", CYAML_FLAG_DEFAULT,
TrackLane, solo),
CYAML_FIELD_SEQUENCE_COUNT (
- "regions", CYAML_FLAG_DEFAULT,
+ "regions", CYAML_FLAG_POINTER,
TrackLane, regions, num_regions,
&region_schema, 0, CYAML_UNLIMITED),
CYAML_FIELD_INT (
diff --git a/inc/gui/backend/tracklist_selections.h b/inc/gui/backend/tracklist_selections.h
index 70ccbe0..899723d 100644
--- a/inc/gui/backend/tracklist_selections.h
+++ b/inc/gui/backend/tracklist_selections.h
@@ -126,6 +126,16 @@ tracklist_selections_select_single (
Track * track);
/**
+ * Selects all Track's.
+ *
+ * @param visible_only Only select visible tracks.
+ */
+void
+tracklist_selections_select_all (
+ TracklistSelections * ts,
+ int visible_only);
+
+/**
* Selects the last visible track after clearing the
* selections.
*/
@@ -144,7 +154,7 @@ tracklist_selections_toggle_visibility (
* For debugging.
*/
void
-tracklist_selections_gprint (
+tracklist_selections_print (
TracklistSelections * self);
/**
diff --git a/inc/gui/widgets/track.h b/inc/gui/widgets/track.h
index b06fdf9..5988ebc 100644
--- a/inc/gui/widgets/track.h
+++ b/inc/gui/widgets/track.h
@@ -155,14 +155,6 @@ TrackWidget *
track_widget_new (Track * track);
/**
- * @param select 1 to select, 0 to unselect.
- */
-void
-track_widget_select (
- TrackWidget * self,
- int select);
-
-/**
* Sets the Track name on the TrackWidget.
*/
void
diff --git a/inc/gui/widgets/tracklist.h b/inc/gui/widgets/tracklist.h
index 8ba25af..d4d5fca 100644
--- a/inc/gui/widgets/tracklist.h
+++ b/inc/gui/widgets/tracklist.h
@@ -77,26 +77,6 @@ tracklist_widget_setup (
Tracklist * tracklist);
/**
- * Selects the track, with the option to either
- * add the track to the current selection or to
- * select it exclusively.
- */
-void
-tracklist_widget_select_track (
- TracklistWidget * self,
- Track * track,
- int select,
- int append);
-
-/**
- * Selects or deselects all tracks.
- */
-void
-tracklist_widget_select_all_tracks (
- TracklistWidget *self,
- int select);
-
-/**
* Makes sure all the tracks for channels marked as
* visible are visible.
*/
diff --git a/src/actions/actions.c b/src/actions/actions.c
index 9f76a5e..d031d0f 100644
--- a/src/actions/actions.c
+++ b/src/actions/actions.c
@@ -235,7 +235,10 @@ activate_about (GSimpleAction *action,
"Nicolas Faure <sub26nico@laposte.net>\n"
"Waui <wau-wau@tutanota.de>\n"
"Allan Nordhøy <epost@anotheragency.no>\n"
- "WaldiS <admin@sto.ugu.pl>";
+ "WaldiS <admin@sto.ugu.pl>\n"
+ "Silvério Santos <ssantos@web.de>\n"
+ "Swann Martinet";
+
char * version =
zrythm_get_version (1);
diff --git a/src/audio/fader.c b/src/audio/fader.c
index 845a921..53480ae 100644
--- a/src/audio/fader.c
+++ b/src/audio/fader.c
@@ -58,6 +58,8 @@ fader_init_loaded (
default:
break;
}
+
+ fader_set_amp ((void *) self, self->amp);
}
/**
diff --git a/src/audio/port.c b/src/audio/port.c
index 071e295..1c1e777 100644
--- a/src/audio/port.c
+++ b/src/audio/port.c
@@ -185,7 +185,9 @@ port_find_from_identifier (
{
case TYPE_EVENT:
if (id->flow == FLOW_OUTPUT)
- { /* TODO */ }
+ {
+ return ch->midi_out;
+ }
else if (id->flow == FLOW_INPUT)
{
if (id->flags & PORT_FLAG_PIANO_ROLL)
@@ -221,21 +223,41 @@ port_find_from_identifier (
g_warn_if_fail (tr);
ch = tr->channel;
g_warn_if_fail (ch);
- if (id->flow == FLOW_OUTPUT)
- {
- if (id->flags & PORT_FLAG_STEREO_L)
- return ch->fader.stereo_out->l;
- else if (id->flags &
- PORT_FLAG_STEREO_R)
- return ch->fader.stereo_out->r;
- }
- else if (id->flow == FLOW_INPUT)
+ switch (id->type)
{
- if (id->flags & PORT_FLAG_STEREO_L)
- return ch->fader.stereo_in->l;
- else if (id->flags &
- PORT_FLAG_STEREO_R)
- return ch->fader.stereo_in->r;
+ case TYPE_EVENT:
+ switch (id->flow)
+ {
+ case FLOW_INPUT:
+ return ch->fader.midi_in;
+ break;
+ case FLOW_OUTPUT:
+ return ch->fader.midi_out;
+ break;
+ default:
+ break;
+ }
+ break;
+ case TYPE_AUDIO:
+ if (id->flow == FLOW_OUTPUT)
+ {
+ if (id->flags & PORT_FLAG_STEREO_L)
+ return ch->fader.stereo_out->l;
+ else if (id->flags &
+ PORT_FLAG_STEREO_R)
+ return ch->fader.stereo_out->r;
+ }
+ else if (id->flow == FLOW_INPUT)
+ {
+ if (id->flags & PORT_FLAG_STEREO_L)
+ return ch->fader.stereo_in->l;
+ else if (id->flags &
+ PORT_FLAG_STEREO_R)
+ return ch->fader.stereo_in->r;
+ }
+ break;
+ default:
+ break;
}
break;
case PORT_OWNER_TYPE_PREFADER:
@@ -243,21 +265,41 @@ port_find_from_identifier (
g_warn_if_fail (tr);
ch = tr->channel;
g_warn_if_fail (ch);
- if (id->flow == FLOW_OUTPUT)
- {
- if (id->flags & PORT_FLAG_STEREO_L)
- return ch->prefader.stereo_out->l;
- else if (id->flags &
- PORT_FLAG_STEREO_R)
- return ch->prefader.stereo_out->r;
- }
- else if (id->flow == FLOW_INPUT)
+ switch (id->type)
{
- if (id->flags & PORT_FLAG_STEREO_L)
- return ch->prefader.stereo_in->l;
- else if (id->flags &
- PORT_FLAG_STEREO_R)
- return ch->prefader.stereo_in->r;
+ case TYPE_EVENT:
+ switch (id->flow)
+ {
+ case FLOW_INPUT:
+ return ch->prefader.midi_in;
+ break;
+ case FLOW_OUTPUT:
+ return ch->prefader.midi_out;
+ break;
+ default:
+ break;
+ }
+ break;
+ case TYPE_AUDIO:
+ if (id->flow == FLOW_OUTPUT)
+ {
+ if (id->flags & PORT_FLAG_STEREO_L)
+ return ch->prefader.stereo_out->l;
+ else if (id->flags &
+ PORT_FLAG_STEREO_R)
+ return ch->prefader.stereo_out->r;
+ }
+ else if (id->flow == FLOW_INPUT)
+ {
+ if (id->flags & PORT_FLAG_STEREO_L)
+ return ch->prefader.stereo_in->l;
+ else if (id->flags &
+ PORT_FLAG_STEREO_R)
+ return ch->prefader.stereo_in->r;
+ }
+ break;
+ default:
+ break;
}
break;
case PORT_OWNER_TYPE_SAMPLE_PROCESSOR:
diff --git a/src/audio/track.c b/src/audio/track.c
index e00d5d0..85188ff 100644
--- a/src/audio/track.c
+++ b/src/audio/track.c
@@ -290,6 +290,90 @@ track_clone (Track * track)
}
/**
+ * Appends the Track to the selections.
+ *
+ * @param exclusive Select only this track.
+ * @param fire_events Fire events to update the
+ * UI.
+ */
+void
+track_select (
+ Track * self,
+ int select,
+ int exclusive,
+ int fire_events)
+{
+ if (select)
+ {
+ if (exclusive)
+ {
+ tracklist_selections_select_single (
+ TRACKLIST_SELECTIONS, self);
+ }
+ else
+ {
+ tracklist_selections_add_track (
+ TRACKLIST_SELECTIONS, self);
+ }
+ }
+ else
+ {
+ tracklist_selections_remove_track (
+ TRACKLIST_SELECTIONS,
+ self);
+ }
+
+ /* auto-set recording mode */
+ Channel * ch = self->channel;
+ switch (self->type)
+ {
+ case TRACK_TYPE_INSTRUMENT:
+ case TRACK_TYPE_AUDIO:
+ case TRACK_TYPE_MIDI:
+ g_warn_if_fail (ch);
+ g_message (
+ "%sselecting track %s, recording %d sa %d",
+ select ? "" : "de",
+ self->name,
+ self->recording,
+ ch->record_set_automatically);
+ /* if selecting the track and recording is not already
+ * on, turn these on */
+ if (select && !self->recording)
+ {
+ track_set_recording (self, 1);
+ ch->record_set_automatically = 1;
+ }
+ /* if deselecting and record mode was
+ * automatically
+ * set when the track was selected, turn
+ * these off */
+ else if (!select &&
+ ch->record_set_automatically)
+ {
+ track_set_recording (self, 0);
+ ch->record_set_automatically = 0;
+ }
+ break;
+ case TRACK_TYPE_CHORD:
+ case TRACK_TYPE_MASTER:
+ case TRACK_TYPE_AUDIO_BUS:
+ case TRACK_TYPE_AUDIO_GROUP:
+ case TRACK_TYPE_MIDI_BUS:
+ case TRACK_TYPE_MIDI_GROUP:
+ break;
+ default:
+ break;
+ }
+
+ if (fire_events)
+ {
+ EVENTS_PUSH (ET_TRACK_CHANGED,
+ self);
+ }
+}
+
+/**
* Sets recording and connects/disconnects the JACK ports.
*/
void
diff --git a/src/audio/track_lane.c b/src/audio/track_lane.c
index 8aec25b..a29bb1a 100644
--- a/src/audio/track_lane.c
+++ b/src/audio/track_lane.c
@@ -32,6 +32,8 @@ void
track_lane_init_loaded (
TrackLane * lane)
{
+ lane->regions_size =
+ lane->num_regions;
int i;
Region * region;
for (i = 0; i < lane->num_regions; i++)
diff --git a/src/audio/tracklist.c b/src/audio/tracklist.c
index 06908ec..50a5a0c 100644
--- a/src/audio/tracklist.c
+++ b/src/audio/tracklist.c
@@ -188,6 +188,10 @@ tracklist_insert_track (
track_set_pos (track, pos);
+ /* make the track the only selected track */
+ tracklist_selections_select_single (
+ TRACKLIST_SELECTIONS, track);
+
/* move other tracks */
for (int i = track->pos + 1;
i < self->num_tracks; i++)
diff --git a/src/gui/backend/tracklist_selections.c b/src/gui/backend/tracklist_selections.c
index df89eab..d4c7085 100644
--- a/src/gui/backend/tracklist_selections.c
+++ b/src/gui/backend/tracklist_selections.c
@@ -114,17 +114,43 @@ tracklist_selections_add_track (
}
}
+/**
+ * Selects all Track's.
+ *
+ * @param visible_only Only select visible tracks.
+ */
+void
+tracklist_selections_select_all (
+ TracklistSelections * ts,
+ int visible_only)
+{
+ Track * track;
+ for (int i = 0; i < TRACKLIST->num_tracks; i++)
+ {
+ track = TRACKLIST->tracks[i];
+
+ if (track->visible || !visible_only)
+ {
+ tracklist_selections_add_track (
+ ts, track);
+ }
+ }
+
+ EVENTS_PUSH (ET_TRACKLIST_SELECTIONS_CHANGED,
+ NULL);
+}
+
void
tracklist_selections_remove_track (
TracklistSelections * ts,
- Track * r)
+ Track * track)
{
if (!array_contains (ts->tracks,
ts->num_tracks,
- r))
+ track))
{
EVENTS_PUSH (ET_TRACK_CHANGED,
- r);
+ track);
EVENTS_PUSH (ET_TRACKLIST_SELECTIONS_CHANGED,
NULL);
return;
@@ -133,7 +159,7 @@ tracklist_selections_remove_track (
array_delete (
ts->tracks,
ts->num_tracks,
- r);
+ track);
EVENTS_PUSH (ET_TRACKLIST_SELECTIONS_CHANGED,
NULL);
@@ -144,16 +170,16 @@ tracklist_selections_contains_track (
TracklistSelections * self,
Track * track)
{
- return array_contains (self->tracks,
- self->num_tracks,
- track);
+ return
+ array_contains (
+ self->tracks, self->num_tracks, track);
}
/**
* For debugging.
*/
void
-tracklist_selections_gprint (
+tracklist_selections_print (
TracklistSelections * self)
{
g_message ("------ tracklist selections ------");
diff --git a/src/gui/widgets/channel.c b/src/gui/widgets/channel.c
index f69accf..b327050 100644
--- a/src/gui/widgets/channel.c
+++ b/src/gui/widgets/channel.c
@@ -137,8 +137,8 @@ on_drag_data_received (
gdk_drag_context_get_selected_action (
context);
- tracklist_selections_gprint (
- TRACKLIST_SELECTIONS);
+ /*tracklist_selections_print (*/
+ /*TRACKLIST_SELECTIONS);*/
int w =
gtk_widget_get_allocated_width (widget);
diff --git a/src/gui/widgets/drag_dest_box.c b/src/gui/widgets/drag_dest_box.c
index 7a82bbe..df7fec9 100644
--- a/src/gui/widgets/drag_dest_box.c
+++ b/src/gui/widgets/drag_dest_box.c
@@ -374,9 +374,6 @@ on_right_click (GtkGestureMultiPress *gesture,
DragDestBoxWidget * self =
Z_DRAG_DEST_BOX_WIDGET (user_data);
- tracklist_widget_select_all_tracks (
- MW_TRACKLIST, F_NO_SELECT);
-
if (n_press == 1)
{
show_context_menu (self);
@@ -384,28 +381,18 @@ on_right_click (GtkGestureMultiPress *gesture,
}
static void
-multipress_pressed (GtkGestureMultiPress *gesture,
- gint n_press,
- gdouble x,
- gdouble y,
- gpointer user_data)
+multipress_pressed (
+ GtkGestureMultiPress * gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ DragDestBoxWidget * self)
{
- DragDestBoxWidget * self =
- Z_DRAG_DEST_BOX_WIDGET (user_data);
-
GdkModifierType state_mask;
ui_get_modifier_type_from_gesture (
GTK_GESTURE_SINGLE (gesture),
&state_mask);
- if (self == TRACKLIST_DRAG_DEST_BOX)
- {
- if (!(state_mask & GDK_SHIFT_MASK ||
- state_mask & GDK_CONTROL_MASK))
- tracklist_widget_select_all_tracks (
- MW_TRACKLIST, F_NO_SELECT);
- }
-
mixer_selections_clear (
MIXER_SELECTIONS);
tracklist_selections_select_last_visible (
diff --git a/src/gui/widgets/fader.c b/src/gui/widgets/fader.c
index c40ae82..88b2578 100644
--- a/src/gui/widgets/fader.c
+++ b/src/gui/widgets/fader.c
@@ -134,9 +134,11 @@ draw_cb (
1);
cairo_set_line_width (cr, 3.0);
cairo_move_to (cr, x, y + (height - value_px));
- cairo_line_to (cr, x+ width, y + (height - value_px));
+ cairo_line_to (
+ cr, x+ width, y + (height - value_px));
cairo_stroke (cr);
- return 0;
+
+ return FALSE;
}
diff --git a/src/gui/widgets/main_window.c b/src/gui/widgets/main_window.c
index 23eddf6..43ba1ce 100644
--- a/src/gui/widgets/main_window.c
+++ b/src/gui/widgets/main_window.c
@@ -144,6 +144,7 @@ main_window_widget_refresh (MainWindowWidget * self)
GTK_WINDOW (self));
/* show track selection info */
+ g_warn_if_fail (TRACKLIST_SELECTIONS->tracks[0]);
EVENTS_PUSH (ET_TRACK_CHANGED,
TRACKLIST_SELECTIONS->tracks[0]);
EVENTS_PUSH (ET_TRACKLIST_SELECTIONS_CHANGED,
diff --git a/src/gui/widgets/track.c b/src/gui/widgets/track.c
index 3af6654..32c1456 100644
--- a/src/gui/widgets/track.c
+++ b/src/gui/widgets/track.c
@@ -66,79 +66,6 @@ G_DEFINE_TYPE_WITH_PRIVATE (TrackWidget,
track_widget,
GTK_TYPE_GRID)
-void
-track_widget_select (
- TrackWidget * self,
- int select) ///< select or not
-{
- TRACK_WIDGET_GET_PRIVATE (self);
- Track * track = tw_prv->track;
-
- if (select)
- {
- /*gtk_widget_set_state_flags (*/
- /*GTK_WIDGET (self),*/
- /*GTK_STATE_FLAG_SELECTED,*/
- /*0);*/
- tracklist_selections_add_track (
- TRACKLIST_SELECTIONS,
- track);
- }
- else
- {
- /*gtk_widget_unset_state_flags (*/
- /*GTK_WIDGET (self),*/
- /*GTK_STATE_FLAG_SELECTED);*/
- tracklist_selections_remove_track (
- TRACKLIST_SELECTIONS,
- track);
- }
-
- /* auto-set recording mode */
- Channel * chan;
- switch (track->type)
- {
- case TRACK_TYPE_INSTRUMENT:
- case TRACK_TYPE_AUDIO:
- case TRACK_TYPE_MIDI:
- chan = track->channel;
- g_message (
- "%sselecting track %s, recording %d sa %d",
- select ? "" : "de",
- track->name,
- track->recording,
- chan->record_set_automatically);
- /* if selecting the track and recording is not already
- * on, turn these on */
- if (select && !track->recording)
- {
- track_set_recording (track, 1);
- chan->record_set_automatically = 1;
- }
- /* if deselecting and record mode was automatically
- * set when the track was selected, turn these off */
- else if (!select && chan->record_set_automatically)
- {
- track_set_recording (track, 0);
- chan->record_set_automatically = 0;
- }
- track_widget_refresh (self);
- break;
- case TRACK_TYPE_CHORD:
- case TRACK_TYPE_MASTER:
- case TRACK_TYPE_AUDIO_BUS:
- case TRACK_TYPE_AUDIO_GROUP:
- case TRACK_TYPE_MIDI_BUS:
- case TRACK_TYPE_MIDI_GROUP:
- break;
- default:
- break;
- }
-
- EVENTS_PUSH (ET_TRACK_CHANGED,
- track);
-}
-
static gboolean
on_motion (GtkWidget * widget,
GdkEventMotion *event,
@@ -516,17 +443,13 @@ on_right_click (GtkGestureMultiPress *gesture,
if (state_mask & GDK_SHIFT_MASK ||
state_mask & GDK_CONTROL_MASK)
{
- tracklist_widget_select_track (
- MW_TRACKLIST,
- track,
- F_SELECT, F_APPEND);
+ track_select (
+ track, F_SELECT, 0, 1);
}
else
{
- tracklist_widget_select_track (
- MW_TRACKLIST,
- track,
- F_SELECT, F_NO_APPEND);
+ track_select (
+ track, F_SELECT, 1, 1);
}
}
if (n_press == 1)
@@ -557,14 +480,15 @@ multipress_pressed (GtkGestureMultiPress *gesture,
PROJECT->last_selection =
SELECTION_TYPE_TRACK;
- tracklist_widget_select_track (
- MW_TRACKLIST, track,
+ track_select (
+ track,
track_is_selected (track) &&
state_mask & GDK_CONTROL_MASK ?
F_NO_SELECT: F_SELECT,
(state_mask & GDK_SHIFT_MASK ||
state_mask & GDK_CONTROL_MASK) ?
- F_APPEND : F_NO_APPEND);
+ 0 : 1,
+ 1);
}
static void
@@ -573,7 +497,6 @@ on_drag_begin (GtkGestureDrag *gesture,
gdouble start_y,
TrackWidget * self)
{
- g_message ("drag begin ch");
TRACK_WIDGET_GET_PRIVATE (self);
tw_prv->selected_in_dnd = 0;
@@ -612,8 +535,8 @@ on_drag_data_received (
gdk_drag_context_get_selected_action (
context);
- tracklist_selections_gprint (
- TRACKLIST_SELECTIONS);
+ /*tracklist_selections_gprint (*/
+ /*TRACKLIST_SELECTIONS);*/
int h =
gtk_widget_get_allocated_height (widget);
diff --git a/src/gui/widgets/tracklist.c b/src/gui/widgets/tracklist.c
index a2b7629..ce83c1f 100644
--- a/src/gui/widgets/tracklist.c
+++ b/src/gui/widgets/tracklist.c
@@ -95,96 +95,22 @@ tracklist_widget_get_hit_track (
}
static gboolean
-on_key_action (GtkWidget *widget,
- GdkEventKey *event,
- gpointer user_data)
+on_key_action (
+ GtkWidget * widget,
+ GdkEventKey * event,
+ TracklistWidget * self)
{
- TracklistWidget * self = (TracklistWidget *) user_data;
-
if (event->state & GDK_CONTROL_MASK &&
event->type == GDK_KEY_PRESS &&
event->keyval == GDK_KEY_a)
{
- tracklist_widget_select_all_tracks (
- self, F_SELECT);
+ tracklist_selections_select_all (
+ TRACKLIST_SELECTIONS, 1);
}
return FALSE;
}
-/**
- * Selects or deselects all tracks.
- */
-void
-tracklist_widget_select_all_tracks (
- TracklistWidget *self,
- int select)
-{
- for (int i = 0;
- i < self->tracklist->num_tracks; i++)
- {
- Track * track = self->tracklist->tracks[i];
- if (!track->visible)
- continue;
-
- TrackWidget *tw = track->widget;
-
- track_widget_select (tw, select);
- }
- EVENTS_PUSH (ET_TRACKLIST_SELECTIONS_CHANGED,
- NULL);
-}
-
-/**
- * Selects the track, with the option to either
- * add the track to the current selection or to
- * select it exclusively.
- */
-void
-tracklist_widget_select_track (
- TracklistWidget * self,
- Track * track,
- int select,
- int append)
-{
- Track ** array =
- TRACKLIST_SELECTIONS->tracks;
- int * num =
- &TRACKLIST_SELECTIONS->num_tracks;
-
- if (select && !append)
- {
- /* deselect existing selections */
- for (int i = 0; i < (*num); i++)
- {
- Track * t = array[i];
- track_widget_select (
- t->widget, F_NO_SELECT);
- }
- }
-
- /* if we are deselecting and the item is
- * selected */
- if (!select &&
- array_contains ((void **) array,
- *num,
- track))
- {
- /* deselect track */
- track_widget_select (
- track->widget, F_NO_SELECT);
- }
- /* if selecting */
- else if (select &&
- !array_contains ((void **) array,
- *num,
- track))
- {
- track_widget_select (
- track->widget, F_SELECT);
- }
-}
-
void
tracklist_widget_hard_refresh (
TracklistWidget * self)