[SCM] calf/master: + GUI: stub support for curve, keyboard and GtkScrolledWindow (no data exchange yet)
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:37:26 UTC 2013
The following commit has been merged in the master branch:
commit 3bad6b33a531f8507743f395f35f9500af11dabd
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Thu Jul 31 20:42:28 2008 +0000
+ GUI: stub support for curve, keyboard and GtkScrolledWindow (no data exchange yet)
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@243 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/src/calf/custom_ctl.h b/src/calf/custom_ctl.h
index 372a9be..9271298 100644
--- a/src/calf/custom_ctl.h
+++ b/src/calf/custom_ctl.h
@@ -1,3 +1,23 @@
+/* Calf DSP Library
+ * A few useful widgets - a line graph, a knob, a VU meter - Panama!
+ *
+ * Copyright (C) 2008 Krzysztof Foltman
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef __CALF_CUSTOM_CTL
#define __CALF_CUSTOM_CTL
diff --git a/src/calf/gui.h b/src/calf/gui.h
index fb6a34d..a08eb94 100644
--- a/src/calf/gui.h
+++ b/src/calf/gui.h
@@ -27,6 +27,9 @@
#include <gtk/gtk.h>
#include "custom_ctl.h"
+struct CalfKeyboard;
+struct CalfCurve;
+
namespace synth {
class plugin_gui;
@@ -119,6 +122,12 @@ struct notebook_container: public control_container
virtual GtkWidget *create(plugin_gui *_gui, const char *element, xml_attribute_map &attributes);
};
+struct scrolled_container: public control_container
+{
+ virtual void add(GtkWidget *w, control_base *base);
+ virtual GtkWidget *create(plugin_gui *_gui, const char *element, xml_attribute_map &attributes);
+};
+
struct label_param_control: public param_control
{
virtual GtkWidget *create(plugin_gui *_gui, int _param_no);
@@ -207,6 +216,24 @@ struct knob_param_control: public param_control
static void knob_value_changed(GtkWidget *widget, gpointer value);
};
+struct keyboard_param_control: public param_control
+{
+ CalfKeyboard *kb;
+
+ virtual GtkWidget *create(plugin_gui *_gui, int _param_no);
+ virtual void get() {}
+ virtual void set() {}
+};
+
+struct curve_param_control: public param_control
+{
+ CalfCurve *curve;
+
+ virtual GtkWidget *create(plugin_gui *_gui, int _param_no);
+ virtual void get() {}
+ virtual void set() {}
+};
+
class plugin_gui_window;
class plugin_gui
diff --git a/src/gui.cpp b/src/gui.cpp
index 28b3b50..ada4173 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -20,6 +20,8 @@
#include <config.h>
#include <assert.h>
+#include <calf/ctl_curve.h>
+#include <calf/ctl_keyboard.h>
#include <calf/giface.h>
#include <calf/gui.h>
#include <calf/preset.h>
@@ -333,6 +335,35 @@ void knob_param_control::knob_value_changed(GtkWidget *widget, gpointer value)
jhp->get();
}
+// keyboard
+
+GtkWidget *keyboard_param_control::create(plugin_gui *_gui, int _param_no)
+{
+ gui = _gui;
+ param_no = _param_no;
+ // const parameter_properties &props = get_props();
+
+ widget = calf_keyboard_new();
+ kb = CALF_KEYBOARD(widget);
+ kb->nkeys = get_int("octaves", 4) * 7 + 1;
+ kb->sink = new CalfKeyboard::EventTester;
+ return widget;
+}
+
+// curve
+
+GtkWidget *curve_param_control::create(plugin_gui *_gui, int _param_no)
+{
+ gui = _gui;
+ param_no = _param_no;
+
+ widget = calf_curve_new();
+ curve = CALF_CURVE(widget);
+ curve->sink = new CalfCurve::EventTester;
+ // gtk_curve_set_curve_type(curve, GTK_CURVE_TYPE_LINEAR);
+ return widget;
+}
+
// line graph
void line_graph_param_control::on_idle()
@@ -573,7 +604,6 @@ GtkWidget *vbox_container::create(plugin_gui *_gui, const char *element, xml_att
/******************************** GtkNotebook container ********************************/
-
GtkWidget *notebook_container::create(plugin_gui *_gui, const char *element, xml_attribute_map &attributes)
{
GtkWidget *nb = gtk_notebook_new();
@@ -586,6 +616,27 @@ void notebook_container::add(GtkWidget *w, control_base *base)
gtk_notebook_append_page(GTK_NOTEBOOK(container), w, gtk_label_new_with_mnemonic(base->attribs["page"].c_str()));
}
+/******************************** GtkNotebook container ********************************/
+
+GtkWidget *scrolled_container::create(plugin_gui *_gui, const char *element, xml_attribute_map &attributes)
+{
+ GtkAdjustment *horiz = NULL, *vert = NULL;
+ int width = get_int("width", 0), height = get_int("height", 0);
+ if (width)
+ horiz = GTK_ADJUSTMENT(gtk_adjustment_new(get_int("x", 0), 0, width, get_int("step-x", 1), get_int("page-x", width / 10), 100));
+ if (height)
+ vert = GTK_ADJUSTMENT(gtk_adjustment_new(get_int("y", 0), 0, width, get_int("step-y", 1), get_int("page-y", height / 10), 10));
+ GtkWidget *sw = gtk_scrolled_window_new(horiz, vert);
+ gtk_widget_set_size_request(sw, get_int("req-x", -1), get_int("req-y", -1));
+ container = GTK_CONTAINER(sw);
+ return sw;
+}
+
+void scrolled_container::add(GtkWidget *w, control_base *base)
+{
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(container), w);
+}
+
/******************************** GUI proper ********************************/
param_control *plugin_gui::create_control_from_xml(const char *element, const char *attributes[])
@@ -608,6 +659,10 @@ param_control *plugin_gui::create_control_from_xml(const char *element, const ch
return new value_param_control;
if (!strcmp(element, "line-graph"))
return new line_graph_param_control;
+ if (!strcmp(element, "keyboard"))
+ return new keyboard_param_control;
+ if (!strcmp(element, "curve"))
+ return new curve_param_control;
return NULL;
}
@@ -625,6 +680,8 @@ control_container *plugin_gui::create_container_from_xml(const char *element, co
return new frame_container;
if (!strcmp(element, "notebook"))
return new notebook_container;
+ if (!strcmp(element, "scrolled"))
+ return new scrolled_container;
return NULL;
}
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list