⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ace.bak

📁 This is a CNCPro source file. It is include the G-Code interpreter source.
💻 BAK
📖 第 1 页 / 共 3 页
字号:
                         layer[iLayer].status=1-SendMessage(GetDlgItem(hDlg, IDD_LAYEROFF), BM_GETCHECK, 0, 0);
                         layer[iLayer].arc=iArc;
                         GetWindowText(GetDlgItem(hDlg, IDD_ZOFFSET), szString, 30);
                         endptr=NULL;
                         fTemp=(float) strtod(szString, &endptr);
                         if(*endptr==NULL) layer[iLayer].zoffset=fTemp;
                         GetWindowText(GetDlgItem(hDlg, IDD_DEPTH), szString, 30);
                         endptr=NULL;
                         fTemp=(float) fabs(strtod(szString, &endptr));
                         if(*endptr==NULL) layer[iLayer].depth=fTemp;
                         SendMessage(GetDlgItem(hDlg, IDD_ZCHAR), CB_GETLBTEXT,
                                     SendMessage(GetDlgItem(hDlg, IDD_ZCHAR), CB_GETCURSEL, 0, 0), (LPARAM) szString);
                         layer[iLayer].zchar=szString[0];
                         SendMessage(GetDlgItem(hDlg, IDD_PRIOR), CB_GETLBTEXT,
                                     SendMessage(GetDlgItem(hDlg, IDD_PRIOR), CB_GETCURSEL, 0, 0), (LPARAM) szString);
                         endptr=NULL;
                         iTemp=(int) strtol(szString, &endptr, 10);
                         if(*endptr==NULL) layer[iLayer].priority=iTemp;
		              case IDD_CANCEL :
                         EndDialog (hDlg, 0) ;
                         return TRUE;
                    case IDD_EITHERARC :
                    case IDD_CCWARC :
                    case IDD_CWARC :
                         iArc=LOWORD (wParam);
                         CheckRadioButton(hDlg,IDD_EITHERARC,IDD_CWARC,LOWORD (wParam));
                         return TRUE;
                    }
               break ;
          }
     return FALSE ;
     }

HWND prehwnd, posthwnd;
char *szTemp1, *szTemp2;
BOOL CALLBACK PriorityDlgProc (HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
     {
     static int iPriority;
     static char szString[30], *endptr;
     static float fTemp;
     static WNDCLASSEX wndclass ;

     switch (iMsg)
          {
          case WM_INITDIALOG :
               iPriority=SendMessage(GetDlgItem(hWindow, IDD_PRIORITY), LB_GETCURSEL, 0, 0);
               sprintf(szString,"%d",iPriority+1);
               SetWindowText(GetDlgItem(hDlg, IDD_PRIODISP),szString);
               if(priority[iPriority].optimize==TRUE) SendMessage(GetDlgItem(hDlg, IDD_OPTIMIZE), BM_SETCHECK, 1, 0);
               sprintf(szString,"%f",priority[iPriority].release);
               SetWindowText(GetDlgItem(hDlg, IDD_RELEASE),szString);
               sprintf(szString,"%f",priority[iPriority].close);
               SetWindowText(GetDlgItem(hDlg, IDD_CLOSE),szString);
               wndclass.cbSize        = sizeof (wndclass) ;
               wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
               wndclass.lpfnWndProc   = CodeWndProc ;
               wndclass.cbClsExtra    = 0 ;
               wndclass.cbWndExtra    = 0 ;
               wndclass.hInstance     = NULL ;
               wndclass.hIcon         = LoadIcon (hInst, szAppName) ;
               wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
               wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
               wndclass.lpszMenuName  = NULL ;
               wndclass.lpszClassName = "code" ;
	            wndclass.hIconSm       = LoadIcon (hInst, szAppName) ;
               RegisterClassEx (&wndclass) ;
               szTemp1=(char *) calloc(strlen(priority[iPriority].precode)+1,sizeof(char));
               szTemp2=(char *) calloc(strlen(priority[iPriority].postcode)+1,sizeof(char)),
               sprintf(szTemp1,"%s",priority[iPriority].precode);
               sprintf(szTemp2,"%s",priority[iPriority].postcode);
               return FALSE ;

          case WM_COMMAND :
               switch (LOWORD (wParam))
                    {
                     case IDD_OK :
                         DestroyWindow(prehwnd);
                         DestroyWindow(posthwnd);
			                free(priority[iPriority].precode);
                         free(priority[iPriority].postcode);
                         priority[iPriority].precode=szTemp1;
                         priority[iPriority].postcode=szTemp2;
                         priority[iPriority].optimize=SendMessage(GetDlgItem(hDlg, IDD_OPTIMIZE), BM_GETCHECK, 0, 0);
                         GetWindowText(GetDlgItem(hDlg, IDD_RELEASE), szString, 30);
                         endptr=NULL;
                         fTemp=(float) strtod(szString, &endptr);
                         if(*endptr==NULL) priority[iPriority].release=fTemp;
                         GetWindowText(GetDlgItem(hDlg, IDD_CLOSE), szString, 30);
                         endptr=NULL;
                         fTemp=(float) fabs(strtod(szString, &endptr));
                         if(*endptr==NULL) priority[iPriority].close=fTemp;
                         EndDialog (hDlg, 0) ;
                         return TRUE ;
                    case IDD_CANCEL :
                         DestroyWindow(prehwnd);
                         DestroyWindow(posthwnd);
			                EndDialog (hDlg, 0) ;
                         return TRUE ;
                    case IDD_PRECODE :
                         if(prehwnd==NULL)
                           {prehwnd = CreateWindow ("code", "Pre-Priority Code",
                                                    WS_OVERLAPPEDWINDOW,
                                                    CW_USEDEFAULT, CW_USEDEFAULT,
                                                    CW_USEDEFAULT, CW_USEDEFAULT,
                                                    NULL, NULL, NULL, NULL) ;
                            SetWindowText(GetWindow(prehwnd, GW_CHILD), szTemp1);
                           }
                         ShowWindow (prehwnd, SW_SHOWNORMAL) ;
                         UpdateWindow (prehwnd) ;
                         return TRUE ;
                    case IDD_POSTCODE :
                         if(posthwnd==NULL)
                           {posthwnd = CreateWindow ("code", "Post-Priority Code",
                                                     WS_OVERLAPPEDWINDOW,
                                                     CW_USEDEFAULT, CW_USEDEFAULT,
                                                     CW_USEDEFAULT, CW_USEDEFAULT,
                                                     NULL, NULL, NULL, NULL) ;
                            SetWindowText(GetWindow(posthwnd, GW_CHILD), szTemp2);
                           }
                         ShowWindow (posthwnd, SW_SHOWNORMAL) ;
                         UpdateWindow (posthwnd) ;
                         return TRUE ;
                    }
               break ;
          }
     return FALSE ;
     }

LRESULT CALLBACK CodeWndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
     {
     static HWND hwndEdit ;
     static int iTemp;

     switch (iMsg)
          {
          case WM_CREATE :
               hwndEdit = CreateWindow ("edit", NULL,
                         WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL |
                              WS_BORDER | ES_LEFT | ES_MULTILINE |
                              ES_AUTOHSCROLL | ES_AUTOVSCROLL,
                         0, 0, 0, 0,
                         hwnd, (HMENU) 1,
                         ((LPCREATESTRUCT) lParam) -> hInstance, NULL) ;
               return 0 ;

          case WM_SETFOCUS :
               SetFocus (hwndEdit) ;
               return 0 ;

          case WM_SIZE : 
               MoveWindow (hwndEdit, 0, 0, LOWORD (lParam),
                                           HIWORD (lParam), TRUE) ;
               return 0 ;

          case WM_COMMAND :
               if (LOWORD (wParam) == 1)
                    if (HIWORD (wParam) == EN_ERRSPACE ||
                        HIWORD (wParam) == EN_MAXTEXT)
                              MessageBox (hwnd, "Edit control out of space.",
                                          szAppName, MB_OK | MB_ICONSTOP) ;
               return 0 ;
          case WM_DESTROY :
               if(prehwnd==hwnd)
                 {prehwnd=NULL;
                  free(szTemp1);
                  szTemp1=(char *) calloc((iTemp=(GetWindowTextLength(hwndEdit)+1)),sizeof(char));
                  GetWindowText(hwndEdit, szTemp1, iTemp);
                 }
               if(posthwnd==hwnd)
                 {posthwnd=NULL;
                  free(szTemp2);
                  szTemp2=(char *) calloc((iTemp=(GetWindowTextLength(hwndEdit)+1)),sizeof(char));
                  GetWindowText(hwndEdit, szTemp2, iTemp);
                 }
               return 0;
          }
     return DefWindowProc (hwnd, iMsg, wParam, lParam) ;
     }

BOOL CALLBACK ConvertDlgProc (HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
     {
     switch (iMsg)
          {
          case WM_INITDIALOG :
               SendMessage(GetDlgItem(hDlg, IDD_IJREL), BM_SETCHECK, convertop.ijrel, 0);
               SendMessage(GetDlgItem(hDlg, IDD_IJFIRST), BM_SETCHECK, convertop.ijfirst, 0);
               SendMessage(GetDlgItem(hDlg, IDD_LINENUM), BM_SETCHECK, convertop.line_num, 0);
               return FALSE ;

          case WM_COMMAND :
               switch (LOWORD (wParam))
                    {
		              case IDD_OK :
                         convertop.ijrel=SendMessage(GetDlgItem(hDlg, IDD_IJREL), BM_GETCHECK, 0, 0);
                         convertop.ijfirst=SendMessage(GetDlgItem(hDlg, IDD_IJFIRST), BM_GETCHECK, 0, 0);
                         convertop.line_num=SendMessage(GetDlgItem(hDlg, IDD_LINENUM), BM_GETCHECK, 0, 0);
                         EndDialog (hDlg, 0) ;
			                return TRUE ;
                    }
               break ;
          }
     return FALSE ;
     }

int DelPriority(int num, int count)
{
   int i;
   if(num>0 && num<=count) free(priority[num-1].precode);
   if(num>0 && num<=count) free(priority[num-1].postcode);
   for(i=num;i<count;i++) priority[i-1]=priority[i];
   if(count==1) free(priority);
   return count-1;
}

int NewPriority(int count)
{
   int i;
   temp_pri=(struct priority_obj *) calloc((count+1), sizeof(struct priority_obj));
   for(i=0;i<count;i++) temp_pri[i]=priority[i];
   if(count>0) free(priority);
   priority=temp_pri;
   priority[count].release=3;
   priority[count].close=.001;
   priority[count].optimize=TRUE;
   priority[count].precode=(char *) calloc(1, sizeof(char));
   priority[count].postcode=(char *) calloc(1, sizeof(char));
   return count+1;
}

int ReadLayer (char *file)
{
   int i, count=0, temp;
   char string[100];
   fpos_t pos;
   FILE *ifp;
   ifp=fopen(file,"r");
   while(1)
     {if((temp=fscanf(ifp,"%s",string))!=EOF && temp!=0 && strcmp(string,"0")==0)
        {fgetpos(ifp, &pos);
         if((temp=fscanf(ifp,"%s",string))!=EOF && temp!=0 && strcmp(string,"LAYER")==0)
           {while(1)
              {if((temp=fscanf(ifp,"%s",string))==EOF || temp==0) break;
               if(strcmp(string,"0")==0) break;
               else if(strcmp(string,"2")==0)
                 {temp_lay=(struct layer_obj *) calloc(++count, sizeof(struct layer_obj));
                  for(i=0;i<count-1;i++) temp_lay[i]=layer[i];
                  if(count>1) free(layer);
                  layer=temp_lay;
                  temp=fscanf(ifp,"%s",layer[count-1].name);
                  break;
                 }
               else if((temp=fscanf(ifp,"%s",string))==EOF || temp==0) break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -