diff --git a/src/Makefile b/src/Makefile index ee40e63e..3a47dc12 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1234,6 +1234,7 @@ doxygen: htmldoc: $(GENERATEDOCBIN) $(MKDIR) ../doc/html + $(CP) ../share/grafx2/skins/skin_classic.png ../doc/html $(GENERATEDOCBIN) ../doc/html print-%: diff --git a/src/generatedoc.c b/src/generatedoc.c index aeb1164e..50ea5873 100644 --- a/src/generatedoc.c +++ b/src/generatedoc.c @@ -29,10 +29,14 @@ */ #include #include + #include "global.h" #include "hotkeys.h" #include "helpfile.h" #include "keyboard.h" // for Key_Name() +#include "windows.h" // for T_Toolbar_button + +static T_Toolbar_button Buttons[NB_BUTTONS]; /// /// Export the help to HTML files @@ -50,6 +54,20 @@ int main(int argc,char * argv[]) } path = argv[1]; } + +#define Init_button(btn, tooltip, x_offset, y_offset, width, height, shape, \ + left_action, right_action, left_instant, right_instant, \ + unselect_action, family) \ + Buttons[btn].Tooltip = tooltip; \ + Buttons[btn].X_offset = x_offset; \ + Buttons[btn].Y_offset = y_offset; \ + Buttons[btn].Width = width; \ + Buttons[btn].Height = height; \ + Buttons[btn].Shape = shape; \ + Buttons[btn].Family = family; + #include "init_buttons.h" +#undef Init_button + r = Export_help(path); if (r < 0) return -r; @@ -96,6 +114,34 @@ static const char * Keyboard_default_shortcut(word shortcut_number) } } +static void Print_button(FILE * f, int btn) +{ + int x_offset, y_offset; + + if (btn < 0 || btn >= NB_BUTTONS) + return; + if (Buttons[btn].Width <= 1) + return; + x_offset = Buttons[btn].X_offset; + y_offset = Buttons[btn].Y_offset; + if (btn <= BUTTON_HIDE) // Status + y_offset += 67; + else if (btn <= BUTTON_ANIM_PLAY) // Animation + y_offset += 53; + else if (btn <= BUTTON_LAYER_SELECT) // Layers + y_offset += 43; + else // Main + y_offset += 8; + + fprintf(f, "
 "); +} + /// static const char * Export_help_table(FILE * f, unsigned int page) { @@ -115,7 +161,10 @@ static const char * Export_help_table(FILE * f, unsigned int page) { if (table[index].Line_type == 'T') { - strncpy(title, table[index].Text, sizeof(title)); + const char * p = table[index].Text; + while (*p == ' ') + p++; + strncpy(title, p, sizeof(title)); title[sizeof(title)-1] = '\0'; while (index + 2 < length && table[index+2].Line_type == 'T') { @@ -159,8 +208,13 @@ static const char * Export_help_table(FILE * f, unsigned int page) if (table[index].Line_type == 'S') fprintf(f, ""); else if (table[index].Line_type == 'T' && !(index > 1 && table[index-2].Line_type == 'T')) + { fprintf(f, "", hlevel); + if (hlevel == 1 && page >= 4) + Print_button(f, page-4); + } + if (table[index].Line_type == 'K') { char keytmp[64]; @@ -232,7 +286,11 @@ static const char * Export_help_table(FILE * f, unsigned int page) { fprintf(f, "", hlevel); if (hlevel == 1) + { hlevel++; + if (page >= 4 && page < NB_BUTTONS + 4 && Buttons[page-4].Tooltip != NULL) + fprintf(f, "\n%s", Buttons[page-4].Tooltip); + } } } if (table[index].Line_type != 'T') @@ -271,6 +329,8 @@ static int Export_help(const char * path) fprintf(findex, "\n"); fprintf(findex, "\n"); + fprintf(findex, "
"); fprintf(findex, "
    \n"); for (i = 0; i < sizeof(Help_section)/sizeof(Help_section[0]); i++) { @@ -285,8 +345,16 @@ static int Export_help(const char * path) } //GFX2_Log(GFX2_INFO, "Saving %s\n", filename); title = Export_help_table(f, i); + // Button = i - 4 fclose(f); - fprintf(findex, "
  • %s
  • \n", i, title); + fprintf(findex, "
  • "); + fprintf(findex, "", i); + if (i >= 4) + Print_button(findex, i-4); + fprintf(findex, "%s", title); + if (i >= 4 && Buttons[i-4].Tooltip != NULL) + fprintf(findex, " %s", Buttons[i-4].Tooltip); + fprintf(findex, "
  • \n"); } fprintf(findex, "
\n"); fprintf(findex, "\n"); @@ -300,6 +368,12 @@ static int Export_help(const char * path) fprintf(f, "font-family: %s;\n", "monospace"); fprintf(f, "white-space: %s;\n", "pre"); fprintf(f, "}\n"); + fprintf(f, "div.button {\n"); + fprintf(f, "display: inline-block;\n"); + fprintf(f, "background-image: url(\"skin_classic.png\");\n"); + fprintf(f, "width: 16px;\n"); + fprintf(f, "height: 16px;\n"); + fprintf(f, "}\n"); fclose(f); } return 0;