Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-05-04 22:12:28 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-05-04 22:13:35 +0300
commitcc81b58277dcea68587d3ff2f4a3ee8a6b28c074 (patch)
tree67558018dbd0892b0cc4268a4d23e90706b8c3d4 /source/blender/editors/space_file/filesel.c
parente10ecb6494e99e5880a1bad296464a2475feac8e (diff)
Cleanup: deduplicate code.
FileBrowser had its own 'shorten_string' func, when we have a full fledge one in interface_widget code...
Diffstat (limited to 'source/blender/editors/space_file/filesel.c')
-rw-r--r--source/blender/editors/space_file/filesel.c52
1 files changed, 0 insertions, 52 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 82409c9ecb4..29a8a06fa23 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -398,58 +398,6 @@ void ED_fileselect_layout_tilepos(FileLayout *layout, int tile, int *x, int *y)
}
}
-/* Shorten a string to a given width w.
- * If front is set, shorten from the front,
- * otherwise shorten from the end. */
-float file_shorten_string(char *string, float w, int front)
-{
- char temp[FILE_MAX];
- short shortened = 0;
- float sw = 0;
- float pad = 0;
-
- if (w <= 0) {
- *string = '\0';
- return 0.0;
- }
-
- sw = file_string_width(string);
- if (front == 1) {
- const char *s = string;
- BLI_strncpy(temp, "...", 4);
- pad = file_string_width(temp);
- while ((*s) && (sw + pad > w)) {
- s++;
- sw = file_string_width(s);
- shortened = 1;
- }
- if (shortened) {
- int slen = strlen(s);
- BLI_strncpy(temp + 3, s, slen + 1);
- temp[slen + 4] = '\0';
- BLI_strncpy(string, temp, slen + 4);
- }
- }
- else {
- const char *s = string;
- while (sw > w) {
- int slen = strlen(string);
- string[slen - 1] = '\0';
- sw = file_string_width(s);
- shortened = 1;
- }
-
- if (shortened) {
- int slen = strlen(string);
- if (slen > 3) {
- BLI_strncpy(string + slen - 3, "...", 4);
- }
- }
- }
-
- return sw;
-}
-
float file_string_width(const char *str)
{
uiStyle *style = UI_style_get();