2.5: Remove OOPS code from the outliner space, as discussed
[blender-staging.git] / source / blender / makesrna / intern / rna_space.c
index 25542fd6d655d5c6f5be1f6275e66f3fad0ba462..5184e904927ca0102c7e68f8396c11b931229a19 100644 (file)
 
 #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;
@@ -41,8 +48,8 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
                /*case SPACE_VIEW3D:
                        return &RNA_SpaceView3D;
                case SPACE_IPO:
-                       return &RNA_SpaceIpoEditor;
-               case SPACE_OOPS:
+                       return &RNA_SpaceGraphEditor;
+               case SPACE_OUTLINER:
                        return &RNA_SpaceOutliner;
                case SPACE_BUTS:
                        return &RNA_SpaceButtonsWindow;
@@ -53,15 +60,15 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
                /*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_SpaceActionEditor;
+                       return &RNA_SpaceDopeSheetEditor;
                case SPACE_NLA:
                        return &RNA_SpaceNLAEditor;
                case SPACE_SCRIPT:
@@ -75,9 +82,33 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
        }
 }
 
-static void *rna_SpaceImage_self_get(PointerRNA *ptr)
+static PointerRNA rna_SpaceImage_uvedit_get(PointerRNA *ptr)
+{
+       return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
+}
+
+static void rna_SpaceImage_paint_update(bContext *C, PointerRNA *ptr)
 {
-       return ptr->id.data;
+       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
@@ -90,8 +121,8 @@ static void rna_def_space(BlenderRNA *brna)
        static EnumPropertyItem type_items[] = {
                {SPACE_EMPTY, "EMPTY", "Empty", ""},
                {SPACE_VIEW3D, "VIEW_3D", "3D View", ""},
-               {SPACE_IPO, "IPO_EDITOR", "Ipo Editor", ""},
-               {SPACE_OOPS, "OUTLINER", "Outliner", ""},
+               {SPACE_IPO, "GRAPH_EDITOR", "Graph Editor", ""},
+               {SPACE_OUTLINER, "OUTLINER", "Outliner", ""},
                {SPACE_BUTS, "BUTTONS_WINDOW", "Buttons Window", ""},
                {SPACE_FILE, "FILE_BROWSER", "File Browser", ""},
                {SPACE_IMAGE, "IMAGE_EDITOR", "Image Editor", ""},
@@ -100,7 +131,7 @@ static void rna_def_space(BlenderRNA *brna)
                {SPACE_TEXT, "TEXT_EDITOR", "Text Editor", ""},
                //{SPACE_IMASEL, "IMAGE_BROWSER", "Image Browser", ""},
                {SPACE_SOUND, "AUDIO_WINDOW", "Audio Window", ""},
-               {SPACE_ACTION, "ACTION_EDITOR", "Action Editor", ""},
+               {SPACE_ACTION, "DOPESHEET_EDITOR", "DopeSheet Editor", ""},
                {SPACE_NLA, "NLA_EDITOR", "NLA Editor", ""},
                {SPACE_SCRIPT, "SCRIPTS_WINDOW", "Scripts Window", ""},
                {SPACE_TIME, "TIMELINE", "Timeline", ""},
@@ -115,7 +146,7 @@ static void rna_def_space(BlenderRNA *brna)
        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.");
 }
 
@@ -195,9 +226,9 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
        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 */
 
@@ -264,14 +295,14 @@ static void rna_def_space_image(BlenderRNA *brna)
        /* uv */
        prop= RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "SpaceUVEditor");
-       RNA_def_property_pointer_funcs(prop, "rna_SpaceImage_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_SpaceImage_uvedit_get", NULL);
        RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings.");
        
        /* 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);
@@ -291,10 +322,83 @@ static void rna_def_space_image(BlenderRNA *brna)
        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