26#define CELL_RIGHT_PADDING (2.0f * UI_SCALE_FAC)
69 const int scroll_offset_y,
76 const int row_pair_height = drawer.
row_height * 2;
77 const int row_top_y = region->
winy - drawer.
top_row_height - scroll_offset_y % row_pair_height;
80 int x_right = region->
winx;
81 int y_top = row_top_y -
i * row_pair_height - drawer.
row_height;
99 const int scroll_offset_x,
118 const int column_width = drawer.
column_width(column_index);
119 line_x += column_width;
130 const int scroll_offset_y,
132 int *r_max_visible_rows)
134 *r_first_row = -scroll_offset_y / drawer.
row_height;
149 int first_row, max_visible_rows;
150 get_visible_rows(drawer, region, scroll_offset_y, &first_row, &max_visible_rows);
151 for (
const int row_index :
IndexRange(first_row, max_visible_rows)) {
156 params.block = left_column_block;
174 const int scroll_offset_x)
188 const int column_width = drawer.
column_width(column_index);
189 const int right_x = left_x + column_width;
192 params.block = first_row_block;
211 const int scroll_offset_x,
212 const int scroll_offset_y)
224 int first_row, max_visible_rows;
225 get_visible_rows(drawer, region, scroll_offset_y, &first_row, &max_visible_rows);
229 const int column_width = drawer.
column_width(column_index);
230 const int right_x = left_x + column_width;
233 for (
const int row_index :
IndexRange(first_row, max_visible_rows)) {
239 params.block = cells_block;
260 const int row_amount)
262 int column_width_sum = 0;
268 const int right_padding =
UI_UNIT_X * 0.5f;
278 const int scroll_offset_x)
300 const int scroll_offset_x)
313 rctf offset_column_rect;
316 offset_column_rect.
xmax = offset_column_rect.
xmin +
318 offset_column_rect.
ymin = 0;
319 offset_column_rect.
ymax = region.
winy;
331 insert_rect.
xmin = insert_column_x - width / 2 - scroll_offset_x;
332 insert_rect.
xmax = insert_rect.
xmin + width;
333 insert_rect.
ymin = 0;
338 insert_rect.
xmin = std::max<float>(insert_rect.
xmin, left_bound);
339 insert_rect.
xmax = std::max<float>(insert_rect.
xmax, left_bound);
356 const int scroll_offset_y = v2d->
cur.
ymax;
357 const int scroll_offset_x = v2d->
cur.
xmin;
367 if (is_reordering_columns) {
378 if (is_reordering_columns) {
SpaceSpreadsheet * CTX_wm_space_spreadsheet(const bContext *C)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
#define SPREADSHEET_WIDTH_UNIT
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_blend(GPUBlend blend)
void GPU_scissor(int x, int y, int width, int height)
void GPU_scissor_get(int coords[4])
void UI_draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
uiBlock * UI_block_begin(const bContext *C, ARegion *region, std::string name, blender::ui::EmbossType emboss)
void UI_block_draw(const bContext *C, uiBlock *block)
void UI_block_end(const bContext *C, uiBlock *block)
void UI_ThemeClearColor(int colorid)
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom)
void UI_view2d_totRect_set(View2D *v2d, int width, int height)
BMesh const char void * data
virtual void draw_top_row_cell(int column_index, const CellDrawParams ¶ms) const
virtual int column_width(int column_index) const
virtual ~SpreadsheetDrawer()
virtual void draw_left_column_cell(int row_index, const CellDrawParams ¶ms) const
virtual void draw_content_cell(int row_index, int column_index, const CellDrawParams ¶ms) const
static void draw_index_column_background(const uint pos, const ARegion *region, const SpreadsheetDrawer &drawer)
static void draw_left_column_content(const int scroll_offset_y, const bContext *C, ARegion *region, const SpreadsheetDrawer &drawer)
static void get_visible_rows(const SpreadsheetDrawer &drawer, const ARegion *region, const int scroll_offset_y, int *r_first_row, int *r_max_visible_rows)
void draw_spreadsheet_in_region(const bContext *C, ARegion *region, const SpreadsheetDrawer &drawer)
static void draw_column_reorder_source(const uint pos, const ARegion ®ion, const SpaceSpreadsheet &sspreadsheet, const int scroll_offset_x)
static void draw_column_reorder_destination(const ARegion ®ion, const SpaceSpreadsheet &sspreadsheet, const SpreadsheetDrawer &drawer, const int scroll_offset_x)
static void update_view2d_tot_rect(const SpreadsheetDrawer &drawer, ARegion *region, const int row_amount)
static void draw_top_row_content(const bContext *C, ARegion *region, const SpreadsheetDrawer &drawer, const int scroll_offset_x)
static void draw_alternating_row_overlay(const uint pos, const int scroll_offset_y, const ARegion *region, const SpreadsheetDrawer &drawer)
static void draw_cell_contents(const bContext *C, ARegion *region, const SpreadsheetDrawer &drawer, const int scroll_offset_x, const int scroll_offset_y)
static void draw_separator_lines(const uint pos, const int scroll_offset_x, const ARegion *region, const SpreadsheetDrawer &drawer)
SpreadsheetTable * get_active_table(SpaceSpreadsheet &sspreadsheet)
static void draw_top_row_background(const uint pos, const ARegion *region, const SpreadsheetDrawer &drawer)
ColorTheme4< float > ColorTheme4f
#define CELL_RIGHT_PADDING
SpaceSpreadsheet_Runtime * runtime
SpreadsheetColumnRuntime * runtime
SpreadsheetColumn ** columns
std::optional< ReorderColumnVisualizationData > reorder_column_visualization_data