Move request code to new request module
[tig.git] / include / request.h
blob84c636ecc2d7072dce06e0a351fb6a24fcbbbe24
1 /* Copyright (c) 2006-2014 Jonas Fonseca <fonseca@diku.dk>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef TIG_REQUEST_H
15 #define TIG_REQUEST_H
17 #include "tig.h"
20 * User requests
23 #define VIEW_REQ(id, name, ref) REQ_(VIEW_##id, "Show " #name " view")
25 #define REQ_INFO \
26 REQ_GROUP("View switching") \
27 VIEW_INFO(VIEW_REQ), \
29 REQ_GROUP("View manipulation") \
30 REQ_(ENTER, "Enter current line and scroll"), \
31 REQ_(BACK, "Go back to the previous view state"), \
32 REQ_(NEXT, "Move to next"), \
33 REQ_(PREVIOUS, "Move to previous"), \
34 REQ_(PARENT, "Move to parent"), \
35 REQ_(VIEW_NEXT, "Move focus to next view"), \
36 REQ_(REFRESH, "Reload and refresh"), \
37 REQ_(MAXIMIZE, "Maximize the current view"), \
38 REQ_(VIEW_CLOSE, "Close the current view"), \
39 REQ_(QUIT, "Close all views and quit"), \
41 REQ_GROUP("View specific requests") \
42 REQ_(STATUS_UPDATE, "Update file status"), \
43 REQ_(STATUS_REVERT, "Revert file changes"), \
44 REQ_(STATUS_MERGE, "Merge file using external tool"), \
45 REQ_(STAGE_UPDATE_LINE, "Update single line"), \
46 REQ_(STAGE_NEXT, "Find next chunk to stage"), \
47 REQ_(STAGE_SPLIT_CHUNK, "Split the current chunk"), \
48 REQ_(DIFF_CONTEXT_DOWN, "Decrease the diff context"), \
49 REQ_(DIFF_CONTEXT_UP, "Increase the diff context"), \
51 REQ_GROUP("Cursor navigation") \
52 REQ_(MOVE_UP, "Move cursor one line up"), \
53 REQ_(MOVE_DOWN, "Move cursor one line down"), \
54 REQ_(MOVE_PAGE_DOWN, "Move cursor one page down"), \
55 REQ_(MOVE_PAGE_UP, "Move cursor one page up"), \
56 REQ_(MOVE_FIRST_LINE, "Move cursor to first line"), \
57 REQ_(MOVE_LAST_LINE, "Move cursor to last line"), \
59 REQ_GROUP("Scrolling") \
60 REQ_(SCROLL_FIRST_COL, "Scroll to the first line columns"), \
61 REQ_(SCROLL_LEFT, "Scroll two columns left"), \
62 REQ_(SCROLL_RIGHT, "Scroll two columns right"), \
63 REQ_(SCROLL_LINE_UP, "Scroll one line up"), \
64 REQ_(SCROLL_LINE_DOWN, "Scroll one line down"), \
65 REQ_(SCROLL_PAGE_UP, "Scroll one page up"), \
66 REQ_(SCROLL_PAGE_DOWN, "Scroll one page down"), \
68 REQ_GROUP("Searching") \
69 REQ_(SEARCH, "Search the view"), \
70 REQ_(SEARCH_BACK, "Search backwards in the view"), \
71 REQ_(FIND_NEXT, "Find next search match"), \
72 REQ_(FIND_PREV, "Find previous search match"), \
74 REQ_GROUP("Option manipulation") \
75 REQ_(OPTIONS, "Open option menu"), \
76 REQ_(TOGGLE_LINENO, "Toggle line numbers"), \
77 REQ_(TOGGLE_DATE, "Toggle date display"), \
78 REQ_(TOGGLE_AUTHOR, "Toggle author display"), \
79 REQ_(TOGGLE_REV_GRAPH, "Toggle revision graph visualization"), \
80 REQ_(TOGGLE_GRAPHIC, "Toggle (line) graphics mode"), \
81 REQ_(TOGGLE_FILENAME, "Toggle file name display"), \
82 REQ_(TOGGLE_REFS, "Toggle reference display (tags/branches)"), \
83 REQ_(TOGGLE_CHANGES, "Toggle local changes display in the main view"), \
84 REQ_(TOGGLE_SORT_ORDER, "Toggle ascending/descending sort order"), \
85 REQ_(TOGGLE_SORT_FIELD, "Toggle field to sort by"), \
86 REQ_(TOGGLE_IGNORE_SPACE, "Toggle ignoring whitespace in diffs"), \
87 REQ_(TOGGLE_COMMIT_ORDER, "Toggle commit ordering"), \
88 REQ_(TOGGLE_ID, "Toggle commit ID display"), \
89 REQ_(TOGGLE_FILES, "Toggle file filtering"), \
90 REQ_(TOGGLE_TITLE_OVERFLOW, "Toggle highlighting of commit title overflow"), \
91 REQ_(TOGGLE_FILE_SIZE, "Toggle file size format"), \
92 REQ_(TOGGLE_UNTRACKED_DIRS, "Toggle display of files in untracked directories"), \
93 REQ_(TOGGLE_VERTICAL_SPLIT, "Toggle vertical split"), \
95 REQ_GROUP("Misc") \
96 REQ_(EDIT, "Open in editor"), \
97 REQ_(PROMPT, "Bring up the prompt"), \
98 REQ_(SCREEN_REDRAW, "Redraw the screen"), \
99 REQ_(SHOW_VERSION, "Show version information"), \
100 REQ_(STOP_LOADING, "Stop all loading views"), \
101 REQ_(NONE, "Do nothing")
104 /* User action requests. */
105 enum request {
106 #define REQ_GROUP(help)
107 #define REQ_(req, help) REQ_##req
109 /* Offset all requests to avoid conflicts with ncurses getch values. */
110 REQ_UNKNOWN = KEY_MAX + 1,
111 REQ_OFFSET,
112 REQ_INFO,
114 /* Internal requests. */
115 REQ_JUMP_COMMIT,
116 REQ_SCROLL_WHEEL_DOWN,
117 REQ_SCROLL_WHEEL_UP,
119 /* Start of the run request IDs */
120 REQ_RUN_REQUESTS
122 #undef REQ_GROUP
123 #undef REQ_
126 struct request_info {
127 enum request request;
128 const char *name;
129 int namelen;
130 const char *help;
133 enum request get_request(const char *name);
134 bool foreach_request(bool (*visitor)(void *data, const struct request_info *req_info, const char *group), void *data);
136 #endif
137 /* vim: set ts=8 sw=8 noexpandtab: */