svn merge ^/trunk/blender -r43420:43436
[blender.git] / source / blender / editors / space_view3d / view3d_header.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version. 
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2004-2008 Blender Foundation.
19  * All rights reserved.
20  *
21  * 
22  * Contributor(s): Blender Foundation
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 /** \file blender/editors/space_view3d/view3d_header.c
28  *  \ingroup spview3d
29  */
30
31
32 #include <string.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35
36 #include "DNA_scene_types.h"
37 #include "DNA_object_types.h"
38
39 #include "RNA_access.h"
40
41 #include "MEM_guardedalloc.h"
42
43 #include "BLI_math.h"
44 #include "BLI_blenlib.h"
45 #include "BLI_editVert.h"
46 #include "BLI_utildefines.h"
47
48 #include "BLF_translation.h"
49
50 #include "BKE_context.h"
51 #include "BKE_depsgraph.h"
52 #include "BKE_effect.h"
53 #include "BKE_main.h"
54 #include "BKE_mesh.h"
55 #include "BKE_modifier.h"
56 #include "BKE_paint.h"
57 #include "BKE_screen.h"
58 #include "BKE_tessmesh.h"
59
60 #include "ED_mesh.h"
61 #include "ED_util.h"
62 #include "ED_screen.h"
63 #include "ED_transform.h"
64 #include "ED_types.h"
65
66 #include "WM_api.h"
67 #include "WM_types.h"
68
69 #include "RNA_define.h"
70 #include "RNA_enum_types.h"
71
72 #include "UI_interface.h"
73 #include "UI_resources.h"
74
75 #include "view3d_intern.h"
76
77
78 /* View3d->modeselect 
79  * This is a bit of a dodgy hack to enable a 'mode' menu with icons+labels
80  * rather than those buttons.
81  * I know the implementation's not good - it's an experiment to see if this
82  * approach would work well
83  *
84  * This can be cleaned when I make some new 'mode' icons.
85  */
86
87 /* view3d handler codes */
88 #define VIEW3D_HANDLER_BACKGROUND       1
89 #define VIEW3D_HANDLER_PROPERTIES       2
90 #define VIEW3D_HANDLER_OBJECT           3
91 #define VIEW3D_HANDLER_PREVIEW          4
92 #define VIEW3D_HANDLER_MULTIRES         5
93 #define VIEW3D_HANDLER_TRANSFORM        6
94 #define VIEW3D_HANDLER_GREASEPENCIL 7
95 #define VIEW3D_HANDLER_BONESKETCH       8
96
97 /* end XXX ************* */
98
99 static void do_view3d_header_buttons(bContext *C, void *arg, int event);
100
101 #define B_SCENELOCK 101
102 #define B_FULL          102
103 #define B_HOME          103
104 #define B_VIEWBUT       104
105 #define B_PERSP         105
106 #define B_MODESELECT 108
107 #define B_SEL_VERT      110
108 #define B_SEL_EDGE      111
109 #define B_SEL_FACE      112
110 #define B_MAN_TRANS     116
111 #define B_MAN_ROT       117
112 #define B_MAN_SCALE     118
113 #define B_NDOF          119     
114 #define B_MAN_MODE      120
115 #define B_REDR          122
116 #define B_NOP           123
117
118 // XXX quickly ported across
119 static void handle_view3d_lock(bContext *C) 
120 {
121         Main *bmain= CTX_data_main(C);
122         Scene *scene= CTX_data_scene(C);
123         ScrArea *sa= CTX_wm_area(C);
124         View3D *v3d= CTX_wm_view3d(C);
125         
126         if (v3d != NULL && sa != NULL) {
127                 if(v3d->localvd==NULL && v3d->scenelock && sa->spacetype==SPACE_VIEW3D) {
128                         /* copy to scene */
129                         scene->lay= v3d->lay;
130                         scene->layact= v3d->layact;
131                         scene->camera= v3d->camera;
132
133                         /* not through notifiery, listener don't have context
134                            and non-open screens or spaces need to be updated too */
135                         BKE_screen_view3d_main_sync(&bmain->screen, scene);
136                         
137                         /* notifiers for scene update */
138                         WM_event_add_notifier(C, NC_SCENE|ND_LAYER, scene);
139                 }
140         }
141 }
142
143 /* layer code is on three levels actually:
144 - here for operator
145 - uiTemplateLayers in interface/ code for buttons
146 - ED_view3d_scene_layer_set for RNA
147  */
148 static void view3d_layers_editmode_ensure(Scene *scene, View3D *v3d)
149 {
150         /* sanity check - when in editmode disallow switching the editmode layer off since its confusing
151          * an alternative would be to always draw the editmode object. */
152         if(scene->obedit && (scene->obedit->lay & v3d->lay)==0) {
153                 int bit;
154                 for(bit=0; bit<32; bit++) {
155                         if(scene->obedit->lay & (1<<bit)) {
156                                 v3d->lay |= 1<<bit;
157                                 break;
158                         }
159                 }
160         }
161 }
162
163 static int view3d_layers_exec(bContext *C, wmOperator *op)
164 {
165         Scene *scene= CTX_data_scene(C);
166         ScrArea *sa= CTX_wm_area(C);
167         View3D *v3d= sa->spacedata.first;
168         int nr= RNA_int_get(op->ptr, "nr");
169         int toggle= RNA_boolean_get(op->ptr, "toggle");
170         
171         if(nr < 0)
172                 return OPERATOR_CANCELLED;
173
174         if(nr == 0) {
175                 /* all layers */
176                 if(!v3d->layact)
177                         v3d->layact= 1;
178
179                 if (toggle && v3d->lay == ((1<<20)-1)) {
180                         /* return to active layer only */
181                         v3d->lay = v3d->layact;
182
183                         view3d_layers_editmode_ensure(scene, v3d);
184                 }
185                 else {
186                         v3d->lay |= (1<<20)-1;
187                 }               
188         }
189         else {
190                 int bit;
191                 nr--;
192
193                 if(RNA_boolean_get(op->ptr, "extend")) {
194                         if(toggle && v3d->lay & (1<<nr) && (v3d->lay & ~(1<<nr)))
195                                 v3d->lay &= ~(1<<nr);
196                         else
197                                 v3d->lay |= (1<<nr);
198                 } else {
199                         v3d->lay = (1<<nr);
200                 }
201
202                 view3d_layers_editmode_ensure(scene, v3d);
203
204                 /* set active layer, ensure to always have one */
205                 if(v3d->lay & (1<<nr))
206                    v3d->layact= 1<<nr;
207                 else if((v3d->lay & v3d->layact)==0) {
208                         for(bit=0; bit<32; bit++) {
209                                 if(v3d->lay & (1<<bit)) {
210                                         v3d->layact= 1<<bit;
211                                         break;
212                                 }
213                         }
214                 }
215         }
216         
217         if(v3d->scenelock) handle_view3d_lock(C);
218         
219         DAG_on_visible_update(CTX_data_main(C), FALSE);
220
221         ED_area_tag_redraw(sa);
222         
223         return OPERATOR_FINISHED;
224 }
225
226 /* applies shift and alt, lazy coding or ok? :) */
227 /* the local per-keymap-entry keymap will solve it */
228 static int view3d_layers_invoke(bContext *C, wmOperator *op, wmEvent *event)
229 {
230         if(event->ctrl || event->oskey)
231                 return OPERATOR_PASS_THROUGH;
232         
233         if(event->shift)
234                 RNA_boolean_set(op->ptr, "extend", TRUE);
235         
236         if(event->alt) {
237                 int nr= RNA_int_get(op->ptr, "nr") + 10;
238                 RNA_int_set(op->ptr, "nr", nr);
239         }
240         view3d_layers_exec(C, op);
241         
242         return OPERATOR_FINISHED;
243 }
244
245 static int view3d_layers_poll(bContext *C)
246 {
247         return (ED_operator_view3d_active(C) && CTX_wm_view3d(C)->localvd==NULL);
248 }
249
250 void VIEW3D_OT_layers(wmOperatorType *ot)
251 {
252         /* identifiers */
253         ot->name= "Layers";
254         ot->description= "Toggle layer(s) visibility";
255         ot->idname= "VIEW3D_OT_layers";
256         
257         /* api callbacks */
258         ot->invoke= view3d_layers_invoke;
259         ot->exec= view3d_layers_exec;
260         ot->poll= view3d_layers_poll;
261         
262         /* flags */
263         ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
264         
265         RNA_def_int(ot->srna, "nr", 1, 0, 20, "Number", "The layer number to set, zero for all layers", 0, 20);
266         RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Add this layer to the current view layers");
267         RNA_def_boolean(ot->srna, "toggle", 1, "Toggle", "Toggle the layer");
268 }
269
270 static int modeselect_addmode(char *str, const char *title, int id, int icon)
271 {
272         static char formatstr[] = "|%s %%x%d %%i%d";
273
274         return sprintf(str, formatstr, IFACE_(title), id, icon);
275 }
276
277 static char *view3d_modeselect_pup(Scene *scene)
278 {
279         Object *ob= OBACT;
280         static char string[512];
281         const char *title= IFACE_("Mode: %t");
282         char *str = string;
283
284         BLI_strncpy(str, title, sizeof(string));
285
286         str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA);
287
288         if(ob==NULL || ob->data==NULL) return string;
289         if(ob->id.lib) return string;
290
291         if(!((ID *)ob->data)->lib) {
292                 /* if active object is editable */
293                 if ( ((ob->type == OB_MESH)
294                         || (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
295                         || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
296
297                         str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
298                 }
299                 else if (ob->type == OB_ARMATURE) {
300                         if (ob->mode & OB_MODE_POSE)
301                                 str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
302                         else
303                                 str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
304                 }
305
306                 if (ob->type == OB_MESH) {
307
308                         str += modeselect_addmode(str, N_("Sculpt Mode"), OB_MODE_SCULPT, ICON_SCULPTMODE_HLT);
309                         str += modeselect_addmode(str, N_("Vertex Paint"), OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT);
310                         str += modeselect_addmode(str, N_("Texture Paint"), OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT);
311                         str += modeselect_addmode(str, N_("Weight Paint"), OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT);
312                 }
313         }
314
315         /* if active object is an armature */
316         if (ob->type==OB_ARMATURE) {
317                 str += modeselect_addmode(str, N_("Pose Mode"), OB_MODE_POSE, ICON_POSE_HLT);
318         }
319
320         if ( ob->particlesystem.first ||
321              modifiers_findByType(ob, eModifierType_Cloth) ||
322              modifiers_findByType(ob, eModifierType_Softbody))
323         {
324                 str += modeselect_addmode(str, N_("Particle Mode"), OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
325         }
326         (void)str;
327         return (string);
328 }
329
330
331 static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
332 {
333         wmWindow *win= CTX_wm_window(C);
334         ToolSettings *ts= CTX_data_tool_settings(C);
335         ScrArea *sa= CTX_wm_area(C);
336         View3D *v3d= sa->spacedata.first;
337         Object *obedit = CTX_data_edit_object(C);
338         BMEditMesh *em= NULL;
339         int ctrl= win->eventstate->ctrl, shift= win->eventstate->shift;
340         PointerRNA props_ptr;
341         
342         if(obedit && obedit->type==OB_MESH) {
343                 em= ((Mesh *)obedit->data)->edit_btmesh;
344         }
345         /* watch it: if sa->win does not exist, check that when calling direct drawing routines */
346
347         switch(event) {
348         case B_REDR:
349                 ED_area_tag_redraw(sa);
350                 break;
351                 
352         case B_MODESELECT:
353                 WM_operator_properties_create(&props_ptr, "OBJECT_OT_mode_set");
354                 RNA_enum_set(&props_ptr, "mode", v3d->modeselect);
355                 WM_operator_name_call(C, "OBJECT_OT_mode_set", WM_OP_EXEC_REGION_WIN, &props_ptr);
356                 WM_operator_properties_free(&props_ptr);
357                 break;          
358                 
359         case B_SEL_VERT:
360                 if(em) {
361                         if(shift==0 || em->selectmode==0)
362                                 em->selectmode= SCE_SELECT_VERTEX;
363                         ts->selectmode= em->selectmode;
364                         EDBM_selectmode_set(em);
365                         WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
366                         ED_undo_push(C, "Selectmode Set: Vertex");
367                 }
368                 break;
369         case B_SEL_EDGE:
370                 if(em) {
371                         if(shift==0 || em->selectmode==0){
372                                 if( (em->selectmode ^ SCE_SELECT_EDGE) == SCE_SELECT_VERTEX){
373                                         if(ctrl) EDBM_convertsel(em, SCE_SELECT_VERTEX,SCE_SELECT_EDGE); 
374                                 }
375                                 em->selectmode = SCE_SELECT_EDGE;
376                         }
377                         ts->selectmode= em->selectmode;
378                         EDBM_selectmode_set(em);
379                         WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
380                         ED_undo_push(C, "Selectmode Set: Edge");
381                 }
382                 break;
383         case B_SEL_FACE:
384                 if(em) {
385                         if( shift==0 || em->selectmode==0){
386                                 if( ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){
387                                         if(ctrl) EDBM_convertsel(em, (ts->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE);
388                                 }
389                                 em->selectmode = SCE_SELECT_FACE;
390                         }
391                         ts->selectmode= em->selectmode;
392                         EDBM_selectmode_set(em);
393                         WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
394                         ED_undo_push(C, "Selectmode Set: Face");
395                 }
396                 break;  
397
398         case B_MAN_TRANS:
399                 if( shift==0 || v3d->twtype==0) {
400                         v3d->twtype= V3D_MANIP_TRANSLATE;
401                 }
402                 ED_area_tag_redraw(sa);
403                 break;
404         case B_MAN_ROT:
405                 if( shift==0 || v3d->twtype==0) {
406                         v3d->twtype= V3D_MANIP_ROTATE;
407                 }
408                 ED_area_tag_redraw(sa);
409                 break;
410         case B_MAN_SCALE:
411                 if( shift==0 || v3d->twtype==0) {
412                         v3d->twtype= V3D_MANIP_SCALE;
413                 }
414                 ED_area_tag_redraw(sa);
415                 break;
416         case B_NDOF:
417                 ED_area_tag_redraw(sa);
418                 break;
419         case B_MAN_MODE:
420                 ED_area_tag_redraw(sa);
421                 break;
422         default:
423                 break;
424         }
425 }
426
427 /* Returns the icon associated with an object mode */
428 static int object_mode_icon(int mode)
429 {
430         EnumPropertyItem *item = object_mode_items;
431         
432         while(item->name != NULL) {
433                 if(item->value == mode)
434                         return item->icon;
435                 ++item;
436         }
437
438         return ICON_OBJECT_DATAMODE;
439 }
440
441 void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
442 {
443         Object *obedit = CTX_data_edit_object(C);
444         uiBlock *block= uiLayoutGetBlock(layout);
445
446         uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL);
447
448         if(obedit && (obedit->type == OB_MESH)) {
449                 BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
450                 uiLayout *row;
451
452                 row= uiLayoutRow(layout, 1);
453                 block= uiLayoutGetBlock(row);
454                 uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
455                 uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
456                 uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,UI_UNIT_X,UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
457         }
458 }
459
460 void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
461 {
462         bScreen *screen= CTX_wm_screen(C);
463         ScrArea *sa= CTX_wm_area(C);
464         View3D *v3d= sa->spacedata.first;
465         Scene *scene= CTX_data_scene(C);
466         ToolSettings *ts= CTX_data_tool_settings(C);
467         PointerRNA v3dptr, toolsptr, sceneptr;
468         Object *ob= OBACT;
469         Object *obedit = CTX_data_edit_object(C);
470         uiBlock *block;
471         uiBut *but;
472         uiLayout *row;
473         const float dpi_fac= UI_DPI_FAC;
474         
475         RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr);        
476         RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &toolsptr);
477         RNA_pointer_create(&scene->id, &RNA_Scene, scene, &sceneptr);
478
479         block= uiLayoutGetBlock(layout);
480         uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL);
481
482         /* other buttons: */
483         uiBlockSetEmboss(block, UI_EMBOSS);
484         
485         /* mode */
486         if(ob) {
487                 v3d->modeselect = ob->mode;
488         }
489         else {
490                 v3d->modeselect = OB_MODE_OBJECT;
491         }
492
493         row= uiLayoutRow(layout, 1);
494         uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) , 
495                           0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_("Mode"));
496         
497         /* Draw type */
498         uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
499
500         if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)))) {
501                 /* Manipulators aren't used in weight paint mode */
502                 
503                 PointerRNA meshptr;
504
505                 RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr);
506                 if(ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) {
507                         uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
508                 }
509                 else {
510                         
511                         row= uiLayoutRow(layout, 1);
512                         uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
513                         uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
514                 }
515         } else {
516                 const char *str_menu;
517
518                 row= uiLayoutRow(layout, 1);
519                 uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
520
521                 /* pose/object only however we want to allow in weight paint mode too
522                  * so dont be totally strict and just check not-editmode for now */
523                 if (obedit == NULL) {
524                         uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
525                 }
526
527                 /* Transform widget / manipulators */
528                 row= uiLayoutRow(layout, 1);
529                 uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
530                 block= uiLayoutGetBlock(row);
531                 
532                 if(v3d->twflag & V3D_USE_MANIPULATOR) {
533                         but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Translate manipulator mode"));
534                         uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
535                         but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Rotate manipulator mode"));
536                         uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
537                         but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Scale manipulator mode"));
538                         uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
539                 }
540                         
541                 if (v3d->twmode > (BIF_countTransformOrientation(C) - 1) + V3D_MANIP_CUSTOM) {
542                         v3d->twmode = 0;
543                 }
544                         
545                 str_menu = BIF_menustringTransformOrientation(C, "Orientation");
546                 but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_("Transform Orientation"));
547                 uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
548                 MEM_freeN((void *)str_menu);
549         }
550
551         if(obedit==NULL && v3d->localvd==NULL) {
552                 unsigned int ob_lay = ob ? ob->lay : 0;
553
554                 /* Layers */
555                 uiTemplateLayers(layout, v3d->scenelock ? &sceneptr : &v3dptr, "layers", &v3dptr, "layers_used", ob_lay);
556
557                 /* Scene lock */
558                 uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
559         }
560         
561         uiTemplateEditModeSelection(layout, C);
562 }