4 * ***** BEGIN GPL LICENSE BLOCK *****
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2008 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation
26 * ***** END GPL LICENSE BLOCK *****
32 #include "DNA_space_types.h"
33 #include "DNA_scene_types.h"
34 #include "DNA_screen_types.h"
35 #include "DNA_windowmanager_types.h"
37 #include "MEM_guardedalloc.h"
39 #include "BLI_blenlib.h"
41 #include "BKE_context.h"
42 #include "BKE_global.h"
43 #include "BKE_screen.h"
45 #include "ED_screen.h"
53 #include "BIF_glutil.h"
55 #include "UI_interface.h"
56 #include "UI_resources.h"
57 #include "UI_view2d.h"
59 #include "info_intern.h"
62 /* ************************ header area region *********************** */
64 #define B_STOPRENDER 1
66 static void do_viewmenu(bContext *C, void *arg, int event)
70 static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
72 ScrArea *curarea= CTX_wm_area(C);
74 short yco= 0, menuwidth=120;
76 block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
77 uiBlockSetButmFunc(block, do_viewmenu, NULL);
79 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
80 menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
82 if(curarea->headertype==HEADERTOP) {
83 uiBlockSetDirection(block, UI_DOWN);
86 uiBlockSetDirection(block, UI_TOP);
87 uiBlockFlipOrder(block);
90 uiTextBoundsBlock(block, 50);
97 static void do_info_buttons(bContext *C, void *arg, int event)
106 static void screen_idpoin_handle(bContext *C, ID *id, int event)
111 /* exception: can't set screens inside of area/region handers */
112 WM_event_add_notifier(C, NC_SCREEN|ND_SCREENBROWSE, id);
120 /* XXX not implemented */
123 /* XXX not implemented */
126 /* XXX not implemented */
133 static void scene_idpoin_handle(bContext *C, ID *id, int event)
138 WM_event_add_notifier(C, NC_SCREEN|ND_SCENEBROWSE, CTX_wm_screen(C));
146 /* XXX not implemented */
149 /* XXX not implemented */
152 /* XXX not implemented */
160 void info_header_buttons(const bContext *C, ARegion *ar)
162 wmWindow *win= CTX_wm_window(C);
163 bScreen *screen= CTX_wm_screen(C);
164 ScrArea *sa= CTX_wm_area(C);
165 SpaceInfo *si= sa->spacedata.first;
169 block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
170 uiBlockSetHandleFunc(block, do_info_buttons, NULL);
172 xco= ED_area_header_standardbuttons(C, block, yco);
174 if((sa->flag & HEADER_NO_PULLDOWN)==0) {
177 /* pull down menus */
178 uiBlockSetEmboss(block, UI_EMBOSSP);
180 xmax= GetButStringLength("File");
181 uiDefPulldownBut(block, dummy_viewmenu, sa, "File", xco, yco, xmax-3, 22, "");
184 xmax= GetButStringLength("Add");
185 uiDefPulldownBut(block, dummy_viewmenu, sa, "Add", xco, yco, xmax-3, 22, "");
188 xmax= GetButStringLength("Timeline");
189 uiDefPulldownBut(block, dummy_viewmenu, sa, "Timeline", xco, yco, xmax-3, 22, "");
192 xmax= GetButStringLength("Game");
193 uiDefPulldownBut(block, dummy_viewmenu, sa, "Game", xco, yco, xmax-3, 22, "");
196 xmax= GetButStringLength("Render");
197 uiDefPulldownBut(block, dummy_viewmenu, sa, "Render", xco, yco, xmax-3, 22, "");
200 xmax= GetButStringLength("Help");
201 uiDefPulldownBut(block, dummy_viewmenu, NULL, "Help", xco, yco, xmax-3, 22, "");
205 uiBlockSetEmboss(block, UI_EMBOSS);
207 if(screen->full==NULL) {
208 si->screen= win->screen;
209 xco= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID**)&si->screen, ID_SCR, NULL, xco, yco,
210 screen_idpoin_handle, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_DELETE);
212 si->scene= screen->scene;
213 xco= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID**)&si->scene, ID_SCE, NULL, xco, yco,
214 scene_idpoin_handle, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_DELETE);
218 if(WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
219 uiDefIconTextBut(block, BUT, B_STOPRENDER, ICON_REC, "Render", xco+5,yco,75,19, NULL, 0.0f, 0.0f, 0, 0, "Stop rendering");
223 UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
225 uiEndBlock(C, block);
226 uiDrawBlock(C, block);