[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/create_buttons.c (new_spe
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/create_buttons.c (new_special_unit_direction_button): pass direction information as an enum BUTTON_special_unit_directions. Use buttons_special_units_names to get the button name. Pass converter and call html_get_direction_index in new_special_unit_direction_button. Update callers. Move new_directions_list_buttons_specifications to the end of the file. |
Date: |
Fri, 04 Oct 2024 02:56:53 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 59907d1cb2 * tp/Texinfo/XS/convert/create_buttons.c
(new_special_unit_direction_button): pass direction information as an enum
BUTTON_special_unit_directions. Use buttons_special_units_names to get the
button name. Pass converter and call html_get_direction_index in
new_special_unit_direction_button. Update callers. Move
new_directions_list_buttons_specifications to the end of the file.
59907d1cb2 is described below
commit 59907d1cb20951229fb455ae7f865ef3f16d31a4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Oct 4 08:56:58 2024 +0200
* tp/Texinfo/XS/convert/create_buttons.c
(new_special_unit_direction_button): pass direction information as an
enum BUTTON_special_unit_directions. Use buttons_special_units_names
to get the button name. Pass converter and call
html_get_direction_index in new_special_unit_direction_button. Update
callers.
Move new_directions_list_buttons_specifications to the end of the
file.
---
ChangeLog | 11 +++
tp/Texinfo/XS/convert/create_buttons.c | 118 +++++++++++++++------------------
2 files changed, 66 insertions(+), 63 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e3d0313713..a5dc92a0d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-09-13 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/create_buttons.c
+ (new_special_unit_direction_button): pass direction information as an
+ enum BUTTON_special_unit_directions. Use buttons_special_units_names
+ to get the button name. Pass converter and call
+ html_get_direction_index in new_special_unit_direction_button. Update
+ callers.
+ Move new_directions_list_buttons_specifications to the end of the
+ file.
+
2024-10-04 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/create_buttons.h (enum
diff --git a/tp/Texinfo/XS/convert/create_buttons.c
b/tp/Texinfo/XS/convert/create_buttons.c
index a31c0aea8a..a1f65317cd 100644
--- a/tp/Texinfo/XS/convert/create_buttons.c
+++ b/tp/Texinfo/XS/convert/create_buttons.c
@@ -101,53 +101,21 @@ new_button_specification_list (size_t buttons_nr)
return result;
}
-/* a negative direction in DIRECTIONS corresponds to a special direction
- which index is not known early and is better stored as a string.
-
- Mainly called for texi2html style navigation buttons, but also for
- default special units navigation panel buttons.
- */
-BUTTON_SPECIFICATION_LIST *
-new_directions_list_buttons_specifications (CONVERTER *self,
- const int* directions)
-{
- int buttons_nr = 0;
- int i;
- BUTTON_SPECIFICATION_LIST *result;
-
- for (buttons_nr = 0; directions[buttons_nr] != -1; buttons_nr++) {};
-
- result = new_button_specification_list (buttons_nr);
-
- for (i = 0; i < buttons_nr; i++)
- {
- int direction_index = directions[i];
- int direction;
- const char *direction_string = 0;
- if (direction_index < 0)
- {
- int name_idx = -direction_index - 2;
- direction_string = buttons_special_units_names[name_idx];
- direction = html_get_direction_index (self, direction_string);
- if (direction >= 0)
- direction_string = 0;
- }
- else
- direction = direction_index;
-
- new_button_specification (&result->list[i], BST_direction,
- 0, direction, direction_string, 0, 0, 0);
- }
- return result;
-}
-
+/* this function may be called too early for special units direction
+ indices to be known, in that case we register direction string name
+ for such directions, directions are set afterwards.
+ */
static void
-new_special_unit_direction_button (BUTTON_SPECIFICATION *button,
- int direction, const char *name)
+new_special_unit_direction_button (const CONVERTER *self,
+ BUTTON_SPECIFICATION *button,
+ enum BUTTON_special_unit_directions special_direction)
{
+ const char *button_name = buttons_special_units_names[-special_direction -2];
+ int direction = html_get_direction_index (self, button_name);
+
if (direction < 0)
new_button_specification (button, BST_direction,
- 0, -1, name, 0, 0, 0);
+ 0, -1, button_name, 0, 0, 0);
else
new_button_specification (button, BST_direction,
0, direction, 0, 0, 0, 0);
@@ -166,12 +134,6 @@ new_base_navigation_buttons (const CONVERTER *self,
buttons_nr++;
result = new_button_specification_list (buttons_nr);
- /* this function may be called too early for special units direction
- indices to be known, in that case we register direction string name
- for such directions, directions are set afterwards.
- */
- int contents_direction = html_get_direction_index (self, "Contents");
- int about_direction = html_get_direction_index (self, "About");
new_button_specification (&result->list[0], BST_direction_info,
BIT_function, D_direction_Next, 0, 0,
@@ -184,13 +146,11 @@ new_base_navigation_buttons (const CONVERTER *self,
function_type, 0);
new_button_specification (&result->list[3], BST_direction, 0,
D_direction_Space, 0, 0, 0, 0);
- new_special_unit_direction_button (&result->list[4], contents_direction,
- "Contents");
+ new_special_unit_direction_button (self, &result->list[4], BSUD_D_Contents);
new_button_specification (&result->list[5], BST_direction, 0,
D_direction_Index, 0, 0, 0, 0);
if (with_about)
- new_special_unit_direction_button (&result->list[6], about_direction,
- "About");
+ new_special_unit_direction_button (self, &result->list[6], BSUD_D_About);
return result;
}
@@ -198,21 +158,13 @@ BUTTON_SPECIFICATION_LIST *
new_base_links_buttons (const CONVERTER *self)
{
BUTTON_SPECIFICATION_LIST *result = new_button_specification_list (7);
- /* this function may be called too early for special units direction
- indices to be known, in that case we register direction string name
- for such directions, directions are set afterwards.
- */
- int contents_direction = html_get_direction_index (self, "Contents");
- int about_direction = html_get_direction_index (self, "About");
new_button_specification (&result->list[0], BST_direction,
0, D_direction_Top, 0, 0, 0, 0);
new_button_specification (&result->list[1], BST_direction,
0, D_direction_Index, 0, 0, 0, 0);
- new_special_unit_direction_button (&result->list[2], contents_direction,
- "Contents");
- new_special_unit_direction_button (&result->list[3], about_direction,
- "About");
+ new_special_unit_direction_button (self, &result->list[2], BSUD_D_Contents);
+ new_special_unit_direction_button (self, &result->list[3], BSUD_D_About);
new_button_specification (&result->list[4], BST_direction,
0, D_direction_NodeUp, 0, 0, 0, 0);
@@ -235,3 +187,43 @@ new_base_navigation_section_footer_buttons (const
CONVERTER *self)
return new_base_navigation_buttons (self, BFT_type_panel_section_footer, 0);
}
+/* a negative direction in DIRECTIONS corresponds to a special direction
+ which index is not known early and is better stored as a string.
+
+ Mainly called for texi2html style navigation buttons, but also for
+ default special units navigation panel buttons.
+ */
+BUTTON_SPECIFICATION_LIST *
+new_directions_list_buttons_specifications (CONVERTER *self,
+ const int* directions)
+{
+ int buttons_nr = 0;
+ int i;
+ BUTTON_SPECIFICATION_LIST *result;
+
+ for (buttons_nr = 0; directions[buttons_nr] != -1; buttons_nr++) {};
+
+ result = new_button_specification_list (buttons_nr);
+
+ for (i = 0; i < buttons_nr; i++)
+ {
+ int direction_index = directions[i];
+ int direction;
+ const char *direction_string = 0;
+ if (direction_index < 0)
+ {
+ int name_idx = -direction_index - 2;
+ direction_string = buttons_special_units_names[name_idx];
+ direction = html_get_direction_index (self, direction_string);
+ if (direction >= 0)
+ direction_string = 0;
+ }
+ else
+ direction = direction_index;
+
+ new_button_specification (&result->list[i], BST_direction,
+ 0, direction, direction_string, 0, 0, 0);
+ }
+ return result;
+}
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/create_buttons.c (new_special_unit_direction_button): pass direction information as an enum BUTTON_special_unit_directions. Use buttons_special_units_names to get the button name. Pass converter and call html_get_direction_index in new_special_unit_direction_button. Update callers. Move new_directions_list_buttons_specifications to the end of the file.,
Patrice Dumas <=