• R/O
  • SSH
  • HTTPS

bchan: 提交


Commit MetaInfo

修訂456 (tree)
時間2012-05-01 02:29:22
作者ornse01

Log Message

uniting external bbs manager HMI to extbbslist_t.

Change Summary

差異

--- bchanl/trunk/src/main.c (revision 455)
+++ bchanl/trunk/src/main.c (revision 456)
@@ -683,21 +683,7 @@
683683
684684 LOCAL VOID bchanl_bbsmenu_registerexternalbbs(bchanl_bbsmenu_t *bchanl, TC *title, W title_len, TC *url, W url_len)
685685 {
686- W url_asc_len;
687- UB *url_asc;
688-
689- url_asc_len = tcstosjs(NULL, url);
690- url_asc = malloc(sizeof(UB)*(url_asc_len+1));
691- if (url_asc == NULL) {
692- DP_ER("malloc", 0);
693- return;
694- }
695- tcstosjs(url_asc, url);
696- url_asc[url_asc_len] = '\0';
697-
698- extbbslist_appenditem(bchanl->extbbslist, title, title_len, url_asc, url_asc_len);
699-
700- free(url_asc);
686+ extbbslist_editcontext_append(bchanl->editctx, title, title_len, url, url_len);
701687 }
702688
703689 LOCAL VOID bchanl_bbsmenu_relayoutcache(bchanl_bbsmenu_t *bchanl)
@@ -841,7 +827,10 @@
841827
842828 bchanl_bbsmenu_registerexternalbbs(&bchanl->bbsmenu, title, title_len, url, url_len);
843829
844- bchanl_bbsmenu_relayout(&bchanl->bbsmenu, bchanl->bbsmenuwindow);
830+ registerexternalwindow_setboradnametext(bchanl->registerexternalwindow, NULL, 0);
831+ registerexternalwindow_seturltext(bchanl->registerexternalwindow, NULL, 0);
832+
833+ externalbbswindow_requestredisp(bchanl->externalbbswindow);
845834 }
846835
847836 LOCAL VOID bchanl_externalbbswindow_draw(bchanl_t *bchanl)
@@ -872,9 +861,10 @@
872861
873862 LOCAL VOID bchanl_externalbbswindow_close(bchanl_t *bchanl)
874863 {
875- extbbslist_endedit(bchanl->bbsmenu.extbbslist, bchanl->bbsmenu.editctx, False);
864+ extbbslist_endedit(bchanl->bbsmenu.extbbslist, bchanl->bbsmenu.editctx, True);
876865 bchanl->bbsmenu.editctx = NULL;
877866 externalbbswindow_close(bchanl->externalbbswindow);
867+ bchanl_bbsmenu_relayout(&bchanl->bbsmenu, bchanl->bbsmenuwindow);
878868 }
879869
880870 LOCAL VOID bchanl_externalbbswindow_butdn(bchanl_t *bchanl, W type, PNT pos)
@@ -998,7 +988,7 @@
998988 {
999989 static RECT r0 = {{400, 100, 700+7, 200+30}};
1000990 static RECT r1 = {{100, 100, 300+7, 300+30}};
1001- static RECT r2 = {{400, 400, 700+7, 600+30}};
991+ static RECT r2 = {{400, 300, 800+7, 400+30}};
1002992 TC *title0 = NULL, *title1 = NULL;
1003993 W err;
1004994 WID wid;
@@ -1392,12 +1382,19 @@
13921382
13931383 LOCAL VOID bchanl_setupmenu(bchanl_t *bchanl)
13941384 {
1395- Bool isopen, isopen_extbbs;
1385+ Bool isopen, isopen_extbbs, selected = False;
1386+ W index;
13961387
13971388 isopen = subjectoptionwindow_isopen(bchanl->subjectoptionwindow);
13981389 isopen_extbbs = externalbbswindow_isopen(bchanl->externalbbswindow);
1390+ if (isopen_extbbs != False) {
1391+ index = extbbslist_editcontext_getselect(bchanl->bbsmenu.editctx);
1392+ if (index >= 0) {
1393+ selected = True;
1394+ }
1395+ }
13991396
1400- bchanl_mainmenu_setup(&bchanl->mainmenu, isopen, isopen_extbbs, False);
1397+ bchanl_mainmenu_setup(&bchanl->mainmenu, isopen, isopen_extbbs, selected);
14011398 }
14021399
14031400 LOCAL VOID bchanl_selectmenu(bchanl_t *bchanl, W sel)
@@ -1404,6 +1401,7 @@
14041401 {
14051402 Bool isopen;
14061403 RECT work;
1404+ W index;
14071405
14081406 switch(sel) {
14091407 case BCHANL_MAINMENU_SELECT_CLOSE: /* [終了] */
@@ -1445,10 +1443,37 @@
14451443 }
14461444 break;
14471445 case BCHANL_MAINMENU_SELECT_EXTBBS_UP:
1446+ isopen = externalbbswindow_isopen(bchanl->externalbbswindow);
1447+ if (isopen != False) {
1448+ index = extbbslist_editcontext_getselect(bchanl->bbsmenu.editctx);
1449+ if (index < 0) {
1450+ break;
1451+ }
1452+ extbbslist_editcontext_swapitem(bchanl->bbsmenu.editctx, index-1, index);
1453+ externalbbswindow_requestredisp(bchanl->externalbbswindow);
1454+ }
14481455 break;
14491456 case BCHANL_MAINMENU_SELECT_EXTBBS_DOWN:
1457+ isopen = externalbbswindow_isopen(bchanl->externalbbswindow);
1458+ if (isopen != False) {
1459+ index = extbbslist_editcontext_getselect(bchanl->bbsmenu.editctx);
1460+ if (index < 0) {
1461+ break;
1462+ }
1463+ extbbslist_editcontext_swapitem(bchanl->bbsmenu.editctx, index, index+1);
1464+ externalbbswindow_requestredisp(bchanl->externalbbswindow);
1465+ }
14501466 break;
14511467 case BCHANL_MAINMENU_SELECT_EXTBBS_DELETE:
1468+ isopen = externalbbswindow_isopen(bchanl->externalbbswindow);
1469+ if (isopen != False) {
1470+ index = extbbslist_editcontext_getselect(bchanl->bbsmenu.editctx);
1471+ if (index < 0) {
1472+ break;
1473+ }
1474+ extbbslist_editcontext_deleteitem(bchanl->bbsmenu.editctx, index);
1475+ externalbbswindow_requestredisp(bchanl->externalbbswindow);
1476+ }
14521477 break;
14531478 }
14541479 return;
@@ -1598,8 +1623,8 @@
15981623 case BCHANLHMIEVENT_TYPE_REGISTEREXTERNALWINDOW_PARTS_URL_KEYMENU:
15991624 break;
16001625 case BCHANLHMIEVENT_TYPE_REGISTEREXTERNALWINDOW_PARTS_DETERMINE_PUSH:
1626+ bchanl_registerexternalbbs(bchanl);
16011627 registerexternalwindow_close(bchanl->registerexternalwindow);
1602- bchanl_registerexternalbbs(bchanl);
16031628 break;
16041629 case BCHANLHMIEVENT_TYPE_REGISTEREXTERNALWINDOW_PARTS_CANCEL_PUSH:
16051630 registerexternalwindow_close(bchanl->registerexternalwindow);
Show on old repository browser