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:
authorCampbell Barton <ideasman42@gmail.com>2010-11-11 16:36:57 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-11 16:36:57 +0300
commit43f396218f5d1a8cb0449cc945eb975ec1d943d7 (patch)
tree5088eb89a601ea8ba4df9867d6b5ef874ad68688 /source/blender/editors
parentc1a74d9bd6b186966568e6455f6fe4c50a3cf17f (diff)
move report/operator view out of the 'Console' into the 'Info' space (file menu).
Ton will work on moving the File menu out of the Info space before release. notes. - reply Operator isn't working anymore. - UI for reports is commented out so its not mixed with the file menu.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/ED_screen.h3
-rw-r--r--source/blender/editors/screen/area.c2
-rw-r--r--source/blender/editors/screen/screen_ops.c11
-rw-r--r--source/blender/editors/space_console/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_console/console_draw.c172
-rw-r--r--source/blender/editors/space_console/console_intern.h17
-rw-r--r--source/blender/editors/space_console/console_ops.c36
-rw-r--r--source/blender/editors/space_console/space_console.c64
-rw-r--r--source/blender/editors/space_info/CMakeLists.txt2
-rw-r--r--source/blender/editors/space_info/info_draw.c192
-rw-r--r--source/blender/editors/space_info/info_intern.h18
-rw-r--r--source/blender/editors/space_info/info_ops.c2
-rw-r--r--source/blender/editors/space_info/info_report.c (renamed from source/blender/editors/space_console/console_report.c)97
-rw-r--r--source/blender/editors/space_info/space_info.c100
14 files changed, 424 insertions, 293 deletions
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index b679ca64a28..07fae14cc06 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -141,6 +141,9 @@ int ED_operator_sequencer_active(struct bContext *C);
int ED_operator_image_active(struct bContext *C);
int ED_operator_nla_active(struct bContext *C);
int ED_operator_logic_active(struct bContext *C);
+int ED_operator_info_active(struct bContext *C);
+int ED_operator_console_active(struct bContext *C);
+
int ED_operator_object_active(struct bContext *C);
int ED_operator_object_active_editable(struct bContext *C);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index e7c6441c077..dcb3762c6f1 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1165,7 +1165,7 @@ static char *editortype_pup(void)
"|%l"
- "|Console %x18"
+ "|Python Console %x18"
);
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 76e37c831d6..d85746d4b3e 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -226,6 +226,17 @@ int ED_operator_logic_active(bContext *C)
return ed_spacetype_test(C, SPACE_LOGIC);
}
+int ED_operator_info_active(bContext *C)
+{
+ return ed_spacetype_test(C, SPACE_INFO);
+}
+
+
+int ED_operator_console_active(bContext *C)
+{
+ return ed_spacetype_test(C, SPACE_CONSOLE);
+}
+
int ED_operator_object_active(bContext *C)
{
Object *ob = ED_object_active_context(C);
diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt
index dbef838db65..83912388bcd 100644
--- a/source/blender/editors/space_console/CMakeLists.txt
+++ b/source/blender/editors/space_console/CMakeLists.txt
@@ -34,7 +34,6 @@ SET(INC
SET(SRC
console_draw.c
console_ops.c
- console_report.c
space_console.c
)
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 5c2ba2cf838..5a9c3249abc 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -73,39 +73,6 @@ static void console_line_color(unsigned char fg[3], int type)
}
}
-static void console_report_color(unsigned char *fg, unsigned char *bg, Report *report, int bool)
-{
- /*
- if (type & RPT_ERROR_ALL) { fg[0]=220; fg[1]=0; fg[2]=0; }
- else if (type & RPT_WARNING_ALL) { fg[0]=220; fg[1]=96; fg[2]=96; }
- else if (type & RPT_OPERATOR_ALL) { fg[0]=96; fg[1]=128; fg[2]=255; }
- else if (type & RPT_INFO_ALL) { fg[0]=0; fg[1]=170; fg[2]=0; }
- else if (type & RPT_DEBUG_ALL) { fg[0]=196; fg[1]=196; fg[2]=196; }
- else { fg[0]=196; fg[1]=196; fg[2]=196; }
- */
- if(report->flag & SELECT) {
- fg[0]=255; fg[1]=255; fg[2]=255;
- if(bool) {
- bg[0]=96; bg[1]=128; bg[2]=255;
- }
- else {
- bg[0]=90; bg[1]=122; bg[2]=249;
- }
- }
-
- else {
- fg[0]=0; fg[1]=0; fg[2]=0;
-
- if(bool) {
- bg[0]=120; bg[1]=120; bg[2]=120;
- }
- else {
- bg[0]=114; bg[1]=114; bg[2]=114;
- }
-
- }
-}
-
typedef struct ConsoleDrawContext {
int cwidth;
int lheight;
@@ -201,131 +168,50 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
}
-
-/* reports! */
-static int report_textview_begin(TextViewContext *tvc)
+static int console_textview_main__internal(struct SpaceConsole *sc, struct ARegion *ar, ReportList *UNUSED(reports), int draw, int mval[2], void **mouse_pick, int *pos_pick)
{
- SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
- ReportList *reports= (ReportList *)tvc->arg2;
-
- tvc->lheight= sc->lheight;
- tvc->sel_start= sc->sel_start;
- tvc->sel_end= sc->sel_end;
-
- /* iterator */
- tvc->iter= reports->list.last;
-
- glClearColor(120.0/255.0, 120.0/255.0, 120.0/255.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
+ ConsoleLine cl_dummy= {0};
+ int ret= 0;
- return (tvc->iter != NULL);
-}
-
-static void report_textview_end(TextViewContext *UNUSED(tvc))
-{
- /* pass */
-}
+ View2D *v2d= &ar->v2d;
-static int report_textview_step(TextViewContext *tvc)
-{
- return ((tvc->iter= (void *)((Link *)tvc->iter)->prev) != NULL);
-}
+ TextViewContext tvc= {0};
+ tvc.begin= console_textview_begin;
+ tvc.end= console_textview_end;
-static int report_textview_line_get(struct TextViewContext *tvc, const char **line, int *len)
-{
- Report *report= (Report *)tvc->iter;
- *line= report->message;
- *len= report->len;
+ tvc.step= console_textview_step;
+ tvc.line_get= console_textview_line_get;
+ tvc.line_color= console_textview_line_color;
- return 1;
-}
+ tvc.arg1= sc;
+ tvc.arg2= NULL;
-static int report_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3])
-{
- Report *report= (Report *)tvc->iter;
- console_report_color(fg, bg, report, tvc->iter_index % 2);
- return TVC_LINE_FG | TVC_LINE_BG;
-}
-
-
-static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports, int draw, int mval[2], void **mouse_pick, int *pos_pick)
-{
- if(sc->type==CONSOLE_TYPE_PYTHON) {
- int ret= 0;
-
- View2D *v2d= &ar->v2d;
-
- TextViewContext tvc= {0};
- tvc.begin= console_textview_begin;
- tvc.end= console_textview_end;
-
- tvc.step= console_textview_step;
- tvc.line_get= console_textview_line_get;
- tvc.line_color= console_textview_line_color;
-
- tvc.arg1= sc;
- tvc.arg2= NULL;
-
- /* view */
- tvc.sel_start= sc->sel_start;
- tvc.sel_end= sc->sel_end;
- tvc.lheight= sc->lheight;
- tvc.ymin= v2d->cur.ymin;
- tvc.ymax= v2d->cur.ymax;
- tvc.winx= ar->winx;
-
- {
- ConsoleLine cl_dummy= {0};
- console_scrollback_prompt_begin(sc, &cl_dummy);
- ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
- console_scrollback_prompt_end(sc, &cl_dummy);
- }
-
- return ret;
- }
- else {
- int ret= 0;
+ /* view */
+ tvc.sel_start= sc->sel_start;
+ tvc.sel_end= sc->sel_end;
+ tvc.lheight= sc->lheight;
+ tvc.ymin= v2d->cur.ymin;
+ tvc.ymax= v2d->cur.ymax;
+ tvc.winx= ar->winx;
- View2D *v2d= &ar->v2d;
+ console_scrollback_prompt_begin(sc, &cl_dummy);
+ ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
+ console_scrollback_prompt_end(sc, &cl_dummy);
- TextViewContext tvc= {0};
- tvc.begin= report_textview_begin;
- tvc.end= report_textview_end;
-
- tvc.step= report_textview_step;
- tvc.line_get= report_textview_line_get;
- tvc.line_color= report_textview_line_color;
-
- tvc.arg1= sc;
- tvc.arg2= reports;
-
- /* view */
- tvc.sel_start= sc->sel_start;
- tvc.sel_end= sc->sel_end;
- tvc.lheight= sc->lheight;
- tvc.ymin= v2d->cur.ymin;
- tvc.ymax= v2d->cur.ymax;
- tvc.winx= ar->winx;
-
- {
- ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
- }
-
- return ret;
- }
+ return ret;
}
-void console_text_main(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
+void console_textview_main(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
{
int mval[2] = {INT_MAX, INT_MAX};
- console_text_main__internal(sc, ar, reports, 1, mval, NULL, NULL);
+ console_textview_main__internal(sc, ar, reports, 1, mval, NULL, NULL);
}
-int console_text_height(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
+int console_textview_height(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports)
{
int mval[2] = {INT_MAX, INT_MAX};
- return console_text_main__internal(sc, ar, reports, 0, mval, NULL, NULL);
+ return console_textview_main__internal(sc, ar, reports, 0, mval, NULL, NULL);
}
void *console_text_pick(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports, int mouse_y)
@@ -336,7 +222,7 @@ void *console_text_pick(struct SpaceConsole *sc, struct ARegion *ar, ReportList
mval[0]= 0;
mval[1]= mouse_y;
- console_text_main__internal(sc, ar, reports, 0, mval, &mouse_pick, NULL);
+ console_textview_main__internal(sc, ar, reports, 0, mval, &mouse_pick, NULL);
return (void *)mouse_pick;
}
@@ -349,6 +235,6 @@ int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, ReportList *r
mval_clamp[0]= CLAMPIS(mval[0], CONSOLE_DRAW_MARGIN, ar->winx-(CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN));
mval_clamp[1]= CLAMPIS(mval[1], CONSOLE_DRAW_MARGIN, ar->winy-CONSOLE_DRAW_MARGIN);
- console_text_main__internal(sc, ar, reports, 0, mval_clamp, &mouse_pick, &pos_pick);
+ console_textview_main__internal(sc, ar, reports, 0, mval_clamp, &mouse_pick, &pos_pick);
return pos_pick;
}
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index 8e6b5dbfcdd..b8d53785d74 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -32,8 +32,8 @@ struct ReportList;
struct bContext;
/* 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 */
+void console_textview_main(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports);
+int console_textview_height(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports); /* needed to calculate the scrollbar */
void *console_text_pick(struct SpaceConsole *sc, struct ARegion *ar, struct ReportList *reports, int mouse_y); /* needed for selection */
int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, ReportList *reports, int mval[2]);
@@ -64,19 +64,6 @@ void CONSOLE_OT_copy(struct wmOperatorType *ot);
void CONSOLE_OT_paste(struct wmOperatorType *ot);
void CONSOLE_OT_select_set(struct wmOperatorType *ot);
-
-
-/* console_report.c */
-void CONSOLE_OT_select_pick(struct wmOperatorType *ot); /* report selection */
-void CONSOLE_OT_select_all_toggle(struct wmOperatorType *ot);
-void CONSOLE_OT_select_border(struct wmOperatorType *ot);
-
-void CONSOLE_OT_report_replay(struct wmOperatorType *ot);
-void CONSOLE_OT_report_delete(struct wmOperatorType *ot);
-void CONSOLE_OT_report_copy(struct wmOperatorType *ot);
-
-
-
enum { LINE_BEGIN, LINE_END, PREV_CHAR, NEXT_CHAR, PREV_WORD, NEXT_WORD };
enum { DEL_ALL, DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_SELECTION, DEL_NEXT_SEL, DEL_PREV_SEL };
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index c5c1f8d1d4c..6aef967b851 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -259,22 +259,6 @@ static int console_line_insert(ConsoleLine *ci, char *str)
return len;
}
-static int console_edit_poll(bContext *C)
-{
- SpaceConsole *sc= CTX_wm_space_console(C);
-
- if(!sc || sc->type != CONSOLE_TYPE_PYTHON)
- return 0;
-
- return 1;
-}
-#if 0
-static int console_poll(bContext *C)
-{
- return (CTX_wm_space_console(C) != NULL);
-}
-#endif
-
/* static funcs for text editing */
/* similar to the text editor, with some not used. keep compatible */
@@ -356,7 +340,7 @@ void CONSOLE_OT_move(wmOperatorType *ot)
/* api callbacks */
ot->exec= move_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to.");
@@ -424,7 +408,7 @@ void CONSOLE_OT_insert(wmOperatorType *ot)
/* api callbacks */
ot->exec= insert_exec;
ot->invoke= insert_invoke;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position.");
@@ -493,7 +477,7 @@ void CONSOLE_OT_delete(wmOperatorType *ot)
/* api callbacks */
ot->exec= delete_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_enum(ot->srna, "type", delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete.");
@@ -534,7 +518,7 @@ void CONSOLE_OT_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec= clear_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_boolean(ot->srna, "scrollback", 1, "Scrollback", "Clear the scrollback history");
@@ -596,7 +580,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot)
/* api callbacks */
ot->exec= history_cycle_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "reverse cycle history");
@@ -644,7 +628,7 @@ void CONSOLE_OT_history_append(wmOperatorType *ot)
/* api callbacks */
ot->exec= history_append_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position.");
@@ -689,7 +673,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
/* api callbacks */
ot->exec= scrollback_append_exec;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
/* properties */
RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position.");
@@ -772,7 +756,7 @@ void CONSOLE_OT_copy(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_copy";
/* api callbacks */
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
ot->exec= copy_exec;
/* properties */
@@ -822,7 +806,7 @@ void CONSOLE_OT_paste(wmOperatorType *ot)
ot->idname= "CONSOLE_OT_paste";
/* api callbacks */
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
ot->exec= paste_exec;
/* properties */
@@ -941,5 +925,5 @@ void CONSOLE_OT_select_set(wmOperatorType *ot)
ot->invoke= console_modal_select_invoke;
ot->modal= console_modal_select;
ot->cancel= console_modal_select_cancel;
- ot->poll= console_edit_poll;
+ ot->poll= ED_operator_console_active;
}
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 66e780f3a04..55fb6a50bb4 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -53,12 +53,12 @@
#include "console_intern.h" // own include
-static void console_update_rect(const bContext *C, ARegion *ar)
+static void console_textview_update_rect(const 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)));
+ UI_view2d_totRect_set(v2d, ar->winx-1, console_textview_height(sc, ar, CTX_wm_reports(C)));
}
/* ******************** default callbacks for console space ***************** */
@@ -72,8 +72,6 @@ static SpaceLink *console_new(const bContext *UNUSED(C))
sconsole->spacetype= SPACE_CONSOLE;
sconsole->lheight= 14;
- sconsole->type= CONSOLE_TYPE_PYTHON;
- sconsole->rpt_mask= CONSOLE_RPT_OP; /* ? - not sure whats a good default here?*/
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for console");
@@ -89,7 +87,7 @@ static SpaceLink *console_new(const bContext *UNUSED(C))
BLI_addtail(&sconsole->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
-
+ /* keep in sync with info */
ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
ar->v2d.align |= V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
ar->v2d.keepofs |= V2D_LOCKOFS_X;
@@ -158,12 +156,11 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
/* ************* dropboxes ************* */
-static int id_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event))
+static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
- if(sc->type==CONSOLE_TYPE_PYTHON)
- if(drag->type==WM_DRAG_ID)
- return 1;
+// SpaceConsole *sc= CTX_wm_space_console(C);
+ if(drag->type==WM_DRAG_ID)
+ return 1;
return 0;
}
@@ -178,12 +175,11 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
RNA_string_set(drop->ptr, "text", text);
}
-static int path_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event))
+static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
- if(sc->type==CONSOLE_TYPE_PYTHON)
- if(drag->type==WM_DRAG_PATH)
- return 1;
+// SpaceConsole *sc= CTX_wm_space_console(C);
+ if(drag->type==WM_DRAG_PATH)
+ return 1;
return 0;
}
@@ -213,14 +209,14 @@ static void console_main_area_draw(const bContext *C, ARegion *ar)
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- if((sc->type==CONSOLE_TYPE_PYTHON) && (sc->scrollback.first==NULL))
+ if(sc->scrollback.first==NULL)
WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL);
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
- console_update_rect(C, ar);
+ console_textview_update_rect(C, ar);
/* worlks best with no view2d matrix set */
UI_view2d_view_ortho(v2d);
@@ -228,7 +224,7 @@ static void console_main_area_draw(const bContext *C, ARegion *ar)
/* data... */
console_history_verify(C); /* make sure we have some command line */
- console_text_main(sc, ar, CTX_wm_reports(C));
+ console_textview_main(sc, ar, CTX_wm_reports(C));
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -255,15 +251,6 @@ void console_operatortypes(void)
WM_operatortype_append(CONSOLE_OT_copy);
WM_operatortype_append(CONSOLE_OT_paste);
WM_operatortype_append(CONSOLE_OT_select_set);
-
- /* console_report.c */
- WM_operatortype_append(CONSOLE_OT_select_pick);
- WM_operatortype_append(CONSOLE_OT_select_all_toggle);
- WM_operatortype_append(CONSOLE_OT_select_border);
-
- WM_operatortype_append(CONSOLE_OT_report_replay);
- WM_operatortype_append(CONSOLE_OT_report_delete);
- WM_operatortype_append(CONSOLE_OT_report_copy);
}
void console_keymap(struct wmKeyConfig *keyconf)
@@ -331,16 +318,6 @@ void console_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CONSOLE_OT_autocomplete", SPACEKEY, KM_PRESS, KM_CTRL, 0); /* python operator - space_text.py */
#endif
- /* report selection */
- WM_keymap_add_item(keymap, "CONSOLE_OT_select_pick", SELECTMOUSE, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CONSOLE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CONSOLE_OT_select_border", BKEY, KM_PRESS, 0, 0);
-
- WM_keymap_add_item(keymap, "CONSOLE_OT_report_replay", RKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CONSOLE_OT_report_delete", XKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CONSOLE_OT_report_delete", DELKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CONSOLE_OT_report_copy", CKEY, KM_PRESS, KM_CTRL, 0);
-
WM_keymap_add_item(keymap, "CONSOLE_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "CONSOLE_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
#ifdef __APPLE__
@@ -367,19 +344,15 @@ static void console_header_area_draw(const bContext *C, ARegion *ar)
ED_region_header(C, ar);
}
-static void console_main_area_listener(ScrArea *sa, wmNotifier *wmn)
+static void console_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
- SpaceConsole *sc= sa->spacedata.first;
+ // SpaceInfo *sinfo= sa->spacedata.first;
/* context changes */
switch(wmn->category) {
case NC_SPACE:
if(wmn->data == ND_SPACE_CONSOLE) { /* generic redraw request */
- ED_area_tag_redraw(sa);
- }
- else if(wmn->data == ND_SPACE_CONSOLE_REPORT && sc->type==CONSOLE_TYPE_REPORT) {
- /* redraw also but only for report view, could do less redraws by checking the type */
- ED_area_tag_redraw(sa);
+ ED_region_tag_redraw(ar);
}
break;
}
@@ -401,7 +374,6 @@ void ED_spacetype_console(void)
st->operatortypes= console_operatortypes;
st->keymap= console_keymap;
st->dropboxes= console_dropboxes;
- st->listener= console_main_area_listener;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype console region");
@@ -410,7 +382,7 @@ void ED_spacetype_console(void)
art->init= console_main_area_init;
art->draw= console_main_area_draw;
-
+ art->listener= console_main_area_listener;
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index ff65efeead0..47bbfec5fe5 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -34,6 +34,8 @@ SET(INC
SET(SRC
info_ops.c
info_stats.c
+ info_draw.c
+ info_report.c
textview.c
space_info.c
)
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
new file mode 100644
index 00000000000..e11c50eda9e
--- /dev/null
+++ b/source/blender/editors/space_info/info_draw.c
@@ -0,0 +1,192 @@
+/**
+ * $Id: info_ops.c 32551 2010-10-18 06:41:16Z campbellbarton $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2010 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <limits.h>
+
+
+#include "BLF_api.h"
+
+#include "BLI_blenlib.h"
+
+#include "DNA_space_types.h"
+#include "DNA_screen_types.h"
+
+// #include "BKE_suggestions.h"
+#include "BKE_report.h"
+#include "BKE_utildefines.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "ED_datafiles.h"
+#include "ED_types.h"
+
+#include "UI_resources.h"
+
+#include "../space_info/textview.h"
+
+static void info_report_color(unsigned char *fg, unsigned char *bg, Report *report, int bool)
+{
+ /*
+ if (type & RPT_ERROR_ALL) { fg[0]=220; fg[1]=0; fg[2]=0; }
+ else if (type & RPT_WARNING_ALL) { fg[0]=220; fg[1]=96; fg[2]=96; }
+ else if (type & RPT_OPERATOR_ALL) { fg[0]=96; fg[1]=128; fg[2]=255; }
+ else if (type & RPT_INFO_ALL) { fg[0]=0; fg[1]=170; fg[2]=0; }
+ else if (type & RPT_DEBUG_ALL) { fg[0]=196; fg[1]=196; fg[2]=196; }
+ else { fg[0]=196; fg[1]=196; fg[2]=196; }
+ */
+ if(report->flag & SELECT) {
+ fg[0]=255; fg[1]=255; fg[2]=255;
+ if(bool) {
+ bg[0]=96; bg[1]=128; bg[2]=255;
+ }
+ else {
+ bg[0]=90; bg[1]=122; bg[2]=249;
+ }
+ }
+
+ else {
+ fg[0]=0; fg[1]=0; fg[2]=0;
+
+ if(bool) {
+ bg[0]=120; bg[1]=120; bg[2]=120;
+ }
+ else {
+ bg[0]=114; bg[1]=114; bg[2]=114;
+ }
+
+ }
+}
+
+
+/* reports! */
+static int report_textview_begin(TextViewContext *tvc)
+{
+ // SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
+ ReportList *reports= (ReportList *)tvc->arg2;
+
+ tvc->lheight= 14; //sc->lheight;
+ tvc->sel_start= 0;
+ tvc->sel_end= 0;
+
+ /* iterator */
+ tvc->iter= reports->list.last;
+
+ glClearColor(120.0/255.0, 120.0/255.0, 120.0/255.0, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ return (tvc->iter != NULL);
+}
+
+static void report_textview_end(TextViewContext *UNUSED(tvc))
+{
+ /* pass */
+}
+
+static int report_textview_step(TextViewContext *tvc)
+{
+ return ((tvc->iter= (void *)((Link *)tvc->iter)->prev) != NULL);
+}
+
+static int report_textview_line_get(struct TextViewContext *tvc, const char **line, int *len)
+{
+ Report *report= (Report *)tvc->iter;
+ *line= report->message;
+ *len= report->len;
+
+ return 1;
+}
+
+static int report_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3])
+{
+ Report *report= (Report *)tvc->iter;
+ info_report_color(fg, bg, report, tvc->iter_index % 2);
+ return TVC_LINE_FG | TVC_LINE_BG;
+}
+
+
+static int info_textview_main__internal(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports, int draw, int mval[2], void **mouse_pick, int *pos_pick)
+{
+ int ret= 0;
+
+ View2D *v2d= &ar->v2d;
+
+ TextViewContext tvc= {0};
+ tvc.begin= report_textview_begin;
+ tvc.end= report_textview_end;
+
+ tvc.step= report_textview_step;
+ tvc.line_get= report_textview_line_get;
+ tvc.line_color= report_textview_line_color;
+
+ tvc.arg1= sinfo;
+ tvc.arg2= reports;
+
+ /* view */
+ tvc.sel_start= 0;
+ tvc.sel_end= 0;
+ tvc.lheight= 14; //sc->lheight;
+ tvc.ymin= v2d->cur.ymin;
+ tvc.ymax= v2d->cur.ymax;
+ tvc.winx= ar->winx;
+
+ ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
+
+ return ret;
+}
+
+void *info_text_pick(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports, int mouse_y)
+{
+ void *mouse_pick= NULL;
+ int mval[2];
+
+ mval[0]= 0;
+ mval[1]= mouse_y;
+
+ info_textview_main__internal(sinfo, ar, reports, 0, mval, &mouse_pick, NULL);
+ return (void *)mouse_pick;
+}
+
+
+int info_textview_height(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports)
+{
+ int mval[2] = {INT_MAX, INT_MAX};
+ return info_textview_main__internal(sinfo, ar, reports, 0, mval, NULL, NULL);
+}
+
+void info_textview_main(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports)
+{
+ int mval[2] = {INT_MAX, INT_MAX};
+ info_textview_main__internal(sinfo, ar, reports, 1, mval, NULL, NULL);
+}
diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h
index 4053bbf5a1f..4953bc1b4be 100644
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.h
@@ -30,7 +30,9 @@
/* internal exports only */
+struct SpaceInfo;
struct wmOperatorType;
+struct ReportList;
void FILE_OT_pack_all(struct wmOperatorType *ot);
void FILE_OT_unpack_all(struct wmOperatorType *ot);
@@ -41,5 +43,19 @@ void FILE_OT_find_missing_files(struct wmOperatorType *ot);
void INFO_OT_reports_display_update(struct wmOperatorType *ot);
-#endif /* ED_INFO_INTERN_H */
+/* info_draw.c */
+void *info_text_pick(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports, int mouse_y);
+int info_textview_height(struct SpaceInfo *sinfo, struct ARegion *ar, struct ReportList *reports);
+void info_textview_main(struct SpaceInfo *sinfo, struct ARegion *ar, struct ReportList *reports);
+
+/* info_report.c */
+/* console_report.c */
+void INFO_OT_select_pick(struct wmOperatorType *ot); /* report selection */
+void INFO_OT_select_all_toggle(struct wmOperatorType *ot);
+void INFO_OT_select_border(struct wmOperatorType *ot);
+void INFO_OT_report_replay(struct wmOperatorType *ot);
+void INFO_OT_report_delete(struct wmOperatorType *ot);
+void INFO_OT_report_copy(struct wmOperatorType *ot);
+
+#endif /* ED_INFO_INTERN_H */
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index aeb32cda6bd..3ed4f07d150 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -395,3 +395,5 @@ void INFO_OT_reports_display_update(wmOperatorType *ot)
/* properties */
}
+
+/* report operators */
diff --git a/source/blender/editors/space_console/console_report.c b/source/blender/editors/space_info/info_report.c
index a714952eaaf..0fc8e157d92 100644
--- a/source/blender/editors/space_console/console_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "MEM_guardedalloc.h"
@@ -42,38 +43,30 @@
#include "RNA_access.h"
#include "RNA_define.h"
-#include "console_intern.h"
+#include "info_intern.h"
-int console_report_mask(SpaceConsole *sc)
+int info_report_mask(SpaceInfo *sinfo)
{
int report_mask = 0;
- if(sc->rpt_mask & CONSOLE_RPT_DEBUG) report_mask |= RPT_DEBUG_ALL;
- if(sc->rpt_mask & CONSOLE_RPT_INFO) report_mask |= RPT_INFO_ALL;
- if(sc->rpt_mask & CONSOLE_RPT_OP) report_mask |= RPT_OPERATOR_ALL;
- if(sc->rpt_mask & CONSOLE_RPT_WARN) report_mask |= RPT_WARNING_ALL;
- if(sc->rpt_mask & CONSOLE_RPT_ERR) report_mask |= RPT_ERROR_ALL;
+ if(sinfo->rpt_mask & INFO_RPT_DEBUG) report_mask |= RPT_DEBUG_ALL;
+ if(sinfo->rpt_mask & INFO_RPT_INFO) report_mask |= RPT_INFO_ALL;
+ if(sinfo->rpt_mask & INFO_RPT_OP) report_mask |= RPT_OPERATOR_ALL;
+ if(sinfo->rpt_mask & INFO_RPT_WARN) report_mask |= RPT_WARNING_ALL;
+ if(sinfo->rpt_mask & INFO_RPT_ERR) report_mask |= RPT_ERROR_ALL;
return report_mask;
}
-static int console_report_poll(bContext *C)
-{
- SpaceConsole *sc= CTX_wm_space_console(C);
-
- if(!sc || sc->type != CONSOLE_TYPE_REPORT)
- return 0;
-
- return 1;
-}
-
+// TODO, get this working again!
static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
- ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
- Report *report;
+// SpaceInfo *sc= CTX_wm_space_info(C);
+// ReportList *reports= CTX_wm_reports(C);
+// int report_mask= info_report_mask(sc);
+// Report *report;
+#if 0
sc->type= CONSOLE_TYPE_PYTHON;
for(report=reports->list.last; report; report=report->prev) {
@@ -86,21 +79,21 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
}
sc->type= CONSOLE_TYPE_REPORT;
-
+#endif
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
-void CONSOLE_OT_report_replay(wmOperatorType *ot)
+void INFO_OT_report_replay(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Replay Operators";
ot->description= "Replay selected reports";
- ot->idname= "CONSOLE_OT_report_replay";
+ ot->idname= "INFO_OT_report_replay";
/* api callbacks */
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
ot->exec= report_replay_exec;
/* flags */
@@ -126,12 +119,12 @@ static int select_report_pick_exec(bContext *C, wmOperator *op)
static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceConsole *sc= CTX_wm_space_console(C);
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
ARegion *ar= CTX_wm_region(C);
ReportList *reports= CTX_wm_reports(C);
Report *report;
- report= console_text_pick(sc, ar, reports, event->mval[1]);
+ report= info_text_pick(sinfo, ar, reports, event->mval[1]);
RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report));
@@ -139,15 +132,15 @@ static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
}
-void CONSOLE_OT_select_pick(wmOperatorType *ot)
+void INFO_OT_select_pick(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select report";
ot->description= "Select reports by index";
- ot->idname= "CONSOLE_OT_select_pick";
+ ot->idname= "INFO_OT_select_pick";
/* api callbacks */
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
ot->invoke= select_report_pick_invoke;
ot->exec= select_report_pick_exec;
@@ -162,9 +155,9 @@ void CONSOLE_OT_select_pick(wmOperatorType *ot)
static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
+ int report_mask= info_report_mask(sinfo);
int deselect= 0;
Report *report;
@@ -193,15 +186,15 @@ static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void CONSOLE_OT_select_all_toggle(wmOperatorType *ot)
+void INFO_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name= "(De)Select All";
ot->description= "(de)select all reports";
- ot->idname= "CONSOLE_OT_select_all_toggle";
+ ot->idname= "INFO_OT_select_all_toggle";
/* api callbacks */
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
ot->exec= report_select_all_toggle_exec;
/* flags */
@@ -213,10 +206,10 @@ void CONSOLE_OT_select_all_toggle(wmOperatorType *ot)
/* borderselect operator */
static int borderselect_exec(bContext *C, wmOperator *op)
{
- SpaceConsole *sc= CTX_wm_space_console(C);
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
ARegion *ar= CTX_wm_region(C);
ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
+ int report_mask= info_report_mask(sinfo);
Report *report_min, *report_max, *report;
//View2D *v2d= UI_view2d_fromcontext(C);
@@ -241,8 +234,8 @@ static int borderselect_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
*/
- report_min= console_text_pick(sc, ar, reports, rect.ymax);
- report_max= console_text_pick(sc, ar, reports, rect.ymin);
+ report_min= info_text_pick(sinfo, ar, reports, rect.ymax);
+ report_max= info_text_pick(sinfo, ar, reports, rect.ymin);
/* get the first report if none found */
if(report_min==NULL) {
@@ -286,19 +279,19 @@ static int borderselect_exec(bContext *C, wmOperator *op)
/* ****** Border Select ****** */
-void CONSOLE_OT_select_border(wmOperatorType *ot)
+void INFO_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Border Select";
ot->description= "Toggle border selection";
- ot->idname= "CONSOLE_OT_select_border";
+ ot->idname= "INFO_OT_select_border";
/* api callbacks */
ot->invoke= WM_border_select_invoke;
ot->exec= borderselect_exec;
ot->modal= WM_border_select_modal;
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
/* flags */
/* ot->flag= OPTYPE_REGISTER; */
@@ -311,9 +304,9 @@ void CONSOLE_OT_select_border(wmOperatorType *ot)
static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
+ int report_mask= info_report_mask(sinfo);
Report *report, *report_next;
@@ -336,15 +329,15 @@ static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void CONSOLE_OT_report_delete(wmOperatorType *ot)
+void INFO_OT_report_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Delete Reports";
ot->description= "Delete selected reports";
- ot->idname= "CONSOLE_OT_report_delete";
+ ot->idname= "INFO_OT_report_delete";
/* api callbacks */
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
ot->exec= report_delete_exec;
/* flags */
@@ -356,9 +349,9 @@ void CONSOLE_OT_report_delete(wmOperatorType *ot)
static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceConsole *sc= CTX_wm_space_console(C);
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
+ int report_mask= info_report_mask(sinfo);
Report *report;
@@ -381,15 +374,15 @@ static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void CONSOLE_OT_report_copy(wmOperatorType *ot)
+void INFO_OT_report_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Copy Reports to Clipboard";
ot->description= "Copy selected reports to Clipboard";
- ot->idname= "CONSOLE_OT_report_copy";
+ ot->idname= "INFO_OT_report_copy";
/* api callbacks */
- ot->poll= console_report_poll;
+ ot->poll= ED_operator_info_active;
ot->exec= report_copy_exec;
/* flags */
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 5173621d9c1..95c1614ffd5 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -49,6 +49,7 @@
#include "UI_resources.h"
#include "UI_interface.h"
+#include "UI_view2d.h"
#include "info_intern.h" // own include
@@ -62,7 +63,9 @@ static SpaceLink *info_new(const bContext *UNUSED(C))
sinfo= MEM_callocN(sizeof(SpaceInfo), "initinfo");
sinfo->spacetype= SPACE_INFO;
-
+
+ sinfo->rpt_mask= INFO_RPT_OP;
+
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for info");
@@ -76,6 +79,17 @@ static SpaceLink *info_new(const bContext *UNUSED(C))
BLI_addtail(&sinfo->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
+ /* keep in sync with console */
+ ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ 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_LIMITZOOM|V2D_KEEPASPECT);
+ 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_LIMITZOOM);
+
return (SpaceLink *)sinfo;
}
@@ -105,16 +119,54 @@ static SpaceLink *info_duplicate(SpaceLink *sl)
/* add handlers, stuff you only do once or on area/region changes */
-static void info_main_area_init(wmWindowManager *UNUSED(wm), ARegion *UNUSED(ar))
+static void info_main_area_init(wmWindowManager *wm, ARegion *ar)
{
+ wmKeyMap *keymap;
+
+ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+
+ /* own keymap */
+ keymap= WM_keymap_find(wm->defaultconf, "Info", SPACE_INFO, 0);
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
}
-static void info_main_area_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar))
+static void info_textview_update_rect(const bContext *C, ARegion *ar)
{
-
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
+ View2D *v2d= &ar->v2d;
+
+ UI_view2d_totRect_set(v2d, ar->winx-1, info_textview_height(sinfo, ar, CTX_wm_reports(C)));
+}
+
+static void info_main_area_draw(const bContext *C, ARegion *ar)
+{
+ /* draw entirely, view changes should be handled here */
+ SpaceInfo *sinfo= CTX_wm_space_info(C);
+ View2D *v2d= &ar->v2d;
+ View2DScrollers *scrollers;
+
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
+
+ /* quick way to avoid drawing if not bug enough */
+ if(ar->winy < 16)
+ return;
+
+ info_textview_update_rect(C, ar);
+
+ /* worlks best with no view2d matrix set */
+ UI_view2d_view_ortho(v2d);
+
+ info_textview_main(sinfo, ar, CTX_wm_reports(C));
+
+ /* reset view matrix */
+ UI_view2d_view_restore(C);
+
+ /* scrollers */
+ 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 info_operatortypes(void)
@@ -125,8 +177,16 @@ void info_operatortypes(void)
WM_operatortype_append(FILE_OT_make_paths_absolute);
WM_operatortype_append(FILE_OT_report_missing_files);
WM_operatortype_append(FILE_OT_find_missing_files);
-
WM_operatortype_append(INFO_OT_reports_display_update);
+
+ /* info_report.c */
+ WM_operatortype_append(INFO_OT_select_pick);
+ WM_operatortype_append(INFO_OT_select_all_toggle);
+ WM_operatortype_append(INFO_OT_select_border);
+
+ WM_operatortype_append(INFO_OT_report_replay);
+ WM_operatortype_append(INFO_OT_report_delete);
+ WM_operatortype_append(INFO_OT_report_copy);
}
void info_keymap(struct wmKeyConfig *keyconf)
@@ -134,6 +194,20 @@ void info_keymap(struct wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_keymap_find(keyconf, "Window", 0, 0);
WM_keymap_verify_item(keymap, "INFO_OT_reports_display_update", TIMER, KM_ANY, KM_ANY, 0);
+
+ /* info space */
+ keymap= WM_keymap_find(keyconf, "Info", SPACE_INFO, 0);
+
+
+ /* report selection */
+ WM_keymap_add_item(keymap, "INFO_OT_select_pick", SELECTMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "INFO_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "INFO_OT_select_border", BKEY, KM_PRESS, 0, 0);
+
+ WM_keymap_add_item(keymap, "INFO_OT_report_replay", RKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "INFO_OT_report_delete", XKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "INFO_OT_report_delete", DELKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "INFO_OT_report_copy", CKEY, KM_PRESS, KM_CTRL, 0);
}
/* add handlers, stuff you only do once or on area/region changes */
@@ -147,9 +221,19 @@ static void info_header_area_draw(const bContext *C, ARegion *ar)
ED_region_header(C, ar);
}
-static void info_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
+static void info_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
+ // SpaceInfo *sinfo= sa->spacedata.first;
+
/* context changes */
+ switch(wmn->category) {
+ case NC_SPACE:
+ if(wmn->data == ND_SPACE_INFO_REPORT) {
+ /* redraw also but only for report view, could do less redraws by checking the type */
+ ED_region_tag_redraw(ar);
+ }
+ break;
+ }
}
static void info_header_listener(ARegion *ar, wmNotifier *wmn)
@@ -223,10 +307,11 @@ void ED_spacetype_info(void)
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype info region");
art->regionid = RGN_TYPE_WINDOW;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+
art->init= info_main_area_init;
art->draw= info_main_area_draw;
art->listener= info_main_area_listener;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
BLI_addhead(&st->regiontypes, art);
@@ -246,4 +331,3 @@ void ED_spacetype_info(void)
BKE_spacetype_register(st);
}
-