app: add gimp_prop_polar_new()

This commit is contained in:
Michael Natterer 2014-05-30 00:33:02 +02:00
parent ca818d7c88
commit fe7aa1384d
2 changed files with 49 additions and 4 deletions

View File

@ -48,6 +48,7 @@
#include "gimpscalebutton.h"
#include "gimpspinscale.h"
#include "gimpview.h"
#include "gimppolar.h"
#include "gimppropwidgets.h"
#include "gimpwidgets-constructors.h"
#include "gimpwidgets-utils.h"
@ -808,10 +809,9 @@ gimp_prop_angle_dial_new (GObject *config,
dial = gimp_dial_new ();
g_object_set (dial,
"size", 32,
"border-width", 0,
"background", GIMP_CIRCLE_BACKGROUND_PLAIN,
"draw-beta", FALSE,
"size", 32,
"background", GIMP_CIRCLE_BACKGROUND_PLAIN,
"draw-beta", FALSE,
NULL);
set_param_spec (G_OBJECT (dial), dial, param_spec);
@ -896,6 +896,47 @@ gimp_prop_angle_range_dial_new (GObject *config,
return dial;
}
GtkWidget *
gimp_prop_polar_new (GObject *config,
const gchar *angle_property_name,
const gchar *radius_property_name)
{
GParamSpec *angle_param_spec;
GParamSpec *radius_param_spec;
GtkWidget *polar;
angle_param_spec = find_param_spec (config, angle_property_name, G_STRFUNC);
if (! angle_param_spec)
return NULL;
radius_param_spec = find_param_spec (config, radius_property_name, G_STRFUNC);
if (! radius_param_spec)
return NULL;
polar = gimp_polar_new ();
g_object_set (polar,
"size", 90,
"border-width", 3,
"background", GIMP_CIRCLE_BACKGROUND_HSV,
NULL);
g_object_bind_property_full (config, angle_property_name,
polar, "angle",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE,
deg_to_rad,
rad_to_deg,
NULL, NULL);
g_object_bind_property (config, radius_property_name,
polar, "radius",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
return polar;
}
/**********/
/* view */

View File

@ -73,6 +73,10 @@ GtkWidget * gimp_prop_angle_range_dial_new (GObject *config,
const gchar *beta_property_name,
const gchar *clockwise_property_name);
GtkWidget * gimp_prop_polar_new (GObject *config,
const gchar *angle_property_name,
const gchar *radius_property_name);
/* GParamObject (GimpViewable) */