| version 1.5, 2003/11/04 19:23:03 | version 1.7, 2005/02/07 15:39:27 | 
| Line 6 | Line 6 | 
 | #include        "sysmng.h" | #include        "sysmng.h" | 
 | #include        "dialog.h" | #include        "dialog.h" | 
 | #include        "dialogs.h" | #include        "dialogs.h" | 
 | #include        "bit2res.h" |  | 
 | #include        "pccore.h" | #include        "pccore.h" | 
 |  | #include        "dipswbmp.h" | 
 |  |  | 
 |  |  | 
 | #ifdef __cplusplus | #ifdef __cplusplus | 
| Line 22  extern COMMNG cm_mpu98; | Line 22  extern COMMNG cm_mpu98; | 
 |  |  | 
 | static const char *mpuinterrupt[4] = {str_int0, str_int1, str_int2, str_int5}; | static const char *mpuinterrupt[4] = {str_int0, str_int1, str_int2, str_int5}; | 
 |  |  | 
| static  BYTE    mpu = 0; | static  UINT8   mpu = 0; | 
 |  |  | 
 |  |  | 
| static void setmpuiopara(HWND hWnd, WORD res, BYTE value) { | static void setmpuiopara(HWND hWnd, UINT16 res, UINT8 value) { | 
 |  |  | 
 | SendDlgItemMessage(hWnd, res, CB_SETCURSEL, | SendDlgItemMessage(hWnd, res, CB_SETCURSEL, | 
 | (WPARAM)((value >> 4) & 15), (LPARAM)0); | (WPARAM)((value >> 4) & 15), (LPARAM)0); | 
 | } | } | 
 |  |  | 
| static BYTE getmpuio(HWND hWnd, WORD res) { | static UINT8 getmpuio(HWND hWnd, UINT16 res) { | 
 |  |  | 
 | char    work[8]; | char    work[8]; | 
 |  |  | 
| Line 39  static BYTE getmpuio(HWND hWnd, WORD res | Line 39  static BYTE getmpuio(HWND hWnd, WORD res | 
 | return((milstr_solveHEX(work) >> 6) & 0xf0); | return((milstr_solveHEX(work) >> 6) & 0xf0); | 
 | } | } | 
 |  |  | 
| static void setmpuintpara(HWND hWnd, WORD res, BYTE value) { | static void setmpuintpara(HWND hWnd, UINT16 res, UINT8 value) { | 
 |  |  | 
 | SendDlgItemMessage(hWnd, res, CB_SETCURSEL, | SendDlgItemMessage(hWnd, res, CB_SETCURSEL, | 
 | (WPARAM)(value & 3), (LPARAM)0); | (WPARAM)(value & 3), (LPARAM)0); | 
 | } | } | 
 |  |  | 
| static BYTE getmpuint(HWND hWnd, WORD res) { | static UINT8 getmpuint(HWND hWnd, UINT16 res) { | 
 |  |  | 
 | char    work[8]; | char    work[8]; | 
| BYTE    ret; | UINT8   ret; | 
 |  |  | 
 | GetDlgItemText(hWnd, res, work, sizeof(work)); | GetDlgItemText(hWnd, res, work, sizeof(work)); | 
 | ret = work[3] - '0'; | ret = work[3] - '0'; | 
| Line 58  static BYTE getmpuint(HWND hWnd, WORD re | Line 58  static BYTE getmpuint(HWND hWnd, WORD re | 
 | return(ret); | return(ret); | 
 | } | } | 
 |  |  | 
| static void setmpujmp(HWND hWnd, BYTE value, BYTE bit) { | static void setmpujmp(HWND hWnd, UINT8 value, UINT8 bit) { | 
 |  |  | 
 | if ((mpu ^ value) & bit) { | if ((mpu ^ value) & bit) { | 
 | mpu &= ~bit; | mpu &= ~bit; | 
| Line 67  static void setmpujmp(HWND hWnd, BYTE va | Line 67  static void setmpujmp(HWND hWnd, BYTE va | 
 | } | } | 
 | } | } | 
 |  |  | 
 | static void setmpuiodip(BYTE *image, int px, int py, int align, BYTE v) { |  | 
 |  |  | 
 | int             i, j, y; |  | 
 |  |  | 
 | px *= 9; |  | 
 | px++; |  | 
 | py *= 9; |  | 
 | for (i=0; i<4; i++, px+=9, v<<=1) { |  | 
 | y = py + ((v&0x80)?5:9); |  | 
 | for (j=0; j<3; j++) { |  | 
 | dlgs_linex(image, px, y+j, 7, align, 2); |  | 
 | } |  | 
 | } |  | 
 | } |  | 
 |  |  | 
 | static void setmpuintdip(BYTE *image, int px, int py, int align, BYTE v) { |  | 
 |  |  | 
 | dlgs_setjumpery(image, px + 3 - (mpu & 3), py, align); |  | 
 | } |  | 
 |  |  | 
 |  |  | 
 | // ---- | // ---- | 
 |  |  | 
| Line 173  static void mpucmddipsw(HWND hWnd) { | Line 153  static void mpucmddipsw(HWND hWnd) { | 
 | RECT    rect2; | RECT    rect2; | 
 | POINT   p; | POINT   p; | 
 | BOOL    redraw; | BOOL    redraw; | 
| BYTE    bit; | UINT8   bit; | 
 |  |  | 
 | GetWindowRect(GetDlgItem(hWnd, IDC_MPUDIP), &rect1); | GetWindowRect(GetDlgItem(hWnd, IDC_MPUDIP), &rect1); | 
 | GetClientRect(GetDlgItem(hWnd, IDC_MPUDIP), &rect2); | GetClientRect(GetDlgItem(hWnd, IDC_MPUDIP), &rect2); | 
| Line 193  static void mpucmddipsw(HWND hWnd) { | Line 173  static void mpucmddipsw(HWND hWnd) { | 
 | redraw = TRUE; | redraw = TRUE; | 
 | } | } | 
 | else if ((p.x >= 9) && (p.x < 13)) { | else if ((p.x >= 9) && (p.x < 13)) { | 
| bit = (BYTE)(12 - p.x); | bit = (UINT8)(12 - p.x); | 
 | if ((mpu ^ bit) & 3) { | if ((mpu ^ bit) & 3) { | 
 | mpu &= ~0x3; | mpu &= ~0x3; | 
 | mpu |= bit; | mpu |= bit; | 
| Line 206  static void mpucmddipsw(HWND hWnd) { | Line 186  static void mpucmddipsw(HWND hWnd) { | 
 | } | } | 
 | } | } | 
 |  |  | 
 | static void mpudrawdipsw(HWND hWnd, HDC hdc) { |  | 
 |  |  | 
 | BITMAPINFO      *bmi; |  | 
 | HBITMAP         hbmp; |  | 
 | BYTE            *image; |  | 
 | int                     align; |  | 
 | BYTE            *imgbtm; |  | 
 | HDC                     hmdc; |  | 
 |  |  | 
 | bmi = (BITMAPINFO *)_MALLOC(bit2res_getsize(&mpudip), "bitmap"); |  | 
 | if (bmi == NULL) { |  | 
 | return; |  | 
 | } |  | 
 | bit2res_sethead(bmi, &mpudip); |  | 
 | hbmp = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, |  | 
 | (void **)&image, NULL, 0); |  | 
 | bit2res_setdata(image, &mpudip); |  | 
 | align = ((mpudip.x + 7) / 2) & ~3; |  | 
 | imgbtm = image + align * (mpudip.y - 1); |  | 
 | setmpuiodip(imgbtm, 2, 1, align, mpu); |  | 
 | setmpuintdip(imgbtm, 9, 1, align, mpu); |  | 
 | hmdc = CreateCompatibleDC(hdc); |  | 
 | SelectObject(hmdc, hbmp); |  | 
 | BitBlt(hdc, 0, 0, mpudip.x, mpudip.y, hmdc, 0, 0, SRCCOPY); |  | 
 | DeleteDC(hmdc); |  | 
 | DeleteObject(hbmp); |  | 
 | _MFREE(bmi); |  | 
 | } |  | 
 |  |  | 
 | LRESULT CALLBACK MidiDialogProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { | LRESULT CALLBACK MidiDialogProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { | 
 |  |  | 
 | switch(msg) { | switch(msg) { | 
| Line 280  LRESULT CALLBACK MidiDialogProc(HWND hWn | Line 231  LRESULT CALLBACK MidiDialogProc(HWND hWn | 
 |  |  | 
 | case WM_DRAWITEM: | case WM_DRAWITEM: | 
 | if (LOWORD(wp) == IDC_MPUDIP) { | if (LOWORD(wp) == IDC_MPUDIP) { | 
| mpudrawdipsw(hWnd, ((LPDRAWITEMSTRUCT)lp)->hDC); | dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, | 
|  | dipswbmp_getmpu(mpu)); | 
 | } | } | 
 | return(FALSE); | return(FALSE); | 
 |  |  |