diff --git a/common/MappingChart/Debug/DieUI.obj b/common/MappingChart/Debug/DieUI.obj index 92fb397..1087681 100644 Binary files a/common/MappingChart/Debug/DieUI.obj and b/common/MappingChart/Debug/DieUI.obj differ diff --git a/common/MappingChart/Debug/GlobalDefine.obj b/common/MappingChart/Debug/GlobalDefine.obj index 626e12b..6de627b 100644 Binary files a/common/MappingChart/Debug/GlobalDefine.obj and b/common/MappingChart/Debug/GlobalDefine.obj differ diff --git a/common/MappingChart/Debug/MappingChart.Build.CppClean.log b/common/MappingChart/Debug/MappingChart.Build.CppClean.log new file mode 100644 index 0000000..030dac5 --- /dev/null +++ b/common/MappingChart/Debug/MappingChart.Build.CppClean.log @@ -0,0 +1,44 @@ +e:\wafermark\common\mappingchart\debug\myqgraphicsrectitem.obj +e:\wafermark\common\mappingchart\debug\myqgraphicslineitem.obj +e:\wafermark\common\mappingchart\debug\mappingui.obj +e:\wafermark\common\mappingchart\debug\myqgraphicstextitem.obj +e:\wafermark\common\mappingchart\debug\mydrawrectitem.obj +e:\wafermark\common\mappingchart\debug\mydierectitem.obj +e:\wafermark\common\mappingchart\debug\dieui.obj +e:\wafermark\common\mappingchart\debug\myqgraphicsellipseitem.obj +e:\wafermark\common\mappingchart\debug\globaldefine.obj +e:\wafermark\common\mappingchart\debug\vc140.pdb +e:\wafermark\common\mappingchart\debug\moc_mydierectitem.obj +e:\wafermark\common\mappingchart\debug\moc_myqgraphicsrectitem.obj +e:\wafermark\common\mappingchart\debug\moc_myqgraphicstextitem.obj +e:\wafermark\common\mappingchart\debug\moc_mydrawrectitem.obj +e:\wafermark\common\mappingchart\debug\moc_mappingui.obj +e:\wafermark\common\mappingchart\debug\moc_dieui.obj +e:\wafermark\common\mappingchart\debug\moc_myqgraphicslineitem.obj +e:\wafermark\common\mappingchart\debug\moc_myqgraphicsellipseitem.obj +e:\wafermark\code\wafermark\debug\mappingchart.ilk +e:\wafermark\code\wafermark\debug\mappingchart.dll +e:\wafermark\code\wafermark\debug\mappingchart.pdb +e:\wafermark\common\mappingchart\debug\uic\ui_dieui.h +e:\wafermark\common\mappingchart\debug\uic\ui_mappingui.h +e:\wafermark\common\mappingchart\debug\moc\moc_myqgraphicstextitem.cpp +e:\wafermark\common\mappingchart\debug\moc\moc_myqgraphicsellipseitem.cpp +e:\wafermark\common\mappingchart\debug\moc\moc_mydrawrectitem.cpp +e:\wafermark\common\mappingchart\debug\moc\moc_mydierectitem.cpp +e:\wafermark\common\mappingchart\debug\moc\moc_myqgraphicslineitem.cpp +e:\wafermark\common\mappingchart\debug\moc\moc_dieui.cpp +e:\wafermark\common\mappingchart\debug\moc\moc_myqgraphicsrectitem.cpp +e:\wafermark\common\mappingchart\debug\moc\moc_mappingui.cpp +e:\wafermark\code\wafermark\debug\mappingchart.lib +e:\wafermark\code\wafermark\debug\mappingchart.exp +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\cl.command.1.tlog +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\cl.read.1.tlog +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\cl.write.1.tlog +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\link.command.1.tlog +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\link.read.1.tlog +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\link.write.1.tlog +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\mappingchart.write.1u.tlog +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\moc.read.1u.tlog +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\moc.write.1u.tlog +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\uic.read.1u.tlog +e:\wafermark\common\mappingchart\debug\mappingchart.tlog\uic.write.1u.tlog diff --git a/common/MappingChart/Debug/MappingChart.log b/common/MappingChart/Debug/MappingChart.log index 030d09f..0070194 100644 --- a/common/MappingChart/Debug/MappingChart.log +++ b/common/MappingChart/Debug/MappingChart.log @@ -1,12 +1,31 @@ - MyDrawRectItem.cpp + Reading Qt configuration (D:/Qt/Qt5.9.9/5.9.9/msvc2015/bin/qmake) + uic DieUI.ui + uic MappingUI.ui + moc MyQGraphicsTextItem.h + moc MyQGraphicsEllipseItem.h + moc MyDrawRectItem.h + moc MyDieRectItem.h + moc MyQGraphicsLineItem.h + moc DieUI.h + moc MyQGraphicsRectItem.h + moc MappingUI.h + DieUI.cpp + GlobalDefine.cpp + MappingUI.cpp + MyDieRectItem.cpp + MyDrawRectItem.cpp + MyQGraphicsEllipseItem.cpp MyQGraphicsLineItem.cpp - moc_DieUI.cpp - moc_MappingUI.cpp - moc_MyDieRectItem.cpp - moc_MyDrawRectItem.cpp + MyQGraphicsRectItem.cpp + MyQGraphicsTextItem.cpp + moc_MyQGraphicsTextItem.cpp moc_MyQGraphicsEllipseItem.cpp + moc_MyDrawRectItem.cpp + moc_MyDieRectItem.cpp moc_MyQGraphicsLineItem.cpp + moc_DieUI.cpp moc_MyQGraphicsRectItem.cpp - moc_MyQGraphicsTextItem.cpp + moc_MappingUI.cpp + 正在创建库 E:\WaferMark\code\WaferMark\Debug\MappingChart.lib 和对象 E:\WaferMark\code\WaferMark\Debug\MappingChart.exp MappingChart.vcxproj -> E:\WaferMark\code\WaferMark\Debug\MappingChart.dll MappingChart.vcxproj -> E:\WaferMark\code\WaferMark\Debug\MappingChart.pdb (Full PDB) diff --git a/common/MappingChart/Debug/MappingChart.tlog/CL.command.1.tlog b/common/MappingChart/Debug/MappingChart.tlog/CL.command.1.tlog index 2f314d7..e4a030d 100644 Binary files a/common/MappingChart/Debug/MappingChart.tlog/CL.command.1.tlog and b/common/MappingChart/Debug/MappingChart.tlog/CL.command.1.tlog differ diff --git a/common/MappingChart/Debug/MappingChart.tlog/CL.read.1.tlog b/common/MappingChart/Debug/MappingChart.tlog/CL.read.1.tlog index c6409ac..16e7034 100644 Binary files a/common/MappingChart/Debug/MappingChart.tlog/CL.read.1.tlog and b/common/MappingChart/Debug/MappingChart.tlog/CL.read.1.tlog differ diff --git a/common/MappingChart/Debug/MappingChart.tlog/CL.write.1.tlog b/common/MappingChart/Debug/MappingChart.tlog/CL.write.1.tlog index 3804449..7e055e2 100644 Binary files a/common/MappingChart/Debug/MappingChart.tlog/CL.write.1.tlog and b/common/MappingChart/Debug/MappingChart.tlog/CL.write.1.tlog differ diff --git a/common/MappingChart/Debug/MappingChart.tlog/MappingChart.write.1u.tlog b/common/MappingChart/Debug/MappingChart.tlog/MappingChart.write.1u.tlog index dea0708..dff8cb4 100644 Binary files a/common/MappingChart/Debug/MappingChart.tlog/MappingChart.write.1u.tlog and b/common/MappingChart/Debug/MappingChart.tlog/MappingChart.write.1u.tlog differ diff --git a/common/MappingChart/Debug/MappingChart.tlog/link.read.1.tlog b/common/MappingChart/Debug/MappingChart.tlog/link.read.1.tlog index 7b78355..6837fd3 100644 Binary files a/common/MappingChart/Debug/MappingChart.tlog/link.read.1.tlog and b/common/MappingChart/Debug/MappingChart.tlog/link.read.1.tlog differ diff --git a/common/MappingChart/Debug/MappingUI.obj b/common/MappingChart/Debug/MappingUI.obj index f5d7745..8038aaf 100644 Binary files a/common/MappingChart/Debug/MappingUI.obj and b/common/MappingChart/Debug/MappingUI.obj differ diff --git a/common/MappingChart/Debug/MyDieRectItem.obj b/common/MappingChart/Debug/MyDieRectItem.obj index 8e1aff4..cf9ad32 100644 Binary files a/common/MappingChart/Debug/MyDieRectItem.obj and b/common/MappingChart/Debug/MyDieRectItem.obj differ diff --git a/common/MappingChart/Debug/MyDrawRectItem.obj b/common/MappingChart/Debug/MyDrawRectItem.obj index a2bacf6..6d7155a 100644 Binary files a/common/MappingChart/Debug/MyDrawRectItem.obj and b/common/MappingChart/Debug/MyDrawRectItem.obj differ diff --git a/common/MappingChart/Debug/MyQGraphicsEllipseItem.obj b/common/MappingChart/Debug/MyQGraphicsEllipseItem.obj index 83bd05f..0fe3cab 100644 Binary files a/common/MappingChart/Debug/MyQGraphicsEllipseItem.obj and b/common/MappingChart/Debug/MyQGraphicsEllipseItem.obj differ diff --git a/common/MappingChart/Debug/MyQGraphicsLineItem.obj b/common/MappingChart/Debug/MyQGraphicsLineItem.obj index 5008caf..fb02941 100644 Binary files a/common/MappingChart/Debug/MyQGraphicsLineItem.obj and b/common/MappingChart/Debug/MyQGraphicsLineItem.obj differ diff --git a/common/MappingChart/Debug/MyQGraphicsRectItem.obj b/common/MappingChart/Debug/MyQGraphicsRectItem.obj index ce8ced4..73b20d8 100644 Binary files a/common/MappingChart/Debug/MyQGraphicsRectItem.obj and b/common/MappingChart/Debug/MyQGraphicsRectItem.obj differ diff --git a/common/MappingChart/Debug/MyQGraphicsTextItem.obj b/common/MappingChart/Debug/MyQGraphicsTextItem.obj index 86f7674..514ae35 100644 Binary files a/common/MappingChart/Debug/MyQGraphicsTextItem.obj and b/common/MappingChart/Debug/MyQGraphicsTextItem.obj differ diff --git a/common/MappingChart/Debug/moc_DieUI.obj b/common/MappingChart/Debug/moc_DieUI.obj index a8cd4f4..9633c83 100644 Binary files a/common/MappingChart/Debug/moc_DieUI.obj and b/common/MappingChart/Debug/moc_DieUI.obj differ diff --git a/common/MappingChart/Debug/moc_MappingUI.obj b/common/MappingChart/Debug/moc_MappingUI.obj index 98232ee..60652ce 100644 Binary files a/common/MappingChart/Debug/moc_MappingUI.obj and b/common/MappingChart/Debug/moc_MappingUI.obj differ diff --git a/common/MappingChart/Debug/moc_MyDieRectItem.obj b/common/MappingChart/Debug/moc_MyDieRectItem.obj index 89260ea..e88df64 100644 Binary files a/common/MappingChart/Debug/moc_MyDieRectItem.obj and b/common/MappingChart/Debug/moc_MyDieRectItem.obj differ diff --git a/common/MappingChart/Debug/moc_MyDrawRectItem.obj b/common/MappingChart/Debug/moc_MyDrawRectItem.obj index 292ce95..c73f551 100644 Binary files a/common/MappingChart/Debug/moc_MyDrawRectItem.obj and b/common/MappingChart/Debug/moc_MyDrawRectItem.obj differ diff --git a/common/MappingChart/Debug/moc_MyQGraphicsEllipseItem.obj b/common/MappingChart/Debug/moc_MyQGraphicsEllipseItem.obj index efb6234..00a4a1d 100644 Binary files a/common/MappingChart/Debug/moc_MyQGraphicsEllipseItem.obj and b/common/MappingChart/Debug/moc_MyQGraphicsEllipseItem.obj differ diff --git a/common/MappingChart/Debug/moc_MyQGraphicsLineItem.obj b/common/MappingChart/Debug/moc_MyQGraphicsLineItem.obj index ca5776f..967c867 100644 Binary files a/common/MappingChart/Debug/moc_MyQGraphicsLineItem.obj and b/common/MappingChart/Debug/moc_MyQGraphicsLineItem.obj differ diff --git a/common/MappingChart/Debug/moc_MyQGraphicsRectItem.obj b/common/MappingChart/Debug/moc_MyQGraphicsRectItem.obj index 0d9769e..bed259c 100644 Binary files a/common/MappingChart/Debug/moc_MyQGraphicsRectItem.obj and b/common/MappingChart/Debug/moc_MyQGraphicsRectItem.obj differ diff --git a/common/MappingChart/Debug/moc_MyQGraphicsTextItem.obj b/common/MappingChart/Debug/moc_MyQGraphicsTextItem.obj index f3ed5b6..7c8fad9 100644 Binary files a/common/MappingChart/Debug/moc_MyQGraphicsTextItem.obj and b/common/MappingChart/Debug/moc_MyQGraphicsTextItem.obj differ diff --git a/common/MappingChart/Debug/qt_work.log b/common/MappingChart/Debug/qt_work.log index 4f65dae..f2973c2 100644 Binary files a/common/MappingChart/Debug/qt_work.log and b/common/MappingChart/Debug/qt_work.log differ diff --git a/common/MappingChart/Debug/uic/ui_DieUI.h b/common/MappingChart/Debug/uic/ui_DieUI.h index ca0e90e..5d4211f 100644 --- a/common/MappingChart/Debug/uic/ui_DieUI.h +++ b/common/MappingChart/Debug/uic/ui_DieUI.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -29,14 +30,15 @@ QT_BEGIN_NAMESPACE class Ui_DieUI { public: - QHBoxLayout *horizontalLayout_3; - QHBoxLayout *horizontalLayout; + QVBoxLayout *verticalLayout_3; QVBoxLayout *verticalLayout; - QPushButton *pushButton_text; - QPushButton *pushButton_rect; + QHBoxLayout *horizontalLayout; + QPushButton *pushButton_circle; QPushButton *pushButton_line; + QPushButton *pushButton_rect; + QPushButton *pushButton_text; QPushButton *pushButton_none; - QPushButton *pushButton_circle; + QSpacerItem *horizontalSpacer; QHBoxLayout *horizontalLayout_2; QGraphicsView *graphicsView; QVBoxLayout *verticalLayout_2; @@ -45,19 +47,16 @@ public: QLabel *label_5; QLineEdit *lineEdit_lineP1Y; QLabel *label_20; - QLabel *label_17; - QLabel *label_2; QLineEdit *lineEdit_lineP2X; QPushButton *pushButton_setLine; QLineEdit *lineEdit_lineId; QLineEdit *lineEdit_lineP2Y; QLabel *label_3; QLineEdit *lineEdit_lineP1X; + QLabel *label_2; QGridLayout *gridLayout_2; QLineEdit *lineEdit_rectHeight; - QLabel *label_7; QLabel *label_23; - QLabel *label_18; QLineEdit *lineEdit_rectAngle; QLineEdit *lineEdit_rectId; QLabel *label_22; @@ -68,10 +67,9 @@ public: QLabel *label_10; QLineEdit *lineEdit_rectY; QPushButton *pushButton_setRect; + QLabel *label_7; QGridLayout *gridLayout_3; QLineEdit *lineEdit_dia; - QLabel *label_19; - QLabel *label_12; QLineEdit *lineEdit_circleId; QLabel *label_16; QLabel *label_13; @@ -79,72 +77,91 @@ public: QLabel *label_15; QLineEdit *lineEdit_circleY; QPushButton *pushButton_setCircle; + QLabel *label_12; QGridLayout *gridLayout_4; - QLabel *label_6; QLineEdit *lineEdit_charX; + QLabel *label_6; + QLineEdit *lineEdit_charId; QPushButton *pushButton_deleteChar; QLineEdit *lineEdit_charWidth; - QLineEdit *lineEdit_charId; - QLabel *label_27; QLabel *label_4; - QLineEdit *lineEdit_charY; - QLabel *label_14; - QLabel *label_24; QLabel *label_9; + QLabel *label_14; QLabel *label_25; + QLineEdit *lineEdit_charY; QLineEdit *lineEdit_charHeight; QLineEdit *lineEdit_charContent; QPushButton *pushButton_addText; QSpacerItem *verticalSpacer; + QLabel *label; + QComboBox *comboBox; + QLabel *label_27; void setupUi(QWidget *DieUI) { if (DieUI->objectName().isEmpty()) DieUI->setObjectName(QStringLiteral("DieUI")); - DieUI->resize(1865, 1275); - horizontalLayout_3 = new QHBoxLayout(DieUI); - horizontalLayout_3->setSpacing(6); - horizontalLayout_3->setContentsMargins(11, 11, 11, 11); - horizontalLayout_3->setObjectName(QStringLiteral("horizontalLayout_3")); - horizontalLayout = new QHBoxLayout(); - horizontalLayout->setSpacing(6); - horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); + DieUI->resize(1263, 1101); + verticalLayout_3 = new QVBoxLayout(DieUI); + verticalLayout_3->setSpacing(6); + verticalLayout_3->setContentsMargins(11, 11, 11, 11); + verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); verticalLayout = new QVBoxLayout(); verticalLayout->setSpacing(6); verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - pushButton_text = new QPushButton(DieUI); - pushButton_text->setObjectName(QStringLiteral("pushButton_text")); - pushButton_text->setMaximumSize(QSize(50, 50)); + horizontalLayout = new QHBoxLayout(); + horizontalLayout->setSpacing(15); + horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); + pushButton_circle = new QPushButton(DieUI); + pushButton_circle->setObjectName(QStringLiteral("pushButton_circle")); + pushButton_circle->setMinimumSize(QSize(70, 50)); + pushButton_circle->setMaximumSize(QSize(50, 50)); + QFont font; + font.setPointSize(13); + font.setBold(true); + font.setWeight(75); + pushButton_circle->setFont(font); + + horizontalLayout->addWidget(pushButton_circle); - verticalLayout->addWidget(pushButton_text); + pushButton_line = new QPushButton(DieUI); + pushButton_line->setObjectName(QStringLiteral("pushButton_line")); + pushButton_line->setMinimumSize(QSize(70, 50)); + pushButton_line->setMaximumSize(QSize(50, 50)); + pushButton_line->setFont(font); + + horizontalLayout->addWidget(pushButton_line); pushButton_rect = new QPushButton(DieUI); pushButton_rect->setObjectName(QStringLiteral("pushButton_rect")); + pushButton_rect->setMinimumSize(QSize(70, 50)); pushButton_rect->setMaximumSize(QSize(50, 50)); + pushButton_rect->setFont(font); - verticalLayout->addWidget(pushButton_rect); + horizontalLayout->addWidget(pushButton_rect); - pushButton_line = new QPushButton(DieUI); - pushButton_line->setObjectName(QStringLiteral("pushButton_line")); - pushButton_line->setMaximumSize(QSize(50, 50)); + pushButton_text = new QPushButton(DieUI); + pushButton_text->setObjectName(QStringLiteral("pushButton_text")); + pushButton_text->setMinimumSize(QSize(70, 50)); + pushButton_text->setMaximumSize(QSize(50, 50)); + pushButton_text->setFont(font); - verticalLayout->addWidget(pushButton_line); + horizontalLayout->addWidget(pushButton_text); pushButton_none = new QPushButton(DieUI); pushButton_none->setObjectName(QStringLiteral("pushButton_none")); + pushButton_none->setMinimumSize(QSize(70, 50)); pushButton_none->setMaximumSize(QSize(50, 50)); + pushButton_none->setFont(font); - verticalLayout->addWidget(pushButton_none); + horizontalLayout->addWidget(pushButton_none); - pushButton_circle = new QPushButton(DieUI); - pushButton_circle->setObjectName(QStringLiteral("pushButton_circle")); - pushButton_circle->setMinimumSize(QSize(50, 0)); - pushButton_circle->setMaximumSize(QSize(50, 50)); + horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - verticalLayout->addWidget(pushButton_circle); + horizontalLayout->addItem(horizontalSpacer); - horizontalLayout->addLayout(verticalLayout); + verticalLayout->addLayout(horizontalLayout); horizontalLayout_2 = new QHBoxLayout(); horizontalLayout_2->setSpacing(6); @@ -156,10 +173,16 @@ public: horizontalLayout_2->addWidget(graphicsView); verticalLayout_2 = new QVBoxLayout(); - verticalLayout_2->setSpacing(6); + verticalLayout_2->setSpacing(20); verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); pushButton_ensure = new QPushButton(DieUI); pushButton_ensure->setObjectName(QStringLiteral("pushButton_ensure")); + pushButton_ensure->setMinimumSize(QSize(0, 60)); + QFont font1; + font1.setPointSize(15); + font1.setBold(true); + font1.setWeight(75); + pushButton_ensure->setFont(font1); verticalLayout_2->addWidget(pushButton_ensure); @@ -168,6 +191,10 @@ public: gridLayout->setObjectName(QStringLiteral("gridLayout")); label_5 = new QLabel(DieUI); label_5->setObjectName(QStringLiteral("label_5")); + QFont font2; + font2.setBold(true); + font2.setWeight(75); + label_5->setFont(font2); gridLayout->addWidget(label_5, 5, 0, 1, 1); @@ -178,19 +205,10 @@ public: label_20 = new QLabel(DieUI); label_20->setObjectName(QStringLiteral("label_20")); + label_20->setFont(font2); gridLayout->addWidget(label_20, 1, 0, 1, 1); - label_17 = new QLabel(DieUI); - label_17->setObjectName(QStringLiteral("label_17")); - - gridLayout->addWidget(label_17, 0, 0, 1, 1); - - label_2 = new QLabel(DieUI); - label_2->setObjectName(QStringLiteral("label_2")); - - gridLayout->addWidget(label_2, 0, 1, 1, 2); - lineEdit_lineP2X = new QLineEdit(DieUI); lineEdit_lineP2X->setObjectName(QStringLiteral("lineEdit_lineP2X")); @@ -198,6 +216,8 @@ public: pushButton_setLine = new QPushButton(DieUI); pushButton_setLine->setObjectName(QStringLiteral("pushButton_setLine")); + pushButton_setLine->setMinimumSize(QSize(0, 30)); + pushButton_setLine->setFont(font2); gridLayout->addWidget(pushButton_setLine, 6, 1, 1, 2); @@ -213,6 +233,7 @@ public: label_3 = new QLabel(DieUI); label_3->setObjectName(QStringLiteral("label_3")); + label_3->setFont(font2); gridLayout->addWidget(label_3, 3, 0, 1, 1); @@ -221,6 +242,19 @@ public: gridLayout->addWidget(lineEdit_lineP1X, 3, 1, 1, 1); + label_2 = new QLabel(DieUI); + label_2->setObjectName(QStringLiteral("label_2")); + label_2->setMinimumSize(QSize(50, 0)); + QFont font3; + font3.setPointSize(14); + font3.setBold(true); + font3.setWeight(75); + label_2->setFont(font3); + label_2->setStyleSheet(QStringLiteral("background-color: rgb(105, 127, 255);")); + label_2->setAlignment(Qt::AlignCenter); + + gridLayout->addWidget(label_2, 0, 0, 1, 3); + gridLayout->setColumnStretch(0, 1); verticalLayout_2->addLayout(gridLayout); @@ -233,21 +267,12 @@ public: gridLayout_2->addWidget(lineEdit_rectHeight, 4, 1, 1, 1); - label_7 = new QLabel(DieUI); - label_7->setObjectName(QStringLiteral("label_7")); - - gridLayout_2->addWidget(label_7, 0, 1, 1, 1); - label_23 = new QLabel(DieUI); label_23->setObjectName(QStringLiteral("label_23")); + label_23->setFont(font2); gridLayout_2->addWidget(label_23, 5, 0, 1, 1); - label_18 = new QLabel(DieUI); - label_18->setObjectName(QStringLiteral("label_18")); - - gridLayout_2->addWidget(label_18, 0, 0, 1, 1); - lineEdit_rectAngle = new QLineEdit(DieUI); lineEdit_rectAngle->setObjectName(QStringLiteral("lineEdit_rectAngle")); @@ -260,6 +285,7 @@ public: label_22 = new QLabel(DieUI); label_22->setObjectName(QStringLiteral("label_22")); + label_22->setFont(font2); gridLayout_2->addWidget(label_22, 1, 0, 1, 1); @@ -270,6 +296,7 @@ public: label_8 = new QLabel(DieUI); label_8->setObjectName(QStringLiteral("label_8")); + label_8->setFont(font2); gridLayout_2->addWidget(label_8, 2, 0, 1, 1); @@ -280,11 +307,13 @@ public: label_11 = new QLabel(DieUI); label_11->setObjectName(QStringLiteral("label_11")); + label_11->setFont(font2); gridLayout_2->addWidget(label_11, 4, 0, 1, 1); label_10 = new QLabel(DieUI); label_10->setObjectName(QStringLiteral("label_10")); + label_10->setFont(font2); gridLayout_2->addWidget(label_10, 3, 0, 1, 1); @@ -295,9 +324,20 @@ public: pushButton_setRect = new QPushButton(DieUI); pushButton_setRect->setObjectName(QStringLiteral("pushButton_setRect")); + pushButton_setRect->setMinimumSize(QSize(0, 30)); + pushButton_setRect->setFont(font2); gridLayout_2->addWidget(pushButton_setRect, 6, 1, 1, 2); + label_7 = new QLabel(DieUI); + label_7->setObjectName(QStringLiteral("label_7")); + label_7->setMinimumSize(QSize(50, 0)); + label_7->setFont(font3); + label_7->setStyleSheet(QStringLiteral("background-color: rgb(105, 127, 255);")); + label_7->setAlignment(Qt::AlignCenter); + + gridLayout_2->addWidget(label_7, 0, 0, 1, 3); + gridLayout_2->setColumnStretch(0, 1); verticalLayout_2->addLayout(gridLayout_2); @@ -310,16 +350,6 @@ public: gridLayout_3->addWidget(lineEdit_dia, 3, 1, 1, 1); - label_19 = new QLabel(DieUI); - label_19->setObjectName(QStringLiteral("label_19")); - - gridLayout_3->addWidget(label_19, 0, 0, 1, 1); - - label_12 = new QLabel(DieUI); - label_12->setObjectName(QStringLiteral("label_12")); - - gridLayout_3->addWidget(label_12, 0, 1, 1, 1); - lineEdit_circleId = new QLineEdit(DieUI); lineEdit_circleId->setObjectName(QStringLiteral("lineEdit_circleId")); @@ -327,11 +357,13 @@ public: label_16 = new QLabel(DieUI); label_16->setObjectName(QStringLiteral("label_16")); + label_16->setFont(font2); gridLayout_3->addWidget(label_16, 1, 0, 1, 1); label_13 = new QLabel(DieUI); label_13->setObjectName(QStringLiteral("label_13")); + label_13->setFont(font2); gridLayout_3->addWidget(label_13, 2, 0, 1, 1); @@ -342,6 +374,7 @@ public: label_15 = new QLabel(DieUI); label_15->setObjectName(QStringLiteral("label_15")); + label_15->setFont(font2); gridLayout_3->addWidget(label_15, 3, 0, 1, 1); @@ -352,9 +385,20 @@ public: pushButton_setCircle = new QPushButton(DieUI); pushButton_setCircle->setObjectName(QStringLiteral("pushButton_setCircle")); + pushButton_setCircle->setMinimumSize(QSize(0, 30)); + pushButton_setCircle->setFont(font2); gridLayout_3->addWidget(pushButton_setCircle, 4, 1, 1, 2); + label_12 = new QLabel(DieUI); + label_12->setObjectName(QStringLiteral("label_12")); + label_12->setMinimumSize(QSize(50, 0)); + label_12->setFont(font3); + label_12->setStyleSheet(QStringLiteral("background-color: rgb(105, 127, 255);")); + label_12->setAlignment(Qt::AlignCenter); + + gridLayout_3->addWidget(label_12, 0, 0, 1, 3); + verticalLayout_2->addLayout(gridLayout_3); @@ -362,84 +406,104 @@ public: gridLayout_4->setSpacing(6); gridLayout_4->setObjectName(QStringLiteral("gridLayout_4")); gridLayout_4->setContentsMargins(-1, -1, -1, 0); + lineEdit_charX = new QLineEdit(DieUI); + lineEdit_charX->setObjectName(QStringLiteral("lineEdit_charX")); + + gridLayout_4->addWidget(lineEdit_charX, 5, 1, 1, 1); + label_6 = new QLabel(DieUI); label_6->setObjectName(QStringLiteral("label_6")); + label_6->setFont(font2); - gridLayout_4->addWidget(label_6, 4, 0, 1, 1); + gridLayout_4->addWidget(label_6, 6, 0, 1, 1); - lineEdit_charX = new QLineEdit(DieUI); - lineEdit_charX->setObjectName(QStringLiteral("lineEdit_charX")); + lineEdit_charId = new QLineEdit(DieUI); + lineEdit_charId->setObjectName(QStringLiteral("lineEdit_charId")); - gridLayout_4->addWidget(lineEdit_charX, 3, 1, 1, 1); + gridLayout_4->addWidget(lineEdit_charId, 2, 1, 1, 1); pushButton_deleteChar = new QPushButton(DieUI); pushButton_deleteChar->setObjectName(QStringLiteral("pushButton_deleteChar")); + pushButton_deleteChar->setMinimumSize(QSize(0, 30)); + pushButton_deleteChar->setFont(font2); - gridLayout_4->addWidget(pushButton_deleteChar, 6, 1, 1, 2); + gridLayout_4->addWidget(pushButton_deleteChar, 8, 1, 1, 2); lineEdit_charWidth = new QLineEdit(DieUI); lineEdit_charWidth->setObjectName(QStringLiteral("lineEdit_charWidth")); - gridLayout_4->addWidget(lineEdit_charWidth, 4, 1, 1, 1); - - lineEdit_charId = new QLineEdit(DieUI); - lineEdit_charId->setObjectName(QStringLiteral("lineEdit_charId")); - - gridLayout_4->addWidget(lineEdit_charId, 1, 1, 1, 1); - - label_27 = new QLabel(DieUI); - label_27->setObjectName(QStringLiteral("label_27")); - - gridLayout_4->addWidget(label_27, 0, 1, 1, 1); + gridLayout_4->addWidget(lineEdit_charWidth, 6, 1, 1, 1); label_4 = new QLabel(DieUI); label_4->setObjectName(QStringLiteral("label_4")); + label_4->setFont(font2); - gridLayout_4->addWidget(label_4, 3, 0, 1, 1); + gridLayout_4->addWidget(label_4, 5, 0, 1, 1); - lineEdit_charY = new QLineEdit(DieUI); - lineEdit_charY->setObjectName(QStringLiteral("lineEdit_charY")); + label_9 = new QLabel(DieUI); + label_9->setObjectName(QStringLiteral("label_9")); + label_9->setFont(font2); - gridLayout_4->addWidget(lineEdit_charY, 3, 2, 1, 1); + gridLayout_4->addWidget(label_9, 7, 0, 1, 1); label_14 = new QLabel(DieUI); label_14->setObjectName(QStringLiteral("label_14")); + label_14->setFont(font2); - gridLayout_4->addWidget(label_14, 2, 0, 1, 1); - - label_24 = new QLabel(DieUI); - label_24->setObjectName(QStringLiteral("label_24")); - - gridLayout_4->addWidget(label_24, 0, 0, 1, 1); - - label_9 = new QLabel(DieUI); - label_9->setObjectName(QStringLiteral("label_9")); - - gridLayout_4->addWidget(label_9, 5, 0, 1, 1); + gridLayout_4->addWidget(label_14, 4, 0, 1, 1); label_25 = new QLabel(DieUI); label_25->setObjectName(QStringLiteral("label_25")); + label_25->setFont(font2); + + gridLayout_4->addWidget(label_25, 2, 0, 1, 1); + + lineEdit_charY = new QLineEdit(DieUI); + lineEdit_charY->setObjectName(QStringLiteral("lineEdit_charY")); - gridLayout_4->addWidget(label_25, 1, 0, 1, 1); + gridLayout_4->addWidget(lineEdit_charY, 5, 2, 1, 1); lineEdit_charHeight = new QLineEdit(DieUI); lineEdit_charHeight->setObjectName(QStringLiteral("lineEdit_charHeight")); - gridLayout_4->addWidget(lineEdit_charHeight, 5, 1, 1, 1); + gridLayout_4->addWidget(lineEdit_charHeight, 7, 1, 1, 1); lineEdit_charContent = new QLineEdit(DieUI); lineEdit_charContent->setObjectName(QStringLiteral("lineEdit_charContent")); - gridLayout_4->addWidget(lineEdit_charContent, 2, 1, 1, 1); + gridLayout_4->addWidget(lineEdit_charContent, 4, 1, 1, 1); pushButton_addText = new QPushButton(DieUI); pushButton_addText->setObjectName(QStringLiteral("pushButton_addText")); + pushButton_addText->setMinimumSize(QSize(0, 30)); + pushButton_addText->setFont(font2); - gridLayout_4->addWidget(pushButton_addText, 6, 0, 1, 1); + gridLayout_4->addWidget(pushButton_addText, 8, 0, 1, 1); verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); - gridLayout_4->addItem(verticalSpacer, 7, 0, 1, 1); + gridLayout_4->addItem(verticalSpacer, 9, 0, 1, 1); + + label = new QLabel(DieUI); + label->setObjectName(QStringLiteral("label")); + label->setFont(font2); + + gridLayout_4->addWidget(label, 1, 0, 1, 1); + + comboBox = new QComboBox(DieUI); + comboBox->setObjectName(QStringLiteral("comboBox")); + comboBox->setMinimumSize(QSize(0, 30)); + + gridLayout_4->addWidget(comboBox, 1, 1, 1, 2); + + label_27 = new QLabel(DieUI); + label_27->setObjectName(QStringLiteral("label_27")); + label_27->setMinimumSize(QSize(50, 0)); + label_27->setFont(font3); + label_27->setStyleSheet(QStringLiteral("background-color: rgb(105, 127, 255);")); + label_27->setAlignment(Qt::AlignCenter); + + gridLayout_4->addWidget(label_27, 0, 0, 1, 3); verticalLayout_2->addLayout(gridLayout_4); @@ -450,10 +514,10 @@ public: horizontalLayout_2->setStretch(0, 8); horizontalLayout_2->setStretch(1, 2); - horizontalLayout->addLayout(horizontalLayout_2); + verticalLayout->addLayout(horizontalLayout_2); - horizontalLayout_3->addLayout(horizontalLayout); + verticalLayout_3->addLayout(verticalLayout); retranslateUi(DieUI); @@ -464,41 +528,38 @@ public: void retranslateUi(QWidget *DieUI) { DieUI->setWindowTitle(QApplication::translate("DieUI", "DieUI", Q_NULLPTR)); - pushButton_text->setText(QApplication::translate("DieUI", "\345\255\227\347\254\246", Q_NULLPTR)); - pushButton_rect->setText(QApplication::translate("DieUI", "\347\237\251\345\275\242", Q_NULLPTR)); + pushButton_circle->setText(QApplication::translate("DieUI", "\345\234\206", Q_NULLPTR)); pushButton_line->setText(QApplication::translate("DieUI", "\347\272\277\346\256\265", Q_NULLPTR)); + pushButton_rect->setText(QApplication::translate("DieUI", "\347\237\251\345\275\242", Q_NULLPTR)); + pushButton_text->setText(QApplication::translate("DieUI", "\345\255\227\347\254\246", Q_NULLPTR)); pushButton_none->setText(QApplication::translate("DieUI", "\345\217\226\346\266\210", Q_NULLPTR)); - pushButton_circle->setText(QApplication::translate("DieUI", "\345\234\206", Q_NULLPTR)); pushButton_ensure->setText(QApplication::translate("DieUI", "\347\241\256\350\256\244", Q_NULLPTR)); label_5->setText(QApplication::translate("DieUI", "\347\254\254\344\272\214\344\270\252\347\202\271(X,Y)", Q_NULLPTR)); label_20->setText(QApplication::translate("DieUI", "ID", Q_NULLPTR)); - label_17->setText(QApplication::translate("DieUI", "\345\233\276\346\240\207", Q_NULLPTR)); - label_2->setText(QApplication::translate("DieUI", "\347\272\277\346\256\265", Q_NULLPTR)); pushButton_setLine->setText(QApplication::translate("DieUI", "\350\256\276\347\275\256", Q_NULLPTR)); label_3->setText(QApplication::translate("DieUI", "\347\254\254\344\270\200\344\270\252\347\202\271(X,Y)", Q_NULLPTR)); - label_7->setText(QApplication::translate("DieUI", "\347\237\251\345\275\242", Q_NULLPTR)); + label_2->setText(QApplication::translate("DieUI", "\347\272\277\346\256\265", Q_NULLPTR)); label_23->setText(QApplication::translate("DieUI", "\350\247\222\345\272\246", Q_NULLPTR)); - label_18->setText(QApplication::translate("DieUI", "\345\233\276\346\240\207", Q_NULLPTR)); label_22->setText(QApplication::translate("DieUI", "ID", Q_NULLPTR)); label_8->setText(QApplication::translate("DieUI", "\345\237\272 \345\207\206 \347\202\271(X,Y)", Q_NULLPTR)); label_11->setText(QApplication::translate("DieUI", "\347\237\251\345\275\242\351\253\230", Q_NULLPTR)); label_10->setText(QApplication::translate("DieUI", "\347\237\251\345\275\242\345\256\275", Q_NULLPTR)); pushButton_setRect->setText(QApplication::translate("DieUI", "\350\256\276\347\275\256", Q_NULLPTR)); - label_19->setText(QApplication::translate("DieUI", "\345\233\276\346\240\207", Q_NULLPTR)); - label_12->setText(QApplication::translate("DieUI", "\345\234\206", Q_NULLPTR)); + label_7->setText(QApplication::translate("DieUI", "\347\237\251\345\275\242", Q_NULLPTR)); label_16->setText(QApplication::translate("DieUI", "ID", Q_NULLPTR)); label_13->setText(QApplication::translate("DieUI", "\345\237\272 \345\207\206 \347\202\271(X,Y)", Q_NULLPTR)); label_15->setText(QApplication::translate("DieUI", "\347\233\264\345\276\204", Q_NULLPTR)); pushButton_setCircle->setText(QApplication::translate("DieUI", "\350\256\276\347\275\256", Q_NULLPTR)); + label_12->setText(QApplication::translate("DieUI", "\345\234\206", Q_NULLPTR)); label_6->setText(QApplication::translate("DieUI", "\345\256\275(mm)", Q_NULLPTR)); pushButton_deleteChar->setText(QApplication::translate("DieUI", "\345\210\240\351\231\244", Q_NULLPTR)); - label_27->setText(QApplication::translate("DieUI", "\345\255\227\347\254\246", Q_NULLPTR)); label_4->setText(QApplication::translate("DieUI", "\345\237\272 \345\207\206 \347\202\271(X,Y)(mm)", Q_NULLPTR)); - label_14->setText(QApplication::translate("DieUI", "\345\255\227\347\254\246", Q_NULLPTR)); - label_24->setText(QApplication::translate("DieUI", "\345\233\276\346\240\207", Q_NULLPTR)); label_9->setText(QApplication::translate("DieUI", "\351\253\230(mm)", Q_NULLPTR)); + label_14->setText(QApplication::translate("DieUI", "\345\255\227\347\254\246", Q_NULLPTR)); label_25->setText(QApplication::translate("DieUI", "ID", Q_NULLPTR)); pushButton_addText->setText(QApplication::translate("DieUI", "\346\267\273\345\212\240", Q_NULLPTR)); + label->setText(QApplication::translate("DieUI", "\345\255\227\344\275\223\351\200\211\346\213\251", Q_NULLPTR)); + label_27->setText(QApplication::translate("DieUI", "\345\255\227\347\254\246", Q_NULLPTR)); } // retranslateUi }; diff --git a/common/MappingChart/Debug/uic/ui_MappingUI.h b/common/MappingChart/Debug/uic/ui_MappingUI.h index 52e1ad0..91b8abb 100644 --- a/common/MappingChart/Debug/uic/ui_MappingUI.h +++ b/common/MappingChart/Debug/uic/ui_MappingUI.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,7 @@ public: QHBoxLayout *horizontalLayout; QLabel *label_2; QLabel *label; + QSpacerItem *horizontalSpacer; QGraphicsView *graphicsView; void setupUi(QWidget *MappingUI) @@ -45,21 +47,32 @@ public: verticalLayout->setSpacing(6); verticalLayout->setObjectName(QStringLiteral("verticalLayout")); horizontalLayout = new QHBoxLayout(); - horizontalLayout->setSpacing(6); + horizontalLayout->setSpacing(30); horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); label_2 = new QLabel(MappingUI); label_2->setObjectName(QStringLiteral("label_2")); + label_2->setMaximumSize(QSize(16777215, 50)); + QFont font; + font.setPointSize(13); + font.setBold(true); + font.setWeight(75); + label_2->setFont(font); horizontalLayout->addWidget(label_2); label = new QLabel(MappingUI); label->setObjectName(QStringLiteral("label")); - QFont font; - font.setPointSize(14); - label->setFont(font); + label->setMaximumSize(QSize(16777215, 50)); + QFont font1; + font1.setPointSize(13); + label->setFont(font1); horizontalLayout->addWidget(label); + horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout->addItem(horizontalSpacer); + verticalLayout->addLayout(horizontalLayout); diff --git a/common/MappingChart/Debug/vc140.pdb b/common/MappingChart/Debug/vc140.pdb index 282bd91..1c3078d 100644 Binary files a/common/MappingChart/Debug/vc140.pdb and b/common/MappingChart/Debug/vc140.pdb differ diff --git a/common/MappingChart/DieUI.cpp b/common/MappingChart/DieUI.cpp index e6a8574..ae76da6 100644 --- a/common/MappingChart/DieUI.cpp +++ b/common/MappingChart/DieUI.cpp @@ -18,10 +18,31 @@ DieUI::DieUI(QWidget *parent) connect(ui.pushButton_deleteChar, SIGNAL(clicked()), this, SLOT(slot_deleteText())); connect(ui.pushButton_ensure, SIGNAL(clicked()), this, SLOT(slot_sendEditEnd())); - + + // ʽֺС㣬С㿪ͷ + QRegExp regExp("[0-9]*\\.?[0-9]+"); + QValidator *validator = new QRegExpValidator(regExp, this); + ui.lineEdit_charWidth->setValidator(validator); + ui.lineEdit_charHeight->setValidator(validator); + ui.lineEdit_charX->setValidator(validator); + ui.lineEdit_charY->setValidator(validator); + + QRegExp regExp3("[a-zA-Z0-9_]{1}"); //ֻһַ + /*ui.lineEdit_charContent->setValidator(new QRegExpValidator(regExp2, ui.lineEdit_charContent)); + QValidator *validator = new QRegExpValidator(regExp3, this);*/ + QValidator *validator2 = new QRegExpValidator(regExp3, this); + ui.lineEdit_charContent->setValidator(validator2); m_pen.setColor(RECT_COLOR); m_pen.setWidth(4); + + //QStringList stringList; + //stringList << "Arial.sl" << "SENI-ksht.sl" << "Simplex1_2MEIGUO.sl"; // б + //QStringListModel *model = new QStringListModel(); + //model->setStringList(stringList); + //ui.comboBox->setModel(model); + //ui.comboBox->setCurrentIndex(0); + //m_curFontType.clear(); } DieUI::~DieUI() @@ -269,6 +290,32 @@ void DieUI::AddText(double x1, double y1) void DieUI::slot_addText() { + if (!(ui.lineEdit_charWidth->text().toDouble() >= 0.08 && ui.lineEdit_charWidth->text().toDouble() <= m_dieWidth && + ui.lineEdit_charHeight->text().toDouble() >= 0.12 && ui.lineEdit_charHeight->text().toDouble() <= m_dieHeight)) + { + QMessageBox::StandardButton button = QMessageBox::information( + nullptr, + QString::fromLocal8Bit("ʾ"), + QString::fromLocal8Bit("ָߡ0.12mmֿ0.08mmҶСdieߵ"), + QMessageBox::Yes, + QMessageBox::NoButton); + ui.lineEdit_charWidth->clear(); + ui.lineEdit_charHeight->clear(); + return; + } + if (!(ui.lineEdit_charX->text().toDouble() >= 0.08 && ui.lineEdit_charX->text().toDouble() <= m_dieWidth && + ui.lineEdit_charY->text().toDouble() >= 0.12 && ui.lineEdit_charY->text().toDouble() <= m_dieHeight)) + { + QMessageBox::StandardButton button = QMessageBox::information( + nullptr, + QString::fromLocal8Bit("ʾ"), + QString::fromLocal8Bit("Ļ׼ڵСڵdieĿ"), + QMessageBox::Yes, + QMessageBox::NoButton); + ui.lineEdit_charX->clear(); + ui.lineEdit_charY->clear(); + return; + } QString testA = ui.lineEdit_charContent->text(); std::shared_ptr textObj = std::make_shared(testA); connect(textObj.get(), SIGNAL(signal_select(int)), this, SLOT(slot_dealSelect(int))); @@ -276,7 +323,7 @@ void DieUI::slot_addText() textObj->setDefaultTextColor(RECT_COLOR); textObj->charPosX = ui.lineEdit_charX->text().toDouble(); - textObj->charPosY = ui.lineEdit_charY->text().toDouble(); + textObj->charPosY = ui.lineEdit_charY->text().toDouble() * (-1.0); textObj->charWidth = ui.lineEdit_charWidth->text().toDouble(); textObj->charHeight = ui.lineEdit_charHeight->text().toDouble(); textObj->charContent = testA; @@ -287,6 +334,19 @@ void DieUI::slot_addText() m_textItemVec.push_back(textObj); m_scene.addItem(textObj.get()); + + QString curText = ui.comboBox->currentText(); + if (m_curFontType.size() >= 1 && m_curFontType != curText.toStdString()) + { + QMessageBox::StandardButton button = QMessageBox::information( + nullptr, + QString::fromLocal8Bit("ʾ"), + QString::fromLocal8Bit("ѡһѡһ"), + QMessageBox::Yes, + QMessageBox::NoButton); + return; + } + m_curFontType = curText.toStdString(); } void DieUI::slot_deleteText() @@ -307,8 +367,12 @@ void DieUI::slot_sendEditEnd() emit signal_charEditEnd(); } -void DieUI::InitCoordSystem() +void DieUI::InitDieUI(double dieWidth, double dieHeight, QStringList& allFontList) { + m_dieWidth = dieWidth; + m_dieHeight = dieHeight; + m_allFontList = allFontList; + //ϵ m_XCoordAxis = std::make_shared(-m_dieWidth * DIE_SCALE - 200, 0, m_dieWidth * DIE_SCALE + 200, 0); m_XCoordAxis->setPen(m_pen); @@ -327,5 +391,12 @@ void DieUI::InitCoordSystem() m_scene.addItem(m_dieObj.get()); ui.graphicsView->setScene(&m_scene); + + // + QStringListModel *model = new QStringListModel(); + model->setStringList(m_allFontList); + ui.comboBox->setModel(model); + ui.comboBox->setCurrentIndex(0); + m_curFontType.clear(); } diff --git a/common/MappingChart/DieUI.h b/common/MappingChart/DieUI.h index 4ee1619..939068b 100644 --- a/common/MappingChart/DieUI.h +++ b/common/MappingChart/DieUI.h @@ -6,6 +6,10 @@ #include #include #include +#include +#include +#include +#include #include "ui_DieUI.h" #include "global.h" #include "mappingchart_global.h" @@ -54,7 +58,7 @@ public slots: void slot_sendEditEnd(); public: - void InitCoordSystem(); + void InitDieUI(double dieWidth, double dieHeight, QStringList& allFontList); private: void AddLine(double x1, double y1, double x2, double y2); @@ -85,5 +89,7 @@ public: //die double m_dieWidth = 3; double m_dieHeight = 4; + QStringList m_allFontList; + std::string m_curFontType; std::vector> m_textItemVec; }; diff --git a/common/MappingChart/DieUI.ui b/common/MappingChart/DieUI.ui index 06b1f81..2e05b1b 100644 --- a/common/MappingChart/DieUI.ui +++ b/common/MappingChart/DieUI.ui @@ -6,76 +6,131 @@ 0 0 - 1865 - 1275 + 1263 + 1101 DieUI - + - + - + + + 15 + - + + + + 70 + 50 + + 50 50 + + + 13 + 75 + true + + - 字符 + - + + + + 70 + 50 + + 50 50 + + + 13 + 75 + true + + - 矩形 + 线段 - + + + + 70 + 50 + + 50 50 + + + 13 + 75 + true + + - 线段 + 矩形 - + + + + 70 + 50 + + 50 50 + + + 13 + 75 + true + + - 取消 + 字符 - + - 50 - 0 + 70 + 50 @@ -84,11 +139,31 @@ 50 + + + 13 + 75 + true + + - + 取消 + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -105,8 +180,24 @@ + + 20 + + + + 0 + 60 + + + + + 15 + 75 + true + + 确认 @@ -116,6 +207,12 @@ + + + 75 + true + + 第二个点(X,Y) @@ -126,22 +223,14 @@ - - ID + + + 75 + true + - - - - - 图标 - - - - - - - 线段 + ID @@ -150,6 +239,18 @@ + + + 0 + 30 + + + + + 75 + true + + 设置 @@ -163,6 +264,12 @@ + + + 75 + true + + 第一个点(X,Y) @@ -171,6 +278,32 @@ + + + + + 50 + 0 + + + + + 14 + 75 + true + + + + background-color: rgb(105, 127, 255); + + + 线段 + + + Qt::AlignCenter + + + @@ -178,24 +311,16 @@ - - - - 矩形 - - - - - 角度 + + + 75 + true + - - - - - 图标 + 角度 @@ -207,6 +332,12 @@ + + + 75 + true + + ID @@ -217,6 +348,12 @@ + + + 75 + true + + 基 准 点(X,Y) @@ -227,6 +364,12 @@ + + + 75 + true + + 矩形高 @@ -234,6 +377,12 @@ + + + 75 + true + + 矩形宽 @@ -244,11 +393,49 @@ + + + 0 + 30 + + + + + 75 + true + + 设置 + + + + + 50 + 0 + + + + + 14 + 75 + true + + + + background-color: rgb(105, 127, 255); + + + 矩形 + + + Qt::AlignCenter + + + @@ -256,25 +443,17 @@ - - - - 图标 - - - - - - - - - - + + + 75 + true + + ID @@ -282,6 +461,12 @@ + + + 75 + true + + 基 准 点(X,Y) @@ -292,6 +477,12 @@ + + + 75 + true + + 直径 @@ -302,11 +493,49 @@ + + + 0 + 30 + + + + + 75 + true + + 设置 + + + + + 50 + 0 + + + + + 14 + 75 + true + + + + background-color: rgb(105, 127, 255); + + + + + + Qt::AlignCenter + + + @@ -314,88 +543,128 @@ 0 - + + + + + + + 75 + true + + 宽(mm) - - + + - + + + + 0 + 30 + + + + + 75 + true + + 删除 - + - - - - - - - 字符 - - - - + + + + 75 + true + + 基 准 点(X,Y)(mm) - - - - - - - 字符 + + + + + 75 + true + - - - - - 图标 + 高(mm) - - + + + + + 75 + true + + - 高(mm) + 字符 - + + + + 75 + true + + ID - + + + + - + - + + + + 0 + 30 + + + + + 75 + true + + 添加 - + Qt::Vertical @@ -408,6 +677,55 @@ + + + + + 75 + true + + + + 字体选择 + + + + + + + + 0 + 30 + + + + + + + + + 50 + 0 + + + + + 14 + 75 + true + + + + background-color: rgb(105, 127, 255); + + + 字符 + + + Qt::AlignCenter + + + diff --git a/common/MappingChart/MappingChart.vcxproj.user b/common/MappingChart/MappingChart.vcxproj.user new file mode 100644 index 0000000..abe8dd8 --- /dev/null +++ b/common/MappingChart/MappingChart.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/common/MappingChart/MappingUI.cpp b/common/MappingChart/MappingUI.cpp index 58f234a..40c9d9b 100644 --- a/common/MappingChart/MappingUI.cpp +++ b/common/MappingChart/MappingUI.cpp @@ -8,6 +8,16 @@ MappingUI::MappingUI(QWidget *parent) MappingUI::~MappingUI() { + QList items = m_scene.items(); + foreach(QGraphicsItem *item, items) { + m_scene.removeItem(item); + //delete item; // Ҫɾͷڴ + } + + m_allDieItem.clear(); + m_ellipseItem.clear(); + m_allLineItem.clear(); + m_curDie = nullptr; } void MappingUI::SetRecipe(double waferDia, @@ -136,7 +146,11 @@ void MappingUI::DrawMapping() } ui.graphicsView->setScene(&m_scene); - ui.graphicsView->scale(m_scaleFactor, m_scaleFactor); + if (!m_isScale) + { + ui.graphicsView->scale(m_scaleFactor, m_scaleFactor); + m_isScale = true; + } } void MappingUI::SetWaferRecipe(MaferRecipe& maferRecipe) @@ -144,6 +158,15 @@ void MappingUI::SetWaferRecipe(MaferRecipe& maferRecipe) } +void MappingUI::SetLabelHide() +{ + ui.horizontalLayout->removeWidget(ui.label); + ui.horizontalLayout->removeWidget(ui.label_2); + ui.label->hide(); + ui.label_2->hide(); + ui.verticalLayout->removeItem(ui.horizontalLayout); +} + void MappingUI::LeftExtend(double firstX, double firstY) { for (int i = 1; i < MAX_EXTEND_NUM; i++) @@ -176,7 +199,7 @@ void MappingUI::RightExtend(double firstX, double firstY, bool isIncludeCur) if (JudgeIsInWafer(rectFirstX, rectFirstY)) { - AddDieRect(rectFirstX, rectFirstY); + AddDieRect(rectFirstX, rectFirstY, "right"); } else { @@ -188,7 +211,7 @@ void MappingUI::RightExtend(double firstX, double firstY, bool isIncludeCur) } } -void MappingUI::AddDieRect(double xCoord, double yCoord) +void MappingUI::AddDieRect(double xCoord, double yCoord, std::string direction) { std::shared_ptr rectObj = std::make_shared( xCoord, @@ -196,6 +219,11 @@ void MappingUI::AddDieRect(double xCoord, double yCoord) m_maferRecipe.m_dieWidth, m_maferRecipe.m_dieHeight); + /*if (direction == "right") + { + xCoord += m_maferRecipe.m_dieWidth; + }*/ + rectObj->setPen(QPen(RECT_COLOR)); if (JudgeIsMark(xCoord, yCoord)) { @@ -347,6 +375,15 @@ void MappingUI::slot_UpdateAllDieStatus(double xCoord, double yCoord) iter->Select(false); iter->setBrush(Qt::NoBrush); } + else + { + //dieϢ + m_curDieCoordX = xCoord; + m_curDieCoordY = yCoord; + m_curAreaIdX = iter->AreaIdX(); + m_curAreaIdY = iter->AreaIdY(); + m_curDie = iter; + } } } QString str = QString::number(xCoord) + "," + QString::number(yCoord); diff --git a/common/MappingChart/MappingUI.h b/common/MappingChart/MappingUI.h index e1757da..968afb5 100644 --- a/common/MappingChart/MappingUI.h +++ b/common/MappingChart/MappingUI.h @@ -43,6 +43,7 @@ public: int areaYDirectionNum); void DrawMapping(); void SetWaferRecipe(MaferRecipe& maferRecipe); + void SetLabelHide(); private: //׼die @@ -52,7 +53,7 @@ private: void RightExtend(double firstX, double firstY, bool isIncludeCur); //die - void AddDieRect(double xCoord, double yCoord); + void AddDieRect(double xCoord, double yCoord, std::string direction = "left"); void SetDieAttr(std::shared_ptr& dieObj, bool isBase, bool isMark, double xCoord, double yCoord); @@ -89,8 +90,15 @@ public: double m_areaStartX = 0.0; //Ͻǿʼĵ double m_areaStartY = 0.0; //Ͻǿʼĵ + double m_curDieCoordX = 0.0; + double m_curDieCoordY = 0.0; + int m_curAreaIdX = -1; + int m_curAreaIdY = -1; + std::shared_ptr m_curDie = nullptr; + private: MaferRecipe m_maferRecipe; int ZERO = 0.00001; + bool m_isScale = false; }; diff --git a/common/MappingChart/MappingUI.ui b/common/MappingChart/MappingUI.ui index a5cb7cb..a5ba626 100644 --- a/common/MappingChart/MappingUI.ui +++ b/common/MappingChart/MappingUI.ui @@ -18,8 +18,24 @@ + + 30 + + + + 16777215 + 50 + + + + + 13 + 75 + true + + 当前die坐标 @@ -27,9 +43,15 @@ + + + 16777215 + 50 + + - 14 + 13 @@ -37,6 +59,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + diff --git a/common/MappingChart/MyQGraphicsRectItem.h b/common/MappingChart/MyQGraphicsRectItem.h index 02833b4..bc80e61 100644 --- a/common/MappingChart/MyQGraphicsRectItem.h +++ b/common/MappingChart/MyQGraphicsRectItem.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "global.h" class MyQGraphicsRectItem : public QObject, public QGraphicsRectItem @@ -26,6 +27,11 @@ public: void Select(bool val) { m_isSelect = val; } bool NeedSelect() const { return m_isNeedSelect; } void NeedSelect(bool val) { m_isNeedSelect = val; } + + int AreaIdX() { return m_areaIdX; } + void AreaIdX(int val) { m_areaIdX = val; } + int AreaIdY() { return m_areaIdY; } + void AreaIdY(int val) { m_areaIdY = val; } protected: virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override; //virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override; @@ -39,4 +45,10 @@ private: bool m_isSelect; double m_xCoord; double m_yCoord; + + int m_areaIdX; + int m_areaIdY; + +public: + std::vector m_markChar; }; diff --git a/common/MappingChart/global.h b/common/MappingChart/global.h index ecc48eb..fdc7043 100644 --- a/common/MappingChart/global.h +++ b/common/MappingChart/global.h @@ -25,6 +25,8 @@ static QColor MARK_POINT_COLOR = QColor::fromRgb(77, 225, 72); static QColor RECT_COLOR = QColor::fromRgb(200, 200, 200); static QColor CUR_SELECT_DIE = QColor::fromRgb(255, 0, 0); static QColor AREA_LINE_COLOR = QColor::fromRgb(255, 242, 0); + +static QColor NOT_START_COLOR = QColor::fromRgb(255, 255, 0); //һ֣Բṩmappingͼ //wafer mapͷṹ @@ -93,5 +95,14 @@ typedef struct _tagMaferRecipe { int areaYDirectionNum; //Yĸ }MaferRecipe; +typedef struct +{ + std::string charData; + double x; //Ͻǵ + double y; //Ͻǵ + double charWidth; //ַ + double charHeight; //ַ +}MarkChar; + #endif diff --git a/common/commonHeadFile/ComComm.h b/common/commonHeadFile/ComComm.h new file mode 100644 index 0000000..81d0320 --- /dev/null +++ b/common/commonHeadFile/ComComm.h @@ -0,0 +1,2153 @@ +/*! \mainpage ComComm v1.51 ̴߳ͨѶ +* \section About +* +* \n 汾: ComComm v1.51 +* \n ;: WINDOWS/WINCE ̴߳ͨѶ +* \n : C++ (ANSI/UNICODE) +* \n ƽ̨: WINDOWS(WIN98/NT/2000/XP/2003/Vista); WINCE 5.0 ģ; Pocket PC 2003 ģ; +* \n Ӳ: PC; ڷ; USB; ⴮; +* \n : BC++ 5(free tool); C++ BUILDER 4, 5, 6, X; EVC 4(sp4); G++ 3, 4; Intel C++ 7, 8, 9; VC++ 6(sp6), .NET, 2003, 2005; +* \n : llbird +* \n : wushaojian@21cn.com +* \n : http://blog.csdn.net/wujian53 http://www.cppblog.com/llbird +* \n ά: 2002.10 - 2009.8 +* +* \section Announce ˵ +* \n 1) ʹü, 뱣; +* \n 2) Ƽֱڱ޸, ӦͨC++̳չչ; +* \n 3) ֱ޸ı, 뷢һݸңͬѷĸĶ; +* \n 4) cnComm1.4°汾, кܴĶͬʱҲComComm; +* \n 5) Ǿϻ, ˮƽ, , ӭָ, , ʱ, ṩComCommڲѯ; +* +* \section Log ־ +* \n 2009 v1.51 ; ǵĹпܲٺʹڴ򽻵ܿһ; +* \n 2009 v1.5 ÷ֿ; ӶWINCE֧(ģ²ͨ); +* \n 2008 v1.4 ӶͬIOĶ֧߳; C++쳣֧; ComComm; Cn == C Next; +* \n 2007 v1.3 ϸڲ޶; +* \n 2006 v1.2 ϸڲ޶; +* \n 2005 v1.1 ϸڲ޶; +* \n 2004 v1.0 VC(), ڶWINDOWƽ̨ͨ, ״ιcnComm; +* \n 2002 v0.1 ҪͨѶ, ͳC++ļ̳л, ͳC; +*/ + +#ifndef COM_COMM_H +#pragma once + +#define COM_COMM_H + +#include +#include +#include +//#include +#include +#include + +#if defined(UNDER_CE) && !defined(CN_COMM_FOR_CE) + #define CN_COMM_FOR_CE UNDER_CE //!< WINCE֧ +#endif + +#ifndef CN_COMM_FOR_CE + #include + #include // WINCEûprocess.h +#endif + +#ifndef ON_COM_MSG_BASE + #define ON_COM_MSG_BASE WM_USER + 618 //!< ϢŵĻ +#endif + +// ͵ڵϢ WPARAM COM˿ں +#define ON_COM_RECEIVE ON_COM_MSG_BASE + 0 //!< EV_RXCHAR +#define ON_COM_RXCHAR ON_COM_MSG_BASE + 0 //!< EV_RXCHAR +#define ON_COM_CTS ON_COM_MSG_BASE + 1 //!< EV_CTS LPARAM==1 CTS ON +#define ON_COM_DSR ON_COM_MSG_BASE + 2 //!< EV_DSR LPARAM==1 DSR ON +#define ON_COM_RING ON_COM_MSG_BASE + 3 //!< EV_RING LPARAM==1 RING ON +#define ON_COM_RLSD ON_COM_MSG_BASE + 4 //!< EV_RLSD LPARAM==1 RLSD ON +#define ON_COM_BREAK ON_COM_MSG_BASE + 5 //!< EV_BREAK +#define ON_COM_TXEMPTY ON_COM_MSG_BASE + 6 //!< EV_TXEMPTY +#define ON_COM_ERROR ON_COM_MSG_BASE + 7 //!< EV_ERR LPARAM Error ID +#define ON_COM_RXFLAG ON_COM_MSG_BASE + 8 //!< EV_RXFLAG +#define ON_COM_POWER ON_COM_MSG_BASE + 9 //!< EV_POWER +#define ON_COM_EVENT1 ON_COM_MSG_BASE + 10//!< EV_EVENT1 +#define ON_COM_EVENT2 ON_COM_MSG_BASE + 11//!< EV_EVENT2 +#define ON_COM_RX80FULL ON_COM_MSG_BASE + 12//!< EV_RX80FULL +#define ON_COM_PERR ON_COM_MSG_BASE + 13//!< EV_PERR +#define ON_COM_CLOSE ON_COM_MSG_BASE + 14 + +#ifndef CN_COMM_WAIT_EVENT + #ifdef CN_COMM_FOR_CE + #define CN_COMM_WAIT_EVENT EV_RXCHAR | EV_ERR | EV_CTS | EV_DSR | EV_BREAK | EV_TXEMPTY | EV_RING | EV_RLSD | EV_POWER //!< WINCE Ĭϵĵȴ¼| EV_RXFLAG + #else + #define CN_COMM_WAIT_EVENT EV_RXCHAR | EV_ERR | EV_CTS | EV_DSR | EV_BREAK | EV_TXEMPTY | EV_RING | EV_RLSD //!< WIN32 Ĭϵĵȴ¼| EV_RXFLAG + #endif +#endif + +#ifndef CN_COMM_BUFFER_MIN_BLOCK_SIZE + #define CN_COMM_BUFFER_MIN_BLOCK_SIZE 1024 //!< 建Сֵ +#endif + +#if CN_COMM_BUFFER_MIN_BLOCK_SIZE < 4 + #error CN_COMM_BUFFER_MIN_BLOCK_SIZE must >= 4 //!< СֵС4 +#endif + +//#define CN_ASSERT(E) ((E) ? true: assert(E)) +#ifndef CN_ASSERT +#define CN_2STR(L) _T(#L) //!< ʽLתַ + #define CN_LINE(L) CN_2STR(L) //!< кLתַ + /*! ڲ 쳣׳쳣 ԰潫˳ аδ쳣κδ */ + //#define CN_ASSERT(E) ((E) ? true : ComComm::Assert(_T("CN_ASSERT(")_T(#E)_T(") failed; ComComm(")CN_LINE(__LINE__)_T("); "))) + #define CN_ASSERT(E) ((E) ? true : ComComm::Assert(_T("CN_ASSERT"))) +#endif + +//CN_COMM_STD_EXCEPTION CN_ASSERT ׳׼C++쳣 +#ifdef CN_COMM_STD_EXCEPTION + #include //throw runtime_error(msg) +#endif + +//CN_COMM_VCL_EXCEPTION CN_ASSERT ׳VCL쳣(C++ Builder) +#if defined(CN_COMM_VCL_EXCEPTION) && defined(__BORLANDC__) + #include //throw new Exception(msg) +#endif + +//CN_COMM_MFC_EXCEPTION CN_ASSERT ׳MFC쳣(VC++) +#ifdef CN_COMM_MFC_EXCEPTION + #include //throw new MfcException(msg) +#endif + +typedef void(__stdcall *ComCallback)(int nType, void *pThis); + +class ComComm +{ +public: + //! ٽ + struct InnerLock; + //! + class BlockBuffer; + //! MFC쳣 + class MfcException; + //! ģʽöֵ, 32λ + enum OptionEnum + { + EN_THREAD = 0x00000001, //!< ü߳ 洮ڴ WatchThread + EN_OVERLAPPED = 0x00000002, //!< 첽صIOʽ + EN_RX_BUFFER = 0x00000004, //!< ö + EN_TX_BUFFER = 0x00000008, //!< д + EN_RX_THREAD = 0x00000010, //!< ߳ ʱδ ReadThread + EN_TX_THREAD = 0x00000020, //!< д߳ WINCE˫ Ӧͬʱд 洮ڴ WriteThread + EN_SUSPEND = 0x00000040, //!< ߳ʱͣ + EN_ABOVE_NORMAL = 0x00000080, //!< ߳ȼһ + EN_FLUSH = 0x00000100, //!< رմʱδ(˿ڻ) ȴ + EN_FLUSH_ALL = 0x00000200 //!< ͬ(д弰˿ڶ) дģûд ̹ܵ߳޷ر + }; + //! 캯 þӦģʽ \param[in] dwOption ҪOptionEnum϶ +#ifdef CN_COMM_FOR_CE + //! WINCE:Ĭϴ򿪴ʱ߳ д߳ д + ComComm(DWORD dwOption = EN_THREAD ) +#else + //! WIN32:Ĭϴ򿪴ʱ߳ 첽صʽ + ComComm(DWORD dwOption = EN_THREAD | EN_OVERLAPPED) +#endif + { + Init(); + SetOption(dwOption); + } + //! һģʽ cnComm1~1.3 \param[in] bThread ߳ \param[in] bOverlapped صI/O + ComComm(bool bThread, bool bOverlapped) + { + DWORD dwOption = 0; + + if (bThread) + dwOption |= EN_THREAD; + + if (bOverlapped) + dwOption |= EN_OVERLAPPED; + + Init(); + SetOption(dwOption); + } + //! Զرմ + virtual ~ComComm() + { + Close(); + Destroy(); + } + //ûص + void SetDataCallBack(ComCallback pCb,void *pUser) + { + m_pComCb = pCb; + m_pUser = pUser; + } + //ûص + void SetDataCallBack(std::function _pfn) + { + m_pfn = _pfn; + } + + //첽ͬģʽԼʱ,üĬ 첽,첽ʱʱЧ + void SetWorkMode(BOOL bAsync,DWORD lReadTimeout=250) + { + m_lReadTimeout = lReadTimeout; + if (!bAsync) + { + DWORD dwOption = EN_THREAD; + SetOption(dwOption); + } + else + { + DWORD dwOption = EN_THREAD | EN_OVERLAPPED; + SetOption(dwOption); + } + } + + //! жϴǻ + bool IsOpen() + { + return hComm_ != INVALID_HANDLE_VALUE; + } + //! жϴǻ + operator bool () + { + return hComm_ != INVALID_HANDLE_VALUE; + } + //! ôھ + HANDLE GetHandle() + { + return hComm_; + } + //! ôھ + operator HANDLE() + { + return hComm_; + } + //! ô + DWORD GetPort() + { + return dwPort_; + } + //! ôȫ + LPCTSTR GetPortName() + { + return szName_; + } + //! ComCommĻò 32λ + DWORD GetOption() + { + return dwOption_; + } + //! ComCommĻò ڴ򿪴ǰ \param[in] dwOption 32λ + void SetOption(DWORD dwOption) + { + CN_ASSERT(!IsOpen());//! ״̬²ò + + dwOption_ = dwOption; + + #ifdef CN_COMM_FOR_CE + CN_ASSERT(!IsOverlappedMode()); //! WINCEʹصIO EN_OVERLAPPED + dwOption_ &= (~EN_OVERLAPPED); + #endif + } + //! ޸ComCommĻò ڴ򿪴ǰ \param[in] dwRemove ɾ32λ \param[in] dwAdd ӵ32λ + void ModifyOption(DWORD dwRemove, DWORD dwAdd) + { + CN_ASSERT(!IsOpen());//! ״̬²ò + + dwOption_ &= ~dwRemove; + dwOption_ |= dwAdd; + + #ifdef CN_COMM_FOR_CE + CN_ASSERT(!IsOverlappedMode()); //! WINCEʹصIO EN_OVERLAPPED + dwOption_ &= (~EN_OVERLAPPED); + #endif + } + //! ǷصIOģʽ + bool IsOverlappedMode() + { + return dwOption_ & EN_OVERLAPPED ? true : false; + } + //! Ƿģʽ + bool IsTxBufferMode() + { + return dwOption_ & EN_TX_BUFFER ? true : false; + } + //! Ƿ뻺ģʽ + bool IsRxBufferMode() + { + return dwOption_ & EN_RX_BUFFER ? true : false; + } + + //! 趨֪ͨ, ַСֵ + void SetNotifyNum(DWORD dwNum) + { + dwNotifyNum_ = dwNum; + } + //! ߳̾ \param[in] iOption EN_THREADhWatchThread_ EN_RX_THREADhReadThread_ EN_TX_THREADhWriteThread_ \return HANDLE ߳̾ + HANDLE GetThread(int iOption = EN_THREAD) + { + return iOption == EN_THREAD ? hWatchThread_ : ((iOption == EN_RX_THREAD) ? hReadThread_ : hWriteThread_); + } + //! Ҫӵ¼ ǰЧ + void SetWaitEvent(DWORD dwEvent = CN_COMM_WAIT_EVENT) + { + CN_ASSERT(!IsOpen());///״̬²ò + + dwWaitEvent_ = dwEvent; + } + //! 뻺 + BlockBuffer& Input() + { + return I_; + } + //! + BlockBuffer& Output() + { + return O_; + } + //! ļ \param[in] bInput Ϊtrue,ĬΪtrue صIODzȷ Ϊϵͳ̨ ȫ + DWORD GetCounter(bool bInput = true) + { + return bInput ? dwInCount_ : dwOutCount_; + } + //! + void ResetCounter() + { + dwInCount_ = dwOutCount_ = 0; + } + //! 򿪴 עcnComm1~1.3 cnComm1~1.3ʹ9600, n, 8, 1ö˿ 1.5ֻ򿪶˿ڲòʵȲ \param[in] dwPort 1~1024 + bool Open(DWORD dwPort) + { + if (!CN_ASSERT(dwPort>=1 && dwPort<=1024)) + return false; + + BindPort(dwPort); + + if(!CN_ASSERT(OpenPort())) + return false; + + if(!CN_ASSERT(SetupPort())) + return Close(), false; + + if ((dwOption_ & (EN_THREAD|EN_RX_THREAD|EN_TX_THREAD)) && !CN_ASSERT(BeginThread())) + return Close(), false; + + return true; + } + /*! \param[in] dwPort 1~1024 \param[in] dwBaudRate \param[in] btParity żУ \param[in] btByteSize λ \param[in] btStopBits ֹͣλ */ + //! 򿪴 ȱʡ 9600, n, 8, 1 \sa bool Open(DWORD dwPort, LPCTSTR szSetStr) + bool Open(DWORD dwPort, DWORD dwBaudRate, BYTE btParity = NOPARITY, BYTE btByteSize = 8, BYTE btStopBits = ONESTOPBIT) + { + if (!CN_ASSERT(dwPort>=1 && dwPort<=1024)) + return false; + + BindPort(dwPort); + + if (!CN_ASSERT(OpenPort())) + return false; + + if (!CN_ASSERT(SetState(dwBaudRate, btParity, btByteSize, btStopBits))) + return Close(), false; + + if (!CN_ASSERT(SetupPort())) + return Close(), false; + + if ((dwOption_ & (EN_THREAD|EN_RX_THREAD|EN_TX_THREAD)) && !CN_ASSERT(BeginThread())) + return Close(), false; + + return true; + } +#ifndef CN_COMM_FOR_CE + /*! \param[in] dwPort 1~1024 \param[in] szSetStr ַ "BBBB,P,D,S" : "9600,N,8,1" "1200,O,7,2" + BBBBΪ PΪżУ(E | M | N | O | S) DΪλ(4 ~ 8) SΪֹͣλ(1 | 1.5 | 2) + \code Open(1, "9600,E,8,2"); \endcode \b עַ˳ 鷵ֵ + ֧WINCE, ԭԼдһ, ǵWINCEӲĸ, ֲԿܲ, ʴ汾ɾ */ + //! 򿪴, ַô + bool Open(DWORD dwPort, LPCTSTR szSetStr) + { + if (!CN_ASSERT(dwPort>=1 && dwPort<=1024)) + return false; + + BindPort(dwPort); + + if (!CN_ASSERT(OpenPort())) + return false; + + if (!CN_ASSERT(SetState(szSetStr))) + return Close(), false; + + if (!CN_ASSERT(SetupPort())) + return Close(), false; + + if ((dwOption_ & (EN_THREAD|EN_RX_THREAD|EN_TX_THREAD)) && !CN_ASSERT(BeginThread())) + return Close(), false; + + return true; + } +#endif + /*! \param[in] dwPort ʱòûо壬Ϣ֪ͨб˿ںţӦעⲻ˿ںظ + \param[in] szPortName ΪָĶ˿, WINDOWS\\\\.\\COM1WINCECOM1: , Щ⴮ڿ + \param[in] dwBaudRate \param[in] btParity żУ \param[in] btByteSize λ \param[in] btStopBits ֹͣλ + \code Open(9999, "COM3:", 2400); \endcode \code Open(1028, "COM3:", 9600, N, 7, ONESTOPBIT); \endcode */ + //! ָĶ˿ƴ򿪴 + bool Open(DWORD dwPort, LPCTSTR szPortName, DWORD dwBaudRate, BYTE btParity = NOPARITY, BYTE btByteSize = 8, BYTE btStopBits = ONESTOPBIT) + { + if(!CN_ASSERT(_tcslen(szPortName) < 64 - 1)) + return false; + + _tcscpy_s(szName_, szPortName); + dwPort_ = dwPort;//֪ͨϢ + + if (!CN_ASSERT(OpenPort())) + return false; + + if (!CN_ASSERT(SetState(dwBaudRate, btParity, btByteSize, btStopBits))) + return Close(), false; + + if (!CN_ASSERT(SetupPort())) + return Close(), false; + + if ((dwOption_ & (EN_THREAD|EN_RX_THREAD|EN_TX_THREAD)) && !CN_ASSERT(BeginThread())) + return Close(), false; + + return true; + } + //! ֱӶ˿ \param[out] pBuffer Ŀ껺 \param[in] dwLength ȡ \param[in] dwWaitTime ȴʱ(ĬINFINITE) \return ʵʶȡֽ + DWORD ReadPort(LPVOID pBuffer, DWORD dwLength, DWORD dwWaitTime = INFINITE) + { + if (!IsOpen()) + { + return -1; + } + COMSTAT Stat; + DWORD dwError, dwReadResult = 0; + + if(!CN_ASSERT(IsOpen()) || !dwLength) + return 0; + + if(::ClearCommError(hComm_, &dwError, &Stat) && dwError > 0) + ::PurgeComm(hComm_, PURGE_RXABORT); + + #ifndef CN_COMM_FOR_CE + if (IsOverlappedMode())//! صI/O dwWaitTime==INFINITE ȴȻʱ ʱɳʱṹ Ĭ趨0.5 + { + if (dwWaitTime == INFINITE)//! ûö ֱӶȡ˿ڽ ൱ԭ1.3汾 Read(pBuffer, dwLength, false); + { + if (!::ReadFile(hComm_, pBuffer, dwLength, &dwReadResult, &RO_)) + {//! ڽʹComCommƼʹödwWaitTimeָʱʱ + if (CN_ASSERT(::GetLastError() == ERROR_IO_PENDING)) + { + while (!CN_ASSERT(::GetOverlappedResult(hComm_, &RO_, &dwReadResult, TRUE))) + ; + } + } + } + else//! صI/O dwWaitTime!=INFINITE ȴʱ ʱdwWaitTime + { //! dwWaitTime = 0 ൱ԭ1.3汾Ĺ + DWORD dwBegin = GetTickCount(), dwEnd, dwCost, uReadLength, uReadReturn; + + uReadLength = Stat.cbInQue > dwLength ? dwLength : Stat.cbInQue; + CN_ASSERT(::ReadFile(hComm_, pBuffer, uReadLength, &uReadReturn, &RO_)); + dwReadResult += uReadReturn; + + do + { + if (!::ReadFile(hComm_, (LPBYTE)pBuffer + dwReadResult, 1, &uReadReturn, &RO_)) + { + if (dwWaitTime > 5 && WaitForSingleObject(RO_.hEvent, dwWaitTime) == WAIT_OBJECT_0) + { + dwEnd = GetTickCount(); + dwCost = dwEnd>=dwBegin ? dwEnd-dwBegin : DWORD(-1L)-dwBegin+dwEnd; + CN_ASSERT(::GetOverlappedResult(hComm_, &RO_, &uReadReturn, FALSE)); + dwWaitTime = dwWaitTime > dwCost ? dwWaitTime-dwCost : 0; + } + else + { + CN_ASSERT(::PurgeComm(hComm_, PURGE_RXABORT)); + break; + } + } + } + while (uReadReturn && ++dwReadResult < dwLength); + } + return dwInCount_ += dwReadResult, dwReadResult; + } + #endif + //! I/OWinCEI/O dwWaitTime ʱʱɳʱṹ Ĭ趨1/4 + CN_ASSERT(::ReadFile(hComm_, pBuffer, dwLength, &dwReadResult, NULL)); + return dwInCount_ += dwReadResult, dwReadResult; + } + //! ȡ dwLengthַ pBuffer ʵʶַ ɶ + DWORD Read(LPVOID pBuffer, DWORD dwLength, DWORD dwWaitTime = INFINITE) + { + if (!IsOpen()) + { + return -1; + } + CN_ASSERT(pBuffer); + + if (dwOption_ & EN_RX_BUFFER) + { + BlockBuffer::InnerLock locker(&I_); + return I_.Read(pBuffer, dwLength); + } + + #ifdef CN_COMM_FOR_CE + return ReadPort(pBuffer, dwLength, dwWaitTime); + #else + return ReadPort(pBuffer, dwLength, dwWaitTime); + #endif + } + //! ȡ dwLength - 1 ANSIַ szBuffer C ģʽַָ ʺһַͨѶ + char * ReadString(char *szBuffer, DWORD dwLength, DWORD dwWaitTime = INFINITE) + { + if (!IsOpen()) + { + return ""; + } + CN_ASSERT(szBuffer); + szBuffer[Read(szBuffer, dwLength - 1, dwWaitTime)] = '\0'; + return szBuffer; + } + //! ȡ dwLength - 1 UNICODEַ szBuffer C ģʽַָ ʺһַͨѶ + wchar_t * ReadString(wchar_t *szBuffer, DWORD dwLength, DWORD dwWaitTime = INFINITE) + { + if (!IsOpen()) + { + return L""; + } + CN_ASSERT(szBuffer); + szBuffer[(Read(szBuffer, (dwLength - 1)*sizeof(wchar_t), dwWaitTime) +1)/ sizeof(wchar_t)] = L'\0'; + return szBuffer; + } + //! ֱд˿ + DWORD WritePort(LPCVOID pBuffer, DWORD dwLength) + { + if (!IsOpen()) + { + return -1; + } + if(!CN_ASSERT(IsOpen()) || !dwLength) + return 0; + + DWORD dwError; + unsigned long uWriteLength = 0; + + if(::ClearCommError(hComm_, &dwError, NULL) && dwError > 0) + ::PurgeComm(hComm_, PURGE_TXABORT); + + #ifndef CN_COMM_FOR_CE + if (IsOverlappedMode())//! ʹصIOǷ0дֱӼϴд볤ȣдɹ + {//! صIO³ʱɳʱṹ ĬΪ*1+10 + if(!::WriteFile(hComm_, pBuffer, dwLength, &uWriteLength, &WO_) + && !CN_ASSERT(::GetLastError() == ERROR_IO_PENDING)) + uWriteLength = 0; + else + dwOutCount_ += dwLength; + } + else + #endif + { + //! ʹIOWINCE³ɹ0 ʧܷʵд볤ȣдֱӼʵд볤, ʱĬ1/4 + BOOL bRet = ::WriteFile(hComm_, pBuffer, dwLength, &uWriteLength, NULL); + int error = ::GetLastError(); + dwOutCount_ += uWriteLength; + uWriteLength = (dwLength == uWriteLength) ? uWriteLength : 0; + } + return uWriteLength; + } + //! д EN_TX_BUFFER д뻺ֱд˿ + DWORD Write(LPCVOID pBuffer, DWORD dwLength) + { + if (!IsOpen()) + { + return -1; + } + if (dwLength && (dwOption_&EN_TX_BUFFER)) + { + BlockBuffer::InnerLock locker(&O_); + + O_.Write(pBuffer, dwLength); + + if (dwOption_ & EN_TX_THREAD) + SetEvent(hWatchEvent_); + else + { + #ifdef CN_COMM_FOR_CE + SetCommMask(hComm_, dwWaitEvent_); + #else + if (IsOverlappedMode()) + SetCommMask(hComm_, dwWaitEvent_); + else + SetEvent(hWatchEvent_); + #endif + } + return 0; + } + + #ifdef CN_COMM_FOR_CE + return WritePort(pBuffer, dwLength); + #else + return WritePort(pBuffer, dwLength); + #endif + } + //! д ANSIַ дANSI C ģʽַָ + DWORD Write(const char *szBuffer,int nBufferLen) + { + if (!IsOpen()) + { + return -1; + } + CN_ASSERT(szBuffer); + + return Write((LPCVOID)szBuffer, nBufferLen); + } + + //! ǿݲȴ + void FlushPort() + { + if(CN_ASSERT(IsOpen())) + FlushFileBuffers(hComm_); + } + //! ǿдǿݲȴ + void Flush() + { + if(CN_ASSERT(IsOpen())) + { + if (dwOption_ & EN_TX_BUFFER) + { + while(O_.SafeSize()) + Sleep(50); + } + + FlushFileBuffers(hComm_); + } + } + //! ַ + bool TransmitChar(char c) + { + if (CN_ASSERT(IsOpen())) + { + if (::TransmitCommChar(hComm_, c)) + return dwOutCount_++, true; + } + + return false; + } + //! ߳̿ + bool BeginThread(DWORD dwThreadOption = 0) + { + DWORD dwCreationFlags; + + if(CN_ASSERT(!hWatchThread_ && !hReadThread_ && !hWriteThread_)) + {//! û߳״̬²ſ߳ + bContinue_ = true; + dwCreationFlags = dwOption_ & EN_SUSPEND ? CREATE_SUSPENDED : 0; + + if (dwThreadOption)//! ộ߳д߳ + dwOption_ |= dwThreadOption; + + #if defined(_MT) && !defined(CN_COMM_FOR_CE) + unsigned int id, rid, wid; + + if (dwOption_ & EN_THREAD) + hWatchThread_ = (HANDLE)_beginthreadex(NULL, 0, WatchThreadProc, this, dwCreationFlags, &id); + + if (dwOption_ & EN_RX_THREAD) + hReadThread_ = (HANDLE)_beginthreadex(NULL, 0, ReadThreadProc, this, dwCreationFlags, &rid); + + if (dwOption_ & EN_TX_THREAD) + hWriteThread_ = (HANDLE)_beginthreadex(NULL, 0, WriteThreadProc, this, dwCreationFlags, &wid); + #else + DWORD id, rid, wid; + + if (dwOption_ & EN_THREAD) + hWatchThread_ = ::CreateThread(NULL, 0, WatchThreadProc, this, dwCreationFlags , &id); + + if (dwOption_ & EN_RX_THREAD) + hReadThread_ = ::CreateThread(NULL, 0, ReadThreadProc, this, dwCreationFlags, &rid); + + if (dwOption_ & EN_TX_THREAD) + hWriteThread_ = ::CreateThread(NULL, 0, WriteThreadProc, this, dwCreationFlags, &wid); + #endif + + if (dwOption_ & EN_THREAD) + { + CN_ASSERT(hWatchThread_ != NULL); + hWatchThreadId_ = id; + + if (!hWatchThread_) + { + EndThread(); + return false; + } + else + { + if (dwOption_ & EN_ABOVE_NORMAL) + SetThreadPriority(hWatchThread_, THREAD_PRIORITY_ABOVE_NORMAL); + } + } + + if (dwOption_ & EN_RX_THREAD) + { + CN_ASSERT(hReadThread_ != NULL); + hReadThreadId_ = rid; + + if (!hReadThreadId_) + { + EndThread(); + return false; + } + else + { + if (dwOption_ & EN_ABOVE_NORMAL) + SetThreadPriority(hReadThread_, THREAD_PRIORITY_ABOVE_NORMAL); + } + } + + if (dwOption_ & EN_TX_THREAD) + { + CN_ASSERT(hWriteThread_ != NULL); + hWriteThreadId_ = wid; + + if (!hWriteThreadId_) + { + EndThread(); + return false; + } + else + { + if (dwOption_ & EN_ABOVE_NORMAL) + SetThreadPriority(hWriteThread_, THREAD_PRIORITY_ABOVE_NORMAL); + } + } + + return true; + } + + return false; + } + //! ͣ߳ + bool SuspendThread(int iOption = EN_THREAD) + { + return ::SuspendThread(GetThread(iOption)) != 0xFFFFFFFF; + } + //! ָ߳ + bool ResumeThread(int iOption = EN_THREAD) + { + return ::ResumeThread(GetThread(iOption)) != 0xFFFFFFFF; + } + //! ֹ߳ + bool EndThread(DWORD dwWaitTime = 500) + { + if(hWatchThread_ || hReadThread_ || hWriteThread_) + { + if ((dwOption_&EN_FLUSH_ALL) && (dwOption_&EN_TX_BUFFER)) + {//! EN_FLUSH_ALLѭȴдգд̲߳ + while(O_.Size()) + Sleep(50); + } + + bContinue_ = false; + + #ifdef CN_COMM_FOR_CE + ::SetCommMask(hComm_, 0); + #else + if (IsOverlappedMode()) + ::SetCommMask(hComm_, 0); + #endif + + if (hWatchThread_) + { + SetEvent(hWatchEvent_); + if(::WaitForSingleObject(hWatchThread_, dwWaitTime) != WAIT_OBJECT_0) + if(!::TerminateThread(hWatchThread_, 0)) + return false; + + ::CloseHandle(hWatchThread_); + hWatchThread_ = NULL; + } + + if (hReadThread_) + { + SetEvent(hReadEvent_); + if(::WaitForSingleObject(hReadThread_, dwWaitTime) != WAIT_OBJECT_0) + if(!::TerminateThread(hReadThread_, 0)) + return false; + + ::CloseHandle(hReadThread_); + hReadThread_ = NULL; + } + + if (hWriteThread_) + { + SetEvent(hWriteEvent_); + if(::WaitForSingleObject(hWriteThread_, dwWaitTime) != WAIT_OBJECT_0) + if(!::TerminateThread(hWriteThread_, 0)) + return false; + + ::CloseHandle(hWriteThread_); + hWriteThread_ = NULL; + } + + return true; + } + + return false; + } + //! رմ ͬʱҲرչ߳ + virtual void Close(DWORD dwWaitTime = 500) + { + if(IsOpen()) + { + EndThread(dwWaitTime);//! ͬ߳ + + if (dwOption_&EN_FLUSH || dwOption_&EN_FLUSH_ALL) + FlushFileBuffers(hComm_); + + ::PurgeComm(hComm_, PURGE_TXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR | PURGE_RXABORT); + ::CloseHandle(hComm_); + hComm_ = INVALID_HANDLE_VALUE; + } + } + //! + void Lock() + { + ::EnterCriticalSection(&CS_); + } + //! + void Unlock() + { + ::LeaveCriticalSection(&CS_); + } + //! Զ ںڲ ö + struct InnerLock + { + ComComm* ptr;//!< ComComm ָ + //! + InnerLock(ComComm* p) : ptr(p) + { + ptr->Lock(); + } + //! + ~InnerLock() + { + ptr->Unlock(); + } + }; + //! ôڲ DCB + DCB *GetState(DCB *pDcb = NULL) + { + return CN_ASSERT(IsOpen()) && ::GetCommState(hComm_, pDcb == NULL ? &DCB_ : pDcb) == TRUE ? (pDcb == NULL ? &DCB_ : pDcb) : NULL; + } + //! ôڲ DCB + bool SetState(DCB *pDcb = NULL) + { + return CN_ASSERT(IsOpen()) ? ::SetCommState(hComm_, pDcb == NULL ? &DCB_ : pDcb) == TRUE : false; + } + //! ôڲʣֹͣλ *** + bool SetState(DWORD dwBaudRate, BYTE btParity = NOPARITY, BYTE btByteSize = 8, BYTE btStopBits = ONESTOPBIT) + { + if(CN_ASSERT(IsOpen())) + { + if(::GetCommState(hComm_, &DCB_) != TRUE) + return false; + + DCB_.BaudRate = dwBaudRate; + DCB_.ByteSize = btByteSize; + DCB_.Parity = btParity; + DCB_.StopBits = btStopBits; + DCB_.fParity = (btParity != NOPARITY); + + return ::SetCommState(hComm_, &DCB_) == TRUE; + } + return false; + } +#ifndef CN_COMM_FOR_CE + //! ôڲ ַ֧ "9600, n, 8, 1" + bool SetState(LPCTSTR szSetStr) + { + if(CN_ASSERT(IsOpen())) + { + if(!::GetCommState(hComm_, &DCB_)) + return false; + + if(!BuildCommDCB(szSetStr, &DCB_)) + return false; + + DCB_.fParity = (DCB_.Parity != NOPARITY); + BOOL bRet = ::SetCommState(hComm_, &DCB_) == TRUE; + + bool smallBool = false; + bRet == 0 ? smallBool = false : smallBool = true; + return smallBool; + } + + return false; + } +#endif + //! óʱṹ + LPCOMMTIMEOUTS GetTimeouts(LPCOMMTIMEOUTS lpCO = NULL) + { + return CN_ASSERT(IsOpen()) && ::GetCommTimeouts(hComm_, lpCO ? lpCO : &CO_) == TRUE ? (lpCO ? lpCO : &CO_) : NULL; + } + //! óʱ + bool SetTimeouts(LPCOMMTIMEOUTS lpCO = NULL) + { + return CN_ASSERT(IsOpen()) ? ::SetCommTimeouts(hComm_, lpCO ? lpCO : &CO_) == TRUE : false; + } + //! ôڵI/OС + bool Setup(DWORD dwInputSize = 4096, DWORD dwOutputSize = 4096) + { + return CN_ASSERT(IsOpen()) ? ::SetupComm(hComm_, dwInputSize, dwOutputSize) == TRUE : false; + } + //! ˿ڹ + bool Escape(DWORD dwType) + { + return CN_ASSERT(IsOpen()) ? EscapeCommFunction(hComm_, dwType) != 0 : false; + } + //! õƽź״̬ + DWORD GetModemStatus() + { + DWORD dwModemStat = 0; + return CN_ASSERT(IsOpen()) && GetCommModemStatus(hComm_, &dwModemStat) ? dwModemStat : 0; + } + //! ö˿ڲ \param[in] pCP ṹָ pCP==NULL, ComCommӶѷڴ, ComCommͷ, ûҪԼͷڴ + LPCOMMPROP GetProperties(LPCOMMPROP pCP = NULL) + { + if (CN_ASSERT(IsOpen())) + { + if (!pCP) + { + #ifdef CN_COMM_FOR_CE + USHORT dwSize = sizeof(COMMPROP); + #else + USHORT dwSize = sizeof(COMMPROP) + sizeof(MODEMDEVCAPS); + #endif + + if (!pCP_) + pCP_ = (LPCOMMPROP) new BYTE[dwSize]; + + if (pCP_) + { + memset(pCP_, 0, dwSize); + + pCP_->wPacketLength = dwSize; + #ifndef CN_COMM_FOR_CE + pCP_->dwProvSubType = PST_MODEM; + #endif + pCP_->dwProvSpec1 = COMMPROP_INITIALIZED; + pCP = pCP_; + } + } + } + + return pCP && GetCommProperties(hComm_, pCP) ? pCP : NULL; + } + //! ȡ¼ʶ + DWORD GetMask() + { + DWORD dwMask; + return CN_ASSERT(IsOpen()) && GetCommMask(hComm_, &dwMask) ? dwMask : 0; + } + //! ˿ڻ + bool Purge(DWORD dwPara = PURGE_TXABORT | PURGE_TXCLEAR | PURGE_RXABORT | PURGE_RXCLEAR) + { + return CN_ASSERT(IsOpen()) ? ::PurgeComm(hComm_, dwPara)==TRUE : false; + } + //! ô + DWORD ClearError() + { + DWORD dwError; + return CN_ASSERT(IsOpen()) && ::ClearCommError(hComm_, &dwError, NULL) ? dwError : 0; + } + //! öַ + DWORD GetQueueCount(bool bInput = true) + { + COMSTAT Stat; + DWORD dwError; + + return CN_ASSERT(IsOpen()) && ::ClearCommError(hComm_, &dwError, &Stat) ? (bInput ? Stat.cbInQue : Stat.cbOutQue) : (DWORD)-1L; + } + //! ƽ CTS ON + bool CheckCTS() + { + return (GetModemStatus()&MS_CTS_ON) != 0; + } + //! ƽ DSR ON + bool CheckDSR() + { + return (GetModemStatus()&MS_DSR_ON) != 0; + } + //! ƽ Ring ON + bool CheckRING() + { + return (GetModemStatus()&MS_RING_ON) != 0; + } + //! ƽ RLSD ON + bool CheckRLSD() + { + return (GetModemStatus()&MS_RLSD_ON) != 0; + } + //! DTR ƽ + bool SetDTR(bool bSetOrClr = true) + { + return Escape(bSetOrClr ? SETDTR : CLRDTR); + } + //! RTS ƽ + bool SetRTS(bool bSetOrClr = true) + { + return Escape(bSetOrClr ? SETRTS : CLRRTS); + } + //! ƽ + bool SetBreak(bool bSetOrClr = true) + { + return Escape(bSetOrClr ? SETBREAK : CLRBREAK); + } +#ifdef CN_COMM_FOR_CE + //! WINCE + bool SetIR(bool bSetOrClr) + { + return Escape(bSetOrClr ? SETIR : CLRIR); + } +#endif + //! SETXON SETXOFF + bool SetX(bool bOnOrOff) + { + return Escape(bOnOrOff ? SETXON : SETXOFF); + } + //! ͨѶص㿪Ļ ڴ һЩչֺ֧APIҽ + class BlockBuffer + { + public: + //! ڴ + struct Block + { + DWORD B_; //!< ʼƫ + DWORD E_; //!< ƫ + DWORD S_; //!< С ڴֵ ڴСֵCN_COMM_BUFFER_MIN_BLOCK_SIZE + Block* N_; //!< һָ + BYTE P_[4]; //!< ָ ʵʴСS_ + + //! + DWORD Capacity() { return S_; } + //! ʵʴС + DWORD Size() { return E_ - B_; } + //! ʼָ + BYTE* Begin() { return P_ + B_; } + //! ĩ˻ָ + BYTE* End() { return P_ + E_; } + //! һ + Block* Next() { return N_; } + //! Ƿ + bool IsEmpty() { return B_ == E_; } + //! дС + DWORD FreeSize() { return S_ - E_; } + }; + + //! ڻ + struct Iterator + { + BlockBuffer* P_; //!< ָ + Block* B_; //!< ǰָ + DWORD I_; //!< ǰƫ + DWORD O_; //!< ȫƫ + + //! + Iterator(BlockBuffer *P = NULL, Block* B = NULL, DWORD I = 0, DWORD O = 0) + : P_(P), B_(B), I_(I), O_(O) + { + } + //! ǷЧ + operator bool() + { + return B_ && I_E_&&I_>=B_->B_; + } + //! Ƿд + bool CanWrite() + { + return B_ && I_ < B_->S_; + } + //! ȡֵ + BYTE& operator *() + { + CN_ASSERT( P_ && B_ && I_E_&&I_>=B_->B_); + return B_->P_[I_]; + } + //! ƶ ++Iter; + Iterator& operator ++ () + { + return operator +=(1); + } + //! ƶ Iter++; + Iterator& operator ++ (int) + { + return operator +=(1); + } + //! ƶ \param dwOffset Ϊƫ + Iterator& operator += (DWORD dwOffset) + { + while (dwOffset) + { + if (I_+dwOffset < B_->E_) + I_ += dwOffset, O_ += dwOffset, dwOffset = 0; + else + dwOffset -= B_->E_-I_, I_ += B_->E_-I_, O_ += B_->E_-I_, B_ = B_->N_, I_ = 0; + } + + return *this; + } + //! Ƚ + bool operator == (const Iterator& iter) + { + return (P_ == iter.P_) && (B_ == iter.B_) && (I_ == iter.I_); + } + }; + //! Ԫ + friend struct Iterator; + //! + void Lock() + { + ::EnterCriticalSection(&C_); + } + //! + void Unlock() + { + ::LeaveCriticalSection(&C_); + } + //! Զ + struct InnerLock + { + BlockBuffer* ptr;//!<ָ + /// + InnerLock(BlockBuffer* p) : ptr(p) + { + if (ptr) + ptr->Lock(); + } + /// + ~InnerLock() + { + if (ptr) + ptr->Unlock(); + } + }; + //! + BlockBuffer() + { + ::InitializeCriticalSection(&C_); + S_ = 0, F_ = L_ = NULL, M_ = CN_COMM_BUFFER_MIN_BLOCK_SIZE; + } + //! Զͷſռ + virtual ~BlockBuffer() + { + Clear(); + ::DeleteCriticalSection(&C_); + } + //! ʼ + Iterator Begin() + { + return Iterator(this, F_, F_? F_->B_ : 0, 0); + } + //! ÿС + void SetMinBlockSize(DWORD dwMinSize) + { + M_ = dwMinSize; + } + //! ÿС + DWORD GetMinBlockSize() + { + return M_; + } + //! ֽ + DWORD Size() + { + return S_; + } + //! С + DWORD SafeSize() + { + InnerLock lock(this); + return S_; + } + //! дANSIַ \sa Write(LPCVOID lpBuf, DWORD dwSize) + DWORD Write(const char* lpBuf) + { + return Write(lpBuf, strlen(lpBuf)); + } + //! дUNICODEַ \sa Write(LPCVOID lpBuf, DWORD dwSize) + DWORD Write(const wchar_t* lpBuf) + { + return Write(lpBuf, wcslen(lpBuf)*sizeof(wchar_t)); + } + //! д뻺 \param[out] lpBuf Ŀ껺 \param[in] dwSize ֽ \return ʵʸֽ + DWORD Write(LPCVOID lpBuf, DWORD dwSize) + { + DWORD dwTemp = dwSize, dwFree = FreeSize(), dwCopy = 0; + + if (dwFree)//! ȲĩβУд + { + dwCopy = dwFree > dwSize ? dwSize : dwFree; + memcpy(L_->P_ + L_->E_, lpBuf, dwCopy); + dwTemp -= dwCopy, L_->E_ += dwCopy; + } + + if (dwTemp)//! ʣݷµĿռ䲢д + { + memcpy(NewBlock(dwSize)->P_, ((LPBYTE)lpBuf )+ dwCopy, dwTemp); + L_->E_ += dwTemp; + } + + S_ += dwSize; + return dwSize; + } + //! ̰߳ȫд뻺 \sa Write(LPCVOID lpBuf, DWORD dwSize) + DWORD SafeWrite(LPCVOID lpBuf, DWORD dwSize) + { + InnerLock lock(this); + return Write(lpBuf, dwSize); + } + //! ̰߳ȫдANSIַ \sa Write(LPCVOID lpBuf, DWORD dwSize) + DWORD SafeWrite(const char* lpBuf) + { + InnerLock lock(this); + return Write(lpBuf, strlen(lpBuf)); + } + //! ̰߳ȫдUNICODEַ \sa Write(LPCVOID lpBuf, DWORD dwSize) + DWORD SafeWrite(const wchar_t* lpBuf) + { + InnerLock lock(this); + return Write(lpBuf, wcslen(lpBuf)*sizeof(wchar_t)); + } + //! \param[out] lpBuf Ŀ껺 \param[in] dwSize ֽ \param[in] dwStart Դʼƫֵ \return ʵʸֽ + DWORD Copy(LPVOID lpBuf, DWORD dwSize, DWORD dwStart = 0) + { + CN_ASSERT(lpBuf); + + if (!F_ || !dwSize || dwStart >= S_) + return 0; + + DWORD dwTemp, dwIndex; + Block * pCur = F_, *pNext = F_->N_; + + for (dwTemp = 0, dwIndex = pCur->B_; dwTemp < dwStart; pCur = pCur->N_, dwIndex = pCur ? pCur->B_ : 0) + { + if (dwStart - dwTemp < pCur->E_ - pCur->B_) + { + dwIndex = pCur->B_ + dwStart - dwTemp; + break; + } + + dwTemp += pCur->E_ - pCur->B_; + } + + for (dwTemp = 0; dwTemp < dwSize && pCur; pCur = pCur->N_, dwIndex = pCur ? pCur->B_ : 0) + { + if (dwSize - dwTemp < pCur->E_ - dwIndex) + { + memcpy((LPBYTE)lpBuf+dwTemp, pCur->P_ + dwIndex, dwSize - dwTemp ); + dwTemp = dwSize; + break; + } + else + { + memcpy((LPBYTE)lpBuf+dwTemp, pCur->P_ + dwIndex, pCur->E_ - dwIndex); + dwTemp += pCur->E_ - dwIndex; + } + } + + return dwTemp; + } + //! ̰߳ȫ \sa Copy(LPVOID lpBuf, DWORD dwSize, DWORD dwStart=0) + DWORD SafeCopy(LPVOID lpBuf, DWORD dwSize, DWORD dwStart = 0) + { + InnerLock lock(this); + return Copy(lpBuf, dwSize, dwStart); + } + /*! \param[out] lpBuf Ŀ껺 ΪNULLʱɾ \param[in] dwSize ֽ \return ʵʸƻɾֽ */ + //! ƲɾݵlpBuf + DWORD Read(LPVOID lpBuf, DWORD dwSize) + { + DWORD dwTemp = 0, dwCopy; + + for (Block * pCur = F_, *pNext = NULL; dwTemp pCur->E_-pCur->B_ ) + dwCopy = pCur->E_ - pCur->B_; + else + dwCopy = dwSize - dwTemp; + + if (lpBuf) + memcpy((LPBYTE)lpBuf+dwTemp, pCur->P_ + pCur->B_, dwCopy); + + pNext = pCur->N_, dwTemp += dwCopy; + + if (dwCopy == pCur->E_-pCur->B_) + {//! ɾȫп, һ㱣1, С4*CN_COMM_BUFFER_MIN_BLOCK_SIZE + if (pNext || pCur->S_>(M_<<2)) + { + delete[] (BYTE*)pCur; + F_ = pNext; + if (!F_) + L_ = NULL; + } + else + pCur->B_ = pCur->E_ = 0; + } + else + pCur->B_ += dwCopy; + + S_ -= dwCopy; + } + + return dwTemp; + } + //! ANSIַ + char* ReadString(char* lpBuf, DWORD dMaxSize) + { + lpBuf[Read(lpBuf, dMaxSize)] = '\0'; + return lpBuf; + } + //! UNICODEַ + wchar_t* ReadString(wchar_t* lpBuf, DWORD dMaxSize) + { + lpBuf[(Read(lpBuf, dMaxSize*sizeof(wchar_t))+1) / sizeof(wchar_t)] = L'\0'; + return lpBuf; + } + //! ̰߳ȫĶ + DWORD SafeRead(LPVOID lpBuf, DWORD dwSize) + { + InnerLock lock(this); + return Read(lpBuf, dwSize); + } + //! ̰߳ȫANSIַ + char* SafeReadString(char* lpBuf, DWORD dMaxSize) + { + InnerLock lock(this); + return ReadString(lpBuf, dMaxSize); + } + //! ̰߳ȫUNICODEַ + wchar_t* SafeReadString(wchar_t* lpBuf, DWORD dMaxSize) + { + InnerLock lock(this); + return ReadString(lpBuf, dMaxSize); + } + //! \param bDeleteAll Ϊtrueʱͷڴ, һڴЧ + void Clear(bool bDeleteAll = false) + { + if (F_ && (F_==L_) && F_->S_>(M_<<2)) + { + DWORD S = F_->S_; + memset(F_, 0, sizeof(Block)), F_->S_ = S; + } + else + { + for (Block* t = F_; t; delete F_) + F_ = t, t = t->N_; + + F_ = L_ = NULL, S_ = 0; + } + } + //! ̰߳ȫ \sa void Clear(bool bDeleteAll = false) + void SafeClear(bool bDeleteAll = false) + { + InnerLock lock(this); + Clear(bDeleteAll); + } + //! ڴָ \param bFirst Ϊtrueʱͷָβָ + Block* GetBlockPtr(bool bFirst = true) + { + return bFirst ? F_ : L_; + } + //! βĿпռ + DWORD FreeSize() + { + return L_ ? L_->S_-L_->E_ : 0 ; + } + //! ùAPIݵֱд СdwSize в¿ 0βĿָ β޿зNULL + LPVOID GetFreePtr(DWORD dwSize = 0) + { + if (dwSize) + return FreeSize() > dwSize ? L_->P_ + L_->E_ : NewBlock(dwSize)->P_; + else + return L_ ? L_->P_ + L_->E_ : NULL; + } + /*! \param[in] dwSize ȫ + \code strcpy(GetFreePtr(100), "test"), Release(4); //ȡ100ֽڵĻ ĸֽ С4ֽ \endcode + */ + //! APIֱдGetFreePtr()ÿָ, ͬС + DWORD Release(DWORD dwSize) + { + return (dwSize <= L_->S_) ? (L_->E_ += dwSize, S_ += dwSize, dwSize) : 0; + } + //! õһЧĻָ + LPVOID GetPtr() + { + return F_ ? F_->P_ + F_->B_ : NULL; + } + //! õһЧĻָָݴС + DWORD GetPtrSize() + { + return F_ ? F_->E_ - F_->B_ : 0; + } + //! 1 Чʺܵ ƼõӷʿԻ + BYTE& operator[](DWORD dwOffset) + { + CN_ASSERT(F_); + + if (F_ == L_) + { + CN_ASSERT(F_->S_ > dwOffset); + return F_->P_[dwOffset]; + } + else + { + Iterator iter = Begin(); + iter += dwOffset; + CN_ASSERT(iter); + return *iter; + } + } + + protected: + + //! ½ Զβ + Block* NewBlock(DWORD dwSize) + { + dwSize = dwSize < M_ ? M_ : dwSize; + Block * pNew = (Block *) new BYTE[sizeof(Block) - 4 + dwSize]; + + if (pNew) + { + memset(pNew, 0, sizeof(Block)); + pNew->S_ = dwSize; + + if (L_) + L_->N_ = pNew, L_ = pNew; + else + F_ = L_ = pNew; + } + + return pNew; + } + + Block* F_;//!< ͷָ + Block* L_;//!< βָ + DWORD S_;//!< С + DWORD M_;//!< С + CRITICAL_SECTION C_;//!< ṹ + }; + +#if defined(CN_COMM_MFC_EXCEPTION) + /*! Ҫ CN_COMM_MFC_EXCEPTION CN_ASSERT \n ʹthrow new MfcException(msg);׳MFC쳣(VC++) */ + //! MFC쳣 + class MfcException : public CException + { + public: + //! 캯ҪCExceptionԶ + MfcException(LPCTSTR szMsg) : CException(TRUE) + { + lstrcpy(szMsg_, szMsg); + + #ifdef _DEBUG + CException::m_bReadyForDelete = TRUE; + #endif + } + //! ʾϢ + BOOL GetErrorMessage( LPTSTR lpszError, UINT nMaxError, PUINT pnHelpContext = NULL ) + { + #ifndef CN_COMM_FOR_CE + lstrcpyn(lpszError, szMsg_, nMaxError); + #else + _tcsncpy(lpszError, szMsg_, nMaxError - 1); + lpszError[nMaxError - 1] = _T('\0'); + #endif + return TRUE; + } + protected: + TCHAR szMsg_[256]; //!< Ϣ ʽCN_ASSERT(ʽ) failed; ComComm(к); Code(GetLastError()); + }; +#endif + + //! û쳣 ׳쳣; δ쳣: DEBUG汾 ̨汾Ϣ ˳; Release汾ʾӦûҪ + static bool Assert(LPCTSTR szMessage) + { + return false; + //#if defined(_DEBUG) || defined(CN_COMM_STD_EXCEPTION) || defined(CN_COMM_VCL_EXCEPTION) || defined(CN_COMM_MFC_EXCEPTION) + // TCHAR szMsg[256]; + // DWORD dwError, dwLength; + // + // _tcscpy_s(szMsg, szMessage); + + // dwError = GetLastError(); + // if (dwError)//! (GetLastError())Ϊ 0 + // { + // dwLength = _tcslen(szMsg); + // _sntprintf_s(szMsg + dwLength, 256 - _tcslen(szMsg), 256, _T("Code:%d; "), dwError); + // dwLength = _tcslen(szMsg); + + // FormatMessage( + // FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + // NULL, + // dwError, + // MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), //! ñ + // szMsg + dwLength - 1, + // 256 - dwLength - 1, + // NULL + // ); + // } + //#else + // ;// Release汾 ʲô Ԥ + //#endif + + //#if defined(CN_COMM_STD_EXCEPTION) + + // #ifdef _UNICODE + // char szTemp[512] = {0}; + // WideCharToMultiByte(CP_ACP, 0, szMsg, -1, szTemp, wcslen(szMsg)*sizeof(wchar_t), NULL, NULL); + // throw std::runtime_error(szTemp); + // #else + // throw std::runtime_error(szMsg); + // #endif + + //#elif defined(CN_COMM_VCL_EXCEPTION) + + // throw Exception(szMsg); + + //#elif defined(CN_COMM_MFC_EXCEPTION) + + // throw (new MfcException(szMsg)); + + //#elif defined(_DEBUG) + + // OutputDebugString(szMsg); + // #ifdef _CONSOLE + // // Ҫ setlocale(LC_ALL, "chs"); ̨ſȷUNICODE תANSI + // #ifdef _UNICODE + // char szTemp[512] = {0}; + // WideCharToMultiByte(CP_ACP, 0, szMsg, -1, szTemp, wcslen(szMsg)*sizeof(wchar_t), NULL, NULL); + // fprintf(stderr, szTemp); + // #else + // fprintf(stderr, szMsg); + // #endif + + // system("pause"); + // exit(1); + // #else + // switch(MessageBox(NULL, szMsg, _T("CN_ASSERT"), MB_ABORTRETRYIGNORE)) + // { + // case IDABORT: + // exit(1); + + // case IDRETRY: + // DebugBreak(); + // break; + + // case IDIGNORE: + // break; + // } + // #endif + + //#else + // ;// Release汾 ʲô Ԥ + //#endif + // return false; + } + +protected: + DWORD m_lReadTimeout; + ComCallback m_pComCb; //!< ݻص + void* m_pUser; //!< ݶ + std::function m_pfn; + DWORD dwOption_; //!< ؼģʽ ڹ캯趨 + HANDLE hComm_; //!< ھ + DWORD dwPort_; //!< ں 0Ϊ⴮ -1ΪЧ ҪϢ֪ͨ + TCHAR szName_[64]; //!< 洮 COM1ַ + CRITICAL_SECTION CS_; //!< ٽ绥 + DCB DCB_; //!< ʣֹͣλ + COMMTIMEOUTS CO_; //!< ʱṹ + COMMPROP* pCP_; //!< ڲ + + BlockBuffer I_; //!< + BlockBuffer O_; //!< д + DWORD dwInCount_; //!< + DWORD dwOutCount_; //!< д + + bool bContinue_; //!< ̼߳ѭ־ + DWORD dwWaitEvent_; //!< WaitCommEvent ļ¼ + + HANDLE hWatchThread_; //!< Ӹ߳ + DWORD hWatchThreadId_; //!< Ӹ߳ ID + HANDLE hWatchEvent_; //!< ֪ͨ߳ + + HANDLE hReadThread_; //!< ո߳ ʵ˫Ч + DWORD hReadThreadId_; //!< ո߳ ID + HANDLE hReadEvent_; //!< ֪ͨ߳ + + HANDLE hWriteThread_; //!< ͸߳ ʵ˫Ч + DWORD hWriteThreadId_; //!< ͸߳ ID + HANDLE hWriteEvent_; //!< ֪ͨ߳ + + DWORD dwNotifyNum_; //!< ֽܶ(>=dwNotifyNum_)֪ͨϢ + +#ifndef CN_COMM_FOR_CE + OVERLAPPED RO_; //!< صI/O ReadFile + OVERLAPPED WO_; //!< صI/O WriteFile + OVERLAPPED EO_; //!< صI/O WaitCommEvent +#endif + + //! ʼ + virtual void Init() + { + ::InitializeCriticalSection(&CS_); + + memset(szName_, 0, 64*sizeof(TCHAR)); + + memset(&DCB_, 0, sizeof(DCB_)); + DCB_.DCBlength = sizeof(DCB_); + m_pComCb = NULL; + m_pUser = NULL; + hComm_ = INVALID_HANDLE_VALUE; + dwPort_ = (DWORD)-1; + dwOutCount_ = 0; + dwInCount_ = 0; + + dwWaitEvent_ = CN_COMM_WAIT_EVENT; + hWatchThread_ = NULL; + hReadThread_ = NULL; + hWriteThread_ = NULL; + hWatchThreadId_ = 0; + hReadThreadId_ = 0; + hWriteThreadId_ = 0; + + dwNotifyNum_ = 0; + pCP_ = NULL; + + #ifndef CN_COMM_FOR_CE + memset(&RO_, 0, sizeof(RO_)); + memset(&WO_, 0, sizeof(WO_)); + memset(&EO_, 0, sizeof(EO_)); + + RO_.hEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL); + CN_ASSERT(RO_.hEvent != NULL); + + WO_.hEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL); + CN_ASSERT(WO_.hEvent != NULL); + + EO_.hEvent= ::CreateEvent(NULL, TRUE, FALSE, NULL); + CN_ASSERT(EO_.hEvent != NULL); + #endif + + hWatchEvent_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); + CN_ASSERT(hWatchEvent_ != NULL); + hReadEvent_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); + CN_ASSERT(hReadEvent_ != NULL); + hWriteEvent_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); + CN_ASSERT(hWriteEvent_ != NULL); + m_lReadTimeout = 250;//250ms + } + //! + virtual void Destroy() + { + #ifndef CN_COMM_FOR_CE + if(RO_.hEvent != NULL) + CloseHandle(RO_.hEvent); + + if(WO_.hEvent != NULL) + CloseHandle(WO_.hEvent); + + if(EO_.hEvent != NULL) + CloseHandle(EO_.hEvent); + #endif + + if(hWatchEvent_ != NULL) + CloseHandle(hWatchEvent_); + + if(hReadEvent_ != NULL) + CloseHandle(hReadEvent_); + + if(hWriteEvent_ != NULL) + CloseHandle(hWriteEvent_); + + if (pCP_) + delete[] ((BYTE*)pCP_); + + ::DeleteCriticalSection(&CS_); + } + //! 󶨴 + void BindPort(DWORD dwPort) + { + dwPort_ = dwPort; + +#if defined(CN_COMM_FOR_CE) + wsprintf(szName_, _T("COM%d:"), dwPort); +#else + wsprintf(szName_, _T("\\\\.\\COM%d"), dwPort); +#endif + } + //! 򿪴 + virtual bool OpenPort() + { + CN_ASSERT(!IsOpen()); + + if(IsOpen()) + Close(); + + hComm_ = ::CreateFile( + szName_, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | (IsOverlappedMode() ? FILE_FLAG_OVERLAPPED : 0), + NULL + ); + + return IsOpen(); + } + //! ô + virtual bool SetupPort() + { + if(!CN_ASSERT(IsOpen())) + return false; + + #if defined(CN_COMM_FOR_CE) + ::SetupComm(hComm_, 4096, 4096); + #else + if(!CN_ASSERT(::SetupComm(hComm_, 4096, 4096)))//! ö˿ڷͽնдС, 4096ֽ, д4096ֽ, I/OģʽͶ + return false; + #endif + + if(!CN_ASSERT(::GetCommTimeouts(hComm_, &CO_))) + return false; + + CO_.ReadIntervalTimeout = 50;//! óʱṹ ַС100ms + CO_.ReadTotalTimeoutMultiplier = 0; + CO_.ReadTotalTimeoutConstant = IsOverlappedMode() ? 500 : m_lReadTimeout;//! ʱ صI/Oģʽ500 I/Oģʽ250 + CO_.WriteTotalTimeoutMultiplier = IsOverlappedMode() ? 1 : 0; + CO_.WriteTotalTimeoutConstant = IsOverlappedMode() ? 10000 : 250;//! дʱ صI/Oģʽ(10000+1ֽ) I/Oģʽ250 + + if(!CN_ASSERT(::SetCommTimeouts(hComm_, &CO_))) + return false; + + if(!CN_ASSERT(::PurgeComm(hComm_, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR )))//! ˿ + return false; + + return true; + } + //! ˿ݶ뻺 + DWORD PortToBuffer(DWORD dwPortByteNum) + { + BlockBuffer::InnerLock locker(&I_); + return dwPortByteNum ? I_.Release(ReadPort(I_.GetFreePtr(dwPortByteNum), dwPortByteNum)) : 0; + } + //! д˿ + DWORD BufferToPort(DWORD dwMaxSize = 1024) + { + if (IsOverlappedMode()) + { + BlockBuffer::InnerLock locker(&O_); + + if (!O_.Size()) + return 0; + + DWORD dwWrite = dwMaxSize > O_.GetPtrSize() ? O_.GetPtrSize() : dwMaxSize; + WritePort(O_.GetPtr(), dwWrite); + return O_.Read(NULL, dwWrite); + } + else + { + BYTE btTemp[1024]; + DWORD dwLength, dwIndex = 0; + + O_.Lock(); + dwLength = O_.Read(btTemp, 1024); + O_.Unlock(); + + while ( dwIndex < dwLength ) + dwIndex += WritePort(btTemp + dwIndex, dwLength - dwIndex); + + return dwLength; + } + } + /*! \param uMsg Ϣ \param lParam \param bPostMode PostMessageSendMessageϢ*/ + //! ھ߳IDЧ, ͳϢ, Ӧ¼֪ͨ, WPARAMĬϰڱ + virtual void Notify(UINT uMsg, LPARAM lParam = 0, bool bPostMode = true) + { + if (NULL != m_pComCb) + m_pComCb(uMsg, m_pUser); + else if (m_pfn != nullptr) + m_pfn(); + } + //---------------------------------------threads callback----------------------------------------------------- + //! ӦEV_RXCHAR¼ ̻߳ص, 麯ڻչ(Ƽʽ) + virtual void OnReceive() + { + Notify(ON_COM_RECEIVE); + } + //! ӦEV_DSR¼ + virtual void OnDSR() + { + Notify(ON_COM_DSR, CheckDSR() ? 1 : 0); + } + //! ӦEV_CTS¼ + virtual void OnCTS() + { + Notify(ON_COM_CTS, CheckCTS() ? 1 : 0); + } + //! ӦEV_BREAK¼ + virtual void OnBreak() + { + ClearCommBreak(hComm_); + Notify(ON_COM_BREAK); + } + //! ӦEV_TXEMPTY¼ + virtual void OnTxEmpty() + { + Notify(ON_COM_TXEMPTY); + } + //! ӦEV_ERROR¼ + virtual void OnError() + { + Notify(ON_COM_ERROR, ClearError()); + } + //! ӦEV_RING¼ + virtual void OnRing() + { + Notify(ON_COM_RING, CheckRING() ? 1 : 0); + } + //! ӦEV_RLSD¼ + virtual void OnRLSD() + { + Notify(MS_RLSD_ON, CheckRLSD() ? 1 : 0); + } + //! ӦEV_RXFLAG¼ + virtual void OnRxFlag() + { + Notify(ON_COM_RXFLAG); + } + //! ӦEV_POWER¼ + virtual void OnPower() + { + Notify(ON_COM_POWER); + } + //! ӦEV_RX80FULL¼ + virtual void OnRx80Full() + { + Notify(ON_COM_RX80FULL); + } + //! ӦEV_EVENT1¼ + virtual void OnEvent1() + { + Notify(ON_COM_EVENT1); + } + //! ӦEV_EVENT2¼ + virtual void OnEvent2() + { + Notify(ON_COM_EVENT2); + } + //! ӦEV_PERR¼ + virtual void OnPrintErr() + { + Notify(ON_COM_PERR); + } + //! ͨõ¼ + virtual void HandleEvent(DWORD dwMask) + { + if ((dwMask & EV_RXCHAR) && !(dwOption_&EN_RX_THREAD)) + { + DWORD dwLength = GetQueueCount(true); + + if (dwLength) + { + if (dwOption_ & EN_RX_BUFFER) + { + PortToBuffer((dwLength << 1) + 64);//ֽ ¼϶ + + if (I_.Size() >= dwNotifyNum_) + OnReceive(); + } + else + { + if (dwLength >= dwNotifyNum_) + OnReceive(); + } + } + } + + if (dwMask & EV_TXEMPTY) + { + if ((dwOption_&EN_TX_BUFFER) && !(dwOption_&EN_TX_THREAD) && O_.SafeSize()) + BufferToPort(); + + OnTxEmpty(); + } + + if (dwMask & EV_RXFLAG) + OnRxFlag(); + + if (dwMask & EV_CTS) + OnCTS(); + + if (dwMask & EV_DSR) + OnDSR(); + + if (dwMask & EV_RING) + OnRing(); + + if (dwMask & EV_RLSD) + OnRLSD(); + + if (dwMask & EV_BREAK) + OnBreak(); + + if (dwMask & EV_ERR) + OnError(); + + #ifdef CN_COMM_FOR_CE + if (dwMask & EV_POWER) + OnPower(); + #endif + } + +#ifndef CN_COMM_FOR_CE + //! ߳صI/Oģ + virtual DWORD OverlappedModel() + { + if(!CN_ASSERT(IsOpen())) + return 1; + + if(!CN_ASSERT(::SetCommMask(hComm_, dwWaitEvent_))) + return 1; + + for(DWORD dwMask = 0, dwLength; bContinue_ && IsOpen(); dwMask = 0) + { + if (GetQueueCount(true))//! ȴ¼ǰɨǷδ ģһEV_RXCHAR¼ ¼֪ͨ + dwMask = EV_RXCHAR, Sleep(10); + else + { + if(!::WaitCommEvent(hComm_, &dwMask, &EO_)) + { + if(::GetLastError() == ERROR_IO_PENDING) + ::GetOverlappedResult(hComm_, &EO_, &dwLength, TRUE); + else + { + Sleep(10); + continue; + } + } + } + + if(dwMask == 0) + { + if ((dwOption_&EN_TX_BUFFER) && !(dwOption_&EN_TX_THREAD) && O_.SafeSize()) + BufferToPort(); + + continue; + } + + HandleEvent(dwMask); + }//for + + return 0; + } +#endif + //! ߳I/Oģ + virtual DWORD NonoverlappedModel() + { + if(!CN_ASSERT(IsOpen())) + return 1; + + for (DWORD dwReturn; bContinue_ && IsOpen();) + { + dwReturn = WaitForSingleObject(hWatchEvent_, 50); + + if (!bContinue_) + break; + + switch (dwReturn) + { + case WAIT_OBJECT_0: + while ((dwOption_&EN_TX_BUFFER) && O_.SafeSize()) + BufferToPort(); + + ResetEvent(hWatchEvent_); + + break; + + case WAIT_TIMEOUT: + + DWORD dwLength = GetQueueCount(true); + + if (dwLength) + { + if (dwOption_ & EN_RX_BUFFER) + { + PortToBuffer(dwLength); + + if (I_.Size() >= dwNotifyNum_) + OnReceive(); + } + else + { + if (dwLength >= dwNotifyNum_) + OnReceive(); + } + } + + if ( (dwOption_&EN_TX_BUFFER) && O_.SafeSize() ) + BufferToPort(); + + break; + } + } + + return 0; + } +#ifdef CN_COMM_FOR_CE + //! ߳WINCEI/Oģ(ص+ Ҳ֪΢ʲôģʽ) + virtual DWORD EmbeddedModel() + { + if(!CN_ASSERT(IsOpen())) + return 1; + + if(!CN_ASSERT(::SetCommMask(hComm_, dwWaitEvent_))) + return 1; + + for(DWORD dwMask = 0; bContinue_ && IsOpen(); dwMask = 0) + { + if (GetQueueCount(true))//! ȴ¼ǰɨǷδ ģһEV_RXCHAR¼ ¼֪ͨ + dwMask = EV_RXCHAR, Sleep(10); + else + { + if(!::WaitCommEvent(hComm_, &dwMask, NULL)) + continue; + } + + if(dwMask == 0) + { + if ( (dwOption_&EN_TX_BUFFER) && !(dwOption_&EN_TX_THREAD) && O_.SafeSize()) + BufferToPort(); + + continue; + } + + HandleEvent(dwMask); + + }//for + + return 0; + } +#endif + //! ˫ȻԸı; + virtual DWORD ReadModel() + { + while(bContinue_) + { + Sleep(50); + + DWORD dwLength = GetQueueCount(true); + + if (dwLength) + { + if (dwOption_ & EN_RX_BUFFER) + { + PortToBuffer(dwLength); + + if (I_.Size() >= dwNotifyNum_) + OnReceive(); + } + else + { + if (dwLength >= dwNotifyNum_) + OnReceive(); + } + } + } + + return 0; + } + //! ˫ȻԸı; + virtual DWORD WriteModel() + { + if (!IsOpen()) + { + return -1; + } + CN_ASSERT(dwOption_ & EN_TX_BUFFER); + + while (bContinue_) + { + DWORD dwReturn = ::WaitForSingleObject(hWriteEvent_, 200); + + while(bContinue_ && O_.SafeSize()) + BufferToPort(); + + if (dwReturn == WAIT_OBJECT_0) + ResetEvent(hWatchEvent_); + } + + return 0; + } + +private: + //! ֹ + ComComm(const ComComm&); + //! ֵֹ + ComComm &operator = (const ComComm&); + +#if defined(_MT) && !defined(CN_COMM_FOR_CE) + //! ߳ Watch MyThread ɼ þǷɶд + static UINT APIENTRY WatchThreadProc(LPVOID lpPara) +#else + //! ߳ Watch MyThread ɼ þǷɶд + static DWORD WINAPI WatchThreadProc(LPVOID lpPara) +#endif + { + #ifdef CN_COMM_FOR_CE + DWORD dwCode = ((ComComm *)lpPara)->EmbeddedModel(); + #else + DWORD dwCode = ((ComComm *)lpPara)->IsOverlappedMode() + ? ((ComComm *)lpPara)->OverlappedModel() + : ((ComComm *)lpPara)->NonoverlappedModel(); + + #if defined(_MT) + _endthreadex(dwCode); + #endif + #endif + + return dwCode; + } + +#if defined(_MT) && !defined(CN_COMM_FOR_CE) + //! ˫߳ ʱδ ò + static UINT APIENTRY ReadThreadProc(LPVOID lpPara) +#else + //! ˫߳ ʱδ ò + static DWORD WINAPI ReadThreadProc(LPVOID lpPara) +#endif + { + DWORD dwCode = ((ComComm *)lpPara)->ReadModel(); + + #if defined(_MT) && !defined(CN_COMM_FOR_CE) + _endthreadex(dwCode); + #endif + + return dwCode; + } + +#if defined(_MT) && !defined(CN_COMM_FOR_CE) + //! ˫߳ WINCEԲ + static UINT APIENTRY WriteThreadProc(LPVOID lpPara) +#else + //! ˫߳ WINCEԲ + static DWORD WINAPI WriteThreadProc(LPVOID lpPara) +#endif + { + DWORD dwCode = ((ComComm *)lpPara)->WriteModel(); + + #if defined(_MT) && !defined(CN_COMM_FOR_CE) + _endthreadex(dwCode); + #endif + + return dwCode; + } +}; + +#endif //! _CN_COMM_H_ diff --git a/common/commonHeadFile/CommMgr.cpp b/common/commonHeadFile/CommMgr.cpp new file mode 100644 index 0000000..193d990 --- /dev/null +++ b/common/commonHeadFile/CommMgr.cpp @@ -0,0 +1,135 @@ +#include "CommMgr.h" + +CCommMgr::CCommMgr(void) +{ + +} +CCommMgr::~CCommMgr(void) +{ + +} +//com (dwBaudRate Dz) +bool CCommMgr::Open(DWORD dwPort, DWORD dwBaudRate) +{ + if(IsOpen())//״ֱ̬ӷ + return true; + + //CString str = "Function :[CCommPortMgr::Open][com ]"; + ////gLogMgr->WriteDebugLog(str); + + //CString str1; + //str1.Format("%ld",dwPort); + + //str = "Result :[com <"+str1+">]"; + bool ret; + if(m_Com.Open(dwPort,dwBaudRate) == false) + { + //gLogMgr->WriteDebugLog(str,_LOG_ERROR); + ret = false; + } + else + { + //str += "[OK]"; + //gLogMgr->WriteDebugLog(str); + ret = true; + } + return ret; +} +//򿪴, ʹ"9600, 8, n, 1"ַô +bool CCommMgr::Open(DWORD dwPort, char *szSetStr) +{ + // CString str = "Function :[CCommPortMgr::Open][com ]"; + //gLogMgr->WriteDebugLog(str); + + //CString str1; + //str1.Format("%ld",dwPort); + + //str = "Result :[com <"+str1+">]"; + bool ret; + + int len = MultiByteToWideChar(CP_ACP, 0, szSetStr, -1, NULL, 0); // 軺С + wchar_t* wStr = new wchar_t[len]; // ַ + MultiByteToWideChar(CP_ACP, 0, szSetStr, -1, wStr, len); // ת + LPCTSTR lpctstr = wStr; + + if(m_Com.Open(dwPort, lpctstr) == false) + { + //gLogMgr->WriteDebugLog(str,_LOG_ERROR); + ret = false; + } + else + { + //str += "[OK]"; + //gLogMgr->WriteDebugLog(str); + ret = true; + } + delete[] wStr; + return ret; +} +void CCommMgr::SetWorkMode(BOOL bSleep, DWORD dwOutTime) +{ + m_Com.SetWorkMode(bSleep, dwOutTime); +} +//󶨴ϢĴID +void CCommMgr::SetWnd(HWND hWnd) +{ + //CString str = "Function :[SetWnd][󶨴ϢӦID]"; + //gLogMgr->WriteDebugLog(str); + + //m_Com.SetWnd(hWnd); +} + +void CCommMgr::SetNotify(std::function _pfn) +{ + //CString str = "Function :[SetWnd][󶨴ϢӦID]"; + m_Com.SetDataCallBack(_pfn); +} +//ȡϢszBuffer +DWORD CCommMgr::ReadBuf(char *szBuffer,DWORD dwBufferLength) +{ + return m_Com.Read(szBuffer,dwBufferLength); +} + +std::string CCommMgr::ReadStr() +{ + const int dwBufferLength = 500; + char szBuffer[dwBufferLength]; + memset(szBuffer,'0',dwBufferLength); + + m_Com.ReadString(szBuffer,dwBufferLength); + //תΪCString + //CString str = szBuffer; + + std::string str(szBuffer); + return str; +} + +int CCommMgr::Read(LPVOID Buffer, DWORD dwBufferLength) +{ + return m_Com.Read(Buffer,dwBufferLength); +} +//Ϣ +DWORD CCommMgr::Write(const char *szBuffer) +{ + return m_Com.Write(szBuffer, strlen(szBuffer)); +} + +DWORD CCommMgr::WriteBuf(LPVOID Buffer, DWORD dwBufferLength) +{ + return m_Com.Write(Buffer,dwBufferLength); +} +//رմ +void CCommMgr::Close() +{ + m_Com.Close(); +} +void CCommMgr::SetBufferSize(DWORD dwInputSize, DWORD dwOutputSize) +{ + //m_Com.SetBufferSize(dwInputSize,dwOutputSize); +} +int CCommMgr::GetInputSize() +{ + //gLogMgr->WriteDebugLog("BufferSize","",m_Com.GetInputSize()); + return 0; +} + diff --git a/common/commonHeadFile/CommMgr.h b/common/commonHeadFile/CommMgr.h new file mode 100644 index 0000000..1616e16 --- /dev/null +++ b/common/commonHeadFile/CommMgr.h @@ -0,0 +1,26 @@ +#pragma once +#include +#include "ComComm.h" +//Եcom ٷװһ +class CCommMgr +{ +public: + CCommMgr(void); + ~CCommMgr(void); + bool Open(DWORD dwPort, DWORD dwBaudRate = 9600); + bool Open(DWORD dwPort, char *szSetStr); + void Close(); + void SetWnd(HWND hWnd); + void SetNotify(std::function _pfn); + void SetWorkMode(BOOL bSleep, DWORD dwOutTime); + DWORD Write(const char *szBuffer); + DWORD WriteBuf(LPVOID Buffer, DWORD dwBufferLength); + std::string ReadStr(); + DWORD ReadBuf(char *szBuffer,DWORD dwBufferLength); + int Read(LPVOID Buffer, DWORD dwBufferLength); + bool IsOpen(){return m_Com.IsOpen();}; + void SetBufferSize(DWORD dwInputSize, DWORD dwOutputSize); + int GetInputSize(); +private: + ComComm m_Com;//PLC ڹ +}; \ No newline at end of file diff --git a/common/commonHeadFile/GlobalDefine.h b/common/commonHeadFile/GlobalDefine.h index 24d0780..33dc0a2 100644 --- a/common/commonHeadFile/GlobalDefine.h +++ b/common/commonHeadFile/GlobalDefine.h @@ -56,6 +56,140 @@ using namespace std;/*ʹ #define MARK_OBJ_CNT 25//obj +enum eGlobalVariableType +{ + _GlobalVar_NULL = 0, + _GlobalVar_Alarm_Robot_StateErr, + _GlobalVar_Alarm_Robot_OverLoad1, + _GlobalVar_Alarm_Robot_Crash1, + _GlobalVar_Alarm_Robot_InsideFANAlarm, + _GlobalVar_Alarm_Robot_SoftLimitErr, + _GlobalVar_Alarm_Robot_CassetteStepZero, + _GlobalVar_Alarm_Robot_CassetteStepOverN, + _GlobalVar_Alarm_Robot_PointNumberZero, + _GlobalVar_Alarm_Robot_HostBufferFull, + _GlobalVar_Alarm_Robot_PositioningTimeOverAx, + _GlobalVar_Alarm_Robot_IllegalRemoteCommandStr, + _GlobalVar_Alarm_Robot_CommunicationRetryOver, + _GlobalVar_Alarm_Robot_ExecutionBufferOver, + _GlobalVar_Alarm_Robot_IllegalCassetteNo, + _GlobalVar_Alarm_Robot_ServoDriverAlarmCodeAx, + _GlobalVar_Alarm_Robot_IllegalGroupNo, + _GlobalVar_Alarm_Robot_ILError, + _GlobalVar_Alarm_Robot_ServoSignalOFF, + _GlobalVar_Alarm_Robot_IllegalCassetteSel, + _GlobalVar_Alarm_Robot_IllegalStageSel, + _GlobalVar_Alarm_Robot_WorkExist, + _GlobalVar_Alarm_Robot_IllegalCassetteOrStageOrPoint, + _GlobalVar_Alarm_Robot_RetryVacuumMiss1, + _GlobalVar_Alarm_Robot_IllegalSensor, + _GlobalVar_Alarm_Robot_CanNotGet, + _GlobalVar_Alarm_Robot_CanNotPut, + _GlobalVar_Alarm_Robot_TeachingCombiCheckError, + _GlobalVar_Alarm_Robot_RetryVacuumMiss2, + _GlobalVar_Alarm_Robot_DriverNotReady, + _GlobalVar_Alarm_Robot_MinusStrokeOver, + _GlobalVar_Alarm_Robot_DiffOver, + _GlobalVar_Alarm_Robot_EncoderAlarm1, + _GlobalVar_Alarm_Robot_VelocityOver, + _GlobalVar_Alarm_Robot_CarryingAlarm, + _GlobalVar_Alarm_Robot_OverLoad2, + _GlobalVar_Alarm_Robot_Crash2, + _GlobalVar_Alarm_Robot_EmergencyStop, + _GlobalVar_Alarm_Robot_MappingAlarm, + _GlobalVar_Alarm_Robot_ClampError, + _GlobalVar_Alarm_Robot_ServoDriverAlarm, + _GlobalVar_Alarm_Robot_DataAlarmCode, + _GlobalVar_Alarm_Robot_EncoderAlarm2, + _GlobalVar_Alarm_Robot_CmdOverTime, + _GlobalVar_Alarm_Robot_ComPortNotOpen, + _GlobalVar_Alarm_Robot_CmdNak, + + + + _GlobalVar_Alarm_LoadPort1_StateCheckError, + _GlobalVar_Alarm_LoadPort2_StateCheckError, + _GlobalVar_Alarm_LoadPort1_WaferProtrusion, + _GlobalVar_Alarm_LoadPort2_WaferProtrusion, + _GlobalVar_Alarm_LoadPort1_MainAirError, + _GlobalVar_Alarm_LoadPort2_MainAirError, + _GlobalVar_Alarm_LoadPort1_ZAxisPositionNG, + _GlobalVar_Alarm_LoadPort2_ZAxisPositionNG, + _GlobalVar_Alarm_LoadPort1_YAxisPositionNG, + _GlobalVar_Alarm_LoadPort2_YAxisPositionNG, + _GlobalVar_Alarm_LoadPort1_DoorPositionNG, + _GlobalVar_Alarm_LoadPort2_DoorPositionNG, + _GlobalVar_Alarm_LoadPort1_MapperArmPositionNG, + _GlobalVar_Alarm_LoadPort2_MapperArmPositionNG, + _GlobalVar_Alarm_LoadPort1_MapperZAxisPositionNG, + _GlobalVar_Alarm_LoadPort2_MapperZAxisPositionNG, + _GlobalVar_Alarm_LoadPort1_MapperStopperPositionNG, + _GlobalVar_Alarm_LoadPort2_MapperStopperPositionNG, + _GlobalVar_Alarm_LoadPort1_MappingEndPositionNG, + _GlobalVar_Alarm_LoadPort2_MappingEndPositionNG, + _GlobalVar_Alarm_LoadPort1_FOUPClampOpenError, + _GlobalVar_Alarm_LoadPort2_FOUPClampOpenError, + _GlobalVar_Alarm_LoadPort1_FOUPClampCloseError, + _GlobalVar_Alarm_LoadPort2_FOUPClampCloseError, + _GlobalVar_Alarm_LoadPort1_LatchKeyOpenError, + _GlobalVar_Alarm_LoadPort2_LatchKeyOpenError, + _GlobalVar_Alarm_LoadPort1_LatchKeyCloseError, + _GlobalVar_Alarm_LoadPort2_LatchKeyCloseError, + _GlobalVar_Alarm_LoadPort1_VacuumOnError, + _GlobalVar_Alarm_LoadPort2_VacuumOnError, + _GlobalVar_Alarm_LoadPort1_VacuumOffError, + _GlobalVar_Alarm_LoadPort2_VacuumOffError, + _GlobalVar_Alarm_LoadPort1_FOUPOpenOvertime, + _GlobalVar_Alarm_LoadPort2_FOUPOpenOvertime, + _GlobalVar_Alarm_LoadPort1_FOUPCloseOvertime, + _GlobalVar_Alarm_LoadPort2_FOUPCloseOvertime, + _GlobalVar_Alarm_LoadPort1_ParallelSignalError, + _GlobalVar_Alarm_LoadPort2_ParallelSignalError, + _GlobalVar_Alarm_LoadPort1_FanOperationError, + _GlobalVar_Alarm_LoadPort2_FanOperationError, + _GlobalVar_Alarm_LoadPort1_InterlockCircuitFailure, + _GlobalVar_Alarm_LoadPort2_InterlockCircuitFailure, + _GlobalVar_Alarm_LoadPort1_CommunicationError, + _GlobalVar_Alarm_LoadPort2_CommunicationError, + _GlobalVar_Alarm_LoadPort1_ObstaclesSensorError, + _GlobalVar_Alarm_LoadPort2_ObstaclesSensorError, + _GlobalVar_Alarm_LoadPort1_MappingMechanicalError, + _GlobalVar_Alarm_LoadPort2_MappingMechanicalError, + + _GlobalVar_Alarm_LoadPort1_LoadFailed_RobotRunning, + _GlobalVar_Alarm_LoadPort2_LoadFailed_RobotRunning, + _GlobalVar_Alarm_LoadPort1_LoadFailed_E84Running, + _GlobalVar_Alarm_LoadPort2_LoadFailed_E84Running, + _GlobalVar_Alarm_Port1E84_ReadIO_Failed, + _GlobalVar_Alarm_Port2E84_ReadIO_Failed, + _GlobalVar_Alarm_LoadPort1_LoadFailed_OHTNotLeave, + _GlobalVar_Alarm_LoadPort2_LoadFailed_OHTNotLeave, + _GlobalVar_Alarm_LoadPort1_MAPDT_Feedback_Error, + _GlobalVar_Alarm_LoadPort2_MAPDT_Feedback_Error, + _GlobalVar_Alarm_LoadPort1_STATE_Feedback_Error, + _GlobalVar_Alarm_LoadPort2_STATE_Feedback_Error, + _GlobalVar_Alarm_LoadPort1_UnloadFailed_RobotRunning, + _GlobalVar_Alarm_LoadPort1_InitialPositionError, + _GlobalVar_Alarm_LoadPort1_OperationNotStopped, + _GlobalVar_Alarm_LoadPort1_DoorNotOpened, + _GlobalVar_Alarm_LoadPort1_DoorNotClosed, + _GlobalVar_Alarm_LoadPort1_WaferProtrusionSensorOn, + + + _GlobalVar_Alarm_Port1E84_CmdOverTime, + _GlobalVar_Alarm_Port1E84_CmdExtErr, + _GlobalVar_Alarm_Port1E84_VALID_BreakOff, + _GlobalVar_Alarm_Port1E84_TP3_OverTime, + _GlobalVar_Alarm_Port1E84_TP4_OverTime, + _GlobalVar_Alarm_Port1E84_E84ExecuteError, + _GlobalVar_Alarm_Port2E84_CmdOverTime, + _GlobalVar_Alarm_Port2E84_CmdExtErr, + _GlobalVar_Alarm_Port2E84_VALID_BreakOff, + _GlobalVar_Alarm_Port2E84_TP3_OverTime, + _GlobalVar_Alarm_Port2E84_TP4_OverTime, + _GlobalVar_Alarm_Port2E84_E84ExecuteError, +}; + //깤ߵ enum MOUSE_TOOL { @@ -441,17 +575,17 @@ public: CAlamLightStateType m_LightGreenState;//̵״̬ CAlamLightStateType m_LightAlamState;//״̬ }; -//class CDlgItemStr -//{ -//public: -// CDlgItemStr(void) -// { -// m_ID = 0; -// }; -//public: -// int m_ID;// -// CString m_Str;//ʾ -//}; +class CDlgItemStr +{ +public: + CDlgItemStr(void) + { + m_ID = 0; + }; +public: + int m_ID;// + CString m_Str;//ʾ +}; enum AlignDirect { AlignTop = 0, @@ -462,6 +596,36 @@ enum AlignDirect { AlignHorizonalCenter, AlignVecticalArrange, // AlignHorizonalArrange, +}; +class _declspec(dllexport) CDataPoint +{ +public: + void Stretch(Dbxy &Pt, Dbxy BasePt, double Size, double Diff, X_OR_Y xy); + +public: + Dbxy m_pt;//ֵ + bool m_bIsNode;//ǷΪڵ +}; + +class _declspec(dllexport) CFontSizeScale +{ +public: + CFontSizeScale(void) + { + m_SizeScale.x = 1; + m_SizeScale.y = 1; + m_CharStr = "A"; + }; +public: + CString m_CharStr;//Ӧַ(0~9)(A~Z) + Dbxy m_SizeScale;//ߴı +}; -}; \ No newline at end of file +//ַתҪõĽṹ +typedef struct { + Dbxy oldBasePt;//Ϊ׼ + double oldSizeWidth; //ǰߴ + double oldSizeHeight; + double diff; //ɳߴ³ߴ֮IJֵ +}OldCharAttr; \ No newline at end of file diff --git a/word/recipe参数包含哪些内容.txt b/word/recipe参数包含哪些内容.txt new file mode 100644 index 0000000..b884505 --- /dev/null +++ b/word/recipe参数包含哪些内容.txt @@ -0,0 +1,5 @@ +1.激光参数 +2.振镜参数 +3.焦距 +4.晶圆属性 +5.mark具体位置 \ No newline at end of file diff --git a/word/~$莱普IAT Check List - 20250617.xlsx b/word/~$莱普IAT Check List - 20250617.xlsx new file mode 100644 index 0000000..1e0c8b3 Binary files /dev/null and b/word/~$莱普IAT Check List - 20250617.xlsx differ diff --git a/word/机器人保存程序指令.txt b/word/机器人保存程序指令.txt new file mode 100644 index 0000000..214c25f --- /dev/null +++ b/word/机器人保存程序指令.txt @@ -0,0 +1 @@ +$1IW \ No newline at end of file diff --git a/word/莱普IAT Check List - 20250530.xlsx b/word/莱普IAT Check List - 20250530.xlsx new file mode 100644 index 0000000..5865aee Binary files /dev/null and b/word/莱普IAT Check List - 20250530.xlsx differ diff --git a/word/莱普IAT Check List - 20250609.xlsx b/word/莱普IAT Check List - 20250609.xlsx new file mode 100644 index 0000000..5789fd6 Binary files /dev/null and b/word/莱普IAT Check List - 20250609.xlsx differ diff --git a/word/莱普IAT Check List - 20250617.xlsx b/word/莱普IAT Check List - 20250617.xlsx new file mode 100644 index 0000000..f1ab3ab Binary files /dev/null and b/word/莱普IAT Check List - 20250617.xlsx differ diff --git a/word/购买安装版semi字体.zip b/word/购买安装版semi字体.zip new file mode 100644 index 0000000..03cd809 Binary files /dev/null and b/word/购买安装版semi字体.zip differ diff --git a/word/购买安装版semi字体/购买安装版semi字体/Semi-single-simple.ttf b/word/购买安装版semi字体/购买安装版semi字体/Semi-single-simple.ttf new file mode 100644 index 0000000..e2be360 Binary files /dev/null and b/word/购买安装版semi字体/购买安装版semi字体/Semi-single-simple.ttf differ diff --git a/word/购买安装版semi字体/购买安装版semi字体/semi-double-simple.ttf b/word/购买安装版semi字体/购买安装版semi字体/semi-double-simple.ttf new file mode 100644 index 0000000..879e30c Binary files /dev/null and b/word/购买安装版semi字体/购买安装版semi字体/semi-double-simple.ttf differ diff --git a/word/购买安装版semi字体/购买安装版semi字体/semi-double-simple更改小z.otf b/word/购买安装版semi字体/购买安装版semi字体/semi-double-simple更改小z.otf new file mode 100644 index 0000000..c5293ce Binary files /dev/null and b/word/购买安装版semi字体/购买安装版semi字体/semi-double-simple更改小z.otf differ diff --git a/word/购买安装版semi字体/购买安装版semi字体/semi-double.ttf b/word/购买安装版semi字体/购买安装版semi字体/semi-double.ttf new file mode 100644 index 0000000..16845dc Binary files /dev/null and b/word/购买安装版semi字体/购买安装版semi字体/semi-double.ttf differ diff --git a/word/购买安装版semi字体/购买安装版semi字体/semi-single.ttf b/word/购买安装版semi字体/购买安装版semi字体/semi-single.ttf new file mode 100644 index 0000000..7f495df Binary files /dev/null and b/word/购买安装版semi字体/购买安装版semi字体/semi-single.ttf differ diff --git a/word/软件页面.rar b/word/软件页面.rar new file mode 100644 index 0000000..9100872 Binary files /dev/null and b/word/软件页面.rar differ diff --git a/word/软件页面/die操作页.png b/word/软件页面/die操作页.png new file mode 100644 index 0000000..5369883 Binary files /dev/null and b/word/软件页面/die操作页.png differ diff --git a/word/软件页面/loadport操作页.png b/word/软件页面/loadport操作页.png new file mode 100644 index 0000000..145c5e1 Binary files /dev/null and b/word/软件页面/loadport操作页.png differ diff --git a/word/软件页面/全局配置页.png b/word/软件页面/全局配置页.png new file mode 100644 index 0000000..22bc6aa Binary files /dev/null and b/word/软件页面/全局配置页.png differ diff --git a/word/软件页面/字符设置页.png b/word/软件页面/字符设置页.png new file mode 100644 index 0000000..675583e Binary files /dev/null and b/word/软件页面/字符设置页.png differ diff --git a/word/软件页面/晶圆传送页.png b/word/软件页面/晶圆传送页.png new file mode 100644 index 0000000..f9d2dff Binary files /dev/null and b/word/软件页面/晶圆传送页.png differ diff --git a/word/软件页面/电缸操作页.png b/word/软件页面/电缸操作页.png new file mode 100644 index 0000000..40934cf Binary files /dev/null and b/word/软件页面/电缸操作页.png differ diff --git a/word/软件页面/轴操作页.png b/word/软件页面/轴操作页.png new file mode 100644 index 0000000..56b4952 Binary files /dev/null and b/word/软件页面/轴操作页.png differ diff --git a/word/软件页面/首页.png b/word/软件页面/首页.png new file mode 100644 index 0000000..5ba6d83 Binary files /dev/null and b/word/软件页面/首页.png differ