From 23493bebb26d34afe1bef20f42cc94a17aa5e868 Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Sun, 13 Apr 2025 06:31:50 -0400 Subject: [PATCH 01/14] Add remaining divided cases to divided function --- src/svg.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/svg.c b/src/svg.c index d149437e..bc50a315 100644 --- a/src/svg.c +++ b/src/svg.c @@ -576,11 +576,33 @@ divided (GridLayout *layout) xpos = coord.column / 2 * (g->border_size + g->cell_size) + g->border_size; ypos = coord.row / 2 * (g->border_size + g->cell_size) + g->border_size; + // TODO: REMOVE + gint r = g_random_int_range(0, 6); + switch (r) { + case 0: divided = IPUZ_STYLE_DIVIDED_HORIZ; id = "divided_horiz"; break; + case 1: divided = IPUZ_STYLE_DIVIDED_VERT; id = "divided_vert"; break; + case 2: divided = IPUZ_STYLE_DIVIDED_UP_RIGHT; id = "divided_up_right"; break; + case 3: divided = IPUZ_STYLE_DIVIDED_UP_LEFT; id = "divided_up_left"; break; + case 4: divided = IPUZ_STYLE_DIVIDED_PLUS; id = "divided_plus"; break; + case 5: divided = IPUZ_STYLE_DIVIDED_CROSS; id = "divided_cross"; break; + } + + if (g_random_double() < 0.5) + divided = IPUZ_STYLE_DIVIDED_HORIZ; + else + divided = IPUZ_STYLE_DIVIDED_VERT; if (divided == IPUZ_STYLE_DIVIDED_HORIZ) id = "divided_horiz"; else if (divided == IPUZ_STYLE_DIVIDED_VERT) id = "divided_vert"; - /* FIXME: handle the rest */ + else if (divided = IPUZ_STYLE_DIVIDED_UP_RIGHT) + id = "divided_up_right"; + else if (divided = IPUZ_STYLE_DIVIDED_UP_LEFT) + id = "divided_up_left"; + else if (divided = IPUZ_STYLE_DIVIDED_PLUS) + id = "divided_plus"; + else if (divided = IPUZ_STYLE_DIVIDED_CROSS) + id = "divided_cross"; if (id) append (s, positioned_instance (id, NULL, xpos, ypos)); -- GitLab From 7dd346c669e7b39592000d86941af40b290426f2 Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Sun, 13 Apr 2025 08:25:46 -0400 Subject: [PATCH 02/14] Add support for divided_plus --- src/svg.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/svg.c b/src/svg.c index bc50a315..d324cbbf 100644 --- a/src/svg.c +++ b/src/svg.c @@ -189,6 +189,29 @@ overlay_definitions (LayoutGeometry *g) g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), g->cell_size); + g_string_append_printf (s, + "\n", + g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), + g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), + g->cell_size); + g_string_append_printf (s, + "\n", + g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), + g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), + g->cell_size); + g_string_append_printf (s, + "\n", + g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), + g->cell_size, + g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), + g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), + g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), + g->cell_size); + g_string_append_printf (s, + "\n", + g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), + g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), + g->cell_size); /* The following arrows come from docs/arrows.svg */ g_ascii_dtostr (buf_a, sizeof (buf_a), scale_for_arrows (g)); @@ -587,21 +610,17 @@ divided (GridLayout *layout) case 5: divided = IPUZ_STYLE_DIVIDED_CROSS; id = "divided_cross"; break; } - if (g_random_double() < 0.5) - divided = IPUZ_STYLE_DIVIDED_HORIZ; - else - divided = IPUZ_STYLE_DIVIDED_VERT; if (divided == IPUZ_STYLE_DIVIDED_HORIZ) id = "divided_horiz"; else if (divided == IPUZ_STYLE_DIVIDED_VERT) id = "divided_vert"; - else if (divided = IPUZ_STYLE_DIVIDED_UP_RIGHT) + else if (divided == IPUZ_STYLE_DIVIDED_UP_RIGHT) id = "divided_up_right"; - else if (divided = IPUZ_STYLE_DIVIDED_UP_LEFT) + else if (divided == IPUZ_STYLE_DIVIDED_UP_LEFT) id = "divided_up_left"; - else if (divided = IPUZ_STYLE_DIVIDED_PLUS) + else if (divided == IPUZ_STYLE_DIVIDED_PLUS) id = "divided_plus"; - else if (divided = IPUZ_STYLE_DIVIDED_CROSS) + else if (divided == IPUZ_STYLE_DIVIDED_CROSS) id = "divided_cross"; if (id) -- GitLab From 5a2ff27729162981f8babf3a7e7aeab706f269a6 Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Sun, 13 Apr 2025 09:44:06 -0400 Subject: [PATCH 03/14] Add math dep --- src/meson.build | 4 ++++ src/svg.c | 22 ++++++++++++++-------- thumbnailer/meson.build | 4 ++++ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/meson.build b/src/meson.build index 75b11353..dfd1c51b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -235,6 +235,9 @@ gen_word_list_resource = executable( install: false, ) +cc = meson.get_compiler('c') +m_dep = cc.find_library('m', required : false) + crosswords_deps = [ dependency('gio-2.0', version: '>= 2.50'), dependency('gtk4', version: '>= 4.2'), @@ -244,6 +247,7 @@ crosswords_deps = [ libadwaita_dep, librsvg_dep, libword_list_dep, + m_dep, ] crosswords_resource_file_config = configuration_data() diff --git a/src/svg.c b/src/svg.c index d324cbbf..1d5a9d15 100644 --- a/src/svg.c +++ b/src/svg.c @@ -21,6 +21,8 @@ #include "crosswords-config.h" #include "svg.h" +#include + /* appends src to dest and consumes src */ static void append (GString *dest, GString *src) @@ -190,22 +192,26 @@ overlay_definitions (LayoutGeometry *g) g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), g->cell_size); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), - g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), - g->cell_size); + g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2 * pow (g->cell_size, 2))), + g_ascii_dtostr (buf_c, sizeof (buf_c), half_border), + buf_a, + buf_a); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), - g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), - g->cell_size); + g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2 * pow (g->cell_size, 2))), + g_ascii_dtostr (buf_c, sizeof (buf_c), half_border), + buf_a, + buf_a); g_string_append_printf (s, "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g->cell_size, g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), - g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), - g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), + buf_a, + buf_b, g->cell_size); g_string_append_printf (s, "\n", diff --git a/thumbnailer/meson.build b/thumbnailer/meson.build index 7c500fac..6d71f326 100644 --- a/thumbnailer/meson.build +++ b/thumbnailer/meson.build @@ -16,6 +16,9 @@ thumbnailer_sources = [ 'crosswords-thumbnailer.c' ] + common_sources + enum_sources +cc = meson.get_compiler('c') +m_dep = cc.find_library('m', required : false) + thumbnailer_deps = [ gtk4_dep, json_glib_dep, @@ -23,6 +26,7 @@ thumbnailer_deps = [ libadwaita_dep, librsvg_dep, libword_list_dep, + m_dep, ] thumbnailer = executable( -- GitLab From 301b4da8b39aabc078c4783b976089187bac9531 Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Sun, 13 Apr 2025 12:50:33 -0400 Subject: [PATCH 04/14] Begin work on diagonal divider --- src/style.css | 2 +- src/svg.c | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/style.css b/src/style.css index 7d93a435..fb5fcc90 100644 --- a/src/style.css +++ b/src/style.css @@ -415,4 +415,4 @@ histogram label.bar { window.edit label.answer { font-size: 16pt; -} +} \ No newline at end of file diff --git a/src/svg.c b/src/svg.c index 1d5a9d15..e343e265 100644 --- a/src/svg.c +++ b/src/svg.c @@ -99,8 +99,11 @@ overlay_definitions (LayoutGeometry *g) gchar buf_a[G_ASCII_DTOSTR_BUF_SIZE]; gchar buf_b[G_ASCII_DTOSTR_BUF_SIZE]; gchar buf_c[G_ASCII_DTOSTR_BUF_SIZE]; + gchar buf_d[G_ASCII_DTOSTR_BUF_SIZE]; + gchar buf_e[G_ASCII_DTOSTR_BUF_SIZE]; double half_border = (double) g->border_size / 2.0; + double quarter_border = (double) g->border_size / 4.0; double double_border = (double) g->border_size * 2.0; double corner_radius = (double) g->border_size; g_string_append (s, "\n"); @@ -192,19 +195,20 @@ overlay_definitions (LayoutGeometry *g) g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), g->cell_size); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2 * pow (g->cell_size, 2))), - g_ascii_dtostr (buf_c, sizeof (buf_c), half_border), + g_ascii_dtostr (buf_d, sizeof (buf_c), half_border), + g_ascii_dtostr (buf_c, sizeof (buf_d), - quarter_border), buf_a, - buf_a); + buf_a, + g_ascii_dtostr (buf_e, sizeof (buf_e), sqrt (2 * pow (g->cell_size, 2)) / 2) + ); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), - g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2 * pow (g->cell_size, 2))), - g_ascii_dtostr (buf_c, sizeof (buf_c), half_border), - buf_a, - buf_a); + g->cell_size, + g_ascii_dtostr (buf_b, sizeof (buf_b), half_border)); g_string_append_printf (s, "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), @@ -219,6 +223,8 @@ overlay_definitions (LayoutGeometry *g) g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), g->cell_size); + printf("%s\n", s->str); + /* The following arrows come from docs/arrows.svg */ g_ascii_dtostr (buf_a, sizeof (buf_a), scale_for_arrows (g)); @@ -606,7 +612,7 @@ divided (GridLayout *layout) ypos = coord.row / 2 * (g->border_size + g->cell_size) + g->border_size; // TODO: REMOVE - gint r = g_random_int_range(0, 6); + gint r = g_random_int_range(1, 3); switch (r) { case 0: divided = IPUZ_STYLE_DIVIDED_HORIZ; id = "divided_horiz"; break; case 1: divided = IPUZ_STYLE_DIVIDED_VERT; id = "divided_vert"; break; -- GitLab From 5ca3d34e4474dd19e0cfd7d40cedc275f8a0e258 Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Sun, 13 Apr 2025 14:56:30 -0400 Subject: [PATCH 05/14] Finish divided_up_right --- src/svg.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/svg.c b/src/svg.c index e343e265..08096f38 100644 --- a/src/svg.c +++ b/src/svg.c @@ -195,15 +195,14 @@ overlay_definitions (LayoutGeometry *g) g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), g->cell_size); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), - g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2 * pow (g->cell_size, 2))), - g_ascii_dtostr (buf_d, sizeof (buf_c), half_border), - g_ascii_dtostr (buf_c, sizeof (buf_d), - quarter_border), + g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2) * g->cell_size), + g_ascii_dtostr (buf_c, sizeof (buf_c), half_border), buf_a, buf_a, - g_ascii_dtostr (buf_e, sizeof (buf_e), sqrt (2 * pow (g->cell_size, 2)) / 2) - ); + g_ascii_dtostr (buf_d, sizeof (buf_d), - (sqrt (2) * g->cell_size - g->cell_size) / 2), + g_ascii_dtostr (buf_e, sizeof (buf_e), - quarter_border)); g_string_append_printf (s, "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), -- GitLab From f83d36efd050de74ecf70e0ce7f360b3379ab32b Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Sun, 13 Apr 2025 15:01:16 -0400 Subject: [PATCH 06/14] Finish divided_up_left --- src/svg.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/svg.c b/src/svg.c index 08096f38..782b22af 100644 --- a/src/svg.c +++ b/src/svg.c @@ -204,10 +204,14 @@ overlay_definitions (LayoutGeometry *g) g_ascii_dtostr (buf_d, sizeof (buf_d), - (sqrt (2) * g->cell_size - g->cell_size) / 2), g_ascii_dtostr (buf_e, sizeof (buf_e), - quarter_border)); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), - g->cell_size, - g_ascii_dtostr (buf_b, sizeof (buf_b), half_border)); + g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2) * g->cell_size), + g_ascii_dtostr (buf_c, sizeof (buf_c), half_border), + buf_a, + buf_a, + g_ascii_dtostr (buf_d, sizeof (buf_d), - (sqrt (2) * g->cell_size - g->cell_size) / 2), + g_ascii_dtostr (buf_e, sizeof (buf_e), - quarter_border)); g_string_append_printf (s, "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), @@ -611,7 +615,7 @@ divided (GridLayout *layout) ypos = coord.row / 2 * (g->border_size + g->cell_size) + g->border_size; // TODO: REMOVE - gint r = g_random_int_range(1, 3); + gint r = g_random_int_range(1, 4); switch (r) { case 0: divided = IPUZ_STYLE_DIVIDED_HORIZ; id = "divided_horiz"; break; case 1: divided = IPUZ_STYLE_DIVIDED_VERT; id = "divided_vert"; break; -- GitLab From 035f0f57b8b880f214af96c43dfed07a4e7d6feb Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Sun, 13 Apr 2025 15:14:02 -0400 Subject: [PATCH 07/14] Finish divided_cross --- src/svg.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/svg.c b/src/svg.c index 782b22af..076cec6c 100644 --- a/src/svg.c +++ b/src/svg.c @@ -221,10 +221,21 @@ overlay_definitions (LayoutGeometry *g) buf_b, g->cell_size); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), - g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), - g->cell_size); + g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2) * g->cell_size), + g_ascii_dtostr (buf_c, sizeof (buf_c), half_border), + buf_a, + buf_a, + g_ascii_dtostr (buf_d, sizeof (buf_d), - (sqrt (2) * g->cell_size - g->cell_size) / 2), + g_ascii_dtostr (buf_e, sizeof (buf_e), - quarter_border), + buf_a, + buf_b, + buf_c, + buf_a, + buf_a, + buf_d, + buf_e); printf("%s\n", s->str); @@ -615,7 +626,7 @@ divided (GridLayout *layout) ypos = coord.row / 2 * (g->border_size + g->cell_size) + g->border_size; // TODO: REMOVE - gint r = g_random_int_range(1, 4); + gint r = g_random_int_range(1, 6); switch (r) { case 0: divided = IPUZ_STYLE_DIVIDED_HORIZ; id = "divided_horiz"; break; case 1: divided = IPUZ_STYLE_DIVIDED_VERT; id = "divided_vert"; break; -- GitLab From 0f6b0d0295e0026947b438363e599d284928f229 Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Sun, 13 Apr 2025 15:38:22 -0400 Subject: [PATCH 08/14] Fix alignment for vertical and horizontal dividers --- src/svg.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/svg.c b/src/svg.c index 076cec6c..ca5105ea 100644 --- a/src/svg.c +++ b/src/svg.c @@ -185,15 +185,17 @@ overlay_definitions (LayoutGeometry *g) /* divided */ g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g->cell_size, - g_ascii_dtostr (buf_b, sizeof (buf_b), half_border)); + g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), + g_ascii_dtostr (buf_c, sizeof (buf_c), - quarter_border)); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), - g->cell_size); + g->cell_size, + g_ascii_dtostr (buf_c, sizeof (buf_c), - quarter_border)); g_string_append_printf (s, "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), @@ -213,13 +215,15 @@ overlay_definitions (LayoutGeometry *g) g_ascii_dtostr (buf_d, sizeof (buf_d), - (sqrt (2) * g->cell_size - g->cell_size) / 2), g_ascii_dtostr (buf_e, sizeof (buf_e), - quarter_border)); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g->cell_size, g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), + g_ascii_dtostr (buf_c, sizeof (buf_c), - quarter_border), buf_a, buf_b, - g->cell_size); + g->cell_size, + buf_c); g_string_append_printf (s, "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), @@ -626,7 +630,7 @@ divided (GridLayout *layout) ypos = coord.row / 2 * (g->border_size + g->cell_size) + g->border_size; // TODO: REMOVE - gint r = g_random_int_range(1, 6); + gint r = g_random_int_range(0, 6); switch (r) { case 0: divided = IPUZ_STYLE_DIVIDED_HORIZ; id = "divided_horiz"; break; case 1: divided = IPUZ_STYLE_DIVIDED_VERT; id = "divided_vert"; break; -- GitLab From a3b4cdb92e82f72f0a90cee79ae7176e6f0b75b9 Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Sun, 13 Apr 2025 15:42:19 -0400 Subject: [PATCH 09/14] Remove debugging code --- src/svg.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/svg.c b/src/svg.c index ca5105ea..702207f7 100644 --- a/src/svg.c +++ b/src/svg.c @@ -241,8 +241,6 @@ overlay_definitions (LayoutGeometry *g) buf_d, buf_e); - printf("%s\n", s->str); - /* The following arrows come from docs/arrows.svg */ g_ascii_dtostr (buf_a, sizeof (buf_a), scale_for_arrows (g)); @@ -629,17 +627,6 @@ divided (GridLayout *layout) xpos = coord.column / 2 * (g->border_size + g->cell_size) + g->border_size; ypos = coord.row / 2 * (g->border_size + g->cell_size) + g->border_size; - // TODO: REMOVE - gint r = g_random_int_range(0, 6); - switch (r) { - case 0: divided = IPUZ_STYLE_DIVIDED_HORIZ; id = "divided_horiz"; break; - case 1: divided = IPUZ_STYLE_DIVIDED_VERT; id = "divided_vert"; break; - case 2: divided = IPUZ_STYLE_DIVIDED_UP_RIGHT; id = "divided_up_right"; break; - case 3: divided = IPUZ_STYLE_DIVIDED_UP_LEFT; id = "divided_up_left"; break; - case 4: divided = IPUZ_STYLE_DIVIDED_PLUS; id = "divided_plus"; break; - case 5: divided = IPUZ_STYLE_DIVIDED_CROSS; id = "divided_cross"; break; - } - if (divided == IPUZ_STYLE_DIVIDED_HORIZ) id = "divided_horiz"; else if (divided == IPUZ_STYLE_DIVIDED_VERT) -- GitLab From 979f92c39ec84e5a27d3f33ae20ecdb22ce5520d Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Sun, 13 Apr 2025 15:51:37 -0400 Subject: [PATCH 10/14] Make small fixes --- src/meson.build | 2 +- src/style.css | 2 +- thumbnailer/meson.build | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/meson.build b/src/meson.build index dfd1c51b..fc9c82a6 100644 --- a/src/meson.build +++ b/src/meson.build @@ -236,7 +236,7 @@ gen_word_list_resource = executable( ) cc = meson.get_compiler('c') -m_dep = cc.find_library('m', required : false) +m_dep = cc.find_library('m', required : true) crosswords_deps = [ dependency('gio-2.0', version: '>= 2.50'), diff --git a/src/style.css b/src/style.css index fb5fcc90..7d93a435 100644 --- a/src/style.css +++ b/src/style.css @@ -415,4 +415,4 @@ histogram label.bar { window.edit label.answer { font-size: 16pt; -} \ No newline at end of file +} diff --git a/thumbnailer/meson.build b/thumbnailer/meson.build index 6d71f326..3f5bbf58 100644 --- a/thumbnailer/meson.build +++ b/thumbnailer/meson.build @@ -17,7 +17,7 @@ thumbnailer_sources = [ ] + common_sources + enum_sources cc = meson.get_compiler('c') -m_dep = cc.find_library('m', required : false) +m_dep = cc.find_library('m', required : true) thumbnailer_deps = [ gtk4_dep, -- GitLab From 78795197b6e455786d4971616f4ced6c624c2941 Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Wed, 16 Apr 2025 18:59:13 -0400 Subject: [PATCH 11/14] Get focused color working for simple dividers --- src/svg.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/svg.c b/src/svg.c index 702207f7..4432b49f 100644 --- a/src/svg.c +++ b/src/svg.c @@ -185,19 +185,19 @@ overlay_definitions (LayoutGeometry *g) /* divided */ g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g->cell_size, g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), g_ascii_dtostr (buf_c, sizeof (buf_c), - quarter_border)); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), g->cell_size, g_ascii_dtostr (buf_c, sizeof (buf_c), - quarter_border)); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2) * g->cell_size), g_ascii_dtostr (buf_c, sizeof (buf_c), half_border), @@ -206,7 +206,7 @@ overlay_definitions (LayoutGeometry *g) g_ascii_dtostr (buf_d, sizeof (buf_d), - (sqrt (2) * g->cell_size - g->cell_size) / 2), g_ascii_dtostr (buf_e, sizeof (buf_e), - quarter_border)); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2) * g->cell_size), g_ascii_dtostr (buf_c, sizeof (buf_c), half_border), @@ -604,6 +604,8 @@ divided (GridLayout *layout) { IpuzStyleDivided divided = IPUZ_STYLE_DIVIDED_NONE; LayoutItemKind kind; + LayoutItemCellStyle cell_style; + gchar *classes = ""; GridCoord coord = { .row = row, .column = column, @@ -615,11 +617,13 @@ divided (GridLayout *layout) { LayoutCell cell = grid_layout_get_cell (layout, coord); divided = cell.divided; + cell_style = cell.css_class; } else if (kind == LAYOUT_ITEM_KIND_CLUE_BLOCK_CELL) { LayoutClueBlockCell cell = grid_layout_get_clue_block_cell (layout, coord); divided = cell.divided; + cell_style = cell.css_class; } else continue; @@ -640,8 +644,11 @@ divided (GridLayout *layout) else if (divided == IPUZ_STYLE_DIVIDED_CROSS) id = "divided_cross"; + if (cell_style == LAYOUT_ITEM_STYLE_FOCUSED) + classes = "divided-focused"; + if (id) - append (s, positioned_instance (id, NULL, xpos, ypos)); + append (s, positioned_instance (id, classes, xpos, ypos)); } } @@ -845,6 +852,7 @@ svg_overlays_from_layout (GridLayout *layout) static const char dark_stylesheet[] = ".barred-focused { fill: #1a5fb4; }\n" + ".divided-focused { fill: #1a5fb4; }\n" ".border { fill: black; }\n" ".enumeration { fill: #888888; }\n" ".arrow { fill: black; }\n" @@ -852,6 +860,7 @@ static const char dark_stylesheet[] = static const char light_stylesheet[] = ".barred-focused { fill: #1a5fb4; }\n" + ".divided-focused { fill: #1a5fb4; }\n" ".border { fill: black; }\n" ".enumeration { fill: #888888; }\n" ".arrow { fill: black; }\n" -- GitLab From 385a83a8203bdd2d3fd4a81c52c33fc6de59d80e Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Wed, 16 Apr 2025 19:41:59 -0400 Subject: [PATCH 12/14] Get focused color working for compound dividers --- src/svg.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/svg.c b/src/svg.c index 4432b49f..c9db6c19 100644 --- a/src/svg.c +++ b/src/svg.c @@ -215,7 +215,7 @@ overlay_definitions (LayoutGeometry *g) g_ascii_dtostr (buf_d, sizeof (buf_d), - (sqrt (2) * g->cell_size - g->cell_size) / 2), g_ascii_dtostr (buf_e, sizeof (buf_e), - quarter_border)); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g->cell_size, g_ascii_dtostr (buf_b, sizeof (buf_b), half_border), @@ -225,7 +225,7 @@ overlay_definitions (LayoutGeometry *g) g->cell_size, buf_c); g_string_append_printf (s, - "\n", + "\n", g_ascii_dtostr (buf_a, sizeof (buf_a), g->cell_size/2.0), g_ascii_dtostr (buf_b, sizeof (buf_b), sqrt (2) * g->cell_size), g_ascii_dtostr (buf_c, sizeof (buf_c), half_border), @@ -644,8 +644,13 @@ divided (GridLayout *layout) else if (divided == IPUZ_STYLE_DIVIDED_CROSS) id = "divided_cross"; - if (cell_style == LAYOUT_ITEM_STYLE_FOCUSED) + if (cell_style == LAYOUT_ITEM_STYLE_FOCUSED + || cell_style == LAYOUT_ITEM_STYLE_FOCUSED_BLOCK + || cell_style == LAYOUT_ITEM_STYLE_SELECTED_FOCUSED + || cell_style == LAYOUT_ITEM_STYLE_SELECTED_FOCUSED_BLOCK) classes = "divided-focused"; + else + classes = "divided"; if (id) append (s, positioned_instance (id, classes, xpos, ypos)); @@ -852,6 +857,7 @@ svg_overlays_from_layout (GridLayout *layout) static const char dark_stylesheet[] = ".barred-focused { fill: #1a5fb4; }\n" + ".divided { fill: black; }\n" ".divided-focused { fill: #1a5fb4; }\n" ".border { fill: black; }\n" ".enumeration { fill: #888888; }\n" @@ -860,6 +866,7 @@ static const char dark_stylesheet[] = static const char light_stylesheet[] = ".barred-focused { fill: #1a5fb4; }\n" + ".divided { fill: black; }\n" ".divided-focused { fill: #1a5fb4; }\n" ".border { fill: black; }\n" ".enumeration { fill: #888888; }\n" -- GitLab From 7a7014db95e8af34c38f76df8c5e5fb75138634c Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Thu, 17 Apr 2025 01:19:28 -0400 Subject: [PATCH 13/14] Move m_dep to root meson.build --- meson.build | 3 +++ src/meson.build | 2 -- thumbnailer/meson.build | 3 --- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index d64bb837..36b20d94 100644 --- a/meson.build +++ b/meson.build @@ -101,6 +101,9 @@ endif libipuz_dep = dependency('libipuz-0.5', version: '>= 0.5.1') +cc = meson.get_compiler('c') +m_dep = cc.find_library('m', required : true) + word_list_inc = include_directories('src') # Variables used to translate puzzle_sets diff --git a/src/meson.build b/src/meson.build index fc9c82a6..d5835d6e 100644 --- a/src/meson.build +++ b/src/meson.build @@ -235,8 +235,6 @@ gen_word_list_resource = executable( install: false, ) -cc = meson.get_compiler('c') -m_dep = cc.find_library('m', required : true) crosswords_deps = [ dependency('gio-2.0', version: '>= 2.50'), diff --git a/thumbnailer/meson.build b/thumbnailer/meson.build index 3f5bbf58..4f500939 100644 --- a/thumbnailer/meson.build +++ b/thumbnailer/meson.build @@ -16,9 +16,6 @@ thumbnailer_sources = [ 'crosswords-thumbnailer.c' ] + common_sources + enum_sources -cc = meson.get_compiler('c') -m_dep = cc.find_library('m', required : true) - thumbnailer_deps = [ gtk4_dep, json_glib_dep, -- GitLab From 39007db40d61d4e07e2c941abd00ea8683186395 Mon Sep 17 00:00:00 2001 From: Victor Ma Date: Thu, 17 Apr 2025 01:20:50 -0400 Subject: [PATCH 14/14] Remove extra newline --- src/meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/src/meson.build b/src/meson.build index d5835d6e..1da74a2c 100644 --- a/src/meson.build +++ b/src/meson.build @@ -235,7 +235,6 @@ gen_word_list_resource = executable( install: false, ) - crosswords_deps = [ dependency('gio-2.0', version: '>= 2.50'), dependency('gtk4', version: '>= 4.2'), -- GitLab