- 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.
This commit is contained in:
Ton Roosendaal 2008-12-14 12:16:55 +00:00
parent 21e01ccac3
commit a4b6ee672d
19 changed files with 287 additions and 386 deletions

@ -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

@ -17,5 +17,6 @@ SConscript(['datafiles/SConscript',
'space_node/SConscript',
'space_buttons/SConscript',
'space_info/SConscript',
'space_file/SConscript',
'transform/SConscript',
'screen/SConscript'])

@ -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);

@ -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 */

@ -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;
}

@ -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;

@ -1,5 +1,5 @@
#
# $Id: $
# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
#
# ***** BEGIN GPL LICENSE BLOCK *****
#

@ -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;

@ -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 */

@ -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;
}

@ -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"
/* ******************** default callbacks for image space ***************** */
#include "file_intern.h" // own include
/* ******************** 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);
}

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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
);
}