* view.c (display): Simplified the ruler drawing code.

This commit is contained in:
Roland Illig 2005-04-17 11:05:42 +00:00
parent 093f7a679a
commit 56ea657694
2 changed files with 4 additions and 6 deletions

View File

@ -20,6 +20,7 @@
rectangle that can be used for displaying data. Expressed rectangle that can be used for displaying data. Expressed
view_get_datalines() and view_get_datacolumns() in terms of view_get_datalines() and view_get_datacolumns() in terms of
these four functions. these four functions.
* view.c (display): Simplified the ruler drawing code.
2005-04-16 Roland Illig <roland.illig@gmx.de> 2005-04-16 Roland Illig <roland.illig@gmx.de>

View File

@ -884,6 +884,7 @@ display (WView *view)
/* Optionally, display a ruler */ /* Optionally, display a ruler */
if ((!view->hex_mode) && (ruler)) { if ((!view->hex_mode) && (ruler)) {
const char ruler_chars[] = "|----*----";
char r_buff[10]; char r_buff[10];
int cl; int cl;
@ -895,12 +896,8 @@ display (WView *view)
view_gotoyx (view, row, c); view_gotoyx (view, row, c);
else else
view_gotoyx (view, row + height - 2, c); view_gotoyx (view, row + height - 2, c);
r_buff[0] = '-'; view_add_character (view, ruler_chars[cl % 10]);
if ((cl % 10) == 0)
r_buff[0] = '|';
else if ((cl % 5) == 0)
r_buff[0] = '*';
view_add_character (view, r_buff[0]);
if ((cl != 0) && (cl % 10) == 0) { if ((cl != 0) && (cl % 10) == 0) {
g_snprintf (r_buff, sizeof (r_buff), "%03d", cl); g_snprintf (r_buff, sizeof (r_buff), "%03d", cl);
if (ruler == 1) { if (ruler == 1) {