Page MenuHome
Paste P1109

(An Untitled Masterwork)
ActivePublic

Authored by Brecht Van Lommel (brecht) on Sep 19 2019, 4:39 PM.
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 8b83b5e..39ffe08 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -110,18 +110,22 @@ void file_tool_props_region_panels_register(ARegionType *art)
BLI_addtail(&art->paneltypes, pt);
}
-static void file_panel_execution_cancel_button(uiBlock *block)
+static void file_panel_execution_cancel_button(uiLayout *layout)
{
- uiDefButO(block,
- UI_BTYPE_BUT,
- "FILE_OT_cancel",
- WM_OP_EXEC_REGION_WIN,
- IFACE_("Cancel"),
- 0,
- 0,
- UI_UNIT_X,
- UI_UNIT_Y,
- "");
+ uiLayout *row = uiLayoutRow(layout, false);
+ uiLayoutSetScaleX(row, 1.3f);
+ uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
+ uiItemO(row, IFACE_("Cancel"), ICON_NONE, "FILE_OT_cancel");
+}
+
+static void file_panel_execution_execute_button(uiLayout *layout, const char *title)
+{
+ uiLayout *row = uiLayoutRow(layout, false);
+ uiLayoutSetScaleX(row, 1.3f);
+ uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
+ /* Just a display hint. */
+ uiLayoutSetActiveDefault(row, true);
+ uiItemO(row, title, ICON_NONE, "FILE_OT_execute");
}
static void file_panel_execution_buttons_draw(const bContext *C, Panel *pa)
@@ -192,23 +196,16 @@ static void file_panel_execution_buttons_draw(const bContext *C, Panel *pa)
UI_block_func_set(block, NULL, NULL, NULL);
{
- if (windows_layout == false) {
- file_panel_execution_cancel_button(block);
- }
- but = uiDefButO(block,
- UI_BTYPE_BUT,
- "FILE_OT_execute",
- WM_OP_EXEC_REGION_WIN,
- params->title,
- 0,
- 0,
- UI_UNIT_X,
- UI_UNIT_Y,
- "");
- /* Just a display hint. */
- UI_but_flag_enable(but, UI_BUT_ACTIVE_DEFAULT);
+ uiLayout *sub = uiLayoutRow(row, false);
+ uiLayoutSetOperatorContext(sub, WM_OP_EXEC_REGION_WIN);
+
if (windows_layout) {
- file_panel_execution_cancel_button(block);
+ file_panel_execution_execute_button(sub, params->title);
+ file_panel_execution_cancel_button(sub);
+ }
+ else {
+ file_panel_execution_cancel_button(sub);
+ file_panel_execution_execute_button(sub, params->title);
}
}
}

Event Timeline