Ejemplo n.º 1
0
void QG_GraphicView::layerActivated(RS_Layer *layer) {
	RS_SETTINGS->beginGroup("/Modify");
	bool toActivated= (RS_SETTINGS->readNumEntry("/ModifyEntitiesToActiveLayer", 0)==1);
	RS_SETTINGS->endGroup();

	if(!toActivated) return;
    RS_EntityContainer *container = this->getContainer();
    RS_Graphic* graphic = this->getGraphic();
    QList<RS_Entity*> clones;

    if (graphic) {
        graphic->startUndoCycle();
    }

    for (auto en: *container) {
        if (!en) continue;
        if (!en->isSelected()) continue;

        RS_Entity* cl = en->clone();
        cl->setLayer(layer);
        this->deleteEntity(en);
        en->setSelected(false);
        cl->setSelected(false);
        clones << cl;

        if (!graphic) continue;

        en->setUndoState(true);
        graphic->addUndoable(en);
    }

    for (auto cl: clones) {
        container->addEntity(cl);
        this->drawEntity(cl);

        if (!graphic) continue;

        graphic->addUndoable(cl);
    }

    if (graphic) {
        graphic->endUndoCycle();
        graphic->updateInserts();
    }

    container->calculateBorders();
    container->setSelected(false);
    redraw(RS2::RedrawDrawing);
}
Ejemplo n.º 2
0
void QG_GraphicView::layerActivated(RS_Layer *layer) {
    if(m_bUpdateLayer==false) return;
    RS_EntityContainer *container = this->getContainer();
    RS_Entity *entity = container->firstEntity();

    while (entity != NULL) {
        if (entity->isSelected()) {
            entity->setLayer(layer);
        }

        entity = container->nextEntity();
    }

    container->setSelected(false);
    redraw(RS2::RedrawDrawing);
}
Ejemplo n.º 3
0
void QG_GraphicView::layerActivated(RS_Layer *layer) {
	RS_SETTINGS->beginGroup("/Modify");
	bool toActivated= (RS_SETTINGS->readNumEntry("/ModifyEntitiesToActiveLayer", 0)==1);
	RS_SETTINGS->endGroup();

	if(!toActivated) return;
    RS_EntityContainer *container = this->getContainer();

	//allow undo cycle for layer change of selected
	RS_AttributesData data;
	data.pen = RS_Pen();
	data.layer = layer->getName();
	data.changeColor = false;
	data.changeLineType = false;
	data.changeWidth = false;
	data.changeLayer = true;
	RS_Modification m(*container, this);
	m.changeAttributes(data);

    container->setSelected(false);
    redraw(RS2::RedrawDrawing);
}