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/space_console
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/space_console')
-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/console_report.c399
-rw-r--r--source/blender/editors/space_console/space_console.c64
6 files changed, 59 insertions, 630 deletions
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/console_report.c b/source/blender/editors/space_console/console_report.c
deleted file mode 100644
index a714952eaaf..00000000000
--- a/source/blender/editors/space_console/console_report.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/**
- * $Id$
- *
- * ***** 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.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-
-#include "BLI_blenlib.h"
-#include "BLI_dynstr.h"
-
-#include "BKE_context.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "ED_screen.h"
-#include "ED_types.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "console_intern.h"
-
-int console_report_mask(SpaceConsole *sc)
-{
- 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;
-
- 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;
-}
-
-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;
-
- sc->type= CONSOLE_TYPE_PYTHON;
-
- for(report=reports->list.last; report; report=report->prev) {
- if((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) {
- console_history_add_str(sc, report->message, 0);
- WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL);
-
- ED_area_tag_redraw(CTX_wm_area(C));
- }
- }
-
- sc->type= CONSOLE_TYPE_REPORT;
-
- ED_area_tag_redraw(CTX_wm_area(C));
-
- return OPERATOR_FINISHED;
-}
-
-void CONSOLE_OT_report_replay(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Replay Operators";
- ot->description= "Replay selected reports";
- ot->idname= "CONSOLE_OT_report_replay";
-
- /* api callbacks */
- ot->poll= console_report_poll;
- ot->exec= report_replay_exec;
-
- /* flags */
- /* ot->flag= OPTYPE_REGISTER; */
-
- /* properties */
-}
-
-static int select_report_pick_exec(bContext *C, wmOperator *op)
-{
- int report_index= RNA_int_get(op->ptr, "report_index");
- Report *report= BLI_findlink(&CTX_wm_reports(C)->list, report_index);
-
- if(!report)
- return OPERATOR_CANCELLED;
-
- report->flag ^= SELECT; /* toggle */
-
- ED_area_tag_redraw(CTX_wm_area(C));
-
- return OPERATOR_FINISHED;
-}
-
-static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- SpaceConsole *sc= CTX_wm_space_console(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]);
-
- RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report));
-
- return select_report_pick_exec(C, op);
-}
-
-
-void CONSOLE_OT_select_pick(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Select report";
- ot->description= "Select reports by index";
- ot->idname= "CONSOLE_OT_select_pick";
-
- /* api callbacks */
- ot->poll= console_report_poll;
- ot->invoke= select_report_pick_invoke;
- ot->exec= select_report_pick_exec;
-
- /* flags */
- /* ot->flag= OPTYPE_REGISTER; */
-
- /* properties */
- RNA_def_int(ot->srna, "report_index", 0, 0, INT_MAX, "Report", "The index of the report.", 0, INT_MAX);
-}
-
-
-
-static int report_select_all_toggle_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);
- int deselect= 0;
-
- Report *report;
-
- for(report=reports->list.last; report; report=report->prev) {
- if((report->type & report_mask) && (report->flag & SELECT)) {
- deselect= 1;
- break;
- }
- }
-
-
- if(deselect) {
- for(report=reports->list.last; report; report=report->prev)
- if(report->type & report_mask)
- report->flag &= ~SELECT;
- }
- else {
- for(report=reports->list.last; report; report=report->prev)
- if(report->type & report_mask)
- report->flag |= SELECT;
- }
-
- ED_area_tag_redraw(CTX_wm_area(C));
-
- return OPERATOR_FINISHED;
-}
-
-void CONSOLE_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";
-
- /* api callbacks */
- ot->poll= console_report_poll;
- ot->exec= report_select_all_toggle_exec;
-
- /* flags */
- /*ot->flag= OPTYPE_REGISTER;*/
-
- /* properties */
-}
-
-/* borderselect operator */
-static int borderselect_exec(bContext *C, wmOperator *op)
-{
- SpaceConsole *sc= CTX_wm_space_console(C);
- ARegion *ar= CTX_wm_region(C);
- ReportList *reports= CTX_wm_reports(C);
- int report_mask= console_report_mask(sc);
- Report *report_min, *report_max, *report;
-
- //View2D *v2d= UI_view2d_fromcontext(C);
-
-
- rcti rect;
- //rctf rectf, rq;
- short selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
- //short mval[2];
-
- rect.xmin= RNA_int_get(op->ptr, "xmin");
- rect.ymin= RNA_int_get(op->ptr, "ymin");
- rect.xmax= RNA_int_get(op->ptr, "xmax");
- rect.ymax= RNA_int_get(op->ptr, "ymax");
-
- /*
- mval[0]= rect.xmin;
- mval[1]= rect.ymin;
- UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmin, &rectf.ymin);
- mval[0]= rect.xmax;
- mval[1]= rect.ymax;
- 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);
-
- /* get the first report if none found */
- if(report_min==NULL) {
- // printf("find_min\n");
- for(report=reports->list.first; report; report=report->next) {
- if(report->type & report_mask) {
- report_min= report;
- break;
- }
- }
- }
-
- if(report_max==NULL) {
- // printf("find_max\n");
- for(report=reports->list.last; report; report=report->prev) {
- if(report->type & report_mask) {
- report_max= report;
- break;
- }
- }
- }
-
- if(report_min==NULL || report_max==NULL)
- return OPERATOR_CANCELLED;
-
- for(report= report_min; (report != report_max->next); report= report->next) {
-
- if((report->type & report_mask)==0)
- continue;
-
- if(selecting)
- report->flag |= SELECT;
- else
- report->flag &= ~SELECT;
- }
-
- ED_area_tag_redraw(CTX_wm_area(C));
-
- return OPERATOR_FINISHED;
-}
-
-
-/* ****** Border Select ****** */
-void CONSOLE_OT_select_border(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Border Select";
- ot->description= "Toggle border selection";
- ot->idname= "CONSOLE_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;
-
- /* flags */
- /* ot->flag= OPTYPE_REGISTER; */
-
- /* rna */
- WM_operator_properties_gesture_border(ot, FALSE);
-}
-
-
-
-static int report_delete_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, *report_next;
-
- for(report=reports->list.first; report; ) {
-
- report_next=report->next;
-
- if((report->type & report_mask) && (report->flag & SELECT)) {
- BLI_remlink(&reports->list, report);
- MEM_freeN(report->message);
- MEM_freeN(report);
- }
-
- report= report_next;
- }
-
- ED_area_tag_redraw(CTX_wm_area(C));
-
- return OPERATOR_FINISHED;
-}
-
-void CONSOLE_OT_report_delete(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Delete Reports";
- ot->description= "Delete selected reports";
- ot->idname= "CONSOLE_OT_report_delete";
-
- /* api callbacks */
- ot->poll= console_report_poll;
- ot->exec= report_delete_exec;
-
- /* flags */
- /*ot->flag= OPTYPE_REGISTER;*/
-
- /* properties */
-}
-
-
-static int report_copy_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;
-
- DynStr *buf_dyn= BLI_dynstr_new();
- char *buf_str;
-
- for(report=reports->list.first; report; report= report->next) {
- if((report->type & report_mask) && (report->flag & SELECT)) {
- BLI_dynstr_append(buf_dyn, report->message);
- BLI_dynstr_append(buf_dyn, "\n");
- }
- }
-
- buf_str= BLI_dynstr_get_cstring(buf_dyn);
- BLI_dynstr_free(buf_dyn);
-
- WM_clipboard_text_set(buf_str, 0);
-
- MEM_freeN(buf_str);
- return OPERATOR_FINISHED;
-}
-
-void CONSOLE_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";
-
- /* api callbacks */
- ot->poll= console_report_poll;
- ot->exec= report_copy_exec;
-
- /* flags */
- /*ot->flag= OPTYPE_REGISTER;*/
-
- /* properties */
-}
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;