diff options
author | Matt Ebb <matt@mke3.net> | 2004-07-29 16:12:20 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2004-07-29 16:12:20 +0400 |
commit | 28f0f2d04826750c83d09ddda3b59dd5ee07f9f6 (patch) | |
tree | d4367a608a13acd91940012b7ea8faedcc89019c /source/blender | |
parent | 7ed803f6a8b675efc0e5ee38f0c50ea0b7be0045 (diff) |
Help menu!
Thanks to Willian for integrating the webbrowser module.
Some of the URLs (Python reference, Release notes) will
need to be updated upon release. These are contained in
http://www.blender3d.org/Help/index.php
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/BPY_menus.c | 8 | ||||
-rw-r--r-- | source/blender/python/BPY_menus.h | 4 | ||||
-rw-r--r-- | source/blender/src/header_info.c | 121 |
3 files changed, 77 insertions, 56 deletions
diff --git a/source/blender/python/BPY_menus.c b/source/blender/python/BPY_menus.c index a54062165ee..de96c47fe4b 100644 --- a/source/blender/python/BPY_menus.c +++ b/source/blender/python/BPY_menus.c @@ -78,6 +78,8 @@ static int bpymenu_group_atoi (char *str) if (!strcmp(str, "Import")) return PYMENU_IMPORT; else if (!strcmp(str, "Export")) return PYMENU_EXPORT; else if (!strcmp(str, "Help")) return PYMENU_HELP; + else if (!strcmp(str, "HelpWebsites")) return PYMENU_HELPWEBSITES; + else if (!strcmp(str, "HelpSystem")) return PYMENU_HELPSYSTEM; else if (!strcmp(str, "Add")) return PYMENU_ADD; else if (!strcmp(str, "Mesh")) return PYMENU_MESH; else if (!strcmp(str, "Wizards")) return PYMENU_WIZARDS; @@ -104,6 +106,12 @@ char *BPyMenu_group_itoa (short menugroup) case PYMENU_HELP: return "Help"; break; + case PYMENU_HELPWEBSITES: + return "Websites"; + break; + case PYMENU_HELPSYSTEM: + return "System"; + break; case PYMENU_MESH: return "Mesh"; break; diff --git a/source/blender/python/BPY_menus.h b/source/blender/python/BPY_menus.h index bafeb59dc8c..35ac71d14d1 100644 --- a/source/blender/python/BPY_menus.h +++ b/source/blender/python/BPY_menus.h @@ -83,7 +83,9 @@ typedef enum { PYMENU_MISC, PYMENU_MESH, PYMENU_MATERIALS, - PYMENU_HELP, /* inserted in the info header 'Help' menu */ + PYMENU_HELP, /* Main Help menu items - prob best to leave for 'official' ones */ + PYMENU_HELPSYSTEM, /* Resources, troubleshooting, system tools */ + PYMENU_HELPWEBSITES, /* Help -> Websites submenu */ PYMENU_IMPORT, PYMENU_EXPORT, PYMENU_ANIMATION, diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c index d483a1b9a50..91dc0c29da6 100644 --- a/source/blender/src/header_info.c +++ b/source/blender/src/header_info.c @@ -1549,12 +1549,8 @@ static uiBlock *info_rendermenu(void *arg_unused) static void do_info_help_websitesmenu(void *arg, int event) { - /* these are no defines, easier this way, the codes are in the function below */ - switch(event) { - case 0: /* */ + BPY_menu_do_python(PYMENU_HELPWEBSITES, event); - break; - } allqueue(REDRAWVIEW3D, 0); } @@ -1562,22 +1558,69 @@ static void do_info_help_websitesmenu(void *arg, int event) static uiBlock *info_help_websitesmenu(void *arg_unused) { uiBlock *block; + BPyMenu *pym; short yco = 20, menuwidth = 120; + int i = 0; block= uiNewBlock(&curarea->uiblocks, "info_help_websitesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); uiBlockSetButmFunc(block, do_info_help_websitesmenu, NULL); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Blender Website *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Blender E-shop *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + for (pym = BPyMenuTable[PYMENU_HELPWEBSITES]; pym; pym = pym->next, i++) { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename); + } - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 60); + + return block; +} + +static void do_info_help_systemmenu(void *arg, int event) +{ + /* events >=10 are registered bpython scripts */ + if (event >= 10) BPY_menu_do_python(PYMENU_HELPSYSTEM, event - 10); + else { + switch(event) { + + case 1: /* Benchmark */ + /* dodgy hack turning on CTRL ALT SHIFT key to do a benchmark + * rather than copying lines and lines of code from toets.c :( + */ - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Development Community *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "User Community *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + if(select_area(SPACE_VIEW3D)) { + mainqenter(LEFTSHIFTKEY, 1); + mainqenter(LEFTCTRLKEY, 1); + mainqenter(LEFTALTKEY, 1); + mainqenter(TKEY, 1); + mainqenter(TKEY, 0); + mainqenter(EXECUTE, 1); + mainqenter(LEFTSHIFTKEY, 0); + mainqenter(LEFTCTRLKEY, 0); + mainqenter(LEFTALTKEY, 0); + } + break; + } + } + + allqueue(REDRAWVIEW3D, 0); +} + + +static uiBlock *info_help_systemmenu(void *arg_unused) +{ + uiBlock *block; + BPyMenu *pym; + short yco = 20, menuwidth = 120; + int i = 0; + + block= uiNewBlock(&curarea->uiblocks, "info_help_systemmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); + uiBlockSetButmFunc(block, do_info_help_systemmenu, NULL); - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Benchmark", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "...? *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + for (pym = BPyMenuTable[PYMENU_HELPSYSTEM]; pym; pym = pym->next, i++) { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename); + } uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); @@ -1585,7 +1628,6 @@ static uiBlock *info_help_websitesmenu(void *arg_unused) return block; } - static void do_info_helpmenu(void *arg, int event) { ScrArea *sa; @@ -1596,32 +1638,16 @@ static void do_info_helpmenu(void *arg, int event) areawinset(sa->win); } - /* events >=2 are registered bpython scripts */ - if (event >= 2) BPY_menu_do_python(PYMENU_HELP, event - 2); - - else switch(event) { + /* events >=10 are registered bpython scripts */ + if (event >= 10) BPY_menu_do_python(PYMENU_HELP, event - 10); + else { + switch(event) { - case 0: /* About Blender */ - break; - case 1: /* Benchmark */ - /* dodgy hack turning on CTRL ALT SHIFT key to do a benchmark - * rather than copying lines and lines of code from toets.c :( - */ - - if(select_area(SPACE_VIEW3D)) { - mainqenter(LEFTSHIFTKEY, 1); - mainqenter(LEFTCTRLKEY, 1); - mainqenter(LEFTALTKEY, 1); - mainqenter(TKEY, 1); - mainqenter(TKEY, 0); - mainqenter(EXECUTE, 1); - mainqenter(LEFTSHIFTKEY, 0); - mainqenter(LEFTCTRLKEY, 0); - mainqenter(LEFTALTKEY, 0); + case 0: /* About Blender */ + break; } - break; } - + allqueue(REDRAWINFO, 0); } @@ -1641,32 +1667,17 @@ static uiBlock *info_helpmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - /* uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "-- Placeholders only --", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tutorials *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "User Manual *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Python Scripting Reference *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); + for (pym = BPyMenuTable[PYMENU_HELP]; pym; pym = pym->next, i++) { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename); + } uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBlockBut(block, info_help_websitesmenu, NULL, ICON_RIGHTARROW_THIN, "Websites", 0, yco-=20, 120, 19, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); -*/ - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Benchmark", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); -/* uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Release Notes *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); -*/ - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - for (pym = BPyMenuTable[PYMENU_HELP]; pym; pym = pym->next, i++) { - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+2, pym->tooltip?pym->tooltip:pym->filename); - } + uiDefIconTextBlockBut(block, info_help_systemmenu, NULL, ICON_RIGHTARROW_THIN, "System", 0, yco-=20, 120, 19, ""); uiBlockSetDirection(block, UI_DOWN); uiTextBoundsBlock(block, 80); |