Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_operators.c
| Context not available. | |||||
| ot->exec = previews_ensure_exec; | ot->exec = previews_ensure_exec; | ||||
| } | } | ||||
| static int doc_view_manual_active_but_exec(bContext *C, wmOperator *UNUSED(op)) | |||||
| { | |||||
| PointerRNA ptr, ptr_props; | |||||
| PropertyRNA *prop; | |||||
| wmOperatorType *ot = UI_context_active_but_ot_get(C); | |||||
| char buf[512]; | |||||
| int index; | |||||
| short retval; | |||||
| UI_context_active_but_prop_get(C, &ptr, &prop, &index); | |||||
| if (ptr.id.data && ptr.data && prop) { | |||||
| BLI_snprintf(buf, sizeof(buf), "%s.%s", RNA_struct_identifier(ptr.type), | |||||
| RNA_property_identifier(prop)); | |||||
| } | |||||
| else if (ot) { | |||||
| WM_operator_py_idname(buf, ot->idname); | |||||
| } | |||||
| WM_operator_properties_create(&ptr_props, "WM_OT_doc_view_manual"); | |||||
| RNA_string_set(&ptr_props, "doc_id", buf); | |||||
| retval = WM_operator_name_call_ptr(C, WM_operatortype_find("WM_OT_doc_view_manual", false), | |||||
| WM_OP_EXEC_DEFAULT, &ptr_props); | |||||
| WM_operator_properties_free(&ptr_props); | |||||
| return retval; | |||||
| } | |||||
| static void WM_OT_doc_view_manual_active_but(wmOperatorType *ot) | |||||
| { | |||||
| /* identifiers */ | |||||
| ot->name = "View online manual"; | |||||
sergey: Picky: convention is to use capital letters for every word in the operator name. | |||||
| ot->idname = "WM_OT_doc_view_manual_active_but"; | |||||
| ot->description = "View the online manual for this button in a webbrowser"; | |||||
| /* callbacks */ | |||||
| ot->poll = ED_operator_regionactive; | |||||
| ot->exec = doc_view_manual_active_but_exec; | |||||
| } | |||||
| /* ******************************************************* */ | /* ******************************************************* */ | ||||
| static void operatortype_ghash_free_cb(wmOperatorType *ot) | static void operatortype_ghash_free_cb(wmOperatorType *ot) | ||||
Not Done Inline ActionsCould just call this WM_OT_doc_view_manual_ui_context ? - maybe we want to make Alt+F1 Link to Sequencer docs when done in the sequencer... or other less specific cases. campbellbarton: Could just call this `WM_OT_doc_view_manual_ui_context` ? - maybe we want to make Alt+F1 Link… | |||||
Not Done Inline ActionsWe already have code in ui_but_menu to get a string from the button. This duplicates it. Would rather have a generic function in interface_utils.c, eg:
where UI_but_online_manual_id_from_active would just get the active button and call UI_but_online_manual_id campbellbarton: We already have code in `ui_but_menu` to get a string from the button. This duplicates it. | |||||
| Context not available. | |||||
| WM_operatortype_append(WM_OT_console_toggle); | WM_operatortype_append(WM_OT_console_toggle); | ||||
| #endif | #endif | ||||
| WM_operatortype_append(WM_OT_previews_ensure); | WM_operatortype_append(WM_OT_previews_ensure); | ||||
| WM_operatortype_append(WM_OT_doc_view_manual_active_but); | |||||
| } | } | ||||
| /* circleselect-like modal operators */ | /* circleselect-like modal operators */ | ||||
| Context not available. | |||||
| WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, KM_ALT, 0); | WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, KM_ALT, 0); | ||||
| WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_CTRL, 0); | WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_CTRL, 0); | ||||
| WM_keymap_add_item(keymap, "WM_OT_doc_view_manual_active_but", F1KEY, KM_PRESS, KM_ALT, 0); | |||||
| /* debug/testing */ | /* debug/testing */ | ||||
| WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT | KM_CTRL, 0); | WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT | KM_CTRL, 0); | ||||
| WM_keymap_verify_item(keymap, "WM_OT_debug_menu", DKEY, KM_PRESS, KM_ALT | KM_CTRL, 0); | WM_keymap_verify_item(keymap, "WM_OT_debug_menu", DKEY, KM_PRESS, KM_ALT | KM_CTRL, 0); | ||||
| Context not available. | |||||
Picky: convention is to use capital letters for every word in the operator name.