installation again

This commit is contained in:
Christophe Alexandre 2008-02-05 20:22:01 +00:00
parent 716aa724f7
commit aa405b5147
10 changed files with 2352 additions and 2221 deletions

View File

@ -1,9 +1,9 @@
# - Find the Hurricane includes and libraries. # - Find the Hurricane includes and libraries.
# The following variables are set if Hurricane is found. If HURRICANE is not # The following variables are set if Hurricane is found. If HURRICANE is not
# found, Hurricane_FOUND is set to false. # found, HURRICANE_FOUND is set to false.
# HURRICANE_FOUND - True when the Hurricane include directory is found. # HURRICANE_FOUND - True when the Hurricane include directory is found.
# HURRICANE_INCLUDE_DIRS - the path to where the Hurricane include files are. # HURRICANE_INCLUDE_DIR - the path to where the Hurricane include files are.
# HURRICANE_LIBRARY_DIRS - The path to where the Hurricane library files are. # HURRICANE_LIBRARIES - The path to where the Hurricane library files are.
SET(HURRICANE_INCLUDE_PATH_DESCRIPTION "directory containing the Hurricane include files. E.g /usr/local/include/hurricane or /asim/coriolis/include/hurricane") SET(HURRICANE_INCLUDE_PATH_DESCRIPTION "directory containing the Hurricane include files. E.g /usr/local/include/hurricane or /asim/coriolis/include/hurricane")
@ -37,10 +37,23 @@ IF(UNIX)
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}" DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
) )
#MESSAGE("HURRICANE_DIR_SEARCH : ${HURRICANE_DIR_SEARCH}") FIND_PATH(HURRICANE_ANALOGIC_INCLUDE_PATH NAMES RdsUnit.h PATHS
#MESSAGE("HURRICANE_LIBRARY_PATH : ${HURRICANE_LIBRARY_PATH}") # Look in other places.
${HURRICANE_DIR_SEARCH}
PATH_SUFFIXES include/hurricane
# Help the user find it if we cannot.
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
)
FIND_PATH(HURRICANE_GRAPHICAL_INCLUDE_PATH FIND_LIBRARY(HURRICANE_ANALOGIC_LIBRARY_PATH
NAMES analogic
PATHS ${HURRICANE_DIR_SEARCH}
PATH_SUFFIXES lib
# Help the user find it if we cannot.
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
)
FIND_PATH(HURRICANE_VIEWER_INCLUDE_PATH
NAMES CellViewer.h NAMES CellViewer.h
PATHS ${HURRICANE_DIR_SEARCH} PATHS ${HURRICANE_DIR_SEARCH}
PATH_SUFFIXES include/hurricane PATH_SUFFIXES include/hurricane
@ -48,7 +61,7 @@ IF(UNIX)
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}" DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
) )
FIND_LIBRARY(HURRICANE_GRAPHICAL_LIBRARY_PATH FIND_LIBRARY(HURRICANE_VIEWER_LIBRARY_PATH
NAMES hurricaneviewer NAMES hurricaneviewer
PATHS ${HURRICANE_DIR_SEARCH} PATHS ${HURRICANE_DIR_SEARCH}
PATH_SUFFIXES lib PATH_SUFFIXES lib
@ -56,39 +69,77 @@ IF(UNIX)
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}" DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
) )
FIND_PATH(HURRICANE_EDITOR_INCLUDE_PATH
NAMES CellEditor.h
PATHS ${HURRICANE_DIR_SEARCH}
PATH_SUFFIXES include/hurricane
# Help the user find it if we cannot.
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
)
FIND_LIBRARY(HURRICANE_EDITOR_LIBRARY_PATH
NAMES hurricaneeditor
PATHS ${HURRICANE_DIR_SEARCH}
PATH_SUFFIXES lib
# Help the user find it if we cannot.
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
)
# Assume we didn't find it. # Assume we didn't find it.
SET(HURRICANE_FOUND 0) SET(HURRICANE_FOUND 0)
SET(HURRICANE_GRAPHICAL_FOUND 0) SET(HURRICANE_GRAPHICAL_FOUND 0)
IF(HURRICANE_INCLUDE_PATH) IF(HURRICANE_INCLUDE_PATH)
IF(HURRICANE_LIBRARY_PATH) IF(HURRICANE_LIBRARY_PATH)
IF(HURRICANE_ANALOGIC_INCLUDE_PATH)
IF(HURRICANE_ANALOGIC_LIBRARY_PATH)
SET(HURRICANE_FOUND "YES") SET(HURRICANE_FOUND "YES")
SET(HURRICANE_INCLUDE_DIR ${HURRICANE_INCLUDE_PATH}) SET(HURRICANE_INCLUDE_DIR
SET(HURRICANE_LIBRARIES ${HURRICANE_LIBRARY_PATH} -lanalogic) ${HURRICANE_INCLUDE_PATH}
${HURRICANE_ANALOGIC_INCLUDE_PATH}
)
SET(HURRICANE_LIBRARIES
${HURRICANE_LIBRARY_PATH}
${HURRICANE_ANALOGIC_LIBRARY_PATH}
)
ENDIF(HURRICANE_ANALOGIC_LIBRARY_PATH)
ENDIF(HURRICANE_ANALOGIC_INCLUDE_PATH)
ENDIF(HURRICANE_LIBRARY_PATH) ENDIF(HURRICANE_LIBRARY_PATH)
ENDIF(HURRICANE_INCLUDE_PATH) ENDIF(HURRICANE_INCLUDE_PATH)
IF(HURRICANE_GRAPHICAL_INCLUDE_PATH) IF(HURRICANE_VIEWER_INCLUDE_PATH)
IF (HURRICANE_GRAPHICAL_LIBRARY_PATH) IF(HURRICANE_VIEWER_LIBRARY_PATH)
IF(HURRICANE_EDITOR_INCLUDE_PATH)
IF(HURRICANE_EDITOR_LIBRARY_PATH)
SET(HURRICANE_GRAPHICAL_FOUND "YES") SET(HURRICANE_GRAPHICAL_FOUND "YES")
SET(HURRICANE_GRAPHICAL_INCLUDE_DIR ${HURRICANE_GRAPHICAL_INCLUDE_PATH}) SET(HURRICANE_GRAPHICAL_INCLUDE_DIR
SET(HURRICANE_GRAPHICAL_LIBRARIES ${HURRICANE_GRAPHICAL_LIBRARY_PATH} -lhurricaneeditor) ${HURRICANE_VIEWER_INCLUDE_PATH}
ENDIF(HURRICANE_GRAPHICAL_LIBRARY_PATH) ${HURRICANE_EDITOR_INCLUDE_PATH}
ENDIF(HURRICANE_GRAPHICAL_INCLUDE_PATH) )
SET(HURRICANE_GRAPHICAL_LIBRARIES
${HURRICANE_VIEWER_LIBRARY_PATH}
${HURRICANE_EDITOR_LIBRARY_PATH}
)
ENDIF(HURRICANE_EDITOR_LIBRARY_PATH)
ENDIF(HURRICANE_EDITOR_INCLUDE_PATH)
ENDIF(HURRICANE_VIEWER_LIBRARY_PATH)
ENDIF(HURRICANE_VIEWER_INCLUDE_PATH)
IF(NOT HURRICANE_FOUND) IF(HURRICANE_FOUND)
IF(NOT HURRICANE_FIND_QUIETLY) IF(NOT HURRICANE_FIND_QUIETLY)
MESSAGE(STATUS "HURRICANE was not found. ${HURRICANE_DIR_MESSAGE}") MESSAGE(STATUS "Found HURRICANE : ${HURRICANE_LIBRARIES}")
ELSE(NOT HURRICANE_FIND_QUIETLY) ENDIF(NOT HURRICANE_FIND_QUIETLY)
ELSE(HURRICANE_FOUND)
IF(HURRICANE_FIND_REQUIRED) IF(HURRICANE_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "HURRICANE was not found. ${HURRICANE_DIR_MESSAGE}") MESSAGE(FATAL_ERROR "HURRICANE was not found. ${HURRICANE_DIR_MESSAGE}")
ENDIF(HURRICANE_FIND_REQUIRED) ENDIF(HURRICANE_FIND_REQUIRED)
ENDIF(NOT HURRICANE_FIND_QUIETLY) ENDIF(HURRICANE_FOUND)
ENDIF(NOT HURRICANE_FOUND)
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
HURRICANE_INCLUDE_PATH HURRICANE_INCLUDE_PATH
HURRICANE_LIBRARY_PATH HURRICANE_LIBRARY_PATH
HURRICANE_ANALOGIC_INCLUDE_PATH
HURRICANE_ANALOGIC_LIBRARY_PATH
HURRICANE_GRAPHICAL_INCLUDE_PATH HURRICANE_GRAPHICAL_INCLUDE_PATH
HURRICANE_GRAPHICAL_LIBRARY_PATH HURRICANE_GRAPHICAL_LIBRARY_PATH
) )

View File

@ -60,9 +60,11 @@ CellEditor::~CellEditor() {
//} //}
void CellEditor::zoomIn() { void CellEditor::zoomIn() {
view->scale(1.2, 1.2);
} }
void CellEditor::zoomOut() { void CellEditor::zoomOut() {
view->scale(0.8, 0.8);
} }
void CellEditor::fitToWindow() { void CellEditor::fitToWindow() {

View File

@ -22,14 +22,17 @@ CellGraphicsItem::CellGraphicsItem(Cell* c):
// end_for; // end_for;
//} //}
unsigned zValue = 10;
for_each_slice(slice, cell->GetSlices()) { for_each_slice(slice, cell->GetSlices()) {
for_each_go(go, slice->GetGos()) { for_each_go(go, slice->GetGos()) {
Segment* segment = dynamic_cast<Segment*>(go); Segment* segment = dynamic_cast<Segment*>(go);
if (segment) { if (segment) {
new SegmentGraphicsItem(this, segment); SegmentGraphicsItem* segmentItem = new SegmentGraphicsItem(this, segment);
segmentItem->setZValue(zValue);
} }
end_for; end_for;
} }
zValue += 10;
end_for; end_for;
} }
} }

View File

@ -1,8 +1,10 @@
#include <math.h> #include <math.h>
#include <QBitmap>
#include <QPainter> #include <QPainter>
#include <QStyleOptionGraphicsItem> #include <QStyleOptionGraphicsItem>
#include "CompositeLayer.h"
#include "BasicLayer.h" #include "BasicLayer.h"
using namespace H; using namespace H;
@ -10,11 +12,57 @@ using namespace H;
#include "CellGraphicsItem.h" #include "CellGraphicsItem.h"
#include "SegmentFigure.h" #include "SegmentFigure.h"
namespace {
QBrush getBrush(const string &pattern, int redValue, int greenValue, int blueValue) {
if (pattern == "FFFFFFFFFFFFFFFF") {
return QBrush(QColor(redValue, greenValue, blueValue));
} else {
uchar bits[8];
for (int i = 0; i < 8; i++) {
int high = pattern[i * 2];
if (('0' <= high) && (high <= '9')) {
high = high - '0';
} else {
if (('a' <= high) && (high <= 'f')) {
high = 10 + high - 'a';
} else {
if (('A' <= high) && (high <= 'F')) {
high = 10 + high - 'A';
} else {
high = '0';
}
}
}
int low = pattern[(i * 2) + 1];
if (('0' <= low) && (low <= '9')) {
low = low - '0';
} else {
if (('a' <= low) && (low <= 'f')) {
low = 10 + low - 'a';
} else {
if (('A' <= low) && (low <= 'F')) {
low = 10 + low - 'A';
} else {
low = '0';
}
}
}
bits[i] = (uchar)((high * 16) + low);
}
return QBrush(QColor(redValue, greenValue, blueValue), QBitmap::fromData(QSize(8,8), bits, QImage::Format_Mono));
}
}
}
SegmentGraphicsItem::SegmentGraphicsItem(CellGraphicsItem* master, Segment* s): SegmentGraphicsItem::SegmentGraphicsItem(CellGraphicsItem* master, Segment* s):
QGraphicsItem(master), QGraphicsItem(master),
segment(s) segment(s)
{ {
setFlag(ItemIsMovable); setFlag(ItemIsMovable);
setFlag(ItemIsSelectable);
setFlag(ItemIsFocusable);
} }
QRectF SegmentGraphicsItem::boundingRect() const { QRectF SegmentGraphicsItem::boundingRect() const {
@ -25,22 +73,46 @@ QRectF SegmentGraphicsItem::boundingRect() const {
} }
void SegmentGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { void SegmentGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
//if (option->levelOfDetail > 1.0) { //if (option->levelOfDetail > 1.0) {
painter->setClipRect(option->exposedRect); painter->setClipRect(option->exposedRect);
BasicLayer* layer = dynamic_cast<BasicLayer*>(segment->GetLayer());
if (layer) {
painter->setBrush(QColor(layer->GetRedValue(), layer->GetGreenValue(), layer->GetBlueValue()));
} else {
painter->setBrush(Qt::blue);
}
Box box = segment->GetBoundingBox(); Box box = segment->GetBoundingBox();
QRectF rect; QRectF rect;
boxToRectangle(box, rect); boxToRectangle(box, rect);
BasicLayer* blayer = dynamic_cast<BasicLayer*>(segment->GetLayer());
if (blayer) {
QColor layerColor(blayer->GetRedValue(),
blayer->GetGreenValue(),
blayer->GetBlueValue());
QBrush brush(layerColor);
brush.setStyle(Qt::Dense1Pattern);
painter->setBrush(brush);
//painter->setBrush(getBrush(blayer->GetFillPattern(),
// blayer->GetRedValue(),
// blayer->GetGreenValue(),
// blayer->GetBlueValue()));
painter->setPen(layerColor);
painter->drawRect(rect); painter->drawRect(rect);
//} } else {
CompositeLayer* clayer = dynamic_cast<CompositeLayer*>(segment->GetLayer());
if (clayer) {
for_each_basic_layer(basiclayer, clayer->GetBasicLayers()) {
QColor layerColor(basiclayer->GetRedValue(),
basiclayer->GetGreenValue(),
basiclayer->GetBlueValue());
QBrush brush(layerColor);
brush.setStyle(Qt::Dense1Pattern);
painter->setBrush(brush);
//painter->setBrush(getBrush(basiclayer->GetFillPattern(),
// basiclayer->GetRedValue(),
// basiclayer->GetGreenValue(),
// basiclayer->GetBlueValue()));
painter->setPen(layerColor);
painter->drawRect(rect);
end_for;
}
}
}
} }
void SegmentGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { void SegmentGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
update(); update();

View File

@ -8,10 +8,10 @@
using namespace H; using namespace H;
inline void boxToRectangle(const Box& box, QRectF& rec) { inline void boxToRectangle(const Box& box, QRectF& rec) {
double xmin = GetValue(box.getXMin()); double xmin = GetValue(box.getXMin() * 10.0);
double xmax = GetValue(box.getXMax()); double xmax = GetValue(box.getXMax()) * 10.0;
double ymin = GetValue(box.getYMin()); double ymin = GetValue(box.getYMin()) * 10.0;
double ymax = GetValue(box.getYMax()); double ymax = GetValue(box.getYMax()) * 10.0;
rec.setCoords(xmin, ymin, xmax, ymax); rec.setCoords(xmin, ymin, xmax, ymax);
} }

View File

@ -23,30 +23,27 @@ CellViewer::~CellViewer() {
delete layersWidget; delete layersWidget;
} }
//void CellViewer::keyPressEvent(QKeyEvent *event) { static int scrollStep = GetUnit(200);
// switch (event->key()) {
// case Qt::Key_Plus: void CellViewer::keyPressEvent(QKeyEvent *event) {
// zoom(ZoomInFactor); switch (event->key()) {
// break; case Qt::Key_Left:
// case Qt::Key_Minus: cellWidget->scroll(-scrollStep, 0);
// zoom(ZoomOutFactor); break;
// break; case Qt::Key_Right:
// case Qt::Key_Left: cellWidget->scroll(+scrollStep, 0);
// scroll(-ScrollStep, 0); break;
// break; case Qt::Key_Down:
// case Qt::Key_Right: cellWidget->scroll(0, -scrollStep);
// scroll(+ScrollStep, 0); break;
// break; case Qt::Key_Up:
// case Qt::Key_Down: cellWidget->scroll(0, +scrollStep);
// scroll(0, -ScrollStep); break;
// break; default:
// case Qt::Key_Up: QWidget::keyPressEvent(event);
// scroll(0, +ScrollStep); }
// break; }
// default:
// QWidget::keyPressEvent(event);
// }
//}
// //
//void CellViewer::wheelEvent(QWheelEvent *event) { //void CellViewer::wheelEvent(QWheelEvent *event) {
// int numDegrees = event->delta() / 8; // int numDegrees = event->delta() / 8;

View File

@ -31,6 +31,9 @@ class CellViewer : public QMainWindow {
void zoomIn(); void zoomIn();
void zoomOut(); void zoomOut();
void fitToWindow(); void fitToWindow();
protected:
void keyPressEvent(QKeyEvent *event);
}; };
#endif #endif

View File

@ -22,6 +22,7 @@ using namespace H;
#include <QPaintEvent> #include <QPaintEvent>
#include <QPainter> #include <QPainter>
#include <QBitmap>
#include <math.h> #include <math.h>
#include <functional> #include <functional>
@ -34,7 +35,7 @@ QBrush getBrush(const string &pattern, int redValue, int greenValue, int blueVal
if (pattern == "FFFFFFFFFFFFFFFF") { if (pattern == "FFFFFFFFFFFFFFFF") {
return QBrush(QColor(redValue, greenValue, blueValue)); return QBrush(QColor(redValue, greenValue, blueValue));
} else { } else {
char bits[8]; uchar bits[8];
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
int high = pattern[i * 2]; int high = pattern[i * 2];
if (('0' <= high) && (high <= '9')) { if (('0' <= high) && (high <= '9')) {
@ -64,10 +65,10 @@ QBrush getBrush(const string &pattern, int redValue, int greenValue, int blueVal
} }
} }
} }
bits[i] = (char)((high * 16) + low); bits[i] = (uchar)((high * 16) + low);
} }
return QBrush(QColor(redValue, greenValue, blueValue),
QPixmap(bits)); return QBrush(QColor(redValue, greenValue, blueValue), QBitmap::fromData(QSize(8,8), bits, QImage::Format_Mono));
} }
} }
@ -1616,8 +1617,7 @@ CellWidget::scroll(const Unit& dx,
if ((getSize(width()) < labs(dx)) || (getSize(height()) < labs(dy))) { if ((getSize(width()) < labs(dx)) || (getSize(height()) < labs(dy))) {
reframe(getCenter().getTranslated(-dx, -dy)); reframe(getCenter().getTranslated(-dx, -dy));
redraw(); redraw();
} } else {
else {
int sdx = getScreenSize(dx); int sdx = getScreenSize(dx);
int sdy = getScreenSize(dy); int sdy = getScreenSize(dy);
@ -1649,32 +1649,35 @@ CellWidget::scroll(const Unit& dx,
if (0 < sdy) { if (0 < sdy) {
//bitBlt(this, sdx, 0, this, 0, sdy, w - sdx, h - sdy); //bitBlt(this, sdx, 0, this, 0, sdy, w - sdx, h - sdy);
invalidate(QRect(-1, -1, sdx + 1, h + 1)); invalidate(QRect(-1, -1, sdx + 1, h + 1));
_redraw(); //_redraw();
invalidate(QRect(sdx - 1, h - sdy - 1, w + 1, h + 1)); invalidate(QRect(sdx - 1, h - sdy - 1, w + 1, h + 1));
_redraw(); //_redraw();
} update();
else { } else {
//bitBlt(this, sdx, -sdy, this, 0, 0, w - sdx, h + sdy, CopyROP); //bitBlt(this, sdx, -sdy, this, 0, 0, w - sdx, h + sdy, CopyROP);
invalidate(QRect(-1, -1, sdx + 1, h + 1)); invalidate(QRect(-1, -1, sdx + 1, h + 1));
_redraw(); //_redraw();
invalidate(QRect(sdx - 1, -1, w + 1, -sdy + 1)); invalidate(QRect(sdx - 1, -1, w + 1, -sdy + 1));
_redraw(); //_redraw();
update();
} }
} }
else { else {
if (0 < sdy) { if (0 < sdy) {
//bitBlt(this, 0, 0, this, -sdx, sdy, w + sdx, h - sdy, CopyROP); //bitBlt(this, 0, 0, this, -sdx, sdy, w + sdx, h - sdy, CopyROP);
invalidate(QRect(w + sdx - 1, -1, w + 1, h + 1)); invalidate(QRect(w + sdx - 1, -1, w + 1, h + 1));
_redraw(); // _redraw();
invalidate(QRect(-1, h - sdy - 1, w + sdx + 1, h + 1)); invalidate(QRect(-1, h - sdy - 1, w + sdx + 1, h + 1));
_redraw(); //_redraw();
update();
} }
else { else {
//bitBlt(this, 0, -sdy, this, -sdx, 0, w + sdx, h + sdy); //bitBlt(this, 0, -sdy, this, -sdx, 0, w + sdx, h + sdy);
invalidate(QRect(w + sdx - 1, -1, w + 1, h + 1)); invalidate(QRect(w + sdx - 1, -1, w + 1, h + 1));
_redraw(); //_redraw();
invalidate(QRect(-1, -1, w + sdx + 1, -sdy + 1)); invalidate(QRect(-1, -1, w + sdx + 1, -sdy + 1));
_redraw(); //_redraw();
update();
} }
} }