UI: 'View Online Manual' Shortcut

D1031, implement proposal T37478 to give easy access to the online manual.

Use Alt+F1 while hovering over a button/setting.
This commit is contained in:
Julian Eisel
2015-04-27 01:17:51 +10:00
committed by Campbell Barton
parent 5efbd2a407
commit cf366c8b66
4 changed files with 77 additions and 32 deletions

View File

@@ -52,6 +52,9 @@
#include "UI_interface.h"
#include "UI_resources.h"
#include "WM_api.h"
#include "WM_types.h"
#include "interface_intern.h"
@@ -309,6 +312,34 @@ int UI_calc_float_precision(int prec, double value)
return prec;
}
bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength)
{
if (but->rnapoin.id.data && but->rnapoin.data && but->rnaprop) {
BLI_snprintf(r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type),
RNA_property_identifier(but->rnaprop));
return true;
}
else if (but->optype) {
WM_operator_py_idname(r_str, but->optype->idname);
return true;
}
*r_str = '\0';
return false;
}
bool UI_but_online_manual_id_from_active(const struct bContext *C, char *r_str, size_t maxlength)
{
uiBut *but = UI_context_active_but_get(C);
if (but) {
return UI_but_online_manual_id(but, r_str, maxlength);
}
*r_str = '\0';
return false;
}
/* -------------------------------------------------------------------- */
/* Modal Button Store API */