| 16 |
|
|
| 17 |
#include "section_list_display.h" |
#include "section_list_display.h" |
| 18 |
#include "section_list_loader.h" |
#include "section_list_loader.h" |
| 19 |
|
#include "article_cache.h" |
| 20 |
#include "common.h" |
#include "common.h" |
| 21 |
#include "io.h" |
#include "io.h" |
| 22 |
#include "screen.h" |
#include "screen.h" |
| 114 |
clearscr(); |
clearscr(); |
| 115 |
show_top(str_section_master, stitle, str_section_name); |
show_top(str_section_master, stitle, str_section_name); |
| 116 |
moveto(2, 0); |
moveto(2, 0); |
| 117 |
prints("离开[\033[1;32m←\033[0;37m,\033[1;32mESC\033[0;37m] 选择[\033[1;32m↑\033[0;37m,\033[1;32m↓\033[0;37m] 阅读[\033[1;32m→\033[0;37m,\033[1;32mENTER\033[0;37m]\033[m 昵称[\033[1;32mn\033[0;37m]\033[m"); |
prints("返回[\033[1;32m←\033[0;37m,\033[1;32mESC\033[0;37m] 选择[\033[1;32m↑\033[0;37m,\033[1;32m↓\033[0;37m] " |
| 118 |
|
"阅读[\033[1;32m→\033[0;37m,\033[1;32mENTER\033[0;37m]\033[m %s[\033[1;32mn\033[0;37m]\033[m", |
| 119 |
|
(display_nickname ? "显示用户名" : "显示昵称")); |
| 120 |
moveto(3, 0); |
moveto(3, 0); |
| 121 |
if (display_nickname) |
if (display_nickname) |
| 122 |
{ |
{ |
| 123 |
prints("\033[44;37m \033[1;37m 编 号 发 布 者 昵 称 日 期 文 章 标 题 \033[m"); |
prints("\033[44;37m \033[1;37m 编 号 发布者昵称 日 期 文章标题 \033[m"); |
| 124 |
} |
} |
| 125 |
else |
else |
| 126 |
{ |
{ |
| 127 |
prints("\033[44;37m \033[1;37m 编 号 发 布 者 日 期 文 章 标 题 \033[m"); |
prints("\033[44;37m \033[1;37m 编 号 发 布 者 日 期 文章标题 \033[m"); |
| 128 |
} |
} |
| 129 |
|
|
| 130 |
return 0; |
return 0; |
| 257 |
int page_count; |
int page_count; |
| 258 |
int page_id = 0; |
int page_id = 0; |
| 259 |
int selected_index = 0; |
int selected_index = 0; |
| 260 |
|
ARTICLE_CACHE article_cache; |
| 261 |
int ret; |
int ret; |
| 262 |
|
|
| 263 |
p_section = section_list_find_by_name(sname); |
p_section = section_list_find_by_name(sname); |
| 314 |
snprintf(page_info_str, sizeof(page_info_str), |
snprintf(page_info_str, sizeof(page_info_str), |
| 315 |
"\033[33m[第\033[36m%d\033[33m/\033[36m%d\033[33m页]", |
"\033[33m[第\033[36m%d\033[33m/\033[36m%d\033[33m页]", |
| 316 |
page_id + 1, MAX(page_count, 1)); |
page_id + 1, MAX(page_count, 1)); |
| 317 |
|
|
| 318 |
show_bottom(page_info_str); |
show_bottom(page_info_str); |
| 319 |
iflush(); |
iflush(); |
| 320 |
|
|
| 340 |
} |
} |
| 341 |
break; |
break; |
| 342 |
case VIEW_ARTICLE: |
case VIEW_ARTICLE: |
| 343 |
log_std("Debug: article %d selected\n", p_articles[selected_index]->aid); |
ret = article_cache_load(&article_cache, VAR_ARTICLE_CACHE_DIR, p_articles[selected_index]); |
| 344 |
|
if (ret < 0) |
| 345 |
|
{ |
| 346 |
|
log_error("article_cache_load(aid=%d, cid=%d)\n", p_articles[selected_index]->aid, p_articles[selected_index]->cid); |
| 347 |
|
break; |
| 348 |
|
} |
| 349 |
|
|
| 350 |
|
log_std("Debug: view article aid = %d, cid = %d\n", p_articles[selected_index]->aid, p_articles[selected_index]->cid); |
| 351 |
|
|
| 352 |
|
ret = article_cache_unload(&article_cache); |
| 353 |
|
if (ret < 0) |
| 354 |
|
{ |
| 355 |
|
log_error("article_cache_unload(aid=%d, cid=%d)\n", p_articles[selected_index]->aid, p_articles[selected_index]->cid); |
| 356 |
|
break; |
| 357 |
|
} |
| 358 |
|
|
| 359 |
|
// TODO: locate last viewed article |
| 360 |
case REFRESH_SCREEN: |
case REFRESH_SCREEN: |
| 361 |
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
| 362 |
{ |
{ |