Fix XML serialization of EekOutline to include corner_radius.
This commit is contained in:
@ -153,6 +153,7 @@ EekOutline *
|
|||||||
eek_outline_copy (const EekOutline *outline)
|
eek_outline_copy (const EekOutline *outline)
|
||||||
{
|
{
|
||||||
EekOutline *_outline = g_slice_dup (EekOutline, outline);
|
EekOutline *_outline = g_slice_dup (EekOutline, outline);
|
||||||
|
_outline->corner_radius = outline->corner_radius;
|
||||||
_outline->num_points = outline->num_points;
|
_outline->num_points = outline->num_points;
|
||||||
_outline->points = g_slice_alloc0 (sizeof (EekPoint) * outline->num_points);
|
_outline->points = g_slice_alloc0 (sizeof (EekPoint) * outline->num_points);
|
||||||
memcpy (_outline->points, outline->points, sizeof (EekPoint) * outline->num_points);
|
memcpy (_outline->points, outline->points, sizeof (EekPoint) * outline->num_points);
|
||||||
|
|||||||
@ -62,6 +62,7 @@ struct _ParseCallbackData {
|
|||||||
EekKey *key;
|
EekKey *key;
|
||||||
gint num_columns;
|
gint num_columns;
|
||||||
EekOrientation orientation;
|
EekOrientation orientation;
|
||||||
|
gdouble corner_radius;
|
||||||
GSList *points;
|
GSList *points;
|
||||||
GSList *symbols;
|
GSList *symbols;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
@ -70,6 +71,7 @@ struct _ParseCallbackData {
|
|||||||
gint groups, levels;
|
gint groups, levels;
|
||||||
EekOutline outline;
|
EekOutline outline;
|
||||||
gchar *oref;
|
gchar *oref;
|
||||||
|
|
||||||
GHashTable *key_oref_hash;
|
GHashTable *key_oref_hash;
|
||||||
GHashTable *oref_outline_hash;
|
GHashTable *oref_outline_hash;
|
||||||
};
|
};
|
||||||
@ -97,7 +99,8 @@ static const gchar *valid_path_list[] = {
|
|||||||
"icon/symbols/key/section/keyboard",
|
"icon/symbols/key/section/keyboard",
|
||||||
"invalid/symbols/key/section/keyboard",
|
"invalid/symbols/key/section/keyboard",
|
||||||
"index/key/section/keyboard",
|
"index/key/section/keyboard",
|
||||||
"point/outline/keyboard"
|
"point/outline/keyboard",
|
||||||
|
"corner-radius/outline/keyboard",
|
||||||
};
|
};
|
||||||
|
|
||||||
static gchar *
|
static gchar *
|
||||||
@ -299,6 +302,9 @@ end_element_callback (GMarkupParseContext *pcontext,
|
|||||||
if (g_strcmp0 (element_name, "outline") == 0) {
|
if (g_strcmp0 (element_name, "outline") == 0) {
|
||||||
EekOutline *outline = g_slice_new (EekOutline);
|
EekOutline *outline = g_slice_new (EekOutline);
|
||||||
|
|
||||||
|
outline->corner_radius = data->corner_radius;
|
||||||
|
data->corner_radius = 0.0;
|
||||||
|
|
||||||
outline->num_points = g_slist_length (data->points);
|
outline->num_points = g_slist_length (data->points);
|
||||||
outline->points = g_slice_alloc0 (sizeof (EekPoint) *
|
outline->points = g_slice_alloc0 (sizeof (EekPoint) *
|
||||||
outline->num_points);
|
outline->num_points);
|
||||||
@ -318,6 +324,11 @@ end_element_callback (GMarkupParseContext *pcontext,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_strcmp0 (element_name, "corner-radius") == 0) {
|
||||||
|
data->corner_radius = g_strtod (text, NULL);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_strcmp0 (element_name, "point") == 0) {
|
if (g_strcmp0 (element_name, "point") == 0) {
|
||||||
EekPoint *point;
|
EekPoint *point;
|
||||||
|
|
||||||
|
|||||||
@ -273,6 +273,9 @@ eek_keyboard_output (EekKeyboard *keyboard, GString *output, gint indent)
|
|||||||
outline = eek_keyboard_get_outline (keyboard, oref);
|
outline = eek_keyboard_get_outline (keyboard, oref);
|
||||||
g_string_append_indent (output, indent + 1);
|
g_string_append_indent (output, indent + 1);
|
||||||
g_string_markup_printf (output, "<outline id=\"outline%u\">\n", oref);
|
g_string_markup_printf (output, "<outline id=\"outline%u\">\n", oref);
|
||||||
|
g_string_append_indent (output, indent + 2);
|
||||||
|
g_string_markup_printf (output, "<corner-radius>%lf</corner-radius>\n",
|
||||||
|
outline->corner_radius);
|
||||||
for (j = 0; j < outline->num_points; j++) {
|
for (j = 0; j < outline->num_points; j++) {
|
||||||
g_string_append_indent (output, indent + 2);
|
g_string_append_indent (output, indent + 2);
|
||||||
g_string_markup_printf (output, "<point>%lf,%lf</point>\n",
|
g_string_markup_printf (output, "<point>%lf,%lf</point>\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user