00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ScheditBitmap_H
00022 #define ScheditBitmap_H
00023
00024 #include <canvaspixmap.h>
00025 #include <qcheckbox.h>
00026
00027 #include "pinrecord.h"
00028 #include "scheditjunction.h"
00029 #include "scheditfontprefs.h"
00030
00031 class QBitmap;
00032 class ScheditPrefs;
00033 class KDialogBase;
00034 class KConfig;
00035 class ColourValuePref;
00036 class QCheckBox;
00037
00041 class ScheditBitmap : public CanvasPixmap {
00042 private:
00043 typedef QPtrList<ScheditPrefs> prefsList;
00044 static prefsList prefPages;
00045 static ColourValuePref * lpBmp;
00046 static QCheckBox * cbShowVal;
00047 static QCheckBox * cbShowDes;
00048 static QCheckBox * cbShowPin;
00049 static QCheckBox * cbShowFun;
00050
00051 public:
00052 ScheditBitmap ( QCanvas * canvas,
00053 unsigned char * & puc );
00054
00055 ~ScheditBitmap();
00056
00057 virtual int rtti () const;
00058
00059 void drawTransformed ( QPainter& painter );
00060
00061 void drawUntransformed ( QPainter& painter );
00062
00063 int getExtension ( void );
00064
00065 QSize getBmpSize ( void );
00066
00067 static void setup ( KDialogBase * dlg );
00068 static void readProperties ( KConfig * config);
00069 static void writeProperties ( KConfig * config );
00070
00071 static QFontMetrics& getNumFontMetrics ( void );
00072 static QFontMetrics& getFunFontMetrics ( void );
00073
00074 private:
00075 typedef enum {
00076 eScheditNormal,
00077 eScheditDevice,
00078 eScheditPower,
00079 eScheditSymbol,
00080 eScheditConnector,
00081 } eScheditDisplayType;
00082
00083 #pragma pack (push,1)
00084 typedef struct {
00085 unsigned short usRot:2;
00086 unsigned short usFlip:1;
00087 unsigned short usQue1:11;
00088 } Orient;
00089
00090
00091
00092
00093
00094
00095
00096 typedef struct {
00097 unsigned char ucType;
00098 char asciilDes [11];
00099 unsigned short usBitmapX;
00100 unsigned short usBitmapY;
00101 char cA;
00102 char asciilVal [11];
00103 unsigned short usBytesPerRow;
00104 unsigned short usRowCount;
00105 char cB;
00106 Orient orient;
00107 unsigned short usDesX;
00108 unsigned short usDesY;
00109 unsigned short usValX;
00110 unsigned short usValY;
00111
00112 unsigned char ucSecIndex;
00113 unsigned char ucSecCount;
00114 unsigned char ucColBlocks;
00115 unsigned char ucRowBlocks;
00116 unsigned char ucDisplayType;
00117
00118 char cC;
00119 unsigned char ucPins;
00120 unsigned char ucQue3[3];
00121 char asciilPkg [11];
00122 } BitmapHdr;
00123
00124 typedef struct {
00125 unsigned char ucA;
00126 unsigned char ucB;
00127 unsigned char ucColBlocks;
00128 unsigned char ucRowBlocks;
00129 int getBmpDataOffs ( void );
00130 int getBmpRows ( void );
00131 int getBmpCols ( void );
00132 bool isBmp ( void );
00133 } SectionData;
00134
00135 typedef struct {
00136 SectionData sdPlus0;
00137 SectionData sdPlus1;
00138 unsigned char acuQueI [8];
00139 } SectionDataLine;
00140 #pragma pack (pop)
00141
00142 QBitmap * bmp;
00143
00144 BitmapHdr bmphdr;
00145 SectionDataLine * asdl;
00146 SectionData ** apsd;
00147 PinRecord ** pins;
00148 unsigned char * pucImageData;
00149 unsigned char * pucSectionImageData;
00150 unsigned char ucSecCount;
00151 int iSection;
00152 int iColCount;
00153 int iRowCount;
00154 int iPinCount;
00155
00156
00157
00158 static int iBitmapCount;
00159 static QStringList slFunction;
00160 static QStringList slSide;
00161 static QStringList slRotation;
00162
00163 void TransformPoint ( QPoint& qpPinData );
00164 void TransformSide ( PinRecord::eScheditSide& eSide );
00165 void Render ( SectionData * psd );
00166 };
00167
00168
00169 #endif