|
|
| version 1.5, 2003/10/29 21:35:58 | version 1.8, 2003/10/30 16:54:04 |
|---|---|
| Line 24 enum { | Line 24 enum { |
| IDC_TOOLFDD2LIST, | IDC_TOOLFDD2LIST, |
| IDC_TOOLFDD2BROWSE, | IDC_TOOLFDD2BROWSE, |
| IDC_TOOLFDD2EJECT, | IDC_TOOLFDD2EJECT, |
| IDC_TOOLRESET, | |
| IDC_TOOLPOWER, | |
| IDC_MAXITEMS, | IDC_MAXITEMS, |
| IDC_BASE = 3000, | IDC_BASE = 3000, |
| Line 33 enum { | Line 35 enum { |
| IDC_TOOLCLOSE = 3102 | IDC_TOOLCLOSE = 3102 |
| }; | }; |
| enum { | |
| TCTL_STATIC = 0, | |
| TCTL_BUTTON = 1, | |
| TCTL_DDLIST = 2 | |
| }; | |
| typedef struct { | typedef struct { |
| char main[MAX_PATH]; | char main[MAX_PATH]; |
| char font[64]; | char font[64]; |
| Line 42 typedef struct { | Line 50 typedef struct { |
| } TOOLSKIN; | } TOOLSKIN; |
| typedef struct { | typedef struct { |
| const char *cname; | UINT tctl; |
| const char *text; | const char *text; |
| DWORD style; | |
| short posx; | short posx; |
| short posy; | short posy; |
| short width; | short width; |
| short height; | short height; |
| BOOL tabstop; | short extend; |
| short padding; | |
| } SUBITEM; | } SUBITEM; |
| typedef struct { | typedef struct { |
| Line 73 typedef struct { | Line 81 typedef struct { |
| SUBCLASSPROC subproc[IDC_MAXITEMS]; | SUBCLASSPROC subproc[IDC_MAXITEMS]; |
| } TOOLWIN; | } TOOLWIN; |
| enum { | |
| GTWL_FOCUS = 0, | |
| GTWL_SIZE = 4 | |
| }; | |
| NP2TOOL np2tool; | NP2TOOL np2tool; |
| static TOOLSKIN toolskin; | static TOOLSKIN toolskin; |
| Line 233 static void sellist(UINT drv) { | Line 245 static void sellist(UINT drv) { |
| } | } |
| } | } |
| static void remakefddlist(UINT drv) { | static void remakefddlist(HWND hwnd, TOOLFDD *fdd) { |
| TOOLFDD *fdd; | |
| char *p; | char *p; |
| UINT cnt; | UINT cnt; |
| char *q; | char *q; |
| Line 244 static void remakefddlist(UINT drv) { | Line 255 static void remakefddlist(UINT drv) { |
| UINT j; | UINT j; |
| UINT sel; | UINT sel; |
| if (drv >= FDDLIST_DRV) { | |
| return; | |
| } | |
| fdd = np2tool.fdd + drv; | |
| p = fdd->name[0]; | p = fdd->name[0]; |
| for (cnt=0; cnt<FDDLIST_MAX; cnt++) { | for (cnt=0; cnt<FDDLIST_MAX; cnt++) { |
| if (p[0] == '\0') { | if (p[0] == '\0') { |
| Line 276 static void remakefddlist(UINT drv) { | Line 283 static void remakefddlist(UINT drv) { |
| } | } |
| } | } |
| } | } |
| setlist(toolwin.sub[fddlist[drv]], fdd, sel); | setlist(hwnd, fdd, sel); |
| } | } |
| static void accdraw(HWND hWnd, BYTE count) { | static void accdraw(HWND hWnd, BYTE count) { |
| Line 302 static LRESULT CALLBACK twsub(HWND hWnd, | Line 309 static LRESULT CALLBACK twsub(HWND hWnd, |
| int files; | int files; |
| char fname[MAX_PATH]; | char fname[MAX_PATH]; |
| for (idc=0; idc<IDC_MAXITEMS; idc++) { | idc = GetWindowLong(hWnd, GWL_ID) - IDC_BASE; |
| if (toolwin.sub[idc] == hWnd) { | |
| break; | |
| } | |
| } | |
| if (idc >= IDC_MAXITEMS) { | if (idc >= IDC_MAXITEMS) { |
| return(0); | return(0); |
| } | } |
| Line 319 static LRESULT CALLBACK twsub(HWND hWnd, | Line 322 static LRESULT CALLBACK twsub(HWND hWnd, |
| if (newidc >= IDC_MAXITEMS) { | if (newidc >= IDC_MAXITEMS) { |
| newidc = (dir >= 0)?0:(IDC_MAXITEMS - 1); | newidc = (dir >= 0)?0:(IDC_MAXITEMS - 1); |
| } | } |
| if (subitem[newidc].tabstop) { | if ((toolwin.sub[newidc] != NULL) && |
| (subitem[newidc].tctl != TCTL_STATIC)) { | |
| SetFocus(toolwin.sub[newidc]); | SetFocus(toolwin.sub[newidc]); |
| break; | break; |
| } | } |
| } while(idc != newidc); | } while(idc != newidc); |
| } | } |
| else if ((TCHAR)wp == VK_RETURN) { | else if ((TCHAR)wp == VK_RETURN) { |
| if (subitem[idc].cname == str_button) { | if (subitem[idc].tctl == TCTL_BUTTON) { |
| return(CallWindowProc(toolwin.subproc[idc], | return(CallWindowProc(toolwin.subproc[idc], |
| hWnd, WM_KEYDOWN, VK_SPACE, 0)); | hWnd, WM_KEYDOWN, VK_SPACE, 0)); |
| } | } |
| Line 362 static LRESULT CALLBACK twsub(HWND hWnd, | Line 366 static LRESULT CALLBACK twsub(HWND hWnd, |
| return(FALSE); | return(FALSE); |
| } | } |
| } | } |
| else if (msg == WM_SETFOCUS) { | |
| SetWindowLong(GetParent(hWnd), GTWL_FOCUS, idc); | |
| } | |
| return(CallWindowProc(toolwin.subproc[idc], hWnd, msg, wp, lp)); | return(CallWindowProc(toolwin.subproc[idc], hWnd, msg, wp, lp)); |
| } | } |
| Line 371 static void toolwincreate(HWND hWnd) { | Line 378 static void toolwincreate(HWND hWnd) { |
| const SUBITEM *p; | const SUBITEM *p; |
| UINT i; | UINT i; |
| HWND sub; | HWND sub; |
| const char *cls; | |
| DWORD style; | |
| toolwin.hfont = CreateFont(toolskin.fontsize, 0, 0, 0, 0, 0, 0, 0, | toolwin.hfont = CreateFont(toolskin.fontsize, 0, 0, 0, 0, 0, 0, 0, |
| SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, | SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, |
| Line 385 const SUBITEM *p; | Line 394 const SUBITEM *p; |
| p = subitem; | p = subitem; |
| for (i=0; i<IDC_MAXITEMS; i++) { | for (i=0; i<IDC_MAXITEMS; i++) { |
| sub = CreateWindow(p->cname, p->text, | sub = NULL; |
| WS_CHILD | p->style, p->posx, p->posy, p->width, p->height, | cls = NULL; |
| hWnd, (HMENU)(i + IDC_BASE), hInst, NULL); | switch(p->tctl) { |
| case TCTL_STATIC: | |
| cls = str_static; | |
| style = 0; | |
| break; | |
| case TCTL_BUTTON: | |
| if (p->extend == 0) { | |
| cls = str_button; | |
| style = BS_PUSHBUTTON; | |
| } | |
| else if (p->extend == 1) { | |
| cls = str_button; | |
| style = BS_OWNERDRAW; | |
| } | |
| break; | |
| case TCTL_DDLIST: | |
| cls = str_combobox; | |
| style = CBS_DROPDOWNLIST | WS_VSCROLL; | |
| break; | |
| } | |
| if ((cls) && (p->width > 0) && (p->height > 0)) { | |
| sub = CreateWindow(cls, p->text, WS_CHILD | WS_VISIBLE | style, | |
| p->posx, p->posy, p->width, p->height, | |
| hWnd, (HMENU)(i + IDC_BASE), hInst, NULL); | |
| } | |
| toolwin.sub[i] = sub; | toolwin.sub[i] = sub; |
| toolwin.subproc[i] = (SUBCLASSPROC)GetWindowLong(sub, GWL_WNDPROC); | toolwin.subproc[i] = NULL; |
| SetWindowLong(sub, GWL_WNDPROC, (LONG)twsub); | if (sub) { |
| SendMessage(sub, WM_SETFONT, (WPARAM)toolwin.hfont, | toolwin.subproc[i] = (SUBCLASSPROC)GetWindowLong(sub, GWL_WNDPROC); |
| SetWindowLong(sub, GWL_WNDPROC, (LONG)twsub); | |
| SendMessage(sub, WM_SETFONT, (WPARAM)toolwin.hfont, | |
| MAKELPARAM(TRUE, 0)); | MAKELPARAM(TRUE, 0)); |
| } | |
| p++; | p++; |
| } | } |
| for (i=0; i<FDDLIST_DRV; i++) { | for (i=0; i<FDDLIST_DRV; i++) { |
| DragAcceptFiles(toolwin.sub[fddlist[i]], TRUE); | sub = toolwin.sub[fddlist[i]]; |
| remakefddlist((BYTE)i); | if (sub) { |
| DragAcceptFiles(sub, TRUE); | |
| remakefddlist(sub, np2tool.fdd + i); | |
| } | |
| } | } |
| for (i=0; i<IDC_MAXITEMS; i++) { | |
| if ((toolwin.sub[i]) && (subitem[i].tctl != TCTL_STATIC)) { | |
| break; | |
| } | |
| } | |
| SetWindowLong(hWnd, GTWL_FOCUS, i); | |
| } | } |
| static void toolwindestroy(void) { | static void toolwindestroy(void) { |
| UINT i; | UINT i; |
| HWND sub; | |
| if (toolwin.hbmp) { | if (toolwin.hbmp) { |
| for (i=0; i<IDC_MAXITEMS; i++) { | for (i=0; i<IDC_MAXITEMS; i++) { |
| DestroyWindow(toolwin.sub[i]); | sub = toolwin.sub[i]; |
| if (sub) { | |
| DestroyWindow(sub); | |
| } | |
| } | } |
| DeleteObject(toolwin.access[0]); | DeleteObject(toolwin.access[0]); |
| DeleteObject(toolwin.access[1]); | DeleteObject(toolwin.access[1]); |
| Line 436 static void toolwinpaint(HWND hWnd) { | Line 487 static void toolwinpaint(HWND hWnd) { |
| EndPaint(hWnd, &ps); | EndPaint(hWnd, &ps); |
| } | } |
| static void tooldrawbutton(HWND hWnd, HDC hdc, UINT idc) { | |
| POINT pt; | |
| HWND sub; | |
| RECT rect; | |
| int cx; | |
| int cy; | |
| HDC hmdc; | |
| HBRUSH hbrush; | |
| idc -= IDC_BASE; | |
| if (idc >= IDC_MAXITEMS) { | |
| return; | |
| } | |
| pt.x = 0; | |
| pt.y = 0; | |
| ClientToScreen(hWnd, &pt); | |
| sub = toolwin.sub[idc]; | |
| GetWindowRect(sub, &rect); | |
| cx = rect.right - rect.left; | |
| cy = rect.bottom - rect.top; | |
| if (toolwin.hbmp) { | |
| hmdc = CreateCompatibleDC(hdc); | |
| SelectObject(hmdc, toolwin.hbmp); | |
| BitBlt(hdc, 0, 0, cx, cy, | |
| hmdc, rect.left - pt.x, rect.top - pt.y, SRCCOPY); | |
| DeleteDC(hmdc); | |
| if (GetFocus() == sub) { | |
| hbrush = (HBRUSH)SelectObject(hdc, GetStockObject(WHITE_BRUSH)); | |
| PatBlt(hdc, 0, 0, cx, 1, PATINVERT); | |
| PatBlt(hdc, 0, 0, 1, cy, PATINVERT); | |
| PatBlt(hdc, cx - 1, 0, cx, cy, PATINVERT); | |
| PatBlt(hdc, 0, cy - 1, cx, cy, PATINVERT); | |
| SelectObject(hdc, hbrush); | |
| } | |
| } | |
| } | |
| static void changeskin(HWND hWnd) { | static void changeskin(HWND hWnd) { |
| HBITMAP hbmp; | HBITMAP hbmp; |
| Line 492 static void movingproc(RECT *rect) { | Line 581 static void movingproc(RECT *rect) { |
| return; | return; |
| } | } |
| changes = FALSE; | if (toolwin.winflg & 0x03) { |
| do { | toolwin.wingx += rect->left - toolwin.wintx; |
| if (toolwin.winflg & 1) { | rect->left = toolwin.wintx; |
| toolwin.wingx += rect->left - toolwin.wintx; | if ((toolwin.wingx >= SNAPDOTREL) || (toolwin.wingx <= -SNAPDOTREL)) { |
| rect->left = toolwin.wintx; | toolwin.winflg &= ~0x03; |
| rect->left += toolwin.wingx; | |
| toolwin.wingx = 0; | |
| } | } |
| else { | rect->right = rect->left + winlx; |
| d = SNAPDOTPULL; | } |
| if (toolwin.winflg & 0x0c) { | |
| toolwin.wingy += rect->top - toolwin.winty; | |
| rect->top = toolwin.winty; | |
| if ((toolwin.wingy >= SNAPDOTREL) || (toolwin.wingy <= -SNAPDOTREL)) { | |
| toolwin.winflg &= ~0x0c; | |
| rect->top += toolwin.wingy; | |
| toolwin.wingy = 0; | |
| } | |
| rect->bottom = rect->top + winly; | |
| } | |
| connectx = ((rect->right >= mainrc.left) && (rect->left <= mainrc.right)); | |
| connecty = ((rect->bottom >= mainrc.top) && (rect->top <= mainrc.bottom)); | |
| if ((!connectx) || (!connecty)) { | |
| if (toolwin.winflg & 0x01) { | |
| toolwin.winflg &= ~0x01; | |
| rect->left += toolwin.wingx; | |
| rect->right = rect->left + winlx; | |
| toolwin.wingx = 0; | |
| } | |
| if (toolwin.winflg & 0x04) { | |
| toolwin.winflg &= ~0x04; | |
| rect->top += toolwin.wingy; | |
| rect->bottom = rect->top + winly; | |
| toolwin.wingy = 0; | |
| } | |
| } | |
| do { | |
| changes = FALSE; | |
| if ((!(toolwin.winflg & 0x01)) && | |
| (rect->bottom >= mainrc.top) && (rect->top <= mainrc.bottom)) { | |
| do { | do { |
| connecty = ((rect->bottom >= mainrc.top) && | d = rect->left - mainrc.right; |
| (rect->top <= mainrc.bottom)); | if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { |
| if (connecty) { | break; |
| d = rect->left - mainrc.right; | } |
| d = rect->right - mainrc.left; | |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | |
| break; | |
| } | |
| if ((rect->bottom == mainrc.top) || | |
| (rect->top == mainrc.bottom)) { | |
| d = rect->left - mainrc.left; | |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { |
| break; | break; |
| } | } |
| d = rect->right - mainrc.left; | d = rect->right - mainrc.right; |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { |
| break; | break; |
| } | } |
| if ((rect->bottom == mainrc.top) || | |
| (rect->top == mainrc.bottom)) { | |
| d = rect->left - mainrc.left; | |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | |
| break; | |
| } | |
| d = rect->right - mainrc.right; | |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | |
| break; | |
| } | |
| } | |
| } | } |
| } while(0); | |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | |
| toolwin.winflg |= 0x01; | |
| rect->left -= d; | |
| rect->right = rect->left + winlx; | |
| toolwin.wingx = d; | |
| toolwin.wintx = rect->left; | |
| changes = TRUE; | |
| } | |
| } | |
| if (!(toolwin.winflg & 0x03)) { | |
| do { | |
| d = rect->left - workrc.left; | d = rect->left - workrc.left; |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { |
| break; | break; |
| Line 534 static void movingproc(RECT *rect) { | Line 665 static void movingproc(RECT *rect) { |
| } | } |
| } while(0); | } while(0); |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { |
| toolwin.winflg |= 1; | toolwin.winflg |= 0x02; |
| rect->left -= d; | rect->left -= d; |
| rect->right = rect->left + winlx; | |
| toolwin.wingx = d; | toolwin.wingx = d; |
| toolwin.wintx = rect->left; | toolwin.wintx = rect->left; |
| changes = TRUE; | |
| } | } |
| } | } |
| if ((toolwin.wingx >= SNAPDOTREL) || (toolwin.wingx <= -SNAPDOTREL)) { | |
| toolwin.winflg &= ~1; | |
| rect->left += toolwin.wingx; | |
| toolwin.wingx = 0; | |
| } | |
| rect->right = rect->left + winlx; | |
| if (changes) { | if ((!(toolwin.winflg & 0x04)) && |
| break; | (rect->right >= mainrc.left) && (rect->left <= mainrc.right)) { |
| } | |
| if (toolwin.winflg & 2) { | |
| toolwin.wingy += rect->top - toolwin.winty; | |
| rect->top = toolwin.winty; | |
| } | |
| else { | |
| d = SNAPDOTPULL; | |
| do { | do { |
| connectx = ((rect->right >= mainrc.left) && | d = rect->top - mainrc.bottom; |
| (rect->left <= mainrc.right)); | if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { |
| if (connectx) { | break; |
| d = rect->top - mainrc.bottom; | } |
| d = rect->bottom - mainrc.top; | |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | |
| break; | |
| } | |
| if ((rect->right == mainrc.left) || | |
| (rect->left == mainrc.right)) { | |
| d = rect->top - mainrc.top; | |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { |
| break; | break; |
| } | } |
| d = rect->bottom - mainrc.top; | d = rect->bottom - mainrc.bottom; |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { |
| break; | break; |
| } | } |
| if ((rect->right == mainrc.left) || | |
| (rect->left == mainrc.right)) { | |
| d = rect->top - mainrc.top; | |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | |
| break; | |
| } | |
| d = rect->bottom - mainrc.bottom; | |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | |
| break; | |
| } | |
| } | |
| } | } |
| } while(0); | |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | |
| toolwin.winflg |= 0x04; | |
| rect->top -= d; | |
| rect->bottom = rect->top + winly; | |
| toolwin.wingy = d; | |
| toolwin.winty = rect->top; | |
| changes = TRUE; | |
| } | |
| } | |
| if (!(toolwin.winflg & 0x0c)) { | |
| do { | |
| d = rect->top - workrc.top; | d = rect->top - workrc.top; |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { |
| break; | break; |
| Line 591 static void movingproc(RECT *rect) { | Line 718 static void movingproc(RECT *rect) { |
| } | } |
| } while(0); | } while(0); |
| if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { | if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { |
| toolwin.winflg |= 2; | toolwin.winflg |= 0x08; |
| rect->top -= d; | rect->top -= d; |
| rect->bottom = rect->top + winly; | |
| toolwin.wingy = d; | toolwin.wingy = d; |
| toolwin.winty = rect->top; | toolwin.winty = rect->top; |
| changes = TRUE; | changes = TRUE; |
| } | } |
| } | } |
| if ((toolwin.wingy >= SNAPDOTREL) || (toolwin.wingy <= -SNAPDOTREL)) { | |
| toolwin.winflg &= ~2; | |
| rect->top += toolwin.wingy; | |
| toolwin.wingy = 0; | |
| changes = TRUE; | |
| } | |
| rect->bottom = rect->top + winly; | |
| } while(changes); | } while(changes); |
| connectx = ((rect->right >= mainrc.left) && (rect->left <= mainrc.right)); | |
| connecty = ((rect->bottom >= mainrc.top) && (rect->top <= mainrc.bottom)); | |
| if ((toolwin.winflg & 3) && ((!connectx) || (!connecty))) { | |
| toolwin.winflg &= ~3; | |
| rect->left += toolwin.wingx; | |
| rect->top += toolwin.wingy; | |
| rect->right = rect->left + winlx; | |
| rect->bottom = rect->top + winly; | |
| toolwin.wingx = 0; | |
| toolwin.wingy = 0; | |
| } | |
| } | } |
| Line 643 static void open_popup(HWND hWnd, LPARAM | Line 752 static void open_popup(HWND hWnd, LPARAM |
| static LRESULT CALLBACK twproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { | static LRESULT CALLBACK twproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { |
| BOOL r; | BOOL r; |
| UINT idc; | |
| switch(msg) { | switch(msg) { |
| case WM_CREATE: | case WM_CREATE: |
| Line 662 static LRESULT CALLBACK twproc(HWND hWnd | Line 772 static LRESULT CALLBACK twproc(HWND hWnd |
| break; | break; |
| case IDC_SKINSEL: | case IDC_SKINSEL: |
| soundmng_stop(); | soundmng_disable(SNDPROC_TOOL); |
| r = dlgs_selectfile(hWnd, &skinui, np2tool.skin, | r = dlgs_selectfile(hWnd, &skinui, np2tool.skin, |
| sizeof(np2tool.skin), NULL); | sizeof(np2tool.skin), NULL); |
| soundmng_play(); | soundmng_enable(SNDPROC_TOOL); |
| if (r) { | if (r) { |
| changeskin(hWnd); | changeskin(hWnd); |
| sysmng_update(SYS_UPDATEOSCFG); | sysmng_update(SYS_UPDATEOSCFG); |
| Line 686 static LRESULT CALLBACK twproc(HWND hWnd | Line 796 static LRESULT CALLBACK twproc(HWND hWnd |
| break; | break; |
| case IDC_BASE + IDC_TOOLFDD1BROWSE: | case IDC_BASE + IDC_TOOLFDD1BROWSE: |
| soundmng_stop(); | soundmng_disable(SNDPROC_TOOL); |
| dialog_changefdd(hWnd, 0); | dialog_changefdd(hWnd, 0); |
| soundmng_play(); | soundmng_enable(SNDPROC_TOOL); |
| break; | break; |
| case IDC_BASE + IDC_TOOLFDD1EJECT: | case IDC_BASE + IDC_TOOLFDD1EJECT: |
| Line 703 static LRESULT CALLBACK twproc(HWND hWnd | Line 813 static LRESULT CALLBACK twproc(HWND hWnd |
| break; | break; |
| case IDC_BASE + IDC_TOOLFDD2BROWSE: | case IDC_BASE + IDC_TOOLFDD2BROWSE: |
| soundmng_stop(); | soundmng_disable(SNDPROC_TOOL); |
| dialog_changefdd(hWnd, 1); | dialog_changefdd(hWnd, 1); |
| soundmng_play(); | soundmng_enable(SNDPROC_TOOL); |
| break; | break; |
| case IDC_BASE + IDC_TOOLFDD2EJECT: | case IDC_BASE + IDC_TOOLFDD2EJECT: |
| Line 713 static LRESULT CALLBACK twproc(HWND hWnd | Line 823 static LRESULT CALLBACK twproc(HWND hWnd |
| toolwin_setfdd(1, NULL); | toolwin_setfdd(1, NULL); |
| break; | break; |
| case IDC_BASE + IDC_TOOLRESET: | |
| SendMessage(hWndMain, WM_COMMAND, IDM_RESET, 0); | |
| break; | |
| case IDC_BASE + IDC_TOOLPOWER: | |
| SendMessage(hWndMain, WM_CLOSE, 0, 0L); | |
| break; | |
| case IDC_SKINDEF: | case IDC_SKINDEF: |
| case IDC_SKINSEL: | case IDC_SKINSEL: |
| SendMessage(hWnd, WM_SYSCOMMAND, wp, lp); | SendMessage(hWnd, WM_SYSCOMMAND, wp, lp); |
| Line 724 static LRESULT CALLBACK twproc(HWND hWnd | Line 842 static LRESULT CALLBACK twproc(HWND hWnd |
| } | } |
| break; | break; |
| case WM_KEYDOWN: // TABを押した時に復帰 | |
| if ((TCHAR)wp == VK_TAB) { | |
| idc = GetWindowLong(hWnd, GTWL_FOCUS); | |
| if (idc < IDC_MAXITEMS) { | |
| SetFocus(toolwin.sub[idc]); | |
| } | |
| return(0); | |
| } | |
| else if ((TCHAR)wp == VK_ESCAPE) { | |
| return(0); | |
| } | |
| break; | |
| case WM_PAINT: | case WM_PAINT: |
| toolwinpaint(hWnd); | toolwinpaint(hWnd); |
| break; | break; |
| case WM_DRAWITEM: | |
| tooldrawbutton(hWnd, ((LPDRAWITEMSTRUCT)lp)->hDC, wp); | |
| break; | |
| case WM_ENTERMENULOOP: | case WM_ENTERMENULOOP: |
| soundmng_stop(); | soundmng_disable(SNDPROC_TOOL); |
| break; | break; |
| case WM_EXITMENULOOP: | case WM_EXITMENULOOP: |
| soundmng_play(); | soundmng_enable(SNDPROC_TOOL); |
| break; | break; |
| case WM_ENTERSIZEMOVE: | case WM_ENTERSIZEMOVE: |
| soundmng_stop(); | soundmng_disable(SNDPROC_TOOL); |
| movingstart(); | movingstart(); |
| break; | break; |
| case WM_EXITSIZEMOVE: | case WM_EXITSIZEMOVE: |
| soundmng_play(); | soundmng_enable(SNDPROC_TOOL); |
| break; | break; |
| case WM_MOVING: | case WM_MOVING: |
| Line 789 BOOL toolwin_initapp(HINSTANCE hInstance | Line 925 BOOL toolwin_initapp(HINSTANCE hInstance |
| WNDCLASS wc; | WNDCLASS wc; |
| wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; | wc.style = CS_HREDRAW | CS_VREDRAW; |
| wc.lpfnWndProc = twproc; | wc.lpfnWndProc = twproc; |
| wc.cbClsExtra = 0; | wc.cbClsExtra = 0; |
| wc.cbWndExtra = 0; | wc.cbWndExtra = GTWL_SIZE; |
| wc.hInstance = hInstance; | wc.hInstance = hInstance; |
| wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2)); | wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON2)); |
| wc.hCursor = LoadCursor(NULL, IDC_ARROW); | wc.hCursor = LoadCursor(NULL, IDC_ARROW); |
| Line 853 void toolwin_close(void) { | Line 989 void toolwin_close(void) { |
| } | } |
| } | } |
| #if 1 | |
| void toolwin_movingstart(void) { | void toolwin_movingstart(void) { |
| RECT mainrc; | RECT mainrc; |
| Line 954 void toolwin_movingend(void) { | Line 1089 void toolwin_movingend(void) { |
| } | } |
| MoveWindow(toolwin.hwnd, toolrc.left, toolrc.top, cx, cy, TRUE); | MoveWindow(toolwin.hwnd, toolrc.left, toolrc.top, cx, cy, TRUE); |
| } | } |
| #else | |
| void toolwin_movingstart(void) { | |
| RECT mainrc; | |
| RECT toolrc; | |
| if (toolwin.hwnd == NULL) { | |
| return; | |
| } | |
| GetWindowRect(hWndMain, &mainrc); | |
| GetWindowRect(toolwin.hwnd, &toolrc); | |
| if (((toolrc.right >= mainrc.left) && (toolrc.left <= mainrc.right) && | |
| ((toolrc.bottom == mainrc.top) || (toolrc.top == mainrc.bottom))) || | |
| ((toolrc.bottom >= mainrc.top) && (toolrc.top <= mainrc.bottom) && | |
| ((toolrc.right == mainrc.left) || (toolrc.left == mainrc.right)))) { | |
| toolwin.parentcn = 1; | |
| toolwin.parentx = mainrc.left; | |
| toolwin.parenty = mainrc.top; | |
| } | |
| } | |
| void toolwin_movingend(void) { | |
| RECT mainrc; | |
| RECT toolrc; | |
| int dx; | |
| int dy; | |
| if ((toolwin.hwnd) && (toolwin.parentcn)) { | |
| GetWindowRect(hWndMain, &mainrc); | |
| GetWindowRect(toolwin.hwnd, &toolrc); | |
| dx = mainrc.left - toolwin.parentx; | |
| dy = mainrc.top - toolwin.parenty; | |
| MoveWindow(toolwin.hwnd, toolrc.left + dx, toolrc.top + dy, | |
| toolrc.right - toolrc.left, | |
| toolrc.bottom - toolrc.top, TRUE); | |
| } | |
| toolwin.parentcn = 0; | |
| } | |
| #endif | |
| void toolwin_setfdd(BYTE drv, const char *name) { | void toolwin_setfdd(BYTE drv, const char *name) { |
| Line 1001 void toolwin_setfdd(BYTE drv, const char | Line 1096 void toolwin_setfdd(BYTE drv, const char |
| char *q; | char *q; |
| char *p; | char *p; |
| UINT i; | UINT i; |
| HWND sub; | |
| if (drv >= FDDLIST_DRV) { | if (drv >= FDDLIST_DRV) { |
| return; | return; |
| Line 1029 void toolwin_setfdd(BYTE drv, const char | Line 1125 void toolwin_setfdd(BYTE drv, const char |
| } | } |
| sysmng_update(SYS_UPDATEOSCFG); | sysmng_update(SYS_UPDATEOSCFG); |
| if (toolwin.hwnd != NULL) { | if (toolwin.hwnd != NULL) { |
| remakefddlist(drv); | sub = toolwin.sub[fddlist[drv]]; |
| SetForegroundWindow(hWndMain); | if (sub) { |
| remakefddlist(sub, fdd); | |
| SetForegroundWindow(hWndMain); | |
| } | |
| } | } |
| } | } |
| static void setdiskacc(UINT num, BYTE count) { | static void setdiskacc(UINT num, BYTE count) { |
| const DISKACC *acc; | const DISKACC *acc; |
| BYTE counter; | HWND sub; |
| if (toolwin.hwnd == NULL) { | if (toolwin.hwnd == NULL) { |
| return; | return; |
| } | } |
| if (num < (sizeof(diskacc)/sizeof(DISKACC))) { | if (num < (sizeof(diskacc)/sizeof(DISKACC))) { |
| acc = diskacc + num; | acc = diskacc + num; |
| counter = *(acc->counter); | sub = NULL; |
| if (*(acc->counter) == 0) { | |
| sub = toolwin.sub[acc->idc]; | |
| } | |
| *(acc->counter) = count; | *(acc->counter) = count; |
| if (counter) { | if (sub) { |
| InvalidateRect(toolwin.sub[acc->idc], NULL, TRUE); | InvalidateRect(sub, NULL, TRUE); |
| } | } |
| } | } |
| } | } |
| Line 1069 void toolwin_draw(BYTE frame) { | Line 1171 void toolwin_draw(BYTE frame) { |
| const DISKACC *acc; | const DISKACC *acc; |
| const DISKACC *accterm; | const DISKACC *accterm; |
| BYTE counter; | BYTE counter; |
| HWND sub; | |
| if (toolwin.hwnd == NULL) { | if (toolwin.hwnd == NULL) { |
| return; | return; |
| Line 1083 const DISKACC *accterm; | Line 1186 const DISKACC *accterm; |
| if (counter) { | if (counter) { |
| if (counter <= frame) { | if (counter <= frame) { |
| *(acc->counter) = 0; | *(acc->counter) = 0; |
| InvalidateRect(toolwin.sub[acc->idc], NULL, TRUE); | sub = toolwin.sub[acc->idc]; |
| if (sub) { | |
| InvalidateRect(sub, NULL, TRUE); | |
| } | |
| } | } |
| else { | else { |
| *(acc->counter) -= frame; | *(acc->counter) -= frame; |