| 1 | #include "DST_WinManager.h" |
|---|
| 2 | #include "DST_CC_Setup.h" |
|---|
| 3 | #include "DST_CCTask.h" |
|---|
| 4 | #include "DST_HostInterface.h" |
|---|
| 5 | #include "DST_FontEngine.h" |
|---|
| 6 | |
|---|
| 7 | extern DS_U16 DMW_KSX2UniSub(DS_U8 high, DS_U8 low); |
|---|
| 8 | #define COLOR_TRANSPARENT 0 |
|---|
| 9 | #if 0 |
|---|
| 10 | ____CC_708_Font_Size_Decide__() |
|---|
| 11 | #endif |
|---|
| 12 | |
|---|
| 13 | static int debug_cc = 0; |
|---|
| 14 | |
|---|
| 15 | /*extern "C" */void DST_708Debug(bool bOn) |
|---|
| 16 | { |
|---|
| 17 | debug_cc = bOn ? 1 : 0; |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | #define MAX_708_ROW 15 |
|---|
| 21 | #define MAX_708_COL 52 // korean 708 cc ¿¡ µû¸§ |
|---|
| 22 | |
|---|
| 23 | static int DST_708_FontSize[3] = {0,0,0}; // 0 = small, 1 = standard, 2 = large |
|---|
| 24 | |
|---|
| 25 | int DST_708_GetFontSize(int n) // 0 = min, 1 = std, 2 = max |
|---|
| 26 | { |
|---|
| 27 | if (DST_708_FontSize[0] == 0) |
|---|
| 28 | { |
|---|
| 29 | DST_708_FontSize[0] = DST_DecideFontSize(13); // ½ºÅ©¸° ³ôÀÌ¿¡ 15ÁÙ ±×¸±¼ö ÀÖÀ¸¸é Samll |
|---|
| 30 | DST_708_FontSize[1] = DST_DecideFontSize(12); // ½ºÅ©¸° ³ôÀÌ¿¡ 12ÁÙ ±×¸±¼ö ÀÖÀ¸¸é Standard |
|---|
| 31 | DST_708_FontSize[2] = DST_DecideFontSize(11); // ½ºÅ©¸° ³ôÀÌ¿¡ 9ÁÙ ±×¸±¼ö ÀÖÀ¸¸é Large |
|---|
| 32 | DST_Printf("708 Font Size = %d %d %d\n", DST_708_FontSize[0], DST_708_FontSize[1], DST_708_FontSize[2]); |
|---|
| 33 | } |
|---|
| 34 | return DST_708_FontSize[n]; |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | #if 0 |
|---|
| 38 | ____CC_708_Region_Process___() |
|---|
| 39 | #endif |
|---|
| 40 | |
|---|
| 41 | static DST_RECT cc708_rect = { 0,0,0,0}; |
|---|
| 42 | static void DST_UpdateRegionReset() |
|---|
| 43 | { |
|---|
| 44 | memset(&cc708_rect, 0, sizeof(DST_RECT)); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | static void DST_UpdateRegionAdd(DST_RECT rectNew) |
|---|
| 48 | { |
|---|
| 49 | if (rectNew.w == 0 || rectNew.h == 0) return; |
|---|
| 50 | // Çå¹Ú½ºÀÇ Å©±â°¡ 0ÀÌ¸é »õ¹Ú½ºÀÇ Å©±â·Î ´ëüÇÑ´Ù. |
|---|
| 51 | if (cc708_rect.w == 0 || cc708_rect.h == 0) |
|---|
| 52 | { |
|---|
| 53 | cc708_rect = rectNew; |
|---|
| 54 | return; |
|---|
| 55 | } |
|---|
| 56 | DST_RECT rectTemp = cc708_rect; |
|---|
| 57 | #ifndef min |
|---|
| 58 | #define min(a,b) ((a)>(b)?(b):(a)) |
|---|
| 59 | #endif |
|---|
| 60 | #ifndef max |
|---|
| 61 | #define max(a,b) ((a)>(b)?(a):(b)) |
|---|
| 62 | #endif |
|---|
| 63 | cc708_rect.x = min(rectTemp.x, rectNew.x ); |
|---|
| 64 | cc708_rect.y = min(rectTemp.y, rectNew.y ); |
|---|
| 65 | cc708_rect.w = max(rectTemp.x + rectTemp.w, rectNew.x + rectNew.w) - cc708_rect.x; |
|---|
| 66 | cc708_rect.h = max(rectTemp.y + rectTemp.h, rectNew.y + rectNew.h) - cc708_rect.y; |
|---|
| 67 | |
|---|
| 68 | if (cc708_rect.x < 0) cc708_rect.x = 0; |
|---|
| 69 | if (cc708_rect.y < 0) cc708_rect.y = 0; |
|---|
| 70 | int nScreenHeight = DST_GetCCScreenHeight(); |
|---|
| 71 | int nScreenWidth = DST_GetCCScreenWidth(); |
|---|
| 72 | if (cc708_rect.w > nScreenWidth - cc708_rect.x) cc708_rect.w = nScreenWidth - cc708_rect.x; |
|---|
| 73 | if (cc708_rect.h > nScreenHeight - cc708_rect.y) cc708_rect.h = nScreenHeight - cc708_rect.y; |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | static DST_RECT DST_UpdateRegionGet() |
|---|
| 77 | { |
|---|
| 78 | return cc708_rect; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | #if 0 |
|---|
| 82 | ____CC_708_Queue____() |
|---|
| 83 | #endif |
|---|
| 84 | |
|---|
| 85 | #define QUEUE_LENGTH 2048 |
|---|
| 86 | |
|---|
| 87 | typedef struct _CCCIRCULARQUEUE CCCircularQueue; |
|---|
| 88 | typedef void (*CCCIRCULARQUEUE_Constructor) (CCCircularQueue* this); |
|---|
| 89 | typedef void (*CCCIRCULARQUEUE_Desstructor) (CCCircularQueue* this); |
|---|
| 90 | typedef void (*CCCIRCULARQUEUE_Reset) (CCCircularQueue* this); |
|---|
| 91 | typedef int (*CCCIRCULARQUEUE_GetSize) (CCCircularQueue* this); |
|---|
| 92 | typedef int (*CCCIRCULARQUEUE_GetFreeSize) (CCCircularQueue* this); |
|---|
| 93 | typedef bool (*CCCIRCULARQUEUE_Add1) (CCCircularQueue* this, unsigned char *Buff, int nSize); |
|---|
| 94 | typedef bool (*CCCIRCULARQUEUE_Add2) (CCCircularQueue* this, unsigned char ucBuff); |
|---|
| 95 | typedef unsigned char (*CCCIRCULARQUEUE_GetByte) (CCCircularQueue* this); |
|---|
| 96 | typedef unsigned char (*CCCIRCULARQUEUE_GetNextByte) (CCCircularQueue* this); |
|---|
| 97 | typedef unsigned char (*CCCIRCULARQUEUE_GetNextNextByte) (CCCircularQueue* this); |
|---|
| 98 | typedef bool (*CCCIRCULARQUEUE_Get) (CCCircularQueue* this, unsigned char *data, int nSize); |
|---|
| 99 | typedef void (*CCCIRCULARQUEUE_RemoveByte) (CCCircularQueue* this); |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | struct _CCCIRCULARQUEUE |
|---|
| 103 | { |
|---|
| 104 | int head; |
|---|
| 105 | int tail; |
|---|
| 106 | int nLength; |
|---|
| 107 | unsigned char buffer[QUEUE_LENGTH]; |
|---|
| 108 | |
|---|
| 109 | CCCIRCULARQUEUE_Constructor Constructor; |
|---|
| 110 | CCCIRCULARQUEUE_Desstructor Destructor; |
|---|
| 111 | CCCIRCULARQUEUE_Reset Reset; |
|---|
| 112 | CCCIRCULARQUEUE_GetSize GetSize; |
|---|
| 113 | CCCIRCULARQUEUE_GetFreeSize GetFreeSize; |
|---|
| 114 | CCCIRCULARQUEUE_Add1 Add1; |
|---|
| 115 | CCCIRCULARQUEUE_Add2 Add2; |
|---|
| 116 | CCCIRCULARQUEUE_GetByte GetByte; |
|---|
| 117 | CCCIRCULARQUEUE_GetNextByte GetNextByte; |
|---|
| 118 | CCCIRCULARQUEUE_GetNextNextByte GetNextNextByte; |
|---|
| 119 | CCCIRCULARQUEUE_Get Get; |
|---|
| 120 | CCCIRCULARQUEUE_RemoveByte RemoveByte; |
|---|
| 121 | }; |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | void QWin_Constructor(CCCircularQueue* this) |
|---|
| 125 | { |
|---|
| 126 | this->Reset(this); |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | void QWin_Destructor(CCCircularQueue* this) |
|---|
| 130 | { |
|---|
| 131 | |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | void QWin_Reset(CCCircularQueue* this) |
|---|
| 135 | { |
|---|
| 136 | this->head = 0; |
|---|
| 137 | this->tail = 0; |
|---|
| 138 | this->nLength = 0; |
|---|
| 139 | |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | int QWin_GetSize(CCCircularQueue* this) |
|---|
| 143 | { |
|---|
| 144 | return this->nLength; |
|---|
| 145 | |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | int QWin_GetFreeSize(CCCircularQueue* this) |
|---|
| 149 | { |
|---|
| 150 | return QUEUE_LENGTH - this->GetSize(this); |
|---|
| 151 | |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | bool QWin_Add1(CCCircularQueue* this, unsigned char *Buff, int nSize) |
|---|
| 155 | { |
|---|
| 156 | if (this->GetFreeSize(this) < nSize) return false; |
|---|
| 157 | while (nSize--) this->Add2(this, *(Buff++)); |
|---|
| 158 | return true; |
|---|
| 159 | |
|---|
| 160 | } |
|---|
| 161 | |
|---|
| 162 | bool QWin_Add2(CCCircularQueue* this, unsigned char ucBuff) |
|---|
| 163 | { |
|---|
| 164 | if (this->GetFreeSize(this) < 1) return false; |
|---|
| 165 | this->buffer[this->head] = ucBuff; |
|---|
| 166 | this->head = (this->head == QUEUE_LENGTH-1) ? 0 : this->head + 1; |
|---|
| 167 | this->nLength++; |
|---|
| 168 | return true; |
|---|
| 169 | |
|---|
| 170 | } |
|---|
| 171 | |
|---|
| 172 | unsigned char QWin_GetByte(CCCircularQueue* this) |
|---|
| 173 | { |
|---|
| 174 | if (this->GetSize(this) < 1) return 0; |
|---|
| 175 | return this->buffer[this->tail]; |
|---|
| 176 | |
|---|
| 177 | } |
|---|
| 178 | |
|---|
| 179 | unsigned char QWin_GetNextByte(CCCircularQueue* this) |
|---|
| 180 | { |
|---|
| 181 | if (this->GetSize(this) < 2) return 0; |
|---|
| 182 | switch (this->tail) |
|---|
| 183 | { |
|---|
| 184 | case QUEUE_LENGTH - 1: |
|---|
| 185 | return this->buffer [0]; |
|---|
| 186 | } |
|---|
| 187 | return this->buffer[this->tail+1]; |
|---|
| 188 | |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | unsigned char QWin_GetNextNextByte(CCCircularQueue* this) |
|---|
| 192 | { |
|---|
| 193 | if (this->GetSize(this) < 3) return 0; |
|---|
| 194 | switch (this->tail) |
|---|
| 195 | { |
|---|
| 196 | case QUEUE_LENGTH - 2: |
|---|
| 197 | return this->buffer [0]; |
|---|
| 198 | case QUEUE_LENGTH - 1: |
|---|
| 199 | return this->buffer [1]; |
|---|
| 200 | } |
|---|
| 201 | return this->buffer[this->tail+2]; |
|---|
| 202 | |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | bool QWin_Get(CCCircularQueue* this, unsigned char *data, int nSize) |
|---|
| 206 | { |
|---|
| 207 | int i = 0; |
|---|
| 208 | if (this->GetSize(this) < nSize) return false; |
|---|
| 209 | for ( i = 0; i < nSize; i++) |
|---|
| 210 | { |
|---|
| 211 | data[i] = this->GetByte(this); |
|---|
| 212 | this->RemoveByte(this); |
|---|
| 213 | } |
|---|
| 214 | return true; |
|---|
| 215 | |
|---|
| 216 | } |
|---|
| 217 | |
|---|
| 218 | void QWin_RemoveByte(CCCircularQueue* this) |
|---|
| 219 | { |
|---|
| 220 | if (this->GetSize(this) < 1) return; |
|---|
| 221 | this->tail = (this->tail == QUEUE_LENGTH-1) ? 0 : this->tail+1; |
|---|
| 222 | this->nLength--; |
|---|
| 223 | |
|---|
| 224 | } |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | // ±âº» À©µµ¿ì¸¦ »ý¼ºÇÑ´Ù. |
|---|
| 229 | CCCircularQueue* NewCCCircularQueue() |
|---|
| 230 | { |
|---|
| 231 | CCCircularQueue* pWin= (CCCircularQueue *)DST_OS_Calloc(sizeof(CCCircularQueue), 1); |
|---|
| 232 | pWin->Constructor = QWin_Constructor; |
|---|
| 233 | pWin->Destructor = QWin_Destructor; |
|---|
| 234 | pWin->Reset = QWin_Reset; |
|---|
| 235 | pWin->GetSize = QWin_GetSize; |
|---|
| 236 | pWin->GetFreeSize = QWin_GetFreeSize; |
|---|
| 237 | pWin->Add1 = QWin_Add1; |
|---|
| 238 | pWin->Add2 = QWin_Add2; |
|---|
| 239 | pWin->GetByte = QWin_GetByte; |
|---|
| 240 | pWin->GetNextByte = QWin_GetNextByte; |
|---|
| 241 | pWin->GetNextNextByte = QWin_GetNextNextByte; |
|---|
| 242 | pWin->Get = QWin_Get; |
|---|
| 243 | pWin->RemoveByte = QWin_RemoveByte; |
|---|
| 244 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 245 | pWin->Constructor(pWin); |
|---|
| 246 | return pWin; |
|---|
| 247 | } |
|---|
| 248 | |
|---|
| 249 | // ¼Ò¸êÀÚ È£Ãâ |
|---|
| 250 | void DeleteCCCircularQueue(CCCircularQueue*pWin) |
|---|
| 251 | { |
|---|
| 252 | if (pWin == 0) return; |
|---|
| 253 | if (pWin->Destructor) pWin->Destructor(pWin); |
|---|
| 254 | // if (pWin->DestructorMother) pWin->DestructorMother(pWin); |
|---|
| 255 | DST_OS_Free(&pWin); |
|---|
| 256 | } |
|---|
| 257 | |
|---|
| 258 | #if 0 |
|---|
| 259 | ____CC_708_Window____() |
|---|
| 260 | #endif |
|---|
| 261 | |
|---|
| 262 | typedef struct |
|---|
| 263 | { |
|---|
| 264 | DS_U8 red; |
|---|
| 265 | DS_U8 green; |
|---|
| 266 | DS_U8 blue; |
|---|
| 267 | } DST_708_Color; |
|---|
| 268 | |
|---|
| 269 | typedef struct |
|---|
| 270 | { |
|---|
| 271 | // Define Window |
|---|
| 272 | DS_U8 priority; // 0 ~ 7 |
|---|
| 273 | DS_U8 anchor_point; // 0 ~8 |
|---|
| 274 | DS_U8 relative_positioning; // 0 ~ 1 |
|---|
| 275 | DS_U8 anchor_vertical; |
|---|
| 276 | DS_U8 anchor_horizontal; |
|---|
| 277 | DS_U8 row_count; |
|---|
| 278 | DS_U8 column_count; |
|---|
| 279 | DS_U8 row_lock; |
|---|
| 280 | DS_U8 column_lock; |
|---|
| 281 | DS_U8 visible; |
|---|
| 282 | DS_U8 window_styleID; |
|---|
| 283 | DS_U8 pen_styleID; |
|---|
| 284 | // Set Window Attributes |
|---|
| 285 | DS_U8 justify; |
|---|
| 286 | DS_U8 print_direction; |
|---|
| 287 | DS_U8 scroll_direction; |
|---|
| 288 | DS_U8 wordwrap; |
|---|
| 289 | DS_U8 display_effect; |
|---|
| 290 | DS_U8 effect_direction; |
|---|
| 291 | DS_U8 effect_speed; |
|---|
| 292 | DST_708_Color fill_color; |
|---|
| 293 | DS_U8 fill_opacity; |
|---|
| 294 | DS_U8 border_type; |
|---|
| 295 | DST_708_Color border_color; |
|---|
| 296 | } DST_708_Window; |
|---|
| 297 | |
|---|
| 298 | typedef struct |
|---|
| 299 | { |
|---|
| 300 | // Set Pen Attributes |
|---|
| 301 | DS_U8 pen_size; |
|---|
| 302 | DS_U8 font_style; |
|---|
| 303 | DS_U8 text_tag; |
|---|
| 304 | DS_U8 offset; |
|---|
| 305 | DS_U8 italics; |
|---|
| 306 | DS_U8 underline; |
|---|
| 307 | DS_U8 edge_type; |
|---|
| 308 | // Set Pen Color |
|---|
| 309 | DST_708_Color fg_color; |
|---|
| 310 | DS_U8 fg_opacity; |
|---|
| 311 | DST_708_Color bg_color; |
|---|
| 312 | DS_U8 bg_opacity; |
|---|
| 313 | DST_708_Color edge_color; |
|---|
| 314 | } DST_708_Pen; |
|---|
| 315 | |
|---|
| 316 | typedef struct |
|---|
| 317 | { |
|---|
| 318 | DS_U16 nCode; |
|---|
| 319 | DST_708_Pen pen; |
|---|
| 320 | } DST_708_Char; |
|---|
| 321 | |
|---|
| 322 | |
|---|
| 323 | typedef struct _CC708WINDOW CC708Window; |
|---|
| 324 | typedef void (*CC708WINDOW_SetID) (CC708Window* this, DS_U8 _id); |
|---|
| 325 | typedef void (*CC708WINDOW_SetKorean) (CC708Window* this, bool bVal); |
|---|
| 326 | typedef bool (*CC708WINDOW_GetNeedRedraw) (CC708Window* this); |
|---|
| 327 | typedef void (*CC708WINDOW_SetNeedRedraw) (CC708Window* this, bool bValue); |
|---|
| 328 | typedef bool (*CC708WINDOW_GetVisible) (CC708Window* this); |
|---|
| 329 | typedef int (*CC708WINDOW_GetPriority) (CC708Window* this); |
|---|
| 330 | typedef OSD_PIXEL_T *(*CC708WINDOW_GetImgBuff) (CC708Window* this); |
|---|
| 331 | typedef DST_RECT (*CC708WINDOW_GetSize) (CC708Window* this); |
|---|
| 332 | typedef void (*CC708WINDOW_Constructor) (CC708Window* this, bool bKorea, bool bWide); |
|---|
| 333 | typedef void (*CC708WINDOW_Initialize) (CC708Window* this); |
|---|
| 334 | typedef void (*CC708WINDOW_Destructor) (CC708Window* this); |
|---|
| 335 | typedef void (*CC708WINDOW_DefineWindow) (CC708Window* this,DS_U8 priority, |
|---|
| 336 | DS_U8 anchor_point, |
|---|
| 337 | DS_U8 relative_positioning, |
|---|
| 338 | DS_U8 anchor_vertical, |
|---|
| 339 | DS_U8 anchor_horizontal, |
|---|
| 340 | DS_U8 row_count, |
|---|
| 341 | DS_U8 column_count, |
|---|
| 342 | DS_U8 row_lock, |
|---|
| 343 | DS_U8 column_lock, |
|---|
| 344 | DS_U8 visible, |
|---|
| 345 | DS_U8 window_styleID, |
|---|
| 346 | DS_U8 pen_styleID); |
|---|
| 347 | typedef void (*CC708WINDOW_SetPredefinedPenStyleID ) (CC708Window* this, unsigned char StyleID); |
|---|
| 348 | typedef void (*CC708WINDOW_SetPredefinedWindowStyleID ) (CC708Window* this, unsigned char StyleID); |
|---|
| 349 | typedef void (*CC708WINDOW_ClearWindow ) (CC708Window* this); |
|---|
| 350 | typedef void (*CC708WINDOW_DeleteWindow ) (CC708Window* this); |
|---|
| 351 | typedef void (*CC708WINDOW_DisplayWindow ) (CC708Window* this); |
|---|
| 352 | typedef void (*CC708WINDOW_HideWindow ) (CC708Window* this); |
|---|
| 353 | typedef void (*CC708WINDOW_ToggleWindow ) (CC708Window* this); |
|---|
| 354 | typedef void (*CC708WINDOW_SetWindowAttribute ) (CC708Window* this, DS_U8 justify, |
|---|
| 355 | DS_U8 print_direction, |
|---|
| 356 | DS_U8 scroll_direction, |
|---|
| 357 | DS_U8 wordwrap, |
|---|
| 358 | DS_U8 display_effect, |
|---|
| 359 | DS_U8 effect_direction, |
|---|
| 360 | DS_U8 effect_speed, |
|---|
| 361 | DS_U8 fill_color_red, //DST_708_Color fill_color, |
|---|
| 362 | DS_U8 fill_color_green, |
|---|
| 363 | DS_U8 fill_color_blue, |
|---|
| 364 | DS_U8 fill_opacity, |
|---|
| 365 | DS_U8 border_type, |
|---|
| 366 | DS_U8 border_color_red, //DST_708_Color border_color |
|---|
| 367 | DS_U8 border_color_green, |
|---|
| 368 | DS_U8 border_color_blue); |
|---|
| 369 | typedef void (*CC708WINDOW_SetPenAttribute ) (CC708Window* this,unsigned char pen_size, |
|---|
| 370 | unsigned char font_style, |
|---|
| 371 | unsigned char text_tag, |
|---|
| 372 | unsigned char offset, |
|---|
| 373 | unsigned char italics, |
|---|
| 374 | unsigned char underline, |
|---|
| 375 | unsigned char edge_type); |
|---|
| 376 | typedef void (*CC708WINDOW_SetPenColor ) (CC708Window* this, unsigned char fg_color_red, |
|---|
| 377 | DS_U8 fg_color_green, |
|---|
| 378 | DS_U8 fg_color_blue, |
|---|
| 379 | DS_U8 fg_opacity, |
|---|
| 380 | DS_U8 bg_color_red, |
|---|
| 381 | DS_U8 bg_color_green, |
|---|
| 382 | DS_U8 bg_color_blue, |
|---|
| 383 | DS_U8 bg_opacity, |
|---|
| 384 | DS_U8 edge_color_red, |
|---|
| 385 | DS_U8 edge_color_green, |
|---|
| 386 | unsigned char edge_color_blue); |
|---|
| 387 | typedef void (*CC708WINDOW_SetPenLocation ) (CC708Window* this, unsigned char x,DS_U8 y); |
|---|
| 388 | typedef void (*CC708WINDOW_Reset) (CC708Window* this); |
|---|
| 389 | typedef void (*CC708WINDOW_ScrollUp) (CC708Window* this); |
|---|
| 390 | typedef void (*CC708WINDOW_ScrollMultiUp) (CC708Window* this, int nLines); |
|---|
| 391 | typedef void (*CC708WINDOW_ScrollDown) (CC708Window* this); |
|---|
| 392 | typedef void (*CC708WINDOW_ScrollMultiDown) (CC708Window* this, int nLines); |
|---|
| 393 | typedef bool (*CC708WINDOW_IsFullCharater) (CC708Window* this, DS_U16 nCode); |
|---|
| 394 | typedef void (*CC708WINDOW_AddChar) (CC708Window* this, DS_U16 data); |
|---|
| 395 | typedef void (*CC708WINDOW_AddCharBottomToTop ) (CC708Window* this, DS_U16 data); |
|---|
| 396 | typedef void (*CC708WINDOW_AddCharTopToBottom ) (CC708Window* this, DS_U16 data); |
|---|
| 397 | typedef unsigned char (*CC708WINDOW_ARGB ) (CC708Window* this, unsigned char alpha,DS_U8 red,DS_U8 green,DS_U8 blue); |
|---|
| 398 | typedef unsigned char (*CC708WINDOW_S_RGB ) (CC708Window* this, DST_708_Color color); |
|---|
| 399 | typedef unsigned char (*CC708WINDOW_T_RGB ) (CC708Window* this, DST_708_Color color); |
|---|
| 400 | typedef int (*CC708WINDOW_GetBorderSize ) (CC708Window* this); |
|---|
| 401 | typedef OSD_PIXEL_T (*CC708WINDOW_ColorConvert ) (CC708Window* this, DS_U8 c); |
|---|
| 402 | typedef DS_U8 (*CC708WINDOW_GetBackGroundColor ) (CC708Window* this, bool bFlash); |
|---|
| 403 | typedef void (*CC708WINDOW_DrawBackGround ) (CC708Window* this, bool bFlash); |
|---|
| 404 | typedef int (*CC708WINDOW_GetStingLength) (CC708Window* this, int nLine); |
|---|
| 405 | typedef int (*CC708WINDOW_GetStringLines ) (CC708Window* this); |
|---|
| 406 | typedef void (*CC708WINDOW_DrawStrings ) (CC708Window* this, bool bFlash); |
|---|
| 407 | typedef void (*CC708WINDOW_DrawImage ) (CC708Window* this, int x_pos, int y_pos, int w, int h, OSD_PIXEL_T *buff); |
|---|
| 408 | typedef int (*CC708WINDOW_GetCharHeight ) (CC708Window* this); |
|---|
| 409 | typedef int (*CC708WINDOW_GetCharWidth ) (CC708Window* this); |
|---|
| 410 | typedef unsigned char (*CC708WINDOW_ConvertFontSize ) (CC708Window* this, unsigned char nSize); |
|---|
| 411 | typedef unsigned char (*CC708WINDOW_ConvertFontStyle ) (CC708Window* this, unsigned char nStyle); |
|---|
| 412 | typedef bool (*CC708WINDOW_ConvertFontItalic ) (CC708Window* this, unsigned char italics); |
|---|
| 413 | typedef unsigned char (*CC708WINDOW_ConvertFontEdgeStyle ) (CC708Window* this, unsigned char edge_type); |
|---|
| 414 | typedef bool (*CC708WINDOW_ConvertFontUnderLine ) (CC708Window* this, unsigned char underline); |
|---|
| 415 | typedef unsigned char (*CC708WINDOW_ConvertFontOffset ) (CC708Window* this, unsigned char offset); |
|---|
| 416 | typedef unsigned char (*CC708WINDOW_ConvertFontColor ) (CC708Window* this, unsigned char opacity, DST_708_Color color, bool bFlash); |
|---|
| 417 | typedef unsigned char (*CC708WINDOW_ConvertFontEdgeColor ) (CC708Window* this, unsigned char opacity, DST_708_Color color, bool bFlash); |
|---|
| 418 | typedef unsigned char (*CC708WINDOW_ConvertFontBackColor ) (CC708Window* this, unsigned char opacity, DST_708_Color color, bool bFlash); |
|---|
| 419 | typedef DS_U8 (*CC708WINDOW_CalcColor ) (CC708Window* this, DS_U8 foreColor, DS_U8 backColor); |
|---|
| 420 | typedef FONT_CC (*CC708WINDOW_ConvertCCStyleToFontStyle ) (CC708Window* this, DST_708_Char cc, bool bFlash); |
|---|
| 421 | typedef OSD_PIXEL_T * (*CC708WINDOW_GetLineImage ) (CC708Window* this, int nLine, int *nWidth, int *nHeight, bool bFlash); |
|---|
| 422 | typedef void (*CC708WINDOW_Resize ) (CC708Window* this, bool bFlash); |
|---|
| 423 | typedef void (*CC708WINDOW_Draw ) (CC708Window* this, bool bFlash); |
|---|
| 424 | typedef void (*CC708WINDOW_UpdateScreen ) (CC708Window* this); |
|---|
| 425 | typedef void (*CC708WINDOW_UpdateScreenEx ) (CC708Window* this, int x, int y, int w, int h); |
|---|
| 426 | typedef void (*CC708WINDOW_OnFlash ) (CC708Window* this); |
|---|
| 427 | |
|---|
| 428 | |
|---|
| 429 | |
|---|
| 430 | struct _CC708WINDOW |
|---|
| 431 | { |
|---|
| 432 | DST_708_Window window_data; |
|---|
| 433 | DST_708_Pen pen_data; |
|---|
| 434 | DST_708_Char strText[MAX_708_COL][MAX_708_ROW]; // ¹öÆÛ¿¡ µé¾î¿Â µ¥ÀÌÅÍ |
|---|
| 435 | bool bDefined; |
|---|
| 436 | int pos_x; // Ä¿¼ÀÇ À§Ä¡ |
|---|
| 437 | int pos_y; |
|---|
| 438 | DST_RECT rect; |
|---|
| 439 | OSD_PIXEL_T *imgBuff; |
|---|
| 440 | bool bNeedDraw; |
|---|
| 441 | bool bKorean; |
|---|
| 442 | bool bWideScreen; |
|---|
| 443 | DS_U8 nID; |
|---|
| 444 | int nLineWidth[MAX_708_ROW]; |
|---|
| 445 | int nLineHeight[MAX_708_ROW]; |
|---|
| 446 | bool bHide; // HDW DSW TGW ¸í·É¿¡ ÀÇÇØ¼ »óŰ¡ º¯°æµÈ´Ù. |
|---|
| 447 | // true°¡ µÇ¸é ¹®ÀÚ¿À» ´õ ÀÌ»ó ¹Þ¾ÆµéÀÌÁö ¾Ê´Â´Ù. |
|---|
| 448 | |
|---|
| 449 | |
|---|
| 450 | CC708WINDOW_SetID SetID; |
|---|
| 451 | CC708WINDOW_SetKorean SetKorean; |
|---|
| 452 | CC708WINDOW_GetNeedRedraw GetNeedRedraw; |
|---|
| 453 | CC708WINDOW_SetNeedRedraw SetNeedRedraw; |
|---|
| 454 | CC708WINDOW_GetVisible GetVisible; |
|---|
| 455 | CC708WINDOW_GetPriority GetPriority; |
|---|
| 456 | CC708WINDOW_GetImgBuff GetImgBuff; |
|---|
| 457 | CC708WINDOW_GetSize GetSize; |
|---|
| 458 | CC708WINDOW_Constructor Constructor; |
|---|
| 459 | CC708WINDOW_Initialize Initialize; |
|---|
| 460 | CC708WINDOW_Destructor Destructor; |
|---|
| 461 | CC708WINDOW_DefineWindow DefineWindow; |
|---|
| 462 | CC708WINDOW_SetPredefinedPenStyleID SetPredefinedPenStyleID; |
|---|
| 463 | CC708WINDOW_SetPredefinedWindowStyleID SetPredefinedWindowStyleID; |
|---|
| 464 | CC708WINDOW_ClearWindow ClearWindow; |
|---|
| 465 | CC708WINDOW_DeleteWindow DeleteWindow; |
|---|
| 466 | CC708WINDOW_DisplayWindow DisplayWindow; |
|---|
| 467 | CC708WINDOW_HideWindow HideWindow; |
|---|
| 468 | CC708WINDOW_ToggleWindow ToggleWindow; |
|---|
| 469 | CC708WINDOW_SetWindowAttribute SetWindowAttribute; |
|---|
| 470 | CC708WINDOW_SetPenAttribute SetPenAttribute; |
|---|
| 471 | CC708WINDOW_SetPenColor SetPenColor; |
|---|
| 472 | CC708WINDOW_SetPenLocation SetPenLocation; |
|---|
| 473 | CC708WINDOW_Reset Reset; |
|---|
| 474 | CC708WINDOW_ScrollUp ScrollUp; |
|---|
| 475 | CC708WINDOW_ScrollMultiUp ScrollMultiUp; |
|---|
| 476 | CC708WINDOW_ScrollDown ScrollDown; |
|---|
| 477 | CC708WINDOW_ScrollMultiDown ScrollMultiDown; |
|---|
| 478 | CC708WINDOW_IsFullCharater IsFullCharater; // ÄÚµå´Â À¯´ÏÄÚµåÀÌ´Ù. |
|---|
| 479 | CC708WINDOW_AddChar AddChar; |
|---|
| 480 | CC708WINDOW_AddCharBottomToTop AddCharBottomToTop; |
|---|
| 481 | CC708WINDOW_AddCharTopToBottom AddCharTopToBottom; |
|---|
| 482 | CC708WINDOW_ARGB ARGB; |
|---|
| 483 | CC708WINDOW_S_RGB S_RGB; |
|---|
| 484 | CC708WINDOW_T_RGB T_RGB; |
|---|
| 485 | CC708WINDOW_GetBorderSize GetBorderSize; |
|---|
| 486 | CC708WINDOW_ColorConvert ColorConvert; |
|---|
| 487 | CC708WINDOW_GetBackGroundColor GetBackGroundColor; |
|---|
| 488 | CC708WINDOW_DrawBackGround DrawBackGround; |
|---|
| 489 | CC708WINDOW_GetStingLength GetStingLength; |
|---|
| 490 | CC708WINDOW_GetStringLines GetStringLines; |
|---|
| 491 | CC708WINDOW_DrawStrings DrawStrings; |
|---|
| 492 | CC708WINDOW_DrawImage DrawImage; |
|---|
| 493 | CC708WINDOW_GetCharHeight GetCharHeight; |
|---|
| 494 | CC708WINDOW_GetCharWidth GetCharWidth; |
|---|
| 495 | CC708WINDOW_ConvertFontSize ConvertFontSize; |
|---|
| 496 | CC708WINDOW_ConvertFontStyle ConvertFontStyle; |
|---|
| 497 | CC708WINDOW_ConvertFontItalic ConvertFontItalic; |
|---|
| 498 | CC708WINDOW_ConvertFontEdgeStyle ConvertFontEdgeStyle; |
|---|
| 499 | CC708WINDOW_ConvertFontUnderLine ConvertFontUnderLine; |
|---|
| 500 | CC708WINDOW_ConvertFontOffset ConvertFontOffset; |
|---|
| 501 | CC708WINDOW_ConvertFontColor ConvertFontColor; |
|---|
| 502 | CC708WINDOW_ConvertFontEdgeColor ConvertFontEdgeColor; |
|---|
| 503 | CC708WINDOW_ConvertFontBackColor ConvertFontBackColor; |
|---|
| 504 | CC708WINDOW_CalcColor CalcColor; |
|---|
| 505 | CC708WINDOW_ConvertCCStyleToFontStyle ConvertCCStyleToFontStyle; |
|---|
| 506 | CC708WINDOW_GetLineImage GetLineImage; |
|---|
| 507 | CC708WINDOW_Resize Resize; // À©µµ¿ìÀÇ »çÀÌÁ Àç Á¶Á¤ÇÑ´Ù. |
|---|
| 508 | CC708WINDOW_Draw Draw; |
|---|
| 509 | CC708WINDOW_UpdateScreen UpdateScreen; |
|---|
| 510 | CC708WINDOW_UpdateScreenEx UpdateScreenEx; |
|---|
| 511 | CC708WINDOW_OnFlash OnFlash; |
|---|
| 512 | |
|---|
| 513 | }; |
|---|
| 514 | |
|---|
| 515 | |
|---|
| 516 | |
|---|
| 517 | void CCWin_SetID(CC708Window* this, DS_U8 _id) |
|---|
| 518 | { |
|---|
| 519 | this->nID = _id; |
|---|
| 520 | } |
|---|
| 521 | |
|---|
| 522 | void CCWin_SetKorean(CC708Window* this, bool bVal) |
|---|
| 523 | { |
|---|
| 524 | this->bKorean = bVal; |
|---|
| 525 | } |
|---|
| 526 | |
|---|
| 527 | bool CCWin_GetNeedRedraw(CC708Window* this) |
|---|
| 528 | { |
|---|
| 529 | return this->bNeedDraw; |
|---|
| 530 | } |
|---|
| 531 | void CCWin_SetNeedRedraw(CC708Window* this, bool bValue) |
|---|
| 532 | { |
|---|
| 533 | this->bNeedDraw = bValue; |
|---|
| 534 | } |
|---|
| 535 | |
|---|
| 536 | bool CCWin_GetVisible(CC708Window* this) |
|---|
| 537 | { |
|---|
| 538 | return this->window_data.visible == 0 ? false : true; |
|---|
| 539 | } |
|---|
| 540 | |
|---|
| 541 | int CCWin_GetPriority(CC708Window* this) |
|---|
| 542 | { |
|---|
| 543 | return this->window_data.priority; |
|---|
| 544 | } |
|---|
| 545 | |
|---|
| 546 | OSD_PIXEL_T *CCWin_GetImgBuff(CC708Window* this) |
|---|
| 547 | { |
|---|
| 548 | return this->imgBuff; |
|---|
| 549 | } |
|---|
| 550 | |
|---|
| 551 | DST_RECT CCWin_GetSize(CC708Window* this) |
|---|
| 552 | { |
|---|
| 553 | return this->rect; |
|---|
| 554 | } |
|---|
| 555 | |
|---|
| 556 | void CCWin_Constructor(CC708Window* this, bool bKorea, bool bWide) |
|---|
| 557 | { |
|---|
| 558 | int i = 0; |
|---|
| 559 | this->imgBuff = 0; |
|---|
| 560 | for ( i = 0; i < MAX_708_ROW; i++) |
|---|
| 561 | { |
|---|
| 562 | this->nLineWidth[i] = 0; |
|---|
| 563 | this->nLineHeight[i] = 0; |
|---|
| 564 | } |
|---|
| 565 | this->Initialize(this); |
|---|
| 566 | this->bKorean = bKorea; |
|---|
| 567 | this->bWideScreen = bWide; |
|---|
| 568 | } |
|---|
| 569 | |
|---|
| 570 | void CCWin_Initialize(CC708Window* this) |
|---|
| 571 | { |
|---|
| 572 | int i = 0; |
|---|
| 573 | this->bHide = false; |
|---|
| 574 | memset(&this->window_data, 0, sizeof(DST_708_Window)); |
|---|
| 575 | memset(&this->pen_data, 0, sizeof(DST_708_Pen)); |
|---|
| 576 | memset(&this->rect, 0, sizeof(DST_RECT)); |
|---|
| 577 | this->ClearWindow(this); |
|---|
| 578 | if (this->imgBuff) DST_OS_Free(&this->imgBuff); |
|---|
| 579 | this->imgBuff = 0; |
|---|
| 580 | for ( i = 0; i < MAX_708_ROW; i++) |
|---|
| 581 | { |
|---|
| 582 | this->nLineWidth[i] = 0; |
|---|
| 583 | this->nLineHeight[i] = 0; |
|---|
| 584 | } |
|---|
| 585 | this->bDefined = false; |
|---|
| 586 | this->bNeedDraw = false; |
|---|
| 587 | } |
|---|
| 588 | |
|---|
| 589 | void CCWin_Destructor(CC708Window* this) |
|---|
| 590 | { |
|---|
| 591 | int i = 0; |
|---|
| 592 | if (this->imgBuff) DST_OS_Free(&this->imgBuff); |
|---|
| 593 | this->imgBuff = 0; |
|---|
| 594 | for ( i = 0; i < MAX_708_ROW; i++) |
|---|
| 595 | { |
|---|
| 596 | this->nLineWidth[i] = 0; |
|---|
| 597 | this->nLineHeight[i] = 0; |
|---|
| 598 | } |
|---|
| 599 | } |
|---|
| 600 | |
|---|
| 601 | void CCWin_DefineWindow(CC708Window* this,DS_U8 priority, |
|---|
| 602 | DS_U8 anchor_point, |
|---|
| 603 | DS_U8 relative_positioning, |
|---|
| 604 | DS_U8 anchor_vertical, |
|---|
| 605 | DS_U8 anchor_horizontal, |
|---|
| 606 | DS_U8 row_count, |
|---|
| 607 | DS_U8 column_count, |
|---|
| 608 | DS_U8 row_lock, |
|---|
| 609 | DS_U8 column_lock, |
|---|
| 610 | DS_U8 visible, |
|---|
| 611 | DS_U8 window_styleID, |
|---|
| 612 | DS_U8 pen_styleID) |
|---|
| 613 | { |
|---|
| 614 | int i = 0; |
|---|
| 615 | if (debug_cc) |
|---|
| 616 | { |
|---|
| 617 | DST_Printf("Define Window[%d]", this->nID); |
|---|
| 618 | DST_Printf(" p(%d)", priority); |
|---|
| 619 | DST_Printf(" a(%d)", anchor_point); |
|---|
| 620 | DST_Printf(" r(%d)", relative_positioning); |
|---|
| 621 | DST_Printf(" v(%d)", anchor_vertical); |
|---|
| 622 | DST_Printf(" h(%d)", anchor_horizontal); |
|---|
| 623 | DST_Printf(" row(%d)", row_count); |
|---|
| 624 | DST_Printf(" col(%d)", column_count); |
|---|
| 625 | DST_Printf(" rl(%d)", row_lock); |
|---|
| 626 | DST_Printf(" cl(%d)", column_lock); |
|---|
| 627 | DST_Printf(" v(%d)", visible); |
|---|
| 628 | DST_Printf(" s(%d)", window_styleID); |
|---|
| 629 | DST_Printf(" pen(%d)", pen_styleID); |
|---|
| 630 | DST_Printf("\n"); |
|---|
| 631 | } |
|---|
| 632 | // 608 ¹ø¿ª ¿À·ù ´ëÀÀ 4¹ø ½ºÅ¸ÀÏ·Î ¿À¸é row_count¸¦ 2ÁÙ ÁÙÀδÙ. |
|---|
| 633 | // football.trp |
|---|
| 634 | if (this->bKorean == false && this->window_data.window_styleID == 4) |
|---|
| 635 | { |
|---|
| 636 | if (row_count > 0) row_count--; |
|---|
| 637 | } |
|---|
| 638 | // 4-Line Roll-Up ¸ðµå 608 ¹ø¿ª ¿À·ù ´ëÀÀ |
|---|
| 639 | // 2¹ø ½ºÅ¸ÀÏ·Î ¿À¸é¼ row_count°¡ 2,3,4·Î ¿À´Âµ¥ 1,2,3À¸·Î ¿Í¾ß ¸Â´Â °ªÀÌ´Ù. |
|---|
| 640 | // DTVCC1080 v1.1_8-08-01.trp 2ºÐ 50ÃÊ |
|---|
| 641 | // SPLÀº ³×¹øÂ° ÁÙ·Î ¿À°í ¹®ÀÚ¿ÀÌ ¿À°í ÁٹٲÞÀÌ ¿Â´Ù. |
|---|
| 642 | // c41misccÀÇ 10.2ä³Î ¹®Á¦·Î ¾Æ·¡ ·çƾÀº »ç¿ëÇÒ¼ö ¾ø½¿ |
|---|
| 643 | if (this->bKorean == false && this->window_data.window_styleID == 2 && column_count == 32) |
|---|
| 644 | { |
|---|
| 645 | if (row_count == 2) row_count = 1; |
|---|
| 646 | if (row_count == 3) row_count = 2; |
|---|
| 647 | if (row_count == 4) row_count = 3; |
|---|
| 648 | } |
|---|
| 649 | if ( this->bDefined == true && |
|---|
| 650 | this->window_data.priority == priority && |
|---|
| 651 | this->window_data.anchor_point == anchor_point && |
|---|
| 652 | this->window_data.relative_positioning == relative_positioning && |
|---|
| 653 | this->window_data.anchor_vertical == anchor_vertical && |
|---|
| 654 | this->window_data.anchor_horizontal == anchor_horizontal && |
|---|
| 655 | this->window_data.row_count == row_count && |
|---|
| 656 | this->window_data.column_count == column_count && |
|---|
| 657 | this->window_data.row_lock == row_lock && |
|---|
| 658 | this->window_data.column_lock == column_lock && |
|---|
| 659 | this->window_data.visible == visible && |
|---|
| 660 | this->window_data.window_styleID == window_styleID && |
|---|
| 661 | this->window_data.pen_styleID == pen_styleID ) |
|---|
| 662 | { |
|---|
| 663 | if (debug_cc) DST_Printf("Same Define Window. Ignore\n"); |
|---|
| 664 | return; |
|---|
| 665 | } |
|---|
| 666 | // PBS_CCD row_count°¡ Á¡Á¡ ÁÙ¾îµå´Â °æ¿ì ´ëÀÀ |
|---|
| 667 | if (this->window_data.row_count > row_count) |
|---|
| 668 | { |
|---|
| 669 | for ( i = 0; i < this->window_data.row_count - row_count; i++) |
|---|
| 670 | { |
|---|
| 671 | this->ScrollUp(this); |
|---|
| 672 | if (this->pos_y > 0) this->pos_y--; |
|---|
| 673 | } |
|---|
| 674 | } |
|---|
| 675 | |
|---|
| 676 | this->window_data.priority = priority; |
|---|
| 677 | this->window_data.anchor_point = anchor_point; |
|---|
| 678 | this->window_data.relative_positioning = relative_positioning; |
|---|
| 679 | this->window_data.anchor_vertical = anchor_vertical; |
|---|
| 680 | this->window_data.anchor_horizontal = anchor_horizontal; |
|---|
| 681 | this->window_data.row_count = row_count; |
|---|
| 682 | this->window_data.column_count = column_count; |
|---|
| 683 | this->window_data.row_lock = row_lock; |
|---|
| 684 | this->window_data.column_lock = column_lock; |
|---|
| 685 | this->window_data.visible = visible; |
|---|
| 686 | this->window_data.window_styleID = window_styleID; |
|---|
| 687 | this->window_data.pen_styleID = pen_styleID; |
|---|
| 688 | |
|---|
| 689 | // À©µµ¿ì ½ºÅ¸ÀÏÀÌ 1~7 »çÀÌÀÇ °ªÀ̶ó¸é Àû¿ëÇÑ´Ù. |
|---|
| 690 | // ¸¸¾à 0À̶ó¸é »ý¼º½Ã¿¡¸¸ Àû¿ëÇÏÀÚ. |
|---|
| 691 | if (this->window_data.window_styleID == 0) |
|---|
| 692 | { |
|---|
| 693 | if (this->bDefined == false) this->SetPredefinedWindowStyleID(this,1); |
|---|
| 694 | } |
|---|
| 695 | else |
|---|
| 696 | { |
|---|
| 697 | this->SetPredefinedWindowStyleID(this, this->window_data.window_styleID); |
|---|
| 698 | } |
|---|
| 699 | // À©µµ¿ì ½ºÅ¸ÀÏÀÌ 1~7 »çÀÌÀÇ °ªÀ̶ó¸é Àû¿ëÇÑ´Ù. |
|---|
| 700 | // ¸¸¾à 0À̶ó¸é »ý¼º½Ã¿¡¸¸ Àû¿ëÇÏÀÚ. |
|---|
| 701 | if (this->window_data.pen_styleID == 0) |
|---|
| 702 | { |
|---|
| 703 | if (this->bDefined == false) this->SetPredefinedPenStyleID(this, 1); |
|---|
| 704 | } |
|---|
| 705 | else |
|---|
| 706 | { |
|---|
| 707 | this->SetPredefinedPenStyleID(this, this->window_data.pen_styleID); |
|---|
| 708 | } |
|---|
| 709 | this->bDefined = true; |
|---|
| 710 | this->bNeedDraw = true; |
|---|
| 711 | |
|---|
| 712 | } |
|---|
| 713 | |
|---|
| 714 | void CCWin_SetPredefinedPenStyleID(CC708Window* this, unsigned char StyleID) |
|---|
| 715 | { |
|---|
| 716 | this->pen_data.pen_size = 1; |
|---|
| 717 | this->pen_data.font_style = 0; |
|---|
| 718 | this->pen_data.text_tag = 0; |
|---|
| 719 | this->pen_data.offset = 1; |
|---|
| 720 | this->pen_data.italics = 0; |
|---|
| 721 | this->pen_data.underline = 0; |
|---|
| 722 | this->pen_data.edge_type = 0; |
|---|
| 723 | // Set Pen Color |
|---|
| 724 | this->pen_data.fg_color.red = 2; |
|---|
| 725 | this->pen_data.fg_color.green = 2; |
|---|
| 726 | this->pen_data.fg_color.blue = 2; |
|---|
| 727 | this->pen_data.fg_opacity = 0; |
|---|
| 728 | this->pen_data.bg_color.red = 0; |
|---|
| 729 | this->pen_data.bg_color.green = 0; |
|---|
| 730 | this->pen_data.bg_color.blue = 0; |
|---|
| 731 | this->pen_data.bg_opacity = 0; |
|---|
| 732 | this->pen_data.edge_color.red = 0; |
|---|
| 733 | this->pen_data.edge_color.green = 0; |
|---|
| 734 | this->pen_data.edge_color.blue = 0; |
|---|
| 735 | |
|---|
| 736 | switch (StyleID) |
|---|
| 737 | { |
|---|
| 738 | case 2: this->pen_data.font_style = 1; break; |
|---|
| 739 | case 3: this->pen_data.font_style = 2; break; |
|---|
| 740 | case 4: this->pen_data.font_style = 3; break; |
|---|
| 741 | case 5: this->pen_data.font_style = 4; break; |
|---|
| 742 | case 6: this->pen_data.font_style = 3; this->pen_data.edge_type = 3; this->pen_data.bg_opacity = 3; break; |
|---|
| 743 | case 7: this->pen_data.font_style = 4; this->pen_data.edge_type = 3; this->pen_data.bg_opacity = 3; break; |
|---|
| 744 | } |
|---|
| 745 | |
|---|
| 746 | } |
|---|
| 747 | |
|---|
| 748 | void CCWin_SetPredefinedWindowStyleID(CC708Window* this, unsigned char StyleID) |
|---|
| 749 | { |
|---|
| 750 | this->window_data.justify = 0; |
|---|
| 751 | this->window_data.print_direction = 0; |
|---|
| 752 | this->window_data.scroll_direction = 3; |
|---|
| 753 | this->window_data.wordwrap = 1; |
|---|
| 754 | this->window_data.display_effect = 0; |
|---|
| 755 | this->window_data.effect_direction = 0; |
|---|
| 756 | this->window_data.effect_speed = 0; |
|---|
| 757 | this->window_data.fill_color.red = 0; |
|---|
| 758 | this->window_data.fill_color.green = 0; |
|---|
| 759 | this->window_data.fill_color.blue = 0; |
|---|
| 760 | this->window_data.fill_opacity = 0; |
|---|
| 761 | this->window_data.border_type = 0; |
|---|
| 762 | this->window_data.border_color.red = 0; |
|---|
| 763 | this->window_data.border_color.green = 0; |
|---|
| 764 | this->window_data.border_color.blue = 0; |
|---|
| 765 | |
|---|
| 766 | switch (StyleID) |
|---|
| 767 | { |
|---|
| 768 | case 2: |
|---|
| 769 | this->window_data.fill_opacity = 3; |
|---|
| 770 | break; |
|---|
| 771 | case 3: this->window_data.justify = 2; break; |
|---|
| 772 | case 4: this->window_data.wordwrap = 0; break; |
|---|
| 773 | case 5: this->window_data.wordwrap = 0; |
|---|
| 774 | this->window_data.fill_opacity = 3; |
|---|
| 775 | break; |
|---|
| 776 | case 6: this->window_data.wordwrap = 0; this->window_data.justify = 2; break; |
|---|
| 777 | case 7: this->window_data.print_direction = 2; this->window_data.scroll_direction = 1; break; |
|---|
| 778 | } |
|---|
| 779 | |
|---|
| 780 | } |
|---|
| 781 | |
|---|
| 782 | void CCWin_ClearWindow(CC708Window* this) |
|---|
| 783 | { |
|---|
| 784 | memset(&this->strText, 0, sizeof(DST_708_Char) * MAX_708_ROW * MAX_708_COL); |
|---|
| 785 | this->pos_x = 0; |
|---|
| 786 | this->pos_y = 0; |
|---|
| 787 | this->bNeedDraw = true; |
|---|
| 788 | |
|---|
| 789 | } |
|---|
| 790 | |
|---|
| 791 | void CCWin_DeleteWindow(CC708Window* this) |
|---|
| 792 | { |
|---|
| 793 | if (this->bDefined == false) return; |
|---|
| 794 | this->UpdateScreen(this); // ÃʱâÈÇϸé visible ¼Ó¼ºÀÌ ²¨Áö¹Ç·Î ¹Ì¸® ¾÷µ¥ÀÌÆ®¸¦ ÇÑ´Ù. |
|---|
| 795 | this->Initialize(this); |
|---|
| 796 | |
|---|
| 797 | } |
|---|
| 798 | |
|---|
| 799 | void CCWin_DisplayWindow(CC708Window* this) |
|---|
| 800 | { |
|---|
| 801 | if (this->bDefined == false) return; |
|---|
| 802 | this->window_data.visible = true; |
|---|
| 803 | this->bNeedDraw = true; |
|---|
| 804 | this->bHide = false; |
|---|
| 805 | this->UpdateScreen(this); |
|---|
| 806 | |
|---|
| 807 | } |
|---|
| 808 | |
|---|
| 809 | void CCWin_HideWindow(CC708Window* this) |
|---|
| 810 | { |
|---|
| 811 | if (this->bDefined == false) return; |
|---|
| 812 | this->window_data.visible = false; |
|---|
| 813 | this->bNeedDraw = true; |
|---|
| 814 | this->bHide = true; |
|---|
| 815 | this->UpdateScreen(this); |
|---|
| 816 | |
|---|
| 817 | } |
|---|
| 818 | |
|---|
| 819 | void CCWin_ToggleWindow(CC708Window* this) |
|---|
| 820 | { |
|---|
| 821 | if (this->bDefined == false) return; |
|---|
| 822 | this->window_data.visible = !this->window_data.visible; |
|---|
| 823 | //bHide = !bHide; |
|---|
| 824 | this->bNeedDraw = true; |
|---|
| 825 | this->UpdateScreen(this); |
|---|
| 826 | |
|---|
| 827 | } |
|---|
| 828 | |
|---|
| 829 | void CCWin_SetWindowAttribute(CC708Window* this, DS_U8 justify, |
|---|
| 830 | DS_U8 print_direction, |
|---|
| 831 | DS_U8 scroll_direction, |
|---|
| 832 | DS_U8 wordwrap, |
|---|
| 833 | DS_U8 display_effect, |
|---|
| 834 | DS_U8 effect_direction, |
|---|
| 835 | DS_U8 effect_speed, |
|---|
| 836 | DS_U8 fill_color_red, //DST_708_Color fill_color, |
|---|
| 837 | DS_U8 fill_color_green, |
|---|
| 838 | DS_U8 fill_color_blue, |
|---|
| 839 | DS_U8 fill_opacity, |
|---|
| 840 | DS_U8 border_type, |
|---|
| 841 | DS_U8 border_color_red, //DST_708_Color border_color |
|---|
| 842 | DS_U8 border_color_green, |
|---|
| 843 | DS_U8 border_color_blue) |
|---|
| 844 | { |
|---|
| 845 | if (this->bDefined == false) return; |
|---|
| 846 | this->window_data.justify = justify; |
|---|
| 847 | this->window_data.print_direction = print_direction; |
|---|
| 848 | this->window_data.scroll_direction = scroll_direction; |
|---|
| 849 | this->window_data.wordwrap = wordwrap; |
|---|
| 850 | this->window_data.display_effect = display_effect; |
|---|
| 851 | this->window_data.effect_direction = effect_direction; |
|---|
| 852 | this->window_data.effect_speed = effect_speed; |
|---|
| 853 | this->window_data.fill_color.red = fill_color_red; |
|---|
| 854 | this->window_data.fill_color.green = fill_color_green; |
|---|
| 855 | this->window_data.fill_color.blue = fill_color_blue; |
|---|
| 856 | this->window_data.fill_opacity = fill_opacity; |
|---|
| 857 | this->window_data.border_type = border_type; |
|---|
| 858 | this->window_data.border_color.red = border_color_red; |
|---|
| 859 | this->window_data.border_color.green = border_color_green; |
|---|
| 860 | this->window_data.border_color.blue = border_color_blue; |
|---|
| 861 | this->bNeedDraw = true; |
|---|
| 862 | if (debug_cc) |
|---|
| 863 | { |
|---|
| 864 | DST_Printf("SetWindowAttribute[%d]", this->nID); |
|---|
| 865 | DST_Printf(" j(%d)", justify); |
|---|
| 866 | DST_Printf(" p(%d)", print_direction); |
|---|
| 867 | DST_Printf(" s(%d)", scroll_direction); |
|---|
| 868 | DST_Printf(" w(%d)", wordwrap); |
|---|
| 869 | DST_Printf(" e(%d)", display_effect); |
|---|
| 870 | DST_Printf(" ed(%d)", effect_direction); |
|---|
| 871 | DST_Printf(" es(%d)", effect_speed); |
|---|
| 872 | DST_Printf(" fill(%d,%d,%d)", fill_color_red, fill_color_green, fill_color_blue); |
|---|
| 873 | DST_Printf(" o(%d)", fill_opacity); |
|---|
| 874 | DST_Printf(" b(%d)", border_type); |
|---|
| 875 | DST_Printf(" border(%d,%d,%d)", border_color_red, border_color_green, border_color_blue); |
|---|
| 876 | DST_Printf("\n"); |
|---|
| 877 | } |
|---|
| 878 | |
|---|
| 879 | } |
|---|
| 880 | |
|---|
| 881 | void CCWin_SetPenAttribute(CC708Window* this,unsigned char pen_size, |
|---|
| 882 | unsigned char font_style, |
|---|
| 883 | unsigned char text_tag, |
|---|
| 884 | unsigned char offset, |
|---|
| 885 | unsigned char italics, |
|---|
| 886 | unsigned char underline, |
|---|
| 887 | unsigned char edge_type) |
|---|
| 888 | { |
|---|
| 889 | if (this->bDefined == false) return; |
|---|
| 890 | this->pen_data.pen_size = pen_size; |
|---|
| 891 | this->pen_data.font_style = font_style; |
|---|
| 892 | this->pen_data.text_tag = text_tag; |
|---|
| 893 | // this->pen_data.offset = offset; 2013.02.20 ±¹³»Çâ YTN ¹®Á¦·Î OFFSET Áö¿øÇÏÁö ¾Êµµ·Ï ÇÔ |
|---|
| 894 | this->pen_data.italics = italics; |
|---|
| 895 | this->pen_data.underline = underline; |
|---|
| 896 | this->pen_data.edge_type = edge_type; |
|---|
| 897 | if (debug_cc) |
|---|
| 898 | { |
|---|
| 899 | DST_Printf("SetPenAttribute[%d]", this->nID); |
|---|
| 900 | DST_Printf(" size(%d)", pen_size); |
|---|
| 901 | DST_Printf(" style(%d)", font_style); |
|---|
| 902 | DST_Printf(" tt(%d)", text_tag); |
|---|
| 903 | DST_Printf(" o(%d)", offset); |
|---|
| 904 | DST_Printf(" i(%d)", italics); |
|---|
| 905 | DST_Printf(" u(%d)", underline); |
|---|
| 906 | DST_Printf(" b(%d)", edge_type); |
|---|
| 907 | DST_Printf("\n"); |
|---|
| 908 | } |
|---|
| 909 | |
|---|
| 910 | } |
|---|
| 911 | |
|---|
| 912 | void CCWin_SetPenColor(CC708Window* this, unsigned char fg_color_red, |
|---|
| 913 | DS_U8 fg_color_green, |
|---|
| 914 | DS_U8 fg_color_blue, |
|---|
| 915 | DS_U8 fg_opacity, |
|---|
| 916 | DS_U8 bg_color_red, |
|---|
| 917 | DS_U8 bg_color_green, |
|---|
| 918 | DS_U8 bg_color_blue, |
|---|
| 919 | DS_U8 bg_opacity, |
|---|
| 920 | DS_U8 edge_color_red, |
|---|
| 921 | DS_U8 edge_color_green, |
|---|
| 922 | unsigned char edge_color_blue) |
|---|
| 923 | { |
|---|
| 924 | if (this->bDefined == false) return; |
|---|
| 925 | // Set Pen Color |
|---|
| 926 | this->pen_data.fg_color.red = fg_color_red; |
|---|
| 927 | this->pen_data.fg_color.green = fg_color_green; |
|---|
| 928 | this->pen_data.fg_color.blue = fg_color_blue; |
|---|
| 929 | this->pen_data.fg_opacity = fg_opacity; |
|---|
| 930 | this->pen_data.bg_color.red = bg_color_red; |
|---|
| 931 | this->pen_data.bg_color.green = bg_color_green; |
|---|
| 932 | this->pen_data.bg_color.blue = bg_color_blue; |
|---|
| 933 | this->pen_data.bg_opacity = bg_opacity; |
|---|
| 934 | this->pen_data.edge_color.red = edge_color_red; |
|---|
| 935 | this->pen_data.edge_color.green = edge_color_green; |
|---|
| 936 | this->pen_data.edge_color.blue = edge_color_blue; |
|---|
| 937 | if (debug_cc) |
|---|
| 938 | { |
|---|
| 939 | DST_Printf("SetPenColor[%d]", this->nID); |
|---|
| 940 | DST_Printf(" fg_color(%d,%d,%d)", fg_color_red, fg_color_green, fg_color_blue); |
|---|
| 941 | DST_Printf(" fg_o(%d)", fg_opacity); |
|---|
| 942 | DST_Printf(" bg_color(%d,%d,%d)", bg_color_red, bg_color_green, bg_color_blue); |
|---|
| 943 | DST_Printf(" bg_opacity(%d)", bg_opacity); |
|---|
| 944 | DST_Printf(" edge_color(%d,%d,%d)", edge_color_red, edge_color_green, edge_color_blue); |
|---|
| 945 | DST_Printf("\n"); |
|---|
| 946 | } |
|---|
| 947 | |
|---|
| 948 | } |
|---|
| 949 | |
|---|
| 950 | void CCWin_SetPenLocation (CC708Window* this, unsigned char x,DS_U8 y) |
|---|
| 951 | { |
|---|
| 952 | int i = 0; |
|---|
| 953 | int xx = 0; |
|---|
| 954 | int nLineLength = 0; |
|---|
| 955 | int nCount = 0; |
|---|
| 956 | if (this->bDefined == false) return; |
|---|
| 957 | if (x > this->window_data.column_count) return; |
|---|
| 958 | if (y > this->window_data.row_count) return; |
|---|
| 959 | // 608 ¹®¹ýÀ» 708·Î ¿Å±â´Ù°¡ ¹ß»ýÇÏ´Â ¿À·ù¿¡ ´ëÀÀÇÑ´Ù. |
|---|
| 960 | // À©µµ¿ì ½ºÅ¸ÀÏÀÌ 2¹øÀÎ °æ¿ì CRÀÌ ¿ÀÁö¾Ê°í SPL ¸¸ ¹Ýº¹Çؼ ¿À´Â °æ¿ì ´ëÀÀ PBS_CCD |
|---|
| 961 | // kcsm43.trp |
|---|
| 962 | this->pos_y = y; |
|---|
| 963 | // ¿ÞÂÊ Á¤·ÄÀÏ ¶§¸¸ x À§Ä¡¸¦ º¯°æÇÑ´Ù. |
|---|
| 964 | // if (window_data.justify != 0) return; |
|---|
| 965 | // ÇÑ±Û CCÀÎ °æ¿ì ¹ÝÀÚ󸮿¡ ´ëÇÑ Ã³¸® ´õ ÇÊ¿äÇÔ |
|---|
| 966 | if (this->bKorean == true) |
|---|
| 967 | { |
|---|
| 968 | nLineLength = this->GetStingLength(this, this->pos_y); |
|---|
| 969 | |
|---|
| 970 | for ( i = 0; i < nLineLength; i++) |
|---|
| 971 | { |
|---|
| 972 | nCount = this->IsFullCharater(this,this->strText[i][this->pos_y].nCode) ? nCount+2 : nCount+1; |
|---|
| 973 | if (nCount < x) continue; |
|---|
| 974 | // ÇöÀç ±ÛÀÚ µ¥ÀÌÅÍ ¾È¿¡ ÀÏÄ¡ÇÏ´Â À§Ä¡°¡ ÀÖ´Â °æ¿ì |
|---|
| 975 | this->pos_x = i; |
|---|
| 976 | return; |
|---|
| 977 | } |
|---|
| 978 | this->pos_x = nLineLength + x - nCount; |
|---|
| 979 | } |
|---|
| 980 | else |
|---|
| 981 | { |
|---|
| 982 | if (this->window_data.justify == 0) |
|---|
| 983 | { |
|---|
| 984 | this->pos_x = x; |
|---|
| 985 | } |
|---|
| 986 | else |
|---|
| 987 | { |
|---|
| 988 | for ( xx = 0; xx < MAX_708_COL; xx++) this->strText[xx][this->pos_y].nCode = 0; // ÇöÀç ÁÙÀÇ Á¤º¸¸¦ Áö¿î´Ù. |
|---|
| 989 | this->pos_x = 0; |
|---|
| 990 | } |
|---|
| 991 | } |
|---|
| 992 | |
|---|
| 993 | } |
|---|
| 994 | |
|---|
| 995 | void CCWin_Reset(CC708Window* this) |
|---|
| 996 | { |
|---|
| 997 | this->window_data.visible = false; |
|---|
| 998 | if (this->bDefined == false) return; |
|---|
| 999 | this->DeleteWindow(this); |
|---|
| 1000 | |
|---|
| 1001 | } |
|---|
| 1002 | |
|---|
| 1003 | void CCWin_ScrollUp(CC708Window* this) |
|---|
| 1004 | { |
|---|
| 1005 | int y = 0; |
|---|
| 1006 | int x = 0; |
|---|
| 1007 | for ( y = 0; y < MAX_708_ROW - 1; y++) for ( x = 0; x < MAX_708_COL; x++) this->strText[x][y] = this->strText[x][y+1]; |
|---|
| 1008 | x = 0; |
|---|
| 1009 | for ( x = 0; x < MAX_708_COL; x++) memset(&this->strText[x][MAX_708_ROW-1], 0, sizeof(DST_708_Char)); |
|---|
| 1010 | |
|---|
| 1011 | } |
|---|
| 1012 | |
|---|
| 1013 | void CCWin_ScrollMultiUp(CC708Window* this, int nLines) |
|---|
| 1014 | { |
|---|
| 1015 | int i = 0; |
|---|
| 1016 | for ( i = 0; i < nLines; i++) this->ScrollUp(this); |
|---|
| 1017 | |
|---|
| 1018 | } |
|---|
| 1019 | |
|---|
| 1020 | void CCWin_ScrollDown(CC708Window* this) |
|---|
| 1021 | { |
|---|
| 1022 | int y = 0; |
|---|
| 1023 | int x = 0; |
|---|
| 1024 | for (y = 0; y < MAX_708_ROW - 1; y++) for ( x = 0; x < MAX_708_COL; x++) this->strText[x][y+1] = this->strText[x][y]; |
|---|
| 1025 | x = 0; |
|---|
| 1026 | for (x = 0; x < MAX_708_COL; x++) memset(&this->strText[x][0], 0, sizeof(DST_708_Char)); |
|---|
| 1027 | |
|---|
| 1028 | } |
|---|
| 1029 | |
|---|
| 1030 | void CCWin_ScrollMultiDown(CC708Window* this, int nLines) |
|---|
| 1031 | { |
|---|
| 1032 | int i = 0; |
|---|
| 1033 | for ( i = 0; i < nLines; i++) this->ScrollDown(this); |
|---|
| 1034 | |
|---|
| 1035 | } |
|---|
| 1036 | |
|---|
| 1037 | bool CCWin_IsFullCharater(CC708Window* this, DS_U16 nCode) |
|---|
| 1038 | { |
|---|
| 1039 | if (0x1100 <= nCode && nCode < 0x1200) return true; // ÇÑ±Û ÀÚ¸ð |
|---|
| 1040 | if (0x2113 <= nCode && nCode < 0x2127) return true; // Tel, TM µî |
|---|
| 1041 | if (0x2E80 <= nCode && nCode < 0xA500) return true; // È÷¶ó°¡³ª, °¡Å¸Ä«³ª |
|---|
| 1042 | if (0xAC00 <= nCode && nCode < 0xD800) return true; // ÇÑ±Û |
|---|
| 1043 | if (0xF900 <= nCode && nCode < 0xFB00) return true; // CJK compatibility ideographs |
|---|
| 1044 | if (0xFE30 <= nCode && nCode < 0xFE50) return true; // CJK compatibility forms |
|---|
| 1045 | return false; |
|---|
| 1046 | |
|---|
| 1047 | } |
|---|
| 1048 | |
|---|
| 1049 | void CCWin_AddChar(CC708Window* this, DS_U16 data) |
|---|
| 1050 | { |
|---|
| 1051 | // if (bHide == true) return; // C16S6Pkc 10.3 |
|---|
| 1052 | #if 0 // 080703_dfa_buick_csd |
|---|
| 1053 | if (this->window_data.scroll_direction == 2) |
|---|
| 1054 | { |
|---|
| 1055 | this->AddCharTopToBottom(this, data); // À§¿¡¼ ¾Æ·¡·Î ½ºÅ©·Ñ ´Ù¿î |
|---|
| 1056 | } |
|---|
| 1057 | else |
|---|
| 1058 | #endif |
|---|
| 1059 | { |
|---|
| 1060 | this->AddCharBottomToTop(this, data); // ¾Æ·¡¿¡¼ À§·Î ½ºÅ©·Ñ ¾÷ |
|---|
| 1061 | } |
|---|
| 1062 | |
|---|
| 1063 | } |
|---|
| 1064 | |
|---|
| 1065 | void CCWin_AddCharBottomToTop(CC708Window* this, DS_U16 data) |
|---|
| 1066 | { |
|---|
| 1067 | int x = 0; |
|---|
| 1068 | int nOverLines = this->GetStringLines(this) - this->window_data.row_count - 1; |
|---|
| 1069 | |
|---|
| 1070 | int nLineLength = 0; |
|---|
| 1071 | int nCount = 0; |
|---|
| 1072 | int i = 0; |
|---|
| 1073 | if (nOverLines > 0) this->ScrollMultiUp(this, nOverLines); |
|---|
| 1074 | if (data == 0x08) // Back Space |
|---|
| 1075 | { |
|---|
| 1076 | if (this->pos_x == 0) return; |
|---|
| 1077 | this->strText[this->pos_x][this->pos_y].nCode = 0; |
|---|
| 1078 | this->pos_x--; |
|---|
| 1079 | this->bNeedDraw = true; |
|---|
| 1080 | return; |
|---|
| 1081 | } |
|---|
| 1082 | if (data == 0x0C) // FF À©µµ¿ìÀÇ ¸Ç óÀ½ À§Ä¡·Î µ¹¾Æ°£´Ù. |
|---|
| 1083 | { |
|---|
| 1084 | this->ClearWindow(this); // c67gsetaÀÇ 10.3ä³Î ȸéÀ» Áö¿ì°í óÀ½À¸·Î µ¹¾Æ°£´Ù. |
|---|
| 1085 | return; |
|---|
| 1086 | } |
|---|
| 1087 | if (data == 0x0E) // HCR ÇØ´çÁÙÀÇ Á¤º¸¸¦ Áö¿ì°í óÀ½ À§Ä¡·Î µ¹¾Æ°£´Ù. |
|---|
| 1088 | { |
|---|
| 1089 | for ( x = 0; x < MAX_708_COL; x++) memset(&this->strText[x][this->pos_y], 0, sizeof(DST_708_Char)); |
|---|
| 1090 | this->pos_x = 0; |
|---|
| 1091 | this->bNeedDraw = true; |
|---|
| 1092 | return; |
|---|
| 1093 | } |
|---|
| 1094 | if (data == 0x0D) // °³Çà ¹®ÀÚ |
|---|
| 1095 | { |
|---|
| 1096 | // 608 ¹ø¿ª ¿À·ù ´ëÀÀ WindowStyleÀÌ 5ÀÎ °æ¿ì´Â CRÀÌ ¿À¸é ¹«Á¶°Ç ÁÙ¹Ù²Þ ¼öÇà |
|---|
| 1097 | // PBS CCD.trp |
|---|
| 1098 | if ( /*window_data.window_styleID == 4 || */ |
|---|
| 1099 | (this->bKorean == false && this->window_data.window_styleID == 5 && this->pos_y != 0) || |
|---|
| 1100 | this->pos_y >= this->window_data.row_count || |
|---|
| 1101 | this->pos_y >= MAX_708_ROW-1) |
|---|
| 1102 | { |
|---|
| 1103 | this->ScrollUp(this); // ÇÑÁÙ Á¦°Å |
|---|
| 1104 | this->bNeedDraw = true; |
|---|
| 1105 | } |
|---|
| 1106 | else |
|---|
| 1107 | { |
|---|
| 1108 | this->pos_y++; |
|---|
| 1109 | } |
|---|
| 1110 | this->pos_x = 0; |
|---|
| 1111 | return; |
|---|
| 1112 | } |
|---|
| 1113 | // ¹®ÀÚ¿ÀÌ Column Count º¸´Ù Å« °æ¿ì ´ÙÀ½ ÁÙ·Î º¸³½´Ù. |
|---|
| 1114 | if (this->bKorean == true) |
|---|
| 1115 | { |
|---|
| 1116 | nLineLength = this->GetStingLength(this, this->pos_y); |
|---|
| 1117 | nCount = 0; |
|---|
| 1118 | for (i = 0; i < nLineLength; i++) |
|---|
| 1119 | { |
|---|
| 1120 | nCount = this->IsFullCharater(this, this->strText[i][this->pos_y].nCode) ? nCount+2 : nCount+1; |
|---|
| 1121 | } |
|---|
| 1122 | if (nCount >= this->window_data.column_count + 1 || nCount >= MAX_708_COL) |
|---|
| 1123 | { |
|---|
| 1124 | this->pos_y++; |
|---|
| 1125 | this->pos_x = 0; |
|---|
| 1126 | } |
|---|
| 1127 | } |
|---|
| 1128 | else |
|---|
| 1129 | { |
|---|
| 1130 | if (this->pos_x > this->window_data.column_count + 1 || this->pos_x >= MAX_708_COL) |
|---|
| 1131 | { |
|---|
| 1132 | this->pos_y++; |
|---|
| 1133 | this->pos_x = 0; |
|---|
| 1134 | } |
|---|
| 1135 | } |
|---|
| 1136 | // ¹®ÀÚ¿ÀÌ Row Count º¸´Ù Å« °æ¿ì ½ºÅ©·Ñ ¾÷ÇÑ´Ù. |
|---|
| 1137 | if (this->pos_y >= this->window_data.row_count + 1 || this->pos_y >= MAX_708_ROW) |
|---|
| 1138 | { |
|---|
| 1139 | this->ScrollUp(this); // ÇÑÁÙ Á¦°Å |
|---|
| 1140 | this->pos_y--; |
|---|
| 1141 | } |
|---|
| 1142 | this->strText[this->pos_x][this->pos_y].nCode = data; |
|---|
| 1143 | this->strText[this->pos_x][this->pos_y].pen = this->pen_data; |
|---|
| 1144 | this->pos_x++; |
|---|
| 1145 | this->bNeedDraw = true; |
|---|
| 1146 | //DST_Printf("%d %d %d\n", pos_x, pos_y, data); |
|---|
| 1147 | |
|---|
| 1148 | } |
|---|
| 1149 | |
|---|
| 1150 | void CCWin_AddCharTopToBottom(CC708Window* this, DS_U16 data) |
|---|
| 1151 | { |
|---|
| 1152 | int x = 0; |
|---|
| 1153 | int nOverLines = this->GetStringLines(this) - this->window_data.row_count - 1; |
|---|
| 1154 | |
|---|
| 1155 | int nLineLength = 0; |
|---|
| 1156 | int nCount = 0; |
|---|
| 1157 | int i = 0; |
|---|
| 1158 | if (nOverLines > 0) this->ScrollMultiDown(this, nOverLines); |
|---|
| 1159 | if (data == 0x08) // Back Space |
|---|
| 1160 | { |
|---|
| 1161 | if (this->pos_x == 0) return; |
|---|
| 1162 | this->strText[this->pos_x][this->pos_y].nCode = 0; |
|---|
| 1163 | this->pos_x--; |
|---|
| 1164 | this->bNeedDraw = true; |
|---|
| 1165 | return; |
|---|
| 1166 | } |
|---|
| 1167 | if (data == 0x0C) // FF À©µµ¿ìÀÇ ¸Ç óÀ½ À§Ä¡·Î µ¹¾Æ°£´Ù. |
|---|
| 1168 | { |
|---|
| 1169 | this->ClearWindow(this); // c67gsetaÀÇ 10.3ä³Î ȸéÀ» Áö¿ì°í óÀ½À¸·Î µ¹¾Æ°£´Ù. |
|---|
| 1170 | return; |
|---|
| 1171 | } |
|---|
| 1172 | if (data == 0x0E) // HCR ÇØ´çÁÙÀÇ Ã³À½ À§Ä¡·Î µ¹¾Æ°£´Ù. |
|---|
| 1173 | { |
|---|
| 1174 | for ( x = 0; x < MAX_708_COL; x++) memset(&this->strText[x][this->pos_y], 0, sizeof(DST_708_Char)); |
|---|
| 1175 | this->pos_x = 0; |
|---|
| 1176 | this->bNeedDraw = true; |
|---|
| 1177 | return; |
|---|
| 1178 | } |
|---|
| 1179 | if (data == 0x0D) // °³Çà ¹®ÀÚ |
|---|
| 1180 | { |
|---|
| 1181 | this->ScrollDown(this); // ÇÑÁÙ Á¦°Å |
|---|
| 1182 | this->bNeedDraw = true; |
|---|
| 1183 | this->pos_y = 0; |
|---|
| 1184 | this->pos_x = 0; |
|---|
| 1185 | return; |
|---|
| 1186 | } |
|---|
| 1187 | // ¹®ÀÚ¿ÀÌ Column Count º¸´Ù Å« °æ¿ì ´ÙÀ½ ÁÙ·Î º¸³½´Ù. |
|---|
| 1188 | if (this->bKorean == true) |
|---|
| 1189 | { |
|---|
| 1190 | nLineLength = this->GetStingLength(this, this->pos_y); |
|---|
| 1191 | nCount = 0; |
|---|
| 1192 | for ( i = 0; i < nLineLength; i++) |
|---|
| 1193 | { |
|---|
| 1194 | nCount = this->IsFullCharater(this, this->strText[i][this->pos_y].nCode) ? nCount+2 : nCount+1; |
|---|
| 1195 | } |
|---|
| 1196 | if (nCount >= this->window_data.column_count + 1 || nCount >= MAX_708_COL) |
|---|
| 1197 | { |
|---|
| 1198 | this->ScrollDown(this); // ÇÑÁÙ Á¦°Å |
|---|
| 1199 | this->pos_y = 0; |
|---|
| 1200 | this->pos_x = 0; |
|---|
| 1201 | } |
|---|
| 1202 | } |
|---|
| 1203 | else |
|---|
| 1204 | { |
|---|
| 1205 | if (this->pos_x >= this->window_data.column_count || this->pos_x >= MAX_708_COL-1) |
|---|
| 1206 | { |
|---|
| 1207 | this->ScrollDown(this); // ÇÑÁÙ Á¦°Å |
|---|
| 1208 | this->pos_y = 0; |
|---|
| 1209 | this->pos_x = 0; |
|---|
| 1210 | } |
|---|
| 1211 | } |
|---|
| 1212 | this->strText[this->pos_x][this->pos_y].nCode = data; |
|---|
| 1213 | this->strText[this->pos_x][this->pos_y].pen = this->pen_data; |
|---|
| 1214 | this->pos_x++; |
|---|
| 1215 | this->bNeedDraw = true; |
|---|
| 1216 | |
|---|
| 1217 | } |
|---|
| 1218 | |
|---|
| 1219 | unsigned char CCWin_ARGB(CC708Window* this, unsigned char alpha,DS_U8 red,DS_U8 green,DS_U8 blue) |
|---|
| 1220 | { |
|---|
| 1221 | if (alpha == 0 || alpha > 2) return 0; |
|---|
| 1222 | return (alpha & 0x03) * 64 + (red & 0x03) * 16 + (green & 0x03) * 4 + (blue & 0x03); |
|---|
| 1223 | |
|---|
| 1224 | } |
|---|
| 1225 | |
|---|
| 1226 | unsigned char CCWin_S_RGB(CC708Window* this, DST_708_Color color) |
|---|
| 1227 | { |
|---|
| 1228 | return this->ARGB(this, 2, color.red, color.green, color.blue); |
|---|
| 1229 | |
|---|
| 1230 | } |
|---|
| 1231 | |
|---|
| 1232 | unsigned char CCWin_T_RGB(CC708Window* this, DST_708_Color color) |
|---|
| 1233 | { |
|---|
| 1234 | return this->ARGB(this, 1, color.red, color.green, color.blue); |
|---|
| 1235 | |
|---|
| 1236 | } |
|---|
| 1237 | |
|---|
| 1238 | int CCWin_GetBorderSize(CC708Window* this) |
|---|
| 1239 | { |
|---|
| 1240 | return DST_GetCCScreenHeight() / 200; |
|---|
| 1241 | |
|---|
| 1242 | } |
|---|
| 1243 | |
|---|
| 1244 | OSD_PIXEL_T CCWin_ColorConvert(CC708Window* this, DS_U8 c) |
|---|
| 1245 | { |
|---|
| 1246 | DS_U32 color = 0; |
|---|
| 1247 | switch (c & 0xC0) |
|---|
| 1248 | { |
|---|
| 1249 | case 0x40: // ¹ÝÅõ¸í |
|---|
| 1250 | color = 0x7F000000 + (c & 0x30) * 348160 + (c & 0x0C) * 5440 + (c & 0x03) * 85; |
|---|
| 1251 | break; |
|---|
| 1252 | case 0x80: // ºÒÅõ¸í |
|---|
| 1253 | color = 0xFF000000 + (c & 0x30) * 348160 + (c & 0x0C) * 5440 + (c & 0x03) * 85;; |
|---|
| 1254 | break; |
|---|
| 1255 | } |
|---|
| 1256 | return CONV32_16(color); |
|---|
| 1257 | |
|---|
| 1258 | } |
|---|
| 1259 | |
|---|
| 1260 | DS_U8 CCWin_GetBackGroundColor(CC708Window* this, bool bFlash) |
|---|
| 1261 | { |
|---|
| 1262 | if (this->window_data.fill_opacity == 3) return COLOR_TRANSPARENT; |
|---|
| 1263 | if (bFlash && this->window_data.fill_opacity == 1) return COLOR_TRANSPARENT; |
|---|
| 1264 | if (this->window_data.fill_opacity == 2) return this->T_RGB(this, this->window_data.fill_color); |
|---|
| 1265 | return this->S_RGB(this, this->window_data.fill_color); |
|---|
| 1266 | |
|---|
| 1267 | } |
|---|
| 1268 | |
|---|
| 1269 | void CCWin_DrawBackGround(CC708Window* this, bool bFlash) |
|---|
| 1270 | { |
|---|
| 1271 | if (this->imgBuff == 0) return; |
|---|
| 1272 | OSD_PIXEL_T color = this->ColorConvert(this, this->GetBackGroundColor(this, bFlash)); |
|---|
| 1273 | int nSize = this->rect.w * this->rect.h; |
|---|
| 1274 | if (color == 0) |
|---|
| 1275 | { |
|---|
| 1276 | memset(this->imgBuff, 0, nSize * sizeof(OSD_PIXEL_T)); |
|---|
| 1277 | } |
|---|
| 1278 | else |
|---|
| 1279 | { |
|---|
| 1280 | OSD_PIXEL_T* buff = this->imgBuff; |
|---|
| 1281 | while (nSize--) *buff++ = color; |
|---|
| 1282 | } |
|---|
| 1283 | |
|---|
| 1284 | } |
|---|
| 1285 | |
|---|
| 1286 | int CCWin_GetStingLength(CC708Window* this, int nLine) |
|---|
| 1287 | { |
|---|
| 1288 | int x = 0; |
|---|
| 1289 | for ( x = MAX_708_COL - 1; x >= 0; x--) if (this->strText[x][nLine].nCode != 0) return x+1; |
|---|
| 1290 | return 0; |
|---|
| 1291 | |
|---|
| 1292 | } |
|---|
| 1293 | |
|---|
| 1294 | int CCWin_GetStringLines(CC708Window* this) |
|---|
| 1295 | { |
|---|
| 1296 | int y = 0; |
|---|
| 1297 | for ( y = MAX_708_ROW - 1; y >= 0; y--) if (this->GetStingLength(this, y) != 0) return y+1; |
|---|
| 1298 | return 0; |
|---|
| 1299 | |
|---|
| 1300 | } |
|---|
| 1301 | |
|---|
| 1302 | void CCWin_DrawStrings(CC708Window* this, bool bFlash) |
|---|
| 1303 | { |
|---|
| 1304 | int y_pos = 0; |
|---|
| 1305 | int nLines = this->GetStringLines(this); |
|---|
| 1306 | int nOldHeight = this->GetCharHeight(this); |
|---|
| 1307 | int y = 0; |
|---|
| 1308 | int x_pos = 0; |
|---|
| 1309 | //OSD_PIXEL_T *LineBuff = 0; |
|---|
| 1310 | for ( y = 0; y < nLines; y++) |
|---|
| 1311 | { |
|---|
| 1312 | x_pos = 0; |
|---|
| 1313 | OSD_PIXEL_T *LineBuff = this->GetLineImage(this, y, &this->nLineWidth[y], &this->nLineHeight[y], bFlash); |
|---|
| 1314 | switch (this->window_data.justify) |
|---|
| 1315 | { |
|---|
| 1316 | case 1: x_pos = this->rect.w - this->nLineWidth[y]; break; // right justify |
|---|
| 1317 | case 2: x_pos = (this->rect.w - this->nLineWidth[y])/2; break;// center justify |
|---|
| 1318 | } |
|---|
| 1319 | this->DrawImage(this, x_pos, y_pos, this->nLineWidth[y], this->nLineHeight[y], LineBuff); |
|---|
| 1320 | // DST_OS_Free(&LineBuff); |
|---|
| 1321 | if (this->nLineHeight[y] == 0) this->nLineHeight[y] = nOldHeight; |
|---|
| 1322 | y_pos+=this->nLineHeight[y]; |
|---|
| 1323 | this->nLineWidth[y] = 0; |
|---|
| 1324 | this->nLineHeight[y] = 0; |
|---|
| 1325 | } |
|---|
| 1326 | |
|---|
| 1327 | } |
|---|
| 1328 | |
|---|
| 1329 | void CCWin_DrawImage(CC708Window* this, int x_pos, int y_pos, int w, int h, OSD_PIXEL_T *buff) |
|---|
| 1330 | { |
|---|
| 1331 | int ww = 0; |
|---|
| 1332 | int y = 0; |
|---|
| 1333 | int x = 0; |
|---|
| 1334 | OSD_PIXEL_T *src = 0; |
|---|
| 1335 | OSD_PIXEL_T *des = 0; |
|---|
| 1336 | int des_delta = 0; |
|---|
| 1337 | if (this->imgBuff == 0) return; |
|---|
| 1338 | if (x_pos + w > this->rect.w) // ȸ鿡 ±×·ÁÁú À̹ÌÁö°¡ ȸ麸´Ù Å« °æ¿ì µÞºÎºÐÀ» ¹ö¸°´Ù. |
|---|
| 1339 | { |
|---|
| 1340 | ww = this->rect.w - x_pos; |
|---|
| 1341 | if (ww <= 0) return; |
|---|
| 1342 | for ( y = 0; y < h; y++) |
|---|
| 1343 | { |
|---|
| 1344 | for ( x = 0; x < ww; x++) buff[y*ww+x] = buff[y*w+x]; |
|---|
| 1345 | } |
|---|
| 1346 | this->DrawImage(this, x_pos, y_pos, ww, h, buff); |
|---|
| 1347 | return; |
|---|
| 1348 | } |
|---|
| 1349 | |
|---|
| 1350 | src = buff; |
|---|
| 1351 | des = this->imgBuff + y_pos * this->rect.w + x_pos; |
|---|
| 1352 | des_delta = this->rect.w - w; |
|---|
| 1353 | y = h; |
|---|
| 1354 | x = 0; |
|---|
| 1355 | while (y--) |
|---|
| 1356 | { |
|---|
| 1357 | x = w; |
|---|
| 1358 | while (x--) |
|---|
| 1359 | { |
|---|
| 1360 | if (*src != 0) *des = *src; |
|---|
| 1361 | src++; |
|---|
| 1362 | des++; |
|---|
| 1363 | } |
|---|
| 1364 | des += des_delta; |
|---|
| 1365 | } |
|---|
| 1366 | |
|---|
| 1367 | } |
|---|
| 1368 | |
|---|
| 1369 | int CCWin_GetCharHeight(CC708Window* this) |
|---|
| 1370 | { |
|---|
| 1371 | int nFontSize = DST_708_GetFontSize(1); // Default, Medium |
|---|
| 1372 | switch (DST_CC_GetSize()) |
|---|
| 1373 | { |
|---|
| 1374 | case 1: nFontSize = DST_708_GetFontSize(0); break;// Small |
|---|
| 1375 | case 3: nFontSize = DST_708_GetFontSize(2); break;// Large |
|---|
| 1376 | } |
|---|
| 1377 | return DST_GetFontHeight(nFontSize); |
|---|
| 1378 | |
|---|
| 1379 | } |
|---|
| 1380 | |
|---|
| 1381 | int CCWin_GetCharWidth(CC708Window* this) |
|---|
| 1382 | { |
|---|
| 1383 | if (this->bKorean) |
|---|
| 1384 | { |
|---|
| 1385 | return this->GetCharHeight(this) * 46 / 100; // ±ÛÀÚ ³ôÀÌÀÇ 40%¸¦ ±âº» ÆøÀ¸·Î ÇÑ´Ù. |
|---|
| 1386 | } |
|---|
| 1387 | return this->GetCharHeight(this) * 45 / 100; // ±ÛÀÚ ³ôÀÌÀÇ 40%¸¦ ±âº» ÆøÀ¸·Î ÇÑ´Ù. |
|---|
| 1388 | |
|---|
| 1389 | } |
|---|
| 1390 | |
|---|
| 1391 | unsigned char CCWin_ConvertFontSize(CC708Window* this, unsigned char nSize) |
|---|
| 1392 | { |
|---|
| 1393 | return DST_708_GetFontSize((DST_CC_GetSize() == 0) ? nSize : DST_CC_GetSize() - 1); |
|---|
| 1394 | |
|---|
| 1395 | } |
|---|
| 1396 | |
|---|
| 1397 | unsigned char CCWin_ConvertFontStyle(CC708Window* this, unsigned char nStyle) |
|---|
| 1398 | { |
|---|
| 1399 | if (this->bKorean == true) return 0; // Çѱ¹ÇâÀÎ °æ¿ì Ç×»ó ±âº» ÆùÆ®¸¦ ¾´´Ù. |
|---|
| 1400 | return (nStyle == 0) ? 4 : nStyle; // ¹ÌÁÖÇâÀÇ ±âº» ÆùÆ®´Â 4.Proportionally without serifs.ttf |
|---|
| 1401 | |
|---|
| 1402 | } |
|---|
| 1403 | |
|---|
| 1404 | bool CCWin_ConvertFontItalic(CC708Window* this, unsigned char italics) |
|---|
| 1405 | { |
|---|
| 1406 | switch (DST_CC_GetItalic()) |
|---|
| 1407 | { |
|---|
| 1408 | case 0: return italics == 0 ? false : true;// default |
|---|
| 1409 | case 1: return true; // Italic on |
|---|
| 1410 | } |
|---|
| 1411 | return false; |
|---|
| 1412 | |
|---|
| 1413 | } |
|---|
| 1414 | |
|---|
| 1415 | unsigned char CCWin_ConvertFontEdgeStyle(CC708Window* this, unsigned char edge_type) |
|---|
| 1416 | { |
|---|
| 1417 | return (DST_CC_GetEdge() == 0) ? edge_type : DST_CC_GetEdge() - 1; |
|---|
| 1418 | |
|---|
| 1419 | } |
|---|
| 1420 | |
|---|
| 1421 | bool CCWin_ConvertFontUnderLine(CC708Window* this, unsigned char underline) |
|---|
| 1422 | { |
|---|
| 1423 | switch (DST_CC_GetUnderline()) |
|---|
| 1424 | { |
|---|
| 1425 | case 0: return underline == 0 ? false : true; // default |
|---|
| 1426 | case 1: return true; // underline on |
|---|
| 1427 | } |
|---|
| 1428 | return false; |
|---|
| 1429 | |
|---|
| 1430 | } |
|---|
| 1431 | |
|---|
| 1432 | unsigned char CCWin_ConvertFontOffset(CC708Window* this, unsigned char offset) |
|---|
| 1433 | { |
|---|
| 1434 | switch (offset) |
|---|
| 1435 | { |
|---|
| 1436 | case 0: return 1; // Sub Script |
|---|
| 1437 | case 1: return 0; // normal |
|---|
| 1438 | case 2: return 2; // Super Script |
|---|
| 1439 | } |
|---|
| 1440 | return 0; |
|---|
| 1441 | |
|---|
| 1442 | } |
|---|
| 1443 | |
|---|
| 1444 | unsigned char CCWin_ConvertFontColor(CC708Window* this, unsigned char opacity, DST_708_Color color, bool bFlash) |
|---|
| 1445 | { |
|---|
| 1446 | switch (DST_CC_GetColor()) |
|---|
| 1447 | { |
|---|
| 1448 | case 1: color.red = 0; color.green = 0; color.blue = 0; break; // black |
|---|
| 1449 | case 2: color.red = 3; color.green = 3; color.blue = 3; break; // white |
|---|
| 1450 | case 3: color.red = 3; color.green = 0; color.blue = 0; break; // red |
|---|
| 1451 | case 4: color.red = 0; color.green = 3; color.blue = 0; break; // green |
|---|
| 1452 | case 5: color.red = 0; color.green = 0; color.blue = 3; break; // blue |
|---|
| 1453 | case 6: color.red = 3; color.green = 3; color.blue = 0; break; // yellow |
|---|
| 1454 | case 7: color.red = 3; color.green = 0; color.blue = 3; break; // magenta |
|---|
| 1455 | case 8: color.red = 0; color.green = 3; color.blue = 3; break; // cyan |
|---|
| 1456 | } |
|---|
| 1457 | |
|---|
| 1458 | switch (DST_CC_GetOpacity()) |
|---|
| 1459 | { |
|---|
| 1460 | case 0: // default |
|---|
| 1461 | switch (opacity) |
|---|
| 1462 | { |
|---|
| 1463 | case 0: return this->S_RGB(this, color); // Solid |
|---|
| 1464 | case 1: return (bFlash) ? COLOR_TRANSPARENT : this->S_RGB(this, color);// Flash |
|---|
| 1465 | case 2: return this->T_RGB(this, color);// TransLucent |
|---|
| 1466 | case 3: return COLOR_TRANSPARENT; |
|---|
| 1467 | } |
|---|
| 1468 | break; |
|---|
| 1469 | case 1: // Solid |
|---|
| 1470 | return this->S_RGB(this, color); |
|---|
| 1471 | case 2: // TransParent |
|---|
| 1472 | return COLOR_TRANSPARENT; |
|---|
| 1473 | case 3: // Translucent |
|---|
| 1474 | return this->T_RGB(this, color); |
|---|
| 1475 | case 4: // Flashing |
|---|
| 1476 | return (bFlash) ? COLOR_TRANSPARENT : this->S_RGB(this, color); |
|---|
| 1477 | } |
|---|
| 1478 | return this->S_RGB(this, color); |
|---|
| 1479 | |
|---|
| 1480 | } |
|---|
| 1481 | |
|---|
| 1482 | unsigned char CCWin_ConvertFontEdgeColor(CC708Window* this, unsigned char opacity, DST_708_Color color, bool bFlash) |
|---|
| 1483 | { |
|---|
| 1484 | switch (DST_CC_GetEdgeColor()) |
|---|
| 1485 | { |
|---|
| 1486 | case 1: color.red = 0; color.green = 0; color.blue = 0; break; // black |
|---|
| 1487 | case 2: color.red = 3; color.green = 3; color.blue = 3; break; // white |
|---|
| 1488 | case 3: color.red = 3; color.green = 0; color.blue = 0; break; // red |
|---|
| 1489 | case 4: color.red = 0; color.green = 3; color.blue = 0; break; // green |
|---|
| 1490 | case 5: color.red = 0; color.green = 0; color.blue = 3; break; // blue |
|---|
| 1491 | case 6: color.red = 3; color.green = 3; color.blue = 0; break; // yellow |
|---|
| 1492 | case 7: color.red = 3; color.green = 0; color.blue = 3; break; // magenta |
|---|
| 1493 | case 8: color.red = 0; color.green = 3; color.blue = 3; break; // cyan |
|---|
| 1494 | } |
|---|
| 1495 | switch (DST_CC_GetOpacity()) |
|---|
| 1496 | { |
|---|
| 1497 | case 0: // default |
|---|
| 1498 | switch (opacity) |
|---|
| 1499 | { |
|---|
| 1500 | case 0: return this->S_RGB(this, color); // Solid |
|---|
| 1501 | case 1: return (bFlash) ? COLOR_TRANSPARENT : this->S_RGB(this, color);// Flash |
|---|
| 1502 | case 2: return this->T_RGB(this, color);// TransLucent |
|---|
| 1503 | case 3: return COLOR_TRANSPARENT; |
|---|
| 1504 | } |
|---|
| 1505 | break; |
|---|
| 1506 | case 1: // Solid |
|---|
| 1507 | return this->S_RGB(this, color); |
|---|
| 1508 | case 2: // TransParent |
|---|
| 1509 | return COLOR_TRANSPARENT; |
|---|
| 1510 | case 3: // Translucent |
|---|
| 1511 | return this->T_RGB(this, color); |
|---|
| 1512 | case 4: // Flashing |
|---|
| 1513 | return (bFlash) ? COLOR_TRANSPARENT : this->S_RGB(this, color); |
|---|
| 1514 | } |
|---|
| 1515 | return this->S_RGB(this, color); |
|---|
| 1516 | |
|---|
| 1517 | } |
|---|
| 1518 | |
|---|
| 1519 | unsigned char CCWin_ConvertFontBackColor(CC708Window* this, unsigned char opacity, DST_708_Color color, bool bFlash) |
|---|
| 1520 | { |
|---|
| 1521 | switch (DST_CC_GetBackColor()) |
|---|
| 1522 | { |
|---|
| 1523 | case 1: color.red = 0; color.green = 0; color.blue = 0; break; // black |
|---|
| 1524 | case 2: color.red = 3; color.green = 3; color.blue = 3; break; // white |
|---|
| 1525 | case 3: color.red = 3; color.green = 0; color.blue = 0; break; // red |
|---|
| 1526 | case 4: color.red = 0; color.green = 3; color.blue = 0; break; // green |
|---|
| 1527 | case 5: color.red = 0; color.green = 0; color.blue = 3; break; // blue |
|---|
| 1528 | case 6: color.red = 3; color.green = 3; color.blue = 0; break; // yellow |
|---|
| 1529 | case 7: color.red = 3; color.green = 0; color.blue = 3; break; // magenta |
|---|
| 1530 | case 8: color.red = 0; color.green = 3; color.blue = 3; break; // cyan |
|---|
| 1531 | } |
|---|
| 1532 | |
|---|
| 1533 | switch (DST_CC_GetBackOpacity()) |
|---|
| 1534 | { |
|---|
| 1535 | case 0: // default |
|---|
| 1536 | switch (opacity) |
|---|
| 1537 | { |
|---|
| 1538 | case 0: return this->S_RGB(this, color); // Solid |
|---|
| 1539 | case 1: return (bFlash) ? COLOR_TRANSPARENT : this->S_RGB(this, color);// Flash |
|---|
| 1540 | case 2: return this->T_RGB(this, color);// TransLucent |
|---|
| 1541 | case 3: return COLOR_TRANSPARENT; |
|---|
| 1542 | } |
|---|
| 1543 | break; |
|---|
| 1544 | case 1: // Solid |
|---|
| 1545 | return this->S_RGB(this, color); |
|---|
| 1546 | case 2: // TransParent |
|---|
| 1547 | return COLOR_TRANSPARENT; |
|---|
| 1548 | case 3: // Translucent |
|---|
| 1549 | return this->T_RGB(this, color); |
|---|
| 1550 | case 4: // Flashing |
|---|
| 1551 | return (bFlash) ? COLOR_TRANSPARENT : this->S_RGB(this, color); |
|---|
| 1552 | } |
|---|
| 1553 | return this->S_RGB(this, color); |
|---|
| 1554 | |
|---|
| 1555 | } |
|---|
| 1556 | |
|---|
| 1557 | DS_U8 CCWin_CalcColor(CC708Window* this, DS_U8 foreColor, DS_U8 backColor) |
|---|
| 1558 | { |
|---|
| 1559 | switch (foreColor & 0xC0) |
|---|
| 1560 | { |
|---|
| 1561 | case 0x40: // ¹ÝÅõ¸í |
|---|
| 1562 | case 0x80: // ºÒÅõ¸í |
|---|
| 1563 | return foreColor; |
|---|
| 1564 | } |
|---|
| 1565 | return backColor; // Åõ¸í |
|---|
| 1566 | |
|---|
| 1567 | } |
|---|
| 1568 | |
|---|
| 1569 | FONT_CC CCWin_ConvertCCStyleToFontStyle(CC708Window* this, DST_708_Char cc, bool bFlash) |
|---|
| 1570 | { |
|---|
| 1571 | FONT_CC font; |
|---|
| 1572 | font.nCode = cc.nCode; |
|---|
| 1573 | font.nSize = this->ConvertFontSize(this, cc.pen.pen_size); |
|---|
| 1574 | font.nStyle = this->ConvertFontStyle(this, cc.pen.font_style); |
|---|
| 1575 | font.bItalic = this->ConvertFontItalic(this, cc.pen.italics); |
|---|
| 1576 | font.nEdgeType = this->ConvertFontEdgeStyle(this, cc.pen.edge_type); |
|---|
| 1577 | font.bUnderLine = this->ConvertFontUnderLine(this, cc.pen.underline); |
|---|
| 1578 | font.nOffset = this->ConvertFontOffset(this, cc.pen.offset); |
|---|
| 1579 | |
|---|
| 1580 | DS_U8 backWindowColor = this->GetBackGroundColor(this, bFlash); |
|---|
| 1581 | DS_U8 foreGroundColor = this->ConvertFontColor(this, cc.pen.fg_opacity, cc.pen.fg_color, bFlash); |
|---|
| 1582 | DS_U8 edgeColor = this->ConvertFontEdgeColor(this, cc.pen.fg_opacity, cc.pen.edge_color, bFlash); |
|---|
| 1583 | DS_U8 backGroundColor = this->ConvertFontBackColor(this, cc.pen.bg_opacity, cc.pen.bg_color, bFlash); |
|---|
| 1584 | |
|---|
| 1585 | font.Color = this->ColorConvert(this, this->CalcColor(this, foreGroundColor, backWindowColor)); |
|---|
| 1586 | font.EdgeColor = this->ColorConvert(this, this->CalcColor(this, edgeColor, backWindowColor)); |
|---|
| 1587 | font.BackColor = this->ColorConvert(this, this->CalcColor(this, backGroundColor, backWindowColor)); |
|---|
| 1588 | return font; |
|---|
| 1589 | |
|---|
| 1590 | } |
|---|
| 1591 | |
|---|
| 1592 | OSD_PIXEL_T * CCWin_GetLineImage(CC708Window* this, int nLine, int *nWidth, int *nHeight, bool bFlash) |
|---|
| 1593 | { |
|---|
| 1594 | int nStrLen = this->GetStingLength(this, nLine); |
|---|
| 1595 | if (nStrLen == 0) |
|---|
| 1596 | { |
|---|
| 1597 | *nWidth = 0; |
|---|
| 1598 | *nHeight = 0; |
|---|
| 1599 | return 0; |
|---|
| 1600 | } |
|---|
| 1601 | |
|---|
| 1602 | static FONT_CC strFont[MAX_708_COL]; |
|---|
| 1603 | int x = 0; |
|---|
| 1604 | for ( x = 0; x < nStrLen; x++) |
|---|
| 1605 | { |
|---|
| 1606 | strFont[x] = this->ConvertCCStyleToFontStyle(this, this->strText[x][nLine], bFlash); |
|---|
| 1607 | } |
|---|
| 1608 | |
|---|
| 1609 | // Åõ¸í °ø¹é ¹®ÀÚÀÇ Å©±â´Â Åõ¸í °ø¹é¹®ÀÚ°¡ ¾Æ´Ñ ù ±ÛÀÚ¿Í °°°Ô ÇÑ´Ù. |
|---|
| 1610 | int nDefaultSize = strFont[0].nSize; |
|---|
| 1611 | x = 0; |
|---|
| 1612 | for ( x = 0; x < nStrLen; x++) |
|---|
| 1613 | { |
|---|
| 1614 | if (strFont[x].nCode == 0) continue; |
|---|
| 1615 | nDefaultSize = strFont[x].nSize; |
|---|
| 1616 | break; |
|---|
| 1617 | } |
|---|
| 1618 | // Åõ¸í °ø¹é ¹®ÀÚ Ã¤¿ì±â |
|---|
| 1619 | x = 0; |
|---|
| 1620 | for ( x = 0; x < nStrLen; x++) |
|---|
| 1621 | { |
|---|
| 1622 | if (strFont[x].nCode != 0) continue; |
|---|
| 1623 | strFont[x].nCode = ' '; |
|---|
| 1624 | strFont[x].nSize = nDefaultSize; |
|---|
| 1625 | strFont[x].nStyle = 0; |
|---|
| 1626 | strFont[x].bItalic = false; |
|---|
| 1627 | strFont[x].nEdgeType = 0; |
|---|
| 1628 | strFont[x].bUnderLine = false; |
|---|
| 1629 | strFont[x].nOffset = 0; |
|---|
| 1630 | strFont[x].Color = COLOR_TRANSPARENT; |
|---|
| 1631 | strFont[x].EdgeColor = COLOR_TRANSPARENT; |
|---|
| 1632 | strFont[x].BackColor = COLOR_TRANSPARENT; |
|---|
| 1633 | } |
|---|
| 1634 | |
|---|
| 1635 | *nWidth = DST_GetFontWidthCC(strFont, nStrLen); |
|---|
| 1636 | *nHeight = DST_GetFontHeightCC(strFont, nStrLen); |
|---|
| 1637 | static OSD_PIXEL_T LineBuff[720*48]; //ÃÖ´ë ÇÑ ÁÙ¿¡ µé¾î°¥ ¹öÆÛ Å©±â |
|---|
| 1638 | DST_GetFontImageCC(strFont, nStrLen, LineBuff); |
|---|
| 1639 | return LineBuff; |
|---|
| 1640 | |
|---|
| 1641 | } |
|---|
| 1642 | |
|---|
| 1643 | void CCWin_Resize(CC708Window* this, bool bFlash) |
|---|
| 1644 | { |
|---|
| 1645 | // define window ¿¡ ÀÇÇÑ ±âº» Å©±â |
|---|
| 1646 | int default_width = this->GetCharWidth(this) * (this->window_data.column_count+1); |
|---|
| 1647 | int default_height = this->GetCharHeight(this) * (this->window_data.row_count+1); |
|---|
| 1648 | |
|---|
| 1649 | // ȸ鿡 Ç¥½ÃµÈ ±ÛÀÚ¿¡ ÀÇÇÑ Å©±â Á¶Á¤ |
|---|
| 1650 | int nMaxWidth = 0; |
|---|
| 1651 | int nTotalHeight = 0; |
|---|
| 1652 | int nOldHeight = this->GetCharHeight(this); |
|---|
| 1653 | int nLines = this->GetStringLines(this); |
|---|
| 1654 | bool bReachMaxColumn = false; // column count¸¦ ³Ñ¾ú´ÂÁö |
|---|
| 1655 | int y = 0; |
|---|
| 1656 | // OSD_PIXEL_T* LineBuff = 0; |
|---|
| 1657 | // °¢ ¶óÀκ°·Î À̹ÌÁö¸¦ ±×·Áº»´Ù. |
|---|
| 1658 | for ( y = 0; y < nLines; y++) |
|---|
| 1659 | { |
|---|
| 1660 | if (this->GetStingLength(this, y) >= this->window_data.column_count+1) bReachMaxColumn = true; |
|---|
| 1661 | OSD_PIXEL_T* LineBuff = this->GetLineImage(this, y, &this->nLineWidth[y], &this->nLineHeight[y], bFlash); |
|---|
| 1662 | // DST_OS_Free(&LineBuff); |
|---|
| 1663 | if (nMaxWidth < this->nLineWidth[y]) nMaxWidth = this->nLineWidth[y]; |
|---|
| 1664 | if (this->nLineHeight[y] == 0) this->nLineHeight[y] = nOldHeight; // ºóÁÙÀ̸é ÁÙÀÇ ³ôÀ̸¦ ¾´´Ù. |
|---|
| 1665 | nOldHeight = this->nLineHeight[y]; |
|---|
| 1666 | nTotalHeight += this->nLineHeight[y]; |
|---|
| 1667 | } |
|---|
| 1668 | |
|---|
| 1669 | if (bReachMaxColumn) |
|---|
| 1670 | { |
|---|
| 1671 | this->rect.w = nMaxWidth; |
|---|
| 1672 | } |
|---|
| 1673 | else |
|---|
| 1674 | { |
|---|
| 1675 | this->rect.w = (nMaxWidth > default_width) ? nMaxWidth : default_width; |
|---|
| 1676 | } |
|---|
| 1677 | if (this->rect.w == 0) return; |
|---|
| 1678 | this->rect.h = (nTotalHeight > default_height) ? nTotalHeight : default_height; |
|---|
| 1679 | if (this->rect.h == 0) return; |
|---|
| 1680 | |
|---|
| 1681 | int nScreenHeight = DST_GetCCScreenHeight(); |
|---|
| 1682 | int nScreenWidth = DST_GetCCScreenWidth(); |
|---|
| 1683 | |
|---|
| 1684 | if (this->rect.w > nScreenWidth) this->rect.w = nScreenWidth; |
|---|
| 1685 | if (this->rect.h > nScreenHeight) this->rect.h = nScreenHeight; |
|---|
| 1686 | |
|---|
| 1687 | // ¸¸¾à ³ôÀ̰¡ ³ÑÃļ º¸Á¤ÀÌ µÇ¾ú´Ù¸é °¢ ¶óÀκ°·Îµµ º¸Á¤ÀÌ ÀÌ·ç¾îÁ®¾Æ ÇÑ´Ù. |
|---|
| 1688 | int nDataEmptyHeight = 0; |
|---|
| 1689 | int nDataHeight = 0; |
|---|
| 1690 | int nEmptyLineCount = 0; |
|---|
| 1691 | y = 0; |
|---|
| 1692 | for ( y = 0; y < nLines; y++) |
|---|
| 1693 | { |
|---|
| 1694 | nDataEmptyHeight += this->nLineHeight[y]; |
|---|
| 1695 | if (this->nLineWidth[y] == 0) |
|---|
| 1696 | { |
|---|
| 1697 | nEmptyLineCount++; |
|---|
| 1698 | } |
|---|
| 1699 | else |
|---|
| 1700 | { |
|---|
| 1701 | nDataHeight += this->nLineHeight[y]; |
|---|
| 1702 | } |
|---|
| 1703 | } |
|---|
| 1704 | |
|---|
| 1705 | int nCompensation = 0; |
|---|
| 1706 | if (nDataHeight > this->rect.h) |
|---|
| 1707 | { |
|---|
| 1708 | DST_Printf("Error || OVER HEIGHT\n"); |
|---|
| 1709 | } |
|---|
| 1710 | else |
|---|
| 1711 | { |
|---|
| 1712 | if (nDataEmptyHeight > this->rect.h) |
|---|
| 1713 | { |
|---|
| 1714 | nCompensation = (this->rect.h - nDataHeight) / nEmptyLineCount; |
|---|
| 1715 | DST_Printf("nCompensation = %d\n", nCompensation); |
|---|
| 1716 | y = 0; |
|---|
| 1717 | for ( y = 0; y < nLines; y++) |
|---|
| 1718 | { |
|---|
| 1719 | if (this->nLineWidth[y] != 0) continue; |
|---|
| 1720 | this->nLineHeight[y] = nCompensation; |
|---|
| 1721 | } |
|---|
| 1722 | } |
|---|
| 1723 | } |
|---|
| 1724 | |
|---|
| 1725 | |
|---|
| 1726 | // À©µµ¿ìÀÇ ½ÃÀÛ À§Ä¡¸¦ ±¸ÇÑ´Ù. |
|---|
| 1727 | int default_x = 0; |
|---|
| 1728 | int default_y = 0; |
|---|
| 1729 | |
|---|
| 1730 | |
|---|
| 1731 | int max_x = nScreenWidth - 1; |
|---|
| 1732 | int max_y = nScreenHeight - 1; |
|---|
| 1733 | if (this->window_data.relative_positioning == 1) |
|---|
| 1734 | { |
|---|
| 1735 | default_x = max_x * this->window_data.anchor_horizontal / 99; |
|---|
| 1736 | default_y = max_y * this->window_data.anchor_vertical / 99; |
|---|
| 1737 | } |
|---|
| 1738 | else |
|---|
| 1739 | { |
|---|
| 1740 | if (this->bWideScreen) |
|---|
| 1741 | { |
|---|
| 1742 | default_x = max_x * this->window_data.anchor_horizontal / 209; |
|---|
| 1743 | default_y = max_y * this->window_data.anchor_vertical / 74; |
|---|
| 1744 | } |
|---|
| 1745 | else |
|---|
| 1746 | { |
|---|
| 1747 | default_x = max_x * (this->window_data.anchor_horizontal + 25) / 209; |
|---|
| 1748 | default_y = max_y * this->window_data.anchor_vertical / 74; |
|---|
| 1749 | } |
|---|
| 1750 | } |
|---|
| 1751 | if (default_x < 0) default_x = 0; |
|---|
| 1752 | if (default_y < 0) default_y = 0; |
|---|
| 1753 | if (default_x > max_x) default_x = max_x; |
|---|
| 1754 | if (default_y > max_y) default_y = max_y; |
|---|
| 1755 | |
|---|
| 1756 | switch (this->window_data.anchor_point) |
|---|
| 1757 | { |
|---|
| 1758 | case 0: break; |
|---|
| 1759 | case 1: default_x -= (this->rect.w/2); break; |
|---|
| 1760 | case 2: default_x -= this->rect.w; break; |
|---|
| 1761 | case 3: default_y -= (this->rect.h/2); break; |
|---|
| 1762 | case 4: default_y -= (this->rect.h/2); default_x -= (this->rect.w/2); break; |
|---|
| 1763 | case 5: default_y -= (this->rect.h/2); default_x -= this->rect.w; break; |
|---|
| 1764 | case 6: default_y -= this->rect.h; break; |
|---|
| 1765 | case 7: default_y -= this->rect.h; default_x -= (this->rect.w/2); break; |
|---|
| 1766 | case 8: default_y -= this->rect.h; default_x -= this->rect.w; break; |
|---|
| 1767 | } |
|---|
| 1768 | |
|---|
| 1769 | if (default_x + this->rect.w > nScreenWidth) default_x = nScreenWidth - this->rect.w; |
|---|
| 1770 | if (default_y + this->rect.h > nScreenHeight) default_y = nScreenHeight - this->rect.h; |
|---|
| 1771 | |
|---|
| 1772 | if (default_x < 0) default_x = 0; |
|---|
| 1773 | if (default_y < 0) default_y = 0; |
|---|
| 1774 | if (default_x >= nScreenWidth) default_x = nScreenWidth - 1; |
|---|
| 1775 | if (default_y >= nScreenHeight) default_y = nScreenHeight - 1; |
|---|
| 1776 | |
|---|
| 1777 | this->rect.x = default_x; |
|---|
| 1778 | this->rect.y = default_y; |
|---|
| 1779 | |
|---|
| 1780 | } |
|---|
| 1781 | |
|---|
| 1782 | void CCWin_Draw(CC708Window* this, bool bFlash) |
|---|
| 1783 | { |
|---|
| 1784 | if (this->GetVisible(this) == false || this->GetNeedRedraw(this) == false) return; |
|---|
| 1785 | this->UpdateScreen(this); |
|---|
| 1786 | this->Resize(this, bFlash); |
|---|
| 1787 | this->UpdateScreen(this); |
|---|
| 1788 | if (this->imgBuff) DST_OS_Free(&this->imgBuff); |
|---|
| 1789 | this->imgBuff = 0; |
|---|
| 1790 | if (this->rect.w == 0 || this->rect.h == 0) return; |
|---|
| 1791 | this->imgBuff = (OSD_PIXEL_T*)DST_OS_Malloc(this->rect.w * this->rect.h * sizeof(OSD_PIXEL_T)); |
|---|
| 1792 | this->DrawBackGround(this, bFlash); |
|---|
| 1793 | this->DrawStrings(this, bFlash); |
|---|
| 1794 | this->SetNeedRedraw(this, false); |
|---|
| 1795 | |
|---|
| 1796 | } |
|---|
| 1797 | |
|---|
| 1798 | void CCWin_UpdateScreen(CC708Window* this) |
|---|
| 1799 | { |
|---|
| 1800 | DST_UpdateRegionAdd(this->rect); |
|---|
| 1801 | |
|---|
| 1802 | } |
|---|
| 1803 | |
|---|
| 1804 | void CCWin_UpdateScreenEx(CC708Window* this, int x, int y, int w, int h) |
|---|
| 1805 | { |
|---|
| 1806 | DST_RECT rectTemp; |
|---|
| 1807 | rectTemp.x = this->rect.x + x; |
|---|
| 1808 | rectTemp.y = this->rect.y + y; |
|---|
| 1809 | rectTemp.w = w; |
|---|
| 1810 | rectTemp.h = h; |
|---|
| 1811 | DST_UpdateRegionAdd(rectTemp); |
|---|
| 1812 | |
|---|
| 1813 | } |
|---|
| 1814 | |
|---|
| 1815 | void CCWin_OnFlash(CC708Window* this) |
|---|
| 1816 | { |
|---|
| 1817 | if (this->GetVisible(this) == false || this->bNeedDraw == true) return; |
|---|
| 1818 | if (this->window_data.fill_opacity == 1) // ¹è°æ»öÀÌ Flash ¼Ó¼ºÀ̶ó¸é ´Ù½Ã ±×¸°´Ù. |
|---|
| 1819 | { |
|---|
| 1820 | this->bNeedDraw = true; |
|---|
| 1821 | return; |
|---|
| 1822 | } |
|---|
| 1823 | // ±ÛÀÚÁß¿¡ Flash ¼Ó¼ºÀÌ ÀÖ´Â ±ÛÀÚ°¡ 1±ÛÀÚ¶óµµ ÀÖÀ¸¸é ´Ù½Ã ±×¸°´Ù. |
|---|
| 1824 | int nLines = this->GetStringLines(this); |
|---|
| 1825 | int y = 0; |
|---|
| 1826 | int nColumn = 0; |
|---|
| 1827 | int x = 0; |
|---|
| 1828 | for ( y = 0; y < nLines; y++) |
|---|
| 1829 | { |
|---|
| 1830 | nColumn = this->GetStingLength(this, y); |
|---|
| 1831 | for ( x = 0; x < nColumn; x++) |
|---|
| 1832 | { |
|---|
| 1833 | if (DST_CC_GetOpacity() == CC_FLASHING) this->bNeedDraw = true; |
|---|
| 1834 | if (DST_CC_GetBackOpacity() == CC_FLASHING) this->bNeedDraw = true; |
|---|
| 1835 | if (this->strText[x][y].pen.fg_opacity == 1) this->bNeedDraw = true; |
|---|
| 1836 | if (this->strText[x][y].pen.bg_opacity == 1) this->bNeedDraw = true; |
|---|
| 1837 | if (this->bNeedDraw == true) return; |
|---|
| 1838 | } |
|---|
| 1839 | } |
|---|
| 1840 | |
|---|
| 1841 | } |
|---|
| 1842 | |
|---|
| 1843 | |
|---|
| 1844 | // ±âº» À©µµ¿ì¸¦ »ý¼ºÇÑ´Ù. |
|---|
| 1845 | CC708Window* NewCC708Window(bool bKorea, bool bWide) |
|---|
| 1846 | { |
|---|
| 1847 | CC708Window* pWin= (CC708Window *)DST_OS_Calloc(sizeof(CC708Window), 1); |
|---|
| 1848 | pWin->SetID = CCWin_SetID; |
|---|
| 1849 | pWin->SetKorean = CCWin_SetKorean; |
|---|
| 1850 | pWin->GetNeedRedraw = CCWin_GetNeedRedraw; |
|---|
| 1851 | pWin->SetNeedRedraw = CCWin_SetNeedRedraw; |
|---|
| 1852 | pWin->GetVisible = CCWin_GetVisible; |
|---|
| 1853 | pWin->GetPriority = CCWin_GetPriority; |
|---|
| 1854 | pWin->GetImgBuff = CCWin_GetImgBuff; |
|---|
| 1855 | pWin->GetSize = CCWin_GetSize; |
|---|
| 1856 | pWin->Constructor = CCWin_Constructor; |
|---|
| 1857 | pWin->Initialize = CCWin_Initialize; |
|---|
| 1858 | pWin->Destructor = CCWin_Destructor; |
|---|
| 1859 | pWin->DefineWindow = CCWin_DefineWindow; |
|---|
| 1860 | pWin->SetPredefinedPenStyleID = CCWin_SetPredefinedPenStyleID; |
|---|
| 1861 | pWin->SetPredefinedWindowStyleID = CCWin_SetPredefinedWindowStyleID; |
|---|
| 1862 | pWin->ClearWindow = CCWin_ClearWindow; |
|---|
| 1863 | pWin->DeleteWindow = CCWin_DeleteWindow; |
|---|
| 1864 | pWin->DisplayWindow = CCWin_DisplayWindow; |
|---|
| 1865 | pWin->HideWindow = CCWin_HideWindow; |
|---|
| 1866 | pWin->ToggleWindow = CCWin_ToggleWindow; |
|---|
| 1867 | pWin->SetWindowAttribute = CCWin_SetWindowAttribute; |
|---|
| 1868 | pWin->SetPenAttribute = CCWin_SetPenAttribute; |
|---|
| 1869 | pWin->SetPenColor = CCWin_SetPenColor; |
|---|
| 1870 | pWin->SetPenLocation = CCWin_SetPenLocation ; |
|---|
| 1871 | pWin->Reset = CCWin_Reset; |
|---|
| 1872 | pWin->ScrollUp = CCWin_ScrollUp; |
|---|
| 1873 | pWin->ScrollMultiUp = CCWin_ScrollMultiUp; |
|---|
| 1874 | pWin->ScrollDown = CCWin_ScrollDown; |
|---|
| 1875 | pWin->ScrollMultiDown = CCWin_ScrollMultiDown; |
|---|
| 1876 | pWin->IsFullCharater = CCWin_IsFullCharater; // ÄÚµå´Â À¯´ÏÄÚµåÀÌ´Ù. |
|---|
| 1877 | pWin->AddChar = CCWin_AddChar; |
|---|
| 1878 | pWin->AddCharBottomToTop = CCWin_AddCharBottomToTop; |
|---|
| 1879 | pWin->AddCharTopToBottom = CCWin_AddCharTopToBottom; |
|---|
| 1880 | pWin->ARGB = CCWin_ARGB; |
|---|
| 1881 | pWin->S_RGB = CCWin_S_RGB; |
|---|
| 1882 | pWin->T_RGB = CCWin_T_RGB; |
|---|
| 1883 | pWin->GetBorderSize = CCWin_GetBorderSize; |
|---|
| 1884 | pWin->ColorConvert = CCWin_ColorConvert; |
|---|
| 1885 | pWin->GetBackGroundColor = CCWin_GetBackGroundColor; |
|---|
| 1886 | pWin->DrawBackGround = CCWin_DrawBackGround; |
|---|
| 1887 | pWin->GetStingLength = CCWin_GetStingLength; |
|---|
| 1888 | pWin->GetStringLines = CCWin_GetStringLines; |
|---|
| 1889 | pWin->DrawStrings = CCWin_DrawStrings; |
|---|
| 1890 | pWin->DrawImage = CCWin_DrawImage; |
|---|
| 1891 | pWin->GetCharHeight = CCWin_GetCharHeight; |
|---|
| 1892 | pWin->GetCharWidth = CCWin_GetCharWidth; |
|---|
| 1893 | pWin->ConvertFontSize = CCWin_ConvertFontSize; |
|---|
| 1894 | pWin->ConvertFontStyle = CCWin_ConvertFontStyle; |
|---|
| 1895 | pWin->ConvertFontItalic = CCWin_ConvertFontItalic; |
|---|
| 1896 | pWin->ConvertFontEdgeStyle = CCWin_ConvertFontEdgeStyle; |
|---|
| 1897 | pWin->ConvertFontUnderLine = CCWin_ConvertFontUnderLine; |
|---|
| 1898 | pWin->ConvertFontOffset = CCWin_ConvertFontOffset; |
|---|
| 1899 | pWin->ConvertFontColor = CCWin_ConvertFontColor; |
|---|
| 1900 | pWin->ConvertFontEdgeColor = CCWin_ConvertFontEdgeColor; |
|---|
| 1901 | pWin->ConvertFontBackColor = CCWin_ConvertFontBackColor; |
|---|
| 1902 | pWin->CalcColor = CCWin_CalcColor; |
|---|
| 1903 | pWin->ConvertCCStyleToFontStyle = CCWin_ConvertCCStyleToFontStyle; |
|---|
| 1904 | pWin->GetLineImage = CCWin_GetLineImage; |
|---|
| 1905 | pWin->Resize = CCWin_Resize; // À©µµ¿ìÀÇ »çÀÌÁ Àç Á¶Á¤ÇÑ´Ù. |
|---|
| 1906 | pWin->Draw = CCWin_Draw; |
|---|
| 1907 | pWin->UpdateScreen = CCWin_UpdateScreen; |
|---|
| 1908 | pWin->UpdateScreenEx = CCWin_UpdateScreenEx; |
|---|
| 1909 | pWin->OnFlash = CCWin_OnFlash; |
|---|
| 1910 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 1911 | pWin->Constructor(pWin, bKorea, bWide); |
|---|
| 1912 | return pWin; |
|---|
| 1913 | } |
|---|
| 1914 | |
|---|
| 1915 | // ¼Ò¸êÀÚ È£Ãâ |
|---|
| 1916 | void DeleteCC708Window(CC708Window*pWin) |
|---|
| 1917 | { |
|---|
| 1918 | if (pWin == 0) return; |
|---|
| 1919 | if (pWin->Destructor) pWin->Destructor(pWin); |
|---|
| 1920 | // if (pWin->DestructorMother) pWin->DestructorMother(pWin); |
|---|
| 1921 | DST_OS_Free(&pWin); |
|---|
| 1922 | } |
|---|
| 1923 | |
|---|
| 1924 | // µÎ ¹Ú½ºÀÇ °øÅë ¿µ¿ªÀ» ±¸ÇÑ´Ù. |
|---|
| 1925 | static bool DST_GetCommonRect(DST_RECT A, DST_RECT B, DST_RECT *C) |
|---|
| 1926 | { |
|---|
| 1927 | C->x= (A.x > B.x) ? A.x : B.x; |
|---|
| 1928 | C->y= (A.y > B.y) ? A.y : B.y; |
|---|
| 1929 | C->w= (A.x + A.w < B.x + B.w) ? (A.x + A.w - C->x) : (B.x + B.w - C->x); |
|---|
| 1930 | C->h= (A.y + A.h < B.y + B.h) ? (A.y + A.h - C->y) : (B.y + B.h - C->y); |
|---|
| 1931 | if (C->w <= 0 || C->h <= 0) return false; |
|---|
| 1932 | return true; |
|---|
| 1933 | } |
|---|
| 1934 | |
|---|
| 1935 | #if 0 |
|---|
| 1936 | ____CC_708_Decoder____() |
|---|
| 1937 | #endif |
|---|
| 1938 | |
|---|
| 1939 | // EIA 708 ¸í·É¾î Á¤ÀÇ |
|---|
| 1940 | #define CW0 0x80 |
|---|
| 1941 | #define CW1 0x81 |
|---|
| 1942 | #define CW2 0x82 |
|---|
| 1943 | #define CW3 0x83 |
|---|
| 1944 | #define CW4 0x84 |
|---|
| 1945 | #define CW5 0x85 |
|---|
| 1946 | #define CW6 0x86 |
|---|
| 1947 | #define CW7 0x87 |
|---|
| 1948 | |
|---|
| 1949 | #define DF0 0x98 |
|---|
| 1950 | #define DF1 0x99 |
|---|
| 1951 | #define DF2 0x9A |
|---|
| 1952 | #define DF3 0x9B |
|---|
| 1953 | #define DF4 0x9C |
|---|
| 1954 | #define DF5 0x9D |
|---|
| 1955 | #define DF6 0x9E |
|---|
| 1956 | #define DF7 0x9F |
|---|
| 1957 | |
|---|
| 1958 | #define CLW 0x88 |
|---|
| 1959 | #define DLW 0x8C |
|---|
| 1960 | #define DSW 0x89 |
|---|
| 1961 | #define HDW 0x8A |
|---|
| 1962 | #define TGW 0x8B |
|---|
| 1963 | #define SWA 0x97 |
|---|
| 1964 | #define SPA 0x90 |
|---|
| 1965 | #define SPC 0x91 |
|---|
| 1966 | #define SPL 0x92 |
|---|
| 1967 | #define DLY 0x8D |
|---|
| 1968 | #define DLC 0x8E |
|---|
| 1969 | #define RST 0x8F |
|---|
| 1970 | |
|---|
| 1971 | #define EXT1 0x10 |
|---|
| 1972 | #define BS 0x08 |
|---|
| 1973 | #define CR 0x0D |
|---|
| 1974 | #define ETX 0x03 |
|---|
| 1975 | |
|---|
| 1976 | //class CC708Decoder : public CWindow |
|---|
| 1977 | //{ |
|---|
| 1978 | //private: |
|---|
| 1979 | static int CC708Decoder_nCurrentWindow; |
|---|
| 1980 | static CC708Window *CC708Decoder_win[8]; |
|---|
| 1981 | static bool CC708Decoder_bKorean; |
|---|
| 1982 | static bool CC708Decoder_bWideScreen; |
|---|
| 1983 | static bool CC708Decoder_bUnicode; |
|---|
| 1984 | static DS_U8 CC708Decoder_nServiceNumber; |
|---|
| 1985 | static CCCircularQueue *CC708Decoder_Queue; |
|---|
| 1986 | static bool CC708Decoder_bFlashDraw; |
|---|
| 1987 | static DS_U32 CC708Decoder_LastShowTime; |
|---|
| 1988 | |
|---|
| 1989 | |
|---|
| 1990 | |
|---|
| 1991 | //public: |
|---|
| 1992 | // CC708Decoder(SWinEventMsg event):CWindow(event) |
|---|
| 1993 | void CC708Decoder_Constructor(CWindow *this, SWinEventMsg event) |
|---|
| 1994 | { |
|---|
| 1995 | CC708Decoder_LastShowTime = 0; |
|---|
| 1996 | //DST_Printf("CC708Decoder Create start\n"); |
|---|
| 1997 | CC708Decoder_bFlashDraw = false; |
|---|
| 1998 | CC708Decoder_nCurrentWindow = -1; |
|---|
| 1999 | CC708Decoder_nServiceNumber = event.data[2]; /*1~6 »çÀÌÀÇ °ª*/ |
|---|
| 2000 | DST_CheckCCDescription(CC708Decoder_nServiceNumber, &CC708Decoder_bKorean, &CC708Decoder_bWideScreen, &CC708Decoder_bUnicode); |
|---|
| 2001 | //DST_Printf("!!!!!!!!![nServiceNumber: %d][bKorean: %d][bWideScreen: %d][bUnicode: %d]!!!!!!!!!\n",nServiceNumber, bKorean, bWideScreen, bUnicode); |
|---|
| 2002 | DS_U8 i = 0; |
|---|
| 2003 | for ( i = 0; i < 8; i++) |
|---|
| 2004 | { |
|---|
| 2005 | CC708Decoder_win[i] = NewCC708Window(CC708Decoder_bKorean, CC708Decoder_bWideScreen); |
|---|
| 2006 | CC708Decoder_win[i]->SetID(CC708Decoder_win[i], i); |
|---|
| 2007 | } |
|---|
| 2008 | CC708Decoder_Queue = NewCCCircularQueue(); |
|---|
| 2009 | this->rect.w = DST_GetCCScreenWidth(); |
|---|
| 2010 | this->rect.h = DST_GetCCScreenHeight(); |
|---|
| 2011 | this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; |
|---|
| 2012 | this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2; |
|---|
| 2013 | //DST_Printf("RECT %d %d %d %d\n", rect.x, rect.y, rect.w, rect.h); |
|---|
| 2014 | this->SetTimeOut(this, 16); // 16ÃÊ ¾È¿¡ »õ·Î¿î Á¤º¸°¡ ¾ø´Ù¸é Áö¿î´Ù. TTAK.KO-07.0093 5.7.22. ÀÚ¸· À©µµ¿ì ÀÚµ¿ »èÁ¦ ±â´É |
|---|
| 2015 | this->SetTimer(this, 1, 500); // Flashing |
|---|
| 2016 | this->bTransparentWindow = false; |
|---|
| 2017 | //DST_Printf("CC708Decoder Create end\n"); |
|---|
| 2018 | } |
|---|
| 2019 | |
|---|
| 2020 | void CC708Decoder_Destructor(CWindow *this) |
|---|
| 2021 | { |
|---|
| 2022 | DS_U8 i = 0; |
|---|
| 2023 | //DST_Printf("CC708Decoder Delete start\n"); |
|---|
| 2024 | for ( i = 0; i < 8; i++) DeleteCC708Window(CC708Decoder_win[i]); |
|---|
| 2025 | //DST_Printf("CC708Decoder Delete end\n"); |
|---|
| 2026 | DeleteCCCircularQueue(CC708Decoder_Queue); |
|---|
| 2027 | } |
|---|
| 2028 | |
|---|
| 2029 | void CC708Decoder_OnFlash() |
|---|
| 2030 | { |
|---|
| 2031 | int i = 0; |
|---|
| 2032 | for (i = 0; i < 8; i++) CC708Decoder_win[i]->OnFlash(CC708Decoder_win[i]); // Ç÷¡½Ã »óŰ¡ ¹Ù²î¸é ±×¸±°Ô ÀÖ´ÂÁö ¾÷µ¥ÀÌÆ®ÇÑ´Ù. |
|---|
| 2033 | } |
|---|
| 2034 | |
|---|
| 2035 | // virtual void OnTimer(char nID) |
|---|
| 2036 | void CC708Decoder_OnTimer(CWindow *this, char nID) |
|---|
| 2037 | { |
|---|
| 2038 | switch (nID) |
|---|
| 2039 | { |
|---|
| 2040 | case 1: // Flashing |
|---|
| 2041 | CC708Decoder_bFlashDraw = !CC708Decoder_bFlashDraw; |
|---|
| 2042 | CC708Decoder_OnFlash(); |
|---|
| 2043 | this->Show(this); |
|---|
| 2044 | break; |
|---|
| 2045 | case 2: // ½Ã½ºÅÛ ¼º´ÉÀÌ ºÎÁ·Çϸé Áö¿¬Çؼ ShowÇϱâ |
|---|
| 2046 | this->Show(this); // Show ¾È¿¡¼ Kill ŸÀ̸簡 È£ÃâµÊ |
|---|
| 2047 | break; |
|---|
| 2048 | } |
|---|
| 2049 | } |
|---|
| 2050 | |
|---|
| 2051 | void CC708Decoder_Delay(unsigned char TenthsOfSeconds) |
|---|
| 2052 | { |
|---|
| 2053 | // TO DO |
|---|
| 2054 | } |
|---|
| 2055 | |
|---|
| 2056 | void CC708Decoder_DelayCancel() |
|---|
| 2057 | { |
|---|
| 2058 | // TO DO |
|---|
| 2059 | } |
|---|
| 2060 | |
|---|
| 2061 | void CC708Decoder_Reset() |
|---|
| 2062 | { |
|---|
| 2063 | int i = 0; |
|---|
| 2064 | for ( i = 0; i < 8; i++) CC708Decoder_win[i]->Reset(CC708Decoder_win[i]); |
|---|
| 2065 | CC708Decoder_nCurrentWindow = -1; |
|---|
| 2066 | } |
|---|
| 2067 | |
|---|
| 2068 | void CC708Decoder_PrintChar(DS_U16 code) |
|---|
| 2069 | { |
|---|
| 2070 | if (CC708Decoder_nCurrentWindow == -1) return; |
|---|
| 2071 | CC708Decoder_win[CC708Decoder_nCurrentWindow]->AddChar(CC708Decoder_win[CC708Decoder_nCurrentWindow], code); |
|---|
| 2072 | } |
|---|
| 2073 | |
|---|
| 2074 | bool CC708Decoder_ProcessC01Byte(CCCircularQueue *Q) |
|---|
| 2075 | { |
|---|
| 2076 | switch (Q->GetByte(Q)) |
|---|
| 2077 | { |
|---|
| 2078 | case 0x0C: CC708Decoder_PrintChar(0x0C); if (debug_cc) DST_Printf("FF\n"); break; // FF À©µµ¿ìÀÇ ¸Ç óÀ½ À§Ä¡·Î µ¹¾Æ°£´Ù. |
|---|
| 2079 | case 0x0E: CC708Decoder_PrintChar(0x0E); if (debug_cc) DST_Printf("HCR\n"); break;// HCR ÇöÀç ÁÙÀÇ Ã³À½ À§Ä¡·Î µ¹¾Æ°£´Ù. |
|---|
| 2080 | case 0x0D: CC708Decoder_PrintChar(0x0D); if (debug_cc) DST_Printf("CR\n"); break;// CR µ¥ÀÌÅ͸¦ ÇÑ ÁÙ ¿Ã¸°´Ù. |
|---|
| 2081 | case 0x08: CC708Decoder_PrintChar(0x08); if (debug_cc) DST_Printf("Back Space\n"); break; // Back Space |
|---|
| 2082 | case ETX: if (debug_cc) DST_Printf("End Of Text\n"); break;// End Of Text |
|---|
| 2083 | default: /*if (debug_cc) DST_Printf("Unknown C0 Code 0x%02X\n", Q->GetByte(Q));*/ break; |
|---|
| 2084 | } |
|---|
| 2085 | Q->RemoveByte(Q); |
|---|
| 2086 | return true; |
|---|
| 2087 | } |
|---|
| 2088 | |
|---|
| 2089 | bool CC708Decoder_ProcessC2(CCCircularQueue *Q) |
|---|
| 2090 | { |
|---|
| 2091 | unsigned char ucNext = Q->GetNextByte(Q); |
|---|
| 2092 | unsigned char buff[5]; |
|---|
| 2093 | if (ucNext < 0x08) // C2 0-Additional bytes |
|---|
| 2094 | { |
|---|
| 2095 | Q->Get(Q, buff, 2); |
|---|
| 2096 | if (debug_cc) |
|---|
| 2097 | { |
|---|
| 2098 | DST_Printf("C2 0-Additional bytes 0x%02X 0x%02X\n", buff[0], buff[1]); |
|---|
| 2099 | } |
|---|
| 2100 | return true; |
|---|
| 2101 | } |
|---|
| 2102 | if (ucNext < 0x10) // C2 1-Additional bytes |
|---|
| 2103 | { |
|---|
| 2104 | if (Q->GetSize(Q) < 3) return false; |
|---|
| 2105 | Q->Get(Q, buff, 3); |
|---|
| 2106 | if (debug_cc) |
|---|
| 2107 | { |
|---|
| 2108 | DST_Printf("C2 1-Additional bytes 0x%02X 0x%02X 0x%02X\n", buff[0], buff[1], buff[2]); |
|---|
| 2109 | } |
|---|
| 2110 | return true; |
|---|
| 2111 | } |
|---|
| 2112 | if (ucNext < 0x18) // C2 2-Additional bytes |
|---|
| 2113 | { |
|---|
| 2114 | if (Q->GetSize(Q) < 4) return false; |
|---|
| 2115 | Q->Get(Q, buff, 4); |
|---|
| 2116 | if (debug_cc) |
|---|
| 2117 | { |
|---|
| 2118 | DST_Printf("C2 2-Additional bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", buff[0], buff[1], buff[2], buff[3]); |
|---|
| 2119 | } |
|---|
| 2120 | return true; |
|---|
| 2121 | } |
|---|
| 2122 | // C2 3-Additional bytes |
|---|
| 2123 | if (Q->GetSize(Q) < 5) return false; |
|---|
| 2124 | Q->Get(Q, buff, 5); |
|---|
| 2125 | if (debug_cc) |
|---|
| 2126 | { |
|---|
| 2127 | DST_Printf("C2 3-Additional bytes 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n", |
|---|
| 2128 | buff[0], buff[1], buff[2], buff[3], buff[4]); |
|---|
| 2129 | } |
|---|
| 2130 | return true; |
|---|
| 2131 | } |
|---|
| 2132 | |
|---|
| 2133 | bool CC708Decoder_ProcessG2(CCCircularQueue *Q) |
|---|
| 2134 | { |
|---|
| 2135 | switch (Q->GetNextByte(Q)) |
|---|
| 2136 | { |
|---|
| 2137 | case 0x20: CC708Decoder_PrintChar(0); break; // TSP |
|---|
| 2138 | case 0x21: CC708Decoder_PrintChar(0); break; // NBTSP |
|---|
| 2139 | case 0x25: CC708Decoder_PrintChar(0x2026); break; // Unicode Character 'HORIZONTAL ELLIPSIS' (U+2026) |
|---|
| 2140 | case 0x2A: CC708Decoder_PrintChar(0x0160); break; // Unicode Character 'LATIN CAPITAL LETTER S WITH CARON' (U+0160) |
|---|
| 2141 | case 0x2C: CC708Decoder_PrintChar(0x0152); break; // Unicode Character 'LATIN CAPITAL LIGATURE OE' (U+0152) |
|---|
| 2142 | case 0x30: CC708Decoder_PrintChar(0x2588); break; // Unicode Character 'FULL BLOCK' (U+2588) |
|---|
| 2143 | case 0x31: CC708Decoder_PrintChar(0x2018); break; // Unicode Character 'LEFT SINGLE QUOTATION MARK' (U+2018) |
|---|
| 2144 | case 0x32: CC708Decoder_PrintChar(0x2019); break; // Unicode Character 'RIGHT SINGLE QUOTATION MARK' (U+2019) |
|---|
| 2145 | case 0x33: CC708Decoder_PrintChar(0x201C); break; // Unicode Character 'LEFT DOUBLE QUOTATION MARK' (U+201C) |
|---|
| 2146 | case 0x34: CC708Decoder_PrintChar(0x201D); break; // Unicode Character 'RIGHT DOUBLE QUOTATION MARK' (U+201D) |
|---|
| 2147 | case 0x35: CC708Decoder_PrintChar(0x2022); break; // Unicode Character 'BULLET' (U+2022) |
|---|
| 2148 | case 0x39: CC708Decoder_PrintChar(0x2122); break; // Unicode Character 'TRADE MARK SIGN' (U+2122) |
|---|
| 2149 | case 0x3A: CC708Decoder_PrintChar(0x0161); break; //Unicode Character 'LATIN SMALL LETTER S WITH CARON' (U+0161) |
|---|
| 2150 | case 0x3C: CC708Decoder_PrintChar(0x0153); break; // Unicode Character 'LATIN SMALL LIGATURE OE' (U+0153) |
|---|
| 2151 | case 0x3D: CC708Decoder_PrintChar(0x2120); break; // Unicode Character 'SERVICE MARK' (U+2120) |
|---|
| 2152 | case 0x3F: CC708Decoder_PrintChar(0x0178); break; // LATIN CAPITAL LETTER Y WITH DIAERESIS' (U+0178) |
|---|
| 2153 | case 0x76: CC708Decoder_PrintChar(0x215B); break; // Unicode Character 'VULGAR FRACTION ONE EIGHTH' (U+215B) |
|---|
| 2154 | case 0x77: CC708Decoder_PrintChar(0x215C); break; // Unicode Character 'VULGAR FRACTION THREE EIGHTHS' (U+215C) |
|---|
| 2155 | case 0x78: CC708Decoder_PrintChar(0x215D); break; // Unicode Character 'VULGAR FRACTION FIVE EIGHTHS' (U+215D) |
|---|
| 2156 | case 0x79: CC708Decoder_PrintChar(0x215E); break; // Unicode Character 'VULGAR FRACTION SEVEN EIGHTHS' (U+215E) |
|---|
| 2157 | case 0x7A: CC708Decoder_PrintChar(0x2502); break; // Unicode Character 'BOX DRAWINGS LIGHT VERTICAL' (U+2502) |
|---|
| 2158 | case 0x7B: CC708Decoder_PrintChar(0x2510); break; // Unicode Character 'BOX DRAWINGS LIGHT DOWN AND LEFT' (U+2510) |
|---|
| 2159 | case 0x7C: CC708Decoder_PrintChar(0x2514); break; // Unicode Character 'BOX DRAWINGS LIGHT UP AND RIGHT' (U+2514) |
|---|
| 2160 | case 0x7D: CC708Decoder_PrintChar(0x2500); break;// Unicode Character 'BOX DRAWINGS LIGHT HORIZONTAL' (U+2500) |
|---|
| 2161 | case 0x7E: CC708Decoder_PrintChar(0x2518); break; // Unicode Character 'BOX DRAWINGS LIGHT UP AND LEFT' (U+2518) |
|---|
| 2162 | case 0x7F: CC708Decoder_PrintChar(0x250C); break; // Unicode Character 'BOX DRAWINGS LIGHT DOWN AND RIGHT' (U+250C) |
|---|
| 2163 | } |
|---|
| 2164 | unsigned char buff[2]; |
|---|
| 2165 | Q->Get(Q, buff, 2); |
|---|
| 2166 | if (debug_cc) |
|---|
| 2167 | { |
|---|
| 2168 | DST_Printf("G2 0x%02X 0x%02X\n", buff[0], buff[1]); |
|---|
| 2169 | } |
|---|
| 2170 | return true; |
|---|
| 2171 | } |
|---|
| 2172 | |
|---|
| 2173 | bool CC708Decoder_ProcessC3(CCCircularQueue *Q) |
|---|
| 2174 | { |
|---|
| 2175 | unsigned char ucNext = Q->GetNextByte(Q); |
|---|
| 2176 | unsigned char buff[256]; |
|---|
| 2177 | if (ucNext < 0x88) // C3 4-Additional bytes |
|---|
| 2178 | { |
|---|
| 2179 | if (Q->GetSize(Q) < 6) return false; |
|---|
| 2180 | Q->Get(Q, buff, 6); |
|---|
| 2181 | if (debug_cc) |
|---|
| 2182 | { |
|---|
| 2183 | DST_Printf("C3 4-Additional bytes 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n", |
|---|
| 2184 | buff[0], buff[1], buff[2], buff[3], buff[4], buff[5]); |
|---|
| 2185 | } |
|---|
| 2186 | return true; |
|---|
| 2187 | } |
|---|
| 2188 | if (ucNext < 0x90) // C3 5-Additional bytes |
|---|
| 2189 | { |
|---|
| 2190 | if (Q->GetSize(Q) < 7) return false; |
|---|
| 2191 | Q->Get(Q, buff, 7); |
|---|
| 2192 | if (debug_cc) |
|---|
| 2193 | { |
|---|
| 2194 | DST_Printf("C3 5-Additional bytes 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n", |
|---|
| 2195 | buff[0], buff[1], buff[2], buff[3], buff[4], buff[5], buff[6]); |
|---|
| 2196 | } |
|---|
| 2197 | return true; |
|---|
| 2198 | } |
|---|
| 2199 | // C3 Variable Length Additional bytes |
|---|
| 2200 | if (Q->GetSize(Q) < 3) return false; |
|---|
| 2201 | unsigned char ucNextNext = Q->GetNextNextByte(Q) & 0x3F; // ÇÏÀ§ 6ºñÆ®°¡ ±æÀÌ ºñÆ®ÀÌ´Ù. |
|---|
| 2202 | if (Q->GetSize(Q) < 3 + ucNextNext) return false; |
|---|
| 2203 | Q->Get(Q, buff, 3 + ucNextNext); |
|---|
| 2204 | if (debug_cc) DST_Printf("C3 Variable Length Additional bytes\n"); |
|---|
| 2205 | return true; |
|---|
| 2206 | } |
|---|
| 2207 | |
|---|
| 2208 | bool CC708Decoder_ProcessG3(CCCircularQueue *Q) |
|---|
| 2209 | { |
|---|
| 2210 | if (Q->GetNextByte(Q) == 0xA0) CC708Decoder_PrintChar(0xE1A0); // [CC] ¹®ÀÚ »ç¿ëÀÚ Á¤ÀÇ ¹®ÀÚ ¿µ¿ª |
|---|
| 2211 | unsigned char buff[2]; |
|---|
| 2212 | Q->Get(Q, buff, 2); |
|---|
| 2213 | if (debug_cc) DST_Printf("G3 0x%02X 0x%02X\n", buff[0], buff[1]); |
|---|
| 2214 | return true; |
|---|
| 2215 | } |
|---|
| 2216 | |
|---|
| 2217 | bool CC708Decoder_ProcessExt1(CCCircularQueue *Q) |
|---|
| 2218 | { |
|---|
| 2219 | unsigned char ucData = Q->GetNextByte(Q); |
|---|
| 2220 | if (ucData < 0x20) |
|---|
| 2221 | { |
|---|
| 2222 | return CC708Decoder_ProcessC2(Q); |
|---|
| 2223 | } |
|---|
| 2224 | if (ucData < 0x80) |
|---|
| 2225 | { |
|---|
| 2226 | return CC708Decoder_ProcessG2(Q); |
|---|
| 2227 | } |
|---|
| 2228 | if (ucData < 0xA0) |
|---|
| 2229 | { |
|---|
| 2230 | return CC708Decoder_ProcessC3(Q); |
|---|
| 2231 | } |
|---|
| 2232 | return CC708Decoder_ProcessG3(Q); |
|---|
| 2233 | } |
|---|
| 2234 | |
|---|
| 2235 | // C0 ¿µ¿ª ó¸® |
|---|
| 2236 | bool CC708Decoder_ProcessC0(CCCircularQueue *Q) |
|---|
| 2237 | { |
|---|
| 2238 | unsigned char buff[4] = {0,0,0,0}; |
|---|
| 2239 | unsigned char ucData = Q->GetByte(Q); |
|---|
| 2240 | if (ucData < 0x10) // 1¹ÙÀÌÆ® ¸í·É¾î |
|---|
| 2241 | { |
|---|
| 2242 | return CC708Decoder_ProcessC01Byte(Q); |
|---|
| 2243 | } |
|---|
| 2244 | if (ucData < 0x18) // 2¹ÙÀÌÆ® ¸í·É¾î |
|---|
| 2245 | { |
|---|
| 2246 | if (Q->GetSize(Q) < 2) return false; |
|---|
| 2247 | if (ucData == EXT1) |
|---|
| 2248 | { |
|---|
| 2249 | return CC708Decoder_ProcessExt1(Q); |
|---|
| 2250 | } |
|---|
| 2251 | Q->Get(Q, buff, 2); |
|---|
| 2252 | if (debug_cc) DST_Printf("C0 0x%02X 0x%02X\n", buff[0], buff[1]); |
|---|
| 2253 | return true; |
|---|
| 2254 | } |
|---|
| 2255 | // 3¹ÙÀÌÆ® ¸í·É¾î |
|---|
| 2256 | if (Q->GetSize(Q) < 3) return false; |
|---|
| 2257 | |
|---|
| 2258 | Q->Get(Q, buff, 3); |
|---|
| 2259 | if (ucData == 0x18 && CC708Decoder_bKorean == true) |
|---|
| 2260 | { |
|---|
| 2261 | // ASC ¹®ÀÚ Áß »ç¿ëÇÒ ¼ö ¾ø´Â ¹®ÀÚ¿Àº ¹èÁ¦ÇÑ´Ù. |
|---|
| 2262 | if (buff[1] == 0 && (buff[2] < 0x20 || (buff[2] >= 0x80 && buff[2] < 0xA0))) |
|---|
| 2263 | { |
|---|
| 2264 | if (debug_cc) DST_Printf("P16 Not supported ascii 0x%02X\n", buff[2]); |
|---|
| 2265 | return true; |
|---|
| 2266 | } |
|---|
| 2267 | if (debug_cc) |
|---|
| 2268 | { |
|---|
| 2269 | if (buff[1] == 0) |
|---|
| 2270 | { |
|---|
| 2271 | DST_Printf("P16 0x%04X [%s]\n", (buff[1]*256)+buff[2], &buff[2]); |
|---|
| 2272 | } |
|---|
| 2273 | else |
|---|
| 2274 | { |
|---|
| 2275 | DST_Printf("P16 0x%04X [%s]\n", (buff[1]*256)+buff[2], &buff[1]); |
|---|
| 2276 | } |
|---|
| 2277 | } |
|---|
| 2278 | if (buff[1] == 0) // 0x007F¿Í 0x00A0´Â °ø¹é¹®ÀڷΠġȯÇÑ´Ù. |
|---|
| 2279 | { |
|---|
| 2280 | switch (buff[2]) |
|---|
| 2281 | { |
|---|
| 2282 | case 0x7F: |
|---|
| 2283 | case 0xA0: |
|---|
| 2284 | buff[2] = 0x20; |
|---|
| 2285 | break; |
|---|
| 2286 | } |
|---|
| 2287 | } |
|---|
| 2288 | CC708Decoder_PrintChar(CC708Decoder_bUnicode ? (DS_U16)(buff[1]*256+buff[2]) : DMW_KSX2UniSub(buff[1], buff[2])); |
|---|
| 2289 | return true; |
|---|
| 2290 | } |
|---|
| 2291 | return true; |
|---|
| 2292 | } |
|---|
| 2293 | |
|---|
| 2294 | bool CC708Decoder_ProcessC1(CCCircularQueue *Q) |
|---|
| 2295 | { |
|---|
| 2296 | unsigned char ucData = Q->GetByte(Q); |
|---|
| 2297 | unsigned char buff[10]; |
|---|
| 2298 | switch (ucData) |
|---|
| 2299 | { |
|---|
| 2300 | case CW0: // Current Window |
|---|
| 2301 | case CW1: |
|---|
| 2302 | case CW2: |
|---|
| 2303 | case CW3: |
|---|
| 2304 | case CW4: |
|---|
| 2305 | case CW5: |
|---|
| 2306 | case CW6: |
|---|
| 2307 | case CW7: |
|---|
| 2308 | CC708Decoder_nCurrentWindow = ucData & 0x07; |
|---|
| 2309 | Q->RemoveByte(Q); |
|---|
| 2310 | if (debug_cc) DST_Printf("CW%d 0x%02X\n", CC708Decoder_nCurrentWindow, ucData); |
|---|
| 2311 | return true; |
|---|
| 2312 | |
|---|
| 2313 | case DF0: // Define Window |
|---|
| 2314 | case DF1: |
|---|
| 2315 | case DF2: |
|---|
| 2316 | case DF3: |
|---|
| 2317 | case DF4: |
|---|
| 2318 | case DF5: |
|---|
| 2319 | case DF6: |
|---|
| 2320 | case DF7: |
|---|
| 2321 | if (Q->GetSize(Q) < 7) return false; |
|---|
| 2322 | Q->Get(Q, buff, 7); |
|---|
| 2323 | if (debug_cc) DST_Printf("DF 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n", |
|---|
| 2324 | buff[0], buff[1], buff[2], buff[3], buff[4], buff[5], buff[6]); |
|---|
| 2325 | CC708Decoder_nCurrentWindow = buff[0] & 0x07; // test code |
|---|
| 2326 | CC708Decoder_win[buff[0] & 0x07]->DefineWindow(CC708Decoder_win[buff[0] & 0x07],// Window ID |
|---|
| 2327 | buff[1] & 0x07, // Priority |
|---|
| 2328 | (buff[4] >> 4) & 0x0F, // Anchor Point |
|---|
| 2329 | (buff[2] & 0x80) ? 1 : 0, // Relative Position |
|---|
| 2330 | buff[2] & 0x7F, // Anchor Vertical |
|---|
| 2331 | buff[3], // Anchor Horizontal |
|---|
| 2332 | buff[4] & 0x0F, // Row Count |
|---|
| 2333 | buff[5] & 0x3F, // Column Count |
|---|
| 2334 | (buff[1] & 0x10) ? 1 : 0, // Row Lock |
|---|
| 2335 | (buff[1] & 0x08) ? 1 : 0, // Column Lock |
|---|
| 2336 | (buff[1] & 0x20) ? 1 : 0, // Visible |
|---|
| 2337 | (buff[6] >> 3) & 0x07, // Window Style ID |
|---|
| 2338 | buff[6] & 0x07 // Pen Style ID |
|---|
| 2339 | ); |
|---|
| 2340 | return true; |
|---|
| 2341 | |
|---|
| 2342 | case CLW: // Clear Window |
|---|
| 2343 | if (Q->GetSize(Q) < 2) return false; |
|---|
| 2344 | Q->Get(Q, buff, 2); |
|---|
| 2345 | if (debug_cc) DST_Printf("CLW 0x%02X 0x%02X\n", buff[0], buff[1]); |
|---|
| 2346 | if (buff[1] & 0x01) CC708Decoder_win[0]->ClearWindow(CC708Decoder_win[0]); |
|---|
| 2347 | if (buff[1] & 0x02) CC708Decoder_win[1]->ClearWindow(CC708Decoder_win[1]); |
|---|
| 2348 | if (buff[1] & 0x04) CC708Decoder_win[2]->ClearWindow(CC708Decoder_win[2]); |
|---|
| 2349 | if (buff[1] & 0x08) CC708Decoder_win[3]->ClearWindow(CC708Decoder_win[3]); |
|---|
| 2350 | if (buff[1] & 0x10) CC708Decoder_win[4]->ClearWindow(CC708Decoder_win[4]); |
|---|
| 2351 | if (buff[1] & 0x20) CC708Decoder_win[5]->ClearWindow(CC708Decoder_win[5]); |
|---|
| 2352 | if (buff[1] & 0x40) CC708Decoder_win[6]->ClearWindow(CC708Decoder_win[6]); |
|---|
| 2353 | if (buff[1] & 0x80) CC708Decoder_win[7]->ClearWindow(CC708Decoder_win[7]); |
|---|
| 2354 | return true; |
|---|
| 2355 | |
|---|
| 2356 | case DLW: // Delete Window |
|---|
| 2357 | if (Q->GetSize(Q) < 2) return false; |
|---|
| 2358 | Q->Get(Q, buff, 2); |
|---|
| 2359 | if (debug_cc) DST_Printf("DLW 0x%02X 0x%02X\n", buff[0], buff[1]); |
|---|
| 2360 | if (buff[1] & 0x01) CC708Decoder_win[0]->DeleteWindow(CC708Decoder_win[0]); |
|---|
| 2361 | if (buff[1] & 0x02) CC708Decoder_win[1]->DeleteWindow(CC708Decoder_win[1]); |
|---|
| 2362 | if (buff[1] & 0x04) CC708Decoder_win[2]->DeleteWindow(CC708Decoder_win[2]); |
|---|
| 2363 | if (buff[1] & 0x08) CC708Decoder_win[3]->DeleteWindow(CC708Decoder_win[3]); |
|---|
| 2364 | if (buff[1] & 0x10) CC708Decoder_win[4]->DeleteWindow(CC708Decoder_win[4]); |
|---|
| 2365 | if (buff[1] & 0x20) CC708Decoder_win[5]->DeleteWindow(CC708Decoder_win[5]); |
|---|
| 2366 | if (buff[1] & 0x40) CC708Decoder_win[6]->DeleteWindow(CC708Decoder_win[6]); |
|---|
| 2367 | if (buff[1] & 0x80) CC708Decoder_win[7]->DeleteWindow(CC708Decoder_win[7]); |
|---|
| 2368 | return true; |
|---|
| 2369 | |
|---|
| 2370 | case DSW: // Display Window |
|---|
| 2371 | if (Q->GetSize(Q) < 2) return false; |
|---|
| 2372 | Q->Get(Q, buff, 2); |
|---|
| 2373 | if (debug_cc) DST_Printf("DSW 0x%02X 0x%02X\n", buff[0], buff[1]); |
|---|
| 2374 | if (buff[1] & 0x01) CC708Decoder_win[0]->DisplayWindow(CC708Decoder_win[0]); |
|---|
| 2375 | if (buff[1] & 0x02) CC708Decoder_win[1]->DisplayWindow(CC708Decoder_win[1]); |
|---|
| 2376 | if (buff[1] & 0x04) CC708Decoder_win[2]->DisplayWindow(CC708Decoder_win[2]); |
|---|
| 2377 | if (buff[1] & 0x08) CC708Decoder_win[3]->DisplayWindow(CC708Decoder_win[3]); |
|---|
| 2378 | if (buff[1] & 0x10) CC708Decoder_win[4]->DisplayWindow(CC708Decoder_win[4]); |
|---|
| 2379 | if (buff[1] & 0x20) CC708Decoder_win[5]->DisplayWindow(CC708Decoder_win[5]); |
|---|
| 2380 | if (buff[1] & 0x40) CC708Decoder_win[6]->DisplayWindow(CC708Decoder_win[6]); |
|---|
| 2381 | if (buff[1] & 0x80) CC708Decoder_win[7]->DisplayWindow(CC708Decoder_win[7]); |
|---|
| 2382 | return true; |
|---|
| 2383 | |
|---|
| 2384 | case HDW: // Hide Window |
|---|
| 2385 | if (Q->GetSize(Q) < 2) return false; |
|---|
| 2386 | Q->Get(Q, buff, 2); |
|---|
| 2387 | if (debug_cc) DST_Printf("HDW 0x%02X 0x%02X\n", buff[0], buff[1]); |
|---|
| 2388 | if (buff[1] & 0x01) CC708Decoder_win[0]->HideWindow(CC708Decoder_win[0]); |
|---|
| 2389 | if (buff[1] & 0x02) CC708Decoder_win[1]->HideWindow(CC708Decoder_win[1]); |
|---|
| 2390 | if (buff[1] & 0x04) CC708Decoder_win[2]->HideWindow(CC708Decoder_win[2]); |
|---|
| 2391 | if (buff[1] & 0x08) CC708Decoder_win[3]->HideWindow(CC708Decoder_win[3]); |
|---|
| 2392 | if (buff[1] & 0x10) CC708Decoder_win[4]->HideWindow(CC708Decoder_win[4]); |
|---|
| 2393 | if (buff[1] & 0x20) CC708Decoder_win[5]->HideWindow(CC708Decoder_win[5]); |
|---|
| 2394 | if (buff[1] & 0x40) CC708Decoder_win[6]->HideWindow(CC708Decoder_win[6]); |
|---|
| 2395 | if (buff[1] & 0x80) CC708Decoder_win[7]->HideWindow(CC708Decoder_win[7]); |
|---|
| 2396 | return true; |
|---|
| 2397 | |
|---|
| 2398 | case TGW: // Toggle Window |
|---|
| 2399 | if (Q->GetSize(Q) < 2) return false; |
|---|
| 2400 | Q->Get(Q, buff, 2); |
|---|
| 2401 | if (debug_cc) DST_Printf("TGW 0x%02X 0x%02X\n", buff[0], buff[1]); |
|---|
| 2402 | if (buff[1] & 0x01) CC708Decoder_win[0]->ToggleWindow(CC708Decoder_win[0]); |
|---|
| 2403 | if (buff[1] & 0x02) CC708Decoder_win[1]->ToggleWindow(CC708Decoder_win[1]); |
|---|
| 2404 | if (buff[1] & 0x04) CC708Decoder_win[2]->ToggleWindow(CC708Decoder_win[2]); |
|---|
| 2405 | if (buff[1] & 0x08) CC708Decoder_win[3]->ToggleWindow(CC708Decoder_win[3]); |
|---|
| 2406 | if (buff[1] & 0x10) CC708Decoder_win[4]->ToggleWindow(CC708Decoder_win[4]); |
|---|
| 2407 | if (buff[1] & 0x20) CC708Decoder_win[5]->ToggleWindow(CC708Decoder_win[5]); |
|---|
| 2408 | if (buff[1] & 0x40) CC708Decoder_win[6]->ToggleWindow(CC708Decoder_win[6]); |
|---|
| 2409 | if (buff[1] & 0x80) CC708Decoder_win[7]->ToggleWindow(CC708Decoder_win[7]); |
|---|
| 2410 | return true; |
|---|
| 2411 | |
|---|
| 2412 | case SWA: // Set Window Attributes |
|---|
| 2413 | if (Q->GetSize(Q) < 5) return false; |
|---|
| 2414 | Q->Get(Q, buff, 5); |
|---|
| 2415 | if (debug_cc) DST_Printf("SWA 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n", |
|---|
| 2416 | buff[0], buff[1], buff[2], buff[3], buff[4]); |
|---|
| 2417 | if (CC708Decoder_nCurrentWindow == -1) return true; |
|---|
| 2418 | CC708Decoder_win[CC708Decoder_nCurrentWindow]->SetWindowAttribute( |
|---|
| 2419 | CC708Decoder_win[CC708Decoder_nCurrentWindow], |
|---|
| 2420 | buff[3] & 0x03, // Justify |
|---|
| 2421 | (buff[3] >> 4) & 0x03, // Print Direction |
|---|
| 2422 | (buff[3] >> 2) & 0x03, // Scroll Direction |
|---|
| 2423 | ((buff[3] >> 5) & 0x01) ? true : false, // Word Wrap |
|---|
| 2424 | buff[4] & 0x03, // Display Effect |
|---|
| 2425 | (buff[4] >> 2) & 0x03, // Effect Direction |
|---|
| 2426 | (buff[4] >> 4) & 0x0F, // Effect Speed |
|---|
| 2427 | (buff[1] >> 4) & 0x03, // Fill Color Red |
|---|
| 2428 | (buff[1] >> 2) & 0x03, // Fill Color Green |
|---|
| 2429 | buff[1] & 0x03, // Fill Color Blue |
|---|
| 2430 | (buff[1] >> 6) & 0x03, // Fill Color Opacity |
|---|
| 2431 | ((buff[3] >> 5) & 0x04) | ((buff[2] >> 6) & 0x03), // Border Type |
|---|
| 2432 | (buff[2] >> 4) & 0x03, // Border Color Red |
|---|
| 2433 | (buff[2] >> 2) & 0x03, // Border Color Green |
|---|
| 2434 | buff[2] & 0x03 // Border Color Blue |
|---|
| 2435 | ); |
|---|
| 2436 | return true; |
|---|
| 2437 | |
|---|
| 2438 | case SPA: // Set Pen Attributes |
|---|
| 2439 | if (Q->GetSize(Q) < 3) return false; |
|---|
| 2440 | Q->Get(Q, buff, 3); |
|---|
| 2441 | if (debug_cc) DST_Printf("SPA 0x%02X 0x%02X 0x%02X\n", buff[0], buff[1], buff[2]); |
|---|
| 2442 | if (CC708Decoder_nCurrentWindow < 0) return true; |
|---|
| 2443 | CC708Decoder_win[CC708Decoder_nCurrentWindow]->SetPenAttribute |
|---|
| 2444 | ( |
|---|
| 2445 | CC708Decoder_win[CC708Decoder_nCurrentWindow], |
|---|
| 2446 | buff[1] & 0x03, // Pen Size |
|---|
| 2447 | buff[2] & 0x07, // Font Style |
|---|
| 2448 | (buff[1] >> 4) & 0x0F, // Text Tag |
|---|
| 2449 | (buff[1] >> 2) & 0x03, // Offset |
|---|
| 2450 | (buff[2] & 0x80) ? 1 : 0, // Italics |
|---|
| 2451 | (buff[2] & 0x40) ? 1 : 0, // UnderLine |
|---|
| 2452 | (buff[2] >> 3) & 0x07 // Edge Type |
|---|
| 2453 | ); |
|---|
| 2454 | return true; |
|---|
| 2455 | |
|---|
| 2456 | case SPC: // Set Pen Color |
|---|
| 2457 | if (Q->GetSize(Q) < 4) return false; |
|---|
| 2458 | Q->Get(Q, buff, 4); |
|---|
| 2459 | if (debug_cc) DST_Printf("SPC 0x%02X 0x%02X 0x%02X 0x%02X\n", buff[0], buff[1], buff[2], buff[3]); |
|---|
| 2460 | if (CC708Decoder_nCurrentWindow < 0) return true; |
|---|
| 2461 | CC708Decoder_win[CC708Decoder_nCurrentWindow]->SetPenColor |
|---|
| 2462 | ( |
|---|
| 2463 | CC708Decoder_win[CC708Decoder_nCurrentWindow], |
|---|
| 2464 | (buff[1] >> 4) & 0x03, // Foreground Body Color Red |
|---|
| 2465 | (buff[1] >> 2) & 0x03, // Foreground Body Color Green |
|---|
| 2466 | (buff[1] >> 0) & 0x03, // Foreground Body Color Blue |
|---|
| 2467 | (buff[1] >> 6) & 0x03, // Foreground Body Opacity |
|---|
| 2468 | (buff[2] >> 4) & 0x03, // BackGround Body Color Red |
|---|
| 2469 | (buff[2] >> 2) & 0x03, // BackGround Body Color Green |
|---|
| 2470 | (buff[2] >> 0) & 0x03, // BackGround Body Color Blue |
|---|
| 2471 | (buff[2] >> 6) & 0x03, // BackGround Body Opacity |
|---|
| 2472 | (buff[3] >> 4) & 0x03, // Edgeground Body Color Red |
|---|
| 2473 | (buff[3] >> 2) & 0x03, // Edgeground Body Color Green |
|---|
| 2474 | (buff[3] >> 0) & 0x03 // Edgeground Body Color Blue |
|---|
| 2475 | ); |
|---|
| 2476 | return true; |
|---|
| 2477 | |
|---|
| 2478 | case SPL: // Set Pen Location |
|---|
| 2479 | if (Q->GetSize(Q) < 3) return false; |
|---|
| 2480 | Q->Get(Q, buff, 3); |
|---|
| 2481 | if (debug_cc) DST_Printf("SPL 0x%02X 0x%02X 0x%02X\n", buff[0], buff[1], buff[2]); |
|---|
| 2482 | if (CC708Decoder_nCurrentWindow == -1) return true; |
|---|
| 2483 | CC708Decoder_win[CC708Decoder_nCurrentWindow]->SetPenLocation( |
|---|
| 2484 | CC708Decoder_win[CC708Decoder_nCurrentWindow], |
|---|
| 2485 | buff[2] & 0x3F, // Column |
|---|
| 2486 | buff[1] & 0x0F // Row |
|---|
| 2487 | ); |
|---|
| 2488 | if (debug_cc) DST_Printf("SPL %d %d\n", buff[2] & 0x3F, buff[1] & 0x0F); |
|---|
| 2489 | return true; |
|---|
| 2490 | |
|---|
| 2491 | case DLY: |
|---|
| 2492 | if (Q->GetSize(Q) < 2) return false; |
|---|
| 2493 | Q->Get(Q, buff, 2); |
|---|
| 2494 | if (debug_cc) DST_Printf("DLY 0x%02X 0x%02X\n", buff[0], buff[1]); |
|---|
| 2495 | CC708Decoder_Delay (buff[1]); |
|---|
| 2496 | return true; |
|---|
| 2497 | |
|---|
| 2498 | case DLC: |
|---|
| 2499 | if (debug_cc) DST_Printf("DLC 0x%02X\n", ucData); |
|---|
| 2500 | CC708Decoder_DelayCancel(); |
|---|
| 2501 | Q->RemoveByte(Q); |
|---|
| 2502 | DST_Printf("DLC\n"); |
|---|
| 2503 | return true; |
|---|
| 2504 | |
|---|
| 2505 | case RST: |
|---|
| 2506 | if (debug_cc) DST_Printf("RST 0x%02X\n", ucData); |
|---|
| 2507 | Q->RemoveByte(Q); |
|---|
| 2508 | CC708Decoder_Reset(); |
|---|
| 2509 | return true; |
|---|
| 2510 | } |
|---|
| 2511 | if (debug_cc) DST_Printf("Unknown C1 Command 0x%02X\n", ucData); |
|---|
| 2512 | Q->RemoveByte(Q); // Undefined Command. |
|---|
| 2513 | return true; |
|---|
| 2514 | } |
|---|
| 2515 | |
|---|
| 2516 | bool CC708Decoder_DecodeSub(CCCircularQueue *Q) |
|---|
| 2517 | { |
|---|
| 2518 | if (Q->GetSize(Q) < 1) return false; |
|---|
| 2519 | unsigned char ucData = Q->GetByte(Q); |
|---|
| 2520 | if (ucData < 0x20) // C0 ¿µ¿ª |
|---|
| 2521 | { |
|---|
| 2522 | return CC708Decoder_ProcessC0(Q); |
|---|
| 2523 | } |
|---|
| 2524 | if (ucData < 0x80) // G0 ¿µ¿ª |
|---|
| 2525 | { |
|---|
| 2526 | if (debug_cc) DST_Printf("G0 %c 0x%02X\n", ucData, ucData); |
|---|
| 2527 | //if (bKorean == false) // JTBC¿¡¼ G0ÀÇ 0x20À» »ç¿ëÇÏ´Â ¹®Á¦·Î ±¹³»Çâ¿¡¼µµ G0 Áö¿ø 2013.03.13 |
|---|
| 2528 | { |
|---|
| 2529 | switch (ucData) |
|---|
| 2530 | { |
|---|
| 2531 | case 0x7F: |
|---|
| 2532 | CC708Decoder_PrintChar(0x266A); //Unicode Character 'EIGHTH NOTE' (U+266A) |
|---|
| 2533 | break; |
|---|
| 2534 | |
|---|
| 2535 | default: |
|---|
| 2536 | CC708Decoder_PrintChar((DS_U16)ucData); |
|---|
| 2537 | break; |
|---|
| 2538 | } |
|---|
| 2539 | } |
|---|
| 2540 | Q->RemoveByte(Q); |
|---|
| 2541 | return true; |
|---|
| 2542 | } |
|---|
| 2543 | if (ucData < 0xA0) // C1 ¿µ¿ª |
|---|
| 2544 | { |
|---|
| 2545 | return CC708Decoder_ProcessC1(Q); |
|---|
| 2546 | } |
|---|
| 2547 | // G1 ¿µ¿ª |
|---|
| 2548 | if (debug_cc) DST_Printf("G1 %c0x%02X\n", ucData, ucData); |
|---|
| 2549 | //if (CC708Decoder_bKorean == false) |
|---|
| 2550 | { |
|---|
| 2551 | CC708Decoder_PrintChar((DS_U16)ucData); |
|---|
| 2552 | } |
|---|
| 2553 | Q->RemoveByte(Q); |
|---|
| 2554 | return true; |
|---|
| 2555 | } |
|---|
| 2556 | |
|---|
| 2557 | // virtual void Show() |
|---|
| 2558 | void CC708Decoder_Show(CWindow *this) |
|---|
| 2559 | { |
|---|
| 2560 | int i = 0; |
|---|
| 2561 | int j = 0; |
|---|
| 2562 | OSD_PIXEL_T *tmp_buff = 0; |
|---|
| 2563 | DST_RECT rectUpdate; |
|---|
| 2564 | |
|---|
| 2565 | OSD_PIXEL_T *srcBuff = 0; |
|---|
| 2566 | DST_RECT rectCommon; |
|---|
| 2567 | DST_RECT rectSrc; |
|---|
| 2568 | int srcStartX = 0; |
|---|
| 2569 | int srcStartY = 0; |
|---|
| 2570 | OSD_PIXEL_T* src = 0; |
|---|
| 2571 | OSD_PIXEL_T* des = 0; |
|---|
| 2572 | int y = 0; |
|---|
| 2573 | int nSize = 0; |
|---|
| 2574 | int src_delta = 0; |
|---|
| 2575 | int des_delta = 0; |
|---|
| 2576 | int x = 0; |
|---|
| 2577 | |
|---|
| 2578 | if (this->imgBuff == 0) return; |
|---|
| 2579 | this->KillTimer(this, 2); // Áö¿¬Çؼ ±×¸®´Â ŸÀ̸Ӹ¦ ²ö´Ù. |
|---|
| 2580 | // EIT³ª PMTÀÇ CC descriptionÀÌ º¯°æµÇ¾ú´Ù¸é ´Ý´Â´Ù. |
|---|
| 2581 | bool _bKorean, _bWideScreen, _bUnicode; |
|---|
| 2582 | DST_CheckCCDescription(CC708Decoder_nServiceNumber, &_bKorean, &_bWideScreen, &_bUnicode); |
|---|
| 2583 | if (CC708Decoder_bKorean != _bKorean || CC708Decoder_bWideScreen != _bWideScreen) |
|---|
| 2584 | { |
|---|
| 2585 | this->Close(this); |
|---|
| 2586 | return; |
|---|
| 2587 | } |
|---|
| 2588 | if (CC708Decoder_bKorean == true && CC708Decoder_bUnicode != _bUnicode) |
|---|
| 2589 | { |
|---|
| 2590 | this->Close(this); |
|---|
| 2591 | return; |
|---|
| 2592 | } |
|---|
| 2593 | |
|---|
| 2594 | i = 0; |
|---|
| 2595 | for (i = 0; i < 8; i++) CC708Decoder_win[i]->Draw(CC708Decoder_win[i], CC708Decoder_bFlashDraw);// º¯°æ»çÇ×ÀÌ ÀÖ´Ù¸é ±×¸°´Ù. |
|---|
| 2596 | // ´Ù ±×·ÈÀ¸¸é ȸ鿡 ±×¸®ÀÚ. |
|---|
| 2597 | rectUpdate = DST_UpdateRegionGet(); |
|---|
| 2598 | if (rectUpdate.w == 0 || rectUpdate.h == 0) return; |
|---|
| 2599 | //DST_Printf("rectUpdate %d %d %d %d \n", rectUpdate.x, rectUpdate.y, rectUpdate.w, rectUpdate.h); |
|---|
| 2600 | this->UpdateScreenEx(this, rectUpdate.x, rectUpdate.y, rectUpdate.w, rectUpdate.h); |
|---|
| 2601 | |
|---|
| 2602 | //DrawBox(rectUpdate.x, rectUpdate.y, rectUpdate.w, rectUpdate.h, COLOR_TRANSPARENT); |
|---|
| 2603 | { // ¾÷µ¥ÀÌÆ® ÇÒ ¿µ¿ªÀ» Åõ¸í»öÀ¸·Î ä¿î´Ù |
|---|
| 2604 | tmp_buff = this->imgBuff + this->rect.w * rectUpdate.y + rectUpdate.x; |
|---|
| 2605 | nSize = rectUpdate.w * sizeof(OSD_PIXEL_T); |
|---|
| 2606 | y = rectUpdate.h; |
|---|
| 2607 | while (y--) |
|---|
| 2608 | { |
|---|
| 2609 | memset(tmp_buff, 0, nSize); |
|---|
| 2610 | tmp_buff += this->rect.w; |
|---|
| 2611 | } |
|---|
| 2612 | } |
|---|
| 2613 | |
|---|
| 2614 | bool bFirst = true; |
|---|
| 2615 | int priority = 0; |
|---|
| 2616 | for ( priority = 7; priority >= 0; priority--) |
|---|
| 2617 | { |
|---|
| 2618 | // 2013.05.16 µ¿ÀÏ priority¶ó¸é nCurrentWindow¸¦ °¡Àå ¸¶Áö¸·¿¡ ±×¸®µµ·Ï ÇÑ´Ù. |
|---|
| 2619 | int order_table[8] = {0,1,2,3,4,5,6,7}; |
|---|
| 2620 | order_table[0] = (CC708Decoder_nCurrentWindow > -1) ? CC708Decoder_nCurrentWindow : 0; |
|---|
| 2621 | i = 0; |
|---|
| 2622 | j = 0; |
|---|
| 2623 | nSize = 0; |
|---|
| 2624 | y = 0; |
|---|
| 2625 | for (i = 1; i < 8; i++) order_table[i] = (i <= order_table[0]) ? i-1 : i; |
|---|
| 2626 | i = 0; |
|---|
| 2627 | |
|---|
| 2628 | |
|---|
| 2629 | for (j = 7; j >= 0; j--) |
|---|
| 2630 | { |
|---|
| 2631 | |
|---|
| 2632 | srcBuff = 0; |
|---|
| 2633 | memset(&rectCommon,0,sizeof(DST_RECT)); |
|---|
| 2634 | memset(&rectSrc,0,sizeof(DST_RECT)); |
|---|
| 2635 | srcStartX = 0; |
|---|
| 2636 | srcStartY = 0; |
|---|
| 2637 | src = 0; |
|---|
| 2638 | des = 0; |
|---|
| 2639 | y = 0; |
|---|
| 2640 | nSize = 0; |
|---|
| 2641 | src_delta = 0; |
|---|
| 2642 | des_delta = 0; |
|---|
| 2643 | x = 0; |
|---|
| 2644 | i = order_table[j]; |
|---|
| 2645 | |
|---|
| 2646 | if (priority != CC708Decoder_win[i]->GetPriority(CC708Decoder_win[i])) continue; |
|---|
| 2647 | if (CC708Decoder_win[i]->GetVisible(CC708Decoder_win[i]) == false) continue; |
|---|
| 2648 | |
|---|
| 2649 | srcBuff = CC708Decoder_win[i]->GetImgBuff(CC708Decoder_win[i]); |
|---|
| 2650 | if (srcBuff == 0) continue; |
|---|
| 2651 | |
|---|
| 2652 | rectSrc = CC708Decoder_win[i]->GetSize(CC708Decoder_win[i]); |
|---|
| 2653 | |
|---|
| 2654 | if (DST_GetCommonRect(rectUpdate, rectSrc, &rectCommon ) == false) continue; |
|---|
| 2655 | |
|---|
| 2656 | srcStartX = rectCommon.x - rectSrc.x; |
|---|
| 2657 | if (srcStartX < 0) srcStartX = 0; |
|---|
| 2658 | srcStartY = rectCommon.y - rectSrc.y; |
|---|
| 2659 | if (srcStartY < 0) srcStartY = 0; |
|---|
| 2660 | //DS_U8* des1 = imgBuff + rect.w * rectCommon.y + rectCommon.x; |
|---|
| 2661 | //DS_U8* src1 = srcBuff + rectSrc.w * srcStartY + srcStartX; |
|---|
| 2662 | if (bFirst == true) |
|---|
| 2663 | { |
|---|
| 2664 | bFirst = false; |
|---|
| 2665 | |
|---|
| 2666 | src = srcBuff + rectSrc.w * srcStartY + srcStartX; |
|---|
| 2667 | des = this->imgBuff + rectCommon.y * this->rect.w + rectCommon.x; |
|---|
| 2668 | y = rectCommon.h; |
|---|
| 2669 | nSize = rectCommon.w * sizeof(OSD_PIXEL_T); |
|---|
| 2670 | while (y--) |
|---|
| 2671 | { |
|---|
| 2672 | memcpy(des, src, nSize); |
|---|
| 2673 | src += rectSrc.w; |
|---|
| 2674 | des += this->rect.w; |
|---|
| 2675 | } |
|---|
| 2676 | } |
|---|
| 2677 | else |
|---|
| 2678 | { |
|---|
| 2679 | src = srcBuff + rectSrc.w * srcStartY + srcStartX; |
|---|
| 2680 | des = this->imgBuff + rectCommon.y * this->rect.w + rectCommon.x; |
|---|
| 2681 | src_delta = rectSrc.w-rectCommon.w; |
|---|
| 2682 | des_delta = this->rect.w-rectCommon.w; |
|---|
| 2683 | y = rectCommon.h; |
|---|
| 2684 | while (y--) |
|---|
| 2685 | { |
|---|
| 2686 | x = rectCommon.w; |
|---|
| 2687 | while (x--) |
|---|
| 2688 | { |
|---|
| 2689 | if (*src) *des = *src; |
|---|
| 2690 | src++; |
|---|
| 2691 | des++; |
|---|
| 2692 | } |
|---|
| 2693 | src+=src_delta; |
|---|
| 2694 | des+=des_delta; |
|---|
| 2695 | x = 0; |
|---|
| 2696 | } |
|---|
| 2697 | } |
|---|
| 2698 | } |
|---|
| 2699 | } |
|---|
| 2700 | DST_UpdateRegionReset(); |
|---|
| 2701 | CC708Decoder_LastShowTime = DST_OS_GetTickCount(); |
|---|
| 2702 | } |
|---|
| 2703 | |
|---|
| 2704 | |
|---|
| 2705 | |
|---|
| 2706 | // virtual void OnMessage(SWinEventMsg event) |
|---|
| 2707 | void CC708Decoder_OnMessage(CWindow *this, SWinEventMsg event) |
|---|
| 2708 | { |
|---|
| 2709 | int i = 0; |
|---|
| 2710 | switch (event.cmd) |
|---|
| 2711 | { |
|---|
| 2712 | case WM_SEQ_ERROR: |
|---|
| 2713 | |
|---|
| 2714 | // T(); |
|---|
| 2715 | this->Close(this); |
|---|
| 2716 | break; |
|---|
| 2717 | |
|---|
| 2718 | case WM_CS1: |
|---|
| 2719 | |
|---|
| 2720 | // T(); |
|---|
| 2721 | if (this->GetState(this) != 1) break; |
|---|
| 2722 | this->ResetTimer(this, 0); // À©µµ¿ìÀÇ Å¸ÀӾƿô °ªÀ» ¿¬ÀåÇÑ´Ù. |
|---|
| 2723 | for (i = 0 ; i < event.data[0]; i++) |
|---|
| 2724 | { |
|---|
| 2725 | if (debug_cc) DST_Printf("%02X ", event.data[i+1]); |
|---|
| 2726 | CC708Decoder_Queue->Add2(CC708Decoder_Queue, event.data[i+1]); |
|---|
| 2727 | } |
|---|
| 2728 | if (debug_cc) DST_Printf("\n"); |
|---|
| 2729 | while (1) |
|---|
| 2730 | { |
|---|
| 2731 | if (CC708Decoder_DecodeSub(CC708Decoder_Queue)== false) break; |
|---|
| 2732 | } |
|---|
| 2733 | if (CC708Decoder_LastShowTime > DST_OS_GetTickCount()) CC708Decoder_LastShowTime = DST_OS_GetTickCount(); |
|---|
| 2734 | if (DST_OS_GetTickCount() - CC708Decoder_LastShowTime < DST_OS_GetTicksPerSecond()/10) |
|---|
| 2735 | { |
|---|
| 2736 | this->SetTimer(this, 2, 100); // 100ms ÈÄ¿¡ ±×¸®±â |
|---|
| 2737 | } |
|---|
| 2738 | else |
|---|
| 2739 | { |
|---|
| 2740 | this->Show(this); |
|---|
| 2741 | } |
|---|
| 2742 | break; |
|---|
| 2743 | |
|---|
| 2744 | case WM_CC_CLOSE: |
|---|
| 2745 | // T(); |
|---|
| 2746 | this->Close(this); |
|---|
| 2747 | break; |
|---|
| 2748 | } |
|---|
| 2749 | } |
|---|
| 2750 | //}; |
|---|
| 2751 | |
|---|
| 2752 | void DST_CreateCC708Win(SWinEventMsg event) |
|---|
| 2753 | { |
|---|
| 2754 | CWindow*pWin = NewCWindow(event); |
|---|
| 2755 | pWin->Destructor = CC708Decoder_Destructor; |
|---|
| 2756 | pWin->OnMessage = CC708Decoder_OnMessage; |
|---|
| 2757 | pWin->OnTimer = CC708Decoder_OnTimer; |
|---|
| 2758 | pWin->Show = CC708Decoder_Show; |
|---|
| 2759 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 2760 | CC708Decoder_Constructor(pWin, event); |
|---|
| 2761 | // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï |
|---|
| 2762 | DST_AddWin((WinID)(event.data[0]), pWin); |
|---|
| 2763 | |
|---|
| 2764 | } |
|---|