Changeset View
Standalone View
source/blender/makesrna/intern/rna_space.c
| Context not available. | |||||
| #include "BKE_key.h" | #include "BKE_key.h" | ||||
| #include "BKE_movieclip.h" | #include "BKE_movieclip.h" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| #include "BKE_text.h" | |||||
| #include "DNA_action_types.h" | #include "DNA_action_types.h" | ||||
| #include "DNA_key_types.h" | #include "DNA_key_types.h" | ||||
| Context not available. | |||||
| WM_main_add_notifier(NC_TEXT | NA_EDITED, st->text); | WM_main_add_notifier(NC_TEXT | NA_EDITED, st->text); | ||||
| } | } | ||||
| static void rna_SpaceTextEditor_line_char_to_screen_pos(SpaceText *st, bContext* C, int line_char[2], int screen_pos[2]) | |||||
| { | |||||
| bScreen *scr = CTX_wm_screen(C); | |||||
| ScrArea *sa; | |||||
| for (sa = scr->areabase.first; sa; sa = sa->next) { | |||||
Severin: Could be copy_v2_v2_int | |||||
campbellbartonAuthorUnsubmitted Not Done Inline Actionsjust finding the first text space is really arbitrary, its even possible st and ar are unrelated. See how text_scroll_to_cursor__area gets the region from the ScrArea campbellbarton: just finding the first text space is really arbitrary, its even possible `st` and `ar` are… | |||||
| if (sa->type->spaceid == SPACE_TEXT) { | |||||
| ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); | |||||
| text_line_char_to_screen_pos(st, ar, line_char, screen_pos); | |||||
Not Done Inline ActionsSee comment below (and needless blank lines again). mont29: See comment below (and needless blank lines again). | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| /* Space Properties */ | /* Space Properties */ | ||||
| Context not available. | |||||
| static void rna_def_space_text(BlenderRNA *brna) | static void rna_def_space_text(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop, *parm; | ||||
| FunctionRNA *func; | |||||
| srna = RNA_def_struct(brna, "SpaceTextEditor", "Space"); | srna = RNA_def_struct(brna, "SpaceTextEditor", "Space"); | ||||
| RNA_def_struct_sdna(srna, "SpaceText"); | RNA_def_struct_sdna(srna, "SpaceText"); | ||||
Not Done Inline ActionsThis is not what you want to do I think, you want to make this prop read-only, right? Defining a getter func and setting setter to NULL will not make the prop read-only! You do not need the getter at all here, and should rather define the prop as readonly (i.e. replace RNA_def_property_int_funcs by RNA_def_property_clear_flag(prop, PROP_EDITABLE);). mont29: This is not what you want to do I think, you want to make this prop read-only, right? Defining… | |||||
Not Done Inline ActionsAdd in 'tip' a reference about the unit (pixel)? And no need to define an update for this prop, if it's read-only… mont29: Add in 'tip' a reference about the unit (pixel)? And no need to define an update for this prop… | |||||
Not Done Inline ActionsGrrrrr… xD mont29: Grrrrr… xD | |||||
Not Done Inline ActionsSuggest to make this a function rather then a property. then the function can do any checks it needs to at the time its run. campbellbarton: Suggest to make this a function rather then a property. then the function can do any checks it… | |||||
| Context not available. | |||||
| RNA_def_property_string_sdna(prop, NULL, "replacestr"); | RNA_def_property_string_sdna(prop, NULL, "replacestr"); | ||||
| RNA_def_property_ui_text(prop, "Replace Text", "Text to replace selected text with using the replace tool"); | RNA_def_property_ui_text(prop, "Replace Text", "Text to replace selected text with using the replace tool"); | ||||
| RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL); | RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL); | ||||
| func = RNA_def_function(srna, "line_char_to_screen_pos", "rna_SpaceTextEditor_line_char_to_screen_pos"); | |||||
| RNA_def_function_ui_description(func, "Retrieve the screen position in pixels from the given line and character position"); | |||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT); | |||||
| parm = RNA_def_int_array(func, "line_char", 2, 0, 0, INT_MAX, "", "Text Position, line and character in line", 0, INT_MAX); | |||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | |||||
| parm = RNA_def_int_array(func, "screen_pos", 2, 0, 0, INT_MAX, "", "Screen Position in Pixels", 0, INT_MAX); | |||||
| RNA_def_function_output(func, parm); | |||||
| } | } | ||||
| static void rna_def_space_dopesheet(BlenderRNA *brna) | static void rna_def_space_dopesheet(BlenderRNA *brna) | ||||
| Context not available. | |||||
Could be copy_v2_v2_int