Diff for /np2/win9x/toolwin.cpp between versions 1.5 and 1.7

version 1.5, 2003/10/29 21:35:58 version 1.7, 2003/10/30 12:45:38
Line 492  static void movingproc(RECT *rect) { Line 492  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 576  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) {  
                         break;  
                 }  
   
                 if (toolwin.winflg & 2) {                  if ((!(toolwin.winflg & 0x04)) &&
                         toolwin.wingy += rect->top - toolwin.winty;                          (rect->right >= mainrc.left) && (rect->left <= mainrc.right)) {
                         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 629  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 662  static LRESULT CALLBACK twproc(HWND hWnd Line 682  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 706  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 723  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 729  static LRESULT CALLBACK twproc(HWND hWnd Line 749  static LRESULT CALLBACK twproc(HWND hWnd
                         break;                          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 809  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 = 0;
Line 853  void toolwin_close(void) { Line 873  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 973  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) {
   

Removed from v.1.5  
changed lines
  Added in v.1.7


RetroPC.NET-CVS <cvs@retropc.net>