Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-09-11 22:08:38 +0300
committerHans Goudey <h.goudey@me.com>2020-09-11 22:08:38 +0300
commita55093711644f1a87eb058d2bed20d530a4de155 (patch)
tree2406e19c3dc370e4360fd2540f8f6b64a9d89b3b /source/blender/editors/space_buttons/buttons_context.c
parente22e30283714d03d0b57ebfa3a4dcda35c808c86 (diff)
UI: Use operator to set property editor's pinned data-block
This commit removes the custom callback that's currently used to set the property editor's pinned data, replacing it with an operator. This means "pin" button doesn't have to be defined in C. Differential Revision: https://developer.blender.org/D8376
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_context.c')
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index e0a5158e510..9228853ed19 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -1133,7 +1133,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
{
SpaceProperties *sbuts = CTX_wm_space_properties(C);
ButsContextPath *path = sbuts->path;
- uiLayout *row;
+ uiLayout *row, *sub;
uiBlock *block;
uiBut *but;
PointerRNA *ptr;
@@ -1199,25 +1199,12 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
uiItemSpacer(row);
- block = uiLayoutGetBlock(row);
- UI_block_emboss_set(block, UI_EMBOSS_NONE);
- but = uiDefIconButBitC(block,
- UI_BTYPE_ICON_TOGGLE,
- SB_PIN_CONTEXT,
- 0,
- ICON_UNPINNED,
- 0,
- 0,
- UI_UNIT_X,
- UI_UNIT_Y,
- &sbuts->flag,
- 0,
- 0,
- 0,
- 0,
- TIP_("Follow context or keep fixed data-block displayed"));
- UI_but_flag_disable(but, UI_BUT_UNDO); /* skip undo on screen buttons */
- UI_but_func_set(but, pin_cb, NULL, NULL);
+ sub = uiLayoutRow(row, false);
+ uiLayoutSetEmboss(sub, UI_EMBOSS_NONE);
+ uiItemO(sub,
+ "",
+ (sbuts->flag & SB_PIN_CONTEXT) ? ICON_PINNED : ICON_UNPINNED,
+ "BUTTONS_OT_toggle_pin");
}
#ifdef USE_HEADER_CONTEXT_PATH