committing working copy
[blender.git] / source / blender / editors / space_image / image_header.c
1 /**
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * The Original Code is Copyright (C) 2008 Blender Foundation.
21  * All rights reserved.
22  *
23  * 
24  * Contributor(s): Blender Foundation
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 #include <string.h>
30 #include <stdio.h>
31
32 #include "DNA_object_types.h"
33 #include "DNA_space_types.h"
34 #include "DNA_windowmanager_types.h"
35
36 #include "MEM_guardedalloc.h"
37
38 #include "BLI_blenlib.h"
39 #include "BLI_editVert.h"
40
41 #include "BKE_context.h"
42 #include "BKE_customdata.h"
43 #include "BKE_image.h"
44 #include "BKE_mesh.h"
45 #include "BKE_screen.h"
46 #include "BKE_utildefines.h"
47 #include "BKE_mesh.h"
48
49
50 #include "ED_image.h"
51
52 #include "WM_types.h"
53
54 #include "BIF_gl.h"
55 #include "BIF_glutil.h"
56
57 #include "UI_interface.h"
58
59
60
61 #include "image_intern.h"
62
63 /********************** toolbox operator *********************/
64
65 static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event)
66 {
67         SpaceImage *sima= CTX_wm_space_image(C);
68         Object *obedit= CTX_data_edit_object(C);
69         uiPopupMenu *pup;
70         uiLayout *layout;
71         int show_uvedit;
72
73         show_uvedit= ED_space_image_show_uvedit(sima, obedit);
74
75         pup= uiPupMenuBegin(C, "Toolbox", 0);
76         layout= uiPupMenuLayout(pup);
77
78         uiItemM(layout, C, "IMAGE_MT_view", NULL, 0);
79         if(show_uvedit) uiItemM(layout, C, "IMAGE_MT_select", NULL, 0);
80         uiItemM(layout, C, "IMAGE_MT_image", NULL, 0);
81         if(show_uvedit) uiItemM(layout, C, "IMAGE_MT_uvs", NULL, 0);
82
83         uiPupMenuEnd(C, pup);
84
85         return OPERATOR_CANCELLED;
86 }
87
88 void IMAGE_OT_toolbox(wmOperatorType *ot)
89 {
90         /* identifiers */
91         ot->name= "Toolbox";
92         ot->idname= "IMAGE_OT_toolbox";
93         
94         /* api callbacks */
95         ot->invoke= toolbox_invoke;
96         ot->poll= space_image_main_area_poll;
97 }
98