4 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version. The Blender
10 * Foundation also sells licenses for use in proprietary software under
11 * the Blender License. See http://www.blender.org/BL/ for information
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
24 * All rights reserved.
26 * The Original Code is: all of this file.
28 * Contributor(s): none yet.
30 * ***** END GPL/BL DUAL LICENSE BLOCK *****
40 #include "BLI_winstuff.h"
43 #include "BLI_blenlib.h"
45 #include "DNA_screen_types.h"
48 #include "BIF_mywindow.h"
49 #include "BIF_screen.h"
50 #include "BIF_spacetypes.h"
58 SpaceChangeFP winchange;
59 SpaceHandleFP winhandle;
63 SpaceType *spacetype_new(char *name)
65 SpaceType *st= calloc(1, sizeof(*st));
66 BLI_strncpy(st->name, name, sizeof(st->name));
71 void spacetype_set_winfuncs(SpaceType *st, SpaceDrawFP draw, SpaceChangeFP change, SpaceHandleFP handle)
74 st->winchange= change;
75 st->winhandle= handle;
80 SpaceType *spacetype_from_code(int spacecode)
83 case SPACE_ACTION: return spaceaction_get_type();
84 case SPACE_BUTS: return spacebuts_get_type();
85 case SPACE_FILE: return spacefile_get_type();
86 case SPACE_IMAGE: return spaceimage_get_type();
87 case SPACE_IMASEL: return spaceimasel_get_type();
88 case SPACE_INFO: return spaceinfo_get_type();
89 case SPACE_IPO: return spaceipo_get_type();
90 case SPACE_NLA: return spacenla_get_type();
91 case SPACE_OOPS: return spaceoops_get_type();
92 case SPACE_SEQ: return spaceseq_get_type();
93 case SPACE_SOUND: return spacesound_get_type();
94 case SPACE_TEXT: return spacetext_get_type();
95 case SPACE_VIEW3D: return spaceview3d_get_type();
101 void scrarea_do_windraw(ScrArea *area)
103 SpaceType *st= spacetype_from_code(area->spacetype);
105 areawinset(area->win);
107 if(area->win && st->windraw) {
111 glClearColor(0.4375, 0.4375, 0.4375, 0.0);
112 glClear(GL_COLOR_BUFFER_BIT);
115 area->win_swap= WIN_BACK_OK;
117 void scrarea_do_winchange(ScrArea *area)
119 SpaceType *st= spacetype_from_code(area->spacetype);
121 areawinset(area->win);
126 if (!BLI_rcti_is_empty(&area->winrct)) {
127 bwin_ortho2(area->win, -0.5, area->winrct.xmax-area->winrct.xmin-0.5, -0.5, area->winrct.ymax-area->winrct.ymin-0.5);
132 void scrarea_do_winhandle(ScrArea *area, BWinEvent *evt)
134 SpaceType *st= spacetype_from_code(area->spacetype);
136 areawinset(area->win);
139 st->winhandle(evt->event, evt->val, evt->ascii);