made region type into an enum

This commit is contained in:
Campbell Barton 2010-01-01 20:50:58 +00:00
parent a2fe0cf5d7
commit a81a98148a
2 changed files with 16 additions and 11 deletions

@ -212,14 +212,16 @@ typedef struct ARegion {
#define SCREEN_HANDLER_VERSE 3 #define SCREEN_HANDLER_VERSE 3
/* regiontype, first two are the default set */ /* regiontype, first two are the default set */
#define RGN_TYPE_WINDOW 0 enum {
#define RGN_TYPE_HEADER 1 RGN_TYPE_WINDOW = 0,
#define RGN_TYPE_CHANNELS 2 RGN_TYPE_HEADER,
#define RGN_TYPE_TEMPORARY 3 RGN_TYPE_CHANNELS,
#define RGN_TYPE_UI 4 RGN_TYPE_TEMPORARY,
#define RGN_TYPE_TOOLS 5 RGN_TYPE_UI,
#define RGN_TYPE_TOOL_PROPS 6 RGN_TYPE_TOOLS,
#define RGN_TYPE_PREVIEW 7 RGN_TYPE_TOOL_PROPS,
RGN_TYPE_PREVIEW
};
/* region alignment */ /* region alignment */
#define RGN_ALIGN_NONE 0 #define RGN_ALIGN_NONE 0

@ -23,6 +23,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h>
#include "RNA_define.h" #include "RNA_define.h"
#include "RNA_types.h" #include "RNA_types.h"
@ -37,9 +38,10 @@ EnumPropertyItem region_type_items[] = {
{RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""}, {RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""},
{RGN_TYPE_HEADER, "HEADER", 0, "Header", ""}, {RGN_TYPE_HEADER, "HEADER", 0, "Header", ""},
{RGN_TYPE_CHANNELS, "CHANNELS", 0, "Channels", ""}, {RGN_TYPE_CHANNELS, "CHANNELS", 0, "Channels", ""},
{RGN_TYPE_TOOLS, "TOOLS", 0, "Tools", ""},
{RGN_TYPE_TEMPORARY, "TEMPORARY", 0, "Temporary", ""}, {RGN_TYPE_TEMPORARY, "TEMPORARY", 0, "Temporary", ""},
{RGN_TYPE_UI, "UI", 0, "UI", ""}, {RGN_TYPE_UI, "UI", 0, "UI", ""},
{RGN_TYPE_TOOLS, "TOOLS", 0, "Tools", ""},
{RGN_TYPE_TOOL_PROPS, "TOOL_PROPS", 0, "Tool Properties", ""},
{RGN_TYPE_PREVIEW, "PREVIEW", 0, "Preview", ""}, {RGN_TYPE_PREVIEW, "PREVIEW", 0, "Preview", ""},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}};
@ -154,8 +156,9 @@ static void rna_def_region(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Region ID", "Unique ID for this region."); RNA_def_property_ui_text(prop, "Region ID", "Unique ID for this region.");
prop= RNA_def_property(srna, "type", PROP_INT, PROP_NONE); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "regiontype"); RNA_def_property_enum_sdna(prop, NULL, "regiontype");
RNA_def_property_enum_items(prop, region_type_items);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Region Type", "Type of this region."); RNA_def_property_ui_text(prop, "Region Type", "Type of this region.");