[Bf-blender-cvs] [c5b872c060a] filebrowser_redesign: Support toggling inverted sorting through column header (3 state)
Julian Eisel
noreply at git.blender.org
Thu Jul 25 02:12:26 CEST 2019
Commit: c5b872c060adc84e69ea953ed5333363468a285d
Author: Julian Eisel
Date: Thu Jul 25 02:09:54 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rBc5b872c060adc84e69ea953ed5333363468a285d
Support toggling inverted sorting through column header (3 state)
===================================================================
M release/scripts/presets/keyconfig/keymap_data/blender_default.py
M source/blender/editors/space_file/file_draw.c
M source/blender/editors/space_file/file_ops.c
===================================================================
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index fd84a4f1fc2..44a52e74a34 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1825,7 +1825,7 @@ def km_file_browser_main(params):
{"properties": [("mode", 'ADD')]}),
("file.rename", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
("file.highlight", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None),
- ("file.sort_column_ui_context", {"type": 'LEFTMOUSE', "value": 'ANY', "any": True}, None),
+ ("file.sort_column_ui_context", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
{"properties": [("increment", 1)]}),
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 0f93bba4591..203c360c958 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -722,7 +722,7 @@ static void draw_columnheader_columns(const FileSelectParams *params,
rgba_uchar_to_float(tri_color, text_col);
UI_draw_icon_tri(sx + column->width - (0.3f * U.widget_unit) - DETAILS_COLUMN_PADDING / 2.0f,
sy + (0.1f * U.widget_unit) - (layout->columnheader_h / 2),
- 'v',
+ (params->flag & FILE_SORT_INVERT) ? 't' : 'v',
tri_color);
}
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 1326a81ef65..c96f2b35436 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1254,7 +1254,14 @@ static int file_column_sort_ui_context_invoke(bContext *C,
const FileDetailsColumn *column = &sfile->layout->details_columns[column_type];
if (column->sort_type != FILE_SORT_NONE) {
- sfile->params->sort = sfile->layout->details_columns[column_type].sort_type;
+ if (sfile->params->sort == column->sort_type) {
+ /* Already sorting by selected column -> toggle sort invert (three state logic). */
+ sfile->params->flag ^= FILE_SORT_INVERT;
+ }
+ else {
+ sfile->params->sort = column->sort_type;
+ sfile->params->flag &= ~FILE_SORT_INVERT;
+ }
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
}
More information about the Bf-blender-cvs
mailing list