* ./unicorn:

- Change: Rename COpenCellDialog in OpenCellDialog.
    - Change: In CgtMain, now the save parameter must be supplied with a design
        name. The same should be different from the input one to avoid overwrites.
    - New: SaveCellDialog to write back the Cell. Currently only writes the
        layout view.
This commit is contained in:
Jean-Paul Chaput 2010-05-14 07:37:33 +00:00
parent babd0f5419
commit f836905c6f
8 changed files with 319 additions and 70 deletions

View File

@ -6,9 +6,11 @@
)
set ( mocincludes unicorn/UnicornGui.h
unicorn/COpenCellDialog.h
unicorn/OpenCellDialog.h
unicorn/SaveCellDialog.h
)
set ( cpps COpenCellDialog.cpp
set ( cpps OpenCellDialog.cpp
SaveCellDialog.cpp
UnicornGui.cpp
)
set ( cgtcpp CgtMain.cpp )
@ -16,48 +18,48 @@
qt4_wrap_cpp ( MOCcpps ${mocincludes} )
qt4_add_resources ( RCC_SRCS Unicorn.qrc )
add_library ( unicorn ${cpps} ${MOCcpps} )
target_link_libraries ( unicorn ${SOLSTICE_GRAPHICAL_LIBRARIES}
${SOLSTICE_LIBRARIES}
${EQUINOX_GRAPHICAL_LIBRARIES}
${EQUINOX_LIBRARIES}
${KITE_GRAPHICAL_LIBRARIES}
${KITE_LIBRARIES}
${KATABATIC_GRAPHICAL_LIBRARIES}
${KATABATIC_LIBRARIES}
${KNIK_GRAPHICAL_LIBRARIES}
${KNIK_LIBRARIES}
${CORIOLIS_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES}
${HURRICANE_LIBRARIES}
${AGDS_LIBRARY}
${CIF_LIBRARY}
${LEFDEF_LIBRARIES}
${OA_LIBRARIES}
${QT_LIBRARIES}
${Boost_LIBRARIES}
add_library ( unicorn ${cpps} ${MOCcpps} )
target_link_libraries ( unicorn ${SOLSTICE_GRAPHICAL_LIBRARIES}
${SOLSTICE_LIBRARIES}
${EQUINOX_GRAPHICAL_LIBRARIES}
${EQUINOX_LIBRARIES}
${KITE_GRAPHICAL_LIBRARIES}
${KITE_LIBRARIES}
${KATABATIC_GRAPHICAL_LIBRARIES}
${KATABATIC_LIBRARIES}
${KNIK_GRAPHICAL_LIBRARIES}
${KNIK_LIBRARIES}
${CORIOLIS_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES}
${HURRICANE_LIBRARIES}
${AGDS_LIBRARY}
${CIF_LIBRARY}
${LEFDEF_LIBRARIES}
${OA_LIBRARIES}
${QT_LIBRARIES}
${Boost_LIBRARIES}
)
add_executable ( cgt ${cgtcpp} )
target_link_libraries ( cgt unicorn
${SOLSTICE_GRAPHICAL_LIBRARIES}
${SOLSTICE_LIBRARIES}
${EQUINOX_GRAPHICAL_LIBRARIES}
${EQUINOX_LIBRARIES}
${KITE_GRAPHICAL_LIBRARIES}
${KITE_LIBRARIES}
${KATABATIC_GRAPHICAL_LIBRARIES}
${KATABATIC_LIBRARIES}
${KNIK_GRAPHICAL_LIBRARIES}
${KNIK_LIBRARIES}
${CORIOLIS_LIBRARIES}
${HURRICANE_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES}
${OA_LIBRARIES}
${QT_LIBRARIES}
${Boost_LIBRARIES}
add_executable ( cgt ${cgtcpp} )
target_link_libraries ( cgt unicorn
${SOLSTICE_GRAPHICAL_LIBRARIES}
${SOLSTICE_LIBRARIES}
${EQUINOX_GRAPHICAL_LIBRARIES}
${EQUINOX_LIBRARIES}
${KITE_GRAPHICAL_LIBRARIES}
${KITE_LIBRARIES}
${KATABATIC_GRAPHICAL_LIBRARIES}
${KATABATIC_LIBRARIES}
${KNIK_GRAPHICAL_LIBRARIES}
${KNIK_LIBRARIES}
${CORIOLIS_LIBRARIES}
${HURRICANE_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES}
${OA_LIBRARIES}
${QT_LIBRARIES}
${Boost_LIBRARIES}
)
install ( TARGETS unicorn DESTINATION /lib)
install ( TARGETS cgt DESTINATION /bin )
install ( FILES ${includes}
${mocIncludes} DESTINATION /include/coriolis/unicorn )
install ( TARGETS unicorn DESTINATION /lib)
install ( TARGETS cgt DESTINATION /bin )
install ( FILES ${includes}
${mocIncludes} DESTINATION /include/coriolis/unicorn )

View File

@ -123,7 +123,6 @@ int main ( int argc, char *argv[] )
bool textMode;
bool loadGlobal;
bool saveGlobal;
bool saveDesign;
poptions::options_description options ("Command line arguments & options");
options.add_options()
@ -158,7 +157,7 @@ int main ( int argc, char *argv[] )
"allowed to perform." )
( "cell,c" , poptions::value<string>()
, "The name of the cell to load, whithout extension." )
( "save,s" , poptions::bool_switch(&saveDesign)->default_value(false)
( "save,s" , poptions::value<string>()->default_value("")
, "Save the routed design.")
( "save-global" , poptions::bool_switch(&saveGlobal)->default_value(false)
, "Save the global routing solution.");
@ -338,9 +337,8 @@ int main ( int argc, char *argv[] )
kite->dumpMeasures ();
kite->destroy ();
if ( saveDesign ) {
string name = getString(cell->getName()) + "_kite";
cell->setName ( name );
if ( arguments.count("save") ) {
cell->setName ( arguments["save"].as<string>().c_str() );
af->saveCell ( cell, Catalog::State::Physical );
}

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -16,7 +16,7 @@
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./COpenCellDialog.cpp" |
// | C++ Module : "./OpenCellDialog.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
@ -40,7 +40,7 @@ using namespace std;
#include "crlcore/Environment.h"
#include "crlcore/AllianceFramework.h"
#include "unicorn/COpenCellDialog.h"
#include "unicorn/OpenCellDialog.h"
namespace Unicorn {
@ -53,12 +53,12 @@ namespace Unicorn {
// -------------------------------------------------------------------
// Class : "COpenCellDialog".
// Class : "OpenCellDialog".
COpenCellDialog::COpenCellDialog ( QWidget* parent )
: QDialog(parent)
, _lineEdit(NULL)
OpenCellDialog::OpenCellDialog ( QWidget* parent )
: QDialog (parent)
, _lineEdit (NULL)
, _viewerCheckBox(NULL)
{
setWindowTitle ( tr("Open Cell") );
@ -126,21 +126,21 @@ namespace Unicorn {
}
const QString COpenCellDialog::getCellName () const
const QString OpenCellDialog::getCellName () const
{
return _lineEdit->text();
}
bool COpenCellDialog::newViewerRequest () const
bool OpenCellDialog::newViewerRequest () const
{
return _viewerCheckBox->isChecked();
}
bool COpenCellDialog::runDialog ( QWidget* parent, QString& name, bool& newViewerRequest )
bool OpenCellDialog::runDialog ( QWidget* parent, QString& name, bool& newViewerRequest )
{
COpenCellDialog* dialog = new COpenCellDialog ( parent );
OpenCellDialog* dialog = new OpenCellDialog ( parent );
bool dialogResult = (dialog->exec() == Accepted);
name = dialog->getCellName ();
@ -152,7 +152,7 @@ namespace Unicorn {
}
void COpenCellDialog::formatChanged ( int index )
void OpenCellDialog::formatChanged ( int index )
{
Environment* environment = AllianceFramework::get()->getEnvironment();
switch ( index ) {

View File

@ -0,0 +1,166 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | U n i c o r n - M a i n G U I |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./SaveCellDialog.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <iostream>
using namespace std;
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QButtonGroup>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "hurricane/Warning.h"
#include "hurricane/viewer/Graphics.h"
#include "crlcore/Environment.h"
#include "crlcore/AllianceFramework.h"
#include "unicorn/SaveCellDialog.h"
namespace Unicorn {
using Hurricane::Warning;
using Hurricane::Graphics;
using CRL::Environment;
using CRL::AllianceFramework;
// -------------------------------------------------------------------
// Class : "SaveCellDialog".
SaveCellDialog::SaveCellDialog ( QWidget* parent )
: QDialog (parent)
, _lineEdit(NULL)
{
setWindowTitle ( tr("Save Cell") );
QLabel* label = new QLabel ();
label->setText ( tr("Enter Cell name (without extention)") );
label->setFont ( Graphics::getNormalFont(true) );
_lineEdit = new QLineEdit ();
_lineEdit->setMinimumWidth ( 400 );
QPushButton* okButton = new QPushButton ();
okButton->setText ( "OK" );
okButton->setDefault ( true );
QPushButton* cancelButton = new QPushButton ();
cancelButton->setText ( "Cancel" );
QHBoxLayout* hLayout1 = new QHBoxLayout ();
hLayout1->addStretch ();
hLayout1->addWidget ( okButton );
hLayout1->addStretch ();
hLayout1->addWidget ( cancelButton );
hLayout1->addStretch ();
QFrame* separator = new QFrame ();
separator->setFrameShape ( QFrame::HLine );
separator->setFrameShadow ( QFrame::Sunken );
QHBoxLayout* hLayout2 = new QHBoxLayout ();
QButtonGroup* formatGroup = new QButtonGroup ();
QRadioButton* formatButton = new QRadioButton ();
formatButton->setText ( tr("vst/ap") );
formatButton->setChecked ( true );
formatGroup->setId ( formatButton, 0 );
formatGroup->addButton ( formatButton );
hLayout2->addWidget ( formatButton );
formatButton = new QRadioButton ();
formatButton->setText ( tr("DEF") );
formatButton->setChecked ( false );
formatGroup->setId ( formatButton, 1 );
formatGroup->addButton ( formatButton );
hLayout2->addWidget ( formatButton );
QVBoxLayout* vLayout = new QVBoxLayout ();
vLayout->setSizeConstraint ( QLayout::SetFixedSize );
vLayout->addWidget ( label );
vLayout->addWidget ( _lineEdit );
vLayout->addLayout ( hLayout1 );
vLayout->addWidget ( separator );
vLayout->addLayout ( hLayout2 );
setLayout ( vLayout );
//setModal ( true );
connect ( okButton, SIGNAL(clicked()) , this, SLOT(accept()) );
connect ( cancelButton, SIGNAL(clicked()) , this, SLOT(reject()) );
connect ( formatGroup , SIGNAL(buttonClicked(int)), this, SLOT(formatChanged(int)) );
}
const QString SaveCellDialog::getCellName () const
{
return _lineEdit->text();
}
void SaveCellDialog::setCellName ( const QString& name )
{
return _lineEdit->setText ( name );
}
bool SaveCellDialog::runDialog ( QWidget* parent, QString& name )
{
auto_ptr<SaveCellDialog> dialog ( new SaveCellDialog(parent) );
dialog->setCellName ( name );
bool dialogResult = (dialog->exec() == Accepted);
name = dialog->getCellName ();
return dialogResult;
}
void SaveCellDialog::formatChanged ( int index )
{
Environment* environment = AllianceFramework::get()->getEnvironment();
switch ( index ) {
case 0:
environment->setOUT_LO ( "vst" );
environment->setOUT_PH ( "ap" );
break;
case 1:
environment->setOUT_LO ( "def" );
environment->setOUT_PH ( "def" );
break;
default:
cerr << Warning("Unknown output format: %d.",index) << endl;
}
}
} // End of Unicorn namespace.

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -33,7 +33,8 @@
#include "crlcore/AllianceFramework.h"
#include "crlcore/GraphicToolEngine.h"
#include "unicorn/COpenCellDialog.h"
#include "unicorn/OpenCellDialog.h"
#include "unicorn/SaveCellDialog.h"
#include "unicorn/UnicornGui.h"
@ -92,6 +93,12 @@ namespace Unicorn {
if ( openAction ) {
connect ( openAction, SIGNAL(triggered()), this, SLOT(openCell()) );
}
QAction* saveAction = findChild<QAction*>("viewer.menuBar.file.saveCell");
if ( saveAction ) {
saveAction->setVisible ( true );
connect ( saveAction, SIGNAL(triggered()), this, SLOT(saveCell()) );
}
}
@ -140,7 +147,7 @@ namespace Unicorn {
QString cellName;
bool newViewer;
if ( COpenCellDialog::runDialog ( this, cellName, newViewer ) ) {
if ( OpenCellDialog::runDialog ( this, cellName, newViewer ) ) {
Cell* cell = getCellFromDb ( cellName.toStdString().c_str() );
if ( cell ) {
if ( newViewer ) {
@ -154,4 +161,18 @@ namespace Unicorn {
}
void UnicornGui::saveCell ()
{
Cell* cell = getCell();
if ( cell == NULL ) return;
QString cellName = getString(cell->getName()).c_str();
if ( SaveCellDialog::runDialog ( this, cellName ) ) {
renameCell ( cellName.toStdString().c_str() );
AllianceFramework::get()->saveCell ( cell, Catalog::State::Physical );
}
}
} // End of Unicorn namespace.

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -16,7 +16,7 @@
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./COpenCellDialog.h" |
// | C++ Header : "./OpenCellDialog.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
@ -35,7 +35,7 @@ class QLineEdit;
namespace Unicorn {
class COpenCellDialog : public QDialog {
class OpenCellDialog : public QDialog {
Q_OBJECT;
public:
@ -43,7 +43,7 @@ namespace Unicorn {
const QString getCellName () const;
bool newViewerRequest () const;
protected:
COpenCellDialog ( QWidget* parent=NULL );
OpenCellDialog ( QWidget* parent=NULL );
protected slots:
void formatChanged ( int );

View File

@ -0,0 +1,61 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | U n i c o r n - M a i n G U I |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./SaveCellDialog.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __UNICORN_SAVE_CELL_DIALOG_H__
#define __UNICORN_SAVE_CELL_DIALOG_H__
#include <QDialog>
class QCheckBox;
class QLineEdit;
namespace Unicorn {
class SaveCellDialog : public QDialog {
Q_OBJECT;
public:
static bool runDialog ( QWidget* parent, QString& name );
const QString getCellName () const;
public slots:
void setCellName ( const QString& );
protected:
SaveCellDialog ( QWidget* parent=NULL );
protected slots:
void formatChanged ( int );
protected:
QLineEdit* _lineEdit;
};
} // End of Unicorn namespace.
#endif

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -61,9 +61,10 @@ namespace Unicorn {
void registerTool ( GraphicTool* );
public slots:
void openCell ();
void saveCell ();
protected:
UnicornGui ( QWidget* parent );
virtual ~UnicornGui ();
virtual ~UnicornGui ();
virtual void _postCreate ();
virtual void _preDestroy ();
protected: