Some minor improvements. master
authorNils Faerber <nils.faerber@kernelconcepts.de>
Sat, 6 Jul 2013 21:21:35 +0000 (23:21 +0200)
committerNils Faerber <nils.faerber@kernelconcepts.de>
Sat, 6 Jul 2013 21:21:35 +0000 (23:21 +0200)
ui/oswald-ui.c
ui/oswald_graphics.c
ui/oswald_graphics.h
ui/oswald_screens.c
ui/oswald_watch_faces.c

index 9d7e575..74d5676 100644 (file)
 
 static oswald_ui *ui_g;
 
-void hal_lcd_set_pixel(gint x, gint y, gboolean state)
+void hal_lcd_set_pixel(gint x, gint y, uint8_t state)
 {
        gint ix, iy;
 
        ix = x*2;
        iy = y*2;
 
+       // we double all pixel to get a bigger picture
        gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix, iy);
        gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix+1, iy);
        gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix, iy+1);
index 651d8e8..78e3659 100644 (file)
@@ -94,7 +94,7 @@ void oswald_draw_line(const uint8_t xstart, const uint8_t ystart, const uint8_t
 
 void oswald_draw_line_ww(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness)
 {
-       int i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
+       int16_t i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
  
        dx = xend - xstart;
        dy = yend - ystart;
@@ -110,17 +110,17 @@ void oswald_draw_line_ww(const uint8_t xstart, const uint8_t ystart, const uint8
        if (dx>dy) {
                pdx = incx;
                pdy = 0;
-               ddx=incx;
-               ddy=incy;
-               es =dy;
-               el =dx;
+               ddx = incx;
+               ddy = incy;
+               es = dy;
+               el = dx;
        } else {
-               pdx=0;
-               pdy=incy;
-               ddx=incx;
-               ddy=incy;
-               es =dx;
-               el =dy;
+               pdx = 0;
+               pdy = incy;
+               ddx = incx;
+               ddy = incy;
+               es = dx;
+               el = dy;
        }
  
        x = xstart;
index d23ebcb..216665e 100644 (file)
@@ -9,7 +9,7 @@
 
 
 #define COLOR_WHITE    0
-//#define COLOR_BLACK  1
+#define COLOR_BLACK    1
 #define COLOR_XOR      2
 #define COLOR_INV      3
 
index ab71408..680b5ba 100644 (file)
@@ -190,8 +190,8 @@ static main_menu_data_t main_menu_screen = {
 // GRID_Y is +1 since there is one empty row for title icon
 #define MAIN_MENU_GRID_Y       3
 #define MAIN_MENU_GRID_SPACING 0
-#define MAIN_MENU_OFFSET_X     3
-#define MAIN_MENU_OFFSET_Y     10
+#define MAIN_MENU_OFFSET_X     6
+#define MAIN_MENU_OFFSET_Y     8
 
 void draw_main_menu_screen(main_menu_data_t *sdata)
 {
@@ -237,6 +237,20 @@ void draw_main_menu_screen(main_menu_data_t *sdata)
        hal_lcd_set_pixel(MAIN_MENU_OFFSET_X+23+((pf%MAIN_MENU_GRID_X) * (MAIN_MENU_GRID_PIXEL / MAIN_MENU_GRID_X)) % (MAIN_MENU_GRID_X*(MAIN_MENU_GRID_PIXEL / MAIN_MENU_GRID_X)),
                MAIN_MENU_OFFSET_Y+23+((pf/MAIN_MENU_GRID_X) * (MAIN_MENU_GRID_PIXEL / MAIN_MENU_GRID_Y)) % (MAIN_MENU_GRID_Y*(MAIN_MENU_GRID_PIXEL / MAIN_MENU_GRID_Y)), FALSE);
 
+
+       // finally a nice border
+       oswald_draw_line(3, 0, 95, 0);
+       oswald_draw_line(2, 1, 95, 1);
+       oswald_draw_line(1, 2, 95, 2);
+
+       oswald_draw_line(0, 3, 0, 92);
+       oswald_draw_line(1, 3, 1, 93);
+       oswald_draw_line(2, 3, 2, 94);
+
+       oswald_draw_line(1, 93, 95, 93);
+       oswald_draw_line(2, 94, 95, 94);
+       oswald_draw_line(3, 95, 95, 95);
+
        hal_lcd_update_display();
 }
 
index 284323a..b955c74 100644 (file)
@@ -271,13 +271,22 @@ void DrawLcdDigitalClock(boolean show_seconds)
        gRow = 0;
        gColumn = 45;
        for (i=0; i<strlen(MainMessage); i++) {
+               // do not draw a whitespace as first character of a row
                if (gRow == 0 && MainMessage[i] == ' ')
                        continue;
+               // interpret new line
+               if (MainMessage[i] == '\n') {
+                       gRow = 0;
+                       gColumn += 9;
+                       continue;
+               }
                gRow += oswald_write_character(gRow, gColumn, FONT_DROID8x12, FALSE, MainMessage[i]);
+               // wrap to new line if line is full
                if (gRow > 90) {
                        gRow = 0;
                        gColumn += 9;
                }
+               // OK, screen ends, leave the loop, no matter what
                if (gColumn > 86)
                        i = 255;
        }