diff --git a/src/cnitemgroup.h b/src/cnitemgroup.h index dd32eb55..de15e29e 100644 --- a/src/cnitemgroup.h +++ b/src/cnitemgroup.h @@ -1,225 +1,225 @@ /*************************************************************************** * Copyright (C) 2003-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 CANVASITEMGROUP_H #define CANVASITEMGROUP_H #include "itemgroup.h" class CNItem; class Item; class ICNDocument; class Component; class Connector; class FlowPart; class Node; class ECNode; // class FPNode; class ICNDocument; class KtlQCanvasItem; class KtlQCanvasItemList; typedef QList > ItemList; typedef QList > NodeList; typedef QList > ConnectorList; /** @author David Saxton */ class CNItemGroup : public ItemGroup { Q_OBJECT public: CNItemGroup( ICNDocument *icnDocument, const char *name = 0 ); ~CNItemGroup(); /** * Adds a CNItem to the group, if it is not already in it, or other items at * a lower levels are already in the group. If there are items are a high level, * those items are removed first. Returns false on failure to add. */ bool addItem( Item *item ); /** * Adds a Node to the group, if it is not already in it. Note: This node * will *NOT* be added if it is a child node, and the function will return false. * If the node is not already present, and is added, then this will return true. */ bool addNode( Node *node ); /** * Adds a Connector to the group, if it is not already in it (if it is, returns false) */ bool addConnector( Connector *con ); /** - * If the item is a a CNItem, Node or Connector, returns the status + * If the item is a CNItem, Node or Connector, returns the status * for that particular add function, else returns false */ virtual bool addQCanvasItem( KtlQCanvasItem *qcanvasItem ); /** * Sets the contained items to those in this list */ virtual void setItems( KtlQCanvasItemList list ); /** * Removes the CNItem from the group */ void removeItem( Item *item ); /** * Removes the Node from the group */ void removeNode( Node *node ); /** * Removes the Connector from the group */ void removeConnector( Connector *con ); /** - * If the item is a a CNItem, Node or Connector, then attempts to remove it + * If the item is a CNItem, Node or Connector, then attempts to remove it */ virtual void removeQCanvasItem( KtlQCanvasItem *qcanvasItem ); /** * Returns true if the KtlQCanvasItem passed is contained in the group */ virtual bool contains( KtlQCanvasItem *qcanvasItem ) const; /** * Returns the number of Nodes in the CanvasGroup */ uint nodeCount() const { return m_nodeCount; } /** * Returns the number of Connectors in the CanvasGroup */ uint connectorCount() const { return m_connectorCount; } /** * Returns the total number of items in the group * (CNItems, Nodes, Connectors) */ uint count() const { return itemCount()+m_nodeCount+m_connectorCount; } /** * Sets the selected state of all items in the group */ virtual void setSelected( bool sel ); /** * Sets the orientation (degrees component) of all items in the group */ void setOrientationAngle( int angleDegrees ); /** * Sets the orientation (flipped component) of all items in the group */ void setOrientationFlipped( bool flipped ); /** * Sets the orientation of all flowparts in the group */ void setFlowPartOrientation( unsigned orientation ); /** * Sets the orientation (degrees and flipped) of all components in the group */ void setComponentOrientation( int angleDegrees, bool flipped ); /** * Merges all items in the given group with this group */ virtual void mergeGroup( ItemGroup *group ); /** * Removes all items from this group (doesn't delete them) * @param unselect whether to unselect the items or not. This will be done after removal from group */ virtual void removeAllItems(); /** * Attempts to delete everything in the group. * Note: You *must* call ICNDocument::flushDeleteList() after calling this function, * as this function only tells the items to remove themselves */ virtual void deleteAllItems(); /** * Returns a list of all the Nodes in the group. * @param excludeParented if false, then nodes that are fully contained * within item children will also be returned. */ NodeList nodes( bool excludeParented = true ) const; /** * Returns a list of all the Connectors in the group. * @param excludeParented if false, then connectors that are fully contained * within item children will also be returned. */ ConnectorList connectors( bool excludeParented = true ) const; /** * Returns a list of the ids of all the CNItems in the group. */ QStringList itemIDs(); /** * Returns true if at least some of the CNItems in this group can be * rotated. Returns false if no items present. */ bool canRotate() const; /** * Returns true if at least some of the CNItems in this group can be * flipped. Returns false if no items present. */ bool canFlip() const; /** * @return whether all the components or flowparts have the same * orientation. If there are a mixture of components and flowparts * (or other items), this will return false. */ bool haveSameOrientation() const; public slots: /** * Sets the orientation of all selected items to 0 degrees. */ void slotSetOrientation0() { setOrientationAngle(0); } /** * Sets the orientation of all selected items to 90 degrees. */ void slotSetOrientation90() { setOrientationAngle(90); } /** * Sets the orientation of all selected items to 180 degrees. */ void slotSetOrientation180() { setOrientationAngle(180); } /** * Sets the orientation of all selected items to 270 (actually -90) degrees. */ void slotSetOrientation270() { setOrientationAngle(-90); } /** * Rotates all CNItems in the group clockwise */ void slotRotateCW(); /** * Rotates all CNItems in the group counter-clockwise */ void slotRotateCCW(); /** * Flips all CNItems in the group through a horizontal axis. */ void flipVertically(); /** * Flips all CNItems in the group through a veritcal axis. */ void flipHorizontally(); signals: void connectorAdded( Connector *con ); void connectorRemoved( Connector *con ); void nodeAdded( Node *node ); void nodeRemoved( Node *node ); protected: void updateInfo(); void getActiveItem(); void setActiveItem( Item *item ); private: ICNDocument *p_icnDocument; ConnectorList m_connectorList; NodeList m_nodeList; uint m_connectorCount; uint m_nodeCount; int m_currentLevel; // We can only accept CNItems of one level }; #endif diff --git a/src/flowparts/pinmapping.h b/src/flowparts/pinmapping.h index 6fc742b0..b64988c9 100644 --- a/src/flowparts/pinmapping.h +++ b/src/flowparts/pinmapping.h @@ -1,143 +1,143 @@ /*************************************************************************** * 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 "circuiticndocument.h" #include "icnview.h" #include 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 Qt templates. */ PinMapping(); /** * Creates a PinMapping with the given type. */ PinMapping( Type type ); ~PinMapping(); Type type() const { return m_type; } QStringList pins() const { return m_pins; } void setPins( const QStringList & pins ) { m_pins = pins; } protected: QStringList m_pins; Type m_type; }; typedef QMap< QString, PinMapping > PinMappingMap; /** Dialog for editing a Pin Mapping @author David Saxton */ class PinMapEditor : public KDialog { Q_OBJECT public: PinMapEditor( PinMapping * PinMapping, MicroInfo * Info, QWidget * 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 -To see a document like this: put down a PIC, clik advanced on it, then down in the pin map definitions dialog -clik add/modifify, select something in the appearing dialog, and there is is. +To see a document like this: put down a PIC, click advanced on it, then down in the pin map definitions dialog +click add/modify, select something in the appearing dialog, and there is it. It's similar to a circuit. */ // because this document is similar to a circuit, the nodes are the electronic nodes class PinMapDocument : public CircuitICNDocument { Q_OBJECT public: PinMapDocument(); ~PinMapDocument(); void init( const PinMapping & PinMapping, MicroInfo *microInfo ); virtual bool isValidItem( Item *item ); virtual bool isValidItem( const QString &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 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(); static Item *construct( ItemDocument *itemDocument, bool newItem, const char *id ); static LibraryItem *libraryItem(); void initPackage(MicroInfo *info); }; #endif diff --git a/src/gui/probepositioner.h b/src/gui/probepositioner.h index bc843080..6b02d38a 100644 --- a/src/gui/probepositioner.h +++ b/src/gui/probepositioner.h @@ -1,77 +1,77 @@ /*************************************************************************** * 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 PROBEPOSITIONER_H #define PROBEPOSITIONER_H #include class ProbeData; typedef QMap< int, ProbeData* > ProbeDataMap; const float probeArrowWidth = 9; const float probeArrowHeight = 12; /** Widget for positioning the output of Probes in the OscilloscopeView @author David Saxton */ class ProbePositioner : public QWidget { Q_OBJECT public: ProbePositioner(QWidget *parent = 0, const char *name = 0); ~ProbePositioner(); /** * Returns the amount of space (height in pixels) that a probe output * takes up */ int probeOutputHeight() const; /** * Returns the probe position (from the top) in pixels that the probe * with the given id should be displayed at, or -1 if probe with the * given id couldn't be found */ int probePosition( ProbeData *probeData ) const; /** * Sets the probe position relative to the top of this widget (and hence * relative to the top of the oscilloscope view) in pixels */ void setProbePosition( ProbeData *probeData, int position ); /** - * Returns the probe at the given position (plus or minus an an arrow), + * Returns the probe at the given position (plus or minus an arrow), * or NULL if none. Records the offset of the position from the mouse * in m_probePosOffset. */ ProbeData* probeAtPosition( const QPoint &pos ); public slots: void forceRepaint(); protected slots: void slotProbeDataRegistered( int id, ProbeData *probe ); void slotProbeDataUnregistered( int id ); protected: virtual void mousePressEvent( QMouseEvent * e ); virtual void mouseReleaseEvent( QMouseEvent * e ); virtual void mouseMoveEvent( QMouseEvent * e ); virtual void paintEvent( QPaintEvent *e ); virtual void resizeEvent( QResizeEvent *event ); ProbeDataMap m_probeDataMap; ProbeData *p_draggedProbe; int m_probePosOffset; bool b_needRedraw; QPixmap *m_pixmap; }; #endif