File indexing completed on 2024-05-05 05:46:09

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef RESISTORDIP_H
0012 #define RESISTORDIP_H
0013 
0014 #include "component.h"
0015 
0016 const int maxCount = 256;
0017 
0018 /**
0019 @author David Saxton
0020 */
0021 class ResistorDIP : public Component
0022 {
0023 public:
0024     ResistorDIP(ICNDocument *icnDocument, bool newItem, const char *id = nullptr);
0025     ~ResistorDIP() override;
0026 
0027     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0028     static LibraryItem *libraryItem();
0029 
0030 protected:
0031     void drawShape(QPainter &p) override;
0032     void updateDIPNodePositions();
0033     void dataChanged() override;
0034     /**
0035      * Add / remove pins according to the number of inputs the user has requested
0036      */
0037     void initPins();
0038 
0039     int m_resistorCount;
0040     Resistance *m_resistance[maxCount];
0041 };
0042 
0043 #endif