Exemplo n.º 1
0
/* ------------------------------------------------------------------------ */
bool Platform_Layer_Info::
cmp(Platform_Layer_Info const& p) const
{
  // Compare sizes of bimaps first
  if(this->_bimap.left.size() != p._bimap.left.size())
    return false;
  // Compare layout (which device maps to which platform, in order)
  if(this->indices() != p.indices())
    return false;
  // Compare Platforms and Devices one by one
  typedef Bimap::left_const_iterator It;
  It cur1(_bimap.left.begin());
  It cur2(p._bimap.left.begin());
  It end1(_bimap.left.end());
  It end2(p._bimap.left.end());
  for(; cur1 != end1 && cur2 != end2; ++cur1, ++cur2)
    {
      if(*(cur1->first) != *(cur2->first) || *(cur1->second) != *(cur2->second))
        return false;
    }
  return true;
}
Exemplo n.º 2
0
/**
 * Constructor.
 */
QG_GraphicView::QG_GraphicView(QWidget* parent, const char* name, Qt::WindowFlags f)
        : QWidget(parent, f), RS_GraphicView() {

    setObjectName(name);
    setBackground(background);

    redrawMethod=RS2::RedrawAll;
    isSmoothScrolling = false;

    PixmapLayer1=PixmapLayer2=PixmapLayer3=NULL;

    layout = new QGridLayout(this);
    layout->setMargin(0);
    layout->setSpacing(0);
    layout->setColumnStretch(0, 1);
    layout->setColumnStretch(1, 0);
    layout->setColumnStretch(2, 0);
    layout->setRowStretch(0, 1);
    layout->setRowStretch(1, 0);

    hScrollBar = new QG_ScrollBar(Qt::Horizontal, this);
    hScrollBar->setSingleStep(50);
    hScrollBar->setCursor(Qt::ArrowCursor);
    layout->addWidget(hScrollBar, 1, 0);
    layout->addItem(new QSpacerItem(0, hScrollBar->sizeHint().height()), 1, 0);
    connect(hScrollBar, SIGNAL(valueChanged(int)),
            this, SLOT(slotHScrolled(int)));

    vScrollBar = new QG_ScrollBar(Qt::Vertical, this);
    vScrollBar->setSingleStep(50);
    vScrollBar->setCursor(Qt::ArrowCursor);
    layout->addWidget(vScrollBar, 0, 2);
    layout->addItem(new QSpacerItem(vScrollBar->sizeHint().width(), 0), 0, 2);
    connect(vScrollBar, SIGNAL(valueChanged(int)),
            this, SLOT(slotVScrolled(int)));

    // Mouse Cursors:
    QPixmap cur1(":ui/cur_cad_bmp.png");
    QPixmap cur2(":ui/cur_glass_bmp.png");
    QPixmap cur3(":ui/cur_del_bmp.png");
    QPixmap cur4(":ui/cur_select_bmp.png");
    QPixmap cur5(":ui/cur_hand_bmp.png");
#ifdef Q_OS_WIN32
    curCad = new QCursor(cur1, 16, 16);
    curMagnifier = new QCursor(cur2, 12, 12);
    curDel = new QCursor(cur3, 16, 16);
    curSelect = new QCursor(cur4, 16, 16);
    curHand = new QCursor(cur5, 15, 15);
#else
    curCad = new QCursor(cur1, 15, 15);
    curMagnifier = new QCursor(cur2, 12, 12);
    curDel = new QCursor(cur3, 15, 15);
    curSelect = new QCursor(cur4, 15, 15);
    curHand = new QCursor(cur5, 15, 15);
#endif

    // Dummy widgets for scrollbar corners:
    //layout->addWidget(new QWidget(this), 1, 1);
    //QWidget* w = new QWidget(this);
    //w->setEraseColor(QColor(255,0,0));
    gridStatus = new QLabel("-", this);
    gridStatus->setAlignment(Qt::AlignRight);
    layout->addWidget(gridStatus, 1, 1, 1, 2);
    layout->addItem(new QSpacerItem(50, 0), 0, 1);

    setMouseTracking(true);
        // flickering under win:
    //setFocusPolicy(WheelFocus);

    setFocusPolicy(Qt::NoFocus);

    // See https://sourceforge.net/tracker/?func=detail&aid=3289298&group_id=342582&atid=1433844 (Left-mouse drag shrinks window)
    setAttribute(Qt::WA_NoMousePropagation);

    //update entities to selected entities to the current active layer
    RS_SETTINGS->beginGroup("/Modify");
    m_bUpdateLayer=(RS_SETTINGS->readEntry("/ModifyEntitiesToActiveLayer", "0")=="1");
    RS_SETTINGS->writeEntry("/ModifyEntitiesToActiveLayer", m_bUpdateLayer?1:0);
    RS_SETTINGS->endGroup();
}