diff options
author | Hans Goudey <h.goudey@me.com> | 2021-11-20 01:36:11 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-11-20 01:36:11 +0300 |
commit | 01df48a983944ab3f8a6f3be926f825ac83bbc14 (patch) | |
tree | 8fab42eb2a468786351e274027faa4538ecc631a /source/blender/editors/space_spreadsheet/spreadsheet_panels.cc | |
parent | a0780ad6253fcb9768dd3184351998effef6d178 (diff) |
Refactor: Port spreadsheet data set to UI tree view
This patch removes a bunch of specific code for drawing the spreadsheet
data set region, which was an overly specific solution for a generic UI.
Nowadays, the UI tree view API used for asset browser catalogs is a much
better way to implement this behavior.
To make this possible, the tree view API is extended in a few ways.
Collapsibility can now be turned off, and whether an item should
be active is moved to a separate virtual function.
The only visual change is that the items are now drawn in a box,
just like the asset catalog.
Differential Revision: https://developer.blender.org/D13198
Diffstat (limited to 'source/blender/editors/space_spreadsheet/spreadsheet_panels.cc')
-rw-r--r-- | source/blender/editors/space_spreadsheet/spreadsheet_panels.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_panels.cc b/source/blender/editors/space_spreadsheet/spreadsheet_panels.cc new file mode 100644 index 00000000000..8f923ea4a63 --- /dev/null +++ b/source/blender/editors/space_spreadsheet/spreadsheet_panels.cc @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#include "BKE_screen.h" + +#include "BLT_translation.h" + +#include "spreadsheet_dataset_draw.hh" +#include "spreadsheet_intern.hh" + +namespace blender::ed::spreadsheet { + +void spreadsheet_data_set_region_panels_register(ARegionType ®ion_type) +{ + PanelType *panel_type = (PanelType *)MEM_callocN(sizeof(PanelType), __func__); + strcpy(panel_type->idname, "SPREADSHEET_PT_data_set"); + strcpy(panel_type->label, N_("Data Set")); + strcpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); + panel_type->flag = PANEL_TYPE_NO_HEADER; + panel_type->draw = spreadsheet_data_set_panel_draw; + BLI_addtail(®ion_type.paneltypes, panel_type); +} + +} // namespace blender::ed::spreadsheet
\ No newline at end of file |