AmendHub

Download

jcs

/

amend

/

browser.h

 

(View History)

jcs   editor: Add amendment metadata editor Latest amendment: 88 on 2022-08-17

1 /*
2 * Copyright (c) 2021 joshua stein <jcs@jcs.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef __BROWSER_H__
18 #define __BROWSER_H__
19
20 #include <stdlib.h>
21
22 #include "committer.h"
23 #include "repo.h"
24
25 enum {
26 BROWSER_STATE_IDLE,
27 BROWSER_STATE_ADD_FILE,
28 BROWSER_STATE_UPDATE_FILE_LIST,
29 BROWSER_STATE_UPDATE_AMENDMENT_LIST,
30 BROWSER_STATE_OPEN_COMMITTER,
31 BROWSER_STATE_WAITING_FOR_COMMITTER,
32 BROWSER_STATE_REMOVE_FILE,
33 BROWSER_STATE_DISCARD_CHANGES,
34 BROWSER_STATE_EXPORT_PATCH,
35 BROWSER_STATE_APPLY_PATCH,
36 BROWSER_STATE_EDIT_AMENDMENT
37 };
38
39 struct browser {
40 short state;
41 WindowPtr win;
42 struct repo *repo;
43 ListHandle file_list;
44 ListHandle amendment_list;
45 TEHandle diff_te;
46 ControlHandle diff_scroller;
47 ControlHandle diff_button;
48 struct committer *committer;
49 bool need_refresh;
50 };
51
52 struct browser *browser_init(struct repo *repo);
53 void browser_update_titlebar(struct browser *browser);
54 void browser_show_amendment(struct browser *browser,
55 struct repo_amendment *amendment);
56 void browser_close_committer(struct browser *browser);
57 void browser_export_patch(struct browser *browser);
58 short browser_is_all_files_selected(struct browser *browser);
59 short browser_selected_file_ids(struct browser *browser,
60 short **selected_files);
61 void browser_apply_patch(struct browser *browser);
62
63 pascal void amendment_list_ldef(short message, Boolean selected,
64 Rect *cellRect, Cell theCell, short dataOffset, short dataLen,
65 ListHandle theList);
66
67 #endif