~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/editors/space_clip/clip_toolbar.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
#include "DNA_windowmanager_types.h"
35
35
 
 
36
#include "RNA_access.h"
 
37
 
36
38
#include "MEM_guardedalloc.h"
37
39
 
38
40
#include "BLI_blenlib.h"
39
41
#include "BLI_utildefines.h"
40
42
 
 
43
#include "BLF_translation.h"
 
44
 
41
45
#include "BKE_context.h"
42
46
#include "BKE_screen.h"
43
47
 
56
60
 
57
61
/************************** properties ******************************/
58
62
 
59
 
static ARegion *clip_has_properties_region(ScrArea *sa)
 
63
ARegion *ED_clip_has_properties_region(ScrArea *sa)
60
64
{
61
65
        ARegion *ar, *arnew;
62
66
 
90
94
static int properties_exec(bContext *C, wmOperator *UNUSED(op))
91
95
{
92
96
        ScrArea *sa = CTX_wm_area(C);
93
 
        ARegion *ar = clip_has_properties_region(sa);
 
97
        ARegion *ar = ED_clip_has_properties_region(sa);
94
98
 
95
 
        if (ar)
 
99
        if (ar && ar->alignment != RGN_ALIGN_NONE)
96
100
                ED_region_toggle_hidden(C, ar);
97
101
 
98
102
        return OPERATOR_FINISHED;
151
155
 
152
156
                BLI_insertlinkafter(&sa->regionbase, artool, arprops);
153
157
                arprops->regiontype = RGN_TYPE_TOOL_PROPS;
154
 
                arprops->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
 
158
                arprops->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
155
159
        }
156
160
 
157
161
        return artool;
167
171
        ScrArea *sa = CTX_wm_area(C);
168
172
        ARegion *ar = clip_has_tools_region(sa);
169
173
 
170
 
        if (ar)
 
174
        if (ar && ar->alignment != RGN_ALIGN_NONE)
171
175
                ED_region_toggle_hidden(C, ar);
172
176
 
173
177
        return OPERATOR_FINISHED;
197
201
        wmOperator *op = WM_operator_last_redo(C);
198
202
 
199
203
        if (op)
200
 
                BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
 
204
                BLI_strncpy(pa->drawname, RNA_struct_ui_name(op->type->srna), sizeof(pa->drawname));
201
205
        else
202
 
                BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname));
 
206
                BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname));
203
207
}
204
208
 
205
209
static void clip_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
206
210
{
207
211
        if (op->type->flag & OPTYPE_MACRO) {
208
212
                for (op = op->macro.first; op; op = op->next) {
209
 
                        uiItemL(pa->layout, op->type->name, ICON_NONE);
 
213
                        uiItemL(pa->layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
210
214
                        clip_panel_operator_redo_operator(C, pa, op);
211
215
                }
212
216
        }
219
223
static void clip_panel_operator_redo(const bContext *C, Panel *pa)
220
224
{
221
225
        wmOperator *op = WM_operator_last_redo(C);
222
 
        uiBlock *block;
 
226
        ARegion *ar;
 
227
        ARegion *ar1;
223
228
 
224
229
        if (op == NULL)
225
230
                return;
226
231
 
227
 
        if (WM_operator_poll((bContext*)C, op->type) == 0)
228
 
                return;
229
 
 
230
 
        block = uiLayoutGetBlock(pa->layout);
231
 
 
232
 
        if (!WM_operator_check_ui_enabled(C, op->type->name))
233
 
                uiLayoutSetEnabled(pa->layout, 0);
234
 
 
235
 
        /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
236
 
        uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
237
 
 
238
 
        clip_panel_operator_redo_operator(C, pa, op);
 
232
        /* keep in sync with logic in ED_undo_operator_repeat() */
 
233
        ar = CTX_wm_region(C);
 
234
        ar1 = BKE_area_find_region_type(CTX_wm_area(C), RGN_TYPE_WINDOW);
 
235
        if (ar1)
 
236
                CTX_wm_region_set((bContext *)C, ar1);
 
237
 
 
238
        if (WM_operator_poll((bContext *)C, op->type)) {
 
239
                uiBlock *block = uiLayoutGetBlock(pa->layout);
 
240
 
 
241
                if (!WM_operator_check_ui_enabled(C, op->type->name))
 
242
                        uiLayoutSetEnabled(pa->layout, FALSE);
 
243
 
 
244
                /* note, blockfunc is a default but->func, use Handle func to allow button callbacks too */
 
245
                uiBlockSetHandleFunc(block, ED_undo_operator_repeat_cb_evt, op);
 
246
 
 
247
                clip_panel_operator_redo_operator(C, pa, op);
 
248
        }
 
249
 
 
250
        /* set region back */
 
251
        CTX_wm_region_set((bContext *)C, ar);
239
252
}
240
253
 
241
254
void ED_clip_tool_props_register(ARegionType *art)