Basics for the remaining 6 spacetypes. 

Note: Andrea prefers to merge SpaceImaSel with SpaceFile
for that I'll provide a good readfile.c patch later
This commit is contained in:
2008-12-14 14:43:08 +00:00
parent 965f872c3e
commit 8be23f9490
36 changed files with 3037 additions and 1 deletions

View File

@@ -235,6 +235,12 @@ 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_sound/libed_sound.a
PULIB += $(OCGDIR)/blender/ed_action/libed_action.a
PULIB += $(OCGDIR)/blender/ed_nla/libed_nla.a
PULIB += $(OCGDIR)/blender/ed_script/libed_script.a
PULIB += $(OCGDIR)/blender/ed_text/libed_text.a
PULIB += $(OCGDIR)/blender/ed_sequencer/libed_sequencer.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

View File

@@ -5090,8 +5090,16 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
break;
case SPACE_ACTION:
ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
BLI_addtail(lb, ar);
ar->regiontype= RGN_TYPE_CHANNELS;
ar->alignment= RGN_ALIGN_LEFT;
break;
case SPACE_NLA:
ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
BLI_addtail(lb, ar);
ar->regiontype= RGN_TYPE_CHANNELS;
ar->alignment= RGN_ALIGN_LEFT;
break;
}
}
@@ -5141,6 +5149,42 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_LEFT);
break;
}
case SPACE_SOUND:
{
SpaceSound *ssound= (SpaceSound *)sl;
memcpy(&ar->v2d, &ssound->v2d, sizeof(View2D));
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
ar->v2d.scroll |= (V2D_SCROLL_LEFT);
break;
}
case SPACE_NLA:
{
SpaceNla *snla= (SpaceNla *)sl;
memcpy(&ar->v2d, &snla->v2d, sizeof(View2D));
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
break;
}
case SPACE_ACTION:
{
SpaceAction *saction= (SpaceAction *)sl;
memcpy(&ar->v2d, &saction->v2d, sizeof(View2D));
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
break;
}
case SPACE_SEQ:
{
SpaceSeq *sseq= (SpaceSeq *)sl;
memcpy(&ar->v2d, &sseq->v2d, sizeof(View2D));
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_SCALE_RIGHT);
break;
}
case SPACE_NODE:
{
SpaceNode *snode= (SpaceNode *)sl;

View File

@@ -29,6 +29,6 @@
# Bounces make to subdirectories.
SOURCEDIR = source/blender/editors
DIRS = datafiles screen space_outliner space_time space_view3d interface util space_api space_ipo space_image space_node space_buttons space_info space_file
DIRS = datafiles screen space_outliner space_time space_view3d interface util space_api space_ipo space_image space_node space_buttons space_info space_file space_sound space_action space_nla space_script space_text space_sequencer
include nan_subdirs.mk

View File

@@ -17,5 +17,11 @@ SConscript(['datafiles/SConscript',
'space_outliner/SConscript',
'space_time/SConscript',
'space_view3d/SConscript',
'space_sound/SConscript',
'space_action/SConscript',
'space_nla/SConscript',
'space_script/SConscript',
'space_text/SConscript',
'space_sequencer/SConscript',
'transform/SConscript',
'screen/SConscript'])

View File

@@ -41,6 +41,12 @@ void ED_spacetype_node(void);
void ED_spacetype_buttons(void);
void ED_spacetype_info(void);
void ED_spacetype_file(void);
void ED_spacetype_sound(void);
void ED_spacetype_action(void);
void ED_spacetype_nla(void);
void ED_spacetype_script(void);
void ED_spacetype_text(void);
void ED_spacetype_sequencer(void);
#endif /* ED_AREA_H */

View File

@@ -0,0 +1,53 @@
#
# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
#
# ***** 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) 2007 Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL LICENSE BLOCK *****
#
# Makes module object directory and bounces make to subdirectories.
LIBNAME = ed_action
DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
# not very neat....
CPPFLAGS += -I../../windowmanager
CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../python
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# own include
CPPFLAGS += -I../include

View File

@@ -0,0 +1,9 @@
#!/usr/bin/python
Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
env.BlenderLib ( 'bf_editors_space_action', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] )

View File

@@ -0,0 +1,132 @@
/**
* $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 "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 "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 "action_intern.h"
/* ************************ header area region *********************** */
static void do_viewmenu(bContext *C, void *arg, int event)
{
}
static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
ScrArea *curarea= C->area;
uiBlock *block;
short yco= 0, menuwidth=120;
block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
uiBlockSetDirection(block, UI_TOP);
uiBlockFlipOrder(block);
}
uiTextBoundsBlock(block, 50);
uiEndBlock(C, block);
return block;
}
static void do_action_buttons(bContext *C, void *arg, int event)
{
switch(event) {
}
}
void action_header_buttons(const bContext *C, ARegion *ar)
{
ScrArea *sa= C->area;
uiBlock *block;
int xco, yco= 3;
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_action_buttons, NULL);
xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
/* pull down menus */
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, C->area,
"View", xco, yco-2, xmax-3, 24, "");
xco+=XIC+xmax;
}
uiBlockSetEmboss(block, UI_EMBOSS);
/* always as last */
sa->headbutlen= xco+XIC+80; // +80 because the last button is not an icon
uiEndBlock(C, block);
uiDrawBlock(block);
}

View File

@@ -0,0 +1,39 @@
/**
* $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_ACTION_INTERN_H
#define ED_ACTION_INTERN_H
/* internal exports only */
/* action_header.c */
void action_header_buttons(const bContext *C, ARegion *ar);
#endif /* ED_ACTION_INTERN_H */

View File

@@ -0,0 +1,276 @@
/**
* $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 "DNA_action_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_screen.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "ED_markers.h"
#include "action_intern.h" // own include
/* ******************** default callbacks for action space ***************** */
static SpaceLink *action_new(void)
{
ARegion *ar;
SpaceAction *saction;
saction= MEM_callocN(sizeof(SpaceAction), "initaction");
saction->spacetype= SPACE_ACTION;
saction->autosnap = SACTSNAP_FRAME;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for action");
BLI_addtail(&saction->regionbase, ar);
ar->regiontype= RGN_TYPE_HEADER;
ar->alignment= RGN_ALIGN_BOTTOM;
UI_view2d_header_default(&ar->v2d);
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for action");
BLI_addtail(&saction->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
ar->v2d.tot.xmin= 1.0f;
ar->v2d.tot.ymin= -1000.0f;
ar->v2d.tot.xmax= 1000.0f;
ar->v2d.tot.ymax= 0.0f;
ar->v2d.cur.xmin= -5.0f;
ar->v2d.cur.ymin= -75.0f;
ar->v2d.cur.xmax= 65.0f;
ar->v2d.cur.ymax= 5.0f;
ar->v2d.min[0]= 0.0f;
ar->v2d.min[1]= 0.0f;
ar->v2d.max[0]= MAXFRAMEF;
ar->v2d.max[1]= 1000.0f;
ar->v2d.minzoom= 0.01f;
ar->v2d.maxzoom= 50;
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
saction->v2d.keepzoom= V2D_LOCKZOOM_Y;
/* channel list region XXX */
ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
BLI_addtail(&saction->regionbase, ar);
ar->regiontype= RGN_TYPE_CHANNELS;
ar->alignment= RGN_ALIGN_LEFT;
return (SpaceLink *)saction;
}
/* not spacelink itself */
static void action_free(SpaceLink *sl)
{
// SpaceAction *saction= (SpaceAction*) sl;
}
/* spacetype; init callback */
static void action_init(struct wmWindowManager *wm, ScrArea *sa)
{
}
static SpaceLink *action_duplicate(SpaceLink *sl)
{
SpaceAction *sactionn= MEM_dupallocN(sl);
/* clear or remove stuff from old */
return (SpaceLink *)sactionn;
}
/* add handlers, stuff you only do once or on area/region changes */
static void action_main_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_listbase(wm, "Action", SPACE_ACTION, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
static void action_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
// SpaceAction *saction= C->area->spacedata.first;
View2D *v2d= &ar->v2d;
float col[3];
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
/* data... */
/* reset view matrix */
UI_view2d_view_restore(C);
/* scrollers? */
}
void action_operatortypes(void)
{
}
void action_keymap(struct wmWindowManager *wm)
{
}
/* add handlers, stuff you only do once or on area/region changes */
static void action_header_area_init(wmWindowManager *wm, ARegion *ar)
{
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
}
static void action_header_area_draw(const bContext *C, ARegion *ar)
{
float col[3];
/* clear */
if(ED_screen_area_active(C))
UI_GetThemeColor3fv(TH_HEADER, col);
else
UI_GetThemeColor3fv(TH_HEADERDESEL, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(C, &ar->v2d);
action_header_buttons(C, ar);
/* restore view matrix? */
UI_view2d_view_restore(C);
}
static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
}
/* only called once, from space/spacetypes.c */
void ED_spacetype_action(void)
{
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype action");
ARegionType *art;
st->spaceid= SPACE_ACTION;
st->new= action_new;
st->free= action_free;
st->init= action_init;
st->duplicate= action_duplicate;
st->operatortypes= action_operatortypes;
st->keymap= action_keymap;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype action region");
art->regionid = RGN_TYPE_WINDOW;
art->init= action_main_area_init;
art->draw= action_main_area_draw;
art->listener= action_main_area_listener;
art->keymapflag= ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype action region");
art->regionid = RGN_TYPE_HEADER;
art->minsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
art->init= action_header_area_init;
art->draw= action_header_area_draw;
BLI_addhead(&st->regiontypes, art);
/* regions: channels */
art= MEM_callocN(sizeof(ARegionType), "spacetype action region");
art->regionid = RGN_TYPE_CHANNELS;
art->minsizex= 80;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
// art->init= action_channel_area_init;
// art->draw= action_channel_area_draw;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
}

View File

@@ -70,6 +70,12 @@ void ED_spacetypes_init(void)
ED_spacetype_buttons();
ED_spacetype_info();
ED_spacetype_file();
ED_spacetype_sound();
ED_spacetype_action();
ED_spacetype_nla();
ED_spacetype_script();
ED_spacetype_text();
ED_spacetype_sequencer();
// ...
/* register operator types for screen and all spaces */

View File

@@ -0,0 +1,53 @@
#
# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
#
# ***** 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) 2007 Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL LICENSE BLOCK *****
#
# Makes module object directory and bounces make to subdirectories.
LIBNAME = ed_nla
DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
# not very neat....
CPPFLAGS += -I../../windowmanager
CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../python
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# own include
CPPFLAGS += -I../include

View File

@@ -0,0 +1,9 @@
#!/usr/bin/python
Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
env.BlenderLib ( 'bf_editors_space_nla', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] )

View File

@@ -0,0 +1,132 @@
/**
* $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 "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 "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 "nla_intern.h"
/* ************************ header area region *********************** */
static void do_viewmenu(bContext *C, void *arg, int event)
{
}
static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
ScrArea *curarea= C->area;
uiBlock *block;
short yco= 0, menuwidth=120;
block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
uiBlockSetDirection(block, UI_TOP);
uiBlockFlipOrder(block);
}
uiTextBoundsBlock(block, 50);
uiEndBlock(C, block);
return block;
}
static void do_nla_buttons(bContext *C, void *arg, int event)
{
switch(event) {
}
}
void nla_header_buttons(const bContext *C, ARegion *ar)
{
ScrArea *sa= C->area;
uiBlock *block;
int xco, yco= 3;
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_nla_buttons, NULL);
xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
/* pull down menus */
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, C->area,
"View", xco, yco-2, xmax-3, 24, "");
xco+=XIC+xmax;
}
uiBlockSetEmboss(block, UI_EMBOSS);
/* always as last */
sa->headbutlen= xco+XIC+80; // +80 because the last button is not an icon
uiEndBlock(C, block);
uiDrawBlock(block);
}

View File

@@ -0,0 +1,39 @@
/**
* $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_NLA_INTERN_H
#define ED_NLA_INTERN_H
/* internal exports only */
/* nla_header.c */
void nla_header_buttons(const bContext *C, ARegion *ar);
#endif /* ED_NLA_INTERN_H */

View File

@@ -0,0 +1,275 @@
/**
* $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 "DNA_nla_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_screen.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "ED_markers.h"
#include "nla_intern.h" // own include
/* ******************** default callbacks for nla space ***************** */
static SpaceLink *nla_new(void)
{
ARegion *ar;
SpaceNla *snla;
snla= MEM_callocN(sizeof(SpaceNla), "initnla");
snla->spacetype= SPACE_NLA;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for nla");
BLI_addtail(&snla->regionbase, ar);
ar->regiontype= RGN_TYPE_HEADER;
ar->alignment= RGN_ALIGN_BOTTOM;
UI_view2d_header_default(&ar->v2d);
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for nla");
BLI_addtail(&snla->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
ar->v2d.tot.xmin= 1.0f;
ar->v2d.tot.ymin= 0.0f;
ar->v2d.tot.xmax= 1000.0f;
ar->v2d.tot.ymax= 1000.0f;
ar->v2d.cur.xmin= -5.0f;
ar->v2d.cur.ymin= 0.0f;
ar->v2d.cur.xmax= 65.0f;
ar->v2d.cur.ymax= 1000.0f;
ar->v2d.min[0]= 0.0f;
ar->v2d.min[1]= 0.0f;
ar->v2d.max[0]= MAXFRAMEF;
ar->v2d.max[1]= 1000.0f;
ar->v2d.minzoom= 0.1f;
ar->v2d.maxzoom= 50.0f;
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
/* channel list region XXX */
ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
BLI_addtail(&snla->regionbase, ar);
ar->regiontype= RGN_TYPE_CHANNELS;
ar->alignment= RGN_ALIGN_LEFT;
return (SpaceLink *)snla;
}
/* not spacelink itself */
static void nla_free(SpaceLink *sl)
{
// SpaceNla *snla= (SpaceNla*) sl;
}
/* spacetype; init callback */
static void nla_init(struct wmWindowManager *wm, ScrArea *sa)
{
}
static SpaceLink *nla_duplicate(SpaceLink *sl)
{
SpaceNla *snlan= MEM_dupallocN(sl);
/* clear or remove stuff from old */
return (SpaceLink *)snlan;
}
/* add handlers, stuff you only do once or on area/region changes */
static void nla_main_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_listbase(wm, "NLA", SPACE_NLA, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
static void nla_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
// SpaceNla *snla= C->area->spacedata.first;
View2D *v2d= &ar->v2d;
float col[3];
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
/* data... */
/* reset view matrix */
UI_view2d_view_restore(C);
/* scrollers? */
}
void nla_operatortypes(void)
{
}
void nla_keymap(struct wmWindowManager *wm)
{
}
/* add handlers, stuff you only do once or on area/region changes */
static void nla_header_area_init(wmWindowManager *wm, ARegion *ar)
{
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
}
static void nla_header_area_draw(const bContext *C, ARegion *ar)
{
float col[3];
/* clear */
if(ED_screen_area_active(C))
UI_GetThemeColor3fv(TH_HEADER, col);
else
UI_GetThemeColor3fv(TH_HEADERDESEL, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(C, &ar->v2d);
nla_header_buttons(C, ar);
/* restore view matrix? */
UI_view2d_view_restore(C);
}
static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
}
/* only called once, from space/spacetypes.c */
void ED_spacetype_nla(void)
{
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype nla");
ARegionType *art;
st->spaceid= SPACE_NLA;
st->new= nla_new;
st->free= nla_free;
st->init= nla_init;
st->duplicate= nla_duplicate;
st->operatortypes= nla_operatortypes;
st->keymap= nla_keymap;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype nla region");
art->regionid = RGN_TYPE_WINDOW;
art->init= nla_main_area_init;
art->draw= nla_main_area_draw;
art->listener= nla_main_area_listener;
art->keymapflag= ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype nla region");
art->regionid = RGN_TYPE_HEADER;
art->minsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
art->init= nla_header_area_init;
art->draw= nla_header_area_draw;
BLI_addhead(&st->regiontypes, art);
/* regions: channels */
art= MEM_callocN(sizeof(ARegionType), "spacetype nla region");
art->regionid = RGN_TYPE_CHANNELS;
art->minsizex= 80;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
// art->init= nla_channel_area_init;
// art->draw= nla_channel_area_draw;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
}

View File

@@ -0,0 +1,53 @@
#
# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
#
# ***** 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) 2007 Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL LICENSE BLOCK *****
#
# Makes module object directory and bounces make to subdirectories.
LIBNAME = ed_script
DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
# not very neat....
CPPFLAGS += -I../../windowmanager
CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../python
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# own include
CPPFLAGS += -I../include

View File

@@ -0,0 +1,9 @@
#!/usr/bin/python
Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
env.BlenderLib ( 'bf_editors_space_script', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] )

View File

@@ -0,0 +1,132 @@
/**
* $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 "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 "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 "script_intern.h"
/* ************************ header area region *********************** */
static void do_viewmenu(bContext *C, void *arg, int event)
{
}
static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
ScrArea *curarea= C->area;
uiBlock *block;
short yco= 0, menuwidth=120;
block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
uiBlockSetDirection(block, UI_TOP);
uiBlockFlipOrder(block);
}
uiTextBoundsBlock(block, 50);
uiEndBlock(C, block);
return block;
}
static void do_script_buttons(bContext *C, void *arg, int event)
{
switch(event) {
}
}
void script_header_buttons(const bContext *C, ARegion *ar)
{
ScrArea *sa= C->area;
uiBlock *block;
int xco, yco= 3;
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_script_buttons, NULL);
xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
/* pull down menus */
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, C->area,
"View", xco, yco-2, xmax-3, 24, "");
xco+=XIC+xmax;
}
uiBlockSetEmboss(block, UI_EMBOSS);
/* always as last */
sa->headbutlen= xco+XIC+80; // +80 because the last button is not an icon
uiEndBlock(C, block);
uiDrawBlock(block);
}

View File

@@ -0,0 +1,39 @@
/**
* $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_SCRIPT_INTERN_H
#define ED_SCRIPT_INTERN_H
/* internal exports only */
/* script_header.c */
void script_header_buttons(const bContext *C, ARegion *ar);
#endif /* ED_SCRIPT_INTERN_H */

View File

@@ -0,0 +1,245 @@
/**
* $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 "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_screen.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "ED_markers.h"
#include "script_intern.h" // own include
/* ******************** default callbacks for script space ***************** */
static SpaceLink *script_new(void)
{
ARegion *ar;
SpaceScript *sscript;
sscript= MEM_callocN(sizeof(SpaceScript), "initscript");
sscript->spacetype= SPACE_SCRIPT;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for script");
BLI_addtail(&sscript->regionbase, ar);
ar->regiontype= RGN_TYPE_HEADER;
ar->alignment= RGN_ALIGN_BOTTOM;
UI_view2d_header_default(&ar->v2d);
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for script");
BLI_addtail(&sscript->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
/* channel list region XXX */
return (SpaceLink *)sscript;
}
/* not spacelink itself */
static void script_free(SpaceLink *sl)
{
SpaceScript *sscript= (SpaceScript*) sl;
#ifndef DISABLE_PYTHON
/*free buttons references*/
if (sscript->but_refs) {
// XXX BPy_Set_DrawButtonsList(sscript->but_refs);
// BPy_Free_DrawButtonsList();
sscript->but_refs = NULL;
}
#endif
sscript->script = NULL;
}
/* spacetype; init callback */
static void script_init(struct wmWindowManager *wm, ScrArea *sa)
{
}
static SpaceLink *script_duplicate(SpaceLink *sl)
{
SpaceScript *sscriptn= MEM_dupallocN(sl);
/* clear or remove stuff from old */
return (SpaceLink *)sscriptn;
}
/* add handlers, stuff you only do once or on area/region changes */
static void script_main_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_listbase(wm, "Script", SPACE_SCRIPT, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
static void script_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
// SpaceScript *sscript= C->area->spacedata.first;
View2D *v2d= &ar->v2d;
float col[3];
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
/* data... */
/* reset view matrix */
UI_view2d_view_restore(C);
/* scrollers? */
}
void script_operatortypes(void)
{
}
void script_keymap(struct wmWindowManager *wm)
{
}
/* add handlers, stuff you only do once or on area/region changes */
static void script_header_area_init(wmWindowManager *wm, ARegion *ar)
{
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
}
static void script_header_area_draw(const bContext *C, ARegion *ar)
{
float col[3];
/* clear */
if(ED_screen_area_active(C))
UI_GetThemeColor3fv(TH_HEADER, col);
else
UI_GetThemeColor3fv(TH_HEADERDESEL, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(C, &ar->v2d);
script_header_buttons(C, ar);
/* restore view matrix? */
UI_view2d_view_restore(C);
}
static void script_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
}
/* only called once, from space/spacetypes.c */
void ED_spacetype_script(void)
{
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype script");
ARegionType *art;
st->spaceid= SPACE_SCRIPT;
st->new= script_new;
st->free= script_free;
st->init= script_init;
st->duplicate= script_duplicate;
st->operatortypes= script_operatortypes;
st->keymap= script_keymap;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype script region");
art->regionid = RGN_TYPE_WINDOW;
art->init= script_main_area_init;
art->draw= script_main_area_draw;
art->listener= script_main_area_listener;
art->keymapflag= ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype script region");
art->regionid = RGN_TYPE_HEADER;
art->minsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
art->init= script_header_area_init;
art->draw= script_header_area_draw;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
}

View File

@@ -0,0 +1,53 @@
#
# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
#
# ***** 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) 2007 Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL LICENSE BLOCK *****
#
# Makes module object directory and bounces make to subdirectories.
LIBNAME = ed_sequencer
DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
# not very neat....
CPPFLAGS += -I../../windowmanager
CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../python
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# own include
CPPFLAGS += -I../include

View File

@@ -0,0 +1,9 @@
#!/usr/bin/python
Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
env.BlenderLib ( 'bf_editors_space_sequencer', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] )

View File

@@ -0,0 +1,132 @@
/**
* $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 "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 "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 "sequencer_intern.h"
/* ************************ header area region *********************** */
static void do_viewmenu(bContext *C, void *arg, int event)
{
}
static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
ScrArea *curarea= C->area;
uiBlock *block;
short yco= 0, menuwidth=120;
block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
uiBlockSetDirection(block, UI_TOP);
uiBlockFlipOrder(block);
}
uiTextBoundsBlock(block, 50);
uiEndBlock(C, block);
return block;
}
static void do_sequencer_buttons(bContext *C, void *arg, int event)
{
switch(event) {
}
}
void sequencer_header_buttons(const bContext *C, ARegion *ar)
{
ScrArea *sa= C->area;
uiBlock *block;
int xco, yco= 3;
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_sequencer_buttons, NULL);
xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
/* pull down menus */
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, C->area,
"View", xco, yco-2, xmax-3, 24, "");
xco+=XIC+xmax;
}
uiBlockSetEmboss(block, UI_EMBOSS);
/* always as last */
sa->headbutlen= xco+XIC+80; // +80 because the last button is not an icon
uiEndBlock(C, block);
uiDrawBlock(block);
}

View File

@@ -0,0 +1,41 @@
/**
* $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_SEQUENCER_INTERN_H
#define ED_SEQUENCER_INTERN_H
#define MAXSEQ 32
/* internal exports only */
/* sequencer_header.c */
void sequencer_header_buttons(const bContext *C, ARegion *ar);
#endif /* ED_SEQUENCER_INTERN_H */

View File

@@ -0,0 +1,264 @@
/**
* $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 "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_screen.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "ED_markers.h"
#include "sequencer_intern.h" // own include
/* ******************** default callbacks for sequencer space ***************** */
static SpaceLink *sequencer_new(void)
{
ARegion *ar;
SpaceSeq *sseq;
sseq= MEM_callocN(sizeof(SpaceSeq), "initsequencer");
sseq->spacetype= SPACE_SEQ;
sseq->zoom= 4;
sseq->chanshown = 0;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for sequencer");
BLI_addtail(&sseq->regionbase, ar);
ar->regiontype= RGN_TYPE_HEADER;
ar->alignment= RGN_ALIGN_BOTTOM;
UI_view2d_header_default(&ar->v2d);
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for sequencer");
BLI_addtail(&sseq->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
/* seq space goes from (0,8) to (250, 0) */
ar->v2d.tot.xmin= 0.0f;
ar->v2d.tot.ymin= 0.0f;
ar->v2d.tot.xmax= 250.0f;
ar->v2d.tot.ymax= 8.0f;
ar->v2d.cur= ar->v2d.tot;
ar->v2d.min[0]= 10.0f;
ar->v2d.min[1]= 4.0f;
ar->v2d.max[0]= MAXFRAMEF;
ar->v2d.max[1]= MAXSEQ;
ar->v2d.minzoom= 0.01f;
ar->v2d.maxzoom= 100.0f;
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_SCALE_RIGHT);
ar->v2d.keepzoom= 0;
ar->v2d.keeptot= 0;
return (SpaceLink *)sseq;
}
/* not spacelink itself */
static void sequencer_free(SpaceLink *sl)
{
// SpaceSeq *sseq= (SpaceSequencer*) sl;
// XXX if(sseq->gpd) free_gpencil_data(sseq->gpd);
}
/* spacetype; init callback */
static void sequencer_init(struct wmWindowManager *wm, ScrArea *sa)
{
}
static SpaceLink *sequencer_duplicate(SpaceLink *sl)
{
SpaceSeq *sseqn= MEM_dupallocN(sl);
/* clear or remove stuff from old */
// XXX sseq->gpd= gpencil_data_duplicate(sseq->gpd);
return (SpaceLink *)sseqn;
}
/* add handlers, stuff you only do once or on area/region changes */
static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_listbase(wm, "Sequencer", SPACE_SEQ, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
static void sequencer_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
// SpaceSeq *sseq= C->area->spacedata.first;
View2D *v2d= &ar->v2d;
float col[3];
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
/* data... */
/* reset view matrix */
UI_view2d_view_restore(C);
/* scrollers? */
}
void sequencer_operatortypes(void)
{
}
void sequencer_keymap(struct wmWindowManager *wm)
{
}
/* add handlers, stuff you only do once or on area/region changes */
static void sequencer_header_area_init(wmWindowManager *wm, ARegion *ar)
{
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
}
static void sequencer_header_area_draw(const bContext *C, ARegion *ar)
{
float col[3];
/* clear */
if(ED_screen_area_active(C))
UI_GetThemeColor3fv(TH_HEADER, col);
else
UI_GetThemeColor3fv(TH_HEADERDESEL, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(C, &ar->v2d);
sequencer_header_buttons(C, ar);
/* restore view matrix? */
UI_view2d_view_restore(C);
}
static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
}
/* only called once, from space/spacetypes.c */
void ED_spacetype_sequencer(void)
{
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype sequencer");
ARegionType *art;
st->spaceid= SPACE_SEQ;
st->new= sequencer_new;
st->free= sequencer_free;
st->init= sequencer_init;
st->duplicate= sequencer_duplicate;
st->operatortypes= sequencer_operatortypes;
st->keymap= sequencer_keymap;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art->regionid = RGN_TYPE_WINDOW;
art->init= sequencer_main_area_init;
art->draw= sequencer_main_area_draw;
art->listener= sequencer_main_area_listener;
art->keymapflag= ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art->regionid = RGN_TYPE_HEADER;
art->minsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
art->init= sequencer_header_area_init;
art->draw= sequencer_header_area_draw;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
}

View File

@@ -0,0 +1,53 @@
#
# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
#
# ***** 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) 2007 Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL LICENSE BLOCK *****
#
# Makes module object directory and bounces make to subdirectories.
LIBNAME = ed_sound
DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
# not very neat....
CPPFLAGS += -I../../windowmanager
CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../python
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# own include
CPPFLAGS += -I../include

View File

@@ -0,0 +1,9 @@
#!/usr/bin/python
Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
env.BlenderLib ( 'bf_editors_space_sound', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] )

View File

@@ -0,0 +1,132 @@
/**
* $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 "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 "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 "sound_intern.h"
/* ************************ header area region *********************** */
static void do_viewmenu(bContext *C, void *arg, int event)
{
}
static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
ScrArea *curarea= C->area;
uiBlock *block;
short yco= 0, menuwidth=120;
block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
uiBlockSetDirection(block, UI_TOP);
uiBlockFlipOrder(block);
}
uiTextBoundsBlock(block, 50);
uiEndBlock(C, block);
return block;
}
static void do_sound_buttons(bContext *C, void *arg, int event)
{
switch(event) {
}
}
void sound_header_buttons(const bContext *C, ARegion *ar)
{
ScrArea *sa= C->area;
uiBlock *block;
int xco, yco= 3;
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_sound_buttons, NULL);
xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
/* pull down menus */
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, C->area,
"View", xco, yco-2, xmax-3, 24, "");
xco+=XIC+xmax;
}
uiBlockSetEmboss(block, UI_EMBOSS);
/* always as last */
sa->headbutlen= xco+XIC+80; // +80 because the last button is not an icon
uiEndBlock(C, block);
uiDrawBlock(block);
}

View File

@@ -0,0 +1,39 @@
/**
* $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_SOUND_INTERN_H
#define ED_SOUND_INTERN_H
/* internal exports only */
/* sound_header.c */
void sound_header_buttons(const bContext *C, ARegion *ar);
#endif /* ED_SOUND_INTERN_H */

View File

@@ -0,0 +1,270 @@
/**
* $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 "DNA_sound_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_screen.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "ED_markers.h"
#include "sound_intern.h" // own include
/* ******************** default callbacks for sound space ***************** */
static SpaceLink *sound_new(void)
{
ARegion *ar;
SpaceSound *ssound;
ssound= MEM_callocN(sizeof(SpaceSound), "initsound");
ssound->spacetype= SPACE_SOUND;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for sound");
BLI_addtail(&ssound->regionbase, ar);
ar->regiontype= RGN_TYPE_HEADER;
ar->alignment= RGN_ALIGN_BOTTOM;
UI_view2d_header_default(&ar->v2d);
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for sound");
BLI_addtail(&ssound->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
ar->v2d.tot.xmin= -4.0f;
ar->v2d.tot.ymin= -4.0f;
ar->v2d.tot.xmax= 250.0f;
ar->v2d.tot.ymax= 255.0f;
ar->v2d.cur.xmin= -4.0f;
ar->v2d.cur.ymin= -4.0f;
ar->v2d.cur.xmax= 50.0f;
ar->v2d.cur.ymax= 255.0f;
ar->v2d.min[0]= 1.0f;
ar->v2d.min[1]= 259.0f;
ar->v2d.max[0]= MAXFRAMEF;
ar->v2d.max[1]= 259.0f;
ar->v2d.minzoom= 0.1f;
ar->v2d.maxzoom= 10.0f;
ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
ar->v2d.scroll |= (V2D_SCROLL_LEFT);
ar->v2d.keepzoom= 0;
ar->v2d.keeptot= 0;
return (SpaceLink *)ssound;
}
/* not spacelink itself */
static void sound_free(SpaceLink *sl)
{
// SpaceSound *ssound= (SpaceSound*) sl;
}
/* spacetype; init callback */
static void sound_init(struct wmWindowManager *wm, ScrArea *sa)
{
}
static SpaceLink *sound_duplicate(SpaceLink *sl)
{
SpaceSound *ssoundn= MEM_dupallocN(sl);
/* clear or remove stuff from old */
return (SpaceLink *)ssoundn;
}
/* add handlers, stuff you only do once or on area/region changes */
static void sound_main_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_listbase(wm, "Sound", SPACE_SOUND, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
static void sound_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
// SpaceSound *ssound= C->area->spacedata.first;
View2D *v2d= &ar->v2d;
float col[3];
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
/* data... */
/* reset view matrix */
UI_view2d_view_restore(C);
/* scrollers? */
}
void sound_operatortypes(void)
{
}
void sound_keymap(struct wmWindowManager *wm)
{
}
/* add handlers, stuff you only do once or on area/region changes */
static void sound_header_area_init(wmWindowManager *wm, ARegion *ar)
{
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
}
static void sound_header_area_draw(const bContext *C, ARegion *ar)
{
float col[3];
/* clear */
if(ED_screen_area_active(C))
UI_GetThemeColor3fv(TH_HEADER, col);
else
UI_GetThemeColor3fv(TH_HEADERDESEL, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(C, &ar->v2d);
sound_header_buttons(C, ar);
/* restore view matrix? */
UI_view2d_view_restore(C);
}
static void sound_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
}
/* only called once, from space/spacetypes.c */
void ED_spacetype_sound(void)
{
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype sound");
ARegionType *art;
st->spaceid= SPACE_SOUND;
st->new= sound_new;
st->free= sound_free;
st->init= sound_init;
st->duplicate= sound_duplicate;
st->operatortypes= sound_operatortypes;
st->keymap= sound_keymap;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype sound region");
art->regionid = RGN_TYPE_WINDOW;
art->init= sound_main_area_init;
art->draw= sound_main_area_draw;
art->listener= sound_main_area_listener;
art->keymapflag= ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype sound region");
art->regionid = RGN_TYPE_HEADER;
art->minsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
art->init= sound_header_area_init;
art->draw= sound_header_area_draw;
BLI_addhead(&st->regiontypes, art);
/* regions: channels */
art= MEM_callocN(sizeof(ARegionType), "spacetype sound region");
art->regionid = RGN_TYPE_CHANNELS;
art->minsizex= 80;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
// art->init= sound_channel_area_init;
// art->draw= sound_channel_area_draw;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
}

View File

@@ -0,0 +1,53 @@
#
# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
#
# ***** 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) 2007 Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL LICENSE BLOCK *****
#
# Makes module object directory and bounces make to subdirectories.
LIBNAME = ed_text
DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
# not very neat....
CPPFLAGS += -I../../windowmanager
CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../python
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# own include
CPPFLAGS += -I../include

View File

@@ -0,0 +1,9 @@
#!/usr/bin/python
Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
env.BlenderLib ( 'bf_editors_space_text', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] )

View File

@@ -0,0 +1,238 @@
/**
* $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 "DNA_text_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
#include "BLI_rand.h"
#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_screen.h"
#include "ED_space_api.h"
#include "ED_screen.h"
#include "BIF_gl.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "ED_markers.h"
#include "text_intern.h" // own include
/* ******************** default callbacks for text space ***************** */
static SpaceLink *text_new(void)
{
ARegion *ar;
SpaceText *stext;
stext= MEM_callocN(sizeof(SpaceText), "inittext");
stext->spacetype= SPACE_TEXT;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for text");
BLI_addtail(&stext->regionbase, ar);
ar->regiontype= RGN_TYPE_HEADER;
ar->alignment= RGN_ALIGN_BOTTOM;
UI_view2d_header_default(&ar->v2d);
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for text");
BLI_addtail(&stext->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
/* channel list region XXX */
return (SpaceLink *)stext;
}
/* not spacelink itself */
static void text_free(SpaceLink *sl)
{
SpaceText *stext= (SpaceText*) sl;
stext->text= NULL;
}
/* spacetype; init callback */
static void text_init(struct wmWindowManager *wm, ScrArea *sa)
{
}
static SpaceLink *text_duplicate(SpaceLink *sl)
{
SpaceText *stextn= MEM_dupallocN(sl);
/* clear or remove stuff from old */
return (SpaceLink *)stextn;
}
/* add handlers, stuff you only do once or on area/region changes */
static void text_main_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
/* own keymap */
keymap= WM_keymap_listbase(wm, "Text", SPACE_TEXT, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
static void text_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
// SpaceText *stext= C->area->spacedata.first;
View2D *v2d= &ar->v2d;
float col[3];
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
UI_view2d_view_ortho(C, v2d);
/* data... */
/* reset view matrix */
UI_view2d_view_restore(C);
/* scrollers? */
}
void text_operatortypes(void)
{
}
void text_keymap(struct wmWindowManager *wm)
{
}
/* add handlers, stuff you only do once or on area/region changes */
static void text_header_area_init(wmWindowManager *wm, ARegion *ar)
{
UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
}
static void text_header_area_draw(const bContext *C, ARegion *ar)
{
float col[3];
/* clear */
if(ED_screen_area_active(C))
UI_GetThemeColor3fv(TH_HEADER, col);
else
UI_GetThemeColor3fv(TH_HEADERDESEL, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* set view2d view matrix for scrolling (without scrollers) */
UI_view2d_view_ortho(C, &ar->v2d);
text_header_buttons(C, ar);
/* restore view matrix? */
UI_view2d_view_restore(C);
}
static void text_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
}
/* only called once, from space/spacetypes.c */
void ED_spacetype_text(void)
{
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype text");
ARegionType *art;
st->spaceid= SPACE_TEXT;
st->new= text_new;
st->free= text_free;
st->init= text_init;
st->duplicate= text_duplicate;
st->operatortypes= text_operatortypes;
st->keymap= text_keymap;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype text region");
art->regionid = RGN_TYPE_WINDOW;
art->init= text_main_area_init;
art->draw= text_main_area_draw;
art->listener= text_main_area_listener;
art->keymapflag= ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype text region");
art->regionid = RGN_TYPE_HEADER;
art->minsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
art->init= text_header_area_init;
art->draw= text_header_area_draw;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
}

View File

@@ -0,0 +1,132 @@
/**
* $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 "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 "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 "text_intern.h"
/* ************************ header area region *********************** */
static void do_viewmenu(bContext *C, void *arg, int event)
{
}
static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
{
ScrArea *curarea= C->area;
uiBlock *block;
short yco= 0, menuwidth=120;
block= uiBeginBlock(C, handle->region, "dummy_viewmenu", UI_EMBOSSP, UI_HELV);
uiBlockSetButmFunc(block, do_viewmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}
else {
uiBlockSetDirection(block, UI_TOP);
uiBlockFlipOrder(block);
}
uiTextBoundsBlock(block, 50);
uiEndBlock(C, block);
return block;
}
static void do_text_buttons(bContext *C, void *arg, int event)
{
switch(event) {
}
}
void text_header_buttons(const bContext *C, ARegion *ar)
{
ScrArea *sa= C->area;
uiBlock *block;
int xco, yco= 3;
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS, UI_HELV);
uiBlockSetHandleFunc(block, do_text_buttons, NULL);
xco= ED_area_header_standardbuttons(C, block, yco);
if((sa->flag & HEADER_NO_PULLDOWN)==0) {
int xmax;
/* pull down menus */
uiBlockSetEmboss(block, UI_EMBOSSP);
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, C->area,
"View", xco, yco-2, xmax-3, 24, "");
xco+=XIC+xmax;
}
uiBlockSetEmboss(block, UI_EMBOSS);
/* always as last */
sa->headbutlen= xco+XIC+80; // +80 because the last button is not an icon
uiEndBlock(C, block);
uiDrawBlock(block);
}

View File

@@ -0,0 +1,39 @@
/**
* $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_TEXT_INTERN_H
#define ED_TEXT_INTERN_H
/* internal exports only */
/* text_header.c */
void text_header_buttons(const bContext *C, ARegion *ar);
#endif /* ED_TEXT_INTERN_H */