Added keymaps for some sort types.

* PanelSortOrderByName
 * PanelSortOrderByExt
 * PanelSortOrderBySize
 * PanelSortOrderByMTime

Also added 'PanelReverseSort' keymap.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2009-10-01 22:15:25 +03:00
parent 3def4aeb0e
commit 9fa3347fc1
4 changed files with 44 additions and 0 deletions

View File

@ -238,6 +238,12 @@ PanelMoveEnd = alt-gt; end
PanelSelectSortOrder=
PanelToggleSortOrderPrev=
PanelToggleSortOrderNext=
PanelReverseSort=
PanelSortOrderByName=
PanelSortOrderByExt=
PanelSortOrderBySize=
PanelSortOrderByMTime=
[panel:xmap]

View File

@ -341,6 +341,11 @@
#define CK_PanelToggleSortOrderNext 8032
#define CK_PanelToggleSortOrderPrev 8033
#define CK_PanelSelectSortOrder 8034
#define CK_PanelReverseSort 8035
#define CK_PanelSortOrderByName 8036
#define CK_PanelSortOrderByExt 8037
#define CK_PanelSortOrderBySize 8038
#define CK_PanelSortOrderByMTime 8039
/*
Process a block through a shell command: CK_Pipe_Block(i) executes shell_cmd[i].

View File

@ -321,6 +321,11 @@ static const name_key_map_t command_names[] = {
{ "PanelToggleSortOrderNext", CK_PanelToggleSortOrderNext },
{ "PanelToggleSortOrderPrev", CK_PanelToggleSortOrderPrev },
{ "PanelSelectSortOrder", CK_PanelSelectSortOrder },
{ "PanelReverseSort", CK_PanelReverseSort },
{ "PanelSortOrderByName", CK_PanelSortOrderByName },
{ "PanelSortOrderByExt", CK_PanelSortOrderByExt },
{ "PanelSortOrderBySize", CK_PanelSortOrderBySize },
{ "PanelSortOrderByMTime", CK_PanelSortOrderByMTime },
/* widgets */
{ "InputBol", CK_InputBol },

View File

@ -2513,6 +2513,18 @@ panel_select_sort_order(WPanel *panel)
}
static void
panel_set_sort_type_by_id(WPanel *panel, const char *name)
{
const panel_field_t *sort_order;
sort_order = panel_get_field_by_id (name);
if (sort_order == NULL)
return;
panel->current_sort_field = sort_order;
panel_set_sort_order (panel, panel->current_sort_field);
}
typedef void (*panel_key_callback) (WPanel *);
static void cmd_do_enter(WPanel *wp) { (void) do_enter(wp); }
@ -2633,6 +2645,22 @@ panel_execute_cmd (WPanel *panel, int command)
case CK_PanelToggleSortOrderNext:
panel_toggle_sort_order_next(panel);
break;
case CK_PanelReverseSort:
panel->reverse = ! panel->reverse;
panel_set_sort_order (panel, panel->current_sort_field);
break;
case CK_PanelSortOrderByName:
panel_set_sort_type_by_id(panel, "name");
break;
case CK_PanelSortOrderByExt:
panel_set_sort_type_by_id(panel, "extension");
break;
case CK_PanelSortOrderBySize:
panel_set_sort_type_by_id(panel, "size");
break;
case CK_PanelSortOrderByMTime:
panel_set_sort_type_by_id(panel, "mtime");
break;
}
return res;
}