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 *****
33 #include "DNA_space_types.h"
34 #include "DNA_scene_types.h"
35 #include "DNA_screen_types.h"
36 #include "DNA_windowmanager_types.h"
38 #include "MEM_guardedalloc.h"
40 #include "BLI_blenlib.h"
42 #include "BKE_context.h"
43 #include "BKE_global.h"
45 #include "BKE_screen.h"
47 #include "ED_screen.h"
55 #include "BIF_glutil.h"
57 #include "UI_interface.h"
58 #include "UI_resources.h"
59 #include "UI_view2d.h"
61 #include "outliner_intern.h"
64 /* ************************ header area region *********************** */
66 static void do_viewmenu(bContext *C, void *arg, int event)
68 ScrArea *curarea= CTX_wm_area(C);
69 SpaceOops *soops= curarea->spacedata.first;
72 case 0: /* Shuffle Selected Blocks */
75 case 1: /* Shrink Selected Blocks */
78 case 2: /* View All */
79 //do_oops_buttons(B_OOPSHOME);
81 case 3: /* View All */
82 //do_oops_buttons(B_OOPSVIEWSEL);
84 case 4: /* Maximize Window */
85 /* using event B_FULL */
88 case 14: /* show outliner viewer */
89 soops->type= SO_OUTLINER;
92 //outliner_toggle_visible(curarea);
95 //outliner_show_hierarchy(curarea);
98 //outliner_show_active(curarea);
101 //outliner_one_level(curarea, 1);
104 //outliner_one_level(curarea, -1);
107 if (soops->flag & SO_HIDE_RESTRICTCOLS) soops->flag &= ~SO_HIDE_RESTRICTCOLS;
108 else soops->flag |= SO_HIDE_RESTRICTCOLS;
111 ED_area_tag_redraw(curarea);
114 static uiBlock *outliner_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
116 ScrArea *curarea= CTX_wm_area(C);
117 SpaceOops *soops= curarea->spacedata.first;
119 short yco= 0, menuwidth=120;
121 block= uiBeginBlock(C, ar, "outliner_viewmenu", UI_EMBOSSP, UI_HELV);
122 uiBlockSetButmFunc(block, do_viewmenu, NULL);
124 if(soops->type==SO_OUTLINER) {
125 if (soops->flag & SO_HIDE_RESTRICTCOLS)
126 uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Show Restriction Columns", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
128 uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Show Restriction Columns", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
130 uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
132 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Expand One Level|NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
133 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Collapse One Level|NumPad -", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
135 uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
137 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show/Hide All", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
138 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hierarchy|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
139 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Active|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
142 // uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
143 // if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
144 // else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, "");
147 if(curarea->headertype==HEADERTOP) {
148 uiBlockSetDirection(block, UI_DOWN);
151 uiBlockSetDirection(block, UI_TOP);
152 uiBlockFlipOrder(block);
155 uiTextBoundsBlock(block, 50);
156 uiEndBlock(C, block);
162 static void do_outliner_buttons(bContext *C, void *arg, int event)
164 ScrArea *sa= CTX_wm_area(C);
168 ED_area_tag_redraw(sa);
174 void outliner_header_buttons(const bContext *C, ARegion *ar)
176 ScrArea *sa= CTX_wm_area(C);
177 SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C);
179 int xco, yco= 3, xmax;
181 block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
182 uiBlockSetHandleFunc(block, do_outliner_buttons, NULL);
184 xco= ED_area_header_standardbuttons(C, block, yco);
186 if((sa->flag & HEADER_NO_PULLDOWN)==0) {
188 /* pull down menus */
189 uiBlockSetEmboss(block, UI_EMBOSSP);
191 xmax= GetButStringLength("View");
192 uiDefPulldownBut(block, outliner_viewmenu, CTX_wm_area(C),
193 "View", xco, yco-2, xmax-3, 24, "");
199 uiBlockSetEmboss(block, UI_EMBOSS);
202 //if (outliner->type==SO_OUTLINER) {
203 if(G.main->library.first)
204 uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10|Datablocks %x11|User Preferences %x12", xco, yco, 120, 20, &soutliner->outlinevis, 0, 0, 0, 0, "");
206 uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10|Datablocks %x11|User Preferences %x12", xco, yco, 120, 20, &soutliner->outlinevis, 0, 0, 0, 0, "");
211 UI_view2d_totRect_set(&ar->v2d, xco+XIC+100, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin));
213 uiEndBlock(C, block);
214 uiDrawBlock(C, block);