Commit a9c03566 authored by Daiki Ueno's avatar Daiki Ueno
Browse files

Fix XML serialization of EekOutline to include corner_radius.

parent b25a9a54
......@@ -153,6 +153,7 @@ EekOutline *
eek_outline_copy (const EekOutline *outline)
{
EekOutline *_outline = g_slice_dup (EekOutline, outline);
_outline->corner_radius = outline->corner_radius;
_outline->num_points = outline->num_points;
_outline->points = g_slice_alloc0 (sizeof (EekPoint) * outline->num_points);
memcpy (_outline->points, outline->points, sizeof (EekPoint) * outline->num_points);
......
......@@ -62,6 +62,7 @@ struct _ParseCallbackData {
EekKey *key;
gint num_columns;
EekOrientation orientation;
gdouble corner_radius;
GSList *points;
GSList *symbols;
gchar *label;
......@@ -70,6 +71,7 @@ struct _ParseCallbackData {
gint groups, levels;
EekOutline outline;
gchar *oref;
GHashTable *key_oref_hash;
GHashTable *oref_outline_hash;
};
......@@ -97,7 +99,8 @@ static const gchar *valid_path_list[] = {
"icon/symbols/key/section/keyboard",
"invalid/symbols/key/section/keyboard",
"index/key/section/keyboard",
"point/outline/keyboard"
"point/outline/keyboard",
"corner-radius/outline/keyboard",
};
static gchar *
......@@ -298,7 +301,10 @@ end_element_callback (GMarkupParseContext *pcontext,
if (g_strcmp0 (element_name, "outline") == 0) {
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->points = g_slice_alloc0 (sizeof (EekPoint) *
outline->num_points);
......@@ -318,6 +324,11 @@ end_element_callback (GMarkupParseContext *pcontext,
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) {
EekPoint *point;
......
......@@ -273,6 +273,9 @@ eek_keyboard_output (EekKeyboard *keyboard, GString *output, gint indent)
outline = eek_keyboard_get_outline (keyboard, oref);
g_string_append_indent (output, indent + 1);
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++) {
g_string_append_indent (output, indent + 2);
g_string_markup_printf (output, "<point>%lf,%lf</point>\n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment