Merging r40615 through r40652 from trunk into soc-2011-tomato
[blender.git] / source / blender / editors / interface / interface_handlers.c
index f340ddb7e640c26921f2c06f37ee82fd1a6ef590..9106453eb545095bb3ef35df64d3324830fa5ee3 100644 (file)
@@ -632,7 +632,7 @@ static void ui_apply_but_IDPOIN(bContext *C, uiBut *but, uiHandleButtonData *dat
        data->applied= 1;
 }
 
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
 static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
        ui_apply_but_func(C, but);
@@ -801,8 +801,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
        if(!act_iter) return;
 
        /* (3) add a new controller */
-       if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED)
-       {
+       if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) {
                cont = (bController *)ob->controllers.last;
 
                /* (4) link the sensor->controller->actuator */
@@ -1032,7 +1031,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
                case IDPOIN:
                        ui_apply_but_IDPOIN(C, but, data);
                        break;
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
                case CHARTAB:
                        ui_apply_but_CHARTAB(C, but, data);
                        break;
@@ -1125,9 +1124,9 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
                if(but->poin==NULL && but->rnapoin.data==NULL);
                else if(mode=='c') {
                        if(ui_is_but_float(but))
-                               sprintf(buf, "%f", ui_get_but_val(but));
+                               BLI_snprintf(buf, sizeof(buf), "%f", ui_get_but_val(but));
                        else
-                               sprintf(buf, "%d", (int)ui_get_but_val(but));
+                               BLI_snprintf(buf, sizeof(buf), "%d", (int)ui_get_but_val(but));
 
                        WM_clipboard_text_set(buf, 0);
                }
@@ -1148,7 +1147,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
                else if(mode=='c') {
 
                        ui_get_but_vectorf(but, rgb);
-                       sprintf(buf, "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]);
+                       BLI_snprintf(buf, sizeof(buf), "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]);
                        WM_clipboard_text_set(buf, 0);
                        
                }
@@ -1247,7 +1246,7 @@ static short test_special_char(char ch)
                case ':':
                case ';':
                case '\'':
-               case '\"':
+               case '\"': // " - an extra closing one for Aligorith's text editor
                case '<':
                case '>':
                case ',':
@@ -1281,7 +1280,7 @@ static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data)
 /* note, but->block->aspect is used here, when drawing button style is getting scaled too */
 static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, short x)
 {
-       uiStyle *style= U.uistyles.first;       // XXX pass on as arg
+       uiStyle *style= UI_GetStyle();  // XXX pass on as arg
        uiFontStyle *fstyle = &style->widget;
        int startx= but->x1;
        char *origstr;
@@ -1696,7 +1695,7 @@ static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
                        /* not a file?, strip non utf-8 chars */
                        if(strip) {
                                /* wont happen often so isnt that annoying to keep it here for a while */
-                               printf("invalid utf8 - stripped chars %d\n", strip);
+                               printf("%s: invalid utf8 - stripped chars %d\n", __func__, strip);
                        }
                }
                
@@ -3936,7 +3935,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
        return WM_UI_HANDLER_CONTINUE;
 }
 
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
 static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event))
 {
        /* XXX 2.50 bad global and state access */
@@ -4094,7 +4093,7 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
                        if(scopes->marker->framenr!=scopes->framenr)
                                scopes->marker= BKE_tracking_ensure_marker(scopes->track, scopes->framenr);
 
-                       scopes->marker->flag&= ~MARKER_DISABLED;
+                       scopes->marker->flag&= ~(MARKER_DISABLED|MARKER_TRACKED);
                        scopes->marker->pos[0]+= -dx*scopes->slide_scale[0] / (but->block->maxx-but->block->minx);
                        scopes->marker->pos[1]+= -dy*scopes->slide_scale[1] / (but->block->maxy-but->block->miny);
 
@@ -4195,7 +4194,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
        wmKeyMapItem *kmi;
        PointerRNA ptr;
        uiLayout *layout;
-       uiStyle *style= U.uistyles.first;
+       uiStyle *style= UI_GetStyle();
        IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
        int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
 
@@ -4227,7 +4226,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
        wmKeyMapItem *kmi;
        PointerRNA ptr;
        uiLayout *layout;
-       uiStyle *style= U.uistyles.first;
+       uiStyle *style= UI_GetStyle();
        IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
        int kmi_id;
        
@@ -4328,6 +4327,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
                
                /* Keyframes */
                if(but->flag & UI_BUT_ANIMATED_KEY) {
+                       /* replace/delete keyfraemes */
                        if(length) {
                                uiItemBooleanO(layout, "Replace Keyframes", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
                                uiItemBooleanO(layout, "Replace Single Keyframe", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
@@ -4338,6 +4338,11 @@ static int ui_but_menu(bContext *C, uiBut *but)
                                uiItemBooleanO(layout, "Replace Keyframe", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
                                uiItemBooleanO(layout, "Delete Keyframe", ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 0);
                        }
+                       
+                       /* keyframe settings */
+                       uiItemS(layout);
+                       
+                       
                }
                else if(but->flag & UI_BUT_DRIVEN);
                else if(is_anim) {
@@ -4380,6 +4385,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
                }
                
                /* Keying Sets */
+               // TODO: check on modifyability of Keying Set when doing this
                if(is_anim) {
                        uiItemS(layout);
 
@@ -4454,7 +4460,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
                PointerRNA ptr_props;
 
                if(but->rnapoin.data && but->rnaprop) {
-                       sprintf(buf, "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
+                       BLI_snprintf(buf, sizeof(buf), "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
 
                        WM_operator_properties_create(&ptr_props, "WM_OT_doc_view");
                        RNA_string_set(&ptr_props, "doc_id", buf);
@@ -4671,7 +4677,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
        case HSVCIRCLE:
                retval= ui_do_but_HSVCIRCLE(C, block, but, data, event);
                break;
-#ifdef INTERNATIONAL
+#ifdef WITH_INTERNATIONAL
        case CHARTAB:
                retval= ui_do_but_CHARTAB(C, block, but, data, event);
                break;
@@ -6004,7 +6010,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
                                                                        ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);
                                                                }
                                                                else {
-                                                                       printf("Error, but->menu_key type: %d\n", but->type);
+                                                                       printf("%s: error, but->menu_key type: %d\n", __func__, but->type);
                                                                }
 
                                                                break;