--- np2/win9x/toolwin.cpp 2003/10/30 16:54:04 1.8 +++ np2/win9x/toolwin.cpp 2003/11/01 22:23:04 1.11 @@ -2,18 +2,23 @@ #include "strres.h" #include "resource.h" #include "np2.h" +#include "winloc.h" #include "dosio.h" #include "soundmng.h" #include "sysmng.h" #include "menu.h" #include "toolwin.h" #include "ini.h" +#include "np2class.h" #include "dialog.h" #include "dialogs.h" #include "pccore.h" #include "diskdrv.h" +extern WINLOCEX np2_winlocexallwin(HWND base); + + enum { IDC_TOOLHDDACC = 0, IDC_TOOLFDD1ACC, @@ -30,9 +35,10 @@ enum { IDC_BASE = 3000, - IDC_SKINDEF = 3100, - IDC_SKINSEL = 3101, - IDC_TOOLCLOSE = 3102 + IDC_SKINSEL = 3100, + IDC_SKINDEF = 3101, + IDC_SKINMRU = 3102, + IDC_TOOLCLOSE = IDC_SKINMRU + SKINMRU_MAX }; enum { @@ -62,6 +68,7 @@ const char *text; typedef struct { HWND hwnd; + WINLOCEX wlex; HBITMAP hbmp; BYTE fddaccess[2]; BYTE hddaccess; @@ -82,8 +89,8 @@ typedef struct { } TOOLWIN; enum { - GTWL_FOCUS = 0, - GTWL_SIZE = 4 + GTWL_FOCUS = NP2GWL_SIZE + 0, + GTWL_SIZE = NP2GWL_SIZE + 4 }; NP2TOOL np2tool; @@ -113,6 +120,7 @@ static const DISKACC diskacc[3] = { static HBITMAP skinload(const char *path) { char fname[MAX_PATH]; + UINT i; HBITMAP ret; ZeroMemory(&toolskin, sizeof(toolskin)); @@ -120,12 +128,23 @@ static HBITMAP skinload(const char *path milstr_ncpy(toolskin.font, str_deffont, sizeof(toolskin.font)); toolskin.color1 = 0x600000; toolskin.color2 = 0xff0000; - CopyMemory(subitem, defsubitem, sizeof(defsubitem)); - if (path) { - ini_read(path, skintitle, skinini, sizeof(skinini)/sizeof(INITBL)); + ini_read(path, skintitle, skinini1, sizeof(skinini1)/sizeof(INITBL)); + } + if (toolskin.main[0]) { + ZeroMemory(subitem, sizeof(defsubitem)); + for (i=0; i= 0)?1:-1; newidc = idc; do { @@ -329,7 +348,7 @@ static LRESULT CALLBACK twsub(HWND hWnd, } } while(idc != newidc); } - else if ((TCHAR)wp == VK_RETURN) { + else if ((short)wp == VK_RETURN) { if (subitem[idc].tctl == TCTL_BUTTON) { return(CallWindowProc(toolwin.subproc[idc], hWnd, WM_KEYDOWN, VK_SPACE, 0)); @@ -487,15 +506,14 @@ static void toolwinpaint(HWND hWnd) { EndPaint(hWnd, &ps); } -static void tooldrawbutton(HWND hWnd, HDC hdc, UINT idc) { +static void tooldrawbutton(HWND hWnd, UINT idc, LPDRAWITEMSTRUCT lpdis) { POINT pt; HWND sub; RECT rect; - int cx; - int cy; + HDC hdc; HDC hmdc; - HBRUSH hbrush; + RECT btn; idc -= IDC_BASE; if (idc >= IDC_MAXITEMS) { @@ -506,281 +524,159 @@ static void tooldrawbutton(HWND hWnd, HD ClientToScreen(hWnd, &pt); sub = toolwin.sub[idc]; GetWindowRect(sub, &rect); - cx = rect.right - rect.left; - cy = rect.bottom - rect.top; + btn.left = 0; + btn.top = 0; + btn.right = rect.right - rect.left; + btn.bottom = rect.bottom - rect.top; + hdc = lpdis->hDC; if (toolwin.hbmp) { hmdc = CreateCompatibleDC(hdc); SelectObject(hmdc, toolwin.hbmp); - BitBlt(hdc, 0, 0, cx, cy, + BitBlt(hdc, 0, 0, btn.right, btn.bottom, 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) { - - HBITMAP hbmp; - BITMAP bmp; - - toolwin_movingstart(); - toolwindestroy(); - hbmp = skinload(np2tool.skin); - if (hbmp == NULL) { - SendMessage(hWnd, WM_CLOSE, 0, 0); - return; + if (lpdis->itemState & ODS_FOCUS) { + DrawFocusRect(hdc, &btn); } - GetObject(hbmp, sizeof(BITMAP), &bmp); - toolwin.hbmp = hbmp; - MoveWindow(hWnd, np2tool.posx, np2tool.posy, - bmp.bmWidth, bmp.bmHeight, TRUE); - toolwincreate(hWnd); - toolwin_movingend(); } -// ---- moving - -enum { - SNAPDOTPULL = 12, - SNAPDOTREL = 16 -}; - -static void movingstart(void) { +// ---- - toolwin.winflg = 0; - toolwin.wingx = 0; - toolwin.wingy = 0; -} - -static void movingproc(RECT *rect) { - - RECT workrc; - RECT mainrc; - int winlx; - int winly; - BOOL changes; - BOOL connectx; - BOOL connecty; - int d; - - SystemParametersInfo(SPI_GETWORKAREA, 0, &workrc, 0); - GetWindowRect(hWndMain, &mainrc); - winlx = rect->right - rect->left; - winly = rect->bottom - rect->top; +static HMENU createskinmenu(void) { - if ((winlx > (workrc.right - workrc.left)) || - (winly > (workrc.bottom - workrc.top))) { - return; - } + HMENU ret; + UINT cnt; +const char *base; + UINT flag; + char *p; + UINT i; + UINT j; + UINT id[SKINMRU_MAX]; +const char *file[SKINMRU_MAX]; - if (toolwin.winflg & 0x03) { - toolwin.wingx += rect->left - toolwin.wintx; - rect->left = toolwin.wintx; - if ((toolwin.wingx >= SNAPDOTREL) || (toolwin.wingx <= -SNAPDOTREL)) { - toolwin.winflg &= ~0x03; - rect->left += toolwin.wingx; - toolwin.wingx = 0; - } - rect->right = rect->left + winlx; - } - 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; + ret = CreatePopupMenu(); + AppendMenu(ret, MF_STRING, IDC_SKINSEL, str_skinsel); + AppendMenu(ret, MF_SEPARATOR, 0, NULL); + + base = np2tool.skin; + flag = (base[0] == '\0')?MF_CHECKED:0; + AppendMenu(ret, MF_STRING + flag, IDC_SKINDEF, str_skindef); + for (cnt=0; cntbottom >= mainrc.top) && (rect->top <= mainrc.bottom)) { - do { - d = rect->left - mainrc.right; - if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { - break; - } - 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)) { - 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; + p = file_getname(p); + for (i=0; ileft - workrc.left; - if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { - break; - } - d = rect->right - workrc.right; - if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { - break; - } - } while(0); - if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { - toolwin.winflg |= 0x02; - rect->left -= d; - rect->right = rect->left + winlx; - toolwin.wingx = d; - toolwin.wintx = rect->left; - changes = TRUE; - } + for (j=cnt; j>i; j--) { + id[j] = id[j-1]; } + id[i] = cnt; + file[cnt] = p; + } + for (i=0; iright >= mainrc.left) && (rect->left <= mainrc.right)) { - do { - d = rect->top - mainrc.bottom; - if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { - break; - } - 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)) { - 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; +static void skinchange(HWND hWnd) { + +const char *p; + UINT i; + HBITMAP hbmp; + BITMAP bmp; + WINLOCEX wlex; + + p = np2tool.skin; + if (p[0]) { + for (i=0; i<(SKINMRU_MAX - 1); i++) { + if (!file_cmpname(p, np2tool.skinmru[i])) { + break; } } - if (!(toolwin.winflg & 0x0c)) { - do { - d = rect->top - workrc.top; - if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { - break; - } - d = rect->bottom - workrc.bottom; - if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { - break; - } - } while(0); - if ((d < SNAPDOTPULL) && (d > -SNAPDOTPULL)) { - toolwin.winflg |= 0x08; - rect->top -= d; - rect->bottom = rect->top + winly; - toolwin.wingy = d; - toolwin.winty = rect->top; - changes = TRUE; - } + while(i > 0) { + CopyMemory(np2tool.skinmru[i], np2tool.skinmru[i-1], + sizeof(np2tool.skinmru[0])); + i--; } - } while(changes); + file_cpyname(np2tool.skinmru[0], p, sizeof(np2tool.skinmru[0])); + } + ModifyMenu(GetSystemMenu(hWnd, FALSE), 0, MF_BYPOSITION | MF_POPUP, + (UINT)createskinmenu(), str_toolskin); + DrawMenuBar(hWnd); + sysmng_update(SYS_UPDATEOSCFG); + + wlex = np2_winlocexallwin(hWndMain); + toolwindestroy(); + hbmp = skinload(np2tool.skin); + if (hbmp == NULL) { + SendMessage(hWnd, WM_CLOSE, 0, 0); + return; + } + GetObject(hbmp, sizeof(BITMAP), &bmp); + toolwin.hbmp = hbmp; + winloc_setclientsize(hWnd, bmp.bmWidth, bmp.bmHeight); + toolwincreate(hWnd); + winlocex_move(wlex); + winlocex_destroy(wlex); } // ---- -static void open_popup(HWND hWnd, LPARAM lp) { +static void openpopup(HWND hWnd, LPARAM lp) { - HMENU hMenu; - POINT pt; + HMENU hMenu; + POINT pt; hMenu = CreatePopupMenu(); - AppendMenu(hMenu, MF_STRING, IDC_SKINDEF, str_skindef); - AppendMenu(hMenu, MF_STRING, IDC_SKINSEL, str_skinsel); + AppendMenu(hMenu, MF_POPUP, (UINT)createskinmenu(), str_toolskin); AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); AppendMenu(hMenu, MF_STRING, IDC_TOOLCLOSE, str_toolclose); pt.x = LOWORD(lp); pt.y = HIWORD(lp); ClientToScreen(hWnd, &pt); TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hWnd, NULL); + ModifyMenu(hMenu, 0, MF_BYPOSITION | MF_POPUP, (UINT)0, str_toolskin); DestroyMenu(hMenu); } static LRESULT CALLBACK twproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { - BOOL r; - UINT idc; + HMENU hMenu; + BOOL r; + UINT idc; + WINLOCEX wlex; switch(msg) { case WM_CREATE: - SetWindowLong(hWnd, GWL_STYLE, - GetWindowLong(hWnd, GWL_STYLE) & (~WS_CAPTION)); - SetWindowPos(hWnd, 0, 0, 0, 0, 0, - SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); + hMenu = GetSystemMenu(hWnd, FALSE); + InsertMenu(hMenu, 0, MF_BYPOSITION | MF_POPUP, + (UINT)createskinmenu(), str_toolskin); + InsertMenu(hMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + + np2class_windowtype(hWnd, np2tool.type); toolwincreate(hWnd); break; case WM_SYSCOMMAND: switch(wp) { - case IDC_SKINDEF: - np2tool.skin[0] = '\0'; - changeskin(hWnd); - sysmng_update(SYS_UPDATEOSCFG); - break; - case IDC_SKINSEL: - soundmng_disable(SNDPROC_TOOL); - r = dlgs_selectfile(hWnd, &skinui, np2tool.skin, - sizeof(np2tool.skin), NULL); - soundmng_enable(SNDPROC_TOOL); - if (r) { - changeskin(hWnd); - sysmng_update(SYS_UPDATEOSCFG); - } - break; + case IDC_SKINDEF: + case IDC_SKINMRU + 0: + case IDC_SKINMRU + 1: + case IDC_SKINMRU + 2: + case IDC_SKINMRU + 3: + return(SendMessage(hWnd, WM_COMMAND, wp, lp)); default: return(DefWindowProc(hWnd, msg, wp, lp)); @@ -825,15 +721,36 @@ static LRESULT CALLBACK twproc(HWND hWnd case IDC_BASE + IDC_TOOLRESET: SendMessage(hWndMain, WM_COMMAND, IDM_RESET, 0); + SetForegroundWindow(hWndMain); break; case IDC_BASE + IDC_TOOLPOWER: SendMessage(hWndMain, WM_CLOSE, 0, 0L); break; - case IDC_SKINDEF: case IDC_SKINSEL: - SendMessage(hWnd, WM_SYSCOMMAND, wp, lp); + soundmng_disable(SNDPROC_TOOL); + r = dlgs_selectfile(hWnd, &skinui, np2tool.skin, + sizeof(np2tool.skin), NULL); + soundmng_enable(SNDPROC_TOOL); + if (r) { + skinchange(hWnd); + } + break; + + case IDC_SKINDEF: + np2tool.skin[0] = '\0'; + skinchange(hWnd); + break; + + case IDC_SKINMRU + 0: + case IDC_SKINMRU + 1: + case IDC_SKINMRU + 2: + case IDC_SKINMRU + 3: + file_cpyname(np2tool.skin, + np2tool.skinmru[LOWORD(wp) - IDC_SKINMRU], + sizeof(np2tool.skin)); + skinchange(hWnd); break; case IDC_TOOLCLOSE: @@ -843,17 +760,13 @@ static LRESULT CALLBACK twproc(HWND hWnd break; case WM_KEYDOWN: // TABを押した時に復帰 - if ((TCHAR)wp == VK_TAB) { + if ((short)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: @@ -861,7 +774,7 @@ static LRESULT CALLBACK twproc(HWND hWnd break; case WM_DRAWITEM: - tooldrawbutton(hWnd, ((LPDRAWITEMSTRUCT)lp)->hDC, wp); + tooldrawbutton(hWnd, wp, (LPDRAWITEMSTRUCT)lp); break; case WM_ENTERMENULOOP: @@ -874,15 +787,18 @@ static LRESULT CALLBACK twproc(HWND hWnd case WM_ENTERSIZEMOVE: soundmng_disable(SNDPROC_TOOL); - movingstart(); + winlocex_destroy(toolwin.wlex); + toolwin.wlex = np2_winlocexallwin(hWnd); break; - case WM_EXITSIZEMOVE: - soundmng_enable(SNDPROC_TOOL); + case WM_MOVING: + winlocex_moving(toolwin.wlex, (RECT *)lp); break; - case WM_MOVING: - movingproc((RECT *)lp); + case WM_EXITSIZEMOVE: + winlocex_destroy(toolwin.wlex); + toolwin.wlex = NULL; + soundmng_enable(SNDPROC_TOOL); break; case WM_MOVE: @@ -897,22 +813,34 @@ static LRESULT CALLBACK twproc(HWND hWnd break; case WM_CLOSE: - xmenu_settoolwin(0); + sysmenu_settoolwin(0); sysmng_update(SYS_UPDATEOSCFG); DestroyWindow(hWnd); break; case WM_DESTROY: + np2class_destroymenu(hWnd); toolwindestroy(); toolwin.hwnd = NULL; break; case WM_LBUTTONDOWN: - SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0L); + if (np2tool.type & 1) { + return(SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0L)); + } break; case WM_RBUTTONDOWN: - open_popup(hWnd, lp); + openpopup(hWnd, lp); + break; + + case WM_LBUTTONDBLCLK: + np2tool.type ^= 1; + wlex = np2_winlocexallwin(hWndMain); + np2class_windowtype(hWnd, np2tool.type); + winlocex_move(wlex); + winlocex_destroy(wlex); + sysmng_update(SYS_UPDATEOSCFG); break; default: @@ -925,7 +853,7 @@ BOOL toolwin_initapp(HINSTANCE hInstance WNDCLASS wc; - wc.style = CS_HREDRAW | CS_VREDRAW; + wc.style = CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; wc.lpfnWndProc = twproc; wc.cbClsExtra = 0; wc.cbWndExtra = GTWL_SIZE; @@ -938,12 +866,11 @@ BOOL toolwin_initapp(HINSTANCE hInstance return(RegisterClass(&wc)); } -void toolwin_open(void) { +void toolwin_create(void) { HBITMAP hbmp; BITMAP bmp; HWND hWnd; - HMENU hMenu; if (toolwin.hwnd) { return; @@ -955,139 +882,39 @@ void toolwin_open(void) { } GetObject(hbmp, sizeof(BITMAP), &bmp); toolwin.hbmp = hbmp; - hWnd = CreateWindow(np2toolclass, np2tooltitle, WS_SYSMENU, + hWnd = CreateWindow(np2toolclass, np2tooltitle, + WS_SYSMENU | WS_MINIMIZEBOX, np2tool.posx, np2tool.posy, bmp.bmWidth, bmp.bmHeight, NULL, NULL, hInst, NULL); + winloc_setclientsize(hWnd, bmp.bmWidth, bmp.bmHeight); toolwin.hwnd = hWnd; if (hWnd == NULL) { goto twope_err2; } UpdateWindow(hWnd); - ShowWindow(hWnd, SW_SHOW); - - hMenu = GetSystemMenu(hWnd, FALSE); - InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING, IDC_SKINDEF, str_skindef); - InsertMenu(hMenu, 1, MF_BYPOSITION | MF_STRING, IDC_SKINSEL, str_skinsel); - InsertMenu(hMenu, 2, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); - SetForegroundWindow(hWndMain); + ShowWindow(hWnd, SW_SHOWNOACTIVATE); return; twope_err2: DeleteObject(hbmp); twope_err1: - xmenu_settoolwin(0); + sysmenu_settoolwin(0); sysmng_update(SYS_UPDATEOSCFG); return; } -void toolwin_close(void) { +void toolwin_destroy(void) { if (toolwin.hwnd) { DestroyWindow(toolwin.hwnd); } } -void toolwin_movingstart(void) { - - RECT mainrc; - RECT toolrc; - UINT connect; +HWND toolwin_gethwnd(void) { - if (toolwin.hwnd == NULL) { - return; - } - GetWindowRect(hWndMain, &mainrc); - GetWindowRect(toolwin.hwnd, &toolrc); - connect = 0; - if ((toolrc.bottom >= mainrc.top) && (toolrc.top <= mainrc.bottom)) { - if (toolrc.right == mainrc.left) { - connect += 0x01; - } - else if (toolrc.left == mainrc.right) { - connect += 0x02; - } - else if (toolrc.left == mainrc.left) { - connect += 0x03; - } - else if (toolrc.right == mainrc.right) { - connect += 0x04; - } - } - if ((toolrc.right >= mainrc.left) && (toolrc.left <= mainrc.right)) { - if (toolrc.bottom == mainrc.top) { - connect += 1 << 4; - } - else if (toolrc.top == mainrc.bottom) { - connect += 2 << 4; - } - else if (toolrc.top == mainrc.top) { - connect += 3 << 4; - } - else if (toolrc.bottom == mainrc.bottom) { - connect += 4 << 4; - } - } - toolwin.parentcn = connect; - toolwin.parentx = mainrc.left; - toolwin.parenty = mainrc.top; -} - -void toolwin_movingend(void) { - - UINT connect; - RECT mainrc; - RECT toolrc; - int cx; - int cy; - - connect = toolwin.parentcn; - toolwin.parentcn = 0; - if ((toolwin.hwnd == NULL) || (!connect)) { - return; - } - GetWindowRect(hWndMain, &mainrc); - GetWindowRect(toolwin.hwnd, &toolrc); - cx = toolrc.right - toolrc.left; - cy = toolrc.bottom - toolrc.top; - toolrc.left += mainrc.left - toolwin.parentx; - toolrc.top += mainrc.top - toolwin.parenty; - switch(connect & 0x0f) { - case 1: - toolrc.left = mainrc.left - cx; - break; - - case 2: - toolrc.left = mainrc.right; - break; - - case 3: - toolrc.left = mainrc.left; - break; - - case 4: - toolrc.left = mainrc.right - cx; - break; - } - switch((connect >> 4) & 0x0f) { - case 1: - toolrc.top = mainrc.top - cy; - break; - - case 2: - toolrc.top = mainrc.bottom; - break; - - case 3: - toolrc.top = mainrc.top; - break; - - case 4: - toolrc.top = mainrc.bottom - cy; - break; - } - MoveWindow(toolwin.hwnd, toolrc.left, toolrc.top, cx, cy, TRUE); + return(toolwin.hwnd); } void toolwin_setfdd(BYTE drv, const char *name) { @@ -1109,7 +936,7 @@ void toolwin_setfdd(BYTE drv, const char fdd->insert = 1; q = fdd->name[0]; for (i=0; i<(FDDLIST_MAX - 1); i++) { - if (!milstr_cmp(q, name)) { + if (!file_cmpname(q, name)) { break; } q += sizeof(fdd->name[0]); @@ -1121,7 +948,7 @@ void toolwin_setfdd(BYTE drv, const char p -= sizeof(fdd->name[0]); q -= sizeof(fdd->name[0]); } - milstr_ncpy(fdd->name[0], name, sizeof(fdd->name[0])); + file_cpyname(fdd->name[0], name, sizeof(fdd->name[0])); } sysmng_update(SYS_UPDATEOSCFG); if (toolwin.hwnd != NULL) { @@ -1202,13 +1029,17 @@ const DISKACC *accterm; // ---- -static const char np2toolini[] = "np2tool.ini"; static const char ini_title[] = "NP2 tool"; static const INITBL iniitem[] = { {"WindposX", INITYPE_SINT32, &np2tool.posx, 0}, {"WindposY", INITYPE_SINT32, &np2tool.posy, 0}, + {"WindType", INITYPE_BOOL, &np2tool.type, 0}, {"SkinFile", INITYPE_STR, np2tool.skin, MAX_PATH}, + {"SkinMRU0", INITYPE_STR, np2tool.skinmru[0], MAX_PATH}, + {"SkinMRU1", INITYPE_STR, np2tool.skinmru[1], MAX_PATH}, + {"SkinMRU2", INITYPE_STR, np2tool.skinmru[2], MAX_PATH}, + {"SkinMRU3", INITYPE_STR, np2tool.skinmru[3], MAX_PATH}, {"FD1NAME0", INITYPE_STR, np2tool.fdd[0].name[0], MAX_PATH}, {"FD1NAME1", INITYPE_STR, np2tool.fdd[0].name[1], MAX_PATH}, {"FD1NAME2", INITYPE_STR, np2tool.fdd[0].name[2], MAX_PATH}, @@ -1226,13 +1057,6 @@ static const INITBL iniitem[] = { {"FD2NAME6", INITYPE_STR, np2tool.fdd[1].name[6], MAX_PATH}, {"FD2NAME7", INITYPE_STR, np2tool.fdd[1].name[7], MAX_PATH}}; -static void getinifile(char *path, int leng) { - - milstr_ncpy(path, modulefile, leng); - file_cutname(path); - file_catname(path, np2toolini, leng); -} - void toolwin_readini(void) { char path[MAX_PATH]; @@ -1240,7 +1064,8 @@ void toolwin_readini(void) { ZeroMemory(&np2tool, sizeof(np2tool)); np2tool.posx = CW_USEDEFAULT; np2tool.posy = CW_USEDEFAULT; - getinifile(path, sizeof(path)); + np2tool.type = 1; + initgetfile(path, sizeof(path)); ini_read(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); } @@ -1248,7 +1073,7 @@ void toolwin_writeini(void) { char path[MAX_PATH]; - getinifile(path, sizeof(path)); + initgetfile(path, sizeof(path)); ini_write(path, ini_title, iniitem, sizeof(iniitem)/sizeof(INITBL)); }