• R/O
  • SSH
  • HTTPS

bchan: 提交


Commit MetaInfo

修訂500 (tree)
時間2012-06-17 19:06:27
作者ornse01

Log Message

implement display attribute setter and getter interface.

Change Summary

差異

--- bchanl/trunk/src/subjectlayout.c (revision 499)
+++ bchanl/trunk/src/subjectlayout.c (revision 500)
@@ -147,6 +147,10 @@
147147 RECT vframe;
148148 };
149149
150+#define SBJTLAYOUT_FLAG_RESNUM_DISPLAY 0x00000001
151+#define SBJTLAYOUT_FLAG_SINCE_DISPLAY 0x00000002
152+#define SBJTLAYOUT_FLAG_VIGOR_DISPLAY 0x00000004
153+
150154 struct sbjtlayout_t_ {
151155 GID target;
152156 W draw_l,draw_t,draw_r,draw_b;
@@ -154,6 +158,7 @@
154158 W len;
155159 FSSPEC fspec;
156160 COLOR vobjbgcol;
161+ UW flag;
157162 };
158163
159164 LOCAL sbjtlayout_thread_t* sbjtlayout_thread_new(sbjtlist_tuple_t *thread)
@@ -367,6 +372,60 @@
367372 return layout->vobjbgcol;
368373 }
369374
375+EXPORT VOID sbjtlayout_setresnumberdisplay(sbjtlayout_t *layout, Bool display)
376+{
377+ if (display == False) {
378+ layout->flag = layout->flag & ~SBJTLAYOUT_FLAG_RESNUM_DISPLAY;
379+ } else {
380+ layout->flag |= SBJTLAYOUT_FLAG_RESNUM_DISPLAY;
381+ }
382+}
383+
384+EXPORT VOID sbjtlayout_setsincedisplay(sbjtlayout_t *layout, Bool display)
385+{
386+ if (display == False) {
387+ layout->flag = layout->flag & ~SBJTLAYOUT_FLAG_SINCE_DISPLAY;
388+ } else {
389+ layout->flag |= SBJTLAYOUT_FLAG_SINCE_DISPLAY;
390+ }
391+}
392+
393+EXPORT VOID sbjtlayout_setvigordisplay(sbjtlayout_t *layout, Bool display)
394+{
395+ if (display == False) {
396+ layout->flag = layout->flag & ~SBJTLAYOUT_FLAG_VIGOR_DISPLAY;
397+ } else {
398+ layout->flag |= SBJTLAYOUT_FLAG_VIGOR_DISPLAY;
399+ }
400+}
401+
402+EXPORT Bool sbjtlayout_getresnumberdisplay(sbjtlayout_t *layout)
403+{
404+ if ((layout->flag & SBJTLAYOUT_FLAG_RESNUM_DISPLAY) != 0) {
405+ return True;
406+ } else {
407+ return False;
408+ }
409+}
410+
411+EXPORT Bool sbjtlayout_getsincedisplay(sbjtlayout_t *layout)
412+{
413+ if ((layout->flag & SBJTLAYOUT_FLAG_SINCE_DISPLAY) != 0) {
414+ return True;
415+ } else {
416+ return False;
417+ }
418+}
419+
420+EXPORT Bool sbjtlayout_getvigordisplay(sbjtlayout_t *layout)
421+{
422+ if ((layout->flag & SBJTLAYOUT_FLAG_VIGOR_DISPLAY) != 0) {
423+ return True;
424+ } else {
425+ return False;
426+ }
427+}
428+
370429 EXPORT sbjtlayout_t* sbjtlayout_new(GID gid)
371430 {
372431 sbjtlayout_t *layout;
@@ -388,6 +447,7 @@
388447 layout->fspec.size.h = 16;
389448 layout->fspec.size.v = 16;
390449 layout->vobjbgcol = 0x10000000;
450+ layout->flag = 0;
391451
392452 return layout;
393453 }
--- bchanl/trunk/src/subjectlayout.h (revision 499)
+++ bchanl/trunk/src/subjectlayout.h (revision 500)
@@ -43,6 +43,12 @@
4343 IMPORT VOID sbjtlayout_setfsspec(sbjtlayout_t *layout, FSSPEC *fspec);
4444 IMPORT VOID sbjtlayout_setvobjbgcol(sbjtlayout_t *layout, COLOR color);
4545 IMPORT COLOR sbjtlayout_getvobjbgcol(sbjtlayout_t *layout);
46+IMPORT VOID sbjtlayout_setresnumberdisplay(sbjtlayout_t *layout, Bool display);
47+IMPORT VOID sbjtlayout_setsincedisplay(sbjtlayout_t *layout, Bool display);
48+IMPORT VOID sbjtlayout_setvigordisplay(sbjtlayout_t *layout, Bool display);
49+IMPORT Bool sbjtlayout_getresnumberdisplay(sbjtlayout_t *layout);
50+IMPORT Bool sbjtlayout_getsincedisplay(sbjtlayout_t *layout);
51+IMPORT Bool sbjtlayout_getvigordisplay(sbjtlayout_t *layout);
4652
4753 typedef struct sbjtdraw_t_ sbjtdraw_t;
4854
--- bchanl/trunk/src/bchanl_subject.c (revision 499)
+++ bchanl/trunk/src/bchanl_subject.c (revision 500)
@@ -318,6 +318,36 @@
318318 return BCHANL_SUBJECT_CREATEVIEWERVOBJ_CREATED;
319319 }
320320
321+EXPORT VOID bchanl_subject_setresnumberdisplay(bchanl_subject_t *subject, Bool display)
322+{
323+ sbjtlayout_setresnumberdisplay(subject->layout, display);
324+}
325+
326+EXPORT VOID bchanl_subject_setsincedisplay(bchanl_subject_t *subject, Bool display)
327+{
328+ sbjtlayout_setsincedisplay(subject->layout, display);
329+}
330+
331+EXPORT VOID bchanl_subject_setvigordisplay(bchanl_subject_t *subject, Bool display)
332+{
333+ sbjtlayout_setvigordisplay(subject->layout, display);
334+}
335+
336+EXPORT Bool bchanl_subject_getresnumberdisplay(bchanl_subject_t *subject)
337+{
338+ return sbjtlayout_getresnumberdisplay(subject->layout);
339+}
340+
341+EXPORT Bool bchanl_subject_getsincedisplay(bchanl_subject_t *subject)
342+{
343+ return sbjtlayout_getsincedisplay(subject->layout);
344+}
345+
346+EXPORT Bool bchanl_subject_getvigordisplay(bchanl_subject_t *subject)
347+{
348+ return sbjtlayout_getvigordisplay(subject->layout);
349+}
350+
321351 LOCAL W bchanl_subject_initialize(bchanl_subject_t *subject, GID gid, UB *host, W host_len, UB *board, W board_len, TC *title, W title_len, FSSPEC *fspec, COLOR vobjbgcol)
322352 {
323353 sbjtcache_t *cache;
--- bchanl/trunk/src/bchanl_subject.h (revision 499)
+++ bchanl/trunk/src/bchanl_subject.h (revision 500)
@@ -52,6 +52,12 @@
5252 #define BCHANL_SUBJECT_CREATEVIEWERVOBJ_CANCELED 0
5353 #define BCHANL_SUBJECT_CREATEVIEWERVOBJ_CREATED 1
5454 IMPORT W bchanl_subject_createviewervobj(bchanl_subject_t *subject, sbjtlist_tuple_t *tuple, UB *fsnrec, W fsnrec_len, VOBJSEG *seg, LINK *lnk);
55+IMPORT VOID bchanl_subject_setresnumberdisplay(bchanl_subject_t *subject, Bool display);
56+IMPORT VOID bchanl_subject_setsincedisplay(bchanl_subject_t *subject, Bool display);
57+IMPORT VOID bchanl_subject_setvigordisplay(bchanl_subject_t *subject, Bool display);
58+IMPORT Bool bchanl_subject_getresnumverdisplay(bchanl_subject_t *subject);
59+IMPORT Bool bchanl_subject_getsincedisplay(bchanl_subject_t *subject);
60+IMPORT Bool bchanl_subject_getvigordisplay(bchanl_subject_t *subject);
5561
5662 IMPORT bchanl_subjecthash_t* bchanl_subjecthash_new(GID gid, W base);
5763 IMPORT VOID bchanl_subjecthash_delete(bchanl_subjecthash_t *subjecthash);
--- bchanl/trunk/src/main.c (revision 499)
+++ bchanl/trunk/src/main.c (revision 500)
@@ -159,6 +159,11 @@
159159 bchanl_subjecthash_t *subjecthash;
160160 bchanl_bbsmenu_t bbsmenu;
161161 bchanl_subject_t *currentsubject;
162+ struct {
163+ Bool resnum;
164+ Bool since;
165+ Bool vigor;
166+ } subjectdisplay;
162167
163168 bchanlhmi_t *hmi;
164169 subjectwindow_t *subjectwindow;
@@ -169,6 +174,33 @@
169174 };
170175 typedef struct bchanl_t_ bchanl_t;
171176
177+LOCAL VOID bchanl_swapresnumberdisplay(bchanl_t *bchanl)
178+{
179+ if (bchanl->subjectdisplay.resnum != False) {
180+ bchanl->subjectdisplay.resnum = False;
181+ } else {
182+ bchanl->subjectdisplay.resnum = True;
183+ }
184+}
185+
186+LOCAL VOID bchanl_swapsincedisplay(bchanl_t *bchanl)
187+{
188+ if (bchanl->subjectdisplay.since != False) {
189+ bchanl->subjectdisplay.since = False;
190+ } else {
191+ bchanl->subjectdisplay.since = True;
192+ }
193+}
194+
195+LOCAL VOID bchanl_swapvigordisplay(bchanl_t *bchanl)
196+{
197+ if (bchanl->subjectdisplay.vigor != False) {
198+ bchanl->subjectdisplay.vigor = False;
199+ } else {
200+ bchanl->subjectdisplay.vigor = True;
201+ }
202+}
203+
172204 LOCAL VOID bchanl_killme(bchanl_t *bchanl);
173205
174206 LOCAL VOID bchanl_subjectwindow_draw(bchanl_t *bchanl)
@@ -381,6 +413,9 @@
381413 LOCAL VOID bchanl_setcurrentsubject(bchanl_t *bchanl, bchanl_subject_t *sbjt)
382414 {
383415 bchanl->currentsubject = sbjt;
416+ bchanl_subject_setresnumberdisplay(sbjt, bchanl->subjectdisplay.resnum);
417+ bchanl_subject_setsincedisplay(sbjt, bchanl->subjectdisplay.since);
418+ bchanl_subject_setvigordisplay(sbjt, bchanl->subjectdisplay.vigor);
384419 subjectwindow_requestredisp(bchanl->subjectwindow);
385420 }
386421
@@ -1138,6 +1173,9 @@
11381173 bchanl->subjecthash = subjecthash;
11391174
11401175 bchanl->currentsubject = NULL;
1176+ bchanl->subjectdisplay.resnum = True;
1177+ bchanl->subjectdisplay.since = False;
1178+ bchanl->subjectdisplay.vigor = False;
11411179
11421180 bchanl->vid = vid;
11431181 bchanl->exectype = exectype;
@@ -1515,7 +1553,7 @@
15151553 break;
15161554 }
15171555
1518- bchanl_mainmenu_setup(&bchanl->mainmenu, isopen, isopen_extbbs, selected, fromtray, totray, False, False, False);
1556+ bchanl_mainmenu_setup(&bchanl->mainmenu, isopen, isopen_extbbs, selected, fromtray, totray, bchanl->subjectdisplay.resnum, bchanl->subjectdisplay.since, bchanl->subjectdisplay.vigor);
15191557 }
15201558
15211559 LOCAL VOID bchanl_selectmenu(bchanl_t *bchanl, W sel, BCHANL_TEXTBOX_MENU_TYPE type)
@@ -1683,10 +1721,22 @@
16831721 }
16841722 break;
16851723 case BCHANL_MAINMENU_SELECT_DISPLAY_RESNUMBER:
1724+ bchanl_swapresnumberdisplay(bchanl);
1725+ if (bchanl->currentsubject != NULL) {
1726+ bchanl_subject_setresnumberdisplay(bchanl->currentsubject, bchanl->subjectdisplay.resnum);
1727+ }
16861728 break;
16871729 case BCHANL_MAINMENU_SELECT_DISPLAY_SINCE:
1730+ bchanl_swapsincedisplay(bchanl);
1731+ if (bchanl->currentsubject != NULL) {
1732+ bchanl_subject_setsincedisplay(bchanl->currentsubject, bchanl->subjectdisplay.since);
1733+ }
16881734 break;
16891735 case BCHANL_MAINMENU_SELECT_DISPLAY_VIGOR:
1736+ bchanl_swapvigordisplay(bchanl);
1737+ if (bchanl->currentsubject != NULL) {
1738+ bchanl_subject_setvigordisplay(bchanl->currentsubject, bchanl->subjectdisplay.vigor);
1739+ }
16901740 break;
16911741 }
16921742 return;
Show on old repository browser