2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-07-16 00:50:27 +00:00
|
|
|
* 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
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-07-16 00:50:27 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
*/
|
2011-02-27 20:29:51 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup spconsole
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
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 "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
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_framebuffer.h"
|
2009-07-16 00:50:27 +00:00
|
|
|
|
|
|
|
/* ******************** default callbacks for console space ***************** */
|
|
|
|
|
2018-04-21 19:30:56 +02:00
|
|
|
static SpaceLink *console_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
|
2009-07-16 00:50:27 +00:00
|
|
|
{
|
|
|
|
ARegion *ar;
|
|
|
|
SpaceConsole *sconsole;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
sconsole = MEM_callocN(sizeof(SpaceConsole), "initconsole");
|
|
|
|
sconsole->spacetype = SPACE_CONSOLE;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-28 11:53:18 +00:00
|
|
|
sconsole->lheight = 14;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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;
|
2018-12-14 09:47:10 +11:00
|
|
|
ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
/* main region */
|
|
|
|
ar = MEM_callocN(sizeof(ARegion), "main region for text");
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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;
|
2018-06-04 09:31:30 +02: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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
while (sc->scrollback.first) {
|
2009-07-16 00:50:27 +00:00
|
|
|
console_scrollback_free(sc, sc->scrollback.first);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
while (sc->history.first) {
|
2009-07-16 00:50:27 +00:00
|
|
|
console_history_free(sc, sc->history.first);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2009-07-16 00:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
/* clear or remove stuff from old */
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
/* 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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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 */
|
2018-08-31 13:36:14 +10:00
|
|
|
keymap = WM_keymap_ensure(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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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 ************* */
|
|
|
|
|
2018-08-07 10:38:20 +02:00
|
|
|
static bool id_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
|
2010-05-08 07:25:26 +00:00
|
|
|
{
|
2018-08-07 10:57:09 +02:00
|
|
|
return WM_drag_ID(drag, 0) != NULL;
|
2010-05-08 07:25:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
|
|
|
|
{
|
2018-08-07 10:57:09 +02:00
|
|
|
ID *id = WM_drag_ID(drag, 0);
|
2010-05-08 07:25:26 +00:00
|
|
|
|
|
|
|
/* copy drag path to properties */
|
2018-08-07 10:57:09 +02:00
|
|
|
char *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
|
|
|
}
|
|
|
|
|
2018-08-07 10:38:20 +02:00
|
|
|
static bool path_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip))
|
2010-05-08 07:25:26 +00:00
|
|
|
{
|
2018-08-07 10:57:09 +02:00
|
|
|
return (drag->type == WM_DRAG_PATH);
|
2010-05-08 07:25:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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
|
|
|
|
2019-03-26 21:16:47 +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);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2009-11-05 11:17:09 +00:00
|
|
|
|
2009-07-16 22:47:27 +00:00
|
|
|
/* clear and setup matrix */
|
2010-04-06 07:02:16 +00:00
|
|
|
UI_ThemeClearColor(TH_BACK);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_clear(GPU_COLOR_BIT);
|
2009-07-16 22:47:27 +00:00
|
|
|
|
|
|
|
/* 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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
/* reset view matrix */
|
2009-07-16 22:47:27 +00:00
|
|
|
UI_view2d_view_restore(C);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
/* scrollers */
|
2018-10-22 16:41:18 +11:00
|
|
|
scrollers = UI_view2d_scrollers_calc(C, v2d, NULL, 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);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2009-07-16 00:50:27 +00:00
|
|
|
/* for use by python only */
|
2018-06-04 09:31:30 +02:00
|
|
|
WM_operatortype_append(CONSOLE_OT_history_append);
|
2009-07-16 00:50:27 +00:00
|
|
|
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
|
|
|
{
|
2018-11-08 15:59:51 +11:00
|
|
|
WM_keymap_ensure(keyconf, "Console", SPACE_CONSOLE, 0);
|
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(
|
2018-07-04 15:14:57 +02:00
|
|
|
wmWindow *UNUSED(win), ScrArea *sa, ARegion *ar,
|
2017-05-02 09:58:01 +10:00
|
|
|
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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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);
|
2018-06-04 09:31:30 +02: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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
|
|
|
|
2009-07-16 22:47:27 +00:00
|
|
|
|
2009-12-19 22:37:51 +00:00
|
|
|
BLI_addhead(&st->regiontypes, art);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
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;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2015-11-28 17:14:45 +01:00
|
|
|
art->init = console_header_region_init;
|
|
|
|
art->draw = console_header_region_draw;
|
2018-06-04 09:31:30 +02: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
|
|
|
}
|