Browse Source

channel style updates

audio_region_bpm_change_fix
parent
commit
9030dfd7ec
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 5
      data/css-themes/zrythm/theme.scss
  2. 29
      inc/gui/widgets/channel.h
  3. 20
      inc/gui/widgets/track_canvas.h
  4. 2
      resources/ui/channel.ui
  5. 52
      src/gui/widgets/channel.c
  6. 20
      src/gui/widgets/track.c
  7. 129
      src/gui/widgets/track_canvas.c
  8. 20
      src/utils/cairo.c

5
data/css-themes/zrythm/theme.scss

@ -342,11 +342,6 @@ automation-lane @@ -342,11 +342,6 @@ automation-lane
font-size: small;
}
.channel_label
{
font-size: small;
}
.channel_label_smaller
{
font-size: smaller;

29
inc/gui/widgets/channel.h

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2021 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#ifndef __GUI_WIDGETS_CHANNEL_H__
#define __GUI_WIDGETS_CHANNEL_H__
@ -171,15 +155,6 @@ channel_widget_new (Channel * channel); @@ -171,15 +155,6 @@ channel_widget_new (Channel * channel);
void
channel_widget_tear_down (ChannelWidget * self);
/**
* Updates the meter reading
*/
gboolean
channel_widget_update_meter_reading (
ChannelWidget * widget,
GdkFrameClock * frame_clock,
gpointer user_data);
/**
* Updates everything on the widget.
*

20
inc/gui/widgets/track_canvas.h

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2022 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#ifndef __GUI_WIDGETS_TRACK_CANVAS_H__
#define __GUI_WIDGETS_TRACK_CANVAS_H__

2
resources/ui/channel.ui

@ -67,6 +67,7 @@ @@ -67,6 +67,7 @@
<child>
<object class="GtkBox">
<property name="name">channel-icon-box</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage" id="icon">
<property name="name">channel-icon-image</property>
@ -77,7 +78,6 @@ @@ -77,7 +78,6 @@
<child>
<object class="EditableLabelWidget" id="name">
<property name="hexpand">1</property>
<property name="visible">True</property>
</object>
</child>
</object>

52
src/gui/widgets/channel.c

@ -49,6 +49,15 @@ G_DEFINE_TYPE ( @@ -49,6 +49,15 @@ G_DEFINE_TYPE (
channel_widget,
GTK_TYPE_BOX)
/**
* Updates the meter reading
*/
static gboolean
channel_widget_tick_cb (
GtkWidget * widget,
GdkFrameClock * frame_clock,
gpointer user_data);
static void
channel_snapshot (
GtkWidget * widget,
@ -92,22 +101,39 @@ channel_snapshot ( @@ -92,22 +101,39 @@ channel_snapshot (
* that would be done via gtk_widget_set_tick_functions()
* gtk_widget_set_tick_function()
*/
gboolean
channel_widget_update_meter_reading (
ChannelWidget * self,
static gboolean
channel_widget_tick_cb (
GtkWidget * widget,
GdkFrameClock * frame_clock,
gpointer user_data)
{
double prev = self->meter_reading_val;
Channel * channel = self->channel;
ChannelWidget * self = Z_CHANNEL_WIDGET (widget);
double prev = self->meter_reading_val;
Channel * channel = self->channel;
if (!gtk_widget_get_mapped (GTK_WIDGET (self)))
{
return G_SOURCE_CONTINUE;
}
/* TODO */
Track * track = channel_get_track (channel);
if (track_is_selected (track))
{
gtk_widget_add_css_class (
GTK_WIDGET (self->name), "caption-heading");
gtk_widget_remove_css_class (
GTK_WIDGET (self->name), "caption");
}
else
{
gtk_widget_add_css_class (
GTK_WIDGET (self->name), "caption");
gtk_widget_remove_css_class (
GTK_WIDGET (self->name), "caption-heading");
}
/* TODO */
if (track->out_signal_type == TYPE_EVENT)
{
gtk_label_set_text (
@ -577,8 +603,8 @@ channel_widget_refresh (ChannelWidget * self) @@ -577,8 +603,8 @@ channel_widget_refresh (ChannelWidget * self)
{
refresh_name (self);
refresh_output (self);
channel_widget_update_meter_reading (
self, NULL, NULL);
/*channel_widget_update_meter_reading (*/
/*self, NULL, NULL);*/
channel_widget_refresh_buttons (self);
refresh_color (self);
update_reveal_status (self);
@ -983,9 +1009,8 @@ channel_widget_new (Channel * channel) @@ -983,9 +1009,8 @@ channel_widget_new (Channel * channel)
gtk_widget_add_tick_callback (
GTK_WIDGET (self),
(GtkTickCallback)
channel_widget_update_meter_reading,
self, NULL);
(GtkTickCallback) channel_widget_tick_cb, self,
NULL);
g_signal_connect (
self, "destroy", G_CALLBACK (on_destroy), NULL);
@ -1078,11 +1103,6 @@ channel_widget_init (ChannelWidget * self) @@ -1078,11 +1103,6 @@ channel_widget_init (ChannelWidget * self)
self->last_midi_trigger_time = 0;
/* set font sizes */
GtkStyleContext * context =
gtk_widget_get_style_context (
GTK_WIDGET (self->name->label));
gtk_style_context_add_class (
context, "channel_label");
gtk_label_set_max_width_chars (
self->name->label, 10);
gtk_label_set_max_width_chars (

20
src/gui/widgets/track.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2022 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "audio/audio_bus_track.h"
#include "audio/audio_group_track.h"

129
src/gui/widgets/track_canvas.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2018-2022 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "audio/control_port.h"
#include "audio/instrument_track.h"
@ -38,11 +22,9 @@ G_DEFINE_TYPE ( @@ -38,11 +22,9 @@ G_DEFINE_TYPE (
GTK_TYPE_WIDGET)
#ifdef _WOE32
# define NAME_FONT "9"
# define AUTOMATABLE_NAME_FONT "8.5"
# define AUTOMATABLE_VAL_FONT "7"
#else
# define NAME_FONT "10"
# define AUTOMATABLE_NAME_FONT "9.5"
# define AUTOMATABLE_VAL_FONT "8"
#endif
@ -69,37 +51,37 @@ recreate_icon_texture (TrackCanvasWidget * self) @@ -69,37 +51,37 @@ recreate_icon_texture (TrackCanvasWidget * self)
}
static void
recreate_pango_layouts (
update_pango_layouts (
TrackCanvasWidget * self,
int w,
int h)
{
if (PANGO_IS_LAYOUT (self->layout))
g_object_unref (self->layout);
if (PANGO_IS_LAYOUT (
self->automation_value_layout))
g_object_unref (self->automation_value_layout);
GtkWidget * widget = GTK_WIDGET (self);
PangoFontDescription * desc;
self->layout =
gtk_widget_create_pango_layout (widget, NULL);
desc =
pango_font_description_from_string (NAME_FONT);
pango_layout_set_font_description (
self->layout, desc);
pango_font_description_free (desc);
pango_layout_set_ellipsize (
self->layout, PANGO_ELLIPSIZE_END);
self->automation_value_layout =
gtk_widget_create_pango_layout (widget, NULL);
desc = pango_font_description_from_string (
AUTOMATABLE_VAL_FONT);
pango_layout_set_font_description (
self->automation_value_layout, desc);
pango_font_description_free (desc);
if (!self->layout)
{
self->layout = gtk_widget_create_pango_layout (
GTK_WIDGET (self), NULL);
pango_layout_set_ellipsize (
self->layout, PANGO_ELLIPSIZE_END);
}
if (!self->automation_value_layout)
{
self->automation_value_layout =
gtk_widget_create_pango_layout (
GTK_WIDGET (self), NULL);
PangoFontDescription * desc =
pango_font_description_from_string (
AUTOMATABLE_VAL_FONT);
pango_layout_set_font_description (
self->automation_value_layout, desc);
pango_font_description_free (desc);
}
pango_layout_set_width (
self->layout, pango_units_from_double (w));
pango_layout_set_width (
self->automation_value_layout,
pango_units_from_double (w));
}
/**
@ -201,13 +183,6 @@ draw_name ( @@ -201,13 +183,6 @@ draw_name (
TrackWidget * tw = self->parent;
Track * track = tw->track;
/* draw text */
GdkRGBA color;
if (track_is_enabled (track))
color = Z_GDK_RGBA_INIT (1, 1, 1, 1);
else
color = Z_GDK_RGBA_INIT (0.5, 0.5, 0.5, 1);
char name[strlen (track->name) + 10];
if (DEBUGGING)
{
@ -224,17 +199,16 @@ draw_name ( @@ -224,17 +199,16 @@ draw_name (
- (TRACK_BUTTON_SIZE + TRACK_BUTTON_PADDING)
* tw->num_top_buttons;
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (
snapshot, &GRAPHENE_POINT_INIT (22, 2));
PangoLayout * layout = self->layout;
pango_layout_set_text (layout, name, -1);
pango_layout_set_width (
layout,
pango_units_from_double (first_button_x - 22));
gtk_snapshot_append_layout (
snapshot, layout, &color);
gtk_snapshot_restore (snapshot);
GtkStyleContext * context =
gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_snapshot_render_layout (
snapshot, context, 22, 2, layout);
}
/**
@ -815,7 +789,7 @@ track_canvas_snapshot ( @@ -815,7 +789,7 @@ track_canvas_snapshot (
self->last_width != width
|| self->last_height != height)
{
recreate_pango_layouts (self, width, height);
update_pango_layouts (self, width, height);
}
TrackWidget * tw = self->parent;
@ -907,9 +881,42 @@ finalize (TrackCanvasWidget * self) @@ -907,9 +881,42 @@ finalize (TrackCanvasWidget * self)
->finalize (G_OBJECT (self));
}
static gboolean
tick_cb (
GtkWidget * widget,
GdkFrameClock * frame_clock,
gpointer user_data)
{
TrackCanvasWidget * self =
Z_TRACK_CANVAS_WIDGET (user_data);
TrackWidget * tw = self->parent;
Track * track = tw->track;
if (!track)
return G_SOURCE_CONTINUE;
if (track_is_selected (track))
{
gtk_widget_add_css_class (
widget, "caption-heading");
gtk_widget_remove_css_class (
widget, "caption");
}
else
{
gtk_widget_add_css_class (widget, "caption");
gtk_widget_remove_css_class (
widget, "caption-heading");
}
return G_SOURCE_CONTINUE;
}
static void
track_canvas_widget_init (TrackCanvasWidget * self)
{
gtk_widget_add_tick_callback (
GTK_WIDGET (self), tick_cb, self, NULL);
}
static void

20
src/utils/cairo.c

@ -1,21 +1,5 @@ @@ -1,21 +1,5 @@
/*
* Copyright (C) 2019-2022 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of Zrythm
*
* Zrythm is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Zrythm 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
*/
// SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
#include "zrythm-config.h"

Loading…
Cancel
Save