File indexing completed on 2024-05-05 05:46:06
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 MATRIXDISPLAY_H 0012 #define MATRIXDISPLAY_H 0013 0014 #include <component.h> 0015 // #include <q3valuevector.h> 0016 0017 const unsigned max_md_width = 100; 0018 const unsigned max_md_height = 20; 0019 0020 /** 0021 @author David Saxton 0022 */ 0023 class MatrixDisplay : public Component 0024 { 0025 public: 0026 MatrixDisplay(ICNDocument *icnDocument, bool newItem, const char *id = nullptr); 0027 ~MatrixDisplay() override; 0028 0029 static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id); 0030 static LibraryItem *libraryItem(); 0031 0032 void stepNonLogic() override; 0033 bool doesStepNonLogic() const override 0034 { 0035 return true; 0036 } 0037 0038 protected: 0039 void drawShape(QPainter &p) override; 0040 void dataChanged() override; 0041 0042 void initPins(unsigned numRows, unsigned numCols); 0043 QString colPinID(int col) const; 0044 QString rowPinID(int row) const; 0045 0046 QVector<QVector<double>> m_avgBrightness; 0047 QVector<QVector<unsigned>> m_lastBrightness; 0048 QVector<QVector<Diode *>> m_pDiodes; 0049 0050 ECNode *m_pRowNodes[max_md_height]; 0051 ECNode *m_pColNodes[max_md_width]; 0052 0053 double m_lastUpdatePeriod; 0054 0055 double m_r, m_g, m_b; 0056 bool m_bRowCathode; 0057 0058 unsigned m_numRows; 0059 unsigned m_numCols; 0060 }; 0061 0062 #endif