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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2008-12-13 22:00:54 +0300
committerTon Roosendaal <ton@blender.org>2008-12-13 22:00:54 +0300
commit2493644509da284ec55d33af91f52c1e522895bc (patch)
tree8d007f78c973bd84c97ada27af9c01dafee6eccb /source/blender
parent04e264a7a22303ad61940a849a93735f06a5893a (diff)
2.5
Added basics for oour precious Buttons Window. The one that will be (OH NO!) vertical one day? ;)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenloader/intern/readfile.c16
-rw-r--r--source/blender/editors/Makefile2
-rw-r--r--source/blender/editors/SConscript1
-rw-r--r--source/blender/editors/include/ED_previewrender.h88
-rw-r--r--source/blender/editors/include/ED_space_api.h1
-rw-r--r--source/blender/editors/space_api/spacetypes.c1
-rw-r--r--source/blender/editors/space_buttons/Makefile53
-rw-r--r--source/blender/editors/space_buttons/SConscript9
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c234
-rw-r--r--source/blender/editors/space_buttons/buttons_intern.h81
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c273
-rw-r--r--source/blender/editors/space_image/image_header.c1
12 files changed, 757 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5d33deec821..a2b08e4890b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5125,9 +5125,21 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_BOTTOM);
ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_LEFT);
-
+ break;
+ }
+ case SPACE_NODE:
+ {
+ SpaceNode *snode= (SpaceNode *)sl;
+ memcpy(&ar->v2d, &snode->v2d, sizeof(View2D));
+ break;
+ }
+ case SPACE_BUTS:
+ {
+ SpaceButs *sbuts= (SpaceButs *)sl;
+ memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D));
+ break;
}
- //case SPACE_XXX: // FIXME... add other ones
+ //case SPACE_XXX: // FIXME... add other ones
// memcpy(&ar->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D));
// break;
}
diff --git a/source/blender/editors/Makefile b/source/blender/editors/Makefile
index 657c0aa3de2..dc90db4f47b 100644
--- a/source/blender/editors/Makefile
+++ b/source/blender/editors/Makefile
@@ -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
+DIRS = datafiles screen space_outliner space_time space_view3d interface util space_api space_ipo space_image space_node space_buttons
include nan_subdirs.mk
diff --git a/source/blender/editors/SConscript b/source/blender/editors/SConscript
index 2023439352f..b21bcd3f221 100644
--- a/source/blender/editors/SConscript
+++ b/source/blender/editors/SConscript
@@ -14,5 +14,6 @@ SConscript(['datafiles/SConscript',
'space_ipo/SConscript',
'space_image/SConscript',
'space_node/SConscript',
+ 'space_buttons/SConscript',
'transform/SConscript',
'screen/SConscript'])
diff --git a/source/blender/editors/include/ED_previewrender.h b/source/blender/editors/include/ED_previewrender.h
new file mode 100644
index 00000000000..f0a9ead4757
--- /dev/null
+++ b/source/blender/editors/include/ED_previewrender.h
@@ -0,0 +1,88 @@
+/**
+ * ***** 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) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BIF_PREVIEWRENDER_H
+#define BIF_PREVIEWRENDER_H
+
+#include "DNA_vec_types.h"
+
+struct View3D;
+struct SpaceButs;
+struct RenderInfo;
+struct Image;
+struct ScrArea;
+struct uiBlock;
+struct Render;
+
+#define PREVIEW_RENDERSIZE 140
+
+typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
+
+/* stores rendered preview - is also used for icons */
+typedef struct RenderInfo {
+ int pr_rectx;
+ int pr_recty;
+ short curtile, tottile, status;
+ rcti disprect; /* storage for view3d preview rect */
+ unsigned int* rect;
+ struct Render *re; /* persistant render */
+} RenderInfo;
+
+/* ri->status */
+#define PR_DBASE 1
+#define PR_DISPRECT 2
+#define PR_PROJECTED 4
+#define PR_ROTATED 8
+
+/* Render the preview
+
+pr_method:
+- PR_DRAW_RENDER: preview is rendered and drawn, as indicated by called context (buttons panel)
+- PR_ICON_RENDER: the preview is not drawn and the function is not dynamic,
+ so no events are processed. Hopefully fast enough for at least 32x32
+- PR_DO_RENDER: preview is rendered, not drawn, but events are processed for afterqueue,
+ in use for node editor now.
+*/
+
+#define PR_DRAW_RENDER 0
+#define PR_ICON_RENDER 1
+#define PR_DO_RENDER 2
+
+#if 0
+void BIF_previewrender (struct ID *id, struct RenderInfo *ri, struct ScrArea *area, int pr_method);
+void BIF_previewrender_buts (struct SpaceButs *sbuts);
+void BIF_previewdraw (struct ScrArea *sa, struct uiBlock *block);
+void BIF_preview_changed (short id_code);
+
+void BIF_preview_init_dbase (void);
+void BIF_preview_free_dbase (void);
+
+void BIF_view3d_previewrender(struct ScrArea *sa);
+void BIF_view3d_previewdraw (struct ScrArea *sa, struct uiBlock *block);
+void BIF_view3d_previewrender_free(struct View3D *v3d);
+void BIF_view3d_previewrender_clear(struct ScrArea *sa);
+void BIF_view3d_previewrender_signal(struct ScrArea *sa, short signal);
+
+#endif
+
+#endif
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index d7b4e90e061..b1eb4d152cb 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -38,6 +38,7 @@ void ED_spacetype_view3d(void);
void ED_spacetype_ipo(void);
void ED_spacetype_image(void);
void ED_spacetype_node(void);
+void ED_spacetype_buttons(void);
#endif /* ED_AREA_H */
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index c8b414f56ac..466eb3e4fe6 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -67,6 +67,7 @@ void ED_spacetypes_init(void)
ED_spacetype_ipo();
ED_spacetype_image();
ED_spacetype_node();
+ ED_spacetype_buttons();
// ...
/* register operator types for screen and all spaces */
diff --git a/source/blender/editors/space_buttons/Makefile b/source/blender/editors/space_buttons/Makefile
new file mode 100644
index 00000000000..33fe2cfc9cb
--- /dev/null
+++ b/source/blender/editors/space_buttons/Makefile
@@ -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_buttons
+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
diff --git a/source/blender/editors/space_buttons/SConscript b/source/blender/editors/space_buttons/SConscript
new file mode 100644
index 00000000000..eb3e6bda207
--- /dev/null
+++ b/source/blender/editors/space_buttons/SConscript
@@ -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_buttons', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] )
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
new file mode 100644
index 00000000000..7850a1dc818
--- /dev/null
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -0,0 +1,234 @@
+/**
+ * $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 "buttons_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;
+}
+
+#define B_NEWSPACE 100
+#define B_CONTEXT_SWITCH 101
+#define B_BUTSPREVIEW 102
+#define B_NEWFRAME 103
+
+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;
+ }
+}
+
+
+void buttons_header_buttons(const bContext *C, ARegion *ar)
+{
+ ScrArea *sa= C->area;
+ SpaceButs *sbuts= sa->spacedata.first;
+ uiBlock *block;
+ int xco, yco= 3;
+
+ 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;
+
+ 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);
+
+ uiBlockBeginAlign(block);
+ uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_GAME, xco, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)CONTEXT_LOGIC, 0, 0, "Logic (F4) ");
+ uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCRIPT, xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)CONTEXT_SCRIPT, 0, 0, "Script ");
+ uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_MATERIAL_DEHLT,xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)CONTEXT_SHADING, 0, 0, "Shading (F5) ");
+ uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_OBJECT, xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)CONTEXT_OBJECT, 0, 0, "Object (F7) ");
+ uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_EDIT, xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)CONTEXT_EDITING, 0, 0, "Editing (F9) ");
+ uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE_DEHLT, xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)CONTEXT_SCENE, 0, 0, "Scene (F10) ");
+
+ xco+= XIC;
+
+ /* select the context to be drawn, per contex/tab the actual context is tested */
+ uiBlockSetEmboss(block, UI_EMBOSS); // normal
+ switch(sbuts->mainb) {
+ case CONTEXT_SCENE:
+ uiBlockBeginAlign(block);
+ uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_RENDER, 0, 0, "Render buttons ");
+ uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_SEQUENCE, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_SEQUENCER, 0, 0, "Sequencer buttons ");
+ uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_ANIM, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_ANIM, 0, 0, "Anim/playback buttons");
+ uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_SOUND, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_SCENE]), 1.0, (float)TAB_SCENE_SOUND, 0, 0, "Sound block buttons");
+
+ break;
+ case CONTEXT_OBJECT:
+ uiBlockBeginAlign(block);
+ uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_OBJECT, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_OBJECT]), 1.0, (float)TAB_OBJECT_OBJECT, 0, 0, "Object buttons ");
+ uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_PHYSICS, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_OBJECT]), 1.0, (float)TAB_OBJECT_PHYSICS, 0, 0, "Physics buttons");
+ uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_PARTICLES, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_OBJECT]), 1.0, (float)TAB_OBJECT_PARTICLE, 0, 0, "Particle buttons");
+
+ break;
+ case CONTEXT_SHADING:
+ uiBlockBeginAlign(block);
+ uiDefIconButC(block, ROW, B_BUTSPREVIEW, ICON_LAMP, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_LAMP, 0, 0, "Lamp buttons");
+ uiDefIconButC(block, ROW, B_BUTSPREVIEW, ICON_MATERIAL, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_MAT, 0, 0, "Material buttons");
+ uiDefIconButC(block, ROW, B_BUTSPREVIEW, ICON_TEXTURE, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_TEX, 0, 0, "Texture buttons(F6)");
+ uiDefIconButC(block, ROW, B_CONTEXT_SWITCH, ICON_RADIO,xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_RAD, 0, 0, "Radiosity buttons");
+ uiDefIconButC(block, ROW, B_BUTSPREVIEW, ICON_WORLD, xco+=XIC, yco, XIC, YIC, &(sbuts->tab[CONTEXT_SHADING]), 1.0, (float)TAB_SHADING_WORLD, 0, 0, "World buttons");
+
+ break;
+ case CONTEXT_EDITING:
+
+ break;
+ case CONTEXT_SCRIPT:
+
+ break;
+ case CONTEXT_LOGIC:
+
+ break;
+ }
+
+ uiBlockEndAlign(block);
+
+ xco+=XIC;
+ uiDefButI(block, NUM, B_NEWFRAME, "", (xco+20),yco,60,YIC, &(C->scene->r.cfra), 1.0, MAXFRAMEF, 0, 0, "Displays Current Frame of animation. Click to change.");
+ xco+= 80;
+
+// XXX buttons_active_id(&id, &idfrom);
+// sbuts->lockpoin= id;
+
+
+
+ /* always as last */
+ sa->headbutlen= xco+XIC+80; // +80 because the last button is not an icon
+
+ uiEndBlock(C, block);
+ uiDrawBlock(block);
+}
+
+
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
new file mode 100644
index 00000000000..7c818488265
--- /dev/null
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -0,0 +1,81 @@
+/**
+ * $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_BUTTONS_INTERN_H
+#define ED_BUTTONS_INTERN_H
+
+/* warning: the values of these defines are used in sbuts->tabs[7] */
+/* buts->mainb new */
+#define CONTEXT_SCENE 0
+#define CONTEXT_OBJECT 1
+#define CONTEXT_TYPES 2
+#define CONTEXT_SHADING 3
+#define CONTEXT_EDITING 4
+#define CONTEXT_SCRIPT 5
+#define CONTEXT_LOGIC 6
+
+/* buts->tab new */
+#define TAB_SHADING_MAT 0
+#define TAB_SHADING_TEX 1
+#define TAB_SHADING_RAD 2
+#define TAB_SHADING_WORLD 3
+#define TAB_SHADING_LAMP 4
+
+#define TAB_OBJECT_OBJECT 0
+#define TAB_OBJECT_PHYSICS 1
+#define TAB_OBJECT_PARTICLE 2
+
+#define TAB_SCENE_RENDER 0
+#define TAB_SCENE_WORLD 1
+#define TAB_SCENE_ANIM 2
+#define TAB_SCENE_SOUND 3
+#define TAB_SCENE_SEQUENCER 4
+
+
+/* buts->scaflag */
+#define BUTS_SENS_SEL 1
+#define BUTS_SENS_ACT 2
+#define BUTS_SENS_LINK 4
+#define BUTS_CONT_SEL 8
+#define BUTS_CONT_ACT 16
+#define BUTS_CONT_LINK 32
+#define BUTS_ACT_SEL 64
+#define BUTS_ACT_ACT 128
+#define BUTS_ACT_LINK 256
+#define BUTS_SENS_STATE 512
+#define BUTS_ACT_STATE 1024
+
+
+/* internal exports only */
+
+
+/* image_header.c */
+void buttons_header_buttons(const bContext *C, ARegion *ar);
+
+
+#endif /* ED_BUTTONS_INTERN_H */
+
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
new file mode 100644
index 00000000000..ccc8f18d983
--- /dev/null
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -0,0 +1,273 @@
+/**
+ * $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_previewrender.h"
+
+#include "buttons_intern.h" // own include
+
+/* ******************** default callbacks for buttons space ***************** */
+
+static SpaceLink *buttons_new(void)
+{
+ ARegion *ar;
+ SpaceButs *sbuts;
+
+ sbuts= MEM_callocN(sizeof(SpaceButs), "initbuts");
+ sbuts->spacetype= SPACE_BUTS;
+ sbuts->scaflag= BUTS_SENS_LINK|BUTS_SENS_ACT|BUTS_CONT_ACT|BUTS_ACT_ACT|BUTS_ACT_LINK;
+
+ /* header */
+ ar= MEM_callocN(sizeof(ARegion), "header for buts");
+
+ BLI_addtail(&sbuts->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 buts");
+
+ BLI_addtail(&sbuts->regionbase, ar);
+ ar->regiontype= RGN_TYPE_WINDOW;
+
+ /* buts space goes from (0,0) to (1280, 228) */
+
+ sbuts->v2d.tot.xmin= 0.0f;
+ sbuts->v2d.tot.ymin= 0.0f;
+ sbuts->v2d.tot.xmax= 1279.0f;
+ sbuts->v2d.tot.ymax= 228.0f;
+
+ sbuts->v2d.min[0]= 256.0f;
+ sbuts->v2d.min[1]= 42.0f;
+
+ sbuts->v2d.max[0]= 2048.0f;
+ sbuts->v2d.max[1]= 450.0f;
+
+ sbuts->v2d.minzoom= 0.5f;
+ sbuts->v2d.maxzoom= 1.21f;
+
+ sbuts->v2d.scroll= 0;
+ sbuts->v2d.keepaspect= 1;
+ sbuts->v2d.keepzoom= 1;
+ sbuts->v2d.keeptot= 1;
+ sbuts->v2d.cur= sbuts->v2d.tot;
+
+
+ return (SpaceLink *)sbuts;
+}
+
+/* not spacelink itself */
+static void buttons_free(SpaceLink *sl)
+{
+ SpaceButs *sbuts= (SpaceButs*) sl;
+
+ if(sbuts->ri) {
+ if (sbuts->ri->rect) MEM_freeN(sbuts->ri->rect);
+ MEM_freeN(sbuts->ri);
+ }
+
+}
+
+
+/* spacetype; init callback */
+static void buttons_init(struct wmWindowManager *wm, ScrArea *sa)
+{
+
+}
+
+static SpaceLink *buttons_duplicate(SpaceLink *sl)
+{
+ SpaceButs *sbutsn= MEM_dupallocN(sl);
+
+ /* clear or remove stuff from old */
+ sbutsn->ri= NULL;
+
+ return (SpaceLink *)sbutsn;
+}
+
+
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void buttons_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, "Buttons", SPACE_BUTS, 0); /* XXX weak? */
+ WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+}
+
+static void buttons_main_area_draw(const bContext *C, ARegion *ar)
+{
+ /* draw entirely, view changes should be handled here */
+ // SpaceButs *sbuts= 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 buttons_operatortypes(void)
+{
+
+}
+
+void buttons_keymap(struct wmWindowManager *wm)
+{
+
+}
+
+/* add handlers, stuff you only do once or on area/region changes */
+static void buttons_header_area_init(wmWindowManager *wm, ARegion *ar)
+{
+ UI_view2d_size_update(&ar->v2d, ar->winx, ar->winy);
+}
+
+static void buttons_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);
+
+ buttons_header_buttons(C, ar);
+
+ /* restore view matrix? */
+ UI_view2d_view_restore(C);
+}
+
+static void buttons_main_area_listener(ARegion *ar, wmNotifier *wmn)
+{
+ /* context changes */
+}
+
+/* only called once, from space/spacetypes.c */
+void ED_spacetype_buttons(void)
+{
+ SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype buttons");
+ ARegionType *art;
+
+ st->spaceid= SPACE_BUTS;
+
+ st->new= buttons_new;
+ st->free= buttons_free;
+ st->init= buttons_init;
+ st->duplicate= buttons_duplicate;
+ st->operatortypes= buttons_operatortypes;
+ st->keymap= buttons_keymap;
+
+ /* regions: main window */
+ art= MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
+ art->regionid = RGN_TYPE_WINDOW;
+ art->init= buttons_main_area_init;
+ art->draw= buttons_main_area_draw;
+ art->listener= buttons_main_area_listener;
+ art->keymapflag= ED_KEYMAP_VIEW2D;
+
+ BLI_addhead(&st->regiontypes, art);
+
+ /* regions: header */
+ art= MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
+ art->regionid = RGN_TYPE_HEADER;
+ art->minsizey= HEADERY;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+
+ art->init= buttons_header_area_init;
+ art->draw= buttons_header_area_draw;
+
+ BLI_addhead(&st->regiontypes, art);
+
+ /* regions: channels */
+ art= MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
+ art->regionid = RGN_TYPE_CHANNELS;
+ art->minsizex= 80;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+
+// art->init= buttons_channel_area_init;
+// art->draw= buttons_channel_area_draw;
+
+ BLI_addhead(&st->regiontypes, art);
+
+
+ BKE_spacetype_register(st);
+}
+
diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c
index 9153cc44d8f..9022dedabeb 100644
--- a/source/blender/editors/space_image/image_header.c
+++ b/source/blender/editors/space_image/image_header.c
@@ -152,6 +152,7 @@ void image_header_buttons(const bContext *C, ARegion *ar)
xmax= GetButStringLength("View");
uiDefPulldownBut(block, dummy_viewmenu, C->area,
"View", xco, yco-2, xmax-3, 24, "");
+ xco+=XIC+xmax;
}
uiBlockSetEmboss(block, UI_EMBOSS);