Example #1
0
/**
 * Constructor.
 */
QG_PenToolBar::QG_PenToolBar( const QString & title, QWidget * parent )
        : QToolBar(title, parent) {

    this->setMinimumWidth(300);
    this->setMaximumWidth(420);

    colorBox = new QG_ColorBox(true, false, this, "colorbox");
    colorBox->setMinimumWidth(64);
    colorBox->setToolTip(tr("Line color"));
    connect(colorBox, SIGNAL(colorChanged(const RS_Color&)),
            this, SLOT(slotColorChanged(const RS_Color&)));

    widthBox = new QG_WidthBox(true, false, this, "widthbox");
    widthBox->setMinimumWidth(64);
    widthBox->setToolTip(tr("Line width"));
    connect(widthBox, SIGNAL(widthChanged(RS2::LineWidth)),
            this, SLOT(slotWidthChanged(RS2::LineWidth)));

    lineTypeBox = new QG_LineTypeBox(true, false, this, "lineTypebox");
    lineTypeBox->setMinimumWidth(64);
    lineTypeBox->setToolTip(tr("Line type"));
    connect(lineTypeBox, SIGNAL(lineTypeChanged(RS2::LineType)),
            this, SLOT(slotLineTypeChanged(RS2::LineType)));

    currentPen.setColor(colorBox->getColor());
    currentPen.setWidth(widthBox->getWidth());
    currentPen.setLineType(lineTypeBox->getLineType());

    addWidget(colorBox);
    addWidget(widthBox);
    addWidget(lineTypeBox);

}
Example #2
0
/**
 * Initialisation (called from constructor or manually but only
 * once).
 *
 * @param showByLayer true: Show attributes ByLayer, ByBlock
 */
void QG_WidthBox::init(bool showByLayer, bool showUnchanged) {
    this->showByLayer = showByLayer;
	this->showUnchanged = showUnchanged;

    if (showUnchanged) {
        addItem(QIcon(":ui/width00.png"), tr("- Unchanged -"));
    }
    if (showByLayer) {
        addItem(QIcon(":ui/width00.png"), tr("By Layer"));
        addItem(QIcon(":ui/width00.png"), tr("By Block"));
    }
    addItem(QIcon(":ui/width01.png"), tr("Default"));
    addItem(QIcon(":ui/width01.png"), tr("0.00mm"));
    addItem(QIcon(":ui/width01.png"), tr("0.05mm"));
    addItem(QIcon(":ui/width01.png"), tr("0.09mm"));
    addItem(QIcon(":ui/width01.png"), tr("0.13mm (ISO)"));
    addItem(QIcon(":ui/width01.png"), tr("0.15mm"));
    addItem(QIcon(":ui/width01.png"), tr("0.18mm (ISO)"));
    addItem(QIcon(":ui/width01.png"), tr("0.20mm"));
    addItem(QIcon(":ui/width01.png"), tr("0.25mm (ISO)"));
    addItem(QIcon(":ui/width01.png"), tr("0.30mm"));
    addItem(QIcon(":ui/width03.png"), tr("0.35mm (ISO)"));
    addItem(QIcon(":ui/width03.png"), tr("0.40mm"));
    addItem(QIcon(":ui/width04.png"), tr("0.50mm (ISO)"));
    addItem(QIcon(":ui/width05.png"), tr("0.53mm"));
    addItem(QIcon(":ui/width05.png"), tr("0.60mm"));
    addItem(QIcon(":ui/width06.png"), tr("0.70mm (ISO)"));
    addItem(QIcon(":ui/width07.png"), tr("0.80mm"));
    addItem(QIcon(":ui/width08.png"), tr("0.90mm"));
    addItem(QIcon(":ui/width09.png"), tr("1.00mm (ISO)"));
    addItem(QIcon(":ui/width10.png"), tr("1.06mm"));
    addItem(QIcon(":ui/width10.png"), tr("1.20mm"));
    addItem(QIcon(":ui/width12.png"), tr("1.40mm (ISO)"));
    addItem(QIcon(":ui/width12.png"), tr("1.58mm"));
    addItem(QIcon(":ui/width12.png"), tr("2.00mm (ISO)"));
    addItem(QIcon(":ui/width12.png"), tr("2.11mm"));

    connect(this, SIGNAL(activated(int)),
            this, SLOT(slotWidthChanged(int)));

    setCurrentIndex(0);
    slotWidthChanged(currentIndex());
}
Example #3
0
/**
 * Initialisation (called from constructor or manually but only
 * once).
 *
 * @param showByLayer true: Show attributes ByLayer, ByBlock
 */
void QG_WidthBox::init(bool showByLayer, bool showUnchanged) {
    this->showByLayer = showByLayer;
	this->showUnchanged = showUnchanged;

    if (showUnchanged) {
        insertItem(QPixmap(width00_xpm), tr("- Unchanged -"));
    }
    if (showByLayer) {
        insertItem(QPixmap(width00_xpm), tr("By Layer"));
        insertItem(QPixmap(width00_xpm), tr("By Block"));
    }
    insertItem(QPixmap(width01_xpm), tr("Default"));
    insertItem(QPixmap(width01_xpm), tr("0.00mm"));
    insertItem(QPixmap(width01_xpm), tr("0.05mm"));
    insertItem(QPixmap(width01_xpm), tr("0.09mm"));
    insertItem(QPixmap(width01_xpm), tr("0.13mm (ISO)"));
    insertItem(QPixmap(width01_xpm), tr("0.15mm"));
    insertItem(QPixmap(width01_xpm), tr("0.18mm (ISO)"));
    insertItem(QPixmap(width01_xpm), tr("0.20mm"));
    insertItem(QPixmap(width01_xpm), tr("0.25mm (ISO)"));
    insertItem(QPixmap(width01_xpm), tr("0.30mm"));
    insertItem(QPixmap(width03_xpm), tr("0.35mm (ISO)"));
    insertItem(QPixmap(width03_xpm), tr("0.40mm"));
    insertItem(QPixmap(width04_xpm), tr("0.50mm (ISO)"));
    insertItem(QPixmap(width05_xpm), tr("0.53mm"));
    insertItem(QPixmap(width05_xpm), tr("0.60mm"));
    insertItem(QPixmap(width06_xpm), tr("0.70mm (ISO)"));
    insertItem(QPixmap(width07_xpm), tr("0.80mm"));
    insertItem(QPixmap(width08_xpm), tr("0.90mm"));
    insertItem(QPixmap(width09_xpm), tr("1.00mm (ISO)"));
    insertItem(QPixmap(width10_xpm), tr("1.06mm"));
    insertItem(QPixmap(width10_xpm), tr("1.20mm"));
    insertItem(QPixmap(width12_xpm), tr("1.40mm (ISO)"));
    insertItem(QPixmap(width12_xpm), tr("1.58mm"));
    insertItem(QPixmap(width12_xpm), tr("2.00mm (ISO)"));
    insertItem(QPixmap(width12_xpm), tr("2.11mm"));

    connect(this, SIGNAL(activated(int)),
            this, SLOT(slotWidthChanged(int)));

    setCurrentItem(0);
    slotWidthChanged(currentItem());
}
Example #4
0
/**
 * Constructor.
 */
QG_PenToolBar::QG_PenToolBar( const QString & title, QWidget * parent )
		: QToolBar(title, parent)
		, currentPen(new RS_Pen{})
		, colorBox(new QG_ColorBox{true, false, this, "colorbox"})
		, widthBox(new QG_WidthBox{true, false, this, "widthbox"})
		, lineTypeBox(new QG_LineTypeBox{true, false, this, "lineTypebox"})
{

#if QT_VERSION >= 0x050500
	int const dPxlRatio=devicePixelRatio();
#else
	int const dPxlRatio=1;
#endif
	setMinimumWidth(300 * dPxlRatio);
	setMaximumWidth(420 * dPxlRatio);

	colorBox->setMinimumWidth(64 * dPxlRatio);
    colorBox->setToolTip(tr("Line color"));
	connect(colorBox.get(), SIGNAL(colorChanged(const RS_Color&)),
            this, SLOT(slotColorChanged(const RS_Color&)));

	widthBox->setMinimumWidth(64 * dPxlRatio);
    widthBox->setToolTip(tr("Line width"));
	connect(widthBox.get(), SIGNAL(widthChanged(RS2::LineWidth)),
            this, SLOT(slotWidthChanged(RS2::LineWidth)));

	lineTypeBox->setMinimumWidth(64 * dPxlRatio);
    lineTypeBox->setToolTip(tr("Line type"));
	connect(lineTypeBox.get(), SIGNAL(lineTypeChanged(RS2::LineType)),
            this, SLOT(slotLineTypeChanged(RS2::LineType)));

	currentPen->setColor(colorBox->getColor());
	currentPen->setWidth(widthBox->getWidth());
	currentPen->setLineType(lineTypeBox->getLineType());

	addWidget(colorBox.get());
	addWidget(widthBox.get());
	addWidget(lineTypeBox.get());

}
Example #5
0
/**
 * Sets the pixmap showing the width of the "By Layer" item.
 */
void QG_WidthBox::setLayerWidth(RS2::LineWidth w) {
    if (showByLayer) {
        QIcon pixmap;
        switch(w) {
        default:
        case RS2::Width00:
            pixmap = QPixmap(":ui/width00.png");
            break;
        case RS2::Width01:
        case RS2::Width02:
            pixmap = QPixmap(":ui/width01.png");
            break;
        case RS2::Width03:
        case RS2::Width04:
            pixmap = QPixmap(":ui/width02.png");
            break;
        case RS2::Width05:
        case RS2::Width06:
            pixmap = QPixmap(":ui/width03.png");
            break;
        case RS2::Width07:
        case RS2::Width08:
            pixmap = QPixmap(":ui/width04.png");
            break;
        case RS2::Width09:
        case RS2::Width10:
            pixmap = QPixmap(":ui/width05.png");
            break;
        case RS2::Width11:
        case RS2::Width12:
            pixmap = QPixmap(":ui/width06.png");
            break;
        case RS2::Width13:
        case RS2::Width14:
            pixmap = QPixmap(":ui/width07.png");
            break;
        case RS2::Width15:
        case RS2::Width16:
            pixmap = QPixmap(":ui/width08.png");
            break;
        case RS2::Width17:
        case RS2::Width18:
            pixmap = QPixmap(":ui/width09.png");
            break;
        case RS2::Width19:
        case RS2::Width20:
            pixmap = QPixmap(":ui/width10.png");
            break;
        case RS2::Width21:
        case RS2::Width22:
            pixmap = QPixmap(":ui/width11.png");
            break;
        case RS2::Width23:
            //case RS2::Width24:
            pixmap = QPixmap(":ui/width12.png");
            break;
        }

        setItemIcon(0, pixmap);
        setItemText(0, tr("By Layer"));

        // needed for the first time a layer is added:
        slotWidthChanged(currentIndex());
    }
}
Example #6
0
/**
 * Sets the currently selected width item to the given width.
 */
void QG_WidthBox::setWidth(RS2::LineWidth w) {

    RS_DEBUG->print("QG_WidthBox::setWidth %d\n", (int)w);

    int offset = (int)showByLayer*2 + (int)showUnchanged;

    switch (w) {
    case RS2::WidthByLayer:
        if (showByLayer) {
            setCurrentIndex(0 + (int)showUnchanged);
        } else {
        	RS_DEBUG->print(RS_Debug::D_WARNING,
            	"QG_WidthBox::setWidth: Unsupported width.");
        }
        break;
    case RS2::WidthByBlock:
        if (showByLayer) {
            setCurrentIndex(1 + (int)showUnchanged);
        } else {
        	RS_DEBUG->print(RS_Debug::D_WARNING,
            	"QG_WidthBox::setWidth: Unsupported width.");
        }
        break;
    case RS2::WidthDefault:
        setCurrentIndex(0 + offset);
        break;
    case RS2::Width00:
        setCurrentIndex(1 + offset);
        break;
    case RS2::Width01:
        setCurrentIndex(2 + offset);
        break;
    case RS2::Width02:
        setCurrentIndex(3 + offset);
        break;
    case RS2::Width03:
        setCurrentIndex(4 + offset);
        break;
    case RS2::Width04:
        setCurrentIndex(5 + offset);
        break;
    case RS2::Width05:
        setCurrentIndex(6 + offset);
        break;
    case RS2::Width06:
        setCurrentIndex(7 + offset);
        break;
    case RS2::Width07:
        setCurrentIndex(8 + offset);
        break;
    case RS2::Width08:
        setCurrentIndex(9 + offset);
        break;
    case RS2::Width09:
        setCurrentIndex(10 + offset);
        break;
    case RS2::Width10:
        setCurrentIndex(11 + offset);
        break;
    case RS2::Width11:
        setCurrentIndex(12 + offset);
        break;
    case RS2::Width12:
        setCurrentIndex(13 + offset);
        break;
    case RS2::Width13:
        setCurrentIndex(14 + offset);
        break;
    case RS2::Width14:
        setCurrentIndex(15 + offset);
        break;
    case RS2::Width15:
        setCurrentIndex(16 + offset);
        break;
    case RS2::Width16:
        setCurrentIndex(17 + offset);
        break;
    case RS2::Width17:
        setCurrentIndex(18 + offset);
        break;
    case RS2::Width18:
        setCurrentIndex(19 + offset);
        break;
    case RS2::Width19:
        setCurrentIndex(20 + offset);
        break;
    case RS2::Width20:
        setCurrentIndex(21 + offset);
        break;
    case RS2::Width21:
        setCurrentIndex(22 + offset);
        break;
    case RS2::Width22:
        setCurrentIndex(23 + offset);
        break;
    case RS2::Width23:
        setCurrentIndex(24 + offset);
        break;
    default:
        break;
    }

    slotWidthChanged(currentIndex());
}
Example #7
0
/**
 * Sets the pixmap showing the width of the "By Layer" item.
 */
void QG_WidthBox::setLayerWidth(RS2::LineWidth w) {
    if (showByLayer) {
        QPixmap pixmap;
        switch(w) {
        default:
        case RS2::Width00:
            pixmap = QPixmap(width00_xpm);
            break;
        case RS2::Width01:
        case RS2::Width02:
            pixmap = QPixmap(width01_xpm);
            break;
        case RS2::Width03:
        case RS2::Width04:
            pixmap = QPixmap(width02_xpm);
            break;
        case RS2::Width05:
        case RS2::Width06:
            pixmap = QPixmap(width03_xpm);
            break;
        case RS2::Width07:
        case RS2::Width08:
            pixmap = QPixmap(width04_xpm);
            break;
        case RS2::Width09:
        case RS2::Width10:
            pixmap = QPixmap(width05_xpm);
            break;
        case RS2::Width11:
        case RS2::Width12:
            pixmap = QPixmap(width06_xpm);
            break;
        case RS2::Width13:
        case RS2::Width14:
            pixmap = QPixmap(width07_xpm);
            break;
        case RS2::Width15:
        case RS2::Width16:
            pixmap = QPixmap(width08_xpm);
            break;
        case RS2::Width17:
        case RS2::Width18:
            pixmap = QPixmap(width09_xpm);
            break;
        case RS2::Width19:
        case RS2::Width20:
            pixmap = QPixmap(width10_xpm);
            break;
        case RS2::Width21:
        case RS2::Width22:
            pixmap = QPixmap(width11_xpm);
            break;
        case RS2::Width23:
            //case RS2::Width24:
            pixmap = QPixmap(width12_xpm);
            break;
        }

        changeItem(pixmap, tr("By Layer"), 0);

        // needed for the first time a layer is added:
        slotWidthChanged(currentItem());
    }
}