Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_spreadsheet/spreadsheet_draw.cc
| Show All 21 Lines | |||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "DNA_userdef_types.h" | #include "DNA_userdef_types.h" | ||||
| #include "BLI_rect.h" | #include "BLI_rect.h" | ||||
| #include "spreadsheet_draw.hh" | #include "spreadsheet_draw.hh" | ||||
| #define CELL_RIGHT_PADDING (2.0f * UI_DPI_FAC) | |||||
| namespace blender::ed::spreadsheet { | namespace blender::ed::spreadsheet { | ||||
| SpreadsheetDrawer::SpreadsheetDrawer() | SpreadsheetDrawer::SpreadsheetDrawer() | ||||
| { | { | ||||
| left_column_width = UI_UNIT_X * 2; | left_column_width = UI_UNIT_X * 2; | ||||
| top_row_height = UI_UNIT_Y * 1.1f; | top_row_height = UI_UNIT_Y * 1.1f; | ||||
| row_height = UI_UNIT_Y; | row_height = UI_UNIT_Y; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | for (const int row_index : IndexRange(first_row, max_visible_rows)) { | ||||
| if (row_index >= drawer.tot_rows) { | if (row_index >= drawer.tot_rows) { | ||||
| break; | break; | ||||
| } | } | ||||
| CellDrawParams params; | CellDrawParams params; | ||||
| params.block = left_column_block; | params.block = left_column_block; | ||||
| params.xmin = 0; | params.xmin = 0; | ||||
| params.ymin = region->winy - drawer.top_row_height - (row_index + 1) * drawer.row_height - | params.ymin = region->winy - drawer.top_row_height - (row_index + 1) * drawer.row_height - | ||||
| scroll_offset_y; | scroll_offset_y; | ||||
| params.width = drawer.left_column_width; | params.width = drawer.left_column_width - CELL_RIGHT_PADDING; | ||||
| params.height = drawer.row_height; | params.height = drawer.row_height; | ||||
| drawer.draw_left_column_cell(row_index, params); | drawer.draw_left_column_cell(row_index, params); | ||||
| } | } | ||||
| UI_block_end(C, left_column_block); | UI_block_end(C, left_column_block); | ||||
| UI_block_draw(C, left_column_block); | UI_block_draw(C, left_column_block); | ||||
| GPU_scissor(UNPACK4(old_scissor)); | GPU_scissor(UNPACK4(old_scissor)); | ||||
| Show All 18 Lines | static void draw_top_row_content(const bContext *C, | ||||
| for (const int column_index : IndexRange(drawer.tot_columns)) { | for (const int column_index : IndexRange(drawer.tot_columns)) { | ||||
| const int column_width = drawer.column_width(column_index); | const int column_width = drawer.column_width(column_index); | ||||
| const int right_x = left_x + column_width; | const int right_x = left_x + column_width; | ||||
| CellDrawParams params; | CellDrawParams params; | ||||
| params.block = first_row_block; | params.block = first_row_block; | ||||
| params.xmin = left_x; | params.xmin = left_x; | ||||
| params.ymin = region->winy - drawer.top_row_height; | params.ymin = region->winy - drawer.top_row_height; | ||||
| params.width = column_width; | params.width = column_width - CELL_RIGHT_PADDING; | ||||
| params.height = drawer.top_row_height; | params.height = drawer.top_row_height; | ||||
| drawer.draw_top_row_cell(column_index, params); | drawer.draw_top_row_cell(column_index, params); | ||||
| left_x = right_x; | left_x = right_x; | ||||
| } | } | ||||
| UI_block_end(C, first_row_block); | UI_block_end(C, first_row_block); | ||||
| UI_block_draw(C, first_row_block); | UI_block_draw(C, first_row_block); | ||||
| Show All 31 Lines | if (right_x >= drawer.left_column_width && left_x <= region->winx) { | ||||
| break; | break; | ||||
| } | } | ||||
| CellDrawParams params; | CellDrawParams params; | ||||
| params.block = cells_block; | params.block = cells_block; | ||||
| params.xmin = left_x; | params.xmin = left_x; | ||||
| params.ymin = region->winy - drawer.top_row_height - (row_index + 1) * drawer.row_height - | params.ymin = region->winy - drawer.top_row_height - (row_index + 1) * drawer.row_height - | ||||
| scroll_offset_y; | scroll_offset_y; | ||||
| params.width = column_width; | params.width = column_width - CELL_RIGHT_PADDING; | ||||
| params.height = drawer.row_height; | params.height = drawer.row_height; | ||||
| drawer.draw_content_cell(row_index, column_index, params); | drawer.draw_content_cell(row_index, column_index, params); | ||||
| } | } | ||||
| } | } | ||||
| left_x = right_x; | left_x = right_x; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines | |||||