[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17842] branches/blender2.5/blender/source : 2.5

Ton Roosendaal ton at blender.org
Sun Dec 14 13:16:56 CET 2008


Revision: 17842
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17842
Author:   ton
Date:     2008-12-14 13:16:55 +0100 (Sun, 14 Dec 2008)

Log Message:
-----------
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.

Modified Paths:
--------------
    branches/blender2.5/blender/source/Makefile
    branches/blender2.5/blender/source/blender/editors/SConscript
    branches/blender2.5/blender/source/blender/editors/include/ED_screen.h
    branches/blender2.5/blender/source/blender/editors/include/ED_util.h
    branches/blender2.5/blender/source/blender/editors/screen/area.c
    branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_header.c
    branches/blender2.5/blender/source/blender/editors/space_file/Makefile
    branches/blender2.5/blender/source/blender/editors/space_file/file_header.c
    branches/blender2.5/blender/source/blender/editors/space_file/space_file.c
    branches/blender2.5/blender/source/blender/editors/space_image/image_header.c
    branches/blender2.5/blender/source/blender/editors/space_info/info_header.c
    branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_header.c
    branches/blender2.5/blender/source/blender/editors/space_node/node_header.c
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_header.c
    branches/blender2.5/blender/source/blender/editors/space_time/time_header.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c
    branches/blender2.5/blender/source/blender/editors/util/ed_util.c

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/editors/space_file/file_intern.h
    branches/blender2.5/blender/source/blender/editors/space_file/filesel.c

Modified: branches/blender2.5/blender/source/Makefile
===================================================================
--- branches/blender2.5/blender/source/Makefile	2008-12-14 11:59:24 UTC (rev 17841)
+++ branches/blender2.5/blender/source/Makefile	2008-12-14 12:16:55 UTC (rev 17842)
@@ -235,6 +235,7 @@
 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

Modified: branches/blender2.5/blender/source/blender/editors/SConscript
===================================================================
--- branches/blender2.5/blender/source/blender/editors/SConscript	2008-12-14 11:59:24 UTC (rev 17841)
+++ branches/blender2.5/blender/source/blender/editors/SConscript	2008-12-14 12:16:55 UTC (rev 17842)
@@ -17,5 +17,6 @@
 			'space_node/SConscript',
 			'space_buttons/SConscript',
 			'space_info/SConscript',
+			'space_file/SConscript',
 			'transform/SConscript',
 			'screen/SConscript'])

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_screen.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_screen.h	2008-12-14 11:59:24 UTC (rev 17841)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_screen.h	2008-12-14 12:16:55 UTC (rev 17842)
@@ -38,6 +38,7 @@
 struct wmNotifier;
 struct SpaceType;
 struct AreagionType;
+struct uiBlock;
 
 /* regions */
 void	ED_region_do_listen(ARegion *ar, struct wmNotifier *note);
@@ -50,8 +51,8 @@
 /* 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);

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_util.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_util.h	2008-12-14 11:59:24 UTC (rev 17841)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_util.h	2008-12-14 12:16:55 UTC (rev 17842)
@@ -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 */
 

Modified: branches/blender2.5/blender/source/blender/editors/screen/area.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/area.c	2008-12-14 11:59:24 UTC (rev 17841)
+++ branches/blender2.5/blender/source/blender/editors/screen/area.c	2008-12-14 12:16:55 UTC (rev 17842)
@@ -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 @@
 #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 @@
 	}
 }
 
+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;
+}
+

Modified: branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_header.c	2008-12-14 11:59:24 UTC (rev 17841)
+++ branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_header.c	2008-12-14 12:16:55 UTC (rev 17842)
@@ -90,7 +90,6 @@
 	return block;
 }
 
-#define B_NEWSPACE			100
 #define B_CONTEXT_SWITCH	101
 #define B_BUTSPREVIEW		102
 #define B_NEWFRAME			103
@@ -98,10 +97,6 @@
 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,37 +114,8 @@
 	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;
+	xco= ED_area_header_standardbuttons(C, block, yco);
 	
-	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;
-	
 	if((sa->flag & HEADER_NO_PULLDOWN)==0) {
 		int xmax;
 		

Modified: branches/blender2.5/blender/source/blender/editors/space_file/Makefile
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/Makefile	2008-12-14 11:59:24 UTC (rev 17841)
+++ branches/blender2.5/blender/source/blender/editors/space_file/Makefile	2008-12-14 12:16:55 UTC (rev 17842)
@@ -1,5 +1,5 @@
 #
-# $Id:  $
+# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
 #
 # ***** BEGIN GPL LICENSE BLOCK *****
 #

Modified: branches/blender2.5/blender/source/blender/editors/space_file/file_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_header.c	2008-12-14 11:59:24 UTC (rev 17841)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_header.c	2008-12-14 12:16:55 UTC (rev 17842)
@@ -54,7 +54,9 @@
 #include "UI_resources.h"
 #include "UI_view2d.h"
 
+#include "file_intern.h"
 
+
 /* ************************ header area region *********************** */
 
 static void do_viewmenu(bContext *C, void *arg, int event)
@@ -88,16 +90,11 @@
 	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,42 +102,13 @@
 {
 	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;
+	xco= ED_area_header_standardbuttons(C, block, yco);
 	
-	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;
-	
 	if((sa->flag & HEADER_NO_PULLDOWN)==0) {
 		int xmax;
 		


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list