| 
									
										
										
										
											2011-02-23 10:52:22 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  |  * ***** 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, | 
					
						
							| 
									
										
										
										
											2010-02-12 13:34:04 +00:00
										 |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  |  *  | 
					
						
							|  |  |  |  * Contributor(s): Campbell Barton | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ***** END GPL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2011-02-27 20:29:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** \file blender/editors/space_console/space_console.c
 | 
					
						
							|  |  |  |  *  \ingroup spconsole | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-14 17:55:27 +00:00
										 |  |  | #include <string.h>
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | #include <stdio.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "MEM_guardedalloc.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "BLI_blenlib.h"
 | 
					
						
							| 
									
										
										
										
											2011-01-07 18:36:47 +00:00
										 |  |  | #include "BLI_utildefines.h"
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "BKE_context.h"
 | 
					
						
							|  |  |  | #include "BKE_screen.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-14 17:55:27 +00:00
										 |  |  | #include "ED_space_api.h"
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | #include "ED_screen.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "BIF_gl.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "RNA_access.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "WM_api.h"
 | 
					
						
							|  |  |  | #include "WM_types.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "UI_resources.h"
 | 
					
						
							|  |  |  | #include "UI_view2d.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | #include "console_intern.h" // own include
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* ******************** default callbacks for console space ***************** */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-13 23:46:42 +00:00
										 |  |  | static SpaceLink *console_new(const bContext *UNUSED(C)) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	ARegion *ar; | 
					
						
							|  |  |  | 	SpaceConsole *sconsole; | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	sconsole = MEM_callocN(sizeof(SpaceConsole), "initconsole"); | 
					
						
							|  |  |  | 	sconsole->spacetype = SPACE_CONSOLE; | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	sconsole->lheight =  14; | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* header */ | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	ar = MEM_callocN(sizeof(ARegion), "header for console"); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	BLI_addtail(&sconsole->regionbase, ar); | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	ar->regiontype = RGN_TYPE_HEADER; | 
					
						
							|  |  |  | 	ar->alignment = RGN_ALIGN_BOTTOM; | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2015-11-28 17:14:45 +01:00
										 |  |  | 	/* main region */ | 
					
						
							|  |  |  | 	ar = MEM_callocN(sizeof(ARegion), "main region for text"); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	BLI_addtail(&sconsole->regionbase, ar); | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	ar->regiontype = RGN_TYPE_WINDOW; | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-11-11 13:36:57 +00:00
										 |  |  | 	/* keep in sync with info */ | 
					
						
							| 
									
										
										
										
											2009-07-17 12:35:57 +00:00
										 |  |  | 	ar->v2d.scroll |= (V2D_SCROLL_RIGHT); | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	ar->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */ | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 	ar->v2d.keepofs |= V2D_LOCKOFS_X; | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); | 
					
						
							|  |  |  | 	ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS; | 
					
						
							|  |  |  | 	ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f; | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ | 
					
						
							| 
									
										
										
										
											2012-10-26 04:14:10 +00:00
										 |  |  | 	//ar->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM);
 | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	return (SpaceLink *)sconsole; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* not spacelink itself */ | 
					
						
							|  |  |  | static void console_free(SpaceLink *sl) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	SpaceConsole *sc = (SpaceConsole *) sl; | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2012-03-24 06:38:07 +00:00
										 |  |  | 	while (sc->scrollback.first) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 		console_scrollback_free(sc, sc->scrollback.first); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2012-03-24 06:38:07 +00:00
										 |  |  | 	while (sc->history.first) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 		console_history_free(sc, sc->history.first); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* spacetype; init callback */ | 
					
						
							| 
									
										
										
										
											2010-10-13 23:46:42 +00:00
										 |  |  | static void console_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static SpaceLink *console_duplicate(SpaceLink *sl) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	SpaceConsole *sconsolen = MEM_dupallocN(sl); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* clear or remove stuff from old */ | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	/* TODO - duplicate?, then we also need to duplicate the py namespace */ | 
					
						
							| 
									
										
										
										
											2014-02-08 06:07:10 +11:00
										 |  |  | 	BLI_listbase_clear(&sconsolen->scrollback); | 
					
						
							|  |  |  | 	BLI_listbase_clear(&sconsolen->history); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	return (SpaceLink *)sconsolen; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* add handlers, stuff you only do once or on area/region changes */ | 
					
						
							| 
									
										
										
										
											2015-11-28 17:14:45 +01:00
										 |  |  | static void console_main_region_init(wmWindowManager *wm, ARegion *ar) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-09-17 21:36:02 +00:00
										 |  |  | 	wmKeyMap *keymap; | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 	ListBase *lb; | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	const float prev_y_min = ar->v2d.cur.ymin; /* so re-sizing keeps the cursor visible */ | 
					
						
							| 
									
										
										
										
											2011-09-18 01:34:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-12 12:30:05 +00:00
										 |  |  | 	/* force it on init, for old files, until it becomes config */ | 
					
						
							|  |  |  | 	ar->v2d.scroll = (V2D_SCROLL_RIGHT); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-18 01:34:53 +00:00
										 |  |  | 	/* always keep the bottom part of the view aligned, less annoying */ | 
					
						
							| 
									
										
										
										
											2012-03-24 06:38:07 +00:00
										 |  |  | 	if (prev_y_min != ar->v2d.cur.ymin) { | 
					
						
							| 
									
										
										
										
											2012-09-15 11:48:20 +00:00
										 |  |  | 		const float cur_y_range = BLI_rctf_size_y(&ar->v2d.cur); | 
					
						
							| 
									
										
										
										
											2012-03-24 02:51:46 +00:00
										 |  |  | 		ar->v2d.cur.ymin = prev_y_min; | 
					
						
							|  |  |  | 		ar->v2d.cur.ymax = prev_y_min + cur_y_range; | 
					
						
							| 
									
										
										
										
											2011-09-18 01:34:53 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	/* own keymap */ | 
					
						
							| 
									
										
										
										
											2012-03-24 02:51:46 +00:00
										 |  |  | 	keymap = WM_keymap_find(wm->defaultconf, "Console", SPACE_CONSOLE, 0); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* add drop boxes */ | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	lb = WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW); | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	WM_event_add_dropbox_handler(&ar->handlers, lb); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-30 18:12:29 +10:00
										 |  |  | /* same as 'text_cursor' */ | 
					
						
							|  |  |  | static void console_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	SpaceText *st = sa->spacedata.first; | 
					
						
							|  |  |  | 	int wmcursor = BC_TEXTEDITCURSOR; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (st->text && BLI_rcti_isect_pt(&st->txtbar, win->eventstate->x - ar->winrct.xmin, st->txtbar.ymin)) { | 
					
						
							|  |  |  | 		wmcursor = CURSOR_STD; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	WM_cursor_set(win, wmcursor); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* ************* dropboxes ************* */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-13 09:03:46 +00:00
										 |  |  | static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-26 04:14:10 +00:00
										 |  |  | //	SpaceConsole *sc = CTX_wm_space_console(C);
 | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	if (drag->type == WM_DRAG_ID) | 
					
						
							| 
									
										
										
										
											2010-11-11 13:36:57 +00:00
										 |  |  | 		return 1; | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void id_drop_copy(wmDrag *drag, wmDropBox *drop) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-12-02 07:13:19 +00:00
										 |  |  | 	char *text; | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	ID *id = drag->poin; | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* copy drag path to properties */ | 
					
						
							| 
									
										
										
										
											2012-12-18 15:22:06 +00:00
										 |  |  | 	text = RNA_path_full_ID_py(id); | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 	RNA_string_set(drop->ptr, "text", text); | 
					
						
							| 
									
										
										
										
											2012-12-02 07:13:19 +00:00
										 |  |  | 	MEM_freeN(text); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-13 09:03:46 +00:00
										 |  |  | static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-26 04:14:10 +00:00
										 |  |  | 	// SpaceConsole *sc = CTX_wm_space_console(C);
 | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	if (drag->type == WM_DRAG_PATH) | 
					
						
							| 
									
										
										
										
											2010-11-11 13:36:57 +00:00
										 |  |  | 		return 1; | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void path_drop_copy(wmDrag *drag, wmDropBox *drop) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	char pathname[FILE_MAX + 2]; | 
					
						
							| 
									
										
										
										
											2011-08-30 10:07:50 +00:00
										 |  |  | 	BLI_snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path); | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 	RNA_string_set(drop->ptr, "text", pathname); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* this region dropbox definition */ | 
					
						
							|  |  |  | static void console_dropboxes(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	ListBase *lb = WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW); | 
					
						
							| 
									
										
										
										
											2010-05-08 07:25:26 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	WM_dropbox_add(lb, "CONSOLE_OT_insert", id_drop_poll, id_drop_copy); | 
					
						
							|  |  |  | 	WM_dropbox_add(lb, "CONSOLE_OT_insert", path_drop_poll, path_drop_copy); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************* end drop *********** */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-28 17:14:45 +01:00
										 |  |  | static void console_main_region_draw(const bContext *C, ARegion *ar) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	/* draw entirely, view changes should be handled here */ | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	SpaceConsole *sc = CTX_wm_space_console(C); | 
					
						
							|  |  |  | 	View2D *v2d = &ar->v2d; | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 	View2DScrollers *scrollers; | 
					
						
							| 
									
										
										
										
											2010-11-30 22:39:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-08 06:07:10 +11:00
										 |  |  | 	if (BLI_listbase_is_empty(&sc->scrollback)) | 
					
						
							| 
									
										
										
										
											2009-11-05 11:17:09 +00:00
										 |  |  | 		WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 	/* clear and setup matrix */ | 
					
						
							| 
									
										
										
										
											2010-04-06 07:02:16 +00:00
										 |  |  | 	UI_ThemeClearColor(TH_BACK); | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 	glClear(GL_COLOR_BUFFER_BIT); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* worlks best with no view2d matrix set */ | 
					
						
							| 
									
										
										
										
											2010-10-14 01:22:14 +00:00
										 |  |  | 	UI_view2d_view_ortho(v2d); | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* data... */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	console_history_verify(C); /* make sure we have some command line */ | 
					
						
							| 
									
										
										
										
											2010-11-30 22:39:41 +00:00
										 |  |  | 	console_textview_main(sc, ar); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* reset view matrix */ | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 	UI_view2d_view_restore(C); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* scrollers */ | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_GRID_CLAMP); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	UI_view2d_scrollers_draw(C, v2d, scrollers); | 
					
						
							|  |  |  | 	UI_view2d_scrollers_free(scrollers); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-14 17:55:27 +00:00
										 |  |  | static void console_operatortypes(void) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-07-19 00:49:44 +00:00
										 |  |  | 	/* console_ops.c */ | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	WM_operatortype_append(CONSOLE_OT_move); | 
					
						
							|  |  |  | 	WM_operatortype_append(CONSOLE_OT_delete); | 
					
						
							|  |  |  | 	WM_operatortype_append(CONSOLE_OT_insert); | 
					
						
							| 
									
										
										
										
											2012-06-04 07:24:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	WM_operatortype_append(CONSOLE_OT_indent); | 
					
						
							|  |  |  | 	WM_operatortype_append(CONSOLE_OT_unindent); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* for use by python only */ | 
					
						
							|  |  |  | 	WM_operatortype_append(CONSOLE_OT_history_append);  | 
					
						
							|  |  |  | 	WM_operatortype_append(CONSOLE_OT_scrollback_append); | 
					
						
							| 
									
										
										
										
											2012-05-09 14:58:57 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	WM_operatortype_append(CONSOLE_OT_clear); | 
					
						
							|  |  |  | 	WM_operatortype_append(CONSOLE_OT_clear_line); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	WM_operatortype_append(CONSOLE_OT_history_cycle); | 
					
						
							| 
									
										
										
										
											2009-07-26 04:31:46 +00:00
										 |  |  | 	WM_operatortype_append(CONSOLE_OT_copy); | 
					
						
							| 
									
										
										
										
											2009-07-30 01:52:00 +00:00
										 |  |  | 	WM_operatortype_append(CONSOLE_OT_paste); | 
					
						
							| 
									
										
										
										
											2009-12-27 20:22:06 +00:00
										 |  |  | 	WM_operatortype_append(CONSOLE_OT_select_set); | 
					
						
							| 
									
										
										
										
											2015-03-16 16:01:32 +11:00
										 |  |  | 	WM_operatortype_append(CONSOLE_OT_select_word); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-14 17:55:27 +00:00
										 |  |  | static void console_keymap(struct wmKeyConfig *keyconf) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-24 02:51:46 +00:00
										 |  |  | 	wmKeyMap *keymap = WM_keymap_find(keyconf, "Console", SPACE_CONSOLE, 0); | 
					
						
							| 
									
										
										
										
											2010-01-03 02:24:53 +00:00
										 |  |  | 	wmKeyMapItem *kmi; | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-09-22 16:23:46 +00:00
										 |  |  | #ifdef __APPLE__
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN); | 
					
						
							| 
									
										
										
										
											2009-09-09 19:43:05 +00:00
										 |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", RIGHTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_END); | 
					
						
							| 
									
										
										
										
											2009-09-22 16:23:46 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-09-09 19:43:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-22 16:23:46 +00:00
										 |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", PREV_WORD); | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", RIGHTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", NEXT_WORD); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", HOMEKEY, KM_PRESS, 0, 0)->ptr, "type", LINE_BEGIN); | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", ENDKEY, KM_PRESS, 0, 0)->ptr, "type", LINE_END); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-01-03 02:24:53 +00:00
										 |  |  | 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0); | 
					
						
							| 
									
										
										
										
											2010-06-14 03:52:10 +00:00
										 |  |  | 	RNA_string_set(kmi->ptr, "data_path", "space_data.font_size"); | 
					
						
							| 
									
										
										
										
											2014-04-01 11:34:00 +11:00
										 |  |  | 	RNA_boolean_set(kmi->ptr, "reverse", false); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-01-03 02:24:53 +00:00
										 |  |  | 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL, 0); | 
					
						
							| 
									
										
										
										
											2010-06-14 03:52:10 +00:00
										 |  |  | 	RNA_string_set(kmi->ptr, "data_path", "space_data.font_size"); | 
					
						
							| 
									
										
										
										
											2014-04-01 11:34:00 +11:00
										 |  |  | 	RNA_boolean_set(kmi->ptr, "reverse", true); | 
					
						
							| 
									
										
										
										
											2010-01-03 02:24:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); | 
					
						
							| 
									
										
										
										
											2010-06-14 03:52:10 +00:00
										 |  |  | 	RNA_string_set(kmi->ptr, "data_path", "space_data.font_size"); | 
					
						
							| 
									
										
										
										
											2014-04-01 11:34:00 +11:00
										 |  |  | 	RNA_boolean_set(kmi->ptr, "reverse", false); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2010-01-03 02:24:53 +00:00
										 |  |  | 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", PADMINUS, KM_PRESS, KM_CTRL, 0); | 
					
						
							| 
									
										
										
										
											2010-06-14 03:52:10 +00:00
										 |  |  | 	RNA_string_set(kmi->ptr, "data_path", "space_data.font_size"); | 
					
						
							| 
									
										
										
										
											2014-04-01 11:34:00 +11:00
										 |  |  | 	RNA_boolean_set(kmi->ptr, "reverse", true); | 
					
						
							| 
									
										
										
										
											2010-01-03 02:24:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_CHAR); | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", NEXT_CHAR); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2014-04-01 11:34:00 +11:00
										 |  |  | 	RNA_boolean_set(WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", UPARROWKEY, KM_PRESS, 0, 0)->ptr, "reverse", true); | 
					
						
							|  |  |  | 	RNA_boolean_set(WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "reverse", false); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2012-03-03 16:31:46 +00:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", PREV_WORD); | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", RIGHTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", NEXT_WORD); | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", UPARROWKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_LINE); | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "type", NEXT_LINE); | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", PAGEUPKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_PAGE); | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", PAGEDOWNKEY, KM_PRESS, 0, 0)->ptr, "type", NEXT_PAGE); | 
					
						
							| 
									
										
										
										
											2012-03-03 16:31:46 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", DELKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_NEXT_CHAR); | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", BACKSPACEKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_PREV_CHAR); | 
					
						
							| 
									
										
										
										
											2011-03-29 16:52:26 +00:00
										 |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", BACKSPACEKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", DEL_PREV_CHAR);  /* same as above [#26623] */ | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-03 03:17:49 +00:00
										 |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", DELKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_WORD); | 
					
						
							|  |  |  | 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", BACKSPACEKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_PREV_WORD); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-09 14:58:57 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_clear_line", RETKEY, KM_PRESS, KM_SHIFT, 0); | 
					
						
							| 
									
										
										
										
											2013-10-03 04:31:41 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_clear_line", PADENTER, KM_PRESS, KM_SHIFT, 0); | 
					
						
							| 
									
										
										
										
											2012-05-09 14:58:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-31 04:11:39 +00:00
										 |  |  | #ifdef WITH_PYTHON
 | 
					
						
							| 
									
										
										
										
											2013-05-24 01:04:37 +00:00
										 |  |  | 	kmi = WM_keymap_add_item(keymap, "CONSOLE_OT_execute", RETKEY, KM_PRESS, 0, 0); | 
					
						
							|  |  |  | 	RNA_boolean_set(kmi->ptr, "interactive", true); | 
					
						
							|  |  |  | 	kmi = WM_keymap_add_item(keymap, "CONSOLE_OT_execute", PADENTER, KM_PRESS, 0, 0); | 
					
						
							|  |  |  | 	RNA_boolean_set(kmi->ptr, "interactive", true); | 
					
						
							| 
									
										
										
										
											2009-07-24 23:07:18 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 	//WM_keymap_add_item(keymap, "CONSOLE_OT_autocomplete", TABKEY, KM_PRESS, 0, 0); /* python operator - space_text.py */
 | 
					
						
							| 
									
										
										
										
											2009-07-28 08:50:11 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_autocomplete", SPACEKEY, KM_PRESS, KM_CTRL, 0); /* python operator - space_text.py */ | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-19 21:32:18 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_copy_as_script", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); | 
					
						
							| 
									
										
										
										
											2009-07-26 04:31:46 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0); | 
					
						
							| 
									
										
										
										
											2009-07-30 01:52:00 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0); | 
					
						
							| 
									
										
										
										
											2010-03-10 02:44:21 +00:00
										 |  |  | #ifdef __APPLE__
 | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_copy", CKEY, KM_PRESS, KM_OSKEY, 0); | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_paste", VKEY, KM_PRESS, KM_OSKEY, 0); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-12-27 20:22:06 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_select_set", LEFTMOUSE, KM_PRESS, 0, 0); | 
					
						
							| 
									
										
										
										
											2015-03-16 16:01:32 +11:00
										 |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_select_word", LEFTMOUSE, KM_DBL_CLICK, 0, 0); | 
					
						
							| 
									
										
										
										
											2009-07-19 00:49:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-04 07:24:19 +00:00
										 |  |  | 	RNA_string_set(WM_keymap_add_item(keymap, "CONSOLE_OT_insert", TABKEY, KM_PRESS, KM_CTRL, 0)->ptr, "text", "\t"); /* fake tabs */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_indent", TABKEY, KM_PRESS, 0, 0); | 
					
						
							|  |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_unindent", TABKEY, KM_PRESS, KM_SHIFT, 0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-24 23:07:18 +00:00
										 |  |  | 	WM_keymap_add_item(keymap, "CONSOLE_OT_insert", KM_TEXTINPUT, KM_ANY, KM_ANY, 0); // last!
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /****************** header region ******************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* add handlers, stuff you only do once or on area/region changes */ | 
					
						
							| 
									
										
										
										
											2015-11-28 17:14:45 +01:00
										 |  |  | static void console_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	ED_region_header_init(ar); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-28 17:14:45 +01:00
										 |  |  | static void console_header_region_draw(const bContext *C, ARegion *ar) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	ED_region_header(C, ar); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-02 09:58:01 +10:00
										 |  |  | static void console_main_region_listener( | 
					
						
							|  |  |  |         bScreen *UNUSED(sc), ScrArea *sa, ARegion *ar, | 
					
						
							|  |  |  |         wmNotifier *wmn, const Scene *UNUSED(scene)) | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-26 04:14:10 +00:00
										 |  |  | 	// SpaceInfo *sinfo = sa->spacedata.first;
 | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* context changes */ | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	switch (wmn->category) { | 
					
						
							| 
									
										
											  
											
												2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
  NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
  notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
  should only be used for notifying about changes in space data,
  we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
											
										 
											2009-09-04 20:51:09 +00:00
										 |  |  | 		case NC_SPACE: | 
					
						
							| 
									
										
										
										
											2015-12-18 16:02:31 +11:00
										 |  |  | 		{ | 
					
						
							|  |  |  | 			if (wmn->data == ND_SPACE_CONSOLE) { | 
					
						
							|  |  |  | 				if (wmn->action == NA_EDITED) { | 
					
						
							|  |  |  | 					if ((wmn->reference && sa) && (wmn->reference == sa->spacedata.first)) { | 
					
						
							|  |  |  | 						/* we've modified the geometry (font size), re-calculate rect */ | 
					
						
							|  |  |  | 						console_textview_update_rect(wmn->reference, ar); | 
					
						
							|  |  |  | 						ED_region_tag_redraw(ar); | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				else { | 
					
						
							|  |  |  | 					/* generic redraw request */ | 
					
						
							|  |  |  | 					ED_region_tag_redraw(ar); | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			break; | 
					
						
							| 
									
										
										
										
											2015-12-18 16:02:31 +11:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* only called once, from space/spacetypes.c */ | 
					
						
							|  |  |  | void ED_spacetype_console(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype console"); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	ARegionType *art; | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	st->spaceid = SPACE_CONSOLE; | 
					
						
							| 
									
										
										
										
											2009-12-19 22:37:51 +00:00
										 |  |  | 	strncpy(st->name, "Console", BKE_ST_MAXNAME); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	st->new = console_new; | 
					
						
							|  |  |  | 	st->free = console_free; | 
					
						
							|  |  |  | 	st->init = console_init; | 
					
						
							|  |  |  | 	st->duplicate = console_duplicate; | 
					
						
							|  |  |  | 	st->operatortypes = console_operatortypes; | 
					
						
							|  |  |  | 	st->keymap = console_keymap; | 
					
						
							|  |  |  | 	st->dropboxes = console_dropboxes; | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* regions: main window */ | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	art = MEM_callocN(sizeof(ARegionType), "spacetype console region"); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	art->regionid = RGN_TYPE_WINDOW; | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D; | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-28 17:14:45 +01:00
										 |  |  | 	art->init = console_main_region_init; | 
					
						
							|  |  |  | 	art->draw = console_main_region_draw; | 
					
						
							| 
									
										
										
										
											2014-06-30 18:12:29 +10:00
										 |  |  | 	art->cursor = console_cursor; | 
					
						
							| 
									
										
										
										
											2015-11-28 17:14:45 +01:00
										 |  |  | 	art->listener = console_main_region_listener; | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-07-16 22:47:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-19 22:37:51 +00:00
										 |  |  | 	BLI_addhead(&st->regiontypes, art); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	/* regions: header */ | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	art = MEM_callocN(sizeof(ARegionType), "spacetype console region"); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	art->regionid = RGN_TYPE_HEADER; | 
					
						
							| 
									
										
										
										
											2012-03-28 11:53:18 +00:00
										 |  |  | 	art->prefsizey = HEADERY; | 
					
						
							|  |  |  | 	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER; | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2015-11-28 17:14:45 +01:00
										 |  |  | 	art->init = console_header_region_init; | 
					
						
							|  |  |  | 	art->draw = console_header_region_draw; | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2009-12-19 22:37:51 +00:00
										 |  |  | 	BLI_addhead(&st->regiontypes, art); | 
					
						
							| 
									
										
										
										
											2009-07-16 00:50:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-19 22:37:51 +00:00
										 |  |  | 	BKE_spacetype_register(st); | 
					
						
							| 
									
										
										
										
											2009-07-18 16:27:25 +00:00
										 |  |  | } |