[Bf-blender-cvs] [b1e2f8b] master: Fix T48426: Use same length for all header message strings.

Bastien Montagne noreply at git.blender.org
Sat May 14 10:03:27 CEST 2016


Commit: b1e2f8be2371eeeed3300d42e796f6cf7901e8d9
Author: Bastien Montagne
Date:   Sat May 14 10:00:52 2016 +0200
Branches: master
https://developer.blender.org/rBb1e2f8be2371eeeed3300d42e796f6cf7901e8d9

Fix T48426: Use same length for all header message strings.

Some languages like Chinese or Japanese take three or four bytes per char...

Also fixed some missing translation markers for UI header messages.

===================================================================

M	source/blender/editors/animation/anim_markers.c
M	source/blender/editors/armature/pose_lib.c
M	source/blender/editors/armature/pose_slide.c
M	source/blender/editors/gpencil/gpencil_brush.c
M	source/blender/editors/mesh/editmesh_bevel.c
M	source/blender/editors/mesh/editmesh_inset.c
M	source/blender/editors/mesh/editmesh_loopcut.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/space_node/node_relationships.c
M	source/blender/editors/space_sequencer/sequencer_edit.c
M	source/blender/editors/space_view3d/view3d_ruler.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/uvedit/uvedit_smart_stitch.c
M	source/blender/editors/uvedit/uvedit_unwrap_ops.c
M	source/blender/windowmanager/intern/wm_operators.c

===================================================================

diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 40376c3..823cde7 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -39,6 +39,8 @@
 #include "BLI_math_base.h"
 #include "BLI_utildefines.h"
 
+#include "BLT_translation.h"
+
 #include "BKE_context.h"
 #include "BKE_fcurve.h"
 #include "BKE_main.h"
@@ -685,7 +687,7 @@ static void ed_marker_move_update_header(bContext *C, wmOperator *op)
 	MarkerMove *mm = op->customdata;
 	TimeMarker *marker, *selmarker = NULL;
 	const int offs = RNA_int_get(op->ptr, "frames");
-	char str[256];
+	char str[UI_MAX_DRAW_STR];
 	char str_offs[NUM_STR_REP_LEN];
 	int totmark;
 	const bool use_time = ed_marker_move_use_time(mm);
@@ -710,14 +712,14 @@ static void ed_marker_move_update_header(bContext *C, wmOperator *op)
 	if (totmark == 1 && selmarker) {
 		/* we print current marker value */
 		if (use_time) {
-			BLI_snprintf(str, sizeof(str), "Marker %.2f offset %s", FRA2TIME(selmarker->frame), str_offs);
+			BLI_snprintf(str, sizeof(str), IFACE_("Marker %.2f offset %s"), FRA2TIME(selmarker->frame), str_offs);
 		}
 		else {
-			BLI_snprintf(str, sizeof(str), "Marker %d offset %s", selmarker->frame, str_offs);
+			BLI_snprintf(str, sizeof(str), IFACE_("Marker %d offset %s"), selmarker->frame, str_offs);
 		}
 	}
 	else {
-		BLI_snprintf(str, sizeof(str), "Marker offset %s", str_offs);
+		BLI_snprintf(str, sizeof(str), IFACE_("Marker offset %s"), str_offs);
 	}
 
 	ED_area_headerprint(CTX_wm_area(C), str);
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index a984e5d..dca9aa3 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -762,7 +762,7 @@ typedef struct tPoseLib_PreviewData {
 	char searchstr[64];     /* (Part of) Name to search for to filter poses that get shown */
 	char searchold[64];     /* Previously set searchstr (from last loop run), so that we can detected when to rebuild searchp */
 	
-	char headerstr[200];    /* Info-text to print in header */
+	char headerstr[UI_MAX_DRAW_STR];    /* Info-text to print in header */
 } tPoseLib_PreviewData;
 
 /* defines for tPoseLib_PreviewData->state values */
@@ -1016,7 +1016,7 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
 	if (pld->state == PL_PREVIEW_RUNNING) {
 		if (pld->flag & PL_PREVIEW_SHOWORIGINAL) {
 			BLI_strncpy(pld->headerstr,
-			            "PoseLib Previewing Pose: [Showing Original Pose] | Use Tab to start previewing poses again",
+			            IFACE_("PoseLib Previewing Pose: [Showing Original Pose] | Use Tab to start previewing poses again"),
 			            sizeof(pld->headerstr));
 			ED_area_headerprint(pld->sa, pld->headerstr);
 		}
@@ -1041,16 +1041,16 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
 			BLI_strncpy(markern, pld->marker ? pld->marker->name : "No Matches", sizeof(markern));
 
 			BLI_snprintf(pld->headerstr, sizeof(pld->headerstr),
-			             "PoseLib Previewing Pose: Filter - [%s] | "
-			             "Current Pose - \"%s\"  | "
-			             "Use ScrollWheel or PageUp/Down to change",
+			             IFACE_("PoseLib Previewing Pose: Filter - [%s] | "
+			                    "Current Pose - \"%s\"  | "
+			                    "Use ScrollWheel or PageUp/Down to change"),
 			             tempstr, markern);
 			ED_area_headerprint(pld->sa, pld->headerstr);
 		}
 		else {
 			BLI_snprintf(pld->headerstr, sizeof(pld->headerstr),
-			             "PoseLib Previewing Pose: \"%s\"  | "
-			             "Use ScrollWheel or PageUp/Down to change",
+			             IFACE_("PoseLib Previewing Pose: \"%s\"  | "
+			                    "Use ScrollWheel or PageUp/Down to change"),
 			             pld->marker->name);
 			ED_area_headerprint(pld->sa, pld->headerstr);
 		}
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index 16ba148..9ef46c6 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -51,6 +51,8 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "UI_interface.h"
+
 #include "ED_armature.h"
 #include "ED_keyframes_draw.h"
 #include "ED_markers.h"
@@ -544,7 +546,7 @@ static void pose_slide_reset(tPoseSlideOp *pso)
 /* draw percentage indicator in header */
 static void pose_slide_draw_status(tPoseSlideOp *pso)
 {
-	char status_str[256];
+	char status_str[UI_MAX_DRAW_STR];
 	char mode_str[32];
 	
 	switch (pso->mode) {
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 561a8e4..df05397 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -906,7 +906,7 @@ static void gpencil_toggle_brush_cursor(bContext *C, bool enable)
 static void gpsculpt_brush_header_set(bContext *C, tGP_BrushEditData *gso)
 {
 	const char *brush_name = NULL;
-	char str[256] = "";
+	char str[UI_MAX_DRAW_STR] = "";
 	
 	RNA_enum_name(rna_enum_gpencil_sculpt_brush_items, gso->brush_type, &brush_name);
 	
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index 37e9a0e..242cbf7 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -44,6 +44,8 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "UI_interface.h"
+
 #include "ED_mesh.h"
 #include "ED_numinput.h"
 #include "ED_screen.h"
@@ -72,14 +74,12 @@ typedef struct {
 	float segments;     /* Segments as float so smooth mouse pan works in small increments */
 } BevelData;
 
-#define HEADER_LENGTH 180
-
 static void edbm_bevel_update_header(bContext *C, wmOperator *op)
 {
 	const char *str = IFACE_("Confirm: (Enter/LMB), Cancel: (Esc/RMB), Mode: %s (M), Clamp Overlap: %s (C), "
 	                         "Vertex Only: %s (V), Offset: %s, Segments: %d");
 
-	char msg[HEADER_LENGTH];
+	char msg[UI_MAX_DRAW_STR];
 	ScrArea *sa = CTX_wm_area(C);
 	Scene *sce = CTX_data_scene(C);
 
@@ -98,7 +98,7 @@ static void edbm_bevel_update_header(bContext *C, wmOperator *op)
 
 		RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &type_str);
 
-		BLI_snprintf(msg, HEADER_LENGTH, str, type_str,
+		BLI_snprintf(msg, sizeof(msg), str, type_str,
 		             WM_bool_as_string(RNA_boolean_get(op->ptr, "clamp_overlap")),
 		             WM_bool_as_string(RNA_boolean_get(op->ptr, "vertex_only")),
 		             offset_str, RNA_int_get(op->ptr, "segments"));
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index 097117c..3e0747f 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -44,6 +44,8 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "UI_interface.h"
+
 #include "ED_mesh.h"
 #include "ED_numinput.h"
 #include "ED_screen.h"
@@ -54,8 +56,6 @@
 #include "mesh_intern.h"  /* own include */
 
 
-#define HEADER_LENGTH 180
-
 typedef struct {
 	float old_thickness;
 	float old_depth;
@@ -83,7 +83,7 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
 	const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, "
 	                         "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s), Individual (I): (%s)");
 
-	char msg[HEADER_LENGTH];
+	char msg[UI_MAX_DRAW_STR];
 	ScrArea *sa = CTX_wm_area(C);
 	Scene *sce = CTX_data_scene(C);
 
@@ -95,7 +95,7 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
 			BLI_snprintf(flts_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "thickness"));
 			BLI_snprintf(flts_str + NUM_STR_REP_LEN, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "depth"));
 		}
-		BLI_snprintf(msg, HEADER_LENGTH, str,
+		BLI_snprintf(msg, sizeof(msg), str,
 		             flts_str,
 		             flts_str + NUM_STR_REP_LEN,
 		             WM_bool_as_string(opdata->modify_depth),
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 31e1a22..f1c1e41 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -47,6 +47,8 @@
 
 #include "BIF_gl.h"
 
+#include "UI_interface.h"
+
 #include "ED_screen.h"
 #include "ED_space_api.h"
 #include "ED_view3d.h"
@@ -780,7 +782,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
 
 	if (show_cuts) {
 		Scene *sce = CTX_data_scene(C);
-		char buf[64 + NUM_STR_REP_LEN * 2];
+		char buf[UI_MAX_DRAW_STR];
 		char str_rep[NUM_STR_REP_LEN * 2];
 		if (hasNumInput(&lcd->num)) {
 			outputNumInput(&lcd->num, str_rep, &sce->unit);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 3511480..ab8b7d4 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -635,8 +635,8 @@ void ED_area_headerprint(ScrArea *sa, const char *str)
 		if (ar->regiontype == RGN_TYPE_HEADER) {
 			if (str) {
 				if (ar->headerstr == NULL)
-					ar->headerstr = MEM_mallocN(256, "headerprint");
-				BLI_strncpy(ar->headerstr, str, 256);
+					ar->headerstr = MEM_mallocN(UI_MAX_DRAW_STR, "headerprint");
+				BLI_strncpy(ar->headerstr, str, UI_MAX_DRAW_STR);
 			}
 			else if (ar->headerstr) {
 				MEM_freeN(ar->headerstr);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 7d663a0..88b3bc5 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -41,6 +41,7 @@
 #include "BLI_utildefines.h"
 #include "BLI_threads.h"
 
+#include "BLT_translation.h"
 
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
@@ -60,6 +61,7 @@
 #include "BKE_paint.h"
 #include "BKE_texture.h"
 
+#include "UI_interface.h"
 #include "UI_view2d.h"
 
 #include "ED_image.h"
@@ -1167,20 +1169,17 @@ typedef struct {
 
 static void sample_color_update_header(SampleColorData *data, bContext *C)
 {
-#define HEADE

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list