1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/***************************************************************************
* Copyright (C) 2005 by David Saxton *
* david@bluehaze.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef PINMAPPING_H
#define PINMAPPING_H
#include "component.h"
#include "icndocument.h"
#include "icnview.h"
#include <kdialogbase.h>
class ECKeyPad;
class ECSevenSegment;
class MicroInfo;
class PIC_IC;
class PinMapDocument;
class PinMapView;
/**
Stores a pin mapping Pic <--> [component] where component is set by the Type
(e.g. Keypad or Seven Segment). Used for FlowCode.
@author David Saxton
*/
class PinMapping
{
public:
enum Type
{
SevenSegment,
Keypad_4x3,
Keypad_4x4,
Invalid
};
/**
* Creates an invalid PinMapping, required by TQt templates.
*/
PinMapping();
/**
* Creates a PinMapping with the given type.
*/
PinMapping( Type type );
~PinMapping();
Type type() const { return m_type; }
TQStringList pins() const { return m_pins; }
void setPins( const TQStringList & pins ) { m_pins = pins; }
protected:
TQStringList m_pins;
Type m_type;
};
typedef TQMap< TQString, PinMapping > PinMappingMap;
/**
Dialog for editing a Pin Mapping
@author David Saxton
*/
class PinMapEditor : public KDialogBase
{
Q_OBJECT
TQ_OBJECT
public:
PinMapEditor( PinMapping * PinMapping, MicroInfo * Info, TQWidget * parent, const char * name );
protected:
virtual void slotApply();
virtual void slotOk();
void savePinMapping();
PinMapping * m_pPinMapping;
PinMapDocument * m_pPinMapDocument;
PinMapView * m_pPinMapView;
};
/**
For use with FlowParts that require a pin map (e.g. Keypad and Seven Segment).
@author David Saxton
*/
class PinMapDocument : public ICNDocument
{
Q_OBJECT
TQ_OBJECT
public:
PinMapDocument();
~PinMapDocument();
void init( const PinMapping & PinMapping, MicroInfo * microInfo );
virtual bool isValidItem( Item * item );
virtual bool isValidItem( const TQString &itemId );
PinMapping pinMapping() const;
virtual void deleteSelection();
protected:
PinMapping::Type m_pinMappingType;
ECKeyPad * m_pKeypad;
ECSevenSegment * m_pSevenSegment;
PIC_IC * m_pPicComponent;
};
/**
@author David Saxton
*/
class PinMapView : public ICNView
{
Q_OBJECT
TQ_OBJECT
public:
PinMapView( PinMapDocument * pinMapDocument, ViewContainer * viewContainer, uint viewAreaId, const char * name = 0l );
~PinMapView();
};
class PIC_IC : public Component
{
public:
PIC_IC( ICNDocument * icnDocument, bool newItem, const char *id = 0L );
virtual ~PIC_IC();
virtual bool canFlip() const { return true; }
static Item * construct( ItemDocument *itemDocument, bool newItem, const char *id );
static LibraryItem * libraryItem();
void initPackage( MicroInfo * info );
};
#endif
|