Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_panel.c
| Show First 20 Lines • Show All 2,094 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| Panel *panel = block->panel; | Panel *panel = block->panel; | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| BLI_assert(panel->type != NULL); | BLI_assert(panel->type != NULL); | ||||
| BLI_assert(!(panel->type->flag & PANEL_TYPE_NO_HEADER)); | BLI_assert(!(panel->type->flag & PANEL_TYPE_NO_HEADER)); | ||||
| const bool is_subpanel = (panel->type->parent != NULL); | const bool is_subpanel = (panel->type->parent != NULL); | ||||
| const bool use_pin = UI_panel_category_is_visible(region) && !is_subpanel; | const bool use_pin = UI_panel_category_is_visible(region) && UI_panel_can_be_pinned(panel); | ||||
| const bool show_pin = use_pin && (panel->flag & PNL_PIN); | const bool show_pin = use_pin && (panel->flag & PNL_PIN); | ||||
| const bool show_drag = !is_subpanel; | const bool show_drag = !is_subpanel; | ||||
| /* Handle panel pinning. */ | /* Handle panel pinning. */ | ||||
| if (use_pin && ELEM(event_type, EVT_RETKEY, EVT_PADENTER, LEFTMOUSE) && shift) { | if (use_pin && ELEM(event_type, EVT_RETKEY, EVT_PADENTER, LEFTMOUSE) && shift) { | ||||
| panel->flag ^= PNL_PIN; | panel->flag ^= PNL_PIN; | ||||
| ED_region_tag_redraw(region); | ED_region_tag_redraw(region); | ||||
| return; | return; | ||||
| ▲ Show 20 Lines • Show All 380 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { | ||||
| if (ELEM(mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER)) { | if (ELEM(mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER)) { | ||||
| return UI_panel_custom_data_get(panel); | return UI_panel_custom_data_get(panel); | ||||
| } | } | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| bool UI_panel_can_be_pinned(const Panel *panel) | |||||
| { | |||||
| return (panel->type->parent == NULL) && !(panel->type->flag & PANEL_TYPE_INSTANCED); | |||||
| } | |||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Window Level Modal Panel Interaction | /** \name Window Level Modal Panel Interaction | ||||
| * \{ */ | * \{ */ | ||||
| /* NOTE: this is modal handler and should not swallow events for animation. */ | /* NOTE: this is modal handler and should not swallow events for animation. */ | ||||
| static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata) | static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata) | ||||
| ▲ Show 20 Lines • Show All 116 Lines • Show Last 20 Lines | |||||