Disable graph drawing for reverse log order
[tig.git] / graph.h
blob541f66b967d3daa42eea0bc1e77da3e53eb9c067
1 /* Copyright (c) 2006-2013 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_GRAPH_H
15 #define TIG_GRAPH_H
17 #include "compat/hashtab.h"
19 #define GRAPH_COLORS 7
21 struct graph_symbol {
22 unsigned int color:8;
24 unsigned int commit:1;
25 unsigned int boundary:1;
26 unsigned int initial:1;
27 unsigned int merge:1;
29 unsigned int continued_down:1;
30 unsigned int continued_up:1;
31 unsigned int continued_right:1;
32 unsigned int continued_left:1;
33 unsigned int continued_up_left:1;
35 unsigned int parent_down:1;
36 unsigned int parent_right:1;
38 unsigned int below_commit:1;
39 unsigned int flanked:1;
40 unsigned int next_right:1;
41 unsigned int matches_commit:1;
43 unsigned int shift_left:1;
44 unsigned int continue_shift:1;
45 unsigned int below_shift:1;
47 unsigned int new_column:1;
48 unsigned int empty:1;
51 struct graph_canvas {
52 size_t size; /* The width of the graph array. */
53 struct graph_symbol *symbols; /* Symbols for this row. */
56 struct graph_column {
57 struct graph_symbol symbol;
58 char id[SIZEOF_REV]; /* Parent SHA1 ID. */
61 struct graph_row {
62 size_t size;
63 struct graph_column *columns;
66 struct colors {
67 htab_t id_map;
68 size_t count[GRAPH_COLORS];
71 struct graph {
72 struct graph_row row;
73 struct graph_row parents;
74 struct graph_row prev_row;
75 struct graph_row next_row;
76 size_t position;
77 size_t prev_position;
78 size_t expanded;
79 const char *id;
80 struct graph_canvas *canvas;
81 struct colors colors;
82 bool has_parents;
83 bool is_boundary;
86 void done_graph(struct graph *graph);
88 bool graph_render_parents(struct graph *graph);
89 bool graph_add_commit(struct graph *graph, struct graph_canvas *canvas,
90 const char *id, const char *parents, bool is_boundary);
91 struct graph_column *graph_add_parent(struct graph *graph, const char *parent);
93 const char *graph_symbol_to_ascii(struct graph_symbol *symbol);
94 const char *graph_symbol_to_utf8(struct graph_symbol *symbol);
95 const chtype *graph_symbol_to_chtype(struct graph_symbol *symbol);
97 #endif
99 /* vim: set ts=8 sw=8 noexpandtab: */