Browse Source

同步载具物料,标尺,状态栏信息,画笔功能

yun 2 days ago
parent
commit
179c115ad8
26 changed files with 569 additions and 205 deletions
  1. 2 2
      View/die-bonder-ui/CameraMaterialGroupWnd/CameraImage/CameraImageHandler.cpp
  2. 1 1
      View/die-bonder-ui/CameraMaterialGroupWnd/CameraImage/CameraImageHandler.h
  3. 19 0
      View/die-bonder-ui/CameraMaterialGroupWnd/Group.cpp
  4. 2 2
      View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/Bond.cpp
  5. 61 23
      View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/DraggableLine.cpp
  6. 13 31
      View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/DraggableLine.h
  7. 74 6
      View/die-bonder-ui/ImageWidget.cpp
  8. 12 0
      View/die-bonder-ui/ImageWidget.h
  9. 2 2
      View/die-bonder-ui/Login.cpp
  10. 4 4
      View/die-bonder-ui/MainWnd.cpp
  11. 28 21
      View/die-bonder-ui/OriginalWnd/ChartsAndCamerasWnd.cpp
  12. 6 2
      View/die-bonder-ui/OriginalWnd/ChartsAndCamerasWnd.h
  13. 7 7
      View/die-bonder-ui/OriginalWnd/DbTreeViewManager.cpp
  14. 15 11
      View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.cpp
  15. 1 1
      View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.h
  16. 116 3
      View/die-bonder-ui/OriginalWnd/OriginalWnd.cpp
  17. 34 0
      View/die-bonder-ui/OriginalWnd/OriginalWnd.h
  18. 2 2
      View/die-bonder-ui/OriginalWnd/OriginalWnd.ui
  19. 19 19
      View/die-bonder-ui/OriginalWnd/SingleCameraOperationWnd.cpp
  20. 6 0
      View/die-bonder-ui/SBTdie-bonder-ui.vcxproj
  21. 14 4
      View/die-bonder-ui/SBTdie-bonder-ui.vcxproj.filters
  22. 92 20
      View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.cpp
  23. 8 2
      View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.h
  24. 10 10
      View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.ui
  25. 4 4
      View/die-bonder-ui/dark.qss
  26. 17 28
      View/die-bonder-ui/light.qss

+ 2 - 2
View/die-bonder-ui/CameraMaterialGroupWnd/CameraImage/CameraImageHandler.cpp

@@ -87,8 +87,8 @@ void CameraImageHandler::initGroup(int CameraId) {
 
     if (CameraId == 1)
     {
-        MaterialWindowType = 1;
-        m_pWafer = new Wafer(0);
+        MaterialWindowType = 4;
+        bond = new Bond(0);
         m_pGroup = new Group(CameraId, ":/images/test_image/image_1.png", MaterialWindowType, dispmodel1, this);
     } 
     else if (CameraId == 2) 

+ 1 - 1
View/die-bonder-ui/CameraMaterialGroupWnd/CameraImage/CameraImageHandler.h

@@ -12,7 +12,7 @@
 #include "CameraMaterialGroupWnd/Group.h"
 #include "CameraMaterialGroupWnd/MaterialWindow/Wafer.h"
 #include "CameraMaterialGroupWnd/MaterialWindow/Waffle.h"
-#include "../MaterialWindow/Bond.h"
+#include "CameraMaterialGroupWnd/MaterialWindow/Bond.h"
 
 
 class CameraImageHandler : public QWidget {

+ 19 - 0
View/die-bonder-ui/CameraMaterialGroupWnd/Group.cpp

@@ -49,6 +49,11 @@ Group::Group(int Id, const QString& imagePath1, int MaterialWindowType, const QS
         m_pMaterialbox = new MaterialBox(0, ui->Imagewidget_right);
         MaterialBoxWidget();
     }
+    else if (MaterialWindowType == 4)
+    {
+        m_pBond = new Bond(ui->Imagewidget_right);
+        BondWidget();
+    }
 
     saveGroupSettings(Id, imagePath1, MaterialWindowType, textList);
     connect(ui->GroupButton, &QPushButton::clicked, this, &Group::onclickbutton);
@@ -184,6 +189,20 @@ void Group::MaterialBoxWidget()
     layout2->addWidget(pixmapLabel);
 }
 
+void Group::BondWidget()
+{
+    QVBoxLayout* layout2 = new QVBoxLayout(ui->Imagewidget_right);
+    m_pBond->paintInitFrom(ui->Imagewidget_right);
+
+    QLabel* pixmapLabel = new QLabel();
+    pixmapLabel->setPixmap(m_pBond->getGlobalPixmap());
+
+    ui->Imagewidget_right->setLayout(layout2);
+    ui->Imagewidget_right->setFixedSize(110, 110);
+    layout2->setContentsMargins(0, 0, 0, 0);
+    layout2->addWidget(pixmapLabel);
+}
+
 void Group::onclickbutton(){
     QSettings settings("YourCompany", "YourApplication_Button");
     settings.setValue("GroupId_button", m_nGroupId);

+ 2 - 2
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/Bond.cpp

@@ -111,7 +111,7 @@ void Bond::initFrom(QWidget* parent) {
                 scene->addItem(pcbItem);
 
                 // 添加PCB标签
-                QGraphicsTextItem* text = new QGraphicsTextItem(QString("PCB%1").arg(pcbId));
+                QGraphicsTextItem* text = new QGraphicsTextItem(QString(tr("PCB%1")).arg(pcbId));
                 text->setFont(font);
 
                 qreal fixedHeight = qMin(pcbWidth / std::ceil(static_cast<qreal>(groupedData[pcbId].keys().size()) / std::ceil(std::sqrt(groupedData[pcbId].keys().size()))) * 0.1
@@ -171,7 +171,7 @@ void Bond::initFrom(QWidget* parent) {
             scene->addItem(ptItem);
 
             // 添加PT矩阵标签
-            QGraphicsTextItem* ptText = new QGraphicsTextItem(QString("PT矩阵%1").arg(ptId));
+            QGraphicsTextItem* ptText = new QGraphicsTextItem(QString(tr("PT矩阵%1")).arg(ptId));
             ptText->setFont(font_1);
 
             qreal fixedHeight_1 = qMin(ptWidth / ptDimensions[pcbId][ptId].second * 0.3, ptHeight / ptDimensions[pcbId][ptId].first * 0.3);

+ 61 - 23
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/DraggableLine.cpp

@@ -1,40 +1,78 @@
 #include "DraggableLine.h"
+#include <QGraphicsSceneMouseEvent>
+#include <QPainter>
+#include <QDebug>
+#include <QGraphicsScene>
+
 void DraggableLine::mousePressEvent(QGraphicsSceneMouseEvent* event) {
-    // 判断点击的是起点还是终点
-    QPointF clickPos = event->pos();
-    if (distance(clickPos, line().p1()) < 10) {
+    QPointF pos = event->pos(); // 获取相对于项的坐标
+    QLineF currentLine = line();
+
+    if (isNearPoint(pos, currentLine.p1())) {
         draggingStart = true;
-    } else if (distance(clickPos, line().p2()) < 10) {
+        offset = currentLine.p1() - pos;
+    }
+    else if (isNearPoint(pos, currentLine.p2())) {
         draggingEnd = true;
+        offset = currentLine.p2() - pos;
+    }
+    else {
+        // 如果没有点击控制点,可以处理其他逻辑或忽略
+        QGraphicsLineItem::mousePressEvent(event);
+        return;
     }
+    event->accept(); // 标记事件已处理
 }
 
-void DraggableLine::mouseMoveEvent(QGraphicsSceneMouseEvent* event)  {
-    if (draggingStart) {
-        // 更新起点坐标
-        QLineF newLine(event->scenePos(), line().p2());
-        setLine(newLine);
-    } else if (draggingEnd) {
-        // 更新终点坐标
-        QLineF newLine(line().p1(), event->scenePos());
-        setLine(newLine);
+
+void DraggableLine::mouseMoveEvent(QGraphicsSceneMouseEvent* event) {
+    if (draggingStart || draggingEnd) {
+        QLineF currentLine = line();
+        QPointF newPos = event->pos() + offset; // 计算新的端点位置
+
+        if (draggingStart) {
+            currentLine.setP1(newPos);
+        }
+        else {
+            currentLine.setP2(newPos);
+        }
+
+        setLine(currentLine); // 更新线段
+        scene()->update(); // 请求重绘
+        event->accept();
+    }
+    else {
+        QGraphicsLineItem::mouseMoveEvent(event);
     }
-    update();
 }
-void DraggableLine::mouseReleaseEvent(QGraphicsSceneMouseEvent*)  {
-    draggingStart = draggingEnd = false;
+
+
+void DraggableLine::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) {
+    draggingStart = false;
+    draggingEnd = false;
+
+    QLineF currentLine = line();
+    qDebug() << "线段长度:" << currentLine.length();
+
+    QGraphicsLineItem::mouseReleaseEvent(event);
 }
 
-void DraggableLine::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) {
-    painter->setPen(QPen(Qt::blue, 2));
-    painter->drawLine(line());
 
-    // 绘制可拖拽端点
+void DraggableLine::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
+    // 先调用基类方法绘制线段
+    QGraphicsLineItem::paint(painter, option, widget);
+
+    // 绘制起点和终点的控制点
     painter->setBrush(Qt::red);
     painter->drawEllipse(line().p1(), 5, 5);
+
+    painter->setBrush(Qt::blue);
     painter->drawEllipse(line().p2(), 5, 5);
 }
 
-double DraggableLine::distance(const QPointF& p1, const QPointF& p2) {
-    return QLineF(p1, p2).length();
-}
+
+bool DraggableLine::isNearPoint(const QPointF& pos, const QPointF& point) const
+{
+    QLineF line(pos, point);
+    return (line.length() < 20); // 10像素范围内判定为点击控制点
+}

+ 13 - 31
View/die-bonder-ui/CameraMaterialGroupWnd/MaterialWindow/DraggableLine.h

@@ -1,48 +1,30 @@
 #ifndef DRAGGABLELINE_H
 #define DRAGGABLELINE_H
-#include <QApplication>
-#include <QWidget>
-#include <QPainter>
-#include <QMouseEvent>
-#include <QString>
-#include <QGraphicsView>
-#include <QGraphicsScene>
-#include <QGraphicsRectItem>
-#include <QMouseEvent>
-#include <QLabel>
-#include <QPointer>
-#include <QGraphicsItem>
-#include <QPainter>
-#include <QColor>
-#include <QGraphicsSceneEvent>
-#include <QDebug>
-#include <QFrame>
 
-// 1. 创建自定义线段类(继承QGraphicsLineItem)
+#include <QGraphicsLineItem >
+#include <QObject>
+
 class DraggableLine : public QGraphicsLineItem {
 public:
-    explicit DraggableLine(QGraphicsItem* parent = nullptr)
-        : QGraphicsLineItem(parent) {
-        setFlag(QGraphicsItem::ItemIsMovable, false); // 禁用整体移动
+    DraggableLine(const QLineF& line, QGraphicsItem* parent = nullptr)
+        : QGraphicsLineItem(line, parent), draggingStart(false), draggingEnd(false) {
         setAcceptHoverEvents(true);
+        setFlag(QGraphicsItem::ItemIsSelectable, true);
+        setFlag(QGraphicsItem::ItemIsMovable, false); // 禁用整体移动,只允许拖动端点
     }
 
-    // 2. 鼠标事件处理
 protected:
     void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
-
     void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
-
-    void mouseReleaseEvent(QGraphicsSceneMouseEvent*) override;
-
-    // 3. 可视化增强(绘制端点)
-    void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) override ;
+    void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
+    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
 
 private:
-    bool draggingStart = false;
-    bool draggingEnd = false;
+    bool draggingStart;
+    bool draggingEnd;
+    QPointF offset;
 
-    double distance(const QPointF& p1, const QPointF& p2);
+    bool isNearPoint(const QPointF& pos, const QPointF& point) const;
 };
 
 #endif // DRAGGABLELINE_H

+ 74 - 6
View/die-bonder-ui/ImageWidget.cpp

@@ -2,11 +2,17 @@
 #include "ui_ImageWidget.h"
 #include <QPainter>
 #include <QDebug>
+#include <QMouseEvent>
 ImageWidget::ImageWidget(QWidget *parent) :
     QWidget(parent),
+    imageOffset(0, 0),
+    isDrawing(false),
+    isDragging(false),
     ui(new Ui::ImageWidget)
 {
     ui->setupUi(this);
+    pen.setColor(Qt::red);
+    pen.setWidth(2);
 }
 
 ImageWidget::~ImageWidget()
@@ -34,6 +40,34 @@ void ImageWidget::paintEvent(QPaintEvent *event)
 {
     QPainter painter(this);
     if (!pixmap.isNull())
+    //{
+    //    // 限制图片偏移量,确保图片不会被拖动到视图外
+    //    int pixmapWidth = pixmap.width();
+    //    int pixmapHeight = pixmap.height();
+    //    int widgetWidth = width();
+    //    int widgetHeight = height();
+
+    //    // 限制横向偏移量,确保图片不会超出左边或右边
+    //    if (pixmapWidth < widgetWidth)
+    //    {
+    //        imageOffset.setX(0); // 如果图片宽度小于控件宽度,居中显示
+    //    } 
+    //    else 
+    //    {
+    //        // 图片左边界不能超出控件左边,右边界不能超出控件右边
+    //        imageOffset.setX(qMin(0.0, qMax(static_cast<qreal>(widgetWidth - pixmapWidth), imageOffset.x())));
+    //    }
+
+    //    // 限制纵向偏移量,确保图片不会超出上边或下边
+    //    if (pixmapHeight < widgetHeight)
+    //    {
+    //        imageOffset.setY(0); // 如果图片高度小于控件高度,居中显示
+    //    } 
+    //    else 
+    //    {
+    //        // 图片上边界不能超出控件上边,下边界不能超出控件下边
+    //        imageOffset.setY(qMin(0.0, qMax(static_cast<qreal>(widgetHeight - pixmapHeight), imageOffset.y())));
+    //    }
     {
         // 限制图片偏移量,确保图片不会被拖动到视图外
         int pixmapWidth = pixmap.width();
@@ -45,8 +79,8 @@ void ImageWidget::paintEvent(QPaintEvent *event)
         if (pixmapWidth < widgetWidth)
         {
             imageOffset.setX(0); // 如果图片宽度小于控件宽度,居中显示
-        } 
-        else 
+        }
+        else
         {
             // 图片左边界不能超出控件左边,右边界不能超出控件右边
             imageOffset.setX(qMin(0.0, qMax(static_cast<qreal>(widgetWidth - pixmapWidth), imageOffset.x())));
@@ -56,8 +90,8 @@ void ImageWidget::paintEvent(QPaintEvent *event)
         if (pixmapHeight < widgetHeight)
         {
             imageOffset.setY(0); // 如果图片高度小于控件高度,居中显示
-        } 
-        else 
+        }
+        else
         {
             // 图片上边界不能超出控件上边,下边界不能超出控件下边
             imageOffset.setY(qMin(0.0, qMax(static_cast<qreal>(widgetHeight - pixmapHeight), imageOffset.y())));
@@ -71,6 +105,16 @@ void ImageWidget::paintEvent(QPaintEvent *event)
         }
 
         drawCross(&painter, targetRect);
+        painter.setPen(pen);
+        for (const auto& line : lines) {
+            painter.drawLine(line);
+        }
+
+        painter.setPen(pen);
+        for (const auto& line : lines)
+        {
+            painter.drawLine(line);
+        }
         //DrawCrossWithScale(&painter, pixmapWidth, pixmapHeight, { 476,300 }, { 300,300 });
     }
 
@@ -85,8 +129,9 @@ void ImageWidget::mousePressEvent(QMouseEvent *event)
         isDragging = true; 
         setCursor(Qt::BlankCursor);
     }
-    else if (event->button() == Qt::RightButton)
+    else if (isDrawing && event->button() == Qt::RightButton)
     {
+        lastPoint = event->pos();
         unsetCursor();
     }
 
@@ -99,6 +144,10 @@ void ImageWidget::mouseMoveEvent(QMouseEvent *event) {
         imageOffset += delta; // 更新图片的偏移量
         lastMousePos = event->pos(); // 更新鼠标位置
         update();
+    }else if (isDrawing && event->buttons() & Qt::RightButton) {
+        lines.append(QLine(lastPoint, event->pos()));
+        lastPoint = event->pos();
+        update();
     }
 
     QWidget::mouseMoveEvent(event);
@@ -108,12 +157,16 @@ void ImageWidget::mouseReleaseEvent(QMouseEvent *event) {
     if (event->button() == Qt::LeftButton) {
         isDragging = false; // 重置正在拖动的标志
         setCursor(Qt::ArrowCursor);
+    }else if (isDrawing && event->button() == Qt::RightButton) {
+        lines.append(QLine(lastPoint, event->pos()));
+        lastPoint = event->pos();
+        unsetCursor();
     }
 
     QWidget::mouseReleaseEvent(event);
 }
 void ImageWidget::mouseDoubleClickEvent(QMouseEvent *event){
-    if (event->type() == QEvent::MouseButtonDblClick) {
+    if ((event->type() == QEvent::MouseButtonDblClick)&&(event->button() == Qt::LeftButton)) {
         // 恢复原始图像
         sendDoubleClicksignal();
     }
@@ -180,3 +233,18 @@ void ImageWidget::drawCross(QPainter* painter, QRect rect)
     painter->drawLine(rect.width() / 2, 0, rect.width() / 2, rect.height());
     painter->drawLine(0, rect.height() / 2, rect.width(), rect.height() / 2);
 }
+
+void ImageWidget::setIsDrawing(bool value) {
+    isDrawing = value;
+    if (isDrawing) {
+        setCursor(Qt::CrossCursor);
+    }
+    else {
+        unsetCursor();
+    }
+}
+
+void ImageWidget::clearDrawing() {
+    lines.clear(); // 清空线条列表
+    update();
+}

+ 12 - 0
View/die-bonder-ui/ImageWidget.h

@@ -4,6 +4,9 @@
 #include <QWidget>
 #include <QPixmap>
 #include <QMouseEvent>
+#include <QVector>
+#include <QPoint>
+#include <QPen>
 
 namespace Ui {
 class ImageWidget;
@@ -20,6 +23,8 @@ public:
     void setPixmap(const QPixmap& pixmap);
     void setPixmapAndPoint(const QPixmap& pixmap, double previousScaleFactor, qreal scaleFactor, QPoint mousePos);
     void clearPixmap();
+    void setIsDrawing(bool value);
+    void clearDrawing();
 signals:
     void sendDoubleClicksignal();
 protected:
@@ -39,6 +44,13 @@ private:
     QPoint      lastMousePos = {};  // 上一次鼠标的位置
     QPointF     imageOffset  = {};  // 图片的偏移量
     bool        isDragging   = false; // 是否正在拖动
+    //QPoint imageOffset;
+
+    QPen pen;
+    QVector<QLine> lines;
+    QPoint lastPoint;
+
+    bool isDrawing;
 
 public:
     /**是否是SingleCameraOperationWnd

+ 2 - 2
View/die-bonder-ui/Login.cpp

@@ -45,8 +45,8 @@ void Login::setChineseMode(QMainWindow *Login)
     ui->label_pass->setText(QString());
     ui->label_user->setText(QString());
     ui->ExitButton->setText(tr("Login", "退出"));
-    ui->userNameLineEdit->setPlaceholderText("请输入账号");
-    ui->passLineEdit->setPlaceholderText("请输入密码");
+    ui->userNameLineEdit->setPlaceholderText(tr("请输入账号"));
+    ui->passLineEdit->setPlaceholderText(tr("请输入密码"));
 }
 
 void Login::onUserNameChanged(const QString &userName) 

+ 4 - 4
View/die-bonder-ui/MainWnd.cpp

@@ -898,12 +898,12 @@ void MainWnd::on_pushButton_clicked()
     // 创建一个消息框
     QMessageBox msgBox;
     if (gen_if.getLanguageValue() == 0) {
-        msgBox.setWindowTitle("Confirm Close");
-        msgBox.setText("Are you sure you want to close the application?");
+        msgBox.setWindowTitle(tr("Confirm Close"));
+        msgBox.setText(tr("Are you sure you want to close the application?"));
     }
     else {
-        msgBox.setWindowTitle("确认关闭");
-        msgBox.setText("你确定要关闭程序吗");
+        msgBox.setWindowTitle(tr("确认关闭"));
+        msgBox.setText(tr("你确定要关闭程序吗"));
     }
 
     msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);

+ 28 - 21
View/die-bonder-ui/OriginalWnd/ChartsAndCamerasWnd.cpp

@@ -9,7 +9,11 @@
 #include <QScrollBar>
 #include <qDebug>
 #include "CameraMaterialGroupWnd/CameraImage/CameraImageHandler.h"
-
+#include <QPixmap>
+#include <QFileDialog>
+#include <QDateTime>
+#include <QMessageBox>
+#include <QPen>
 
 ChartsAndCamerasWnd::ChartsAndCamerasWnd(QWidget *parent) :
     JOriginalMainWnd(parent),
@@ -62,7 +66,7 @@ ChartsAndCamerasWnd::ChartsAndCamerasWnd(QWidget *parent) :
     }
 
 
-
+    //isEnable = false;
     //initFrom();
     isShow = true;
 }
@@ -74,6 +78,9 @@ ChartsAndCamerasWnd::~ChartsAndCamerasWnd()
 }
 
 
+
+
+
 void ChartsAndCamerasWnd::initializeSeriesInfo()
 {
     // 初始化系列信息,使用 DataSeries 结构体
@@ -413,25 +420,25 @@ void ChartsAndCamerasWnd::CameraConnectUpdateImageFun(int nIndex, Group* widget,
 
 void ChartsAndCamerasWnd::wheelEvent(QWheelEvent *event)
 {
-    mousePos = ui->viewwidgetgroup->getOperatewidget()->mapFromGlobal(event->globalPos());
-
-    if (ui->viewwidgetgroup->getOperatewidget()->rect().contains(ui->viewwidgetgroup->getOperatewidget()->mapFromGlobal(event->globalPos()))) {
-        if (event->angleDelta().y() > 0) {
-            ui->viewwidgetgroup->updateScale(scaleFactor * 1.1); // 放大
-        } else {
-            ui->viewwidgetgroup->updateScale(scaleFactor * 0.9); // 缩小
-        }
-    }
-    if (ui->scrollArea->rect().contains(ui->scrollArea->mapFromGlobal(event->globalPos()))) {
-        // 获取 QScrollArea 的横向滚动条
-        QScrollBar *scrollBar = ui->scrollArea->horizontalScrollBar();
-        // 根据滚轮滚动方向改变滚动条的值
-        if (event->angleDelta().y() > 0) {
-            scrollBar->setValue(scrollBar->value() - 50);
-        } else {
-            scrollBar->setValue(scrollBar->value() + 50);
-        }
-    }
+    //mousePos = ui->viewwidgetgroup->getOperatewidget()->mapFromGlobal(event->globalPos());
+
+    //if (ui->viewwidgetgroup->getOperatewidget()->rect().contains(ui->viewwidgetgroup->getOperatewidget()->mapFromGlobal(event->globalPos()))) {
+    //    if (event->angleDelta().y() > 0) {
+    //        ui->viewwidgetgroup->updateScale(scaleFactor * 1.1); // 放大
+    //    } else {
+    //        ui->viewwidgetgroup->updateScale(scaleFactor * 0.9); // 缩小
+    //    }
+    //}
+    //if (ui->scrollArea->rect().contains(ui->scrollArea->mapFromGlobal(event->globalPos()))) {
+    //    // 获取 QScrollArea 的横向滚动条
+    //    QScrollBar *scrollBar = ui->scrollArea->horizontalScrollBar();
+    //    // 根据滚轮滚动方向改变滚动条的值
+    //    if (event->angleDelta().y() > 0) {
+    //        scrollBar->setValue(scrollBar->value() - 50);
+    //    } else {
+    //        scrollBar->setValue(scrollBar->value() + 50);
+    //    }
+    //}
 
     QMainWindow::wheelEvent(event);
 }

+ 6 - 2
View/die-bonder-ui/OriginalWnd/ChartsAndCamerasWnd.h

@@ -26,7 +26,7 @@ public:
 
     void initFrom();
     void updateMaterialWidget( int materialWndType, int groupId);
-
+    
 protected:
     void wheelEvent(QWheelEvent *event) override;
     void loadSettings();
@@ -35,7 +35,9 @@ protected:
     void showEvent(QShowEvent *event) override;
     void hideEvent(QHideEvent *event) override;
 
-
+public slots: // 确保这里声明了槽函数
+    
+    
 
 private:
     void InitMainCameraBind(CameraBind* pCameraBind) override;
@@ -127,6 +129,8 @@ private:
     OperateMode currentMode = ModeImage;
     QGraphicsView *currentView = nullptr;
     QPoint mousePos;
+    
+    QPoint pressPos; // 记录鼠标按下位置
 
 };
 

+ 7 - 7
View/die-bonder-ui/OriginalWnd/DbTreeViewManager.cpp

@@ -2052,7 +2052,7 @@ void DbTreeViewManager::displayThirdLevelFields(const QList<Table_Control_Data>&
                         {//上下限至少设置了一个值
                             if (fieldValue == "")
                             {
-                                lineEdit->setPlaceholderText("请输入数字");
+                                lineEdit->setPlaceholderText(tr("请输入数字"));
                             } else
                             {
                                 lineEdit->setText(fieldValue);
@@ -2107,7 +2107,7 @@ void DbTreeViewManager::displayThirdLevelFields(const QList<Table_Control_Data>&
                                     //updateDb(fieldTableName, fieldId, lineEdit->text());
                                 } else
                                 {
-                                    lineEdit->setPlaceholderText("超出设定范围,请重新输入");
+                                    lineEdit->setPlaceholderText(tr("超出设定范围,请重新输入"));
                                 }
                             } else if (fieldDownLimit != "")
                             {
@@ -2119,7 +2119,7 @@ void DbTreeViewManager::displayThirdLevelFields(const QList<Table_Control_Data>&
                                     //updateDb(fieldTableName, fieldId, lineEdit->text());
                                 } else
                                 {
-                                    lineEdit->setPlaceholderText("超出设定范围,请重新输入");
+                                    lineEdit->setPlaceholderText(tr("超出设定范围,请重新输入"));
                                 }
                             } else if (fieldUpLimit != "")
                             {
@@ -2131,7 +2131,7 @@ void DbTreeViewManager::displayThirdLevelFields(const QList<Table_Control_Data>&
                                     //updateDb(fieldTableName, fieldId, lineEdit->text());
                                 } else
                                 {
-                                    lineEdit->setPlaceholderText("超出设定范围,请重新输入");
+                                    lineEdit->setPlaceholderText(tr("超出设定范围,请重新输入"));
                                 }
                             } else
                             {
@@ -2344,18 +2344,18 @@ void DbTreeViewManager::displayThirdLevelFields(const QList<Table_Control_Data>&
                         switchBox->setChecked(true);
                     else
                         switchBox->setChecked(false);
-                    QLabel* switchLabel = new QLabel(switchBox->isChecked() ? "开" : "关");
+                    QLabel* switchLabel = new QLabel(switchBox->isChecked() ? tr("开") :tr("关"));
                     switchLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
                     switchLabel->setStyleSheet("font-size: 14px;");
                     connect(switchBox, &QCheckBox::stateChanged, [fieldTableName, fieldName, switchLabel, this](int state) {
                         if (state == Qt::Checked)
                         {
-                            switchLabel->setText("开");
+                            switchLabel->setText(tr("开"));
                             m_sqlOper->updateControlData(fieldTableName, fieldName, "on");
                             //updateDb(fieldTableName, fieldId, "on");
                         } else
                         {
-                            switchLabel->setText("关");
+                            switchLabel->setText(tr("关"));
                             m_sqlOper->updateControlData(fieldTableName, fieldName, "off");
                             //updateDb(fieldTableName, fieldId, "off");
                         }

+ 15 - 11
View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.cpp

@@ -149,7 +149,9 @@ void MainAndSecondaryCamerasWnd::InitPage()
             if (manager->getMaterialBox()) {
                 m_mapMaterialBoxMap.insert(num, manager->getMaterialBox());
             }
-
+            if (manager->getBond()) {
+                m_mapBondMap.insert(num, manager->getBond());
+            }
             delete manager;
         }
 
@@ -322,6 +324,7 @@ void MainAndSecondaryCamerasWnd::updateMaterialWidget(int  side,int materialWndT
         case 1: ui->viewwidgetgroup_L->setWafer(m_mapWaferMap.value(groupId)); break;
         case 2: ui->viewwidgetgroup_L->setWaffle(m_mapWaffleMap.value(groupId)); break;
         case 3: ui->viewwidgetgroup_L->setMaterialBox(m_mapMaterialBoxMap.value(groupId)); break;
+		case 4: ui->viewwidgetgroup_L->setBond(m_mapBondMap.value(groupId)); break;
         }
     }
     else if (side == m_nCurrentRight) {
@@ -329,6 +332,7 @@ void MainAndSecondaryCamerasWnd::updateMaterialWidget(int  side,int materialWndT
         case 1: ui->viewwidgetgroup_R->setWafer(m_mapWaferMap.value(groupId)); break;
         case 2: ui->viewwidgetgroup_R->setWaffle(m_mapWaffleMap.value(groupId)); break;
         case 3: ui->viewwidgetgroup_R->setMaterialBox(m_mapMaterialBoxMap.value(groupId)); break;
+		case 4: ui->viewwidgetgroup_R->setBond(m_mapBondMap.value(groupId)); break;
         }
     }
 }
@@ -711,16 +715,16 @@ void MainAndSecondaryCamerasWnd::wheelEvent(QWheelEvent *event)
     //       ui->viewwidgetgroup_R->updateScale(Right_scaleFactor * 0.9); // 缩小
     //   }
     //}
-    if (ui->scrollArea->rect().contains(ui->scrollArea->mapFromGlobal(event->globalPos()))) {
-        // 获取 QScrollArea 的横向滚动条
-        QScrollBar *scrollBar = ui->scrollArea->horizontalScrollBar();
-        // 根据滚轮滚动方向改变滚动条的值
-        if (event->angleDelta().y() > 0) {
-            scrollBar->setValue(scrollBar->value() - 50);
-        } else {
-            scrollBar->setValue(scrollBar->value() + 50);
-        }
-    }
+    //if (ui->scrollArea->rect().contains(ui->scrollArea->mapFromGlobal(event->globalPos()))) {
+    //    // 获取 QScrollArea 的横向滚动条
+    //    QScrollBar *scrollBar = ui->scrollArea->horizontalScrollBar();
+    //    // 根据滚轮滚动方向改变滚动条的值
+    //    if (event->angleDelta().y() > 0) {
+    //        scrollBar->setValue(scrollBar->value() - 50);
+    //    } else {
+    //        scrollBar->setValue(scrollBar->value() + 50);
+    //    }
+    //}
     
 	QMainWindow::wheelEvent(event);
 }

+ 1 - 1
View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.h

@@ -144,7 +144,7 @@ private:
 
     QMap<int, Waffle*>          m_mapWaffleMap;
     QMap<int, MaterialBox*>     m_mapMaterialBoxMap;
-
+    QMap<int, Bond*>            m_mapBondMap;
 
     //OperateMode         Left_currentMode = ModeImage;
 

+ 116 - 3
View/die-bonder-ui/OriginalWnd/OriginalWnd.cpp

@@ -25,7 +25,7 @@ OriginalWnd::OriginalWnd(QWidget* parent, CameraBind* pCameraBind)
 
     m_pCameraBind.reset(pCameraBind);
     m_pCameraDistribute = CameraDistribute::GetInstance();
-
+    StatusBar();
     RegFun();
 
     if (gen_if.getLanguageValue() == 0)//TODO: 这里有问题吧.... ==-1 也加载?
@@ -119,8 +119,8 @@ void OriginalWnd::setChineseMode(QMainWindow* OriginalWnd)
     ui->RegistrationNumber->setText(QCoreApplication::translate("OriginalWnd", "注册号码 001", nullptr));
     ui->CalibrationButton->setText(QCoreApplication::translate("OriginalWnd", "校准", nullptr));
     ui->ProductIotNumber->setText(QCoreApplication::translate("OriginalWnd", "xxx生产编号", nullptr));
-    ui->pushButton_2->setText(QString());
-    ui->pushButton_3->setText(QString());
+    ui->MachineLink->setText(QString());
+    ui->HostStatus->setText(QString());
     ui->label_time->setText(QString());
     ui->label_username->setText(QString());
     ui->label_userlogo->setText(QString());
@@ -368,3 +368,116 @@ void OriginalWnd::JRunFunSlots(ns_module::ST_BUTTON_FUN pra)
 {
     m_pCameraBind->JRunButton(pra);
 }
+
+void OriginalWnd::StatusBar()
+{
+    enum DEVICE_STATUS currentStatus = DEVICE_STATUS::IDLE;
+    updateCalibrationButtonColor(currentStatus);
+
+    enum CONNECT_STATUS currentStatus2 = OriginalWnd::CONNECT_STATUS::NO_CONNECT;
+    updateMachineLinkColor(currentStatus2);
+
+    enum HOST_STATUS currentStatus3 = OriginalWnd::HOST_STATUS::DEVICE_OK;
+    updateHostStatusColor(currentStatus3);
+}
+
+void OriginalWnd::updateCalibrationButtonColor(enum DEVICE_STATUS status)
+{
+    QString styleSheet;
+    QString buttonText;
+
+    switch (status) {
+    case DEVICE_STATUS::IDLE: // 停机待机
+        styleSheet = "QPushButton { background-color: green; color: white; }";
+        buttonText = "IDLE";
+        break;
+    case DEVICE_STATUS::RUNING: // 生产
+        styleSheet = "QPushButton { background-color: green; color: white; }";
+        buttonText = "RUNING";
+        break;
+    case DEVICE_STATUS::CALIB: // 校准
+        styleSheet = "QPushButton { background-color: yellow; color: black; }";
+        buttonText = "CALIB";
+        break;
+    case DEVICE_STATUS::WARN: // 报警
+        styleSheet = "QPushButton { background-color: yellow; color: black; }";
+        buttonText = "WARN";
+        break;
+    case DEVICE_STATUS::FAULT: // 故障
+        styleSheet = "QPushButton { background-color: red; color: white; }";
+        buttonText = "FAULT";
+        break;
+    case DEVICE_STATUS::DIAGNOSE: // 诊断
+        styleSheet = "QPushButton { background-color: red; color: white; }";
+        buttonText = "DIAGNOSE";
+        break;
+    default: // 未知状态
+        styleSheet = "QPushButton { background-color: gray; color: white; }";
+        buttonText = "未知状态";
+        break;
+    }
+
+    // 设置按钮样式和文本
+    ui->CalibrationButton->setStyleSheet(styleSheet);
+    ui->CalibrationButton->setText(buttonText);
+}
+
+void OriginalWnd::updateMachineLinkColor(enum CONNECT_STATUS status)
+{
+    QString styleSheet;
+    QString buttonText;
+
+    switch (status) {
+    case CONNECT_STATUS::NO_CONNECT: // 未连接
+        styleSheet = "QPushButton { background-color: gray; color: white; }";
+        break;
+    case CONNECT_STATUS::CONNECT_ING: // 连接中
+        styleSheet = "QPushButton { background-color: yellow; color: black; }";
+        break;
+    case CONNECT_STATUS::MACHINE_TIMEOUT: // 机台超时
+        styleSheet = "QPushButton { background-color: orange; color: black; }";
+        break;
+    case CONNECT_STATUS::HOST_TIMEOUT: // 主机超时
+        styleSheet = "QPushButton { background-color: blue; color: white; }";
+        break;
+    case CONNECT_STATUS::CONNECT_OK: // 连接成功
+        styleSheet = "QPushButton { background-color: green; color: white; }";
+        break;
+    default: // 未知状态
+        styleSheet = "QPushButton { background-color: gray; color: white; }";
+        break;
+    }
+
+    // 设置按钮样式
+    ui->MachineLink->setStyleSheet(styleSheet);
+}
+
+void OriginalWnd::updateHostStatusColor(enum HOST_STATUS status)
+{
+    QString styleSheet;
+    QString buttonText;
+
+    switch (status) {
+    case HOST_STATUS::HOST_OUT: // 主机离线
+        styleSheet = "QPushButton { background-color: yellow; color: black; }";
+        break;
+    case HOST_STATUS::DEVICE_OUT: // 设备离线
+        styleSheet = "QPushButton { background-color: orange; color: black; }";
+        break;
+    case HOST_STATUS::DEVICE_ING: // 设备试图连线
+        styleSheet = "QPushButton { background-color: magenta; color: white; }";
+        break;
+    case HOST_STATUS::DEVICE_OK: // 设备在线
+        styleSheet = "QPushButton { background-color: blue; color: white; }";
+        break;
+    case HOST_STATUS::HOST_CON_DEVICE: // 主机控制设备
+        styleSheet = "QPushButton { background-color: green; color: white; }";
+        break;
+    default: // 未知状态
+        styleSheet = "QPushButton { background-color: gray; color: white; }";
+        break;
+    }
+
+    // 设置按钮样式和文本
+    ui->HostStatus->setStyleSheet(styleSheet);
+}

+ 34 - 0
View/die-bonder-ui/OriginalWnd/OriginalWnd.h

@@ -66,6 +66,40 @@ public:
     void switchToSystemConfig();
     void setChineseMode(QMainWindow* OriginalWnd);
 
+
+    enum DEVICE_STATUS
+    {
+        IDLE,//停机待机
+        RUNING,//生产
+        CALIB,//校准
+        WARN,//报警
+        FAULT, //故障
+        DIAGNOSE//诊断
+    };
+    enum CONNECT_STATUS
+    {
+        NO_CONNECT,//未连接           灰色
+        CONNECT_ING,//连接中          黄色
+
+        MACHINE_TIMEOUT,//机台超时    橙色
+        HOST_TIMEOUT,//主机超时       蓝色
+
+        CONNECT_OK,//连接成功         绿色
+    };
+    enum HOST_STATUS
+    {
+        HOST_OUT,//主机离线           黄色
+        DEVICE_OUT,//设备离线         橙色
+        DEVICE_ING,//设备试图连线      紫红色
+        DEVICE_OK,//设备在线          蓝色
+        HOST_CON_DEVICE,//主机控制设备 绿色
+    };
+    // 顶部状态栏
+    void updateCalibrationButtonColor(enum DEVICE_STATUS status);
+    void updateMachineLinkColor(enum CONNECT_STATUS status);
+    void updateHostStatusColor(enum HOST_STATUS status);
+    void StatusBar();
+
 protected:
     bool eventFilter(QObject* obj, QEvent* event) override;
     void timerEvent(QTimerEvent* event) override;

+ 2 - 2
View/die-bonder-ui/OriginalWnd/OriginalWnd.ui

@@ -297,7 +297,7 @@ production</string>
       <string>xxxProduct lot number</string>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton_2">
+    <widget class="QPushButton" name="MachineLink">
      <property name="geometry">
       <rect>
        <x>1061</x>
@@ -310,7 +310,7 @@ production</string>
       <string/>
      </property>
     </widget>
-    <widget class="QPushButton" name="pushButton_3">
+    <widget class="QPushButton" name="HostStatus">
      <property name="geometry">
       <rect>
        <x>1111</x>

+ 19 - 19
View/die-bonder-ui/OriginalWnd/SingleCameraOperationWnd.cpp

@@ -238,25 +238,25 @@ void SingleCameraOperationWnd::UpdateCameraDisplay4(int iCameraId, JVision::Imag
 
 void SingleCameraOperationWnd::wheelEvent(QWheelEvent *event)
 {
-    mousePos = ui->viewwidgetgroup->getOperatewidget()->mapFromGlobal(event->globalPos());
-
-    if (ui->viewwidgetgroup->getOperatewidget()->rect().contains(ui->viewwidgetgroup->getOperatewidget()->mapFromGlobal(event->globalPos()))) {
-        if (event->angleDelta().y() > 0) {
-            ui->viewwidgetgroup->updateScale(scaleFactor * 1.1); // 放大
-        } else {
-            ui->viewwidgetgroup->updateScale(scaleFactor * 0.9); // 缩小
-        }
-    }
-    if (ui->scrollArea->rect().contains(ui->scrollArea->mapFromGlobal(event->globalPos()))) {
-        // 获取 QScrollArea 的横向滚动条
-        QScrollBar *scrollBar = ui->scrollArea->horizontalScrollBar();
-        // 根据滚轮滚动方向改变滚动条的值
-        if (event->angleDelta().y() > 0) {
-            scrollBar->setValue(scrollBar->value() - 50);
-        } else {
-            scrollBar->setValue(scrollBar->value() + 50);
-        }
-    }
+    //mousePos = ui->viewwidgetgroup->getOperatewidget()->mapFromGlobal(event->globalPos());
+
+    //if (ui->viewwidgetgroup->getOperatewidget()->rect().contains(ui->viewwidgetgroup->getOperatewidget()->mapFromGlobal(event->globalPos()))) {
+    //    if (event->angleDelta().y() > 0) {
+    //        ui->viewwidgetgroup->updateScale(scaleFactor * 1.1); // 放大
+    //    } else {
+    //        ui->viewwidgetgroup->updateScale(scaleFactor * 0.9); // 缩小
+    //    }
+    //}
+    //if (ui->scrollArea->rect().contains(ui->scrollArea->mapFromGlobal(event->globalPos()))) {
+    //    // 获取 QScrollArea 的横向滚动条
+    //    QScrollBar *scrollBar = ui->scrollArea->horizontalScrollBar();
+    //    // 根据滚轮滚动方向改变滚动条的值
+    //    if (event->angleDelta().y() > 0) {
+    //        scrollBar->setValue(scrollBar->value() - 50);
+    //    } else {
+    //        scrollBar->setValue(scrollBar->value() + 50);
+    //    }
+    //}
 
     QMainWindow::wheelEvent(event);
 

+ 6 - 0
View/die-bonder-ui/SBTdie-bonder-ui.vcxproj

@@ -212,6 +212,7 @@
     <ClCompile Include="CameraMaterialGroupWnd\MaterialWindow\BondGraphicsView.cpp" />
     <ClCompile Include="CameraMaterialGroupWnd\MaterialWindow\DraggableLine.cpp" />
     <ClCompile Include="CameraMaterialGroupWnd\MaterialWindow\MaterialBoxGraphicsView.cpp" />
+    <ClCompile Include="ImageView.cpp" />
     <ClCompile Include="OriginalWnd\CameraDataHandleAndShow.cpp" />
     <ClCompile Include="CameraMaterialGroupWnd\CameraImage\CameraImageHandler.cpp" />
     <ClCompile Include="OriginalWnd\ChartsAndCamerasWnd.cpp" />
@@ -261,6 +262,7 @@
     <QtMoc Include="CameraMaterialGroupWnd\MaterialWindow\Bond.h" />
     <ClInclude Include="CameraMaterialGroupWnd\MaterialWindow\DraggableLine.h" />
     <QtMoc Include="CameraMaterialGroupWnd\MaterialWindow\MaterialBoxGraphicsView.h" />
+    <QtMoc Include="ImageView.h" />
     <ClInclude Include="JUserAccountsData.h" />
     <QtMoc Include="Src\common\GlobalUse\JMouseMonitorThread.h" />
     <ClInclude Include="Src\common\JLogAllOutput.h" />
@@ -465,6 +467,10 @@
   <ItemGroup>
     <None Include="configurations.db" />
   </ItemGroup>
+  <ItemGroup>
+    <QtTranslation Include="SBT_en.ts" />
+    <QtTranslation Include="SBT_zh_CN.ts" />
+  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
     <Import Project="$(QtMsBuild)\qt.targets" />

+ 14 - 4
View/die-bonder-ui/SBTdie-bonder-ui.vcxproj.filters

@@ -168,6 +168,9 @@
     <ClCompile Include="OriginalWnd\JOriginalMainWnd.cpp">
       <Filter>Source Files\OriginalWnd</Filter>
     </ClCompile>
+    <ClCompile Include="Src\CameraBind.cpp">
+      <Filter>Header Files\Src</Filter>
+    </ClCompile>
     <ClCompile Include="OriginalWnd\DbTreeViewManager.cpp">
       <Filter>Source Files\OriginalWnd</Filter>
     </ClCompile>
@@ -255,8 +258,8 @@
     <ClCompile Include="CameraMaterialGroupWnd\MaterialWindow\Bond.cpp">
       <Filter>Source Files\CameraMaterialGroupWnd\MaterialWindow</Filter>
     </ClCompile>
-    <ClCompile Include="Src\CameraBind.cpp">
-      <Filter>Source Files\Src</Filter>
+    <ClCompile Include="ImageView.cpp">
+      <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
@@ -278,6 +281,9 @@
     <ClInclude Include="gen_interface.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <QtMoc Include="Src\CameraBind.h">
+      <Filter>Source Files\Src</Filter>
+    </QtMoc>
     <QtMoc Include="Src\common\JMessageTip.h">
       <Filter>Header Files\Src\common</Filter>
     </QtMoc>
@@ -347,8 +353,8 @@
     <QtMoc Include="CameraMaterialGroupWnd\MaterialWindow\BondGraphicsView.h">
       <Filter>Generated Files</Filter>
     </QtMoc>
-    <QtMoc Include="Src\CameraBind.h">
-      <Filter>Header Files\Src</Filter>
+    <QtMoc Include="ImageView.h">
+      <Filter>Header Files</Filter>
     </QtMoc>
   </ItemGroup>
   <ItemGroup>
@@ -783,4 +789,8 @@
       <Filter>Header Files\CameraMaterialGroupWnd\MaterialWindow</Filter>
     </QtMoc>
   </ItemGroup>
+  <ItemGroup>
+    <QtTranslation Include="SBT_zh_CN.ts" />
+    <QtTranslation Include="SBT_en.ts" />
+  </ItemGroup>
 </Project>

+ 92 - 20
View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.cpp

@@ -7,9 +7,11 @@ ControlOperationPage::ControlOperationPage(QWidget* parent)
     , ui(new Ui::ControlOperationPage)
 {
     ui->setupUi(this);
+	m_isEnable = false;
 
 
     InitWnd();
+	initForm();
 }
 
 ControlOperationPage::~ControlOperationPage()
@@ -22,15 +24,21 @@ void ControlOperationPage::updateOperateWidget(const QPixmap& pixmap) {
     QPixmap scaledPixmap = pixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
 
     clearLayout();
-
-    ui->Operatewidget->setPixmap(scaledPixmap);
+    ImageView* customView = new ImageView(ui->Operatewidget);
+    customView->setPixmap(scaledPixmap);
+    QVBoxLayout* layout = new QVBoxLayout(ui->Operatewidget);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(customView);
+    ui->Operatewidget->setLayout(layout);
+    
     m_currentPixmap = scaledPixmap;
     m_scaleFactor = 1.0;
     m_previousScaleFactor = 1.0;
     ui->label_Percentage->setText("100%");
 
-    m_currentMode = ModeImage;
-
+    //m_currentMode = ModeImage;
+	m_currentImageView = customView;
+	applyScale();
 }
 
 void ControlOperationPage::setDataSources(const QStringList& textList) {
@@ -85,15 +93,12 @@ void ControlOperationPage::updateScale(double newScaleFactor)
 // 应用缩放
 void ControlOperationPage::applyScale() 
 {
-    if (m_currentMode == ModeImage)
+    if (m_currentMode == ModeImage && m_currentImageView)
     {
         // 图片模式:缩放图片
-        int newWidth = m_currentPixmap.width() * m_scaleFactor;
-        int newHeight = m_currentPixmap.height() * m_scaleFactor;
-
-        QPixmap scaledImage = m_currentPixmap.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-        ui->Operatewidget->setPixmapAndPoint(scaledImage, m_previousScaleFactor, m_scaleFactor, m_mousePos);
-        m_previousScaleFactor = m_scaleFactor;
+        QTransform transform;
+        transform.scale(m_scaleFactor, m_scaleFactor);
+        m_currentImageView->setTransform(transform);
     }
     else if (m_currentMode == ModeView && m_currentView)
     {
@@ -110,10 +115,11 @@ void ControlOperationPage::applyScale()
 }
 
 void ControlOperationPage::handleDoubleClick() {
-    if (m_currentMode == ModeImage) 
+    if (m_currentMode == ModeImage && m_currentImageView) 
     {
-        QPixmap scaledImage = m_currentPixmap.scaled(m_currentPixmap.width(), m_currentPixmap.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
-        ui->Operatewidget->setPixmap(scaledImage); // 这里传递缩放后的图片
+        QTransform transform;
+        transform.scale(1, 1);
+        m_currentImageView->setTransform(transform);
     }
     else if (m_currentMode == ModeView && m_currentView) 
     {
@@ -232,7 +238,7 @@ ImageWidget* ControlOperationPage::getOperatewidget()
 void ControlOperationPage::resizeSingleUI(bool bMax /*= false*/)
 {
     ui->DataSources->setGeometry(QRect(20, 20, 400, 32));
-    ui->Operatewidget->setGeometry(QRect(5, 5, 786, 786));
+    ui->Operatewidget->setGeometry(QRect(20, 72, 786, 786));
     //ui->line_2->setGeometry(QRect(826, 20, 1, 953));
     ui->LiveButton->setGeometry(QRect(436, 20, 60, 32));
     ui->horizontalLayout_2->setGeometry(QRect(12, 882, 786, 32));
@@ -263,12 +269,21 @@ qreal ControlOperationPage::getScaleFactorValue() {
     return m_scaleFactor;
 }
 void ControlOperationPage::setScaleFactorSize(QPixmap scaledImage) {
-    int newWidth = scaledImage.width() * m_scaleFactor;
-    int newHeight = scaledImage.height() * m_scaleFactor;
+    //int newWidth = scaledImage.width() * m_scaleFactor;
+    //int newHeight = scaledImage.height() * m_scaleFactor;
 
-    QPixmap curr_scaledImage = scaledImage.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-    ui->Operatewidget->setPixmapAndPoint(curr_scaledImage, m_previousScaleFactor, m_scaleFactor, m_mousePos);
-    ui->Operatewidget->setPixmap(curr_scaledImage);
+    //QPixmap curr_scaledImage = scaledImage.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+   // ui->Operatewidget->setPixmapAndPoint(curr_scaledImage, m_previousScaleFactor, m_scaleFactor, m_mousePos);
+   // ui->Operatewidget->setPixmap(curr_scaledImage);
+    if (m_currentImageView == nullptr) {
+        updateOperateWidget(scaledImage);
+    }
+    else
+    {
+        QSize size = ui->Operatewidget->size();
+        QPixmap scaledPixmap = scaledImage.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+        m_currentImageView->setCurPixmap(scaledPixmap);
+    }
 }
 
 
@@ -289,6 +304,7 @@ void ControlOperationPage::UpDateCameraBind(CameraBind* pCameraBind)
 
 void ControlOperationPage::setSwitchJoystickButEnable(bool isEnable)
 {
+	ui->switchJoystickBut->setEnabled(isEnable);
     if (isEnable == false)
     {
         ResetIdleTimer(false);
@@ -595,3 +611,59 @@ void ControlOperationPage::setBlueBord() {
     ui->BackGround->setStyleSheet(QString::fromUtf8("border: 4px solid blue;"));
 }
 
+void ControlOperationPage::on_RulerButton_clicked()
+{
+    if (m_currentMode == ModeImage) {
+        if (m_currentImageView->rulerVisibale()) {
+            m_currentImageView->endRuler();
+        }
+        else {
+            m_currentImageView->startRuler();
+        }
+    }
+}
+
+void ControlOperationPage::on_PenButton_clicked() {
+    m_isEnable = !m_isEnable;
+
+    if (m_isEnable) {
+        //ui->Operatewidget->setIsDrawing(true);
+        m_currentImageView->setIsDrawing(true);
+        ui->PenButton->setStyleSheet("QPushButton { background-color: #808FFF; }");
+    }
+    else {
+        //ui->Operatewidget->setIsDrawing(false);
+        m_currentImageView->setIsDrawing(false);
+        ui->PenButton->setStyleSheet("QPushButton { background-color: none; }");
+    }
+}
+
+void ControlOperationPage::SaveNewImage()
+{
+    //// 捕获 ui->Operatewidget 的当前显示内容
+    //QPixmap pixmap = ui->Operatewidget->grab();
+
+    //// 使用当前时间生成默认文件名
+    //QString defaultFileName = QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss") + ".png";
+
+    //// 弹出文件对话框,让用户选择保存路径和文件名
+    //QString filePath = QFileDialog::getSaveFileName(
+    //    this,
+    //    tr("保存图片"),
+    //    QDir::homePath() + "/" + defaultFileName, // 默认路径为用户目录,文件名为当前时间
+    //    tr("PNG 文件 (*.png);;JPEG 文件 (*.jpg);;所有文件 (*)")
+    //);
+
+    //// 如果用户取消保存,则退出函数
+    //if (filePath.isEmpty()) {
+    //    return;
+    //}
+
+
+    //if (!pixmap.save(filePath)) {
+    //    QMessageBox::warning(this, tr("保存失败"), tr("无法保存图片到指定路径。"));
+    //}
+    //else {
+    //    QMessageBox::information(this, tr("保存成功"), tr("图片已成功保存到:") + filePath);
+    //}
+}

+ 8 - 2
View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.h

@@ -13,6 +13,7 @@
 #include "ImageWidget.h"
 #include "../common/GlobalUse/JMouseMonitorThread.h"
 #include "../CameraBind.h"
+#include "ImageView.h"
 namespace Ui {
 class ControlOperationPage;
 }
@@ -59,7 +60,9 @@ public:
 private slots:
     void on_ZoomUpButton_clicked();
     void on_ZoomOutButton_clicked();
-    // void on_RulerButton_clicked();
+    void on_RulerButton_clicked();
+
+    void on_PenButton_clicked();
 
     //void on_PenButton_clicked();
     void handleDoubleClick();
@@ -67,6 +70,7 @@ private slots:
     
     void on_moduleTypeComboBox_currentIndexChanged(int index);
     void on_axisTypeComboBox_currentIndexChanged(int index);
+	void SaveNewImage();
 
 signals:
     /**发送轴变化消息
@@ -124,7 +128,9 @@ private:
     Waffle*                     m_waffle                = nullptr; // 声明Waffle指针
     MaterialBox*                m_materialbox           = nullptr; // 声明materialbox指针
     Bond*                       m_bond                  = nullptr;
-
+    ImageView*                  m_currentImageView      = nullptr;
+    bool                        m_isEnable;
+    QPoint                      m_pressPos; // 记录鼠标按下位置
 
     /**用作定时使用,后面移动到整个类里面,目前先实现功能
     */

+ 10 - 10
View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.ui

@@ -48,16 +48,6 @@
    <property name="styleSheet">
     <string notr="true">border: 4px solid red;</string>
    </property>
-   <widget class="ImageWidget" name="Operatewidget" native="true">
-    <property name="geometry">
-     <rect>
-      <x>4</x>
-      <y>4</y>
-      <width>493</width>
-      <height>493</height>
-     </rect>
-    </property>
-   </widget>
   </widget>
   <widget class="QWidget" name="layoutWidget">
    <property name="geometry">
@@ -152,6 +142,16 @@
     </item>
    </layout>
   </widget>
+  <widget class="ImageWidget" name="Operatewidget" native="true">
+   <property name="geometry">
+    <rect>
+     <x>14</x>
+     <y>54</y>
+     <width>493</width>
+     <height>493</height>
+    </rect>
+   </property>
+  </widget>
  </widget>
  <customwidgets>
   <customwidget>

+ 4 - 4
View/die-bonder-ui/dark.qss

@@ -163,15 +163,15 @@ OriginalWnd QWidget#Toptitlebar QPushButton#CalibrationButton
     background: #4AA2FF;
 }
 
-QWidget#Toptitlebar QPushButton#pushButton_2
+QWidget#Toptitlebar QPushButton#MachineLink
 {
-    background-color: transparent;
+    border-radius: 4px;
     image: url(:/images/TopStatusBar/MachineLink.png);
 }
 
-QWidget#Toptitlebar QPushButton#pushButton_3
+QWidget#Toptitlebar QPushButton#HostStatus
 {
-    background-color: transparent;
+    border-radius: 4px;
     image: url(:/images/TopStatusBar/HostStatus.png);
 }
 

+ 17 - 28
View/die-bonder-ui/light.qss

@@ -163,15 +163,15 @@ OriginalWnd QWidget#Toptitlebar QPushButton#CalibrationButton
     background: #4AA2FF;
 }
 
-QWidget#Toptitlebar QPushButton#pushButton_2
+QWidget#Toptitlebar QPushButton#MachineLink
 {
-    background-color: transparent;
+    border-radius: 4px;
     image: url(:/images/TopStatusBar/MachineLink.png);
 }
 
-QWidget#Toptitlebar QPushButton#pushButton_3
+QWidget#Toptitlebar QPushButton#HostStatus
 {
-    background-color: transparent;
+    border-radius: 4px;
     image: url(:/images/TopStatusBar/HostStatus.png);
 }
 
@@ -390,30 +390,7 @@ ChartsAndCamerasWnd QWidget#layoutWidget QPushButton
     border:none;
 }
 
-SingleCameraOperationWnd QFrame#line,
-SingleCameraOperationWnd QFrame#line_3,
-SingleCameraOperationWnd QFrame#line_4,
-SingleCameraOperationWnd QFrame#line_5,
-SingleCameraOperationWnd QFrame#line_6,
-MainAndSecondaryCamerasWnd QFrame#line_1,
-MainAndSecondaryCamerasWnd QFrame#line_3,
-MainAndSecondaryCamerasWnd QFrame#line_4,
-MainAndSecondaryCamerasWnd QFrame#line_5,
-MainAndSecondaryCamerasWnd QFrame#line_6,
-MainAndSecondaryCamerasWnd QFrame#line_11,
-MainAndSecondaryCamerasWnd QFrame#line_12,
-MainAndSecondaryCamerasWnd QFrame#line_13,
-MainAndSecondaryCamerasWnd QFrame#line_14,
-MainAndSecondaryCamerasWnd QFrame#line_15,
-ChartsAndCamerasWnd QFrame#line,
-ChartsAndCamerasWnd QFrame#line_3,
-ChartsAndCamerasWnd QFrame#line_4,
-ChartsAndCamerasWnd QFrame#line_5,
-ChartsAndCamerasWnd QFrame#line_6
-{
-    border:none;
-    background-color: rgba(78, 81, 206, 0.5);
-}
+
 
 SingleCameraOperationWnd QPushButton#pushButton_2,
 SingleCameraOperationWnd QLabel#label_Percentage,
@@ -675,3 +652,15 @@ ChartsAndCamerasWnd QLabel#PurpleVerticalBar
 {
     image: url(:/images/Participation display/Purple vertical bars.png);
 }
+
+/* 悬停时的样式 */
+ControlOperationPage QWidget#QHBoxLayout QPushButton:hover
+{
+    background: #A6AFFF; /* 悬停时的背景颜色 */
+}
+
+/* 点击时的样式 */
+ControlOperationPage QWidget#QHBoxLayout QPushButton:pressed
+{
+    background: #808FFF; /* 点击时的背景颜色 */
+}