Imported Upstream version 0.35
Andrew Caudwell
12 years ago
0 | 0.35: | |
1 | * Added long file extension truncation handling to file key (--key). | |
2 | * Treat changes in Mercurial log files with the same time/user as one commit. | |
3 | * Fixed handling of spaces in directory names with Mercurial. | |
4 | * Fixed --font-colour option. | |
5 | ||
0 | 6 | 0.34: |
1 | 7 | * Now using VBOs and shaders for faster rendering when OpenGL 2.0 is available. |
2 | 8 | * Eliminated bloom colour banding artifacts (requires OpenGL 2.0). |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.67 for Gource 0.34. | |
2 | # Generated by GNU Autoconf 2.67 for Gource 0.35. | |
3 | 3 | # |
4 | 4 | # Report bugs to <acaudwell@gmail.com>. |
5 | 5 | # |
551 | 551 | # Identity of this package. |
552 | 552 | PACKAGE_NAME='Gource' |
553 | 553 | PACKAGE_TARNAME='gource' |
554 | PACKAGE_VERSION='0.34' | |
555 | PACKAGE_STRING='Gource 0.34' | |
554 | PACKAGE_VERSION='0.35' | |
555 | PACKAGE_STRING='Gource 0.35' | |
556 | 556 | PACKAGE_BUGREPORT='acaudwell@gmail.com' |
557 | 557 | PACKAGE_URL='' |
558 | 558 | |
1283 | 1283 | # Omit some internal or obsolete options to make the list less imposing. |
1284 | 1284 | # This message is too long to be a string in the A/UX 3.1 sh. |
1285 | 1285 | cat <<_ACEOF |
1286 | \`configure' configures Gource 0.34 to adapt to many kinds of systems. | |
1286 | \`configure' configures Gource 0.35 to adapt to many kinds of systems. | |
1287 | 1287 | |
1288 | 1288 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1289 | 1289 | |
1357 | 1357 | |
1358 | 1358 | if test -n "$ac_init_help"; then |
1359 | 1359 | case $ac_init_help in |
1360 | short | recursive ) echo "Configuration of Gource 0.34:";; | |
1360 | short | recursive ) echo "Configuration of Gource 0.35:";; | |
1361 | 1361 | esac |
1362 | 1362 | cat <<\_ACEOF |
1363 | 1363 | |
1464 | 1464 | test -n "$ac_init_help" && exit $ac_status |
1465 | 1465 | if $ac_init_version; then |
1466 | 1466 | cat <<\_ACEOF |
1467 | Gource configure 0.34 | |
1467 | Gource configure 0.35 | |
1468 | 1468 | generated by GNU Autoconf 2.67 |
1469 | 1469 | |
1470 | 1470 | Copyright (C) 2010 Free Software Foundation, Inc. |
2051 | 2051 | This file contains any messages produced by compilers while |
2052 | 2052 | running configure, to aid debugging if configure makes a mistake. |
2053 | 2053 | |
2054 | It was created by Gource $as_me 0.34, which was | |
2054 | It was created by Gource $as_me 0.35, which was | |
2055 | 2055 | generated by GNU Autoconf 2.67. Invocation command line was |
2056 | 2056 | |
2057 | 2057 | $ $0 $@ |
2868 | 2868 | |
2869 | 2869 | # Define the identity of the package. |
2870 | 2870 | PACKAGE='gource' |
2871 | VERSION='0.34' | |
2871 | VERSION='0.35' | |
2872 | 2872 | |
2873 | 2873 | |
2874 | 2874 | cat >>confdefs.h <<_ACEOF |
7395 | 7395 | # report actual input values of CONFIG_FILES etc. instead of their |
7396 | 7396 | # values after options handling. |
7397 | 7397 | ac_log=" |
7398 | This file was extended by Gource $as_me 0.34, which was | |
7398 | This file was extended by Gource $as_me 0.35, which was | |
7399 | 7399 | generated by GNU Autoconf 2.67. Invocation command line was |
7400 | 7400 | |
7401 | 7401 | CONFIG_FILES = $CONFIG_FILES |
7452 | 7452 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
7453 | 7453 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
7454 | 7454 | ac_cs_version="\\ |
7455 | Gource config.status 0.34 | |
7455 | Gource config.status 0.35 | |
7456 | 7456 | configured by $0, generated by GNU Autoconf 2.67, |
7457 | 7457 | with options \\"\$ac_cs_config\\" |
7458 | 7458 |
2 | 2 | |
3 | 3 | AC_PREREQ(2.61) |
4 | 4 | |
5 | AC_INIT(Gource, 0.34, [acaudwell@gmail.com]) | |
5 | AC_INIT(Gource, 0.35, [acaudwell@gmail.com]) | |
6 | 6 | AC_CONFIG_SRCDIR([src/main.h]) |
7 | 7 | |
8 | 8 | AM_INIT_AUTOMAKE([dist-bzip2 foreign subdir-objects]) |
79 | 79 | RCommitLog::~RCommitLog() { |
80 | 80 | if(logf!=0) delete logf; |
81 | 81 | |
82 | if(temp_file.size()) { | |
82 | if(!temp_file.empty()) { | |
83 | 83 | remove(temp_file.c_str()); |
84 | 84 | } |
85 | 85 | } |
146 | 146 | } |
147 | 147 | |
148 | 148 | bool RCommitLog::getNextLine(std::string& line) { |
149 | if(lastline.size()>0) { | |
149 | if(!lastline.empty()) { | |
150 | 150 | line = lastline; |
151 | 151 | lastline = std::string(""); |
152 | 152 | return true; |
68 | 68 | |
69 | 69 | void Camera::focus() { |
70 | 70 | display.mode3D(fov, znear, zfar); |
71 | glMatrixMode(GL_PROJECTION); | |
72 | ||
73 | 71 | look(); |
74 | 72 | } |
75 | 73 | |
76 | 74 | void Camera::focusOn(vec3f p) { |
77 | 75 | display.mode3D(fov, znear, zfar); |
78 | glMatrixMode(GL_PROJECTION); | |
79 | ||
80 | 76 | lookAt(p); |
81 | 77 | } |
82 | 78 |
30 | 30 | |
31 | 31 | //ShaderManager |
32 | 32 | |
33 | Regex Shader_pre_include("\\s*#include\\s*\"([^\"]+)\""); | |
34 | ||
33 | 35 | Shader* ShaderManager::grab(const std::string& shader_prefix) { |
34 | 36 | Resource* s = resources[shader_prefix]; |
35 | 37 | |
45 | 47 | |
46 | 48 | //Shader |
47 | 49 | Shader::Shader(const std::string& prefix) : Resource(prefix) { |
50 | ||
48 | 51 | std::string shader_dir = shadermanager.getDir(); |
49 | 52 | |
50 | 53 | std::string vertexSrc = shader_dir + prefix + std::string(".vert"); |
99 | 102 | } |
100 | 103 | |
101 | 104 | GLenum Shader::load(const std::string& filename, GLenum shaderType) { |
102 | std::string source = readSource(filename); | |
103 | ||
104 | if(source.size()==0) { | |
105 | ||
106 | std::string source; | |
107 | readSource(filename, source); | |
108 | ||
109 | if(source.empty()) { | |
105 | 110 | throw SDLAppException("could not read shader '%s'", filename.c_str()); |
106 | 111 | } |
107 | 112 | |
119 | 124 | return shaderRef; |
120 | 125 | } |
121 | 126 | |
122 | std::string Shader::readSource(const std::string& file) { | |
123 | ||
124 | std::string source; | |
127 | ||
128 | bool Shader::preprocess(const std::string& line, std::string& output) { | |
129 | ||
130 | std::vector<std::string> matches; | |
131 | ||
132 | if(Shader_pre_include.match(line, &matches)) { | |
133 | ||
134 | std::string include_file = shadermanager.getDir() + matches[0]; | |
135 | ||
136 | readSource(include_file, output); | |
137 | ||
138 | return true; | |
139 | } | |
140 | ||
141 | return false; | |
142 | ||
143 | } | |
144 | ||
145 | bool Shader::readSource(const std::string& file, std::string& output) { | |
125 | 146 | |
126 | 147 | // get length |
127 | 148 | std::ifstream in(file.c_str()); |
128 | 149 | |
129 | if(!in.is_open()) return source; | |
150 | if(!in.is_open()) { | |
151 | throw SDLAppException("could not open '%s'", file.c_str()); | |
152 | } | |
130 | 153 | |
131 | 154 | std::string line; |
132 | 155 | while( std::getline(in,line) ) { |
133 | source += line; | |
134 | source += "\n"; | |
156 | if(!preprocess(line, output)) { | |
157 | output += line; | |
158 | output += "\n"; | |
159 | } | |
135 | 160 | } |
136 | 161 | |
137 | 162 | in.close(); |
138 | ||
139 | return source; | |
163 | ||
164 | return true; | |
140 | 165 | } |
141 | 166 | |
142 | 167 | void Shader::use() { |
32 | 32 | #include "resource.h" |
33 | 33 | #include "display.h" |
34 | 34 | #include "sdlapp.h" |
35 | #include "regex.h" | |
35 | 36 | |
36 | 37 | #include <map> |
37 | 38 | #include <string> |
47 | 48 | |
48 | 49 | GLint getVarLocation(const std::string& name); |
49 | 50 | |
50 | std::string readSource(const std::string& filename); | |
51 | bool preprocess(const std::string& line, std::string& output); | |
52 | bool readSource(const std::string& filename, std::string& output); | |
51 | 53 | GLenum load(const std::string& filename, GLenum shaderType); |
52 | 54 | void makeProgram(); |
53 | 55 |
41 | 41 | |
42 | 42 | bool CustomLog::parseCommit(RCommit& commit) { |
43 | 43 | |
44 | while(readCustomCommit(commit)); | |
44 | while(parseCommitEntry(commit)); | |
45 | 45 | |
46 | return commit.files.size() > 0; | |
46 | return !commit.files.empty(); | |
47 | 47 | } |
48 | 48 | |
49 | bool CustomLog::readCustomCommit(RCommit& commit) { | |
49 | bool CustomLog::parseCommitEntry(RCommit& commit) { | |
50 | 50 | |
51 | 51 | std::string line; |
52 | 52 | std::vector<std::string> entries; |
61 | 61 | std::string username = (entries[1].size()>0) ? entries[1] : "Unknown"; |
62 | 62 | std::string action = (entries[2].size()>0) ? entries[2] : "A"; |
63 | 63 | |
64 | //if this file is for the same person and timestamp | |
65 | //we add to the commit, else we save the lastline | |
66 | //and return false | |
67 | if(commit.files.empty()) { | |
68 | commit.timestamp = timestamp; | |
69 | commit.username = username; | |
70 | } else { | |
71 | if(commit.timestamp != timestamp || commit.username != username) { | |
72 | lastline = line; | |
73 | return false; | |
74 | } | |
75 | } | |
76 | ||
64 | 77 | bool has_colour = false; |
65 | 78 | vec3f colour; |
66 | 79 | |
67 | 80 | if(entries.size()>=5 && entries[4].size()>0) { |
68 | 81 | has_colour = true; |
69 | 82 | colour = parseColour(entries[4]); |
70 | } | |
71 | ||
72 | //if this file is for the same person and timestamp | |
73 | //we add to the commit, else we save the lastline | |
74 | //and return false | |
75 | if(commit.files.size() > 0 | |
76 | && (commit.timestamp != timestamp | |
77 | || commit.username != username)) { | |
78 | lastline = line; | |
79 | return false; | |
80 | } | |
81 | ||
82 | if(commit.files.size() == 0) { | |
83 | commit.timestamp = timestamp; | |
84 | commit.username = username; | |
85 | 83 | } |
86 | 84 | |
87 | 85 | if(has_colour) { |
21 | 21 | |
22 | 22 | class CustomLog : public RCommitLog { |
23 | 23 | protected: |
24 | ||
25 | bool readCustomCommit(RCommit& commit); | |
26 | ||
24 | bool parseCommit(RCommit& commit); | |
25 | bool parseCommitEntry(RCommit& commit); | |
27 | 26 | vec3f parseColour(const std::string& cstr); |
28 | bool parseCommit(RCommit& commit); | |
29 | 27 | public: |
30 | 28 | CustomLog(const std::string& logfile); |
31 | 29 | }; |
1856 | 1856 | |
1857 | 1857 | updateAndDrawEdges(); |
1858 | 1858 | |
1859 | draw_edges_time = SDL_GetTicks() - draw_edges_time; | |
1859 | draw_edges_time = SDL_GetTicks() - draw_edges_time; | |
1860 | 1860 | |
1861 | 1861 | //draw shadows |
1862 | 1862 | |
1904 | 1904 | |
1905 | 1905 | void Gource::updateAndDrawEdges() { |
1906 | 1906 | if(gGourceSettings.hide_tree) return; |
1907 | ||
1907 | ||
1908 | 1908 | root->calcEdges(); |
1909 | 1909 | |
1910 | 1910 | //switch to 2d |
1944 | 1944 | glUseProgramObjectARB(0); |
1945 | 1945 | |
1946 | 1946 | edge_vbo.draw(); |
1947 | ||
1947 | ||
1948 | 1948 | } else { |
1949 | 1949 | root->drawEdgeShadows(); |
1950 | 1950 | root->drawEdges(); |
2238 | 2238 | glLoadIdentity(); |
2239 | 2239 | |
2240 | 2240 | camera.focus(); |
2241 | ||
2242 | glMatrixMode(GL_MODELVIEW); | |
2243 | glLoadIdentity(); | |
2244 | 2241 | |
2245 | 2242 | //check visibility |
2246 | 2243 | root->checkFrustum(frustum); |
2448 | 2445 | |
2449 | 2446 | // text using the specified font goes here |
2450 | 2447 | |
2451 | glColor4f(gGourceSettings.font_colour.x, gGourceSettings.font_colour.y, gGourceSettings.font_colour.z, 1.0f); | |
2452 | ||
2448 | fontmedium.setColour(vec4f(gGourceSettings.font_colour, 1.0f)); | |
2449 | ||
2453 | 2450 | if(!gGourceSettings.hide_date) { |
2454 | 2451 | fontmedium.draw(display.width/2 - date_x_offset, 20, displaydate); |
2455 | 2452 | } |
17 | 17 | #ifndef GOURCE_SETTINGS_H |
18 | 18 | #define GOURCE_SETTINGS_H |
19 | 19 | |
20 | #define GOURCE_VERSION "0.34" | |
20 | #define GOURCE_VERSION "0.35" | |
21 | 21 | |
22 | 22 | #include <dirent.h> |
23 | 23 |
24 | 24 | |
25 | 25 | std::string gource_style_path = gSDLAppResourceDir + std::string("gource.style"); |
26 | 26 | |
27 | return std::string("hg log -r 0:tip --style ") + gource_style_path; | |
27 | return std::string("hg log -r 0:tip --style \"") + gource_style_path + std::string("\""); | |
28 | 28 | } |
29 | 29 | |
30 | 30 | MercurialLog::MercurialLog(const std::string& logfile) : RCommitLog(logfile) { |
44 | 44 | |
45 | 45 | BaseLog* MercurialLog::generateLog(const std::string& dir) { |
46 | 46 | |
47 | //does directory have a .git ? | |
47 | //does directory have a .hg ? | |
48 | 48 | std::string hgdir = dir + std::string("/.hg"); |
49 | 49 | struct stat dirinfo; |
50 | 50 | int stat_rc = stat(hgdir.c_str(), &dirinfo); |
59 | 59 | if(temp_file.size()==0) return 0; |
60 | 60 | |
61 | 61 | char cmd_buff[2048]; |
62 | sprintf(cmd_buff, "%s -R %s > %s", command.c_str(), dir.c_str(), temp_file.c_str()); | |
62 | sprintf(cmd_buff, "%s -R \"%s\" > %s", command.c_str(), dir.c_str(), temp_file.c_str()); | |
63 | 63 | |
64 | 64 | int command_rc = system(cmd_buff); |
65 | 65 | |
75 | 75 | |
76 | 76 | bool MercurialLog::parseCommit(RCommit& commit) { |
77 | 77 | |
78 | while(parseCommitEntry(commit)); | |
79 | ||
80 | return !commit.files.empty(); | |
81 | } | |
82 | ||
83 | bool MercurialLog::parseCommitEntry(RCommit& commit) { | |
84 | ||
78 | 85 | std::string line; |
79 | 86 | std::vector<std::string> entries; |
80 | 87 | |
83 | 90 | //custom line |
84 | 91 | if(!hg_regex.match(line, &entries)) return false; |
85 | 92 | |
86 | commit.timestamp = atol(entries[0].c_str()); | |
93 | time_t timestamp = atol(entries[0].c_str()); | |
94 | std::string username = entries[1]; | |
87 | 95 | |
88 | commit.username = entries[1]; | |
89 | ||
96 | //if this file is for the same person and timestamp | |
97 | //we add to the commit, else we save the lastline | |
98 | //and return false | |
99 | if(commit.files.empty()) { | |
100 | commit.timestamp = timestamp; | |
101 | commit.username = username; | |
102 | } else { | |
103 | if(commit.timestamp != timestamp || commit.username != username) { | |
104 | lastline = line; | |
105 | return false; | |
106 | } | |
107 | } | |
108 | ||
90 | 109 | std::string action = "A"; |
91 | 110 | |
92 | if(entries[2].size()>0) { | |
111 | if(!entries[2].empty()) { | |
93 | 112 | action = entries[2]; |
94 | 113 | } |
95 | 114 | |
96 | bool has_colour = false; | |
97 | vec3f colour; | |
98 | ||
99 | // debugLog("file = %s, timestamp=%d, username=%s, action=%s\n", entries[3].c_str(), | |
100 | // commit.timestamp, commit.username.c_str(), action.c_str()); | |
101 | ||
102 | if(has_colour) { | |
103 | commit.addFile(entries[3], action, colour); | |
104 | } else { | |
105 | commit.addFile(entries[3], action); | |
106 | } | |
115 | commit.addFile(entries[3], action); | |
107 | 116 | |
108 | 117 | //commit.debug(); |
109 | 118 |
24 | 24 | class MercurialLog : public RCommitLog { |
25 | 25 | protected: |
26 | 26 | bool parseCommit(RCommit& commit); |
27 | bool parseCommitEntry(RCommit& commit); | |
27 | 28 | BaseLog* generateLog(const std::string& dir); |
28 | 29 | public: |
29 | 30 | MercurialLog(const std::string& logfile); |
25 | 25 | dest_y = -1.0f; |
26 | 26 | |
27 | 27 | show = true; |
28 | ||
29 | display_ext = ext; | |
30 | ||
31 | bool truncated = false; | |
32 | ||
33 | while(font.getWidth(display_ext) > width - 15.0f) { | |
34 | display_ext.resize(display_ext.size()-1); | |
35 | truncated = true; | |
36 | } | |
37 | ||
38 | if(truncated) { | |
39 | display_ext += std::string("..."); | |
40 | } | |
28 | 41 | } |
29 | 42 | |
30 | 43 | const vec3f& FileKeyEntry::getColour() const { |
131 | 144 | font.setColour(vec4f(1.0f, 1.0f, 1.0f, alpha)); |
132 | 145 | |
133 | 146 | font.dropShadow(false); |
134 | font.draw((int)pos.x+2, (int)pos.y+3, ext.c_str()); | |
147 | font.draw((int)pos.x+2, (int)pos.y+3, display_ext.c_str()); | |
135 | 148 | |
136 | 149 | font.dropShadow(true); |
137 | 150 | font.print((int)pos.x+width+4, (int)pos.y+3, "%d", count); |