int SelectRoot(void) { unsigned int key ; int ret = 0 ; SaveDisp(SAVEDISP_PAGE3) ; PopUpWin(4) ; Print_zh("1.内置闪存 ", 14, 11, 0) ; Print_zh("2.SD卡 ", 14, 25, 0) ; GetKey(&key) ; switch (key) { case KEY_CHAR_1: Fls_F = TRUE ; SDcard_F = FALSE ; break ; case KEY_CHAR_2: SDcard_F = TRUE ; Fls_F = FALSE ; break ; default: ret = 1 ; break ; } RestoreDisp(SAVEDISP_PAGE3) ; return ret ; }
void CCDecoder::DecodeCC(BYTE* buff, int len, __int64 time) { if (!m_rawfn.IsEmpty()) { if (FILE* f = _tfopen(m_rawfn, _T("at"))) { _ftprintf(f, _T("%02d:%02d:%02d.%03d\n"), (int)(time / 1000 / 60 / 60), (int)((time / 1000 / 60) % 60), (int)((time / 1000) % 60), (int)(time % 1000)); for (int i = 0; i < len; i++) { _ftprintf(f, _T("%02x"), buff[i]); if (i < len - 1) { _ftprintf(f, _T(" ")); } if (i > 0 && (i & 15) == 15) { _ftprintf(f, _T("\n")); } } if (len > 0) { _ftprintf(f, _T("\n\n")); } fclose(f); } } for (int i = 0; i < len; i++) { BYTE c = buff[i] & 0x7f; if (c >= 0x20) { static WCHAR charmap[0x60] = { ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', 0xE1, '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', 0x3F, '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', 0xE9, ']', 0xED, 0xF3, 0xFA, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 0xE7, 0xF7, 'N', 'n', 0x3F }; PutChar(charmap[c - 0x20]); } else if (buff[i] != 0x80 && i < len - 1) { // codes and special characters are supposed to be doubled if (i < len - 3 && buff[i] == buff[i + 2] && buff[i + 1] == buff[i + 3]) { i += 2; } c = buff[i + 1] & 0x7f; if (buff[i] == 0x91 && c >= 0x20 && c < 0x30) { // formating // TODO } else if (buff[i] == 0x91 && c == 0x39) { // transparent space OffsetCursor(1, 0); } else if (buff[i] == 0x91 && c >= 0x30 && c < 0x40) { // special characters static WCHAR charmap[0x10] = { 0x00ae, // (r)egistered 0x00b0, // degree 0x00bd, // 1/2 0x00bf, // inverted question mark 0x2122, // trade mark 0x00a2, // cent 0x00a3, // pound 0x266a, // music 0x00e0, // a` 0x00ff, // transparent space, handled above 0x00e8, // e` 0x00e2, // a^ 0x00ea, // e^ 0x00ee, // i^ 0x00f4, // o^ 0x00fb, // u^ }; PutChar(charmap[c - 0x30]); } else if (buff[i] == 0x92 && c >= 0x20 && c < 0x40) { // extended characters static WCHAR charmap[0x20] = { 0x00c0, // A' 0x00c9, // E' 0x00d3, // O' 0x00da, // U' 0x00dc, // U: 0x00fc, // u: 0x2018, // ` 0x00a1, // inverted ! 0x002a, // * 0x2019, // ' 0x002d, // - 0x00a9, // (c)opyright 0x2120, // SM 0x00b7, // . (dot in the middle) 0x201c, // inverted " 0x201d, // " 0x00c1, // A` 0x00c2, // A^ 0x00c7, // C, 0x00c8, // E` 0x00ca, // E^ 0x00cb, // E: 0x00eb, // e: 0x00ce, // I^ 0x00cf, // I: 0x00ef, // i: 0x00d4, // O^ 0x00d9, // U` 0x00f9, // u` 0x00db, // U^ 0x00ab, // << 0x00bb, // >> }; PutChar(charmap[c - 0x20]); } else if (buff[i] == 0x13 && c >= 0x20 && c < 0x40) { // more extended characters static WCHAR charmap[0x20] = { 0x00c3, // A~ 0x00e3, // a~ 0x00cd, // I' 0x00cc, // I` 0x00ec, // i` 0x00d2, // O` 0x00f2, // o` 0x00d5, // O~ 0x00f5, // o~ 0x007b, // { 0x007d, // } 0x005c, // /* \ */ 0x005e, // ^ 0x005f, // _ 0x00a6, // | 0x007e, // ~ 0x00c4, // A: 0x00e4, // a: 0x00d6, // O: 0x00f6, // o: 0x00df, // B (ss in german) 0x00a5, // Y= 0x00a4, // ox 0x007c, // | 0x00c5, // Ao 0x00e5, // ao 0x00d8, // O/ 0x00f8, // o/ 0x250c, // |- 0x2510, // -| 0x2514, // |_ 0x2518, // _| }; PutChar(charmap[c - 0x20]); } else if (buff[i] == 0x94 && buff[i + 1] == 0xae) { // Erase Non-displayed [buffer] Memory memset(m_buff, 0, sizeof(m_buff)); } else if (buff[i] == 0x94 && buff[i + 1] == 0x20) { // Resume Caption Loading memset(m_buff, 0, sizeof(m_buff)); } else if (buff[i] == 0x94 && buff[i + 1] == 0x2f) { // End Of Caption if (memcmp(m_disp, m_buff, sizeof(m_disp)) != 0) { if (m_fEndOfCaption) { SaveDisp(time + (i / 2) * 1000 / 30); } m_fEndOfCaption = true; memcpy(m_disp, m_buff, sizeof(m_disp)); m_time = time + (i / 2) * 1000 / 30; } } else if (buff[i] == 0x94 && buff[i + 1] == 0x2c) { // Erase Displayed Memory if (m_fEndOfCaption) { m_fEndOfCaption = false; SaveDisp(time + (i / 2) * 1000 / 30); } memset(m_disp, 0, sizeof(m_disp)); } else if (buff[i] == 0x97 && (buff[i + 1] == 0xa1 || buff[i + 1] == 0xa2 || buff[i + 1] == 0x23)) { // Tab Over OffsetCursor(buff[i + 1] & 3, 0); } else if (buff[i] == 0x91 || buff[i] == 0x92 || buff[i] == 0x15 || buff[i] == 0x16 || buff[i] == 0x97 || buff[i] == 0x10 || buff[i] == 0x13 || buff[i] == 0x94) { // curpos, color, underline int row = 0; switch (buff[i]) { default: case 0x91: row = 0; break; case 0x92: row = 2; break; case 0x15: row = 4; break; case 0x16: row = 6; break; case 0x97: row = 8; break; case 0x10: row = 10; break; case 0x13: row = 12; break; case 0x94: row = 14; break; } if (buff[i + 1] & 0x20) { row++; } int col = buff[i + 1] & 0xe; if (col == 0 || (col > 0 && !(buff[i + 1] & 0x10))) { col = 0; } else { col <<= 1; } MoveCursor(col, row); } else { int iiii = 0; } i++; } } }
int Suidao_DM(void) { int display = 0; double sd_pj = 0.0 ; /* 测点与中线的距离 */ double sd_gc = 0.0 ; /* 测点与设计线的高差 */ unsigned int key = 0 ; unsigned int back_key ; BYTE exit_flag = FALSE; BYTE xyrow = 0 ; int shuaxin = TRUE; /* 刷新 */ while (exit_flag != TRUE) { switch(key) { case KEY_CTRL_F1: default: if (key == KEY_CTRL_F1) shuaxin == TRUE; if (shuaxin){ Bdisp_AllClr_DDVRAM() ; Print_zh("隧道断面 ", 0, 1, VERT_REV) ; PrintIcon (0,"Home",0); PrintIcon (1,"Set",0); PrintIcon (2,"SQX",0); PrintIcon (3,"DM",0); (R_L > 0) ? PrintIcon (4,"YOU",0) : PrintIcon (4,"ZUO",1); PrintIcon (5,"Help",0); shuaxin = FALSE; } back_key = key ; Bdisp_AreaClr_DDVRAM(&clear_area) ; Print_zh("X坐标 ", 20, 6, 0) ; Print_zh("Y坐标 ", 20, 22, 0) ; Print_zh("Z坐标 ", 20, 38, 0) ; if (xyrow > 2) { if (!sd_flag) { Warning("未载入断面 ",2); //exit_flag = TRUE ; //强制退出以解决卡在载入数据界面的问题 fix by 龙之冰点 xyrow = 0; /* 把焦点设置在TOP */ key = KEY_CTRL_F4; break ; } xyrow = 0 ; x = sd_x ; y = sd_y ; SaveDisp(SAVEDISP_PAGE2) ; if (InputStake(FS_NOPOPUP) == FSOK){ number = fs_zh ; if (!GC_JS(number)) break ; RestoreDisp(SAVEDISP_PAGE2) ; Bdisp_AreaClr_DDVRAM(&clear_area) ; sd_gc = sd_z - DesignGC; if (!yanxin(fs_pj, sd_gc)){ Warning("断面计算失败 ",2); key == KEY_CTRL_F1; break ; } Print_zh("桩号K ", 20, 0, 0) ; Print_zh("偏距D ", 20, 13, 0) ; Print_zh("高差H ", 20, 26, 0) ; if (sd_cqw < 0) Print_zh("欠挖W ", 20, 39, 0) ; else Print_zh("超挖T ", 20, 39, 0) ; Print_C(120, 4, CA = fs_zh, 3) ; Print_C(120, 17, CA = fs_pj, 3) ; Print_C(120, 30, CA = sd_gc, 3) ; Print_C(120, 43, CA = sd_cqw, 3) ; key = 0 ; while(key != KEY_CTRL_EXE && key != KEY_CTRL_EXIT) GetKey(&key) ; key = KEY_CTRL_F1 ; break ; } RestoreDisp(SAVEDISP_PAGE2) ; } Print_C(112, 10, CA = sd_x, 3) ; Print_C(112, 26, CA = sd_y, 3) ; Print_C(112, 42, CA = sd_z, 3) ; key = InputVal(59, 8+xyrow*16) ; switch (xyrow) { case 0: sd_x = number ? number : sd_x ; break ; case 1: sd_y = number ? number : sd_y; break ; case 2: sd_z = number ? number : sd_z; break ; default: break ; } if (key >= KEY_CTRL_F1 && key <= KEY_CTRL_F6) xyrow = 0 ; break ; case KEY_CTRL_F2: back_key = key ; Bdisp_AreaClr_DDVRAM(&clear_area) ; Print_zh("修正H ", 20, 6, 0) ; Print_zh("修正D ", 20, 22, 0) ; Print_zh("修正R ", 20, 38, 0) ; if (xyrow > 2) { /* 返回上一个菜单 */ key = KEY_CTRL_F1 ; xyrow = 0 ; break ; } Print_C(112, 10, CA = sd_h, 3) ; Print_C(112, 26, CA = sd_d, 3) ; Print_C(112, 42, CA = sd_r, 3) ; key = InputValP(59, 8+xyrow*16) ; switch (xyrow) { case 0: sd_h = number ? number : sd_h ; break ; case 1: sd_d = number ? number : sd_d ;break ; case 2: sd_r = number ? number : sd_r ; break ; default: break ; } if (key >= KEY_CTRL_F1 && key <= KEY_CTRL_F6) xyrow = 0 ; break ; case KEY_CTRL_F3: SaveDisp(SAVEDISP_PAGE2) ; if (sqx_flag == TRUE) { if ( InputSQstake() == TRUE) { if (InputSQpj() == TRUE) { /* 输入偏距 */ DesignGC = Cut_3(DesignGC) ; PopUpWin(3); locatestr(12,22) ; printf("高程:%.3f",DesignGC ) ; GetKey(&key); } } } else DebugS("未载入竖曲线 ") ; key = back_key ; RestoreDisp(SAVEDISP_PAGE2) ; break ; case KEY_CTRL_F4: sd_flag = load_SD_data(sd_flag) ; key = KEY_CTRL_F1 ; shuaxin = TRUE; break ; case KEY_CTRL_F5: if (R_L == -1){ R_L = 1; Warning("应用在右幅 ",2); } else{ R_L = -1; Warning("应用在左幅 ",2); } key = KEY_CTRL_F1 ; shuaxin = TRUE; break ; case KEY_CTRL_F6: Bdisp_AllClr_DDVRAM() ; Print_zh("Home=刷新页面 ", 1, 2, 0) ; Print_zh("Set =断面数据修正 ", 1, 16, 0) ; Print_zh("SQX =竖曲线高程 ", 1, 30, 0) ; Print_zh("DM =选择断面文件 ", 1, 44, 0) ; GetKey(&key); Bdisp_AllClr_DDVRAM() ; Print_zh("ZUO =应用在左幅 ", 1, 2, 0) ; Print_zh("YOU =应用在右幅 ", 1, 16, 0) ; Print_zh("修正H=改变圆心高差 ", 1, 30, 0) ; Print_zh(" (+上移 -下移)", 1, 44, 0) ; GetKey(&key); Bdisp_AllClr_DDVRAM() ; Print_zh("修正D=改变圆心偏距 ", 1, 2, 0) ; Print_zh(" (+右移 -左移) ", 1, 16, 0) ; Print_zh("修正R=改变设计半径 ", 1, 30, 0) ; Print_zh(" (+变长 -变短)", 1, 44, 0) ; GetKey(&key); key = KEY_CTRL_F1 ; shuaxin = TRUE; break ; case KEY_CTRL_UP: if (xyrow > 0) --xyrow ; key = back_key ; break ; case KEY_CTRL_DOWN: case KEY_CTRL_EXE: ++xyrow ; key = back_key ; break ; case KEY_CTRL_DEL: key = back_key ; break ; case KEY_CTRL_EXIT : exit_flag = TRUE ; break ; } } return ; }
int computeFS () { uint refresh = 2,key; int index = 0,i,hcs; char ch; double ht,hz,v,bh,hd; double value[4] = {0.0,0.0,0.0,0.0}; const char * context[] = {"","","",""}; while(1){ if (refresh == REFRESH_ALL){ refresh = REFRESH_PART; Bdisp_AllClr_VRAM(); SetMyFont(&stHz12x12,&stAsc6x12); //¶¨Òå×ÖÌå´óС DispStr(2,1, "Ïß "); DispStr(2,12,"· "); DispStr(2,25,"·´ "); DispStr(2,38,"Ëã "); ShowTitle(TITLE); DispStr(17,0, "×ø±êX: "); DispStr(17,13,"×ø±êY: "); DispStr(17,26,"×ø±êZ: "); //DispStr(17,39,"×ø±êZ: "); for (i=0;i<4;++i){ PrintXY(50,2+i*12,(uchar*)context[i],0); } PrintIcon (0,"Rou",0); PrintIcon (1,"Set",0); PrintIcon (2,"Disp",0); PrintIcon (3,"=0=",1); PrintIcon (4,"Save",1); PrintIcon (5,"?",0); } if (refresh == REFRESH_PART){ for (i=0;i<4;++i){ PrintFloat(value[i],48,0+i*12,index==i,4); //ÊäÈë¿òλÖà } refresh = 0; } GetKey(&key); switch(key){ case KEY_CTRL_F1 : SET(); refresh=REFRESH_ALL; break; case KEY_CTRL_F2 : ZSSET(); refresh=REFRESH_ALL; break; case KEY_CTRL_F3 : RestoreDisp(SAVEDISP_PAGE1);refresh=REFRESH_ALL;WaitKey();break; case KEY_CTRL_F4 : case KEY_CTRL_F5 : Nodata(); refresh=REFRESH_ALL; break; case KEY_CTRL_F6 : About(); refresh=REFRESH_ALL; break; case KEY_CTRL_UP : refresh=REFRESH_PART; --index; break; case KEY_CTRL_DOWN : refresh=REFRESH_PART; ++index; break; case KEY_CTRL_EXE: if (index<3){ refresh = REFRESH_PART; index++; }else{ yscs.x1 = value[0]; yscs.y1 = value[1]; hz = value[2]; ht = value[3]; refresh=REFRESH_ALL; //yscs.k=0.0; yscs.k=xy_to_sdSrd( yscs.x1, yscs.y1, 0); yscs.d=xy_to_sdSrd( yscs.x1, yscs.y1, 1); //yscs.k=xy_to_sd( yscs.x1, yscs.y1, 0); //yscs.d=xy_to_sd( yscs.x1, yscs.y1, 1); //FS(); GC(); HP(); if (yscs.d<0) hcs=-1; //Æ«¾à×ó²à if (yscs.d>=0) hcs=1; //Æ«¾àÓÒ²à if (yscs.d*hcs<=zfset.zsp) hd=0; // if (zfset.zsh==0) hd=0; if (yscs.d*hcs>zfset.zsp && yscs.d*hcs-zfset.zsp<zfset.zsh) hd=(yscs.d*hcs-zfset.zsp)*hcs; if (yscs.d*hcs-zfset.zsp>=zfset.zsh) hd=zfset.zsh*hcs; bh=yscs.gch+(yscs.hpd*hd)-ht; Bdisp_AllClr_VRAM(); DispStr(2,0, "¼Æ "); DispStr(2,12,"Ëã "); DispStr(2,26,"½á "); DispStr(2,39,"¹û "); ShowTitle(TITLE); DispStr(17,0,"×®ºÅ "); DispStr(17,13,"Æ«¾à "); DispStr(17,26,"ÌîÍÚ: "); DispStr(17,39,"»ù¸ß: "); PrintfXY (48,2.5,0,"%.4f",yscs.k); PrintfXY (48,15,0,"%.4f",yscs.d); PrintfXY (48,28,0,"%.4f",yscs.gch); PrintfXY (48,42,0,"%.4f",yscs.hpd); //PrintfXY (22,40,0," H= %.3f",bh); //PrintfXY (22,48,0," H-Z= %.3f",hz-bh); SaveDisp(SAVEDISP_PAGE1); WaitKey(); ++index; }break; case KEY_CTRL_EXIT: return 0; default: if ((ch=GetPressNumChar(key))!=0){ char buf[14]; int r; refresh = REFRESH_PART; buf[0] = ch; buf[1] = '\0'; r = InputString (48,0+index*12,buf,0,12); //ÊäÈë¿òλÖà if (r != KEY_CTRL_EXIT){ value[index] = atof(buf); if (r==KEY_CTRL_DOWN) ++index; if (r==KEY_CTRL_UP) --index; if (r==KEY_CTRL_EXE && index<3) ++index; } break; } } if (index >=4) index = 2; if (index < 0) index = 3; } }