Fossil SCM

New timeline formatting experiment. Foreground font color changes when mousing over the vinfo hyperline show all immediate parents in red and immediate children in green and hide all entries that are not part of the current line.

drh 2007-08-29 11:48 trunk
Commit 4d051c1eda312ef2be17c7f254c54a8d15850688
1 file changed +42 -56
+42 -56
--- src/timeline.c
+++ src/timeline.c
@@ -42,18 +42,23 @@
4242
4343
/*
4444
** Generate a hyperlink that invokes javascript to highlight
4545
** a version on mouseover.
4646
*/
47
-void hyperlink_to_uuid_with_highlight(const char *zUuid, int id){
47
+void hyperlink_to_uuid_with_mouseover(
48
+ const char *zUuid, /* The UUID to display */
49
+ const char *zIn, /* Javascript proc for mouseover */
50
+ const char *zOut, /* Javascript proc for mouseout */
51
+ int id /* Argument to javascript procs */
52
+){
4853
char zShortUuid[UUID_SIZE+1];
4954
sprintf(zShortUuid, "%.10s", zUuid);
5055
if( g.okHistory ){
51
- @ <a onmouseover='hilite("m%d(id)")' onmouseout='unhilite("m%d(id)")'
56
+ @ <a onmouseover='%s(zIn)("m%d(id)")' onmouseout='%s(zOut)("m%d(id)")'
5257
@ href="%s(g.zBaseURL)/vinfo/%s(zUuid)">[%s(zShortUuid)]</a>
5358
}else{
54
- @ <b onmouseover='hilite("m%d(id)")' onmouseout='unhilite("m%d(id)")'>
59
+ @ <b onmouseover='%s(zIn)("m%d(id)")' onmouseout='%s(zOut)("m%d(id)")'>
5560
@ [%s(zShortUuid)]</b>
5661
}
5762
}
5863
5964
/*
@@ -91,10 +96,11 @@
9196
char zPrevDate[20];
9297
zPrevDate[0] = 0;
9398
@ <table cellspacing=0 border=0 cellpadding=0>
9499
while( db_step(pQuery)==SQLITE_ROW ){
95100
int rid = db_column_int(pQuery, 0);
101
+ const char *zUuid = db_column_text(pQuery, 1);
96102
int nPChild = db_column_int(pQuery, 5);
97103
int nParent = db_column_int(pQuery, 6);
98104
int isLeaf = db_column_int(pQuery, 7);
99105
const char *zDate = db_column_text(pQuery, 2);
100106
if( xCallback ){
@@ -109,50 +115,25 @@
109115
@ <td bgcolor="#d0d9f4" class="bkgnd1">%s(zPrevDate)</td>
110116
@ </tr></table>
111117
@ </td></tr></table>
112118
@ </td></tr>
113119
}
114
- @ <tr id="m%d(rid)" onmouseover='xin("m%d(rid)")'
115
- @ onmouseout='xout("m%d(rid)")'>
120
+ @ <tr id="m%d(rid)">
116121
@ <td valign="top">%s(&zDate[11])</td>
117122
@ <td width="20"></td>
118123
@ <td valign="top" align="left">
119
- hyperlink_to_uuid(db_column_text(pQuery,1));
120
- @ %h(db_column_text(pQuery,3))
124
+ hyperlink_to_uuid_with_mouseover(zUuid, "xin", "xout", rid);
121125
if( nParent>1 ){
122
- Stmt q;
123
- @ <b>Merge</b> from
124
- db_prepare(&q,
125
- "SELECT rid, uuid FROM plink, blob"
126
- " WHERE plink.cid=%d AND blob.rid=plink.pid AND plink.isprim=0",
127
- rid
128
- );
129
- while( db_step(&q)==SQLITE_ROW ){
130
- int mrid = db_column_int(&q, 0);
131
- const char *zUuid = db_column_text(&q, 1);
132
- hyperlink_to_uuid_with_highlight(zUuid, mrid);
133
- }
134
- db_finalize(&q);
126
+ @ <b>Merge</b>
135127
}
136128
if( nPChild>1 ){
137
- Stmt q;
138
- @ <b>Fork</b> to
139
- db_prepare(&q,
140
- "SELECT rid, uuid FROM plink, blob"
141
- " WHERE plink.pid=%d AND blob.rid=plink.cid AND plink.isprim>0",
142
- rid
143
- );
144
- while( db_step(&q)==SQLITE_ROW ){
145
- int frid = db_column_int(&q, 0);
146
- const char *zUuid = db_column_text(&q, 1);
147
- hyperlink_to_uuid_with_highlight(zUuid, frid);
148
- }
149
- db_finalize(&q);
129
+ @ <b>Fork</b>
150130
}
151131
if( isLeaf ){
152132
@ <b>Leaf</b>
153133
}
134
+ @ %h(db_column_text(pQuery,3))
154135
@ (by %h(db_column_text(pQuery,4)))</td></tr>
155136
if( zLastDate ){
156137
strcpy(zLastDate, zDate);
157138
}
158139
}
@@ -247,58 +228,63 @@
247228
@ function setall(value){
248229
@ for(var x in parentof){
249230
@ setone(x,value);
250231
@ }
251232
@ }
252
- @ function setone(id, onoff){
233
+ @ function setone(id, clr){
253234
@ if( parentof[id]==null ) return 0;
254235
@ var w = document.getElementById(id);
255
- @ var clr = onoff==1 ? "#e0e0ff" : "#ffffff";
256
- @ if( w.backgroundColor==clr ){
236
+ @ if( w.style.color==clr ){
257237
@ return 0
258238
@ }else{
259
- @ w.style.backgroundColor = clr
239
+ @ w.style.color = clr
260240
@ return 1
261241
@ }
262242
@ }
263243
@ function xin(id) {
264
- @ setall(0);
265
- @ setone(id,1);
266
- @ set_children(id);
267
- @ set_parents(id);
244
+ @ setall("#ffffff");
245
+ @ setone(id,"#000000");
246
+ @ set_children(id, "#002000");
247
+ @ set_parents(id, "#200000");
248
+ @ for(var x in parentof[id]){
249
+ @ var pid = parentof[id][x]
250
+ @ var w = document.getElementById(pid);
251
+ @ if( w!=null ){
252
+ @ w.style.color = "#ff0000";
253
+ @ }
254
+ @ }
255
+ @ for(var x in childof[id]){
256
+ @ var cid = childof[id][x]
257
+ @ var w = document.getElementById(cid);
258
+ @ if( w!=null ){
259
+ @ w.style.color = "#008000";
260
+ @ }
261
+ @ }
268262
@ }
269263
@ function xout(id) {
270
- @ setall(0);
264
+ @ setall("#000000");
271265
@ }
272
- @ function set_parents(id){
266
+ @ function set_parents(id, clr){
273267
@ var plist = parentof[id];
274268
@ if( plist==null ) return;
275269
@ for(var x in plist){
276270
@ var pid = plist[x];
277
- @ if( setone(pid,1)==1 ){
278
- @ set_parents(pid);
271
+ @ if( setone(pid,clr)==1 ){
272
+ @ set_parents(pid,clr);
279273
@ }
280274
@ }
281275
@ }
282
- @ function set_children(id){
276
+ @ function set_children(id,clr){
283277
@ var clist = childof[id];
284278
@ if( clist==null ) return;
285279
@ for(var x in clist){
286280
@ var cid = clist[x];
287
- @ if( setone(cid,1)==1 ){
288
- @ set_children(cid);
281
+ @ if( setone(cid,clr)==1 ){
282
+ @ set_children(cid,clr);
289283
@ }
290284
@ }
291285
@ }
292
- @ function hilite(id) {
293
- @ var x = document.getElementById(id);
294
- @ x.style.color = "#ff0000";
295
- @ }
296
- @ function unhilite(id) {
297
- @ var x = document.getElementById(id);
298
- @ x.style.color = "#000000";
299
- @ }
300286
@ </script>
301287
@ <hr>
302288
@ <form method="GET" action="%s(g.zBaseURL)/timeline">
303289
@ Start Date:
304290
@ <input type="text" size="30" value="%h(zStart)" name="d">
305291
--- src/timeline.c
+++ src/timeline.c
@@ -42,18 +42,23 @@
42
43 /*
44 ** Generate a hyperlink that invokes javascript to highlight
45 ** a version on mouseover.
46 */
47 void hyperlink_to_uuid_with_highlight(const char *zUuid, int id){
 
 
 
 
 
48 char zShortUuid[UUID_SIZE+1];
49 sprintf(zShortUuid, "%.10s", zUuid);
50 if( g.okHistory ){
51 @ <a onmouseover='hilite("m%d(id)")' onmouseout='unhilite("m%d(id)")'
52 @ href="%s(g.zBaseURL)/vinfo/%s(zUuid)">[%s(zShortUuid)]</a>
53 }else{
54 @ <b onmouseover='hilite("m%d(id)")' onmouseout='unhilite("m%d(id)")'>
55 @ [%s(zShortUuid)]</b>
56 }
57 }
58
59 /*
@@ -91,10 +96,11 @@
91 char zPrevDate[20];
92 zPrevDate[0] = 0;
93 @ <table cellspacing=0 border=0 cellpadding=0>
94 while( db_step(pQuery)==SQLITE_ROW ){
95 int rid = db_column_int(pQuery, 0);
 
96 int nPChild = db_column_int(pQuery, 5);
97 int nParent = db_column_int(pQuery, 6);
98 int isLeaf = db_column_int(pQuery, 7);
99 const char *zDate = db_column_text(pQuery, 2);
100 if( xCallback ){
@@ -109,50 +115,25 @@
109 @ <td bgcolor="#d0d9f4" class="bkgnd1">%s(zPrevDate)</td>
110 @ </tr></table>
111 @ </td></tr></table>
112 @ </td></tr>
113 }
114 @ <tr id="m%d(rid)" onmouseover='xin("m%d(rid)")'
115 @ onmouseout='xout("m%d(rid)")'>
116 @ <td valign="top">%s(&zDate[11])</td>
117 @ <td width="20"></td>
118 @ <td valign="top" align="left">
119 hyperlink_to_uuid(db_column_text(pQuery,1));
120 @ %h(db_column_text(pQuery,3))
121 if( nParent>1 ){
122 Stmt q;
123 @ <b>Merge</b> from
124 db_prepare(&q,
125 "SELECT rid, uuid FROM plink, blob"
126 " WHERE plink.cid=%d AND blob.rid=plink.pid AND plink.isprim=0",
127 rid
128 );
129 while( db_step(&q)==SQLITE_ROW ){
130 int mrid = db_column_int(&q, 0);
131 const char *zUuid = db_column_text(&q, 1);
132 hyperlink_to_uuid_with_highlight(zUuid, mrid);
133 }
134 db_finalize(&q);
135 }
136 if( nPChild>1 ){
137 Stmt q;
138 @ <b>Fork</b> to
139 db_prepare(&q,
140 "SELECT rid, uuid FROM plink, blob"
141 " WHERE plink.pid=%d AND blob.rid=plink.cid AND plink.isprim>0",
142 rid
143 );
144 while( db_step(&q)==SQLITE_ROW ){
145 int frid = db_column_int(&q, 0);
146 const char *zUuid = db_column_text(&q, 1);
147 hyperlink_to_uuid_with_highlight(zUuid, frid);
148 }
149 db_finalize(&q);
150 }
151 if( isLeaf ){
152 @ <b>Leaf</b>
153 }
 
154 @ (by %h(db_column_text(pQuery,4)))</td></tr>
155 if( zLastDate ){
156 strcpy(zLastDate, zDate);
157 }
158 }
@@ -247,58 +228,63 @@
247 @ function setall(value){
248 @ for(var x in parentof){
249 @ setone(x,value);
250 @ }
251 @ }
252 @ function setone(id, onoff){
253 @ if( parentof[id]==null ) return 0;
254 @ var w = document.getElementById(id);
255 @ var clr = onoff==1 ? "#e0e0ff" : "#ffffff";
256 @ if( w.backgroundColor==clr ){
257 @ return 0
258 @ }else{
259 @ w.style.backgroundColor = clr
260 @ return 1
261 @ }
262 @ }
263 @ function xin(id) {
264 @ setall(0);
265 @ setone(id,1);
266 @ set_children(id);
267 @ set_parents(id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268 @ }
269 @ function xout(id) {
270 @ setall(0);
271 @ }
272 @ function set_parents(id){
273 @ var plist = parentof[id];
274 @ if( plist==null ) return;
275 @ for(var x in plist){
276 @ var pid = plist[x];
277 @ if( setone(pid,1)==1 ){
278 @ set_parents(pid);
279 @ }
280 @ }
281 @ }
282 @ function set_children(id){
283 @ var clist = childof[id];
284 @ if( clist==null ) return;
285 @ for(var x in clist){
286 @ var cid = clist[x];
287 @ if( setone(cid,1)==1 ){
288 @ set_children(cid);
289 @ }
290 @ }
291 @ }
292 @ function hilite(id) {
293 @ var x = document.getElementById(id);
294 @ x.style.color = "#ff0000";
295 @ }
296 @ function unhilite(id) {
297 @ var x = document.getElementById(id);
298 @ x.style.color = "#000000";
299 @ }
300 @ </script>
301 @ <hr>
302 @ <form method="GET" action="%s(g.zBaseURL)/timeline">
303 @ Start Date:
304 @ <input type="text" size="30" value="%h(zStart)" name="d">
305
--- src/timeline.c
+++ src/timeline.c
@@ -42,18 +42,23 @@
42
43 /*
44 ** Generate a hyperlink that invokes javascript to highlight
45 ** a version on mouseover.
46 */
47 void hyperlink_to_uuid_with_mouseover(
48 const char *zUuid, /* The UUID to display */
49 const char *zIn, /* Javascript proc for mouseover */
50 const char *zOut, /* Javascript proc for mouseout */
51 int id /* Argument to javascript procs */
52 ){
53 char zShortUuid[UUID_SIZE+1];
54 sprintf(zShortUuid, "%.10s", zUuid);
55 if( g.okHistory ){
56 @ <a onmouseover='%s(zIn)("m%d(id)")' onmouseout='%s(zOut)("m%d(id)")'
57 @ href="%s(g.zBaseURL)/vinfo/%s(zUuid)">[%s(zShortUuid)]</a>
58 }else{
59 @ <b onmouseover='%s(zIn)("m%d(id)")' onmouseout='%s(zOut)("m%d(id)")'>
60 @ [%s(zShortUuid)]</b>
61 }
62 }
63
64 /*
@@ -91,10 +96,11 @@
96 char zPrevDate[20];
97 zPrevDate[0] = 0;
98 @ <table cellspacing=0 border=0 cellpadding=0>
99 while( db_step(pQuery)==SQLITE_ROW ){
100 int rid = db_column_int(pQuery, 0);
101 const char *zUuid = db_column_text(pQuery, 1);
102 int nPChild = db_column_int(pQuery, 5);
103 int nParent = db_column_int(pQuery, 6);
104 int isLeaf = db_column_int(pQuery, 7);
105 const char *zDate = db_column_text(pQuery, 2);
106 if( xCallback ){
@@ -109,50 +115,25 @@
115 @ <td bgcolor="#d0d9f4" class="bkgnd1">%s(zPrevDate)</td>
116 @ </tr></table>
117 @ </td></tr></table>
118 @ </td></tr>
119 }
120 @ <tr id="m%d(rid)">
 
121 @ <td valign="top">%s(&zDate[11])</td>
122 @ <td width="20"></td>
123 @ <td valign="top" align="left">
124 hyperlink_to_uuid_with_mouseover(zUuid, "xin", "xout", rid);
 
125 if( nParent>1 ){
126 @ <b>Merge</b>
 
 
 
 
 
 
 
 
 
 
 
 
127 }
128 if( nPChild>1 ){
129 @ <b>Fork</b>
 
 
 
 
 
 
 
 
 
 
 
 
130 }
131 if( isLeaf ){
132 @ <b>Leaf</b>
133 }
134 @ %h(db_column_text(pQuery,3))
135 @ (by %h(db_column_text(pQuery,4)))</td></tr>
136 if( zLastDate ){
137 strcpy(zLastDate, zDate);
138 }
139 }
@@ -247,58 +228,63 @@
228 @ function setall(value){
229 @ for(var x in parentof){
230 @ setone(x,value);
231 @ }
232 @ }
233 @ function setone(id, clr){
234 @ if( parentof[id]==null ) return 0;
235 @ var w = document.getElementById(id);
236 @ if( w.style.color==clr ){
 
237 @ return 0
238 @ }else{
239 @ w.style.color = clr
240 @ return 1
241 @ }
242 @ }
243 @ function xin(id) {
244 @ setall("#ffffff");
245 @ setone(id,"#000000");
246 @ set_children(id, "#002000");
247 @ set_parents(id, "#200000");
248 @ for(var x in parentof[id]){
249 @ var pid = parentof[id][x]
250 @ var w = document.getElementById(pid);
251 @ if( w!=null ){
252 @ w.style.color = "#ff0000";
253 @ }
254 @ }
255 @ for(var x in childof[id]){
256 @ var cid = childof[id][x]
257 @ var w = document.getElementById(cid);
258 @ if( w!=null ){
259 @ w.style.color = "#008000";
260 @ }
261 @ }
262 @ }
263 @ function xout(id) {
264 @ setall("#000000");
265 @ }
266 @ function set_parents(id, clr){
267 @ var plist = parentof[id];
268 @ if( plist==null ) return;
269 @ for(var x in plist){
270 @ var pid = plist[x];
271 @ if( setone(pid,clr)==1 ){
272 @ set_parents(pid,clr);
273 @ }
274 @ }
275 @ }
276 @ function set_children(id,clr){
277 @ var clist = childof[id];
278 @ if( clist==null ) return;
279 @ for(var x in clist){
280 @ var cid = clist[x];
281 @ if( setone(cid,clr)==1 ){
282 @ set_children(cid,clr);
283 @ }
284 @ }
285 @ }
 
 
 
 
 
 
 
 
286 @ </script>
287 @ <hr>
288 @ <form method="GET" action="%s(g.zBaseURL)/timeline">
289 @ Start Date:
290 @ <input type="text" size="30" value="%h(zStart)" name="d">
291

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button