| 53 |
struct paragraph *main_window_paragraphs = 0; |
struct paragraph *main_window_paragraphs = 0; |
| 54 |
struct paragraph *feed_window_paragraphs = 0; |
struct paragraph *feed_window_paragraphs = 0; |
| 55 |
unsigned int current_feed = 0; |
unsigned int current_feed = 0; |
| 56 |
|
char font_headings[100] = "Homerton"; |
| 57 |
|
char font_summaries[100] = "NewHall"; |
| 58 |
|
char font_links[100] = "Homerton"; |
| 59 |
|
|
| 60 |
#define ICON_FLAGS (wimp_ICON_TEXT | \ |
#define ICON_FLAGS (wimp_ICON_TEXT | \ |
| 61 |
(wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT)) |
(wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT)) |
| 73 |
{ wimp_MENU_LAST, 0, ICON_FLAGS, { "Remove feed" } } } }; |
{ wimp_MENU_LAST, 0, ICON_FLAGS, { "Remove feed" } } } }; |
| 74 |
wimp_menu *current_menu; |
wimp_menu *current_menu; |
| 75 |
unsigned int current_removing = 0; |
unsigned int current_removing = 0; |
| 76 |
|
wimp_i current_font_menu; |
| 77 |
|
|
| 78 |
const char *default_feeds[] = { |
const char *default_feeds[] = { |
| 79 |
"http://news.google.co.uk/?output=rss", |
"http://news.google.co.uk/?output=rss", |
| 128 |
char error[200]; |
char error[200]; |
| 129 |
struct stat s; |
struct stat s; |
| 130 |
|
|
| 131 |
memdebug_memdebug("memdump"); |
/* memdebug_memdebug("memdump"); */ |
| 132 |
|
|
| 133 |
if (!feed_init()) |
if (!feed_init()) |
| 134 |
die(feed_error); |
die(feed_error); |
| 530 |
set_icon_string(choices_window, 1, minutes); |
set_icon_string(choices_window, 1, minutes); |
| 531 |
xwimp_set_caret_position(choices_window, 1, |
xwimp_set_caret_position(choices_window, 1, |
| 532 |
0, 0, -1, strlen(minutes)); |
0, 0, -1, strlen(minutes)); |
| 533 |
|
} else if (i == 7 || i == 8 || |
| 534 |
|
i == 10 || i == 11 || |
| 535 |
|
i == 13 || i == 14) { |
| 536 |
|
if (i == 8 || i == 11 || i == 14) |
| 537 |
|
i--; |
| 538 |
|
wimp_window_state state; |
| 539 |
|
wimp_icon_state icon_state; |
| 540 |
|
state.w = w; |
| 541 |
|
xwimp_get_window_state(&state); |
| 542 |
|
icon_state.w = w; |
| 543 |
|
icon_state.i = i; |
| 544 |
|
xwimp_get_icon_state(&icon_state); |
| 545 |
|
open_menu((wimp_menu *) rufl_family_menu, |
| 546 |
|
state.visible.x0 + icon_state.icon.extent.x1, |
| 547 |
|
state.visible.y1 + icon_state.icon.extent.y1); |
| 548 |
|
current_font_menu = i; |
| 549 |
} |
} |
| 550 |
} |
} |
| 551 |
} |
} |
| 623 |
void menu_selection(wimp_selection *selection) |
void menu_selection(wimp_selection *selection) |
| 624 |
{ |
{ |
| 625 |
char minutes[10]; |
char minutes[10]; |
| 626 |
|
wimp_pointer pointer; |
| 627 |
|
|
| 628 |
|
xwimp_get_pointer_info(&pointer); |
| 629 |
|
|
| 630 |
if (current_menu == (wimp_menu *) &iconbar_menu) { |
if (current_menu == (wimp_menu *) &iconbar_menu) { |
| 631 |
switch (selection->items[0]) { |
switch (selection->items[0]) { |
| 632 |
case 1: |
case 1: |
| 633 |
snprintf(minutes, sizeof minutes, "%i", interval / 60); |
snprintf(minutes, sizeof minutes, "%i", interval / 60); |
| 634 |
set_icon_string(choices_window, 1, minutes); |
set_icon_string(choices_window, 1, minutes); |
| 635 |
|
set_icon_string(choices_window, 8, font_headings); |
| 636 |
|
set_icon_string(choices_window, 11, font_summaries); |
| 637 |
|
set_icon_string(choices_window, 14, font_links); |
| 638 |
open_window(choices_window); |
open_window(choices_window); |
| 639 |
xwimp_set_caret_position(choices_window, 1, |
xwimp_set_caret_position(choices_window, 1, |
| 640 |
0, 0, -1, strlen(minutes)); |
0, 0, -1, strlen(minutes)); |
| 664 |
warn(feed_error); |
warn(feed_error); |
| 665 |
break; |
break; |
| 666 |
} |
} |
| 667 |
|
} else if (current_menu == (wimp_menu *) rufl_family_menu) { |
| 668 |
|
char *font = ((wimp_menu *) rufl_family_menu)-> |
| 669 |
|
entries[selection->items[0]].data.indirected_text.text; |
| 670 |
|
if (current_font_menu == 7) |
| 671 |
|
strncpy(font_headings, font, sizeof font_headings); |
| 672 |
|
else if (current_font_menu == 10) |
| 673 |
|
strncpy(font_summaries, font, sizeof font_summaries); |
| 674 |
|
else if (current_font_menu == 13) |
| 675 |
|
strncpy(font_links, font, sizeof font_links); |
| 676 |
|
set_icon_string(choices_window, 8, font_headings); |
| 677 |
|
set_icon_string(choices_window, 11, font_summaries); |
| 678 |
|
set_icon_string(choices_window, 14, font_links); |
| 679 |
|
update_main_window(); |
| 680 |
|
if (feed_count) |
| 681 |
|
update_feed_window(current_feed); |
| 682 |
} |
} |
| 683 |
|
|
| 684 |
|
if (pointer.buttons == wimp_CLICK_ADJUST) |
| 685 |
|
xwimp_create_menu(current_menu, pointer.pos.x, pointer.pos.y); |
| 686 |
} |
} |
| 687 |
|
|
| 688 |
|
|
| 791 |
|
|
| 792 |
p = add_paragraph(&main_window_paragraphs, 0, y, 700, |
p = add_paragraph(&main_window_paragraphs, 0, y, 700, |
| 793 |
0xffaa99, 0x000000, |
0xffaa99, 0x000000, |
| 794 |
"Homerton", style, 200, |
font_headings, style, 200, |
| 795 |
feeds[i].title ? (char *) feeds[i].title : |
feeds[i].title ? (char *) feeds[i].title : |
| 796 |
feeds[i].url, |
feeds[i].url, |
| 797 |
click_main_window, i); |
click_main_window, i); |
| 820 |
} |
} |
| 821 |
p = add_paragraph(&main_window_paragraphs, 700, y, 1000, |
p = add_paragraph(&main_window_paragraphs, 700, y, 1000, |
| 822 |
0xffaa99, 0x000000, |
0xffaa99, 0x000000, |
| 823 |
"Homerton", style, 200, |
font_headings, style, 200, |
| 824 |
status + i * 40, |
status + i * 40, |
| 825 |
click_main_window, i); |
click_main_window, i); |
| 826 |
y = p->y1 = y1; |
y = p->y1 = y1; |
| 828 |
if (feeds[i].error) { |
if (feeds[i].error) { |
| 829 |
p = add_paragraph(&main_window_paragraphs, 0, y, 1000, |
p = add_paragraph(&main_window_paragraphs, 0, y, 1000, |
| 830 |
0, 0x0000a0, |
0, 0x0000a0, |
| 831 |
"NewHall", style, 200, |
font_summaries, style, 200, |
| 832 |
feeds[i].error, |
feeds[i].error, |
| 833 |
click_main_window, i); |
click_main_window, i); |
| 834 |
y = p->y1; |
y = p->y1; |
| 837 |
if (feeds[i].description) { |
if (feeds[i].description) { |
| 838 |
p = add_paragraph(&main_window_paragraphs, 0, y, 1000, |
p = add_paragraph(&main_window_paragraphs, 0, y, 1000, |
| 839 |
0, 0x000000, |
0, 0x000000, |
| 840 |
"NewHall", rufl_WEIGHT_400, 200, |
font_summaries, rufl_WEIGHT_400, 200, |
| 841 |
feeds[i].description, |
feeds[i].description, |
| 842 |
click_main_window, i); |
click_main_window, i); |
| 843 |
y = p->y1; |
y = p->y1; |
| 919 |
|
|
| 920 |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
| 921 |
0xffaa99, 0x000000, |
0xffaa99, 0x000000, |
| 922 |
"Homerton", rufl_WEIGHT_400, 200, |
font_headings, rufl_WEIGHT_400, 200, |
| 923 |
feeds[i].title ? (char *) feeds[i].title : feeds[i].url, |
feeds[i].title ? (char *) feeds[i].title : feeds[i].url, |
| 924 |
0, 0); |
0, 0); |
| 925 |
y = p->y1; |
y = p->y1; |
| 927 |
if (feeds[i].link) { |
if (feeds[i].link) { |
| 928 |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
| 929 |
0, 0xff0000, |
0, 0xff0000, |
| 930 |
"Homerton", rufl_WEIGHT_400, 160, |
font_links, rufl_WEIGHT_400, 160, |
| 931 |
feeds[i].link, |
feeds[i].link, |
| 932 |
click_feed_link, i); |
click_feed_link, i); |
| 933 |
y = p->y1; |
y = p->y1; |
| 935 |
if (feeds[i].pub_date) { |
if (feeds[i].pub_date) { |
| 936 |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
| 937 |
0, 0x0060ee, |
0, 0x0060ee, |
| 938 |
"NewHall", rufl_WEIGHT_400 | rufl_SLANTED, 160, |
font_summaries, rufl_WEIGHT_400 | rufl_SLANTED, |
| 939 |
|
160, |
| 940 |
feeds[i].pub_date, |
feeds[i].pub_date, |
| 941 |
0, 0); |
0, 0); |
| 942 |
y = p->y1; |
y = p->y1; |
| 944 |
if (feeds[i].description) { |
if (feeds[i].description) { |
| 945 |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
| 946 |
0, 0x000000, |
0, 0x000000, |
| 947 |
"NewHall", rufl_WEIGHT_400, 200, |
font_summaries, rufl_WEIGHT_400, 200, |
| 948 |
feeds[i].description, |
feeds[i].description, |
| 949 |
0, 0); |
0, 0); |
| 950 |
y = p->y1; |
y = p->y1; |
| 952 |
if (feeds[i].copyright) { |
if (feeds[i].copyright) { |
| 953 |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
| 954 |
0, 0x666666, |
0, 0x666666, |
| 955 |
"NewHall", rufl_WEIGHT_400 | rufl_SLANTED, 160, |
font_summaries, rufl_WEIGHT_400 | rufl_SLANTED, 160, |
| 956 |
feeds[i].copyright, |
feeds[i].copyright, |
| 957 |
0, 0); |
0, 0); |
| 958 |
y = p->y1; |
y = p->y1; |
| 966 |
|
|
| 967 |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
| 968 |
0xa0dddd, 0x000000, |
0xa0dddd, 0x000000, |
| 969 |
"Homerton", style, 200, |
font_headings, style, 200, |
| 970 |
feeds[i].item[j].title ? |
feeds[i].item[j].title ? |
| 971 |
(char *) feeds[i].item[j].title : "", |
(char *) feeds[i].item[j].title : "", |
| 972 |
0, j); |
0, j); |
| 975 |
if (feeds[i].item[j].pub_date) { |
if (feeds[i].item[j].pub_date) { |
| 976 |
p = add_paragraph(&feed_window_paragraphs, 0, y, 420, |
p = add_paragraph(&feed_window_paragraphs, 0, y, 420, |
| 977 |
0, 0x0060ee, |
0, 0x0060ee, |
| 978 |
"NewHall", |
font_summaries, |
| 979 |
rufl_WEIGHT_400 | rufl_SLANTED, 160, |
rufl_WEIGHT_400 | rufl_SLANTED, 160, |
| 980 |
feeds[i].item[j].pub_date, |
feeds[i].item[j].pub_date, |
| 981 |
0, j); |
0, j); |
| 985 |
if (feeds[i].item[j].author) { |
if (feeds[i].item[j].author) { |
| 986 |
p = add_paragraph(&feed_window_paragraphs, 420, y, 720, |
p = add_paragraph(&feed_window_paragraphs, 420, y, 720, |
| 987 |
0, 0x666666, |
0, 0x666666, |
| 988 |
"NewHall", |
font_summaries, |
| 989 |
rufl_WEIGHT_400 | rufl_SLANTED, 160, |
rufl_WEIGHT_400 | rufl_SLANTED, 160, |
| 990 |
feeds[i].item[j].author, |
feeds[i].item[j].author, |
| 991 |
0, j); |
0, j); |
| 995 |
if (feeds[i].item[j].category) { |
if (feeds[i].item[j].category) { |
| 996 |
p = add_paragraph(&feed_window_paragraphs, 720, y, 1000, |
p = add_paragraph(&feed_window_paragraphs, 720, y, 1000, |
| 997 |
0, 0xee6000, |
0, 0xee6000, |
| 998 |
"NewHall", rufl_WEIGHT_400, 160, |
font_summaries, rufl_WEIGHT_400, 160, |
| 999 |
feeds[i].item[j].category, |
feeds[i].item[j].category, |
| 1000 |
0, j); |
0, j); |
| 1001 |
if (y1 < p->y1) |
if (y1 < p->y1) |
| 1006 |
if (feeds[i].item[j].link) { |
if (feeds[i].item[j].link) { |
| 1007 |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
| 1008 |
0, 0xff0000, |
0, 0xff0000, |
| 1009 |
"Homerton", rufl_WEIGHT_400, 160, |
font_links, rufl_WEIGHT_400, 160, |
| 1010 |
feeds[i].item[j].link, |
feeds[i].item[j].link, |
| 1011 |
click_item_link, j); |
click_item_link, j); |
| 1012 |
y = p->y1; |
y = p->y1; |
| 1015 |
if (feeds[i].item[j].description) { |
if (feeds[i].item[j].description) { |
| 1016 |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
p = add_paragraph(&feed_window_paragraphs, 0, y, 1000, |
| 1017 |
0, 0x000000, |
0, 0x000000, |
| 1018 |
"NewHall", rufl_WEIGHT_400, 180, |
font_summaries, rufl_WEIGHT_400, 180, |
| 1019 |
feeds[i].item[j].description, |
feeds[i].item[j].description, |
| 1020 |
0, j); |
0, j); |
| 1021 |
y = p->y1; |
y = p->y1; |
| 1216 |
return; |
return; |
| 1217 |
} |
} |
| 1218 |
fprintf(choices, "interval: %i\n", interval); |
fprintf(choices, "interval: %i\n", interval); |
| 1219 |
|
fprintf(choices, "font_headings: %s\n", font_headings); |
| 1220 |
|
fprintf(choices, "font_summaries: %s\n", font_summaries); |
| 1221 |
|
fprintf(choices, "font_links: %s\n", font_links); |
| 1222 |
fclose(choices); |
fclose(choices); |
| 1223 |
} |
} |
| 1224 |
|
|
| 1242 |
} |
} |
| 1243 |
while (fgets(s, sizeof s, choices)) { |
while (fgets(s, sizeof s, choices)) { |
| 1244 |
sscanf(s, "interval: %i", &interval); |
sscanf(s, "interval: %i", &interval); |
| 1245 |
|
sscanf(s, "font_headings: %s", font_headings); |
| 1246 |
|
sscanf(s, "font_summaries: %s", font_summaries); |
| 1247 |
|
sscanf(s, "font_links: %s", font_links); |
| 1248 |
} |
} |
| 1249 |
fclose(choices); |
fclose(choices); |
| 1250 |
} |
} |
| 1336 |
|
|
| 1337 |
xwimp_set_icon_state(w, i, 0, 0); |
xwimp_set_icon_state(w, i, 0, 0); |
| 1338 |
} |
} |
|
|
|