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:
authorJoseph Eagar <joeedh@gmail.com>2011-02-27 09:19:40 +0300
committerJoseph Eagar <joeedh@gmail.com>2011-02-27 09:19:40 +0300
commitf01261d040be27337db9f9996d648a279c89b7c4 (patch)
treec448230939b3c90d53ce8852dd00925d6052e3a4 /source/blender/editors/space_view3d/view3d_toolbar.c
parentdcaeda5c4e3a0687251b8511de4f2e8b85ef75c0 (diff)
parent2198cfdb2deec8b2e85e242c74a032f43d0b26ca (diff)
merge with/from trunk at r35190
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_toolbar.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c55
1 files changed, 12 insertions, 43 deletions
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index c07d7d88944..3292c5d396c 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -40,6 +40,7 @@
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_idprop.h"
@@ -63,27 +64,6 @@
/* ******************* view3d space & buttons ************** */
-
-/* op->invoke */
-static void redo_cb(bContext *C, void *arg_op, void *arg2)
-{
- wmOperator *lastop= arg_op;
-
- if(lastop) {
- int retval;
-
- if (G.f & G_DEBUG)
- printf("operator redo %s\n", lastop->type->name);
- ED_undo_pop_op(C, lastop);
- retval= WM_operator_repeat(C, lastop);
- if((retval & OPERATOR_FINISHED)==0) {
- if (G.f & G_DEBUG)
- printf("operator redo failed %s\n", lastop->type->name);
- ED_undo_redo(C);
- }
- }
-}
-
static wmOperator *view3d_last_operator(const bContext *C)
{
wmWindowManager *wm= CTX_wm_manager(C);
@@ -99,22 +79,7 @@ static wmOperator *view3d_last_operator(const bContext *C)
static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOperator *op)
{
- wmWindowManager *wm= CTX_wm_manager(C);
- PointerRNA ptr;
-
- if(!op->properties) {
- IDPropertyTemplate val = {0};
- op->properties= IDP_New(IDP_GROUP, val, "wmOperatorProperties");
- }
-
- RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
- if(op->type->ui) {
- op->layout= pa->layout;
- op->type->ui((bContext*)C, op);
- op->layout= NULL;
- }
- else
- uiDefAutoButsRNA(C, pa->layout, &ptr, 1);
+ uiLayoutOperatorButs(C, pa->layout, op, NULL, 'V', 0);
}
static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa)
@@ -129,7 +94,7 @@ static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wm
{
if(op->type->flag & OPTYPE_MACRO) {
for(op= op->macro.first; op; op= op->next) {
- uiItemL(pa->layout, op->idname, 0);
+ uiItemL(pa->layout, op->type->name, ICON_NULL);
view3d_panel_operator_redo_operator(C, pa, op);
}
}
@@ -149,8 +114,12 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
return;
block= uiLayoutGetBlock(pa->layout);
+
+ if(ED_undo_valid(C, op->type->name)==0)
+ uiLayoutSetEnabled(pa->layout, 0);
- uiBlockSetFunc(block, redo_cb, op, NULL);
+ /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
+ uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
view3d_panel_operator_redo_operator(C, pa, op);
}
@@ -177,7 +146,7 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2)
}
-static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items)
+static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
{
wmOperatorType *ot = WM_operatortype_first();
@@ -246,7 +215,7 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa)
for(ct= st->toolshelf.first; ct; ct= ct->next) {
if(0==strncmp(context, ct->context, OP_MAX_TYPENAME)) {
col= uiLayoutColumn(pa->layout, 1);
- uiItemFullO(col, ct->opname, NULL, 0, NULL, WM_OP_INVOKE_REGION_WIN, 0);
+ uiItemFullO(col, ct->opname, NULL, ICON_NULL, NULL, WM_OP_INVOKE_REGION_WIN, 0);
}
}
}
@@ -280,7 +249,7 @@ void view3d_tool_props_register(ARegionType *art)
/* ********** operator to open/close toolshelf region */
-static int view3d_toolshelf(bContext *C, wmOperator *op)
+static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= view3d_has_tools_region(sa);