AmendHub

Download

jcs

/

amend

/

browser.h

 

(View History)

jcs   committer: If "All Files" is selected, skip diffing unchanged files Latest amendment: 33 on 2021-12-15

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_COMMIT_LIST,
30 BROWSER_STATE_OPEN_COMMITTER,
31 BROWSER_STATE_COMMITTER_DO_DIFF,
32 BROWSER_STATE_WAITING_FOR_COMMITTER,
33 BROWSER_STATE_REMOVE_FILE,
34 BROWSER_STATE_REVERT_FILE,
35 BROWSER_STATE_EXPORT_PATCH,
36 BROWSER_STATE_APPLY_PATCH
37 };
38
39 struct browser {
40 short state;
41 WindowPtr win;
42 struct repo *repo;
43 ListHandle file_list;
44 ListHandle commit_list;
45 TEHandle diff_te;
46 ControlHandle diff_scroller;
47 ControlHandle diff_button;
48 struct committer *committer;
49 };
50
51 struct browser *browser_init(struct repo *repo);
52 void browser_close(struct browser *browser);
53 void browser_update_titlebar(struct browser *browser);
54 void browser_close(struct browser *browser);
55 void browser_close_committer(struct browser *browser);
56 void browser_idle(struct browser *browser);
57 void browser_update_menu(struct browser *browser);
58 void browser_update(struct browser *browser, EventRecord *event);
59 void browser_show_commit(struct browser *browser,
60 struct repo_commit *commit);
61 void browser_export_patch(struct browser *browser);
62 short browser_is_all_files_selected(struct browser *browser);
63 short browser_selected_file_ids(struct browser *browser,
64 short **selected_files);
65 void browser_mouse_down(struct browser *browser, EventRecord *event);
66 void browser_apply_patch(struct browser *browser);
67
68 pascal void commit_list_ldef(short message, Boolean selected,
69 Rect *cellRect, Cell theCell, short dataOffset, short dataLen,
70 ListHandle theList);
71
72 #endif