diff options
Diffstat (limited to 'source/blender/editors/space_console/space_console.c')
-rw-r--r-- | source/blender/editors/space_console/space_console.c | 64 |
1 files changed, 18 insertions, 46 deletions
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; |