21 changed files with 351 additions and 115 deletions
@ -0,0 +1,95 @@
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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/>.
|
||||
*/ |
||||
|
||||
/**
|
||||
* \file |
||||
* |
||||
* PluginProperties expander widget. |
||||
*/ |
||||
|
||||
#ifndef __GUI_WIDGETS_PLUGIN_PROPERTIES_EXPANDER_H__ |
||||
#define __GUI_WIDGETS_PLUGIN_PROPERTIES_EXPANDER_H__ |
||||
|
||||
#include "audio/port.h" |
||||
#include "gui/widgets/two_col_expander_box.h" |
||||
|
||||
#include <gtk/gtk.h> |
||||
|
||||
typedef struct _EditableLabelWidget |
||||
EditableLabelWidget; |
||||
typedef struct _PluginPresetSelectorWidget |
||||
PluginPresetSelectorWidget; |
||||
typedef struct Track Track; |
||||
typedef struct Plugin Plugin; |
||||
|
||||
#define PLUGIN_PROPERTIES_EXPANDER_WIDGET_TYPE \ |
||||
(plugin_properties_expander_widget_get_type ()) |
||||
G_DECLARE_FINAL_TYPE ( |
||||
PluginPropertiesExpanderWidget, |
||||
plugin_properties_expander_widget, |
||||
Z, PLUGIN_PROPERTIES_EXPANDER_WIDGET, |
||||
TwoColExpanderBoxWidget); |
||||
|
||||
/**
|
||||
* @addtogroup widgets |
||||
* |
||||
* @{ |
||||
*/ |
||||
|
||||
/**
|
||||
* A widget for selecting plugin_properties in the plugin |
||||
* inspector. |
||||
*/ |
||||
typedef struct _PluginPropertiesExpanderWidget |
||||
{ |
||||
TwoColExpanderBoxWidget parent_instance; |
||||
|
||||
/** Plugin name. */ |
||||
GtkLabel * name; |
||||
|
||||
/** Plugin class. */ |
||||
GtkLabel * type; |
||||
|
||||
PluginPresetSelectorWidget * pset_selector; |
||||
|
||||
/** Owner plugin. */ |
||||
Plugin * plugin; |
||||
} PluginPropertiesExpanderWidget; |
||||
|
||||
/**
|
||||
* Refreshes each field. |
||||
*/ |
||||
void |
||||
plugin_properties_expander_widget_refresh ( |
||||
PluginPropertiesExpanderWidget * self, |
||||
Plugin * pl); |
||||
|
||||
/**
|
||||
* Sets up the PluginPropertiesExpanderWidget for a Plugin. |
||||
*/ |
||||
void |
||||
plugin_properties_expander_widget_setup ( |
||||
PluginPropertiesExpanderWidget * self, |
||||
Plugin * pl); |
||||
|
||||
/**
|
||||
* @} |
||||
*/ |
||||
|
||||
#endif |
@ -0,0 +1,143 @@
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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/>.
|
||||
*/ |
||||
|
||||
#include "audio/engine.h" |
||||
#include "audio/mixer.h" |
||||
#include "audio/port.h" |
||||
#include "audio/track.h" |
||||
#include "gui/widgets/editable_label.h" |
||||
#include "gui/widgets/inspector_port.h" |
||||
#include "gui/widgets/plugin_properties_expander.h" |
||||
#include "plugins/plugin.h" |
||||
#include "plugins/plugin_gtk.h" |
||||
#include "project.h" |
||||
#include "utils/gtk.h" |
||||
|
||||
#include <glib/gi18n.h> |
||||
|
||||
G_DEFINE_TYPE ( |
||||
PluginPropertiesExpanderWidget, |
||||
plugin_properties_expander_widget, |
||||
TWO_COL_EXPANDER_BOX_WIDGET_TYPE) |
||||
|
||||
/**
|
||||
* Refreshes each field. |
||||
*/ |
||||
void |
||||
plugin_properties_expander_widget_refresh ( |
||||
PluginPropertiesExpanderWidget * self, |
||||
Plugin * pl) |
||||
{ |
||||
if (pl) |
||||
{ |
||||
gtk_label_set_text ( |
||||
self->name, pl->descr->name); |
||||
gtk_label_set_text ( |
||||
self->type, pl->descr->category_str); |
||||
} |
||||
else |
||||
{ |
||||
gtk_label_set_text ( |
||||
self->name, _("None")); |
||||
gtk_label_set_text ( |
||||
self->type, _("None")); |
||||
} |
||||
} |
||||
|
||||
/**
|
||||
* Sets up the PluginPropertiesExpanderWidget for a Plugin. |
||||
*/ |
||||
void |
||||
plugin_properties_expander_widget_setup ( |
||||
PluginPropertiesExpanderWidget * self, |
||||
Plugin * pl) |
||||
{ |
||||
self->plugin = pl; |
||||
|
||||
/* set name and icon */ |
||||
expander_box_widget_set_label ( |
||||
Z_EXPANDER_BOX_WIDGET (self), |
||||
_("Plugin Properties")); |
||||
|
||||
GtkWidget * lbl; |
||||
|
||||
#define CREATE_LABEL(x) \ |
||||
lbl = \ |
||||
plugin_gtk_new_label ( \ |
||||
x, true, false, 0.f, 0.5f); \ |
||||
z_gtk_widget_add_style_class ( \ |
||||
lbl, "inspector_label"); \ |
||||
gtk_widget_set_margin_start (lbl, 2); \ |
||||
gtk_widget_set_visible (lbl, 1) |
||||
|
||||
CREATE_LABEL (_("Name")); |
||||
gtk_widget_set_visible (lbl, TRUE); |
||||
two_col_expander_box_widget_add_single ( |
||||
Z_TWO_COL_EXPANDER_BOX_WIDGET (self), lbl); |
||||
self->name = |
||||
GTK_LABEL (gtk_label_new ("dist")); |
||||
gtk_widget_set_visible ( |
||||
GTK_WIDGET (self->name), TRUE); |
||||
gtk_label_set_xalign ( |
||||
self->name, 0); |
||||
gtk_widget_set_margin_start ( |
||||
GTK_WIDGET (self->name), 4); |
||||
two_col_expander_box_widget_add_single ( |
||||
Z_TWO_COL_EXPANDER_BOX_WIDGET (self), |
||||
GTK_WIDGET (self->name)); |
||||
|
||||
CREATE_LABEL (_("Type")); |
||||
gtk_widget_set_visible (lbl, TRUE); |
||||
two_col_expander_box_widget_add_single ( |
||||
Z_TWO_COL_EXPANDER_BOX_WIDGET (self), lbl); |
||||
self->type = |
||||
GTK_LABEL (gtk_label_new ("Instrument")); |
||||
gtk_widget_set_visible ( |
||||
GTK_WIDGET (self->type), TRUE); |
||||
gtk_label_set_xalign ( |
||||
self->type, 0); |
||||
gtk_widget_set_margin_start ( |
||||
GTK_WIDGET (self->type), 4); |
||||
two_col_expander_box_widget_add_single ( |
||||
Z_TWO_COL_EXPANDER_BOX_WIDGET (self), |
||||
GTK_WIDGET (self->type)); |
||||
|
||||
CREATE_LABEL (_("Preset")); |
||||
gtk_widget_set_visible (lbl, TRUE); |
||||
two_col_expander_box_widget_add_single ( |
||||
Z_TWO_COL_EXPANDER_BOX_WIDGET (self), lbl); |
||||
|
||||
plugin_properties_expander_widget_refresh ( |
||||
self, pl); |
||||
} |
||||
|
||||
static void |
||||
plugin_properties_expander_widget_class_init ( |
||||
PluginPropertiesExpanderWidgetClass * klass) |
||||
{ |
||||
} |
||||
|
||||
static void |
||||
plugin_properties_expander_widget_init ( |
||||
PluginPropertiesExpanderWidget * self) |
||||
{ |
||||
/*two_col_expander_box_widget_add_single (*/ |
||||
/*Z_TWO_COL_EXPANDER_BOX_WIDGET (self),*/ |
||||
/*GTK_WIDGET (self->name));*/ |
||||
} |
Loading…
Reference in new issue