Permalink
Browse files

[wiki-app] updates from Symbio

change scroll threshold to 1 pixel
clear history keyboard change
search list less than a page fix
Parental control screen (at first random key press) implementation.
Article filtering fine tuning

Signed-off-by: Christopher Hall <hsw@openmoko.com>
  • Loading branch information...
1 parent d6ac6e7 commit a8a9edd556c2543040f5ae85cc21c4907d891af5 @hxw hxw committed Sep 30, 2009
Showing with 335 additions and 233 deletions.
  1. +42 −0 wiki-app/history.c
  2. +1 −0 wiki-app/history.h
  3. +14 −14 wiki-app/keyboard.c
  4. +0 −74 wiki-app/keyboard_all_image.h
  5. +12 −3 wiki-app/lcd_buf_draw.c
  6. +247 −133 wiki-app/restricted.c
  7. +1 −0 wiki-app/restricted.h
  8. +18 −9 wiki-app/wikilib.c
View
@@ -23,6 +23,8 @@
#include <search.h>
#include <stdlib.h>
#include <file-io.h>
+#include <guilib.h>
+#include <lcd.h>
#include "history.h"
#include "search.h"
#include "msg.h"
@@ -75,6 +77,7 @@ void history_add(const long idx_article, const char *title)
history_tmp = history_list[i];
memrcpy((void*)&history_list[1],(void*)&history_list[0],sizeof(HISTORY)*i);
history_list[0]=history_tmp;
+ history_list[0].last_y_pos = 0;
bFound = 1;
}
else
@@ -290,3 +293,42 @@ void history_open_article(int new_selection)
strcpy(title, history_list[history_current + history_base].title);
display_link_article(idx_article);
}
+
+void draw_clear_history(void)
+{
+ int i;
+
+ memset(&framebuffer[181 * LCD_VRAM_WIDTH_PIXELS / 8], 0xFF, 27 * LCD_VRAM_WIDTH_PIXELS / 8);
+
+ framebuffer[184 * LCD_VRAM_WIDTH_PIXELS / 8 + 18] = 0xFE;
+ memset(&framebuffer[184 * LCD_VRAM_WIDTH_PIXELS / 8 + 19], 0, 4);
+ framebuffer[184 * LCD_VRAM_WIDTH_PIXELS / 8 + 23] = 0x07;
+
+ framebuffer[184 * LCD_VRAM_WIDTH_PIXELS / 8 + 24] = 0xF8;
+ memset(&framebuffer[184 * LCD_VRAM_WIDTH_PIXELS / 8 + 25], 0, 4);
+ framebuffer[184 * LCD_VRAM_WIDTH_PIXELS / 8 + 29] = 0x1F;
+
+ for (i = 185; i <= 203; i++)
+ {
+ framebuffer[i * LCD_VRAM_WIDTH_PIXELS / 8 + 18] = 0xFC;
+ memset(&framebuffer[i * LCD_VRAM_WIDTH_PIXELS / 8 + 19], 0, 4);
+ framebuffer[i * LCD_VRAM_WIDTH_PIXELS / 8 + 23] = 0x03;
+
+ framebuffer[i * LCD_VRAM_WIDTH_PIXELS / 8 + 24] = 0xF0;
+ memset(&framebuffer[i * LCD_VRAM_WIDTH_PIXELS / 8 + 25], 0, 4);
+ framebuffer[i * LCD_VRAM_WIDTH_PIXELS / 8 + 29] = 0x0F;
+ }
+
+ framebuffer[204 * LCD_VRAM_WIDTH_PIXELS / 8 + 18] = 0xFE;
+ memset(&framebuffer[204 * LCD_VRAM_WIDTH_PIXELS / 8 + 19], 0, 4);
+ framebuffer[204 * LCD_VRAM_WIDTH_PIXELS / 8 + 23] = 0x07;
+
+ framebuffer[204 * LCD_VRAM_WIDTH_PIXELS / 8 + 24] = 0xF8;
+ memset(&framebuffer[204 * LCD_VRAM_WIDTH_PIXELS / 8 + 25], 0, 4);
+ framebuffer[204 * LCD_VRAM_WIDTH_PIXELS / 8 + 29] = 0x1F;
+
+ render_string(SUBTITLE_FONT_IDX, LCD_LEFT_MARGIN, 185, "Clear History", 13, 1);
+ render_string(SUBTITLE_FONT_IDX, 156, 185, "Yes", 3, 0);
+ render_string(SUBTITLE_FONT_IDX, 206, 185, "No", 2, 0);
+
+}
View
@@ -48,6 +48,7 @@ void history_open_article(int new_selection);
void history_reload();
void history_log_y_pos(const long y_pos);
long history_get_y_pos(const long idx_article);
+void draw_clear_history(void);
typedef struct _HISTORY {
long idx_article;
View
@@ -116,7 +116,7 @@ static struct keyboard_key qwerty_num[] = {
KEY(216, 181, 239, 207, INTERNAL_NUMBER),
};
static struct keyboard_key password_char[] = {
- KEY(176, 81, 205, 105, 'Y'),
+ KEY(175, 81, 204, 105, 'Y'),
KEY(0, 126, 23, 152, 'q'),
KEY(0, 153, 23, 180, 'a'),
@@ -158,7 +158,7 @@ static struct keyboard_key password_char[] = {
KEY(216, 181, 239, 207, INTERNAL_NUMBER),
};
static struct keyboard_key password_num[] = {
- KEY(176, 81, 205, 105, 'Y'),
+ KEY(175, 81, 204, 105, 'Y'),
KEY(0, 126, 23, 152, '1'),
KEY(0, 153, 23, 180, '*'),
@@ -200,20 +200,20 @@ static struct keyboard_key password_num[] = {
KEY(216, 181, 239, 207, INTERNAL_NUMBER),
};
static struct keyboard_key clear_history[] = {
- KEY(144, 181, 191, 207, 'Y'),
- KEY(192, 181, 239, 207, 'N'),
+ KEY(147, 181, 192, 207, 'Y'),
+ KEY(193, 181, 238, 207, 'N'),
};
static struct keyboard_key restriction[] = {
- KEY(60, 138, 179, 160, 'Y'),
+ KEY(60, 148, 179, 170, 'Y'),
};
static struct keyboard_key filter_on_off[] = {
- KEY(42, 124, 195, 147, 'Y'),
- KEY(42, 153, 195, 176, 'N'),
+ KEY(44, 134, 195, 157, 'Y'),
+ KEY(44, 163, 195, 186, 'N'),
};
static struct keyboard_key filter_option[] = {
- KEY(42, 95, 195, 118, 'Y'),
- KEY(42, 124, 195, 147, 'N'),
- KEY(42, 153, 195, 176, 'P'),
+ KEY(44, 105, 195, 128, 'Y'),
+ KEY(44, 134, 195, 157, 'N'),
+ KEY(44, 163, 195, 187, 'P'),
};
/*
* The secret of the position and size of the keyboard
@@ -230,8 +230,8 @@ void keyboard_set_mode(int mode)
image_data = &image_data_char;
else if(kb_mode == KEYBOARD_NUM)
image_data = &image_data_num;
- else if(kb_mode == KEYBOARD_CLEAR_HISTORY)
- image_data = &image_data_clear_history;
+// else if(kb_mode == KEYBOARD_CLEAR_HISTORY)
+// image_data = &image_data_clear_history;
else
image_data = NULL;
@@ -251,8 +251,8 @@ void keyboard_paint()
image_data = &image_data_char;
else if(kb_mode == KEYBOARD_NUM || kb_mode == KEYBOARD_PASSWORD_NUM)
image_data = &image_data_num;
- else if(kb_mode == KEYBOARD_CLEAR_HISTORY)
- image_data = &image_data_clear_history;
+// else if(kb_mode == KEYBOARD_CLEAR_HISTORY)
+// image_data = &image_data_clear_history;
else
return;
@@ -430,77 +430,3 @@ static struct guilib_image image_data_num = {
B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), },
};
-
-static struct guilib_image image_data_clear_history = {
- .width = 240,
- .height = 27,
- .data = {
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xf0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x0f), B(0xf0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x1f),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x07),
- B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x0f), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x07), B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x0f),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x07),
- B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x0f), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x07), B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x0f),
- B(0xff), B(0xe0), B(0xf3), B(0xff), B(0xff), B(0xff), B(0xf3), B(0xe6), B(0x7f), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe0), B(0x1c), B(0x38), B(0x00), B(0x00), B(0x07),
- B(0xe0), B(0x00), B(0xe1), B(0x80), B(0x00), B(0x0f), B(0xff), B(0xc0), B(0x73), B(0xff), B(0xff), B(0xff),
- B(0xf3), B(0xe6), B(0x7f), B(0xf3), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xe0), B(0x0e), B(0x30), B(0x00), B(0x00), B(0x07), B(0xe0), B(0x00), B(0xe1), B(0x80), B(0x00), B(0x0f),
- B(0xff), B(0xce), B(0x33), B(0xff), B(0xff), B(0xff), B(0xf3), B(0xe7), B(0xff), B(0xf3), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe0), B(0x06), B(0x70), B(0x00), B(0x00), B(0x07),
- B(0xe0), B(0x00), B(0xf1), B(0x80), B(0x00), B(0x0f), B(0xff), B(0x9f), B(0x33), B(0xc3), B(0xc1), B(0xc9),
- B(0xf3), B(0xe6), B(0x70), B(0x60), B(0xe3), B(0xc9), B(0x3c), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xe0), B(0x07), B(0xe3), B(0xc3), B(0xe0), B(0x07), B(0xe0), B(0x00), B(0xf9), B(0x8e), B(0x00), B(0x0f),
- B(0xff), B(0x9f), B(0xf3), B(0x81), B(0x9c), B(0xc1), B(0xf0), B(0x06), B(0x67), B(0x33), B(0xc1), B(0xc1),
- B(0x19), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe0), B(0x03), B(0xc7), B(0xe6), B(0x30), B(0x07),
- B(0xe0), B(0x00), B(0xd9), B(0x9f), B(0x00), B(0x0f), B(0xff), B(0x9f), B(0xf3), B(0x39), B(0x9c), B(0xc7),
- B(0xf0), B(0x06), B(0x67), B(0xf3), B(0x9c), B(0xc7), B(0x99), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xe0), B(0x03), B(0xcc), B(0x66), B(0x00), B(0x07), B(0xe0), B(0x00), B(0xdd), B(0xb1), B(0x80), B(0x0f),
- B(0xff), B(0x9f), B(0xf3), B(0x00), B(0xc0), B(0xcf), B(0xf3), B(0xe6), B(0x60), B(0x73), B(0x9c), B(0xcf),
- B(0x99), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe0), B(0x01), B(0x8f), B(0xf7), B(0xe0), B(0x07),
- B(0xe0), B(0x00), B(0xcd), B(0xb1), B(0x80), B(0x0f), B(0xff), B(0x9f), B(0x33), B(0x3f), B(0x80), B(0xcf),
- B(0xf3), B(0xe6), B(0x78), B(0x33), B(0x9c), B(0xcf), B(0xc3), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xe0), B(0x01), B(0x8c), B(0x01), B(0xf0), B(0x07), B(0xe0), B(0x00), B(0xcf), B(0xb1), B(0x80), B(0x0f),
- B(0xff), B(0xce), B(0x33), B(0x19), B(0x9c), B(0xcf), B(0xf3), B(0xe6), B(0x7f), B(0x33), B(0x9c), B(0xcf),
- B(0xc3), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe0), B(0x01), B(0x8e), B(0x66), B(0x30), B(0x07),
- B(0xe0), B(0x00), B(0xc7), B(0xb1), B(0x80), B(0x0f), B(0xff), B(0xc0), B(0x73), B(0x81), B(0x9c), B(0xcf),
- B(0xf3), B(0xe6), B(0x63), B(0x30), B(0xc1), B(0xcf), B(0xc3), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xe0), B(0x01), B(0x87), B(0xe7), B(0x30), B(0x07), B(0xe0), B(0x00), B(0xc3), B(0x9f), B(0x00), B(0x0f),
- B(0xff), B(0xe0), B(0xf3), B(0xc3), B(0xc0), B(0xcf), B(0xf3), B(0xe6), B(0x70), B(0x78), B(0xe3), B(0xcf),
- B(0xe7), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe0), B(0x01), B(0x83), B(0xc3), B(0xe0), B(0x07),
- B(0xe0), B(0x00), B(0xc3), B(0x8e), B(0x00), B(0x0f), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe7), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x07), B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x0f),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0x8f), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x07),
- B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x0f), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0x8f), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x07), B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x0f),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x07),
- B(0xe0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x0f), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xf0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x0f), B(0xf0), B(0x00), B(0x00), B(0x00), B(0x00), B(0x1f),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff),
- B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), B(0xff), },
-};
View
@@ -487,8 +487,8 @@ void buf_draw_UTF8_str(unsigned char **pUTF8)
draw_restricted_mark(lcd_draw_buf.screen_buf);
if (article_link_count < MAX_ARTICLE_LINKS)
{
- articleLink[article_link_count].start_xy = (unsigned long)(211 | (3 << 8));
- articleLink[article_link_count].end_xy = (unsigned long)(230 | (23 << 8));
+ articleLink[article_link_count].start_xy = (unsigned long)(211 | (4 << 8));
+ articleLink[article_link_count].end_xy = (unsigned long)(230 | (24 << 8));
articleLink[article_link_count++].article_id = RESTRICTED_MARK_LINK;
}
}
@@ -1063,7 +1063,10 @@ int render_search_result_with_pcf(void)
static long offset_next = 0;
if (!more_search_results)
+ {
+ display_first_page = 1;
return rc;
+ }
guilib_fb_lock();
if (article_link_count == NUMBER_OF_FIRST_PAGE_RESULTS) // has not rendered any results beyond the first page
@@ -1465,11 +1468,17 @@ void open_article_link_with_link_number(int article_link_number)
{
long idx;
- invert_link(article_link_number);
if (article_link_number < 0 || articleLink[article_link_number].article_id <= 0)
return;
display_first_page = 0; // use this to disable scrolling until the first page of the linked article is loaded
idx = articleLink[article_link_number].article_id;
+ if (idx == RESTRICTED_MARK_LINK)
+ {
+#ifdef INCLUDED_FROM_KERNEL
+ delay_us(100000);
+#endif
+ invert_link(article_link_number);
+ }
display_link_article(idx);
}
#endif
Oops, something went wrong.

0 comments on commit a8a9edd

Please sign in to comment.