Example #1
0
void Dip::swapEntry(const QString & text) {

    FamilyPropertyComboBox * comboBox = qobject_cast<FamilyPropertyComboBox *>(sender());
    if (comboBox == NULL) return;

    bool sip = moduleID().contains("sip");
    bool dip = moduleID().contains("dip");

    if (comboBox->prop().contains("package", Qt::CaseInsensitive)) {
        sip = text.contains("sip", Qt::CaseInsensitive);
        dip = text.contains("dip", Qt::CaseInsensitive);
        if (!dip && !sip) {
            // one of the generic smds
            PaletteItem::swapEntry(text);
            return;
        }
    }

    if (sip) {
        generateSwap(text, genModuleID, genSipFZP, makeBreadboardSvg, makeSchematicSvg, PinHeader::makePcbSvg);
    }
    else if (dip) {
        generateSwap(text, genModuleID, genDipFZP, makeBreadboardSvg, makeSchematicSvg, makePcbDipSvg);
    }
    PaletteItem::swapEntry(text);
}
Example #2
0
void Resistor::setResistance(QString resistance, QString pinSpacing, bool force) {

	QString tolerance = prop("tolerance");

	if (resistance.endsWith(OhmSymbol)) {
		resistance.chop(1);
	}

	switch (this->m_viewIdentifier) {
		case ViewIdentifierClass::BreadboardView:
			if (force || resistance.compare(m_ohms) != 0) {
				QString svg = makeSvg(resistance, m_viewLayerID);
				//DebugDialog::debug(svg);
				loadExtraRenderer(svg.toUtf8());
			}
			break;
		case ViewIdentifierClass::PCBView:
			if (force || pinSpacing.compare(m_pinSpacing) != 0) {

				InfoGraphicsView * infoGraphicsView = InfoGraphicsView::getInfoGraphicsView(this);
				if (infoGraphicsView == NULL) break;

				if (moduleID().compare(ModuleIDNames::ResistorModuleIDName) != 0) break;

				QDomElement element = LayerAttributes::getSvgElementLayers(modelPart()->domDocument(), m_viewIdentifier);
				if (element.isNull()) break;

				// hack the dom element and call setUpImage
				FSvgRenderer::removeFromHash(moduleID(), "");
				QString filename = PinSpacings.value(pinSpacing, "");
				if (filename.isEmpty()) break;

				element.setAttribute("image", filename);

				m_changingPinSpacing = true;
				resetImage(infoGraphicsView);
				m_changingPinSpacing = false;

				updateConnections();
			}
			break;
		default:
			break;
	}

	m_ohms = resistance;
	m_pinSpacing = pinSpacing;
	modelPart()->setProp("resistance", resistance);
	modelPart()->setProp("pin spacing", pinSpacing);
	modelPart()->setProp("tolerance", tolerance);

	updateResistances(m_ohms);
    if (m_partLabel) m_partLabel->displayTextsIf();
}
Example #3
0
QString Pad::makeFirstLayerSvg(double mmW, double mmH, double milsW, double milsH) {
	return makeLayerSvg(moduleID().compare(ModuleIDNames::Copper0PadModuleIDName) == 0 ? ViewLayer::Copper0 : ViewLayer::Copper1, mmW, mmH, milsW, milsH);
}