diff options
Diffstat (limited to 'source/blender/editors/space_info')
-rw-r--r-- | source/blender/editors/space_info/SConscript | 28 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_draw.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_ops.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_report.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_info/space_info.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_info/textview.c | 36 | ||||
-rw-r--r-- | source/blender/editors/space_info/textview.h | 2 |
7 files changed, 65 insertions, 28 deletions
diff --git a/source/blender/editors/space_info/SConscript b/source/blender/editors/space_info/SConscript index e4746aefa0c..bacc28161d3 100644 --- a/source/blender/editors/space_info/SConscript +++ b/source/blender/editors/space_info/SConscript @@ -1,4 +1,30 @@ -#!/usr/bin/python +#!/usr/bin/env python +# +# ***** 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) 2006, Blender Foundation +# All rights reserved. +# +# The Original Code is: all of this file. +# +# Contributor(s): Nathan Letwory. +# +# ***** END GPL LICENSE BLOCK ***** + Import ('env') sources = env.Glob('*.c') diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index 5830c4574df..54afc9a0849 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -56,6 +56,8 @@ #include "ED_types.h" #include "UI_resources.h" +#include "UI_interface.h" +#include "UI_view2d.h" #include "info_intern.h" #include "../space_info/textview.h" @@ -139,7 +141,7 @@ static int report_textview_begin(TextViewContext *tvc) // SpaceConsole *sc = (SpaceConsole *)tvc->arg1; ReportList *reports = (ReportList *)tvc->arg2; - tvc->lheight = 14; //sc->lheight; + tvc->lheight = 14 * UI_DPI_FAC; //sc->lheight; tvc->sel_start = 0; tvc->sel_end = 0; @@ -269,10 +271,10 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo, ARegion *ar, Re /* view */ tvc.sel_start = 0; tvc.sel_end = 0; - tvc.lheight = 14; //sc->lheight; + tvc.lheight = 14 * UI_DPI_FAC; //sc->lheight; tvc.ymin = v2d->cur.ymin; tvc.ymax = v2d->cur.ymax; - tvc.winx = ar->winx; + tvc.winx = ar->winx - V2D_SCROLL_WIDTH; ret = textview_draw(&tvc, draw, mval, mouse_pick, pos_pick); diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 48b5eaf7b44..e902a4ea6f4 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -40,7 +40,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_bpath.h" +#include "BKE_bpath.h" #include "BLI_utildefines.h" #include "BKE_context.h" @@ -204,7 +204,7 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BLI_bpath_relative_convert(bmain, bmain->name, op->reports); + BKE_bpath_relative_convert(bmain, bmain->name, op->reports); /* redraw everything so any changed paths register */ WM_main_add_notifier(NC_WINDOW, NULL); @@ -237,7 +237,7 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BLI_bpath_absolute_convert(bmain, bmain->name, op->reports); + BKE_bpath_absolute_convert(bmain, bmain->name, op->reports); /* redraw everything so any changed paths register */ WM_main_add_notifier(NC_WINDOW, NULL); @@ -266,7 +266,7 @@ static int report_missing_files_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); /* run the missing file check */ - BLI_bpath_missing_files_check(bmain, op->reports); + BKE_bpath_missing_files_check(bmain, op->reports); return OPERATOR_FINISHED; } @@ -291,7 +291,7 @@ static int find_missing_files_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); const char *searchpath = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0); - BLI_bpath_missing_files_find(bmain, searchpath, op->reports); + BKE_bpath_missing_files_find(bmain, searchpath, op->reports); MEM_freeN((void *)searchpath); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 049a50f89fc..023ffa50272 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -62,7 +62,7 @@ int info_report_mask(SpaceInfo *UNUSED(sinfo)) return report_mask; #endif - return RPT_DEBUG_ALL | RPT_INFO_ALL | RPT_OPERATOR_ALL | RPT_WARNING_ALL | RPT_ERROR_ALL; + return RPT_DEBUG_ALL | RPT_INFO_ALL | RPT_OPERATOR_ALL | RPT_PROPERTY_ALL | RPT_WARNING_ALL | RPT_ERROR_ALL; } // TODO, get this working again! @@ -77,7 +77,10 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op)) 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)) { + if ((report->type & report_mask) && + (report->type & RPT_OPERATOR_ALL | RPT_PROPERTY_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); diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index cba0a808d63..db9be22eedb 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -272,7 +272,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn) static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) { struct RecentFile *recent; - char file [FILE_MAX]; + char file[FILE_MAX]; uiLayout *layout = menu->layout; uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN); if (G.recent_files.first) { diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index f454b1dbe7d..e5f8d6553ed 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -45,7 +45,8 @@ static void console_font_begin(TextViewContext *sc) { - BLF_size(blf_mono_font, sc->lheight - 2, 72); + /* 0.875 is based on: 16 pixels lines get 14 pixel text */ + BLF_size(blf_mono_font, 0.875 * sc->lheight, 72); } typedef struct ConsoleDrawContext { @@ -61,7 +62,13 @@ typedef struct ConsoleDrawContext { int draw; } ConsoleDrawContext; -static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight) +BLI_INLINE void console_step_sel(ConsoleDrawContext *cdc, const int step) +{ + cdc->sel[0] += step; + cdc->sel[1] += step; +} + +static void console_draw_sel(const int sel[2], const int xy[2], const int str_len_draw, int cwidth, int lheight) { if (sel[0] <= str_len_draw && sel[1] >= 0) { int sta = max_ii(sel[0], 0); @@ -84,9 +91,9 @@ static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth /* 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(ConsoleDrawContext *cdc, const char *str, int str_len, unsigned char *fg, unsigned char *bg) +static int console_draw_string(ConsoleDrawContext *cdc, const char *str, const int str_len, + const unsigned char *fg, const unsigned char *bg) { -#define STEP_SEL(value) cdc->sel[0] += (value); cdc->sel[1] += (value) int rct_ofs = cdc->lheight / 4; int tot_lines = (str_len / cdc->console_width) + 1; /* total number of lines for wrapping */ int y_next = (str_len > cdc->console_width) ? cdc->xy[1] + cdc->lheight * tot_lines : cdc->xy[1] + cdc->lheight; @@ -120,7 +127,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str /* adjust selection even if not drawing */ if (cdc->sel[0] != cdc->sel[1]) { - STEP_SEL(-(str_len + 1)); + console_step_sel(cdc, -(str_len + 1)); } return 1; @@ -149,10 +156,10 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str BLF_draw(mono, line_stride, str_len - initial_offset); if (cdc->sel[0] != cdc->sel[1]) { - STEP_SEL(-initial_offset); + console_step_sel(cdc, -initial_offset); // glColor4ub(255, 0, 0, 96); // debug console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight); - STEP_SEL(cdc->console_width); + console_step_sel(cdc, cdc->console_width); glColor3ubv(fg); } @@ -167,7 +174,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (cdc->sel[0] != cdc->sel[1]) { // glColor4ub(0, 255, 0, 96); // debug console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight); - STEP_SEL(cdc->console_width); + console_step_sel(cdc, cdc->console_width); glColor3ubv(fg); } @@ -179,7 +186,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str } copy_v2_v2_int(cdc->sel, sel_orig); - STEP_SEL(-(str_len + 1)); + console_step_sel(cdc, -(str_len + 1)); } else { /* simple, no wrap */ @@ -201,7 +208,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str // glColor4ub(255, 255, 0, 96); // debug console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight); - STEP_SEL(-(str_len + 1)); + console_step_sel(cdc, -(str_len + 1)); } cdc->xy[1] += cdc->lheight; @@ -211,13 +218,11 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str } return 1; -#undef STEP_SEL } #define CONSOLE_DRAW_MARGIN 4 -#define CONSOLE_DRAW_SCROLL 16 -int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick, int *pos_pick) +int textview_draw(TextViewContext *tvc, const int draw, int mval[2], void **mouse_pick, int *pos_pick) { ConsoleDrawContext cdc = {0}; @@ -241,9 +246,10 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick cdc.cwidth = (int)BLF_fixed_width(mono); assert(cdc.cwidth > 0); cdc.lheight = tvc->lheight; - cdc.console_width = (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN * 2) ) / cdc.cwidth; + /* note, scroll bar must be already subtracted () */ + cdc.console_width = (tvc->winx - (CONSOLE_DRAW_MARGIN * 2) ) / cdc.cwidth; CLAMP(cdc.console_width, 1, INT_MAX); /* avoid divide by zero on small windows */ - cdc.winx = tvc->winx - (CONSOLE_DRAW_MARGIN + CONSOLE_DRAW_SCROLL); + cdc.winx = tvc->winx - CONSOLE_DRAW_MARGIN; cdc.ymin = tvc->ymin; cdc.ymax = tvc->ymax; cdc.xy = xy; diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h index 33fbe556245..d0fab880dc3 100644 --- a/source/blender/editors/space_info/textview.h +++ b/source/blender/editors/space_info/textview.h @@ -54,7 +54,7 @@ typedef struct TextViewContext { } TextViewContext; -int textview_draw(struct TextViewContext *tvc, int draw, int mval[2], void **mouse_pick, int *pos_pick); +int textview_draw(struct TextViewContext *tvc, const int draw, int mval[2], void **mouse_pick, int *pos_pick); #define TVC_LINE_FG (1<<0) #define TVC_LINE_BG (1<<1) |