#include "DNA_space_types.h"
+#include "WM_types.h"
+
#ifdef RNA_RUNTIME
+#include "DNA_scene_types.h"
+
+#include "BKE_brush.h"
+#include "BKE_context.h"
+
static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
{
SpaceLink *space= (SpaceLink*)ptr->data;
return &RNA_SpaceView3D;
case SPACE_IPO:
return &RNA_SpaceGraphEditor;
- case SPACE_OOPS:
+ case SPACE_OUTLINER:
return &RNA_SpaceOutliner;
case SPACE_BUTS:
return &RNA_SpaceButtonsWindow;
/*case SPACE_INFO:
return &RNA_SpaceUserPreferences;
case SPACE_SEQ:
- return &RNA_SpaceSequenceEditor;
+ return &RNA_SpaceSequenceEditor;*/
case SPACE_TEXT:
return &RNA_SpaceTextEditor;
//case SPACE_IMASEL:
// return &RNA_SpaceImageBrowser;
- case SPACE_SOUND:
+ /*case SPACE_SOUND:
return &RNA_SpaceAudioWindow;
case SPACE_ACTION:
return &RNA_SpaceDopeSheetEditor;
return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
}
+static void rna_SpaceImage_paint_update(bContext *C, PointerRNA *ptr)
+{
+ Scene *scene= CTX_data_scene(C);
+
+ if(scene)
+ brush_check_exists(&scene->toolsettings->imapaint.brush);
+}
+
+void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, int value)
+{
+ SpaceText *st= (SpaceText*)(ptr->data);
+
+ st->wordwrap= value;
+ st->left= 0;
+}
+
+void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value)
+{
+ SpaceText *st= (SpaceText*)(ptr->data);
+
+ st->text= value.data;
+ st->top= 0;
+}
+
#else
static void rna_def_space(BlenderRNA *brna)
{SPACE_EMPTY, "EMPTY", "Empty", ""},
{SPACE_VIEW3D, "VIEW_3D", "3D View", ""},
{SPACE_IPO, "GRAPH_EDITOR", "Graph Editor", ""},
- {SPACE_OOPS, "OUTLINER", "Outliner", ""},
+ {SPACE_OUTLINER, "OUTLINER", "Outliner", ""},
{SPACE_BUTS, "BUTTONS_WINDOW", "Buttons Window", ""},
{SPACE_FILE, "FILE_BROWSER", "File Browser", ""},
{SPACE_IMAGE, "IMAGE_EDITOR", "Image Editor", ""},
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spacetype");
RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Type", "Space data type.");
}
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LOCAL_UV);
RNA_def_property_ui_text(prop, "Local View", "Draw only faces with the currently displayed image assigned.");*/
- prop= RNA_def_property(srna, "display_normalized_coordinates", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "normalized_coordinates", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS);
- RNA_def_property_ui_text(prop, "Display Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels.");
+ RNA_def_property_ui_text(prop, "Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels.");
/* todo: move edge and face drawing options here from G.f */
/* paint */
prop= RNA_def_property(srna, "image_painting", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWTOOL);
- RNA_def_property_flag(prop, PROP_NOT_EDITABLE); // brush check
RNA_def_property_ui_text(prop, "Image Painting", "Enable image painting mode.");
+ RNA_def_property_update(prop, 0, "rna_SpaceImage_paint_update");
/* grease pencil */
prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
rna_def_space_image_uv(brna);
}
+static void rna_def_space_text(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem font_size_items[] = {
+ {12, "SCREEN_12", "Screen 12", ""},
+ {15, "SCREEN_15", "Screen 15", ""},
+ {0, NULL, NULL, NULL}};
+
+ srna= RNA_def_struct(brna, "SpaceTextEditor", "Space");
+ RNA_def_struct_sdna(srna, "SpaceText");
+ RNA_def_struct_ui_text(srna, "Space Text Editor", "Text editor space data.");
+
+ /* text */
+ prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Text", "Text displayed and edited in this space.");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set");
+ RNA_def_property_update(prop, NC_TEXT|ND_CURSOR, NULL);
+
+ /* display */
+ prop= RNA_def_property(srna, "syntax_highlight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "showsyntax", 0);
+ RNA_def_property_ui_text(prop, "Syntax Highlight", "Syntax highlight for scripting.");
+ RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
+
+ prop= RNA_def_property(srna, "word_wrap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "wordwrap", 0);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceTextEditor_word_wrap_set");
+ RNA_def_property_ui_text(prop, "Word Wrap", "Wrap words if there is not enough horizontal space.");
+ RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
+
+ prop= RNA_def_property(srna, "line_numbers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "showlinenrs", 0);
+ RNA_def_property_ui_text(prop, "Line Numbers", "Show line numbers next to the text.");
+ RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
+
+ prop= RNA_def_property(srna, "overwrite", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Overwrite", "Overwrite characters when typing rather than inserting them.");
+ RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
+
+ prop= RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "tabnumber");
+ RNA_def_property_range(prop, 2, 8);
+ RNA_def_property_ui_text(prop, "Tab Width", "Number of spaces to display tabs with.");
+ RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
+
+ prop= RNA_def_property(srna, "font_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "lheight");
+ RNA_def_property_enum_items(prop, font_size_items);
+ RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text.");
+ RNA_def_property_update(prop, NC_TEXT|ND_DISPLAY, NULL);
+
+ /* find */
+ prop= RNA_def_property(srna, "find_all", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_ALL);
+ RNA_def_property_ui_text(prop, "Find All", "Search in all text datablocks, instead of only the active one.");
+
+ prop= RNA_def_property(srna, "find_wrap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_WRAP);
+ RNA_def_property_ui_text(prop, "Find Wrap", "Search again from the start of the file when reaching the end.");
+
+ prop= RNA_def_property(srna, "find_text", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "findstr");
+ RNA_def_property_ui_text(prop, "Find Text", "Text to search for with the find tool.");
+
+ prop= RNA_def_property(srna, "replace_text", PROP_STRING, PROP_NONE);
+ 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.");
+}
+
void RNA_def_space(BlenderRNA *brna)
{
rna_def_space(brna);
rna_def_space_image(brna);
+ rna_def_space_text(brna);
}
#endif