logo       
Google Custom Search
    AddThis Social Bookmark Button

cvs: apps menu.c,1.46,1.47 tree.c,1.131,1.132: msg#00064

Subject: cvs: apps menu.c,1.46,1.47 tree.c,1.131,1.132
Update of /cvsroot/rockbox/apps
In directory usw-pr-cvs1:/tmp/cvs-serv7233/apps

Modified Files:
        menu.c tree.c 
Log Message:
Only show scrollbar when needed. (Björn Fischer)


Index: menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/menu.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- menu.c      24 Sep 2002 18:04:12 -0000      1.46
+++ menu.c      24 Sep 2002 19:41:23 -0000      1.47
@@ -47,18 +47,18 @@
 
 #ifdef HAVE_LCD_BITMAP
 
-#define MARGIN_X    (global_settings.scrollbar ? SCROLLBAR_WIDTH : 0) + 
CURSOR_WIDTH /* X pixel margin */
-#define MARGIN_Y    (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)  /* Y 
pixel margin */
+/* pixel margins */
+#define MARGIN_X (global_settings.scrollbar && \
+                  menu_lines < menus[m].itemcount ? SCROLLBAR_WIDTH : 0) +\
+                  CURSOR_WIDTH
+#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)
+
+/* position the entry-list starts at */
+#define LINE_X   0
+#define LINE_Y   (global_settings.statusbar ? 1 : 0)
 
-#define LINE_X      0 /* X position the entry-list starts at */
-#define LINE_Y      (global_settings.statusbar ? 1 : 0) /* Y position the 
entry-list starts at */
-
-//FIXME remove
-#define LINE_HEIGTH 8 /* pixels for each text line */
-//FIXME remove
-#define MENU_LINES  (LCD_HEIGHT / LINE_HEIGTH - LINE_Y)
-
-#define CURSOR_X    (global_settings.scrollbar ? 1 : 0)
+#define CURSOR_X (global_settings.scrollbar && \
+                  menu_lines < menus[m].itemcount ? 1 : 0)
 #define CURSOR_Y    0 /* the cursor is not positioned in regard to
                          the margins, so this is the amount of lines
                          we add to the cursor Y position to position
@@ -165,7 +165,7 @@
     /* place the cursor */
     put_cursorxy(CURSOR_X, menus[m].cursor - menus[m].top, true);
 #ifdef HAVE_LCD_BITMAP
-    if (global_settings.scrollbar) 
+    if (global_settings.scrollbar && menus[m].itemcount > menu_lines) 
         scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1,
                   LCD_HEIGHT - SCROLLBAR_Y, menus[m].itemcount, menus[m].top,
                   menus[m].top + menu_lines, VERTICAL);

Index: tree.c
===================================================================
RCS file: /cvsroot/rockbox/apps/tree.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -b -r1.131 -r1.132
--- tree.c      24 Sep 2002 19:12:08 -0000      1.131
+++ tree.c      24 Sep 2002 19:41:23 -0000      1.132
@@ -81,17 +81,18 @@
 
 #ifdef HAVE_LCD_BITMAP
 
-#define TREE_MAX_ON_SCREEN   ((LCD_HEIGHT-MARGIN_Y)/LINE_HEIGTH)
-#define TREE_MAX_LEN_DISPLAY 16 /* max length that fits on screen */
+/* pixel margins */
+#define MARGIN_X (global_settings.scrollbar && \
+                  filesindir > tree_max_on_screen ? SCROLLBAR_WIDTH : 0) + \
+                  CURSOR_WIDTH + ICON_WIDTH
+#define MARGIN_Y (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)
+
+/* position the entry-list starts at */
+#define LINE_X   0 
+#define LINE_Y   (global_settings.statusbar ? 1 : 0)
  
-#define MARGIN_X      (global_settings.scrollbar ? SCROLLBAR_WIDTH : 0) + 
CURSOR_WIDTH + ICON_WIDTH /* X pixel margin */
-#define MARGIN_Y      (global_settings.statusbar ? STATUSBAR_HEIGHT : 0)  /* Y 
pixel margin */
-
-#define LINE_X      0 /* X position the entry-list starts at */
-#define LINE_Y      (global_settings.statusbar ? 1 : 0) /* Y position the 
entry-list starts at */
-#define LINE_HEIGTH 8 /* pixels for each text line */
-
-#define CURSOR_X    (global_settings.scrollbar ? 1 : 0)
+#define CURSOR_X (global_settings.scrollbar && \
+                  filesindir > tree_max_on_screen ? 1 : 0)
 #define CURSOR_Y    0 /* the cursor is not positioned in regard to
                          the margins, so this is the amount of lines
                          we add to the cursor Y position to position
@@ -191,7 +192,7 @@
     bool dir_buffer_full;
 
 #ifdef HAVE_LCD_BITMAP
-    int line_height = LINE_HEIGTH;
+    int line_height;
     int fw, fh;
     lcd_setfont(FONT_UI);
     lcd_getstringsize("A", &fw, &fh);
@@ -428,7 +429,7 @@
     }
 
 #ifdef HAVE_LCD_BITMAP
-    if (global_settings.scrollbar) 
+    if (global_settings.scrollbar && filesindir > tree_max_on_screen) 
         scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1,
                   LCD_HEIGHT - SCROLLBAR_Y, filesindir, start,
                   start + tree_max_on_screen, VERTICAL);





Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>