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

📄 xemc.cc

📁 CNC 的开放码,EMC2 V2.2.8版
💻 CC
📖 第 1 页 / 共 5 页
字号:
                            NULL);  XtAddCallback(fileEditorMark, XtNcallback, fileEditorMarkCB, fileEditorShell);  return 0;}static int destroyFileEditorShell(){  if (fileEditorMark != NULL) {    XtDestroyWidget(fileEditorMark);    fileEditorMark = NULL;  }  if (fileEditorCancel != NULL) {    XtDestroyWidget(fileEditorCancel);    fileEditorCancel = NULL;  }  if (fileEditorDone != NULL) {    XtDestroyWidget(fileEditorDone);    fileEditorDone = NULL;  }  if (fileEditorText != NULL) {    XtDestroyWidget(fileEditorText);    fileEditorText = NULL;  }  if (fileEditorLabel != NULL) {    XtDestroyWidget(fileEditorLabel);    fileEditorLabel = NULL;  }  if (fileEditorForm != NULL) {    XtDestroyWidget(fileEditorForm);    fileEditorForm = NULL;  }  if (fileEditorShell != NULL) {    XtDestroyWidget(fileEditorShell);    fileEditorShell = NULL;  }  return 0;}static void doFileEditorDone(int get){  Widget source;  String string;  if (get) {    XtVaGetValues(fileEditorText,                  XtNtextSource, &source,                  XtNstring, &string,                  NULL);    XawAsciiSave(source);  }  XtPopdown(fileEditorShell);  destroyFileEditorShell();}// tool table forward declsstatic void toolTableDoneCB(Widget w, XtPointer client_data, XtPointer call_data);static void toolTableCancelCB(Widget w, XtPointer client_data, XtPointer call_data);static int createToolTableShell();static int destroyToolTableShell();static void doToolTableDone(int get);static void toolTableDoneCB(Widget w, XtPointer client_data, XtPointer call_data){  doToolTableDone(1);}static void toolTableCancelCB(Widget w, XtPointer client_data, XtPointer call_data){  doToolTableDone(0);}static int createToolTableShell(){  if (NULL != toolTableShell) {    return 0;  }  toolTableShell =    XtVaCreatePopupShell("toolTableShell",                         topLevelShellWidgetClass,                         topLevel,                         XtNallowShellResize, True,                         NULL);  toolTableForm =    XtVaCreateManagedWidget("toolTableForm",                            formWidgetClass,                            toolTableShell,                            NULL);  toolTableLabel =    XtVaCreateManagedWidget("toolTableLabel",                            labelWidgetClass,                            toolTableForm,                            XtNlabel, TOOL_TABLE_FILE,                            NULL);  toolTableText =    XtVaCreateManagedWidget("toolTableText",                            asciiTextWidgetClass,                            toolTableForm,                            XtNfromVert, toolTableLabel,                            XtNeditType, XawtextEdit,                            XtNtype, XawAsciiFile,                            XtNstring, TOOL_TABLE_FILE,                            XtNscrollVertical, XawtextScrollWhenNeeded,                            NULL);  toolTableDone =    XtVaCreateManagedWidget("toolTableDone",                            commandWidgetClass,                            toolTableForm,                            XtNfromVert, toolTableText,                            NULL);  XtAddCallback(toolTableDone, XtNcallback, toolTableDoneCB, toolTableShell);  toolTableCancel =    XtVaCreateManagedWidget("toolTableCancel",                            commandWidgetClass,                            toolTableForm,                            XtNfromVert, toolTableText,                            XtNfromHoriz, toolTableDone,                            NULL);  XtAddCallback(toolTableCancel, XtNcallback, toolTableCancelCB, toolTableShell);  return 0;}static int destroyToolTableShell(){  if (toolTableCancel != NULL) {    XtDestroyWidget(toolTableCancel);    toolTableCancel = NULL;  }  if (toolTableDone != NULL) {    XtDestroyWidget(toolTableDone);    toolTableDone = NULL;  }  if (toolTableText != NULL) {    XtDestroyWidget(toolTableText);    toolTableText = NULL;  }  if (toolTableLabel != NULL) {    XtDestroyWidget(toolTableLabel);    toolTableLabel = NULL;  }  if (toolTableForm != NULL) {    XtDestroyWidget(toolTableForm);    toolTableForm = NULL;  }  if (toolTableShell != NULL) {    XtDestroyWidget(toolTableShell);    toolTableShell = NULL;  }  return 0;}static void doToolTableDone(int get){  Widget source;  String string;  if (get) {    XtVaGetValues(toolTableText,                  XtNtextSource, &source,                  XtNstring, &string,                  NULL);    XawAsciiSave(source);    sendLoadToolTable(string);  }  XtPopdown(toolTableShell);  destroyToolTableShell();}// forward declsstatic void varFileDoneCB(Widget w, XtPointer client_data, XtPointer call_data);static void varFileCancelCB(Widget w, XtPointer client_data, XtPointer call_data);static int createVarFileShell();static int destroyVarFileShell();static void doVarFileDone(int get);static void varFileDoneCB(Widget w, XtPointer client_data, XtPointer call_data){  doVarFileDone(1);}static void varFileCancelCB(Widget w, XtPointer client_data, XtPointer call_data){  doVarFileDone(0);}static int createVarFileShell(){  if (NULL != varFileShell) {    return 0;  }  varFileShell =    XtVaCreatePopupShell("varFileShell",                         topLevelShellWidgetClass,                         topLevel,                         XtNallowShellResize, True,                         NULL);  varFileForm =    XtVaCreateManagedWidget("varFileForm",                            formWidgetClass,                            varFileShell,                            NULL);  varFileLabel =    XtVaCreateManagedWidget("varFileLabel",                            labelWidgetClass,                            varFileForm,                            XtNlabel, PARAMETER_FILE,                            NULL);  varFileText =    XtVaCreateManagedWidget("varFileText",                            asciiTextWidgetClass,                            varFileForm,                            XtNfromVert, varFileLabel,                            XtNeditType, XawtextEdit,                            XtNtype, XawAsciiFile,                            XtNstring, PARAMETER_FILE,                            XtNscrollVertical, XawtextScrollWhenNeeded,                            NULL);  varFileDone =    XtVaCreateManagedWidget("varFileDone",                            commandWidgetClass,                            varFileForm,                            XtNfromVert, varFileText,                            NULL);  XtAddCallback(varFileDone, XtNcallback, varFileDoneCB, varFileShell);  varFileCancel =    XtVaCreateManagedWidget("varFileCancel",                            commandWidgetClass,                            varFileForm,                            XtNfromVert, varFileText,                            XtNfromHoriz, varFileDone,                            NULL);  XtAddCallback(varFileCancel, XtNcallback, varFileCancelCB, varFileShell);  return 0;}static int destroyVarFileShell(){  if (varFileCancel != NULL) {    XtDestroyWidget(varFileCancel);    varFileCancel = NULL;  }  if (varFileDone != NULL) {    XtDestroyWidget(varFileDone);    varFileDone = NULL;  }  if (varFileText != NULL) {    XtDestroyWidget(varFileText);    varFileText = NULL;  }  if (varFileLabel != NULL) {    XtDestroyWidget(varFileLabel);    varFileLabel = NULL;  }  if (varFileForm != NULL) {    XtDestroyWidget(varFileForm);    varFileForm = NULL;  }  if (varFileShell != NULL) {    XtDestroyWidget(varFileShell);    varFileShell = NULL;  }  return 0;}static void doVarFileDone(int get){  Widget source;  String string;  if (get) {  XtVaGetValues(varFileText,                XtNtextSource, &source,                XtNstring, &string,                NULL);  XawAsciiSave(source);  sendTaskPlanInit();  }  XtPopdown(varFileShell);  destroyVarFileShell();}// diagnostics dialogstatic Widget diagnosticsShell = NULL;static Widget diagnosticsForm = NULL;static Widget diagnosticsLabel = NULL;static Widget diagnosticsTaskHBLabel = NULL;static Widget diagnosticsTaskHB = NULL;static Widget diagnosticsIoHBLabel = NULL;static Widget diagnosticsIoHB = NULL;static Widget diagnosticsMotionHBLabel = NULL;static Widget diagnosticsMotionHB= NULL;static Widget diagnosticsFerrorLabel = NULL;static Widget diagnosticsFerror = NULL;static Widget diagnosticsDone = NULL;// flag that window is up, so we don't waste time updating labelsstatic int diagnosticsIsPopped = 0;static void diagnosticsDoDone(){  diagnosticsIsPopped = 0;  XtPopdown(diagnosticsShell);}static void diagnosticsDoneCB(Widget w, XtPointer client_data, XtPointer call_data){  diagnosticsDoDone();}static void diagnosticsReturnAction(Widget w, XEvent *event, String *params, Cardinal *num_params){  diagnosticsDoDone();}static Pixel fileOpenBorderColor;static int fileOpenDoDone = 1;static void doFileOpenDone(){  String string;  if (fileOpenDoDone) {    // note: "*value: " must be set in resources for input box    // to appear, and for this to be valid (and not dump core)    string = XawDialogGetValueString(fileOpenDialog);    // set value to be the same in file edit dialog    strcpy(EDITOR_FILE, string);    XtVaSetValues(fileEditDialog, XtNvalue, EDITOR_FILE, NULL);    sendProgramOpen(string);  }  setBorderColor(fileOpenDone, pixelRed);  setBorderColor(fileOpenCancel, fileOpenBorderColor);  fileOpenDoDone = 1;  XtPopdown(fileOpenShell);}static void fileOpenDoneCB(Widget w, XtPointer client_data, XtPointer call_data){  doFileOpenDone();}static void fileOpenReturnAction(Widget w, XEvent *event, String *params, Cardinal *num_params){  doFileOpenDone();}static void fileOpenTabAction(Widget w, XEvent *event, String *params, Cardinal *num_params){  if (fileOpenDoDone) {    setBorderColor(fileOpenDone, fileOpenBorderColor);    setBorderColor(fileOpenCancel, pixelRed);    fileOpenDoDone = 0;  }  else {    setBorderColor(fileOpenDone, pixelRed);    setBorderColor(fileOpenCancel, fileOpenBorderColor);    fileOpenDoDone = 1;  }}static Pixel fileQuitBorderColor;static int fileQuitDoDone = 1;static void doFileQuitDone(){  XtPopdown(fileQuitShell);  if (fileQuitDoDone) {    quit();  }  else {    setBorderColor(fileQuitDone, pixelRed);    setBorderColor(fileQuitCancel, fileQuitBorderColor);    fileQuitDoDone = 1;  }}static void fileQuitDoneCB(Widget w, XtPointer client_data, XtPointer call_data){  doFileQuitDone();}static void fileQuitReturnAction(Widget w, XEvent *event, String *params, Cardinal *num_params){  doFileQuitDone();}static void fileQuitTabAction(Widget w, XEvent *event, String *params, Cardinal *num_params){  if (fileQuitDoDone) {    setBorderColor(fileQuitDone, fileQuitBorderColor);    setBorderColor(fileQuitCancel, pixelRed);    fileQuitDoDone = 0;  }  else {    setBorderColor(fileQuitDone, pixelRed);    setBorderColor(fileQuitCancel, fileQuitBorderColor);    fileQuitDoDone = 1;  }}static Pixel fileEditBorderColor;static int fileEditDoDone = 1;static void doFileEditDone(){  String string;  struct stat buf;  int fd;  if (fileEditDoDone) {    string = XawDialogGetValueString(fileEditDialog);    // set value to be the same in file open dialog    strcpy(EDITOR_FILE, string);    XtVaSetValues(fileOpenDialog, XtNvalue, EDITOR_FILE, NULL);  }  XtPopdown(fileEditShell);  if (fileEditDoDone) {    if (-1 == stat(EDITOR_FILE, &buf)) {      // file not found-- it's a new one. Touch it so that it      // exists and the text widget won't barf      fd = open(EDITOR_FILE, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);      close(fd);      createFileEditorShell(1);      dialogPopup(NULL, fileEditorShell, NULL);      // trap window kill      XSetWMProtocols(XtDisplay(topLevel), XtWindow(fileEditorShell), &killAtom, 1);    }    else {      // file is there-- check type and permissions      if (! S_ISREG(buf.st_mode)) {        // file is not a regular file        popupError("Can't edit %S: not a text file", EDITOR_FILE);      }      else if ((S_IWUSR & buf.st_mode)) {        // file is writeable        createFileEditorShell(1);        dialogPopup(NULL, fileEditorShell, NULL);        // trap window kill        XSetWMProtocols(XtDisplay(topLevel), XtWindow(fileEditorShell), &killAtom, 1);      }      else {        // file is read-only        createFileEditorShell(0);        dialogPopup(NULL, fileEditorShell, NULL);        // trap window kill        XSetWMProtocols(XtDisplay(topLevel), XtWindow(fileEditorShell), &killAtom, 1);      }    }  }  setBorderColor(fileEditDone, pixelRed);  setBorderColor(fileEditCancel, fileEditBorderColor);  fileEditDoDone = 1;}static void fileEditDoneCB(Widget w, XtPointer client_data, XtPointer call_data){  doFileEditDone();}static void fileEditReturnAction(Widget w, XEvent *event, String *params, Cardinal *num_params){  doFileEditDone();}static void fileEditTabAction(Widget w, XEvent *event, String *params, Cardinal *num_params){  if (fileEditDoDone) {    setBorderColor(fileEditDone, fileEditBorderColor);    setBorderColor(fileEditCancel, pixelRed);    fileEditDoDone = 0;  }  else {    setBorderColor(fileEditDone, pixelRed);    setBorderColor(fileEditCancel, fileEditBorderColor);    fileEditDoDone = 1;  }}static void toolSetOffsetDoDone(int done){  String str1, str2, str3;  int tool;  double length;  double diameter;

⌨️ 快捷键说明

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