diff options
author | julianeisel <julian_eisel@web.de> | 2014-11-06 19:45:32 +0300 |
---|---|---|
committer | julianeisel <julian_eisel@web.de> | 2014-11-06 19:45:32 +0300 |
commit | a91888206fbef1dd43439986505865d0d1f10935 (patch) | |
tree | 1fa2647dfee0925da31b3c49ac97cb02a89fbf21 /source/blender/editors/space_file/file_draw.c | |
parent | 0c28aaae7e65538f8e6c30a35861dc6c49a84637 (diff) |
Fix T42497: Enlarge rename text field in File Browser
To ensure there's space for more than a few characters in the rename text fields of the File Browser, we now use a width relative to the column width (for all display modes).
Includes some edits from @campbellbarton - thanks for this!
Diffstat (limited to 'source/blender/editors/space_file/file_draw.c')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 3e099b43a4b..20dccc208d4 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -549,8 +549,24 @@ void file_draw_list(const bContext *C, ARegion *ar) UI_ThemeColor4(TH_TEXT); if (file->selflag & EDITING_FILE) { - uiBut *but = uiDefBut(block, TEX, 1, "", sx, sy - layout->tile_h - 0.15f * UI_UNIT_X, - textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit), 0, 0, ""); + uiBut *but; + short width; + + if (params->display == FILE_SHORTDISPLAY) { + width = layout->tile_w - (ICON_DEFAULT_WIDTH_SCALE + 0.2f * UI_UNIT_X); + } + else if (params->display == FILE_LONGDISPLAY) { + width = layout->column_widths[COLUMN_NAME] + layout->column_widths[COLUMN_MODE1] + + layout->column_widths[COLUMN_MODE2] + layout->column_widths[COLUMN_MODE3] + + (column_space * 3.5f); + } + else { + BLI_assert(params->display == FILE_IMGDISPLAY); + width = textwidth; + } + + but = uiDefBut(block, TEX, 1, "", sx, sy - layout->tile_h - 0.15f * UI_UNIT_X, + width, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit), 0, 0, ""); uiButSetRenameFunc(but, renamebutton_cb, file); uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */ uiButClearFlag(but, UI_BUT_UNDO); |