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:
-rw-r--r--release/ui/space_console.py8
-rw-r--r--source/blender/blenkernel/BKE_report.h38
-rw-r--r--source/blender/blenkernel/intern/context.c2
-rw-r--r--source/blender/blenkernel/intern/report.c6
-rw-r--r--source/blender/blenloader/intern/readfile.c3
-rw-r--r--source/blender/editors/interface/view2d_ops.c16
-rw-r--r--source/blender/editors/space_console/console_draw.c121
-rw-r--r--source/blender/editors/space_console/console_intern.h1
-rw-r--r--source/blender/editors/space_console/console_ops.c6
-rw-r--r--source/blender/editors/space_console/space_console.c70
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h41
-rw-r--r--source/blender/windowmanager/intern/wm.c2
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c8
14 files changed, 201 insertions, 123 deletions
diff --git a/release/ui/space_console.py b/release/ui/space_console.py
index 6548a2249b2..7d8ea3018c4 100644
--- a/release/ui/space_console.py
+++ b/release/ui/space_console.py
@@ -50,7 +50,7 @@ def get_console(console_id):
console_id can be any hashable type
'''
- import sys, code, io
+ import sys, code
try: consoles = get_console.consoles
except:consoles = get_console.consoles = {}
@@ -72,9 +72,11 @@ def get_console(console_id):
console = code.InteractiveConsole(namespace)
if sys.version.startswith('2'):
- stdout = io.BytesIO() # Py2x support
- stderr = io.BytesIO()
+ import cStringIO
+ stdout = cStringIO.BytesIO() # Py2x support
+ stderr = cStringIO.BytesIO()
else:
+ import io
stdout = io.StringIO()
stderr = io.StringIO()
diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h
index 26853866ebb..1d72b1c81f0 100644
--- a/source/blender/blenkernel/BKE_report.h
+++ b/source/blender/blenkernel/BKE_report.h
@@ -32,48 +32,14 @@
extern "C" {
#endif
-#include "DNA_listBase.h"
+#include "DNA_windowmanager_types.h"
/* Reporting Information and Errors
*
* These functions also accept NULL in case no error reporting
* is needed. */
-typedef enum ReportType {
- RPT_DEBUG = 1<<0,
- RPT_INFO = 1<<1,
- RPT_OPERATOR = 1<<2,
- RPT_WARNING = 1<<3,
- RPT_ERROR = 1<<4,
- RPT_ERROR_INVALID_INPUT = 1<<5,
- RPT_ERROR_INVALID_CONTEXT = 1<<6,
- RPT_ERROR_OUT_OF_MEMORY = 1<<7
-} ReportType;
-
-#define RPT_DEBUG_ALL (RPT_DEBUG)
-#define RPT_INFO_ALL (RPT_INFO)
-#define RPT_OPERATOR_ALL (RPT_OPERATOR)
-#define RPT_WARNING_ALL (RPT_WARNING)
-#define RPT_ERROR_ALL (RPT_ERROR|RPT_ERROR_INVALID_INPUT|RPT_ERROR_INVALID_CONTEXT|RPT_ERROR_OUT_OF_MEMORY)
-
-enum ReportListFlags {
- RPT_PRINT = 1,
- RPT_STORE = 2,
-};
-
-typedef struct Report {
- struct Report *next, *prev;
- ReportType type;
- char *typestr;
- char *message;
-} Report;
-
-typedef struct ReportList {
- ListBase list;
- ReportType printlevel;
- ReportType storelevel;
- int flag;
-} ReportList;
+/* report structures are stored in DNA */
void BKE_reports_init(ReportList *reports, int flag);
void BKE_reports_clear(ReportList *reports);
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index bbf3ceb01e8..4bfc1484e56 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -206,7 +206,7 @@ struct ARegion *CTX_wm_menu(const bContext *C)
struct ReportList *CTX_wm_reports(const bContext *C)
{
- return C->wm.manager->reports;
+ return &(C->wm.manager->reports);
}
View3D *CTX_wm_view3d(const bContext *C)
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index 6564329ef82..3e3dd4b0af0 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -102,7 +102,7 @@ void BKE_report(ReportList *reports, ReportType type, const char *message)
len= strlen(message);
report->message= MEM_callocN(sizeof(char)*(len+1), "ReportMessage");
memcpy(report->message, message, sizeof(char)*(len+1));
-
+ report->len= len;
BLI_addtail(&reports->list, report);
}
}
@@ -129,7 +129,7 @@ void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
va_end(args);
report->message= BLI_dynstr_get_cstring(ds);
-
+ report->len= BLI_dynstr_get_len(ds);
BLI_dynstr_free(ds);
report->type= type;
@@ -155,6 +155,7 @@ void BKE_reports_prepend(ReportList *reports, const char *prepend)
MEM_freeN(report->message);
report->message= BLI_dynstr_get_cstring(ds);
+ report->len= BLI_dynstr_get_len(ds);
BLI_dynstr_free(ds);
}
@@ -179,6 +180,7 @@ void BKE_reports_prependf(ReportList *reports, const char *prepend, ...)
MEM_freeN(report->message);
report->message= BLI_dynstr_get_cstring(ds);
+ report->len= BLI_dynstr_get_len(ds);
BLI_dynstr_free(ds);
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 1d7ba88136f..fbe7a07c7be 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4221,7 +4221,8 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
wm->keymaps.first= wm->keymaps.last= NULL;
wm->paintcursors.first= wm->paintcursors.last= NULL;
wm->queue.first= wm->queue.last= NULL;
- wm->reports= NULL;
+ BKE_reports_init(&wm->reports, RPT_STORE);
+
wm->jobs.first= wm->jobs.last= NULL;
wm->windrawable= NULL;
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index c6688aea5c5..f0745ebfd71 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -257,7 +257,7 @@ void VIEW2D_OT_pan(wmOperatorType *ot)
ot->modal= view_pan_modal;
/* operator is repeatable */
- ot->flag= OPTYPE_REGISTER|OPTYPE_BLOCKING;
+ ot->flag= OPTYPE_BLOCKING;
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -303,7 +303,7 @@ void VIEW2D_OT_scroll_right(wmOperatorType *ot)
ot->exec= view_scrollright_exec;
/* operator is repeatable */
- ot->flag= OPTYPE_REGISTER;
+ // ot->flag= OPTYPE_REGISTER;
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -349,7 +349,7 @@ void VIEW2D_OT_scroll_left(wmOperatorType *ot)
ot->exec= view_scrollleft_exec;
/* operator is repeatable */
- ot->flag= OPTYPE_REGISTER;
+ // ot->flag= OPTYPE_REGISTER;
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -394,7 +394,7 @@ void VIEW2D_OT_scroll_down(wmOperatorType *ot)
ot->exec= view_scrolldown_exec;
/* operator is repeatable */
- ot->flag= OPTYPE_REGISTER;
+ // ot->flag= OPTYPE_REGISTER;
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -440,7 +440,7 @@ void VIEW2D_OT_scroll_up(wmOperatorType *ot)
ot->exec= view_scrollup_exec;
/* operator is repeatable */
- ot->flag= OPTYPE_REGISTER;
+ // ot->flag= OPTYPE_REGISTER;
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -550,7 +550,7 @@ void VIEW2D_OT_zoom_in(wmOperatorType *ot)
ot->exec= view_zoomin_exec;
/* operator is repeatable */
- ot->flag= OPTYPE_REGISTER;
+ // ot->flag= OPTYPE_REGISTER;
/* rna - must keep these in sync with the other operators */
RNA_def_float(ot->srna, "zoomfacx", 0, -FLT_MAX, FLT_MAX, "Zoom Factor X", "", -FLT_MAX, FLT_MAX);
@@ -586,7 +586,7 @@ void VIEW2D_OT_zoom_out(wmOperatorType *ot)
ot->exec= view_zoomout_exec;
/* operator is repeatable */
- ot->flag= OPTYPE_REGISTER;
+ // ot->flag= OPTYPE_REGISTER;
/* rna - must keep these in sync with the other operators */
RNA_def_float(ot->srna, "zoomfacx", 0, -FLT_MAX, FLT_MAX, "Zoom Factor X", "", -FLT_MAX, FLT_MAX);
@@ -832,7 +832,7 @@ void VIEW2D_OT_zoom(wmOperatorType *ot)
ot->modal= view_zoomdrag_modal;
/* operator is repeatable */
- ot->flag= OPTYPE_REGISTER|OPTYPE_BLOCKING;
+ // ot->flag= OPTYPE_REGISTER|OPTYPE_BLOCKING;
/* rna - must keep these in sync with the other operators */
RNA_def_float(ot->srna, "deltax", 0, -FLT_MAX, FLT_MAX, "Delta X", "", -FLT_MAX, FLT_MAX);
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 0a725d0c69f..96641fd8fbd 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -68,7 +68,7 @@ static void console_font_begin(SpaceConsole *sc)
BLF_set(mono);
BLF_aspect(1.0);
- BLF_size(sc->lheight, 72);
+ BLF_size(sc->lheight-2, 72);
}
static void console_line_color(unsigned char *fg, int type)
@@ -106,12 +106,24 @@ static void console_report_color(unsigned char *fg, int type)
/* return 0 if the last line is off the screen
* should be able to use this for any string type */
-static int console_draw_string(char *str, int str_len, int console_width, int lheight, unsigned char *fg, unsigned char *bg, int winx, int winy, int *x, int *y)
+static int console_draw_string( char *str, int str_len,
+ int console_width, int lheight,
+ unsigned char *fg, unsigned char *bg,
+ int winx, int winy,
+ int *x, int *y, int draw)
{
int rct_ofs= lheight/4;
+ int tot_lines = (str_len/console_width)+1; /* total number of lines for wrapping */
+
+ /* just advance the height */
+ if(draw==0) {
+ if(str_len > console_width) (*y) += tot_lines * lheight;
+ else (*y) += lheight;
+
+ return 1;
+ }
if(str_len > console_width) { /* wrap? */
- int tot_lines = (str_len/console_width)+1; /* total number of lines for wrapping */
char *line_stride= str + ((tot_lines-1) * console_width); /* advance to the last line and draw it first */
char eol; /* baclup the end of wrapping */
@@ -160,11 +172,13 @@ static int console_draw_string(char *str, int str_len, int console_width, int lh
return 1;
}
-#define CONSOLE_DRAW_MARGIN 8
-#define CONSOLE_LINE_MARGIN 6
+#define CONSOLE_DRAW_MARGIN 4
+#define CONSOLE_DRAW_SCROLL 16
-void console_text_main(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
+static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports, int draw)
{
+ View2D *v2d= &ar->v2d;
+
ConsoleLine *cl= sc->history.last;
int x_orig=CONSOLE_DRAW_MARGIN, y_orig=CONSOLE_DRAW_MARGIN;
@@ -176,41 +190,54 @@ void console_text_main(struct SpaceConsole *sc, struct ARegion *ar, ReportList *
console_font_begin(sc);
cwidth = BLF_fixed_width();
- console_width= (ar->winx - CONSOLE_DRAW_MARGIN*2)/cwidth;
+ console_width= (ar->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN*2) )/cwidth;
if (console_width < 8) console_width= 8;
x= x_orig; y= y_orig;
if(sc->type==CONSOLE_TYPE_PYTHON) {
- int prompt_len= strlen(sc->prompt);
+ int prompt_len;
/* text */
- console_line_color(fg, CONSOLE_LINE_INPUT);
- glColor3ub(fg[0], fg[1], fg[2]);
-
- /* command line */
- if(prompt_len) {
- BLF_position(x, y, 0); x += cwidth * prompt_len;
- BLF_draw(sc->prompt);
+ if(draw) {
+ prompt_len= strlen(sc->prompt);
+ console_line_color(fg, CONSOLE_LINE_INPUT);
+ glColor3ub(fg[0], fg[1], fg[2]);
+
+ /* command line */
+ if(prompt_len) {
+ BLF_position(x, y, 0); x += cwidth * prompt_len;
+ BLF_draw(sc->prompt);
+ }
+ BLF_position(x, y, 0);
+ BLF_draw(cl->line);
+
+ /* cursor */
+ console_line_color(fg, CONSOLE_LINE_ERROR); /* lazy */
+ glColor3ub(fg[0], fg[1], fg[2]);
+ glRecti(x+(cwidth*cl->cursor) -1, y-2, x+(cwidth*cl->cursor) +1, y+sc->lheight-2);
+
+ x= x_orig; /* remove prompt offset */
}
- BLF_position(x, y, 0);
- BLF_draw(cl->line);
-
- /* cursor */
- console_line_color(fg, CONSOLE_LINE_ERROR); /* lazy */
- glColor3ub(fg[0], fg[1], fg[2]);
- glRecti(x+(cwidth*cl->cursor) -1, y-2, x+(cwidth*cl->cursor) +1, y+sc->lheight-2);
-
- x= x_orig; /* remove prompt offset */
y += sc->lheight;
for(cl= sc->scrollback.last; cl; cl= cl->prev) {
- console_line_color(fg, cl->type);
- if(!console_draw_string(cl->line, cl->len, console_width, sc->lheight+CONSOLE_LINE_MARGIN, fg, NULL, ar->winx, ar->winy, &x, &y))
- break; /* past the y limits */
-
+ if(draw)
+ console_line_color(fg, cl->type);
+
+ if(!console_draw_string( cl->line, cl->len,
+ console_width, sc->lheight,
+ fg, NULL,
+ ar->winx-CONSOLE_DRAW_MARGIN, v2d->cur.ymax,
+ &x, &y, draw))
+ {
+ /* when drawing, if we pass v2d->cur.ymax, then quit */
+ if(draw) {
+ break; /* past the y limits */
+ }
+ }
}
}
else {
@@ -219,8 +246,10 @@ void console_text_main(struct SpaceConsole *sc, struct ARegion *ar, ReportList *
int bool= 0;
unsigned char bg[3] = {114, 114, 114};
- glClearColor(120.0/255.0, 120.0/255.0, 120.0/255.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
+ if(draw) {
+ glClearColor(120.0/255.0, 120.0/255.0, 120.0/255.0, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
/* convert our display toggles into a flag compatible with BKE_report flags */
if(sc->rpt_mask & CONSOLE_RPT_DEBUG) report_mask |= RPT_DEBUG_ALL;
@@ -232,15 +261,39 @@ void console_text_main(struct SpaceConsole *sc, struct ARegion *ar, ReportList *
for(report=reports->list.last; report; report=report->prev) {
if(report->type & report_mask) {
- console_report_color(fg, report->type);
- if(!console_draw_string(report->message, strlen(report->message), console_width, sc->lheight+CONSOLE_LINE_MARGIN, fg, bool?bg:NULL, ar->winx, ar->winy, &x, &y))
- break; /* past the y limits */
- y+=CONSOLE_LINE_MARGIN;
+ if(draw)
+ console_report_color(fg, report->type);
+
+ if(!console_draw_string( report->message, report->len,
+ console_width, sc->lheight,
+ fg, bool?bg:NULL,
+ ar->winx-CONSOLE_DRAW_MARGIN, v2d->cur.ymax,
+ &x, &y, draw))
+ {
+ /* when drawing, if we pass v2d->cur.ymax, then quit */
+ if(draw) {
+ break; /* past the y limits */
+ }
+ }
+
bool = !(bool);
}
}
}
+ y += sc->lheight*2;
+
+ return y-y_orig;
+}
+
+void console_text_main(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
+{
+ console_text_main__internal(sc, ar, reports, 1);
+}
+
+int console_text_height(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
+{
+ return console_text_main__internal(sc, ar, reports, 0);
}
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index 55474844d87..2e5af9c5ffd 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -39,6 +39,7 @@ struct ReportList;
/* console_draw.c */
void console_text_main(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports);
+int console_text_height(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports); /* needed to calculate the scrollbar */
/* console_ops.c */
void console_history_free(SpaceConsole *sc, ConsoleLine *cl);
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index d2cd4df6426..c82463eb768 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -287,8 +287,10 @@ static int insert_exec(const bContext *C, wmOperator *op)
static int insert_invoke(const bContext *C, wmOperator *op, wmEvent *event)
{
- char str[2] = {event->ascii, '\0'};
- RNA_string_set(op->ptr, "text", str);
+ if(!RNA_property_is_set(op->ptr, "text")) {
+ char str[2] = {event->ascii, '\0'};
+ RNA_string_set(op->ptr, "text", str);
+ }
return insert_exec(C, op);
}
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index ee80fe3d2d9..f5bccbce3f5 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -60,6 +60,13 @@
#include "console_intern.h" // own include
+static void console_update_rect(bContext *C, ARegion *ar)
+{
+ SpaceConsole *sc= CTX_wm_space_console(C);
+ View2D *v2d= &ar->v2d;
+
+ UI_view2d_totRect_set(v2d, ar->winx-1, console_text_height(sc, ar, CTX_wm_reports(C)));
+}
/* ******************** default callbacks for console space ***************** */
@@ -89,12 +96,17 @@ static SpaceLink *console_new(const bContext *C)
BLI_addtail(&sconsole->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM_O);
- ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
+
+ ar->v2d.scroll |= (V2D_SCROLL_LEFT);
+ ar->v2d.align |= V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+ ar->v2d.keepofs |= V2D_LOCKOFS_X;
ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPZOOM|V2D_KEEPASPECT);
- ar->v2d.keeptot= V2D_KEEPTOT_STRICT;
+ ar->v2d.keeptot= V2D_KEEPTOT_BOUNDS;
ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
-
+
+ /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
+ //ar->v2d.keepzoom= (V2D_KEEPASPECT|V2D_KEEPZOOM);
+
return (SpaceLink *)sconsole;
}
@@ -136,9 +148,9 @@ static SpaceLink *console_duplicate(SpaceLink *sl)
static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
{
ListBase *keymap;
-
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
-
+
+ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+
/* own keymap */
keymap= WM_keymap_listbase(wm, "Console", SPACE_CONSOLE, 0); /* XXX weak? */
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
@@ -148,21 +160,10 @@ static void console_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
SpaceConsole *sc= CTX_wm_space_console(C);
- //View2D *v2d= &ar->v2d;
+ View2D *v2d= &ar->v2d;
+ View2DScrollers *scrollers;
//float col[3];
- /* clear and setup matrix */
- //UI_GetThemeColor3fv(TH_BACK, col);
- //glClearColor(col[0], col[1], col[2], 0.0);
- glClearColor(0, 0, 0, 1.0);
-
- glClear(GL_COLOR_BUFFER_BIT);
-
- /* worlks best with no view2d matrix set */
- /*UI_view2d_view_ortho(C, v2d);*/
-
- /* data... */
-
/* add helper text, why not? */
if(sc->scrollback.first==NULL) {
console_scrollback_add_str(C, " * Python Interactive Console *", 0);
@@ -170,23 +171,34 @@ static void console_main_area_draw(const bContext *C, ARegion *ar)
console_scrollback_add_str(C, "Cursor: Left/Right Home/End", 0);
console_scrollback_add_str(C, "Remove: Backspace/Delete", 0);
console_scrollback_add_str(C, "Execute: Enter", 0);
- console_scrollback_add_str(C, "Autocomplete: Tab", 0);
+ console_scrollback_add_str(C, "Autocomplete: Ctrl+Enter", 0);
console_scrollback_add_str(C, "Ctrl +/- Wheel: Zoom", 0);
console_scrollback_add_str(C, "Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.ui", 0);
}
+ /* clear and setup matrix */
+ //UI_GetThemeColor3fv(TH_BACK, col);
+ //glClearColor(col[0], col[1], col[2], 0.0);
+ glClearColor(0, 0, 0, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ console_update_rect(C, ar);
+
+ /* worlks best with no view2d matrix set */
+ UI_view2d_view_ortho(C, v2d);
+
+ /* data... */
+
console_history_verify(C); /* make sure we have some command line */
console_text_main(sc, ar, CTX_wm_reports(C));
/* reset view matrix */
- /* UI_view2d_view_restore(C); */
+ UI_view2d_view_restore(C);
/* scrollers */
- /*
- scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+ scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_GRID_CLAMP);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
- */
}
void console_operatortypes(void)
@@ -255,8 +267,11 @@ void console_keymap(struct wmWindowManager *wm)
#ifndef DISABLE_PYTHON
WM_keymap_add_item(keymap, "CONSOLE_OT_exec", RETKEY, KM_PRESS, 0, 0); /* python operator - space_text.py */
- WM_keymap_add_item(keymap, "CONSOLE_OT_autocomplete", TABKEY, KM_PRESS, 0, 0); /* python operator - space_text.py */
+ //WM_keymap_add_item(keymap, "CONSOLE_OT_autocomplete", TABKEY, KM_PRESS, 0, 0); /* python operator - space_text.py */
+ WM_keymap_add_item(keymap, "CONSOLE_OT_autocomplete", RETKEY, KM_PRESS, KM_CTRL, 0); /* python operator - space_text.py */
#endif
+
+ RNA_string_set(WM_keymap_add_item(keymap, "CONSOLE_OT_insert", TABKEY, KM_PRESS, 0, 0)->ptr, "text", " "); /* fake tabs */
WM_keymap_add_item(keymap, "CONSOLE_OT_insert", KM_TEXTINPUT, KM_PRESS, KM_ANY, 0); // last!
}
@@ -310,11 +325,14 @@ void ED_spacetype_console(void)
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype console region");
art->regionid = RGN_TYPE_WINDOW;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+
art->init= console_main_area_init;
art->draw= console_main_area_draw;
+
BLI_addhead(&sc->regiontypes, art);
/* regions: header */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index ca50d8494c0..61931085707 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -511,7 +511,7 @@ typedef struct SpaceConsole {
int type; /* console/report/..? */
int rpt_mask; /* which reports to display */
int flag, lheight;
-
+
ListBase scrollback; /* ConsoleLine; output */
ListBase history; /* ConsoleLine; command history, current edited line is the first */
char prompt[8];
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 9a60e3c92b8..69ab45d3389 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -52,6 +52,44 @@ struct wmTimer;
struct StructRNA;
struct PointerRNA;
struct ReportList;
+struct Report;
+
+typedef enum ReportType {
+ RPT_DEBUG = 1<<0,
+ RPT_INFO = 1<<1,
+ RPT_OPERATOR = 1<<2,
+ RPT_WARNING = 1<<3,
+ RPT_ERROR = 1<<4,
+ RPT_ERROR_INVALID_INPUT = 1<<5,
+ RPT_ERROR_INVALID_CONTEXT = 1<<6,
+ RPT_ERROR_OUT_OF_MEMORY = 1<<7
+} ReportType;
+
+#define RPT_DEBUG_ALL (RPT_DEBUG)
+#define RPT_INFO_ALL (RPT_INFO)
+#define RPT_OPERATOR_ALL (RPT_OPERATOR)
+#define RPT_WARNING_ALL (RPT_WARNING)
+#define RPT_ERROR_ALL (RPT_ERROR|RPT_ERROR_INVALID_INPUT|RPT_ERROR_INVALID_CONTEXT|RPT_ERROR_OUT_OF_MEMORY)
+
+enum ReportListFlags {
+ RPT_PRINT = 1,
+ RPT_STORE = 2,
+};
+typedef struct Report {
+ struct Report *next, *prev;
+ int type; /* ReportType */
+ int len; /* strlen(message), saves some time calculating the word wrap */
+ char *typestr;
+ char *message;
+} Report;
+typedef struct ReportList {
+ ListBase list;
+ int printlevel; /* ReportType */
+ int storelevel; /* ReportType */
+ int flag, pad;
+} ReportList;
+/* reports need to be before wmWindowManager */
+
/* windowmanager is saved, tag WMAN */
typedef struct wmWindowManager {
@@ -68,7 +106,7 @@ typedef struct wmWindowManager {
ListBase queue; /* refresh/redraw wmNotifier structs */
- struct ReportList *reports; /* information and error reports */
+ struct ReportList reports; /* information and error reports */
ListBase jobs; /* threaded jobs manager */
@@ -258,6 +296,5 @@ typedef enum wmRadialControlMode {
WM_RADIALCONTROL_ANGLE
} wmRadialControlMode;
-
#endif /* DNA_WINDOWMANAGER_TYPES_H */
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 6b3b128d34b..94200925a02 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -98,7 +98,7 @@ void wm_operator_register(bContext *C, wmOperator *op)
/* Report the string representation of the operator */
buf = WM_operator_pystring(op);
- BKE_report(wm->reports, RPT_OPERATOR, buf);
+ BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf);
MEM_freeN(buf);
/* so the console is redrawn */
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 5938677afe7..4c9c3059e5b 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -104,15 +104,11 @@ static void sound_init_listener(void)
static void wm_init_reports(bContext *C)
{
- wmWindowManager *wm= CTX_wm_manager(C);
- wm->reports= MEM_callocN(sizeof(ReportList), "wmReportList");
- BKE_reports_init(wm->reports, RPT_STORE);
+ BKE_reports_init(CTX_wm_reports(C), RPT_STORE);
}
static void wm_free_reports(bContext *C)
{
- wmWindowManager *wm= CTX_wm_manager(C);
- BKE_reports_clear(wm->reports);
- MEM_freeN(wm->reports);
+ BKE_reports_clear(CTX_wm_reports(C));
}