Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2008-12-14 15:16:55 +0300
committerTon Roosendaal <ton@blender.org>2008-12-14 15:16:55 +0300
commita4b6ee672d298a077d6adeac022c6d025d6e082a (patch)
treeef38678c1f2dd499131eb45b362952ff61c2ffc6
parent21e01ccac356a9d8e9dee01c48db54e70ededec7 (diff)
2.5
- Added file space (too) :) Andrea was first, this is more complete. - Suggestion from Joshua: move all standard header buttons to 1 function, makes it all easier, less code, and less area/space stuff needs to be exposed.
-rw-r--r--source/Makefile1
-rw-r--r--source/blender/editors/SConscript1
-rw-r--r--source/blender/editors/include/ED_screen.h5
-rw-r--r--source/blender/editors/include/ED_util.h1
-rw-r--r--source/blender/editors/screen/area.c89
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c36
-rw-r--r--source/blender/editors/space_file/Makefile2
-rw-r--r--source/blender/editors/space_file/file_header.c42
-rw-r--r--source/blender/editors/space_file/file_intern.h42
-rw-r--r--source/blender/editors/space_file/filesel.c92
-rw-r--r--source/blender/editors/space_file/space_file.c54
-rw-r--r--source/blender/editors/space_image/image_header.c39
-rw-r--r--source/blender/editors/space_info/info_header.c38
-rw-r--r--source/blender/editors/space_ipo/ipo_header.c39
-rw-r--r--source/blender/editors/space_node/node_header.c39
-rw-r--r--source/blender/editors/space_outliner/outliner_header.c39
-rw-r--r--source/blender/editors/space_time/time_header.c36
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c38
-rw-r--r--source/blender/editors/util/ed_util.c40
19 files changed, 287 insertions, 386 deletions
diff --git a/source/Makefile b/source/Makefile
index 57d250b7d22..ec3abe5f868 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -235,6 +235,7 @@ PULIB = $(NAN_MOTO)/lib/libmoto.a
PULIB += $(NAN_ELBEEM)/lib/$(DEBUG_DIR)libelbeem.a
PULIB += $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
PULIB += $(OCGDIR)/blender/ed_space/libed_space.a
+PULIB += $(OCGDIR)/blender/ed_file/libed_file.a
PULIB += $(OCGDIR)/blender/ed_info/libed_info.a
PULIB += $(OCGDIR)/blender/ed_buttons/libed_buttons.a
PULIB += $(OCGDIR)/blender/ed_node/libed_node.a
diff --git a/source/blender/editors/SConscript b/source/blender/editors/SConscript
index 9a1dbe491a7..8c7943a1108 100644
--- a/source/blender/editors/SConscript
+++ b/source/blender/editors/SConscript
@@ -17,5 +17,6 @@ SConscript(['datafiles/SConscript',
'space_node/SConscript',
'space_buttons/SConscript',
'space_info/SConscript',
+ 'space_file/SConscript',
'transform/SConscript',
'screen/SConscript'])
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index dd6137aa46c..7292cc87366 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -38,6 +38,7 @@ struct wmWindow;
struct wmNotifier;
struct SpaceType;
struct AreagionType;
+struct uiBlock;
/* regions */
void ED_region_do_listen(ARegion *ar, struct wmNotifier *note);
@@ -50,8 +51,8 @@ ARegion *ED_region_copy(ARegion *ar);
/* spaces */
void ED_spacetypes_init(void);
void ED_spacetypes_keymap(struct wmWindowManager *wm);
-struct ARegionType *ED_regiontype_from_id(struct SpaceType *st, int regionid);
-void ED_newspace(struct ScrArea *sa, int type);
+struct ARegionType *ED_regiontype_from_id(struct SpaceType *st, int regionid);
+int ED_area_header_standardbuttons(const bContext *C, struct uiBlock *block, int yco);
/* areas */
void ED_area_initialize(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *sa);
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index 10e9c0473a2..d0a4b93bfae 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -35,7 +35,6 @@
void apply_keyb_grid(float *val, float fac1, float fac2, float fac3, int invert);
int GetButStringLength(char *str);
-char *windowtype_pup(void);
#endif /* ED_UTIL_H */
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 32813041d2d..1097062c526 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -57,6 +57,8 @@
#include "BPY_extern.h"
#endif
+#include "ED_util.h"
+
#include "screen_intern.h"
/* general area and region code */
@@ -499,7 +501,10 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
#endif
}
-void ED_newspace(ScrArea *sa, int type)
+/* *********** Space switching code, local now *********** */
+/* XXX make operator for this */
+
+static void newspace(ScrArea *sa, int type)
{
if(sa->spacetype != type) {
SpaceType *st= BKE_spacetype_from_id(type);
@@ -548,4 +553,86 @@ void ED_newspace(ScrArea *sa, int type)
}
}
+static char *windowtype_pup(void)
+{
+ return(
+ "Window type:%t" //14
+ "|3D View %x1" //30
+
+ "|%l" // 33
+
+ "|Ipo Curve Editor %x2" //54
+ "|Action Editor %x12" //73
+ "|NLA Editor %x13" //94
+
+ "|%l" //97
+
+ "|UV/Image Editor %x6" //117
+
+ "|Video Sequence Editor %x8" //143
+ "|Timeline %x15" //163
+ "|Audio Window %x11" //163
+ "|Text Editor %x9" //179
+
+ "|%l" //192
+
+
+ "|User Preferences %x7" //213
+ "|Outliner %x3" //232
+ "|Buttons Window %x4" //251
+ "|Node Editor %x16"
+ "|%l" //254
+
+ "|Image Browser %x10" //273
+ "|File Browser %x5" //290
+
+ "|%l" //293
+
+ "|Scripts Window %x14"//313
+ );
+}
+
+static void spacefunc(struct bContext *C, void *arg1, void *arg2)
+{
+ newspace(C->area, C->area->butspacetype);
+ WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+}
+
+/* returns offset for next button in header */
+int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
+{
+ uiBut *but;
+ int xco= 8;
+
+ if(ED_screen_area_active(C)) uiBlockSetCol(block, TH_HEADER);
+ else uiBlockSetCol(block, TH_HEADERDESEL);
+
+ but= uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D,
+ windowtype_pup(), xco, yco, XIC+10, YIC,
+ &(C->area->butspacetype), 1.0, SPACEICONMAX, 0, 0,
+ "Displays Current Window Type. "
+ "Click for menu of available types.");
+ uiButSetFunc(but, spacefunc, NULL, NULL);
+
+ xco += XIC + 14;
+
+ uiBlockSetEmboss(block, UI_EMBOSSN);
+ if (C->area->flag & HEADER_NO_PULLDOWN) {
+ uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
+ ICON_DISCLOSURE_TRI_RIGHT,
+ xco,yco,XIC,YIC-2,
+ &(C->area->flag), 0, 0, 0, 0,
+ "Show pulldown menus");
+ }
+ else {
+ uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
+ ICON_DISCLOSURE_TRI_DOWN,
+ xco,yco,XIC,YIC-2,
+ &(C->area->flag), 0, 0, 0, 0,
+ "Hide pulldown menus");
+ }
+ xco+=XIC;
+
+ return xco;
+}
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 7850a1dc818..3f07b220b64 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -90,7 +90,6 @@ static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-#define B_NEWSPACE 100
#define B_CONTEXT_SWITCH 101
#define B_BUTSPREVIEW 102
#define B_NEWFRAME 103
@@ -98,10 +97,6 @@ static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
static void do_buttons_buttons(bContext *C, void *arg, int event)
{
switch(event) {
- case B_NEWSPACE:
- ED_newspace(C->area, C->area->butspacetype);
- WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
- break;
case B_NEWFRAME:
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
break;
@@ -119,36 +114,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_buttons_buttons, NULL);
- if(ED_screen_area_active(C)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, yco, XIC+10, YIC,
- &(C->area->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
+ xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
diff --git a/source/blender/editors/space_file/Makefile b/source/blender/editors/space_file/Makefile
index 07811dc88d1..5376f01325d 100644
--- a/source/blender/editors/space_file/Makefile
+++ b/source/blender/editors/space_file/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: $
+# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
diff --git a/source/blender/editors/space_file/file_header.c b/source/blender/editors/space_file/file_header.c
index d52a35ffbb7..b4f2817d3cb 100644
--- a/source/blender/editors/space_file/file_header.c
+++ b/source/blender/editors/space_file/file_header.c
@@ -54,6 +54,8 @@
#include "UI_resources.h"
#include "UI_view2d.h"
+#include "file_intern.h"
+
/* ************************ header area region *********************** */
@@ -88,16 +90,11 @@ static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-#define B_NEWSPACE 100
static void do_file_buttons(bContext *C, void *arg, int event)
{
switch(event) {
- case B_NEWSPACE:
- ED_newspace(C->area, C->area->butspacetype);
- WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
- break;
- }
+ }
}
@@ -105,41 +102,12 @@ void file_header_buttons(const bContext *C, ARegion *ar)
{
ScrArea *sa= C->area;
uiBlock *block;
- short xco, yco= 3;
+ int xco, yco= 3;
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_file_buttons, NULL);
- if(ED_screen_area_active(C)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, yco, XIC+10, YIC,
- &(C->area->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
+ xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
new file mode 100644
index 00000000000..2322c60f9c9
--- /dev/null
+++ b/source/blender/editors/space_file/file_intern.h
@@ -0,0 +1,42 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef ED_FILE_INTERN_H
+#define ED_FILE_INTERN_H
+
+/* internal exports only */
+
+
+/* file_header.c */
+void file_header_buttons(const bContext *C, ARegion *ar);
+
+/* filesel.c */
+
+void freefilelist(SpaceFile *sfile);
+
+#endif /* ED_FILE_INTERN_H */
+
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
new file mode 100644
index 00000000000..36e2bae133b
--- /dev/null
+++ b/source/blender/editors/space_file/filesel.c
@@ -0,0 +1,92 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#ifdef WIN32
+#include <io.h>
+#include <direct.h>
+#include "BLI_winstuff.h"
+#else
+#include <unistd.h>
+#include <sys/times.h>
+#endif
+
+#include "DNA_space_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_linklist.h"
+#include "BLI_storage_types.h"
+#include "BLI_dynstr.h"
+
+#include "BKE_global.h"
+#include "BKE_screen.h"
+
+#include "ED_screen.h"
+#include "ED_util.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+
+#include "file_intern.h"
+
+
+void freefilelist(SpaceFile *sfile)
+{
+ int num;
+
+ num= sfile->totfile-1;
+
+ if (sfile->filelist==0) return;
+
+ for(; num>=0; num--){
+ MEM_freeN(sfile->filelist[num].relname);
+
+ if (sfile->filelist[num].string) MEM_freeN(sfile->filelist[num].string);
+ }
+ free(sfile->filelist);
+ sfile->filelist= 0;
+}
+
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 9a7ffe77eba..b6d87ee0224 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -29,7 +29,6 @@
#include <string.h>
#include <stdio.h>
-#include "DNA_image_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
@@ -37,6 +36,8 @@
#include "MEM_guardedalloc.h"
+#include "BLO_readfile.h"
+
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BLI_rand.h"
@@ -57,18 +58,22 @@
#include "UI_resources.h"
#include "UI_view2d.h"
+#include "ED_markers.h"
+
+#include "file_intern.h" // own include
-/* ******************** default callbacks for image space ***************** */
+/* ******************** default callbacks for file space ***************** */
static SpaceLink *file_new(void)
{
ARegion *ar;
SpaceFile *sfile;
- sfile= MEM_callocN(sizeof(SpaceImage), "initimage");
+ sfile= MEM_callocN(sizeof(SpaceFile), "initfile");
sfile->spacetype= SPACE_FILE;
- /* XXX init cleaned up file space */
+ sfile->dir[0]= '/';
+ sfile->type= FILE_UNIX;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for file");
@@ -84,9 +89,8 @@ static SpaceLink *file_new(void)
BLI_addtail(&sfile->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- /* bookmark region XXX */
+ /* channel list region XXX */
- /* button region XXX */
return (SpaceLink *)sfile;
}
@@ -94,9 +98,14 @@ static SpaceLink *file_new(void)
/* not spacelink itself */
static void file_free(SpaceLink *sl)
{
- SpaceFile *sfile= (SpaceFile*) sl;
-
- /* XXX free necessary items */
+ SpaceFile *sfile= (SpaceFile *) sl;
+
+ if(sfile->libfiledata)
+ BLO_blendhandle_close(sfile->libfiledata);
+ if(sfile->filelist)
+ freefilelist(sfile);
+ if(sfile->pupmenu)
+ MEM_freeN(sfile->pupmenu);
}
@@ -109,11 +118,11 @@ static void file_init(struct wmWindowManager *wm, ScrArea *sa)
static SpaceLink *file_duplicate(SpaceLink *sl)
{
- SpaceImage *file_dup= MEM_dupallocN(sl);
+ SpaceFile *sfilen= MEM_dupallocN(sl);
/* clear or remove stuff from old */
- return (SpaceLink *)file_dup;
+ return (SpaceLink *)sfilen;
}
@@ -126,14 +135,14 @@ static void file_main_area_init(wmWindowManager *wm, ARegion *ar)
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
/* own keymap */
- keymap= WM_keymap_listbase(wm, "Image", SPACE_IMAGE, 0); /* XXX weak? */
+ keymap= WM_keymap_listbase(wm, "File", SPACE_FILE, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
static void file_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
- // SpaceImage *simage= C->area->spacedata.first;
+ // SpaceFile *sfile= C->area->spacedata.first;
View2D *v2d= &ar->v2d;
float col[3];
@@ -224,13 +233,26 @@ void ED_spacetype_file(void)
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype file region");
art->regionid = RGN_TYPE_HEADER;
+ art->minsizey= HEADERY;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+
art->init= file_header_area_init;
art->draw= file_header_area_draw;
- art->minsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
-
+
+ /* regions: channels */
+ art= MEM_callocN(sizeof(ARegionType), "spacetype file region");
+ art->regionid = RGN_TYPE_CHANNELS;
+ art->minsizex= 80;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+
+// art->init= file_channel_area_init;
+// art->draw= file_channel_area_draw;
+
+ BLI_addhead(&st->regiontypes, art);
+
+
BKE_spacetype_register(st);
}
diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c
index 9022dedabeb..44b068cebc1 100644
--- a/source/blender/editors/space_image/image_header.c
+++ b/source/blender/editors/space_image/image_header.c
@@ -90,16 +90,10 @@ static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-#define B_NEWSPACE 100
-
static void do_image_buttons(bContext *C, void *arg, int event)
{
switch(event) {
- case B_NEWSPACE:
- ED_newspace(C->area, C->area->butspacetype);
- WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
- break;
- }
+ }
}
@@ -112,36 +106,7 @@ void image_header_buttons(const bContext *C, ARegion *ar)
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_image_buttons, NULL);
- if(ED_screen_area_active(C)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, yco, XIC+10, YIC,
- &(C->area->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
+ xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c
index e41177f196a..0ecb0c27b65 100644
--- a/source/blender/editors/space_info/info_header.c
+++ b/source/blender/editors/space_info/info_header.c
@@ -90,16 +90,11 @@ static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-#define B_NEWSPACE 100
static void do_info_buttons(bContext *C, void *arg, int event)
{
switch(event) {
- case B_NEWSPACE:
- ED_newspace(C->area, C->area->butspacetype);
- WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
- break;
- }
+ }
}
@@ -112,36 +107,7 @@ void info_header_buttons(const bContext *C, ARegion *ar)
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_info_buttons, NULL);
- if(ED_screen_area_active(C)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, yco, XIC+10, YIC,
- &(C->area->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
+ xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
diff --git a/source/blender/editors/space_ipo/ipo_header.c b/source/blender/editors/space_ipo/ipo_header.c
index 4f5ebfbae2b..62b553991d6 100644
--- a/source/blender/editors/space_ipo/ipo_header.c
+++ b/source/blender/editors/space_ipo/ipo_header.c
@@ -90,16 +90,10 @@ static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-#define B_NEWSPACE 100
-
static void do_ipo_buttons(bContext *C, void *arg, int event)
{
switch(event) {
- case B_NEWSPACE:
- ED_newspace(C->area, C->area->butspacetype);
- WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
- break;
- }
+ }
}
@@ -112,36 +106,7 @@ void ipo_header_buttons(const bContext *C, ARegion *ar)
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_ipo_buttons, NULL);
- if(ED_screen_area_active(C)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, yco, XIC+10, YIC,
- &(C->area->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
+ xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index 14e626c6c93..11f8a38ce18 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -90,16 +90,10 @@ static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-#define B_NEWSPACE 100
-
static void do_node_buttons(bContext *C, void *arg, int event)
{
switch(event) {
- case B_NEWSPACE:
- ED_newspace(C->area, C->area->butspacetype);
- WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
- break;
- }
+ }
}
@@ -112,36 +106,7 @@ void node_header_buttons(const bContext *C, ARegion *ar)
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_node_buttons, NULL);
- if(ED_screen_area_active(C)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, yco, XIC+10, YIC,
- &(C->area->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
+ xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
diff --git a/source/blender/editors/space_outliner/outliner_header.c b/source/blender/editors/space_outliner/outliner_header.c
index 2765d80cf8c..16b64e0a328 100644
--- a/source/blender/editors/space_outliner/outliner_header.c
+++ b/source/blender/editors/space_outliner/outliner_header.c
@@ -90,16 +90,10 @@ static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-#define B_NEWSPACE 100
-
static void do_outliner_buttons(bContext *C, void *arg, int event)
{
switch(event) {
- case B_NEWSPACE:
- ED_newspace(C->area, C->area->butspacetype);
- WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
- break;
- }
+ }
}
@@ -114,36 +108,7 @@ void outliner_header_buttons(const bContext *C, ARegion *ar)
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_outliner_buttons, NULL);
- if(ED_screen_area_active(C)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, yco, XIC+10, YIC,
- &(C->area->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
+ xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c
index 8898fb296db..e996c29d61c 100644
--- a/source/blender/editors/space_time/time_header.c
+++ b/source/blender/editors/space_time/time_header.c
@@ -371,7 +371,6 @@ static void end_animated_screen(SpaceTime *stime)
#define B_TL_PREVIEWON 757
#define B_TL_INSERTKEY 758
#define B_TL_DELETEKEY 759
-#define B_NEWSPACE 760
#define B_FLIPINFOMENU 0
#define B_NEWFRAME 0
@@ -384,10 +383,6 @@ void do_time_buttons(bContext *C, void *arg, int event)
SpaceTime *stime= C->area->spacedata.first;
switch(event) {
- case B_NEWSPACE:
- ED_newspace(C->area, C->area->butspacetype);
- WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
- break;
case B_REDRAWALL:
WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
break;
@@ -455,36 +450,7 @@ void time_header_buttons(const bContext *C, ARegion *ar)
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_time_buttons, NULL);
- if(ED_screen_area_active(C)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, yco, XIC+10, YIC,
- &(C->area->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, B_FLIPINFOMENU,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
+ xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index a0e166bc8b1..f85ecc468e3 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -90,16 +90,11 @@ static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg
return block;
}
-#define B_NEWSPACE 100
static void do_view3d_buttons(bContext *C, void *arg, int event)
{
switch(event) {
- case B_NEWSPACE:
- ED_newspace(C->area, C->area->butspacetype);
- WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
- break;
- }
+ }
}
@@ -112,36 +107,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar)
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_view3d_buttons, NULL);
- if(ED_screen_area_active(C)) uiBlockSetCol(block, TH_HEADER);
- else uiBlockSetCol(block, TH_HEADERDESEL);
-
- xco = 8;
-
- uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
- windowtype_pup(), xco, yco, XIC+10, YIC,
- &(C->area->butspacetype), 1.0, SPACEICONMAX, 0, 0,
- "Displays Current Window Type. "
- "Click for menu of available types.");
-
- xco += XIC + 14;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- if (sa->flag & HEADER_NO_PULLDOWN) {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
- }
- else {
- uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,XIC,YIC-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
- }
- uiBlockSetEmboss(block, UI_EMBOSS);
- xco+=XIC;
+ xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 94579c5e91f..841c5cd3cb5 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -38,6 +38,8 @@
#include "BKE_global.h"
+#include "ED_util.h"
+
#include "UI_text.h"
/* ********* general editor util funcs, not BKE stuff please! ********* */
@@ -78,41 +80,3 @@ int GetButStringLength(char *str)
return rt + 15;
}
-char *windowtype_pup(void)
-{
- return(
- "Window type:%t" //14
- "|3D View %x1" //30
-
- "|%l" // 33
-
- "|Ipo Curve Editor %x2" //54
- "|Action Editor %x12" //73
- "|NLA Editor %x13" //94
-
- "|%l" //97
-
- "|UV/Image Editor %x6" //117
-
- "|Video Sequence Editor %x8" //143
- "|Timeline %x15" //163
- "|Audio Window %x11" //163
- "|Text Editor %x9" //179
-
- "|%l" //192
-
-
- "|User Preferences %x7" //213
- "|Outliner %x3" //232
- "|Buttons Window %x4" //251
- "|Node Editor %x16"
- "|%l" //254
-
- "|Image Browser %x10" //273
- "|File Browser %x5" //290
-
- "|%l" //293
-
- "|Scripts Window %x14"//313
- );
-}