• R/O
  • SSH
  • HTTPS

bchan: 提交


Commit MetaInfo

修訂514 (tree)
時間2012-07-06 00:16:16
作者ornse01

Log Message

implement external bbs window scrolling.

Change Summary

差異

--- bchanl/trunk/src/extbbslist.c (revision 513)
+++ bchanl/trunk/src/extbbslist.c (revision 514)
@@ -809,8 +809,8 @@
809809 gdra_lin(target, p1, p2, 1, lnpat, G_STORE);
810810
811811 p1.y = p2.y;
812- p1.x = ctx->view_l;
813- p2.x = ctx->view_r;
812+ p1.x = 0;
813+ p2.x = ctx->view_r - ctx->view_l;
814814 gdra_lin(target, p1, p2, 1, lnpat, G_STORE);
815815
816816 return 0;
@@ -1023,11 +1023,37 @@
10231023 ctx->view_b += dv;
10241024 }
10251025
1026-EXPORT VOID extbbslist_editcontext_getdrawrect(extbbslist_editcontext_t *ctx, W *l, W *t, W *r, W *b)
1026+EXPORT VOID extbbslist_editcontext_getdrawrect(extbbslist_editcontext_t *ctx, GID gid, W *l, W *t, W *r, W *b)
10271027 {
1028+ extbbslist_item_t *senti, *item;
1029+ W max = 0, width;
1030+ FSSPEC fspec;
1031+
1032+ gget_fon(gid, &fspec, NULL);
1033+ fspec.size.h = fspec.size.v / 2;
1034+ gset_fon(gid, &fspec);
1035+
1036+ senti = extbbslist_editcontext_sentinelnode(ctx);
1037+ item = extbbslist_item_nextnode(senti);
1038+ for (;;) {
1039+ if (item == senti) {
1040+ break;
1041+ }
1042+
1043+ width = gget_stw(gid, item->url.tc, item->url.tc_len, NULL, NULL);
1044+ if (width < 0) {
1045+ continue;
1046+ }
1047+ if (width > max) {
1048+ max = width;
1049+ }
1050+
1051+ item = extbbslist_item_nextnode(item);
1052+ }
1053+
10281054 *l = 0;
10291055 *t = 0;
1030- *r = 200;
1056+ *r = EXTBBSLIST_TITLE_WIDTH + 8 + max + 4;
10311057 *b = EXTBBSLIST_ENTRY_HEIGHT * ctx->num;
10321058 }
10331059
--- bchanl/trunk/src/extbbslist.h (revision 513)
+++ bchanl/trunk/src/extbbslist.h (revision 514)
@@ -60,6 +60,6 @@
6060 IMPORT VOID extbbslist_editcontext_setviewrect(extbbslist_editcontext_t *ctx, W l, W t, W r, W b);
6161 IMPORT VOID extbbslist_editcontext_getviewrect(extbbslist_editcontext_t *ctx, W *l, W *t, W *r, W *b);
6262 IMPORT VOID extbbslist_editcontext_scrollviewrect(extbbslist_editcontext_t *ctx, W dh, W dv);
63-IMPORT VOID extbbslist_editcontext_getdrawrect(extbbslist_editcontext_t *ctx, W *l, W *t, W *r, W *b);
63+IMPORT VOID extbbslist_editcontext_getdrawrect(extbbslist_editcontext_t *ctx, GID gid, W *l, W *t, W *r, W *b);
6464
6565 #endif
--- bchanl/trunk/src/main.c (revision 513)
+++ bchanl/trunk/src/main.c (revision 514)
@@ -866,8 +866,9 @@
866866 {
867867 TC title[128];
868868 TC url[256];
869- W title_len, url_len;
869+ W title_len, url_len, l, t, r, b;
870870 TCURL_CHECK_VALID_BBSURL ret;
871+ GID gid;
871872
872873 title_len = registerexternalwindow_getboradnametext(bchanl->registerexternalwindow, title, 128);
873874 if (title_len < 0) {
@@ -906,6 +907,9 @@
906907 registerexternalwindow_setboradnametext(bchanl->registerexternalwindow, NULL, 0);
907908 registerexternalwindow_seturltext(bchanl->registerexternalwindow, NULL, 0);
908909
910+ gid = externalbbswindow_getGID(bchanl->externalbbswindow);
911+ extbbslist_editcontext_getdrawrect(bchanl->bbsmenu.editctx, gid, &l, &t, &r, &b);
912+ externalbbswindow_setdrawrect(bchanl->externalbbswindow, l, t, r, b);
909913 externalbbswindow_requestredisp(bchanl->externalbbswindow);
910914
911915 return True;
@@ -1694,7 +1698,8 @@
16941698 RECT work;
16951699 #define BCHANL_SELECTMENU_STRBUF_LENGTH 256
16961700 TC str[BCHANL_SELECTMENU_STRBUF_LENGTH];
1697- W index, len = 0;
1701+ W index, len = 0, l, t, r, b;
1702+ GID gid;
16981703
16991704 switch(sel) {
17001705 case BCHANL_MAINMENU_SELECT_CLOSE: /* [終了] */
@@ -1727,6 +1732,9 @@
17271732 externalbbswindow_getworkrect(bchanl->externalbbswindow, &work);
17281733 extbbslist_editcontext_setviewrect(bchanl->bbsmenu.editctx, 0, 0, work.c.right - work.c.left, work.c.bottom - work.c.top);
17291734 externalbbswindow_setworkrect(bchanl->externalbbswindow, 0, 0, work.c.right - work.c.left, work.c.bottom - work.c.top);
1735+ gid = externalbbswindow_getGID(bchanl->externalbbswindow);
1736+ extbbslist_editcontext_getdrawrect(bchanl->bbsmenu.editctx, gid, &l, &t, &r, &b);
1737+ externalbbswindow_setdrawrect(bchanl->externalbbswindow, l, t, r, b);
17301738 }
17311739 break;
17321740 case BCHANL_MAINMENU_SELECT_EXTBBS_REGISTER:
@@ -1765,6 +1773,9 @@
17651773 break;
17661774 }
17671775 extbbslist_editcontext_deleteitem(bchanl->bbsmenu.editctx, index);
1776+ gid = externalbbswindow_getGID(bchanl->externalbbswindow);
1777+ extbbslist_editcontext_getdrawrect(bchanl->bbsmenu.editctx, gid, &l, &t, &r, &b);
1778+ externalbbswindow_setdrawrect(bchanl->externalbbswindow, l, t, r, b);
17681779 externalbbswindow_requestredisp(bchanl->externalbbswindow);
17691780 }
17701781 break;
@@ -2043,8 +2054,8 @@
20432054 bchanl_externalbbswindow_draw(bchanl);
20442055 break;
20452056 case BCHANLHMIEVENT_TYPE_EXTERNALBBSWINDOW_RESIZE:
2057+ bchanl_externalbbswindow_resize(bchanl, evt->data.externalbbswindow_resize.work_sz);
20462058 break;
2047- bchanl_externalbbswindow_resize(bchanl, evt->data.externalbbswindow_resize.work_sz);
20482059 case BCHANLHMIEVENT_TYPE_EXTERNALBBSWINDOW_CLOSE:
20492060 bchanl_externalbbswindow_close(bchanl);
20502061 break;
Show on old repository browser