Fossil SCM

Place Newer and Older buttons on circa queries to make browsing easier.

andybradford 2015-03-21 23:34 trunk
Commit ced021fd57ac2bac3087a203525decb721b3e579
1 file changed +28 -10
+28 -10
--- src/timeline.c
+++ src/timeline.c
@@ -1420,11 +1420,11 @@
14201420
if( (tmFlags & TIMELINE_UNHIDE)==0 ){
14211421
timeline_submenu(&url, "Unhide", "unhide", "", 0);
14221422
}
14231423
}else{
14241424
/* Otherwise, a timeline based on a span of time */
1425
- int n;
1425
+ int n, nBefore, nAfter;
14261426
const char *zEType = "timeline item";
14271427
char *zDate;
14281428
if( zUses ){
14291429
blob_append_sql(&sql, " AND event.objid IN usesfile ");
14301430
}
@@ -1628,20 +1628,38 @@
16281628
}
16291629
if( zSearch ){
16301630
blob_appendf(&desc, " matching \"%h\"", zSearch);
16311631
}
16321632
if( g.perm.Hyperlink ){
1633
- if( zAfter || n==nEntry ){
1633
+ if( zCirca && rCirca ){
1634
+ nBefore = db_int(0,
1635
+ "SELECT count(*) FROM timeline WHERE etype!='div'"
1636
+ " AND sortby<=%f /*scan*/", rCirca);
1637
+ nAfter = db_int(0,
1638
+ "SELECT count(*) FROM timeline WHERE etype!='div'"
1639
+ " AND sortby>=%f /*scan*/", rCirca);
16341640
zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
1635
- timeline_submenu(&url, "Older", "b", zDate, "a");
1636
- zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0));
1637
- free(zDate);
1638
- }
1639
- if( zBefore || (zAfter && n==nEntry) ){
1640
- zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
1641
- timeline_submenu(&url, "Newer", "a", zDate, "b");
1642
- free(zDate);
1641
+ if( nBefore>=nEntry ){
1642
+ timeline_submenu(&url, "Older", "b", zDate, "c");
1643
+ zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "c", 0));
1644
+ }
1645
+ if( nAfter>=nEntry ){
1646
+ timeline_submenu(&url, "Newer", "a", zDate, "c");
1647
+ }
1648
+ free(zDate);
1649
+ }else{
1650
+ if( zAfter || n==nEntry ){
1651
+ zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
1652
+ timeline_submenu(&url, "Older", "b", zDate, "a");
1653
+ zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0));
1654
+ free(zDate);
1655
+ }
1656
+ if( zBefore || (zAfter && n==nEntry) ){
1657
+ zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
1658
+ timeline_submenu(&url, "Newer", "a", zDate, "b");
1659
+ free(zDate);
1660
+ }
16431661
}
16441662
if( zType[0]=='a' || zType[0]=='c' ){
16451663
if( (tmFlags & TIMELINE_UNHIDE)==0 ){
16461664
timeline_submenu(&url, "Unhide", "unhide", "", 0);
16471665
}
16481666
--- src/timeline.c
+++ src/timeline.c
@@ -1420,11 +1420,11 @@
1420 if( (tmFlags & TIMELINE_UNHIDE)==0 ){
1421 timeline_submenu(&url, "Unhide", "unhide", "", 0);
1422 }
1423 }else{
1424 /* Otherwise, a timeline based on a span of time */
1425 int n;
1426 const char *zEType = "timeline item";
1427 char *zDate;
1428 if( zUses ){
1429 blob_append_sql(&sql, " AND event.objid IN usesfile ");
1430 }
@@ -1628,20 +1628,38 @@
1628 }
1629 if( zSearch ){
1630 blob_appendf(&desc, " matching \"%h\"", zSearch);
1631 }
1632 if( g.perm.Hyperlink ){
1633 if( zAfter || n==nEntry ){
 
 
 
 
 
 
1634 zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
1635 timeline_submenu(&url, "Older", "b", zDate, "a");
1636 zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0));
1637 free(zDate);
1638 }
1639 if( zBefore || (zAfter && n==nEntry) ){
1640 zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
1641 timeline_submenu(&url, "Newer", "a", zDate, "b");
1642 free(zDate);
 
 
 
 
 
 
 
 
 
 
 
 
1643 }
1644 if( zType[0]=='a' || zType[0]=='c' ){
1645 if( (tmFlags & TIMELINE_UNHIDE)==0 ){
1646 timeline_submenu(&url, "Unhide", "unhide", "", 0);
1647 }
1648
--- src/timeline.c
+++ src/timeline.c
@@ -1420,11 +1420,11 @@
1420 if( (tmFlags & TIMELINE_UNHIDE)==0 ){
1421 timeline_submenu(&url, "Unhide", "unhide", "", 0);
1422 }
1423 }else{
1424 /* Otherwise, a timeline based on a span of time */
1425 int n, nBefore, nAfter;
1426 const char *zEType = "timeline item";
1427 char *zDate;
1428 if( zUses ){
1429 blob_append_sql(&sql, " AND event.objid IN usesfile ");
1430 }
@@ -1628,20 +1628,38 @@
1628 }
1629 if( zSearch ){
1630 blob_appendf(&desc, " matching \"%h\"", zSearch);
1631 }
1632 if( g.perm.Hyperlink ){
1633 if( zCirca && rCirca ){
1634 nBefore = db_int(0,
1635 "SELECT count(*) FROM timeline WHERE etype!='div'"
1636 " AND sortby<=%f /*scan*/", rCirca);
1637 nAfter = db_int(0,
1638 "SELECT count(*) FROM timeline WHERE etype!='div'"
1639 " AND sortby>=%f /*scan*/", rCirca);
1640 zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
1641 if( nBefore>=nEntry ){
1642 timeline_submenu(&url, "Older", "b", zDate, "c");
1643 zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "c", 0));
1644 }
1645 if( nAfter>=nEntry ){
1646 timeline_submenu(&url, "Newer", "a", zDate, "c");
1647 }
1648 free(zDate);
1649 }else{
1650 if( zAfter || n==nEntry ){
1651 zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
1652 timeline_submenu(&url, "Older", "b", zDate, "a");
1653 zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0));
1654 free(zDate);
1655 }
1656 if( zBefore || (zAfter && n==nEntry) ){
1657 zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
1658 timeline_submenu(&url, "Newer", "a", zDate, "b");
1659 free(zDate);
1660 }
1661 }
1662 if( zType[0]=='a' || zType[0]=='c' ){
1663 if( (tmFlags & TIMELINE_UNHIDE)==0 ){
1664 timeline_submenu(&url, "Unhide", "unhide", "", 0);
1665 }
1666

Keyboard Shortcuts

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