4 * Copyright (c) 2010 project bchan
6 * This software is provided 'as-is', without any express or implied
7 * warranty. In no event will the authors be held liable for any damages
8 * arising from the use of this software.
10 * Permission is granted to anyone to use this software for any purpose,
11 * including commercial applications, and to alter it and redistribute it
12 * freely, subject to the following restrictions:
14 * 1. The origin of this software must not be misrepresented; you must not
15 * claim that you wrote the original software. If you use this software
16 * in a product, an acknowledgment in the product documentation would be
17 * appreciated but is not required.
19 * 2. Altered source versions must be plainly marked as such, and must not be
20 * misrepresented as being the original software.
22 * 3. This notice may not be removed or altered from any source
27 #include "bchan_vobj.h"
32 #include <btron/btron.h>
33 #include <btron/vobj.h>
34 #include <btron/hmi.h>
38 #ifdef BCHAN_CONFIG_DEBUG
39 # define DP(arg) printf arg
40 # define DP_ER(msg, err) printf("%s (%d/%x)\n", msg, err>>16, err)
43 # define DP_ER(msg, err) /**/
46 LOCAL W adjust_vobj(VOBJSEG *seg, VLINK *vlnk)
52 seg->view = (RECT){{0,0,300,20}};
55 seg->frcol = 0x10000000;
56 seg->chcol = 0x10000000;
57 err = wget_inf(WI_VOBJBGCOL, &seg->tbcol, sizeof(COLOR));
59 seg->tbcol = 0x10ffffff;
61 seg->bgcol = 0x10ffffff;
64 vid = oreg_vob(vlnk, seg, -1, V_NODISP);
66 DP_ER("oreg_vob", vid);
69 err = orsz_vob(vid, &newr, V_ADJUST1|V_NODISP);
71 DP_ER("orsz_vob", vid);
76 err = odel_vob(vid, 0);
78 DP_ER("odel_vob", err);
85 EXPORT W bchan_createbbbvobj(UB *fsn_bbb, W fsn_bbb_len, UB *fsn_texedit, W fsn_texedit_len, UB *taddata, W taddata_len, VOBJSEG *seg, LINK *lnk)
89 TADSEG *base = (TADSEG*)bin;
90 INFOSEG *infoseg = (INFOSEG*)(bin + 4);
91 TEXTSEG *textseg = (TEXTSEG*)(bin + 4);
93 fd = cre_fil(lnk, (TC*)taddata, NULL, 0x31, F_FLOAT);
95 DP_ER("cre_fil error", fd);
99 err = apd_rec(fd, fsn_bbb, fsn_bbb_len, 8, 0, 0);
101 DP_ER("apd_rec:fusen rec error", err);
103 del_fil(NULL, lnk, 0);
107 err = apd_rec(fd, fsn_texedit, fsn_texedit_len, 8, 0, 0);
109 DP_ER("apd_rec:fusen rec error", err);
111 del_fil(NULL, lnk, 0);
115 err = apd_rec(fd, NULL, 0, RT_TADDATA, 0, 0);
117 DP_ER("apd_rec:retrieve info error", err);
119 del_fil(NULL, lnk, 0);
122 err = see_rec(fd, -1, -1, NULL);
124 DP_ER("see_rec error", err);
126 del_fil(NULL, lnk, 0);
133 infoseg->data[0] = 0x0122;
134 err = wri_rec(fd, -1, bin, 4+6, NULL, NULL, 0);
136 DP_ER("wri_rec:infoseg error", err);
138 del_fil(NULL, lnk, 0);
143 textseg->view = (RECT){{0, 0, 0, 0}};
144 textseg->draw = (RECT){{0, 0, 0, 0}};
145 textseg->h_unit = -120;
146 textseg->v_unit = -120;
147 textseg->lang = 0x21;
149 err = wri_rec(fd, -1, bin, 4+24, NULL, NULL, 0);
151 DP_ER("wri_rec:textseg error", err);
153 del_fil(NULL, lnk, 0);
156 err = wri_rec(fd, -1, taddata, taddata_len, NULL, NULL, 0);
158 DP_ER("wri_rec:data error", err);
160 del_fil(NULL, lnk, 0);
165 err = wri_rec(fd, -1, bin, 4, NULL, NULL, 0);
167 DP_ER("wri_rec:textend error", err);
169 del_fil(NULL, lnk, 0);
175 err = adjust_vobj(seg, (VLINK*)lnk);
177 DP_ER("adjust_vobj", err);
178 del_fil(NULL, lnk, 0);
185 EXPORT W bchan_createviewervobj(TC *title, UB *fsn, W fsn_len, UB *host, W host_len, UB *board, W board_len, UB *thread, W thread_len, VOBJSEG *seg, LINK *lnk)
189 fd = cre_fil(lnk, title, NULL, 1, F_FLOAT);
191 DP_ER("cre_fil error", fd);
195 err = apd_rec(fd, fsn, fsn_len, 8, 0, 0);
197 DP_ER("apd_rec:fusen rec error", err);
199 del_fil(NULL, lnk, 0);
203 err = apd_rec(fd, NULL, NULL, DATCACHE_RECORDTYPE_INFO, DATCACHE_RECORDSUBTYPE_RETRIEVE, 0);
205 DP_ER("apd_rec:retrieve info error", err);
207 del_fil(NULL, lnk, 0);
210 err = see_rec(fd, -1, -1, NULL);
212 DP_ER("see_rec error", err);
214 del_fil(NULL, lnk, 0);
218 err = wri_rec(fd, -1, host, host_len, NULL, NULL, 0);
220 DP_ER("wri_rec:host error", err);
222 del_fil(NULL, lnk, 0);
225 err = wri_rec(fd, -1, "\n", 1, NULL, NULL, 0);
227 DP_ER("wri_rec:host error", err);
229 del_fil(NULL, lnk, 0);
232 err = wri_rec(fd, -1, board, board_len, NULL, NULL, 0);
234 DP_ER("wri_rec:board error", err);
236 del_fil(NULL, lnk, 0);
239 err = wri_rec(fd, -1, "\n", 1, NULL, NULL, 0);
241 DP_ER("wri_rec:board error", err);
243 del_fil(NULL, lnk, 0);
246 err = wri_rec(fd, -1, thread, thread_len, NULL, NULL, 0);
248 DP_ER("wri_rec:thread error", err);
250 del_fil(NULL, lnk, 0);
253 err = wri_rec(fd, -1, "\n", 1, NULL, NULL, 0);
255 DP_ER("wri_rec:thread error", err);
257 del_fil(NULL, lnk, 0);
263 err = adjust_vobj(seg, (VLINK*)lnk);
265 DP_ER("adjust_vobj", err);
266 del_fil(NULL, lnk, 0);