Codebase list gource / upstream/0.35
Imported Upstream version 0.35 Andrew Caudwell 12 years ago
15 changed file(s) with 125 addition(s) and 79 deletion(s). Raw diff Collapse all Expand all
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
06 0.34:
17 * Now using VBOs and shaders for faster rendering when OpenGL 2.0 is available.
28 * Eliminated bloom colour banding artifacts (requires OpenGL 2.0).
00 #! /bin/sh
11 # 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.
33 #
44 # Report bugs to <acaudwell@gmail.com>.
55 #
551551 # Identity of this package.
552552 PACKAGE_NAME='Gource'
553553 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'
556556 PACKAGE_BUGREPORT='acaudwell@gmail.com'
557557 PACKAGE_URL=''
558558
12831283 # Omit some internal or obsolete options to make the list less imposing.
12841284 # This message is too long to be a string in the A/UX 3.1 sh.
12851285 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.
12871287
12881288 Usage: $0 [OPTION]... [VAR=VALUE]...
12891289
13571357
13581358 if test -n "$ac_init_help"; then
13591359 case $ac_init_help in
1360 short | recursive ) echo "Configuration of Gource 0.34:";;
1360 short | recursive ) echo "Configuration of Gource 0.35:";;
13611361 esac
13621362 cat <<\_ACEOF
13631363
14641464 test -n "$ac_init_help" && exit $ac_status
14651465 if $ac_init_version; then
14661466 cat <<\_ACEOF
1467 Gource configure 0.34
1467 Gource configure 0.35
14681468 generated by GNU Autoconf 2.67
14691469
14701470 Copyright (C) 2010 Free Software Foundation, Inc.
20512051 This file contains any messages produced by compilers while
20522052 running configure, to aid debugging if configure makes a mistake.
20532053
2054 It was created by Gource $as_me 0.34, which was
2054 It was created by Gource $as_me 0.35, which was
20552055 generated by GNU Autoconf 2.67. Invocation command line was
20562056
20572057 $ $0 $@
28682868
28692869 # Define the identity of the package.
28702870 PACKAGE='gource'
2871 VERSION='0.34'
2871 VERSION='0.35'
28722872
28732873
28742874 cat >>confdefs.h <<_ACEOF
73957395 # report actual input values of CONFIG_FILES etc. instead of their
73967396 # values after options handling.
73977397 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
73997399 generated by GNU Autoconf 2.67. Invocation command line was
74007400
74017401 CONFIG_FILES = $CONFIG_FILES
74527452 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
74537453 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
74547454 ac_cs_version="\\
7455 Gource config.status 0.34
7455 Gource config.status 0.35
74567456 configured by $0, generated by GNU Autoconf 2.67,
74577457 with options \\"\$ac_cs_config\\"
74587458
22
33 AC_PREREQ(2.61)
44
5 AC_INIT(Gource, 0.34, [acaudwell@gmail.com])
5 AC_INIT(Gource, 0.35, [acaudwell@gmail.com])
66 AC_CONFIG_SRCDIR([src/main.h])
77
88 AM_INIT_AUTOMAKE([dist-bzip2 foreign subdir-objects])
7979 RCommitLog::~RCommitLog() {
8080 if(logf!=0) delete logf;
8181
82 if(temp_file.size()) {
82 if(!temp_file.empty()) {
8383 remove(temp_file.c_str());
8484 }
8585 }
146146 }
147147
148148 bool RCommitLog::getNextLine(std::string& line) {
149 if(lastline.size()>0) {
149 if(!lastline.empty()) {
150150 line = lastline;
151151 lastline = std::string("");
152152 return true;
6868
6969 void Camera::focus() {
7070 display.mode3D(fov, znear, zfar);
71 glMatrixMode(GL_PROJECTION);
72
7371 look();
7472 }
7573
7674 void Camera::focusOn(vec3f p) {
7775 display.mode3D(fov, znear, zfar);
78 glMatrixMode(GL_PROJECTION);
79
8076 lookAt(p);
8177 }
8278
3030
3131 //ShaderManager
3232
33 Regex Shader_pre_include("\\s*#include\\s*\"([^\"]+)\"");
34
3335 Shader* ShaderManager::grab(const std::string& shader_prefix) {
3436 Resource* s = resources[shader_prefix];
3537
4547
4648 //Shader
4749 Shader::Shader(const std::string& prefix) : Resource(prefix) {
50
4851 std::string shader_dir = shadermanager.getDir();
4952
5053 std::string vertexSrc = shader_dir + prefix + std::string(".vert");
99102 }
100103
101104 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()) {
105110 throw SDLAppException("could not read shader '%s'", filename.c_str());
106111 }
107112
119124 return shaderRef;
120125 }
121126
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) {
125146
126147 // get length
127148 std::ifstream in(file.c_str());
128149
129 if(!in.is_open()) return source;
150 if(!in.is_open()) {
151 throw SDLAppException("could not open '%s'", file.c_str());
152 }
130153
131154 std::string line;
132155 while( std::getline(in,line) ) {
133 source += line;
134 source += "\n";
156 if(!preprocess(line, output)) {
157 output += line;
158 output += "\n";
159 }
135160 }
136161
137162 in.close();
138
139 return source;
163
164 return true;
140165 }
141166
142167 void Shader::use() {
3232 #include "resource.h"
3333 #include "display.h"
3434 #include "sdlapp.h"
35 #include "regex.h"
3536
3637 #include <map>
3738 #include <string>
4748
4849 GLint getVarLocation(const std::string& name);
4950
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);
5153 GLenum load(const std::string& filename, GLenum shaderType);
5254 void makeProgram();
5355
4141
4242 bool CustomLog::parseCommit(RCommit& commit) {
4343
44 while(readCustomCommit(commit));
44 while(parseCommitEntry(commit));
4545
46 return commit.files.size() > 0;
46 return !commit.files.empty();
4747 }
4848
49 bool CustomLog::readCustomCommit(RCommit& commit) {
49 bool CustomLog::parseCommitEntry(RCommit& commit) {
5050
5151 std::string line;
5252 std::vector<std::string> entries;
6161 std::string username = (entries[1].size()>0) ? entries[1] : "Unknown";
6262 std::string action = (entries[2].size()>0) ? entries[2] : "A";
6363
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
6477 bool has_colour = false;
6578 vec3f colour;
6679
6780 if(entries.size()>=5 && entries[4].size()>0) {
6881 has_colour = true;
6982 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;
8583 }
8684
8785 if(has_colour) {
2121
2222 class CustomLog : public RCommitLog {
2323 protected:
24
25 bool readCustomCommit(RCommit& commit);
26
24 bool parseCommit(RCommit& commit);
25 bool parseCommitEntry(RCommit& commit);
2726 vec3f parseColour(const std::string& cstr);
28 bool parseCommit(RCommit& commit);
2927 public:
3028 CustomLog(const std::string& logfile);
3129 };
18561856
18571857 updateAndDrawEdges();
18581858
1859 draw_edges_time = SDL_GetTicks() - draw_edges_time;
1859 draw_edges_time = SDL_GetTicks() - draw_edges_time;
18601860
18611861 //draw shadows
18621862
19041904
19051905 void Gource::updateAndDrawEdges() {
19061906 if(gGourceSettings.hide_tree) return;
1907
1907
19081908 root->calcEdges();
19091909
19101910 //switch to 2d
19441944 glUseProgramObjectARB(0);
19451945
19461946 edge_vbo.draw();
1947
1947
19481948 } else {
19491949 root->drawEdgeShadows();
19501950 root->drawEdges();
22382238 glLoadIdentity();
22392239
22402240 camera.focus();
2241
2242 glMatrixMode(GL_MODELVIEW);
2243 glLoadIdentity();
22442241
22452242 //check visibility
22462243 root->checkFrustum(frustum);
24482445
24492446 // text using the specified font goes here
24502447
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
24532450 if(!gGourceSettings.hide_date) {
24542451 fontmedium.draw(display.width/2 - date_x_offset, 20, displaydate);
24552452 }
1717 #ifndef GOURCE_SETTINGS_H
1818 #define GOURCE_SETTINGS_H
1919
20 #define GOURCE_VERSION "0.34"
20 #define GOURCE_VERSION "0.35"
2121
2222 #include <dirent.h>
2323
2424
2525 std::string gource_style_path = gSDLAppResourceDir + std::string("gource.style");
2626
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("\"");
2828 }
2929
3030 MercurialLog::MercurialLog(const std::string& logfile) : RCommitLog(logfile) {
4444
4545 BaseLog* MercurialLog::generateLog(const std::string& dir) {
4646
47 //does directory have a .git ?
47 //does directory have a .hg ?
4848 std::string hgdir = dir + std::string("/.hg");
4949 struct stat dirinfo;
5050 int stat_rc = stat(hgdir.c_str(), &dirinfo);
5959 if(temp_file.size()==0) return 0;
6060
6161 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());
6363
6464 int command_rc = system(cmd_buff);
6565
7575
7676 bool MercurialLog::parseCommit(RCommit& commit) {
7777
78 while(parseCommitEntry(commit));
79
80 return !commit.files.empty();
81 }
82
83 bool MercurialLog::parseCommitEntry(RCommit& commit) {
84
7885 std::string line;
7986 std::vector<std::string> entries;
8087
8390 //custom line
8491 if(!hg_regex.match(line, &entries)) return false;
8592
86 commit.timestamp = atol(entries[0].c_str());
93 time_t timestamp = atol(entries[0].c_str());
94 std::string username = entries[1];
8795
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
90109 std::string action = "A";
91110
92 if(entries[2].size()>0) {
111 if(!entries[2].empty()) {
93112 action = entries[2];
94113 }
95114
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);
107116
108117 //commit.debug();
109118
2424 class MercurialLog : public RCommitLog {
2525 protected:
2626 bool parseCommit(RCommit& commit);
27 bool parseCommitEntry(RCommit& commit);
2728 BaseLog* generateLog(const std::string& dir);
2829 public:
2930 MercurialLog(const std::string& logfile);
2525 dest_y = -1.0f;
2626
2727 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 }
2841 }
2942
3043 const vec3f& FileKeyEntry::getColour() const {
131144 font.setColour(vec4f(1.0f, 1.0f, 1.0f, alpha));
132145
133146 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());
135148
136149 font.dropShadow(true);
137150 font.print((int)pos.x+width+4, (int)pos.y+3, "%d", count);
3030 FXFont font;
3131 vec3f colour;
3232 std::string ext;
33 std::string display_ext;
3334 float alpha;
3435 float brightness;
3536 int count;