use constant strings for outliner menus rather then sprint'ing them together.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 5 Dec 2010 06:40:47 +0000 (06:40 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 5 Dec 2010 06:40:47 +0000 (06:40 +0000)
source/blender/editors/space_outliner/outliner.c
source/blender/imbuf/intern/cineon/CMakeLists.txt
source/blender/windowmanager/wm_event_types.h

index 154911422a6373a4fd8a463655458a18f999bea9..393be83ad111cab12c3bb2faf5198458b4481a1c 100644 (file)
@@ -5376,84 +5376,74 @@ static short keymap_menu_type(short type)
        return 0;
 }
 
-static char *keymap_type_menu(void)
+static const char *keymap_type_menu(void)
 {
-       static char string[500];
-       static char formatstr[] = "|%s %%x%d";
-       char *str= string;
-       
-       str += sprintf(str, "Event Type %%t");
-       
-       str += sprintf(str, formatstr, "Keyboard", OL_KM_KEYBOARD);
-       str += sprintf(str, formatstr, "Mouse", OL_KM_MOUSE);
-       str += sprintf(str, formatstr, "Tweak", OL_KM_TWEAK);
-//     str += sprintf(str, formatstr, "Specials", OL_KM_SPECIALS);
-       
+       static const char string[]=
+       "Event Type%t"
+       "|Keyboard%x" STRINGIFY(OL_KM_KEYBOARD)
+       "|Mouse%x" STRINGIFY(OL_KM_MOUSE)
+       "|Tweak%x" STRINGIFY(OL_KM_TWEAK)
+//     "|Specials%x" STRINGIFY(OL_KM_SPECIALS)
+       ;
+
        return string;
-}      
-
-static char *keymap_mouse_menu(void)
-{
-       static char string[500];
-       static char formatstr[] = "|%s %%x%d";
-       char *str= string;
-       
-       str += sprintf(str, "Mouse Event %%t");
-       
-       str += sprintf(str, formatstr, "Left Mouse", LEFTMOUSE);
-       str += sprintf(str, formatstr, "Middle Mouse", MIDDLEMOUSE);
-       str += sprintf(str, formatstr, "Right Mouse", RIGHTMOUSE);
-       str += sprintf(str, formatstr, "Button4 Mouse ", BUTTON4MOUSE);
-       str += sprintf(str, formatstr, "Button5 Mouse ", BUTTON5MOUSE);
-       str += sprintf(str, formatstr, "Action Mouse", ACTIONMOUSE);
-       str += sprintf(str, formatstr, "Select Mouse", SELECTMOUSE);
-       str += sprintf(str, formatstr, "Mouse Move", MOUSEMOVE);
-       str += sprintf(str, formatstr, "Wheel Up", WHEELUPMOUSE);
-       str += sprintf(str, formatstr, "Wheel Down", WHEELDOWNMOUSE);
-       str += sprintf(str, formatstr, "Wheel In", WHEELINMOUSE);
-       str += sprintf(str, formatstr, "Wheel Out", WHEELOUTMOUSE);
-       str += sprintf(str, formatstr, "Mouse/Trackpad Pan", MOUSEPAN);
-       str += sprintf(str, formatstr, "Mouse/Trackpad Zoom", MOUSEZOOM);
-       str += sprintf(str, formatstr, "Mouse/Trackpad Rotate", MOUSEROTATE);
-       
+}
+
+static const char *keymap_mouse_menu(void)
+{
+       static const char string[]=
+       "Mouse Event%t"
+       "|Left Mouse%x" STRINGIFY(LEFTMOUSE)
+       "|Middle Mouse%x" STRINGIFY(MIDDLEMOUSE)
+       "|Right Mouse%x" STRINGIFY(RIGHTMOUSE)
+       "|Middle Mouse%x" STRINGIFY(MIDDLEMOUSE)
+       "|Right Mouse%x" STRINGIFY(RIGHTMOUSE)
+       "|Button4 Mouse%x" STRINGIFY(BUTTON4MOUSE)
+       "|Button5 Mouse%x" STRINGIFY(BUTTON5MOUSE)
+       "|Action Mouse%x" STRINGIFY(ACTIONMOUSE)
+       "|Select Mouse%x" STRINGIFY(SELECTMOUSE)
+       "|Mouse Move%x" STRINGIFY(MOUSEMOVE)
+       "|Wheel Up%x" STRINGIFY(WHEELUPMOUSE)
+       "|Wheel Down%x" STRINGIFY(WHEELDOWNMOUSE)
+       "|Wheel In%x" STRINGIFY(WHEELINMOUSE)
+       "|Wheel Out%x" STRINGIFY(WHEELOUTMOUSE)
+       "|Mouse/Trackpad Pan%x" STRINGIFY(MOUSEPAN)
+       "|Mouse/Trackpad Zoom%x" STRINGIFY(MOUSEZOOM)
+       "|Mouse/Trackpad Rotate%x" STRINGIFY(MOUSEROTATE)
+       ;
+
        return string;
 }
 
-static char *keymap_tweak_menu(void)
+static const char *keymap_tweak_menu(void)
 {
-       static char string[500];
-       static char formatstr[] = "|%s %%x%d";
-       char *str= string;
-       
-       str += sprintf(str, "Tweak Event %%t");
-       
-       str += sprintf(str, formatstr, "Left Mouse", EVT_TWEAK_L);
-       str += sprintf(str, formatstr, "Middle Mouse", EVT_TWEAK_M);
-       str += sprintf(str, formatstr, "Right Mouse", EVT_TWEAK_R);
-       str += sprintf(str, formatstr, "Action Mouse", EVT_TWEAK_A);
-       str += sprintf(str, formatstr, "Select Mouse", EVT_TWEAK_S);
-       
+       static const char string[]=
+       "Tweak Event%t"
+       "|Left Mouse%x" STRINGIFY(EVT_TWEAK_L)
+       "|Middle Mouse%x" STRINGIFY(EVT_TWEAK_M)
+       "|Right Mouse%x" STRINGIFY(EVT_TWEAK_R)
+       "|Action Mouse%x" STRINGIFY(EVT_TWEAK_A)
+       "|Select Mouse%x" STRINGIFY(EVT_TWEAK_S)
+       ;
+
        return string;
 }
 
-static char *keymap_tweak_dir_menu(void)
+static const char *keymap_tweak_dir_menu(void)
 {
-       static char string[500];
-       static char formatstr[] = "|%s %%x%d";
-       char *str= string;
-       
-       str += sprintf(str, "Tweak Direction %%t");
-       
-       str += sprintf(str, formatstr, "Any", KM_ANY);
-       str += sprintf(str, formatstr, "North", EVT_GESTURE_N);
-       str += sprintf(str, formatstr, "North-East", EVT_GESTURE_NE);
-       str += sprintf(str, formatstr, "East", EVT_GESTURE_E);
-       str += sprintf(str, formatstr, "Sout-East", EVT_GESTURE_SE);
-       str += sprintf(str, formatstr, "South", EVT_GESTURE_S);
-       str += sprintf(str, formatstr, "South-West", EVT_GESTURE_SW);
-       str += sprintf(str, formatstr, "West", EVT_GESTURE_W);
-       str += sprintf(str, formatstr, "North-West", EVT_GESTURE_NW);
-       
+       static const char string[]=
+       "Tweak Direction%t"
+       "|Any%x" STRINGIFY(KM_ANY)
+       "|North%x" STRINGIFY(EVT_GESTURE_N)
+       "|North-East%x" STRINGIFY(EVT_GESTURE_NE)
+       "|East%x" STRINGIFY(EVT_GESTURE_E)
+       "|Sout-East%x" STRINGIFY(EVT_GESTURE_SE)
+       "|South%x" STRINGIFY(EVT_GESTURE_S)
+       "|South-West%x" STRINGIFY(EVT_GESTURE_SW)
+       "|West%x" STRINGIFY(EVT_GESTURE_W)
+       "|North-West%x" STRINGIFY(EVT_GESTURE_NW)
+       ;
+
        return string;
 }
 
@@ -5496,7 +5486,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
                tselem= TREESTORE(te);
                if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
                        uiBut *but;
-                       char *str;
+                       const char *str;
                        int xstart= 240;
                        int butw1= 20; /* operator */
                        int butw2= 90; /* event type, menus */
index 0a1d2d3fd749f8eaaaf608e79deec4ed681bbbb0..f475471976151df37f6249608495698cbd0ecd66 100644 (file)
@@ -26,7 +26,6 @@
 
 SET(INC 
                .
-               intern/include
                ..
                ../../
                ../../../blenkernel
index efc31f6f7c389d244cca06d28a987f5691fc0ff0..822b36392ce7820564fe60a51f4725fc1bb553ed 100644 (file)
 #define EVT_TABLET_STYLUS      1
 #define EVT_TABLET_ERASER      2
 
-#define MOUSEX         0x004   
-#define MOUSEY         0x005   
+#define MOUSEX         4
+#define MOUSEY         5
 
 /* MOUSE : 0x00x */
-#define LEFTMOUSE              0x001   
-#define MIDDLEMOUSE            0x002   
-#define RIGHTMOUSE             0x003   
-#define MOUSEMOVE              0x004   
+#define LEFTMOUSE              1
+#define MIDDLEMOUSE            2
+#define RIGHTMOUSE             3
+#define MOUSEMOVE              4
                /* only use if you want user option switch possible */
-#define ACTIONMOUSE            0x005
-#define SELECTMOUSE            0x006
+#define ACTIONMOUSE            5
+#define SELECTMOUSE            6
                /* Extra mouse buttons */
-#define BUTTON4MOUSE   0x007  
-#define BUTTON5MOUSE   0x008
+#define BUTTON4MOUSE   7
+#define BUTTON5MOUSE   8
                /* Extra trackpad gestures */
-#define MOUSEPAN               0x00e
-#define MOUSEZOOM              0x00f
-#define MOUSEROTATE            0x010
+#define MOUSEPAN               14
+#define MOUSEZOOM              15
+#define MOUSEROTATE            16
                /* defaults from ghost */
-#define WHEELUPMOUSE   0x00a   
-#define WHEELDOWNMOUSE 0x00b
+#define WHEELUPMOUSE   10
+#define WHEELDOWNMOUSE 11
                /* mapped with userdef */
-#define WHEELINMOUSE   0x00c
-#define WHEELOUTMOUSE  0x00d
-#define INBETWEEN_MOUSEMOVE    0x011
+#define WHEELINMOUSE   12
+#define WHEELOUTMOUSE  13
+#define INBETWEEN_MOUSEMOVE    17
 
 
 /* SYSTEM : 0x01xx */
 /* test whether event type is acceptable as hotkey, excluding modifiers */
 #define ISHOTKEY(event)        ((ISKEYBOARD(event) || ISMOUSE(event)) && !(event>=LEFTCTRLKEY && event<=LEFTSHIFTKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
 
-/* **************** BLENDER GESTURE EVENTS ********************* */
+/* **************** BLENDER GESTURE EVENTS (0x5000) **************** */
 
-#define EVT_ACTIONZONE_AREA            0x5000
-#define EVT_ACTIONZONE_REGION  0x5001
+#define EVT_ACTIONZONE_AREA            20480
+#define EVT_ACTIONZONE_REGION  20481
 
                /* tweak events, for L M R mousebuttons */
-#define EVT_TWEAK_L            0x5002
-#define EVT_TWEAK_M            0x5003
-#define EVT_TWEAK_R            0x5004
+#define EVT_TWEAK_L            20482
+#define EVT_TWEAK_M            20483
+#define EVT_TWEAK_R            20484
                /* tweak events for action or select mousebutton */
-#define EVT_TWEAK_A            0x5005
-#define EVT_TWEAK_S            0x5006
+#define EVT_TWEAK_A            20485
+#define EVT_TWEAK_S            20486
 
-#define EVT_GESTURE            0x5010
+#define EVT_GESTURE            20496
 
 /* value of tweaks and line gestures, note, KM_ANY (-1) works for this case too */
 #define EVT_GESTURE_N          1