34static void rna_Text_filepath_get(
PointerRNA *ptr,
char *value)
36 const Text *text =
static_cast<const Text *
>(ptr->data);
39 strcpy(value, text->filepath);
46static int rna_Text_filepath_length(
PointerRNA *ptr)
48 const Text *text =
static_cast<const Text *
>(ptr->data);
49 return (text->filepath) ? strlen(text->filepath) : 0;
52static void rna_Text_filepath_set(
PointerRNA *ptr,
const char *value)
54 Text *text =
static_cast<Text *
>(ptr->data);
57 MEM_delete(text->filepath);
64 text->filepath =
nullptr;
68static bool rna_Text_modified_get(
PointerRNA *ptr)
70 const Text *text =
static_cast<const Text *
>(ptr->data);
74static int rna_Text_current_line_index_get(
PointerRNA *ptr)
76 const Text *text =
static_cast<const Text *
>(ptr->data);
80static void rna_Text_current_line_index_set(
PointerRNA *ptr,
int value)
82 Text *text =
static_cast<Text *
>(ptr->data);
84 if (line ==
nullptr) {
85 line = text->lines.last();
91static int rna_Text_select_end_line_index_get(
PointerRNA *ptr)
93 const Text *text =
static_cast<Text *
>(ptr->data);
97static void rna_Text_select_end_line_index_set(
PointerRNA *ptr,
int value)
99 Text *text =
static_cast<Text *
>(ptr->data);
101 if (line ==
nullptr) {
102 line = text->lines.last();
108static int rna_Text_current_character_get(
PointerRNA *ptr)
110 const Text *text =
static_cast<const Text *
>(ptr->data);
115static void rna_Text_current_character_set(
PointerRNA *ptr,
const int index)
117 Text *text =
static_cast<Text *
>(ptr->data);
122static int rna_Text_select_end_character_get(
PointerRNA *ptr)
124 Text *text =
static_cast<Text *
>(ptr->data);
129static void rna_Text_select_end_character_set(
PointerRNA *ptr,
const int index)
131 Text *text =
static_cast<Text *
>(ptr->data);
136static void rna_TextLine_body_get(
PointerRNA *ptr,
char *value)
141 strcpy(value, line->line);
148static int rna_TextLine_body_length(
PointerRNA *ptr)
154static void rna_TextLine_body_set(
PointerRNA *ptr,
const char *value)
157 size_t len = strlen(value);
160 MEM_delete(line->line);
164 line->len = int(
len);
165 memcpy(line->line, value,
len + 1);
167 MEM_SAFE_DELETE(line->format);
186 prop,
"rna_TextLine_body_get",
"rna_TextLine_body_length",
"rna_TextLine_body_set");
196 {0,
"TABS", 0,
"Tabs",
"Indent using tabs"},
198 {0,
nullptr, 0,
nullptr,
nullptr},
206 srna,
"Text",
"Text data-block referencing an external or packed text file");
212 prop,
"rna_Text_filepath_get",
"rna_Text_filepath_length",
"rna_Text_filepath_set");
225 prop,
"Modified",
"Text file on disk is different than the one in memory");
231 prop,
"Memory",
"Text file is in memory, without a corresponding file on disk");
254 prop,
"Current Line",
"Current line, and start line of selection if one exists");
260 "Index of current character in current line, and also start index of "
261 "character in selection if one exists");
263 prop,
"rna_Text_current_character_get",
"rna_Text_current_character_set",
nullptr);
268 prop,
"rna_Text_current_line_index_get",
"rna_Text_current_line_index_set",
nullptr);
270 prop,
"Current Line Index",
"Index of current TextLine in TextLine collection");
282 prop,
"rna_Text_select_end_line_index_get",
"rna_Text_select_end_line_index_set",
nullptr);
289 "Selection End Character",
290 "Index of character after end of selection in the selection end line");
292 prop,
"rna_Text_select_end_character_get",
"rna_Text_select_end_character_set",
nullptr);
#define BLT_I18NCONTEXT_ID_TEXT
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
static void rna_def_text(BlenderRNA *brna)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
static void rna_def_text_line(BlenderRNA *brna)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_def_struct_clear_flag(StructRNA *srna, StructFlag flag)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void int BKE_text_file_modified_check(const struct Text *text)
int BLI_str_utf8_offset_from_index(const char *str, size_t str_len, int index_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_api_text(StructRNA *srna)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
int BLI_str_utf8_offset_to_index(const char *str, size_t str_len, int offset_target) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_text(BlenderRNA *brna)