WIP: edt enabled for Qt-less

This commit is contained in:
Matthias Koefferlein 2022-05-08 19:44:14 +02:00
parent aea861f9b4
commit 37a42b70db
16 changed files with 594 additions and 403 deletions

View File

@ -6,62 +6,70 @@ include($$PWD/../../lib.pri)
DEFINES += MAKE_EDT_LIBRARY DEFINES += MAKE_EDT_LIBRARY
HEADERS = \ !equals(HAVE_QT, "0") {
edtConfig.h \
edtDialogs.h \ HEADERS = \
edtEditorOptionsPages.h \ edtDialogs.h \
edtInstPropertiesPage.h \ edtEditorOptionsPages.h \
edtMainService.h \ edtInstPropertiesPage.h \
edtPartialService.h \ edtPCellParametersPage.h \
edtPCellParametersPage.h \ edtPropertiesPages.h \
edtPlugin.h \ edtPropertiesPageUtils.h \
edtPropertiesPages.h \
edtPropertiesPageUtils.h \
edtService.h \
edtServiceImpl.h \
edtUtils.h \
edtCommon.h \
edtDistribute.h \
edtRecentConfigurationPage.h edtRecentConfigurationPage.h
FORMS = \ FORMS = \
AlignOptionsDialog.ui \ AlignOptionsDialog.ui \
BoxPropertiesPage.ui \ BoxPropertiesPage.ui \
CopyModeDialog.ui \ CopyModeDialog.ui \
ChangeLayerOptionsDialog.ui \ ChangeLayerOptionsDialog.ui \
EditablePathPropertiesPage.ui \ EditablePathPropertiesPage.ui \
EditorOptionsGeneric.ui \ EditorOptionsGeneric.ui \
EditorOptionsInst.ui \ EditorOptionsInst.ui \
EditorOptionsPath.ui \ EditorOptionsPath.ui \
EditorOptionsText.ui \ EditorOptionsText.ui \
InstantiationForm.ui \ InstantiationForm.ui \
InstPropertiesPage.ui \ InstPropertiesPage.ui \
MakeArrayOptionsDialog.ui \ MakeArrayOptionsDialog.ui \
MakeCellOptionsDialog.ui \ MakeCellOptionsDialog.ui \
PathPropertiesPage.ui \ PathPropertiesPage.ui \
PolygonPropertiesPage.ui \ PolygonPropertiesPage.ui \
RoundCornerOptionsDialog.ui \ RoundCornerOptionsDialog.ui \
TextPropertiesPage.ui \ TextPropertiesPage.ui \
DistributeOptionsDialog.ui \ DistributeOptionsDialog.ui \
EditorOptionsInstPCellParam.ui EditorOptionsInstPCellParam.ui
SOURCES = \
edtDialogs.cc \
edtEditorOptionsPages.cc \
edtInstPropertiesPage.cc \
edtPCellParametersPage.cc \
edtPropertiesPages.cc \
edtPropertiesPageUtils.cc \
edtRecentConfigurationPage.cc
}
HEADERS = \
edtConfig.h \
edtMainService.h \
edtPartialService.h \
edtPlugin.h \
edtService.h \
edtServiceImpl.h \
edtUtils.h \
edtCommon.h \
edtDistribute.h \
SOURCES = \ SOURCES = \
edtConfig.cc \ edtConfig.cc \
edtDialogs.cc \
edtEditorOptionsPages.cc \
edtInstPropertiesPage.cc \
edtMainService.cc \ edtMainService.cc \
edtPartialService.cc \ edtPartialService.cc \
edtPCellParametersPage.cc \
edtPlugin.cc \ edtPlugin.cc \
edtPropertiesPages.cc \
edtPropertiesPageUtils.cc \
edtService.cc \ edtService.cc \
edtServiceImpl.cc \ edtServiceImpl.cc \
edtUtils.cc \ edtUtils.cc \
gsiDeclEdt.cc \ gsiDeclEdt.cc \
edtDistribute.cc \ edtDistribute.cc \
edtRecentConfigurationPage.cc
INCLUDEPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$DB_INC INCLUDEPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$DB_INC
DEPENDPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$DB_INC DEPENDPATH += $$TL_INC $$GSI_INC $$LAYBASIC_INC $$DB_INC

View File

@ -289,7 +289,7 @@ EditGridConverter::from_string_picky (const std::string &s, db::DVector &eg)
y = x; y = x;
} }
if (x < 1e-6 || y < 1e-6) { if (x < 1e-6 || y < 1e-6) {
throw tl::Exception (tl::to_string (QObject::tr ("The grid must be larger than zero"))); throw tl::Exception (tl::to_string (tr ("The grid must be larger than zero")));
} }
eg = db::DVector (x, y); eg = db::DVector (x, y);
} }

View File

@ -21,33 +21,37 @@
*/ */
#include <QInputDialog>
#include "dbEdgeProcessor.h" #include "dbEdgeProcessor.h"
#include "dbPolygonTools.h" #include "dbPolygonTools.h"
#include "dbLibrary.h" #include "dbLibrary.h"
#include "dbLibraryManager.h" #include "dbLibraryManager.h"
#include "tlExceptions.h" #include "tlExceptions.h"
#include "layLayoutView.h" #include "layLayoutView.h"
#include "layDialogs.h"
#include "laySelector.h" #include "laySelector.h"
#include "layCellSelectionForm.h"
#include "layFinder.h" #include "layFinder.h"
#include "layLayerProperties.h" #include "layLayerProperties.h"
#include "layLayerTreeModel.h"
#include "tlProgress.h" #include "tlProgress.h"
#include "edtPlugin.h" #include "edtPlugin.h"
#include "edtMainService.h" #include "edtMainService.h"
#include "edtService.h" #include "edtService.h"
#include "edtServiceImpl.h" #include "edtServiceImpl.h"
#include "edtConfig.h" #include "edtConfig.h"
#include "edtDialogs.h"
#include "edtEditorOptionsPages.h"
#include "edtDistribute.h" #include "edtDistribute.h"
#include <QMessageBox> #if defined(HAVE_QT)
#include <QFontInfo> # include "layDialogs.h"
#include <QWidgetAction> # include "layLayerTreeModel.h"
# include "layCellSelectionForm.h"
# include "edtDialogs.h"
# include "edtEditorOptionsPages.h"
#endif
#if defined(HAVE_QT)
# include <QInputDialog>
# include <QMessageBox>
# include <QFontInfo>
# include <QWidgetAction>
#endif
namespace edt namespace edt
{ {
@ -73,15 +77,16 @@ MainService::MainService (db::Manager *manager, lay::LayoutView *view, lay::Disp
m_origin_mode_x (-1), m_origin_mode_y (-1), m_origin_visible_layers_for_bbox (false), m_origin_mode_x (-1), m_origin_mode_y (-1), m_origin_visible_layers_for_bbox (false),
m_array_a (0.0, 1.0), m_array_b (1.0, 0.0), m_array_a (0.0, 1.0), m_array_b (1.0, 0.0),
m_array_na (1), m_array_nb (1), m_array_na (1), m_array_nb (1),
m_router (0.0), m_rinner (0.0), m_npoints (64), m_undo_before_apply (true), m_router (0.0), m_rinner (0.0), m_npoints (64), m_undo_before_apply (true)
mp_round_corners_dialog (0),
mp_align_options_dialog (0),
mp_distribute_options_dialog (0),
mp_flatten_inst_options_dialog (0),
mp_make_cell_options_dialog (0),
mp_make_array_options_dialog (0)
{ {
// .. nothing yet .. #if defined(HAVE_QT)
mp_round_corners_dialog = 0;
mp_align_options_dialog = 0;
mp_distribute_options_dialog = 0;
mp_flatten_inst_options_dialog = 0;
mp_make_cell_options_dialog = 0;
mp_make_array_options_dialog = 0;
#endif
} }
MainService::~MainService () MainService::~MainService ()
@ -89,6 +94,8 @@ MainService::~MainService ()
// .. nothing yet .. // .. nothing yet ..
} }
#if defined(HAVE_QT)
edt::RoundCornerOptionsDialog * edt::RoundCornerOptionsDialog *
MainService::round_corners_dialog () MainService::round_corners_dialog ()
{ {
@ -143,6 +150,8 @@ MainService::make_array_options_dialog ()
return mp_make_array_options_dialog; return mp_make_array_options_dialog;
} }
#endif
void void
MainService::menu_activated (const std::string &symbol) MainService::menu_activated (const std::string &symbol)
{ {
@ -298,10 +307,10 @@ MainService::cm_descend ()
} }
if (! common_inst.anything ()) { if (! common_inst.anything ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Select an object to determine into which instance to descend"))); throw tl::Exception (tl::to_string (tr ("Select an object to determine into which instance to descend")));
} }
if (! common_inst.valid () || common_inst.ambiguous ()) { if (! common_inst.valid () || common_inst.ambiguous ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Selection is ambiguous - cannot determine into which instance to descend"))); throw tl::Exception (tl::to_string (tr ("Selection is ambiguous - cannot determine into which instance to descend")));
} }
// remove the common path and create a new set of selections // remove the common path and create a new set of selections
@ -391,56 +400,58 @@ MainService::cm_flatten_insts ()
tl_assert (view ()->is_editable ()); tl_assert (view ()->is_editable ());
check_no_guiding_shapes (); check_no_guiding_shapes ();
if (flatten_inst_options_dialog ()->exec_dialog (m_flatten_insts_levels, m_flatten_prune) && m_flatten_insts_levels != 0) { #if defined(HAVE_QT)
if (! (flatten_inst_options_dialog ()->exec_dialog (m_flatten_insts_levels, m_flatten_prune) && m_flatten_insts_levels != 0)) {
return
}
#endif
view ()->cancel_edits (); view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Flatten instances"))); manager ()->transaction (tl::to_string (tr ("Flatten instances")));
std::set<db::Layout *> needs_cleanup; std::set<db::Layout *> needs_cleanup;
std::vector<edt::Service *> edt_services = view ()->get_plugins <edt::Service> (); std::vector<edt::Service *> edt_services = view ()->get_plugins <edt::Service> ();
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
for (edt::Service::objects::const_iterator r = (*es)->selection ().begin (); r != (*es)->selection ().end (); ++r) { for (edt::Service::objects::const_iterator r = (*es)->selection ().begin (); r != (*es)->selection ().end (); ++r) {
const lay::CellView &cv = view ()->cellview (r->cv_index ()); const lay::CellView &cv = view ()->cellview (r->cv_index ());
if (cv.is_valid ()) { if (cv.is_valid ()) {
db::Cell &target_cell = cv->layout ().cell (r->cell_index ()); db::Cell &target_cell = cv->layout ().cell (r->cell_index ());
if (r->is_cell_inst () && target_cell.is_valid (r->back ().inst_ptr)) { if (r->is_cell_inst () && target_cell.is_valid (r->back ().inst_ptr)) {
// because we select whole arrays in editable mode, we can iterator over them
db::CellInstArray cell_inst = r->back ().inst_ptr.cell_inst ();
for (db::CellInstArray::iterator a = cell_inst.begin (); ! a.at_end (); ++a) {
cv->layout ().flatten (cv->layout ().cell (r->cell_index_tot ()), target_cell, cell_inst.complex_trans (*a), m_flatten_insts_levels < 0 ? m_flatten_insts_levels : m_flatten_insts_levels - 1);
}
if (cv->layout ().cell (r->back ().inst_ptr.cell_index ()).is_proxy ()) {
needs_cleanup.insert (& cv->layout ());
}
target_cell.erase (r->back ().inst_ptr);
// because we select whole arrays in editable mode, we can iterator over them
db::CellInstArray cell_inst = r->back ().inst_ptr.cell_inst ();
for (db::CellInstArray::iterator a = cell_inst.begin (); ! a.at_end (); ++a) {
cv->layout ().flatten (cv->layout ().cell (r->cell_index_tot ()), target_cell, cell_inst.complex_trans (*a), m_flatten_insts_levels < 0 ? m_flatten_insts_levels : m_flatten_insts_levels - 1);
} }
if (cv->layout ().cell (r->back ().inst_ptr.cell_index ()).is_proxy ()) {
needs_cleanup.insert (& cv->layout ());
}
target_cell.erase (r->back ().inst_ptr);
} }
} }
} }
// clean up the layouts that need to do so.
for (std::set<db::Layout *>::const_iterator l = needs_cleanup.begin (); l != needs_cleanup.end (); ++l) {
(*l)->cleanup ();
}
// The selection is no longer valid
view ()->clear_selection ();
manager ()->commit ();
} }
// clean up the layouts that need to do so.
for (std::set<db::Layout *>::const_iterator l = needs_cleanup.begin (); l != needs_cleanup.end (); ++l) {
(*l)->cleanup ();
}
// The selection is no longer valid
view ()->clear_selection ();
manager ()->commit ();
} }
void void
@ -449,7 +460,7 @@ MainService::cm_move_hier_up ()
view ()->cancel_edits (); view ()->cancel_edits ();
check_no_guiding_shapes (); check_no_guiding_shapes ();
manager ()->transaction (tl::to_string (QObject::tr ("Move up in hierarchy"))); manager ()->transaction (tl::to_string (tr ("Move up in hierarchy")));
std::vector<edt::Service *> edt_services = view ()->get_plugins <edt::Service> (); std::vector<edt::Service *> edt_services = view ()->get_plugins <edt::Service> ();
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
@ -691,7 +702,7 @@ MainService::cm_make_cell_variants ()
if (cv_index < 0) { if (cv_index < 0) {
cv_index = r->cv_index (); cv_index = r->cv_index ();
} else if (cv_index != int (r->cv_index ())) { } else if (cv_index != int (r->cv_index ())) {
throw tl::Exception (tl::to_string (QObject::tr ("The selection must not contain objects from different layouts for 'make cell variants'"))); throw tl::Exception (tl::to_string (tr ("The selection must not contain objects from different layouts for 'make cell variants'")));
} }
} }
} }
@ -705,7 +716,7 @@ MainService::cm_make_cell_variants ()
view ()->cancel_edits (); view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Make cell variants for selection"))); manager ()->transaction (tl::to_string (tr ("Make cell variants for selection")));
std::vector<lay::ObjectInstPath> new_selection; std::vector<lay::ObjectInstPath> new_selection;
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
@ -716,7 +727,7 @@ MainService::cm_make_cell_variants ()
// TODO: the algorithm is basically O(2) in the number of selected items. A first // TODO: the algorithm is basically O(2) in the number of selected items. A first
// step to mitigate that problem is to provide a progress and hence a way to cancel it. // step to mitigate that problem is to provide a progress and hence a way to cancel it.
tl::RelativeProgress progress (tl::to_string (QObject::tr ("Make cell variants for selection")), num_sel, 1); tl::RelativeProgress progress (tl::to_string (tr ("Make cell variants for selection")), num_sel, 1);
for (size_t nsel = 0; nsel < num_sel; ++nsel) { for (size_t nsel = 0; nsel < num_sel; ++nsel) {
@ -901,7 +912,7 @@ MainService::cm_resolve_arefs ()
cv_index = r->cv_index (); cv_index = r->cv_index ();
} else if (cv_index != int (r->cv_index ())) { } else if (cv_index != int (r->cv_index ())) {
// TODO: this limitation is not really necessary, but makes the code somewhat simpler // TODO: this limitation is not really necessary, but makes the code somewhat simpler
throw tl::Exception (tl::to_string (QObject::tr ("The selection must not contain objects from different layouts for 'resolve array references'"))); throw tl::Exception (tl::to_string (tr ("The selection must not contain objects from different layouts for 'resolve array references'")));
} }
insts_to_resolve.push_back (*r); insts_to_resolve.push_back (*r);
} }
@ -917,7 +928,7 @@ MainService::cm_resolve_arefs ()
std::vector<lay::ObjectInstPath> new_selection; std::vector<lay::ObjectInstPath> new_selection;
manager ()->transaction (tl::to_string (QObject::tr ("Resolve array references"))); manager ()->transaction (tl::to_string (tr ("Resolve array references")));
for (std::vector<lay::ObjectInstPath>::const_iterator p = insts_to_resolve.begin (); p != insts_to_resolve.end (); ++p) { for (std::vector<lay::ObjectInstPath>::const_iterator p = insts_to_resolve.begin (); p != insts_to_resolve.end (); ++p) {
@ -972,7 +983,7 @@ MainService::cm_make_cell ()
if (cv_index < 0) { if (cv_index < 0) {
cv_index = r->cv_index (); cv_index = r->cv_index ();
} else if (cv_index != int (r->cv_index ())) { } else if (cv_index != int (r->cv_index ())) {
throw tl::Exception (tl::to_string (QObject::tr ("The selection must not contain objects from different layouts for 'make cell'"))); throw tl::Exception (tl::to_string (tr ("The selection must not contain objects from different layouts for 'make cell'")));
} }
} }
} }
@ -981,80 +992,82 @@ MainService::cm_make_cell ()
const lay::CellView &cv = view ()->cellview (cv_index); const lay::CellView &cv = view ()->cellview (cv_index);
if (make_cell_options_dialog ()->exec_dialog (cv->layout (), m_make_cell_name, m_origin_mode_x, m_origin_mode_y)) { #if defined(HAVE_QT)
if (! make_cell_options_dialog ()->exec_dialog (cv->layout (), m_make_cell_name, m_origin_mode_x, m_origin_mode_y)) {
return;
}
#endif
// Compute the selection's bbox to establish a good origin for the new cell // Compute the selection's bbox to establish a good origin for the new cell
db::Box selection_bbox; db::Box selection_bbox;
db::box_convert<db::CellInst> bc (cv->layout ()); db::box_convert<db::CellInst> bc (cv->layout ());
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
for (edt::Service::objects::const_iterator r = (*es)->selection ().begin (); r != (*es)->selection ().end (); ++r) { for (edt::Service::objects::const_iterator r = (*es)->selection ().begin (); r != (*es)->selection ().end (); ++r) {
if (r->is_cell_inst ()) { if (r->is_cell_inst ()) {
selection_bbox += db::ICplxTrans (r->trans ()) * r->back ().bbox (bc); selection_bbox += db::ICplxTrans (r->trans ()) * r->back ().bbox (bc);
} else { } else {
selection_bbox += db::ICplxTrans (r->trans ()) * r->shape ().bbox (); selection_bbox += db::ICplxTrans (r->trans ()) * r->shape ().bbox ();
}
} }
} }
}
if (selection_bbox.empty ()) { if (selection_bbox.empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("The selection is empty. Cannot create a cell from an empty selection."))); throw tl::Exception (tl::to_string (tr ("The selection is empty. Cannot create a cell from an empty selection.")));
} }
view ()->cancel_edits (); view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Make cell from selection"))); manager ()->transaction (tl::to_string (tr ("Make cell from selection")));
db::cell_index_type target_ci = cv->layout ().add_cell (m_make_cell_name.c_str ()); db::cell_index_type target_ci = cv->layout ().add_cell (m_make_cell_name.c_str ());
// create target cell // create target cell
db::Cell &target_cell = cv->layout ().cell (target_ci); db::Cell &target_cell = cv->layout ().cell (target_ci);
// create target cell instance // create target cell instance
db::Vector ref; db::Vector ref;
if (m_origin_mode_x >= -1) { if (m_origin_mode_x >= -1) {
ref = db::Vector (selection_bbox.left () + ((m_origin_mode_x + 1) * selection_bbox.width ()) / 2, selection_bbox.bottom () + ((m_origin_mode_y + 1) * selection_bbox.height ()) / 2); ref = db::Vector (selection_bbox.left () + ((m_origin_mode_x + 1) * selection_bbox.width ()) / 2, selection_bbox.bottom () + ((m_origin_mode_y + 1) * selection_bbox.height ()) / 2);
} }
db::Instance target_cell_inst = cv.cell ()->insert (db::CellInstArray (db::CellInst (target_ci), db::Trans (ref))); db::Instance target_cell_inst = cv.cell ()->insert (db::CellInstArray (db::CellInst (target_ci), db::Trans (ref)));
db::ICplxTrans to = db::ICplxTrans (db::Trans (-ref)); db::ICplxTrans to = db::ICplxTrans (db::Trans (-ref));
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
for (edt::Service::objects::const_iterator r = (*es)->selection ().begin (); r != (*es)->selection ().end (); ++r) { for (edt::Service::objects::const_iterator r = (*es)->selection ().begin (); r != (*es)->selection ().end (); ++r) {
if (r->is_cell_inst ()) { if (r->is_cell_inst ()) {
db::Instance new_inst = target_cell.insert (r->back ().inst_ptr); db::Instance new_inst = target_cell.insert (r->back ().inst_ptr);
target_cell.transform (new_inst, to * db::ICplxTrans (r->trans ())); target_cell.transform (new_inst, to * db::ICplxTrans (r->trans ()));
} else { } else {
db::Shapes &target_shapes = target_cell.shapes (r->layer ()); db::Shapes &target_shapes = target_cell.shapes (r->layer ());
db::Shape new_shape = target_shapes.insert (r->shape ()); db::Shape new_shape = target_shapes.insert (r->shape ());
target_shapes.transform (new_shape, to * db::ICplxTrans (r->trans ())); target_shapes.transform (new_shape, to * db::ICplxTrans (r->trans ()));
}
} }
// delete all the objects currently selected and set the new selection
(*es)->del_selected ();
// establish the new instance as selection for the instance service
std::vector<lay::ObjectInstPath> new_selection;
if ((*es)->flags () == db::ShapeIterator::Nothing) {
new_selection.push_back (lay::ObjectInstPath ());
new_selection.back ().set_topcell (cv.cell_index ());
new_selection.back ().set_cv_index (cv_index);
new_selection.back ().add_path (db::InstElement (target_cell_inst));
}
(*es)->set_selection (new_selection.begin (), new_selection.end ());
} }
manager ()->commit (); // delete all the objects currently selected and set the new selection
(*es)->del_selected ();
// establish the new instance as selection for the instance service
std::vector<lay::ObjectInstPath> new_selection;
if ((*es)->flags () == db::ShapeIterator::Nothing) {
new_selection.push_back (lay::ObjectInstPath ());
new_selection.back ().set_topcell (cv.cell_index ());
new_selection.back ().set_cv_index (cv_index);
new_selection.back ().add_path (db::InstElement (target_cell_inst));
}
(*es)->set_selection (new_selection.begin (), new_selection.end ());
} }
manager ()->commit ();
} }
} }
@ -1069,7 +1082,7 @@ MainService::cm_convert_to_cell ()
try { try {
manager ()->transaction (tl::to_string (QObject::tr ("Convert to static cell"))); manager ()->transaction (tl::to_string (tr ("Convert to static cell")));
std::vector<edt::Service *> edt_services = view ()->get_plugins <edt::Service> (); std::vector<edt::Service *> edt_services = view ()->get_plugins <edt::Service> ();
@ -1110,7 +1123,7 @@ MainService::cm_convert_to_cell ()
} }
if (needs_cleanup.empty ()) { if (needs_cleanup.empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("No instance of a PCell or library cell selected - nothing to convert"))); throw tl::Exception (tl::to_string (tr ("No instance of a PCell or library cell selected - nothing to convert")));
} }
// clean up the layouts that need to do so. // clean up the layouts that need to do so.
@ -1132,6 +1145,7 @@ MainService::cm_convert_to_cell ()
void void
MainService::cm_convert_to_pcell () MainService::cm_convert_to_pcell ()
{ {
#if defined(HAVE_QT) // @@@
tl_assert (view ()->is_editable ()); tl_assert (view ()->is_editable ());
check_no_guiding_shapes (); check_no_guiding_shapes ();
@ -1143,7 +1157,7 @@ MainService::cm_convert_to_pcell ()
num_selected += (*es)->selection ().size (); num_selected += (*es)->selection ().size ();
for (edt::Service::obj_iterator s = (*es)->selection ().begin (); s != (*es)->selection ().end (); ++s) { for (edt::Service::obj_iterator s = (*es)->selection ().begin (); s != (*es)->selection ().end (); ++s) {
if (s->is_cell_inst ()) { if (s->is_cell_inst ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Selection contains instances - they cannot be converted to PCells."))); throw tl::Exception (tl::to_string (tr ("Selection contains instances - they cannot be converted to PCells.")));
} }
} }
} }
@ -1189,8 +1203,8 @@ MainService::cm_convert_to_pcell ()
bool ok = false; bool ok = false;
QString item = QInputDialog::getItem (view ()->widget (), QString item = QInputDialog::getItem (view ()->widget (),
QObject::tr ("Select Target PCell"), tr ("Select Target PCell"),
QObject::tr ("Select the PCell the shape should be converted into"), tr ("Select the PCell the shape should be converted into"),
items, 0, false, &ok); items, 0, false, &ok);
if (! ok) { if (! ok) {
return; return;
@ -1210,7 +1224,7 @@ MainService::cm_convert_to_pcell ()
try { try {
manager ()->transaction (tl::to_string (QObject::tr ("Convert to PCell"))); manager ()->transaction (tl::to_string (tr ("Convert to PCell")));
std::vector<edt::Service::obj_iterator> to_delete; std::vector<edt::Service::obj_iterator> to_delete;
std::vector<lay::ObjectInstPath> new_selection; std::vector<lay::ObjectInstPath> new_selection;
@ -1219,7 +1233,7 @@ MainService::cm_convert_to_pcell ()
bool any_converted = false; bool any_converted = false;
{ {
tl::RelativeProgress progress (tl::to_string (QObject::tr ("Convert to PCell")), num_selected, 1000); tl::RelativeProgress progress (tl::to_string (tr ("Convert to PCell")), num_selected, 1000);
// convert the shapes which can be converted // convert the shapes which can be converted
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
@ -1267,7 +1281,7 @@ MainService::cm_convert_to_pcell ()
} }
if (! any_converted) { if (! any_converted) {
throw tl::Exception (tl::to_string (QObject::tr ("None of the shapes could be converted to the desired PCell"))); throw tl::Exception (tl::to_string (tr ("None of the shapes could be converted to the desired PCell")));
} }
// Delete the shapes which have been converted // Delete the shapes which have been converted
@ -1290,7 +1304,7 @@ MainService::cm_convert_to_pcell ()
} }
if (any_non_converted) { if (any_non_converted) {
QMessageBox::warning (view ()->widget (), QObject::tr ("Warning"), QObject::tr ("Some of the shapes could not be converted to the desired PCell")); QMessageBox::warning (view ()->widget (), tr ("Warning"), tr ("Some of the shapes could not be converted to the desired PCell"));
} }
manager ()->commit (); manager ()->commit ();
@ -1299,6 +1313,7 @@ MainService::cm_convert_to_pcell ()
manager ()->commit (); manager ()->commit ();
throw; throw;
} }
#endif
} }
static bool extract_rad (std::vector <db::Polygon> &poly, double &rinner, double &router, unsigned int &n) static bool extract_rad (std::vector <db::Polygon> &poly, double &rinner, double &router, unsigned int &n)
@ -1361,12 +1376,12 @@ MainService::cm_round_corners ()
if (! s->is_cell_inst () && (s->shape ().is_polygon () || s->shape ().is_path () || s->shape ().is_box ())) { if (! s->is_cell_inst () && (s->shape ().is_polygon () || s->shape ().is_path () || s->shape ().is_box ())) {
if (cv_index >= 0 && cv_index != int (s->cv_index ())) { if (cv_index >= 0 && cv_index != int (s->cv_index ())) {
throw tl::Exception (tl::to_string (QObject::tr ("Selection originates from different layouts - cannot compute result in this case."))); throw tl::Exception (tl::to_string (tr ("Selection originates from different layouts - cannot compute result in this case.")));
} }
cv_index = int (s->cv_index ()); cv_index = int (s->cv_index ());
if (layer_index >= 0 && layer_index != int (s->layer ())) { if (layer_index >= 0 && layer_index != int (s->layer ())) {
throw tl::Exception (tl::to_string (QObject::tr ("Selection originates from different layers - cannot compute result in this case."))); throw tl::Exception (tl::to_string (tr ("Selection originates from different layers - cannot compute result in this case.")));
} }
layer_index = int (s->layer ()); layer_index = int (s->layer ());
@ -1380,7 +1395,7 @@ MainService::cm_round_corners ()
} }
if (cv_index < 0 || layer_index < 0) { if (cv_index < 0 || layer_index < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("Selection does not contain polygons"))); throw tl::Exception (tl::to_string (tr ("Selection does not contain polygons")));
} }
// prepare: merge to remove cutlines and smooth to remove effects of cutlines // prepare: merge to remove cutlines and smooth to remove effects of cutlines
@ -1403,9 +1418,11 @@ MainService::cm_round_corners ()
rinner *= dbu; rinner *= dbu;
router *= dbu; router *= dbu;
#if defined(HAVE_QT)
if (! round_corners_dialog ()->exec_dialog (cv->layout (), m_router, m_rinner, m_npoints, m_undo_before_apply, router, rinner, n, has_extracted)) { if (! round_corners_dialog ()->exec_dialog (cv->layout (), m_router, m_rinner, m_npoints, m_undo_before_apply, router, rinner, n, has_extracted)) {
return; return;
} }
#endif
if (! m_undo_before_apply || ! has_extracted) { if (! m_undo_before_apply || ! has_extracted) {
out.swap (in); out.swap (in);
@ -1420,7 +1437,7 @@ MainService::cm_round_corners ()
ep.merge (out, primary, 0 /*min_wc*/, true /*resolve holes*/, true /*min coherence*/); ep.merge (out, primary, 0 /*min_wc*/, true /*resolve holes*/, true /*min coherence*/);
view ()->cancel_edits (); view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Corner rounding operation on selection"))); manager ()->transaction (tl::to_string (tr ("Corner rounding operation on selection")));
// Delete the current selection // Delete the current selection
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
@ -1466,6 +1483,7 @@ MainService::cm_round_corners ()
void void
MainService::cm_size () MainService::cm_size ()
{ {
#if defined(HAVE_QT) // @@@
tl_assert (view ()->is_editable ()); tl_assert (view ()->is_editable ());
check_no_guiding_shapes (); check_no_guiding_shapes ();
@ -1483,12 +1501,12 @@ MainService::cm_size ()
if (! s->is_cell_inst () && (s->shape ().is_polygon () || s->shape ().is_path () || s->shape ().is_box ())) { if (! s->is_cell_inst () && (s->shape ().is_polygon () || s->shape ().is_path () || s->shape ().is_box ())) {
if (cv_index >= 0 && cv_index != int (s->cv_index ())) { if (cv_index >= 0 && cv_index != int (s->cv_index ())) {
throw tl::Exception (tl::to_string (QObject::tr ("Selection originates from different layouts - cannot compute result in this case."))); throw tl::Exception (tl::to_string (tr ("Selection originates from different layouts - cannot compute result in this case.")));
} }
cv_index = int (s->cv_index ()); cv_index = int (s->cv_index ());
if (layer_index >= 0 && layer_index != int (s->layer ())) { if (layer_index >= 0 && layer_index != int (s->layer ())) {
throw tl::Exception (tl::to_string (QObject::tr ("Selection originates from different layers - cannot compute result in this case."))); throw tl::Exception (tl::to_string (tr ("Selection originates from different layers - cannot compute result in this case.")));
} }
layer_index = int (s->layer ()); layer_index = int (s->layer ());
@ -1502,13 +1520,13 @@ MainService::cm_size ()
} }
if (cv_index < 0 || layer_index < 0) { if (cv_index < 0 || layer_index < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("Selection does not contain polygons"))); throw tl::Exception (tl::to_string (tr ("Selection does not contain polygons")));
} }
bool ok = false; bool ok = false;
QString s = QInputDialog::getText (view ()->widget (), QString s = QInputDialog::getText (view ()->widget (),
QObject::tr ("Sizing"), tr ("Sizing"),
QObject::tr ("Sizing (in micron, positive or negative). Two values (dx, dy) for anisotropic sizing."), tr ("Sizing (in micron, positive or negative). Two values (dx, dy) for anisotropic sizing."),
QLineEdit::Normal, QString::fromUtf8 ("0.0"), QLineEdit::Normal, QString::fromUtf8 ("0.0"),
&ok); &ok);
@ -1536,7 +1554,7 @@ MainService::cm_size ()
ep.size (primary, idx, idy, out, 2 /*mode, TODO: make variable*/, true /*resolve holes*/, true /*min coherence*/); ep.size (primary, idx, idy, out, 2 /*mode, TODO: make variable*/, true /*resolve holes*/, true /*min coherence*/);
view ()->cancel_edits (); view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Sizing operation on selection"))); manager ()->transaction (tl::to_string (tr ("Sizing operation on selection")));
// Delete the current selection // Delete the current selection
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
@ -1577,6 +1595,7 @@ MainService::cm_size ()
} }
manager ()->commit (); manager ()->commit ();
#endif
} }
void void
@ -1599,12 +1618,12 @@ MainService::boolean_op (int mode)
if (s->seq () == 0 && ! s->is_cell_inst () && (s->shape ().is_polygon () || s->shape ().is_path () || s->shape ().is_box ())) { if (s->seq () == 0 && ! s->is_cell_inst () && (s->shape ().is_polygon () || s->shape ().is_path () || s->shape ().is_box ())) {
if (cv_index >= 0 && cv_index != int (s->cv_index ())) { if (cv_index >= 0 && cv_index != int (s->cv_index ())) {
throw tl::Exception (tl::to_string (QObject::tr ("Primary selection originates from different layouts - cannot compute result in this case."))); throw tl::Exception (tl::to_string (tr ("Primary selection originates from different layouts - cannot compute result in this case.")));
} }
cv_index = int (s->cv_index ()); cv_index = int (s->cv_index ());
if (layer_index >= 0 && layer_index != int (s->layer ())) { if (layer_index >= 0 && layer_index != int (s->layer ())) {
throw tl::Exception (tl::to_string (QObject::tr ("Primary selection originates from different layers - cannot compute result in this case."))); throw tl::Exception (tl::to_string (tr ("Primary selection originates from different layers - cannot compute result in this case.")));
} }
layer_index = int (s->layer ()); layer_index = int (s->layer ());
@ -1618,7 +1637,7 @@ MainService::boolean_op (int mode)
} }
if (cv_index < 0 || layer_index < 0) { if (cv_index < 0 || layer_index < 0) {
throw tl::Exception (tl::to_string (QObject::tr ("Primary selection does not contain polygons"))); throw tl::Exception (tl::to_string (tr ("Primary selection does not contain polygons")));
} }
std::vector<db::Polygon> secondary; std::vector<db::Polygon> secondary;
@ -1656,7 +1675,7 @@ MainService::boolean_op (int mode)
} }
view ()->cancel_edits (); view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Boolean operation on selection"))); manager ()->transaction (tl::to_string (tr ("Boolean operation on selection")));
// Delete the current selection // Delete the current selection
// NOTE: we delete only those shapes from the primary layer and keep shapes from other layers. // NOTE: we delete only those shapes from the primary layer and keep shapes from other layers.
@ -1780,9 +1799,11 @@ MainService::cm_align ()
std::vector<edt::Service *> edt_services = view ()->get_plugins <edt::Service> (); std::vector<edt::Service *> edt_services = view ()->get_plugins <edt::Service> ();
#if defined(HAVE_QT)
if (! align_options_dialog ()->exec_dialog (m_align_hmode, m_align_vmode, m_align_visible_layers)) { if (! align_options_dialog ()->exec_dialog (m_align_hmode, m_align_vmode, m_align_visible_layers)) {
return; return;
} }
#endif
db::DBox prim_box; db::DBox prim_box;
bool has_secondary = false; bool has_secondary = false;
@ -1812,7 +1833,7 @@ MainService::cm_align ()
if (! prim_box.empty ()) { if (! prim_box.empty ()) {
view ()->cancel_edits (); view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Alignment"))); manager ()->transaction (tl::to_string (tr ("Alignment")));
// do the alignment // do the alignment
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
@ -1866,11 +1887,13 @@ MainService::cm_distribute ()
std::vector<edt::Service *> edt_services = view ()->get_plugins <edt::Service> (); std::vector<edt::Service *> edt_services = view ()->get_plugins <edt::Service> ();
#if defined(HAVE_QT)
if (! distribute_options_dialog ()->exec_dialog (m_hdistribute, m_distribute_hmode, m_distribute_hpitch, m_distribute_hspace, if (! distribute_options_dialog ()->exec_dialog (m_hdistribute, m_distribute_hmode, m_distribute_hpitch, m_distribute_hspace,
m_vdistribute, m_distribute_vmode, m_distribute_vpitch, m_distribute_vspace, m_vdistribute, m_distribute_vmode, m_distribute_vpitch, m_distribute_vspace,
m_distribute_visible_layers)) { m_distribute_visible_layers)) {
return; return;
} }
#endif
if (! m_hdistribute && ! m_vdistribute) { if (! m_hdistribute && ! m_vdistribute) {
return; return;
@ -1946,7 +1969,7 @@ MainService::cm_distribute ()
{ {
view ()->cancel_edits (); view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Distribution"))); manager ()->transaction (tl::to_string (tr ("Distribution")));
// do the distribution // do the distribution
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
@ -1981,97 +2004,100 @@ MainService::cm_make_array ()
} }
if (n == 0) { if (n == 0) {
throw tl::Exception (tl::to_string (QObject::tr ("Nothing selected to make arrays of"))); throw tl::Exception (tl::to_string (tr ("Nothing selected to make arrays of")));
} }
if (make_array_options_dialog ()->exec_dialog (m_array_a, m_array_na, m_array_b, m_array_nb)) { #if defined(HAVE_QT)
if (! make_array_options_dialog ()->exec_dialog (m_array_a, m_array_na, m_array_b, m_array_nb)) {
return;
}
#endif
view ()->cancel_edits (); view ()->cancel_edits ();
// undo support for small arrays only // undo support for small arrays only
bool has_undo = (m_array_na * m_array_nb < 1000); bool has_undo = (m_array_na * m_array_nb < 1000);
// No undo support currently - the undo buffering is pretty inefficient right now. // No undo support currently - the undo buffering is pretty inefficient right now.
if (! has_undo) { if (! has_undo) {
manager ()->clear (); manager ()->clear ();
} else { } else {
manager ()->transaction (tl::to_string (QObject::tr ("Make array"))); manager ()->transaction (tl::to_string (tr ("Make array")));
} }
tl::RelativeProgress progress (tl::to_string (QObject::tr ("Make array")), (size_t (m_array_na) * size_t (m_array_nb) - 1) * n, 1000); tl::RelativeProgress progress (tl::to_string (tr ("Make array")), (size_t (m_array_na) * size_t (m_array_nb) - 1) * n, 1000);
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) { for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
for (edt::Service::obj_iterator s = (*es)->selection ().begin (); s != (*es)->selection ().end (); ++s) { for (edt::Service::obj_iterator s = (*es)->selection ().begin (); s != (*es)->selection ().end (); ++s) {
const lay::CellView &cv = view ()->cellview (s->cv_index ());
if (! cv.is_valid ()) {
continue;
}
db::Cell &target_cell = cv->layout ().cell (s->cell_index ());
if (s->is_cell_inst ()) {
for (unsigned int ia = 0; ia < m_array_na; ++ia) {
for (unsigned int ib = 0; ib < m_array_nb; ++ib) {
// don't create a copy
if (ia == 0 && ib == 0) {
continue;
}
db::DCplxTrans dtrans (m_array_a * double (ia) + m_array_b * double (ib));
db::ICplxTrans itrans (db::DCplxTrans (s->trans ()).inverted () * db::DCplxTrans (1.0 / cv->layout ().dbu ()) * dtrans * db::DCplxTrans (cv->layout ().dbu ()) * db::DCplxTrans (s->trans ()));
db::Instance new_inst = target_cell.insert (s->back ().inst_ptr);
target_cell.transform (new_inst, itrans);
++progress;
}
const lay::CellView &cv = view ()->cellview (s->cv_index ());
if (! cv.is_valid ()) {
continue;
} }
db::Cell &target_cell = cv->layout ().cell (s->cell_index ()); } else {
if (s->is_cell_inst ()) { db::Shapes &target_shapes = target_cell.shapes (s->layer ());
for (unsigned int ia = 0; ia < m_array_na; ++ia) { for (unsigned int ia = 0; ia < m_array_na; ++ia) {
for (unsigned int ib = 0; ib < m_array_nb; ++ib) { for (unsigned int ib = 0; ib < m_array_nb; ++ib) {
// don't create a copy
if (ia == 0 && ib == 0) {
continue;
}
db::DCplxTrans dtrans (m_array_a * double (ia) + m_array_b * double (ib));
db::ICplxTrans itrans (db::DCplxTrans (s->trans ()).inverted () * db::DCplxTrans (1.0 / cv->layout ().dbu ()) * dtrans * db::DCplxTrans (cv->layout ().dbu ()) * db::DCplxTrans (s->trans ()));
db::Instance new_inst = target_cell.insert (s->back ().inst_ptr);
target_cell.transform (new_inst, itrans);
++progress;
// don't create a copy
if (ia == 0 && ib == 0) {
continue;
} }
db::DCplxTrans dtrans (m_array_a * double (ia) + m_array_b * double (ib));
db::ICplxTrans itrans (db::DCplxTrans (s->trans ()).inverted () * db::DCplxTrans (1.0 / cv->layout ().dbu ()) * dtrans * db::DCplxTrans (cv->layout ().dbu ()) * db::DCplxTrans (s->trans ()));
db::Shape new_shape = target_shapes.insert (s->shape ());
target_shapes.transform (new_shape, itrans);
++progress;
} }
} else {
db::Shapes &target_shapes = target_cell.shapes (s->layer ());
for (unsigned int ia = 0; ia < m_array_na; ++ia) {
for (unsigned int ib = 0; ib < m_array_nb; ++ib) {
// don't create a copy
if (ia == 0 && ib == 0) {
continue;
}
db::DCplxTrans dtrans (m_array_a * double (ia) + m_array_b * double (ib));
db::ICplxTrans itrans (db::DCplxTrans (s->trans ()).inverted () * db::DCplxTrans (1.0 / cv->layout ().dbu ()) * dtrans * db::DCplxTrans (cv->layout ().dbu ()) * db::DCplxTrans (s->trans ()));
db::Shape new_shape = target_shapes.insert (s->shape ());
target_shapes.transform (new_shape, itrans);
++progress;
}
}
} }
} }
} }
if (has_undo) { }
manager ()->commit ();
}
if (has_undo) {
manager ()->commit ();
} }
} }
void void
MainService::cm_tap () MainService::cm_tap ()
{ {
#if defined(HAVE_QT) // @@@
if (! view ()->view_object_widget ()->mouse_in_window ()) { if (! view ()->view_object_widget ()->mouse_in_window ()) {
return; return;
} }
@ -2134,6 +2160,7 @@ MainService::cm_tap ()
} }
} }
#endif
} }
void void
@ -2147,7 +2174,7 @@ MainService::cm_change_layer ()
// get (common) cellview index of the selected shapes // get (common) cellview index of the selected shapes
for (SelectionIterator s (view ()); ! s.at_end (); ++s) { for (SelectionIterator s (view ()); ! s.at_end (); ++s) {
if (cv_index >= 0 && cv_index != int (s->cv_index ())) { if (cv_index >= 0 && cv_index != int (s->cv_index ())) {
throw tl::Exception (tl::to_string (QObject::tr ("Selections originate from different layouts - cannot switch layer in this case."))); throw tl::Exception (tl::to_string (tr ("Selections originate from different layouts - cannot switch layer in this case.")));
} }
cv_index = int (s->cv_index ()); cv_index = int (s->cv_index ());
} }
@ -2159,24 +2186,24 @@ MainService::cm_change_layer ()
lay::LayerPropertiesConstIterator cl = view ()->current_layer (); lay::LayerPropertiesConstIterator cl = view ()->current_layer ();
if (cl.is_null ()) { if (cl.is_null ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Please select a layer first")).c_str ()); throw tl::Exception (tl::to_string (tr ("Please select a layer first")).c_str ());
} }
if (cv_index != cl->cellview_index ()) { if (cv_index != cl->cellview_index ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Shapes cannot be moved to a different layout")).c_str ()); throw tl::Exception (tl::to_string (tr ("Shapes cannot be moved to a different layout")).c_str ());
} }
const lay::CellView &cv = view ()->cellview (cv_index); const lay::CellView &cv = view ()->cellview (cv_index);
int layer = cl->layer_index (); int layer = cl->layer_index ();
if (! cv.is_valid ()) { if (! cv.is_valid ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Please select a cell first")).c_str ()); throw tl::Exception (tl::to_string (tr ("Please select a cell first")).c_str ());
} }
if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) { if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) {
if (cl->has_children ()) { if (cl->has_children ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Please select a valid drawing layer first")).c_str ()); throw tl::Exception (tl::to_string (tr ("Please select a valid drawing layer first")).c_str ());
} else { } else {
// create this layer now // create this layer now
@ -2205,7 +2232,7 @@ MainService::cm_change_layer ()
view ()->cancel_edits (); view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Change layer"))); manager ()->transaction (tl::to_string (tr ("Change layer")));
db::Layout &layout = view ()->cellview (cv_index)->layout (); db::Layout &layout = view ()->cellview (cv_index)->layout ();
@ -2266,7 +2293,7 @@ MainService::cm_change_layer ()
manager ()->commit (); manager ()->commit ();
} else { } else {
throw tl::Exception (tl::to_string (QObject::tr ("Nothing selected to switch layers for"))); throw tl::Exception (tl::to_string (tr ("Nothing selected to switch layers for")));
} }
} }
@ -2279,7 +2306,7 @@ MainService::check_no_guiding_shapes ()
for (edt::Service::obj_iterator s = (*es)->selection ().begin (); s != (*es)->selection ().end (); ++s) { for (edt::Service::obj_iterator s = (*es)->selection ().begin (); s != (*es)->selection ().end (); ++s) {
if (! s->is_cell_inst ()) { if (! s->is_cell_inst ()) {
if (s->layer () == view ()->cellview (s->cv_index ())->layout ().guiding_shape_layer ()) { if (s->layer () == view ()->cellview (s->cv_index ())->layout ().guiding_shape_layer ()) {
throw tl::Exception (tl::to_string (QObject::tr ("This function cannot be applied to PCell guiding shapes"))); throw tl::Exception (tl::to_string (tr ("This function cannot be applied to PCell guiding shapes")));
} }
} }
} }
@ -2376,7 +2403,7 @@ MainService::paste ()
if (value) { if (value) {
if (! cv.is_valid ()) { if (! cv.is_valid ()) {
throw tl::Exception (tl::to_string (QObject::tr ("No cell selected to paste something into"))); throw tl::Exception (tl::to_string (tr ("No cell selected to paste something into")));
} }
std::vector<unsigned int> nl = value->get ().insert (cv->layout (), cv.context_trans ().inverted (), &cv->layout ().cell (cv.cell_index ()), 0 /*new_tops*/, &insert_notification); std::vector<unsigned int> nl = value->get ().insert (cv->layout (), cv.context_trans ().inverted (), &cv->layout ().cell (cv.cell_index ()), 0 /*new_tops*/, &insert_notification);

View File

@ -221,21 +221,25 @@ private:
double m_router, m_rinner; double m_router, m_rinner;
unsigned int m_npoints; unsigned int m_npoints;
bool m_undo_before_apply; bool m_undo_before_apply;
#if defined(HAVE_QT)
edt::RoundCornerOptionsDialog *mp_round_corners_dialog; edt::RoundCornerOptionsDialog *mp_round_corners_dialog;
edt::AlignOptionsDialog *mp_align_options_dialog; edt::AlignOptionsDialog *mp_align_options_dialog;
edt::DistributeOptionsDialog *mp_distribute_options_dialog; edt::DistributeOptionsDialog *mp_distribute_options_dialog;
lay::FlattenInstOptionsDialog *mp_flatten_inst_options_dialog; lay::FlattenInstOptionsDialog *mp_flatten_inst_options_dialog;
edt::MakeCellOptionsDialog *mp_make_cell_options_dialog; edt::MakeCellOptionsDialog *mp_make_cell_options_dialog;
edt::MakeArrayOptionsDialog *mp_make_array_options_dialog; edt::MakeArrayOptionsDialog *mp_make_array_options_dialog;
#endif
void boolean_op (int mode); void boolean_op (int mode);
void check_no_guiding_shapes (); void check_no_guiding_shapes ();
#if defined(HAVE_QT)
edt::RoundCornerOptionsDialog *round_corners_dialog (); edt::RoundCornerOptionsDialog *round_corners_dialog ();
edt::AlignOptionsDialog *align_options_dialog (); edt::AlignOptionsDialog *align_options_dialog ();
edt::DistributeOptionsDialog *distribute_options_dialog (); edt::DistributeOptionsDialog *distribute_options_dialog ();
lay::FlattenInstOptionsDialog *flatten_inst_options_dialog (); lay::FlattenInstOptionsDialog *flatten_inst_options_dialog ();
edt::MakeCellOptionsDialog *make_cell_options_dialog (); edt::MakeCellOptionsDialog *make_cell_options_dialog ();
edt::MakeArrayOptionsDialog *make_array_options_dialog (); edt::MakeArrayOptionsDialog *make_array_options_dialog ();
#endif
}; };
} }

View File

@ -21,8 +21,6 @@
*/ */
#include <QMessageBox>
#include "dbVector.h" #include "dbVector.h"
#include "layLayoutView.h" #include "layLayoutView.h"
#include "laySnap.h" #include "laySnap.h"
@ -31,9 +29,12 @@
#include "edtPartialService.h" #include "edtPartialService.h"
#include "edtService.h" #include "edtService.h"
#include "edtConfig.h" #include "edtConfig.h"
#include "edtDialogs.h"
#include "edtPlugin.h" #include "edtPlugin.h"
#include "edtEditorOptionsPages.h"
#if defined(HAVE_QT)
# include "edtDialogs.h"
# include "edtEditorOptionsPages.h"
#endif
#include <cmath> #include <cmath>
@ -1010,8 +1011,10 @@ PartialShapeFinder::visit_cell (const db::Cell &cell, const db::Box &search_box,
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Main Service implementation // Main Service implementation
PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root) PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root) :
: QObject (), #if defined(HAVE_QT)
QObject (),
#endif
lay::EditorServiceBase (view), lay::EditorServiceBase (view),
db::Object (manager), db::Object (manager),
mp_view (view), mp_view (view),
@ -1027,9 +1030,11 @@ PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay
m_hover (false), m_hover (false),
m_hover_wait (false) m_hover_wait (false)
{ {
#if defined(HAVE_QT)
m_timer.setInterval (100 /*hover time*/); m_timer.setInterval (100 /*hover time*/);
m_timer.setSingleShot (true); m_timer.setSingleShot (true);
connect (&m_timer, SIGNAL (timeout ()), this, SLOT (timeout ())); connect (&m_timer, SIGNAL (timeout ()), this, SLOT (timeout ()));
#endif
} }
PartialService::~PartialService () PartialService::~PartialService ()
@ -1077,7 +1082,9 @@ void
PartialService::hover_reset () PartialService::hover_reset ()
{ {
if (m_hover_wait) { if (m_hover_wait) {
#if defined(HAVE_QT)
m_timer.stop (); m_timer.stop ();
#endif
m_hover_wait = false; m_hover_wait = false;
} }
if (m_hover) { if (m_hover) {
@ -1086,7 +1093,9 @@ PartialService::hover_reset ()
} }
} }
void // TODO: should receive timer calls from regular timer update
#if defined(HAVE_QT)
void
PartialService::timeout () PartialService::timeout ()
{ {
m_hover_wait = false; m_hover_wait = false;
@ -1209,6 +1218,7 @@ PartialService::timeout ()
resize_inst_markers (n_inst_marker, true); resize_inst_markers (n_inst_marker, true);
} }
#endif
void void
PartialService::clear_partial_transient_selection () PartialService::clear_partial_transient_selection ()
@ -1571,7 +1581,9 @@ PartialService::mouse_move_event (const db::DPoint &p, unsigned int buttons, boo
} else if (view ()->transient_selection_mode ()) { } else if (view ()->transient_selection_mode ()) {
m_hover_wait = true; m_hover_wait = true;
#if defined(HAVE_QT)
m_timer.start (); m_timer.start ();
#endif
m_hover_point = p; m_hover_point = p;
} }
@ -1622,8 +1634,7 @@ PartialService::mouse_press_event (const db::DPoint &p, unsigned int buttons, bo
try { try {
partial_select (db::DBox (p, p), lay::Editable::Replace); partial_select (db::DBox (p, p), lay::Editable::Replace);
} catch (tl::Exception &ex) { } catch (tl::Exception &ex) {
tl::error << ex.msg (); show_error (ex);
QMessageBox::critical (0, QObject::tr ("Error"), tl::to_qstring (ex.msg ()));
// clear selection // clear selection
partial_select (db::DBox (), lay::Editable::Reset); partial_select (db::DBox (), lay::Editable::Reset);
} }
@ -1703,7 +1714,7 @@ PartialService::mouse_click_event (const db::DPoint &p, unsigned int buttons, bo
// stop dragging // stop dragging
widget ()->ungrab_mouse (this); widget ()->ungrab_mouse (this);
manager ()->transaction (tl::to_string (QObject::tr ("Partial move"))); manager ()->transaction (tl::to_string (tr ("Partial move")));
// heuristically, if there is just one edge selected: do not confine to the movement // heuristically, if there is just one edge selected: do not confine to the movement
// angle constraint - the edge usually is confined enough // angle constraint - the edge usually is confined enough
@ -1862,8 +1873,7 @@ PartialService::mouse_click_event (const db::DPoint &p, unsigned int buttons, bo
selection_to_view (); selection_to_view ();
} catch (tl::Exception &ex) { } catch (tl::Exception &ex) {
tl::error << ex.msg (); show_error (ex);
QMessageBox::critical (0, QObject::tr ("Error"), tl::to_qstring (ex.msg ()));
// clear selection // clear selection
partial_select (db::DBox (), lay::Editable::Reset); partial_select (db::DBox (), lay::Editable::Reset);
} }
@ -1901,7 +1911,7 @@ PartialService::mouse_double_click_event (const db::DPoint &p, unsigned int butt
partial_objects::iterator r = m_selection.begin (); // we assert above that we have at least one selected element partial_objects::iterator r = m_selection.begin (); // we assert above that we have at least one selected element
if (! r->first.is_cell_inst ()) { if (! r->first.is_cell_inst ()) {
manager ()->transaction (tl::to_string (QObject::tr ("Insert point"))); manager ()->transaction (tl::to_string (tr ("Insert point")));
// snap the point // snap the point
db::DPoint new_point_d = snap (p); db::DPoint new_point_d = snap (p);
@ -2018,8 +2028,7 @@ PartialService::mouse_release_event (const db::DPoint &p, unsigned int buttons,
try { try {
partial_select (db::DBox (m_p1, m_p2), mode); partial_select (db::DBox (m_p1, m_p2), mode);
} catch (tl::Exception &ex) { } catch (tl::Exception &ex) {
tl::error << ex.msg (); show_error (ex);
QMessageBox::critical (0, QObject::tr ("Error"), tl::to_qstring (ex.msg ()));
// clear selection // clear selection
partial_select (db::DBox (), lay::Editable::Reset); partial_select (db::DBox (), lay::Editable::Reset);
} }

View File

@ -34,8 +34,10 @@
#include "edtUtils.h" #include "edtUtils.h"
#include "edtConfig.h" #include "edtConfig.h"
#include <QObject> #if defined(HAVE_QT)
#include <QTimer> # include <QObject>
# include <QTimer>
#endif
namespace db { namespace db {
class Manager; class Manager;
@ -136,12 +138,16 @@ struct EdgeWithIndex
/** /**
* @brief The partial selection and manipulation service * @brief The partial selection and manipulation service
*/ */
class PartialService class PartialService :
: public QObject, #if defined(HAVE_QT)
public QObject,
#endif
public lay::EditorServiceBase, public lay::EditorServiceBase,
public db::Object public db::Object
{ {
#if defined(HAVE_QT)
Q_OBJECT Q_OBJECT
#endif
public: public:
typedef std::map<lay::ObjectInstPath, std::set<EdgeWithIndex> > partial_objects; typedef std::map<lay::ObjectInstPath, std::set<EdgeWithIndex> > partial_objects;
@ -289,8 +295,10 @@ public:
*/ */
virtual void edit_cancel (); virtual void edit_cancel ();
#if defined(HAVE_QT)
public slots: public slots:
void timeout (); void timeout ();
#endif
protected: protected:
lay::angle_constraint_type connect_ac () const; lay::angle_constraint_type connect_ac () const;
@ -324,7 +332,9 @@ private:
std::vector<lay::InstanceMarker *> m_inst_markers; std::vector<lay::InstanceMarker *> m_inst_markers;
std::vector<lay::InstanceMarker *> m_transient_inst_markers; std::vector<lay::InstanceMarker *> m_transient_inst_markers;
#if defined(HAVE_QT)
QTimer m_timer; QTimer m_timer;
#endif
bool m_hover; bool m_hover;
bool m_hover_wait; bool m_hover_wait;
db::DPoint m_hover_point; db::DPoint m_hover_point;

View File

@ -21,8 +21,11 @@
*/ */
#include "layTipDialog.h" #if defined(HAVE_QT)
#include "layEditorOptionsPages.h" # include "layTipDialog.h"
# include "layEditorOptionsPages.h"
#endif
#include "layDispatcher.h" #include "layDispatcher.h"
#include "layLayoutView.h" #include "layLayoutView.h"
#include "edtPlugin.h" #include "edtPlugin.h"
@ -31,26 +34,36 @@
#include "edtServiceImpl.h" #include "edtServiceImpl.h"
#include "edtMainService.h" #include "edtMainService.h"
#include "edtPartialService.h" #include "edtPartialService.h"
#include "edtEditorOptionsPages.h" #if defined(HAVE_QT)
#include "edtRecentConfigurationPage.h" # include "edtEditorOptionsPages.h"
# include "edtRecentConfigurationPage.h"
#endif
#include <QApplication> #if defined(HAVE_QT)
#include <QLayout> # include <QApplication>
# include <QLayout>
#endif
namespace edt namespace edt
{ {
#if defined(HAVE_QT)
edt::RecentConfigurationPage::ConfigurationDescriptor shape_cfg_descriptors[] = edt::RecentConfigurationPage::ConfigurationDescriptor shape_cfg_descriptors[] =
{ {
edt::RecentConfigurationPage::ConfigurationDescriptor ("", tl::to_string (tr ("Layer")), edt::RecentConfigurationPage::Layer), edt::RecentConfigurationPage::ConfigurationDescriptor ("", tl::to_string (tr ("Layer")), edt::RecentConfigurationPage::Layer),
}; };
#endif
#if defined(HAVE_QT)
static static
void get_shape_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher) void get_shape_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher)
{ {
ret.push_back (new RecentConfigurationPage (view, dispatcher, "edit-recent-shape-param", ret.push_back (new RecentConfigurationPage (view, dispatcher, "edit-recent-shape-param",
&shape_cfg_descriptors[0], &shape_cfg_descriptors[sizeof (shape_cfg_descriptors) / sizeof (shape_cfg_descriptors[0])])); &shape_cfg_descriptors[0], &shape_cfg_descriptors[sizeof (shape_cfg_descriptors) / sizeof (shape_cfg_descriptors[0])]));
} }
#else
static void get_shape_editor_options_pages () { }
#endif
static static
void get_text_options (std::vector < std::pair<std::string, std::string> > &options) void get_text_options (std::vector < std::pair<std::string, std::string> > &options)
@ -61,6 +74,7 @@ void get_text_options (std::vector < std::pair<std::string, std::string> > &opti
options.push_back (std::pair<std::string, std::string> (cfg_edit_text_valign, "bottom")); options.push_back (std::pair<std::string, std::string> (cfg_edit_text_valign, "bottom"));
} }
#if defined(HAVE_QT)
static static
void get_text_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher) void get_text_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher)
{ {
@ -77,6 +91,9 @@ void get_text_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret,
&text_cfg_descriptors[0], &text_cfg_descriptors[sizeof (text_cfg_descriptors) / sizeof (text_cfg_descriptors[0])])); &text_cfg_descriptors[0], &text_cfg_descriptors[sizeof (text_cfg_descriptors) / sizeof (text_cfg_descriptors[0])]));
ret.push_back (new edt::EditorOptionsText (view, dispatcher)); ret.push_back (new edt::EditorOptionsText (view, dispatcher));
} }
#else
static void get_text_editor_options_pages () { }
#endif
static static
void get_path_options (std::vector < std::pair<std::string, std::string> > &options) void get_path_options (std::vector < std::pair<std::string, std::string> > &options)
@ -87,6 +104,7 @@ void get_path_options (std::vector < std::pair<std::string, std::string> > &opti
options.push_back (std::pair<std::string, std::string> (cfg_edit_path_ext_var_end, "0.0")); options.push_back (std::pair<std::string, std::string> (cfg_edit_path_ext_var_end, "0.0"));
} }
#if defined(HAVE_QT)
static static
void get_path_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher) void get_path_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher)
{ {
@ -103,6 +121,9 @@ void get_path_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret,
&path_cfg_descriptors[0], &path_cfg_descriptors[sizeof (path_cfg_descriptors) / sizeof (path_cfg_descriptors[0])])); &path_cfg_descriptors[0], &path_cfg_descriptors[sizeof (path_cfg_descriptors) / sizeof (path_cfg_descriptors[0])]));
ret.push_back (new EditorOptionsPath (view, dispatcher)); ret.push_back (new EditorOptionsPath (view, dispatcher));
} }
#else
static void get_path_editor_options_pages () { }
#endif
static static
void get_inst_options (std::vector < std::pair<std::string, std::string> > &options) void get_inst_options (std::vector < std::pair<std::string, std::string> > &options)
@ -123,6 +144,7 @@ void get_inst_options (std::vector < std::pair<std::string, std::string> > &opti
options.push_back (std::pair<std::string, std::string> (cfg_edit_show_shapes_of_instances, "true")); options.push_back (std::pair<std::string, std::string> (cfg_edit_show_shapes_of_instances, "true"));
} }
#if defined(HAVE_QT)
static static
void get_inst_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher) void get_inst_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret, lay::LayoutView *view, lay::Dispatcher *dispatcher)
{ {
@ -148,12 +170,16 @@ void get_inst_editor_options_pages (std::vector<lay::EditorOptionsPage *> &ret,
ret.push_back (new EditorOptionsInstPCellParam (view, dispatcher)); ret.push_back (new EditorOptionsInstPCellParam (view, dispatcher));
ret.push_back (new EditorOptionsInst (view, dispatcher)); ret.push_back (new EditorOptionsInst (view, dispatcher));
} }
#else
static void get_inst_editor_options_pages () { }
#endif
template <class Svc> template <class Svc>
class PluginDeclaration class PluginDeclaration
: public PluginDeclarationBase : public PluginDeclarationBase
{ {
public: public:
#if defined(HAVE_QT)
PluginDeclaration (const std::string &title, const std::string &mouse_mode, PluginDeclaration (const std::string &title, const std::string &mouse_mode,
void (*option_get_f) (std::vector < std::pair<std::string, std::string> > &) = 0, void (*option_get_f) (std::vector < std::pair<std::string, std::string> > &) = 0,
void (*pages_f) (std::vector <lay::EditorOptionsPage *> &, lay::LayoutView *, lay::Dispatcher *) = 0) void (*pages_f) (std::vector <lay::EditorOptionsPage *> &, lay::LayoutView *, lay::Dispatcher *) = 0)
@ -161,6 +187,15 @@ public:
{ {
// .. nothing yet .. // .. nothing yet ..
} }
#else
PluginDeclaration (const std::string &title, const std::string &mouse_mode,
void (*option_get_f) (std::vector < std::pair<std::string, std::string> > &) = 0,
void (*pages_f) () = 0)
: m_title (title), m_mouse_mode (mouse_mode), mp_option_get_f (option_get_f), mp_pages_f (pages_f)
{
// .. nothing yet ..
}
#endif
virtual void get_options (std::vector < std::pair<std::string, std::string> > &options) const virtual void get_options (std::vector < std::pair<std::string, std::string> > &options) const
{ {
@ -169,16 +204,19 @@ public:
} }
} }
#if defined(HAVE_QT)
virtual lay::ConfigPage *config_page (QWidget * /*parent*/, std::string & /*title*/) const virtual lay::ConfigPage *config_page (QWidget * /*parent*/, std::string & /*title*/) const
{ {
return 0; return 0;
} }
#endif
virtual void get_menu_entries (std::vector<lay::MenuEntry> & /*menu_entries*/) const virtual void get_menu_entries (std::vector<lay::MenuEntry> & /*menu_entries*/) const
{ {
// .. nothing yet .. // .. nothing yet ..
} }
#if defined(HAVE_QT)
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutView *view, lay::Dispatcher *root) const virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutView *view, lay::Dispatcher *root) const
{ {
if (mp_pages_f != 0) { if (mp_pages_f != 0) {
@ -189,6 +227,7 @@ public:
} }
} }
} }
#endif
virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const virtual lay::Plugin *create_plugin (db::Manager *manager, lay::Dispatcher *, lay::LayoutView *view) const
{ {
@ -214,31 +253,35 @@ private:
std::string m_mouse_mode; std::string m_mouse_mode;
void (*mp_option_get_f) (std::vector < std::pair<std::string, std::string> > &options); void (*mp_option_get_f) (std::vector < std::pair<std::string, std::string> > &options);
#if defined(HAVE_QT)
void (*mp_pages_f) (std::vector <lay::EditorOptionsPage *> &, lay::LayoutView *, lay::Dispatcher *); void (*mp_pages_f) (std::vector <lay::EditorOptionsPage *> &, lay::LayoutView *, lay::Dispatcher *);
#else
void (*mp_pages_f) ();
#endif
}; };
static tl::RegisteredClass<lay::PluginDeclaration> config_decl1 ( static tl::RegisteredClass<lay::PluginDeclaration> config_decl1 (
new edt::PluginDeclaration<edt::PolygonService> (tl::to_string (QObject::tr ("Polygons")), "polygon:edit_mode\t" + tl::to_string (QObject::tr ("Polygon")) + "<:polygon.png>" + tl::to_string (QObject::tr ("{Create a polygon}")), 0, &get_shape_editor_options_pages), new edt::PluginDeclaration<edt::PolygonService> (tl::to_string (tr ("Polygons")), "polygon:edit_mode\t" + tl::to_string (tr ("Polygon")) + "<:polygon.png>" + tl::to_string (tr ("{Create a polygon}")), 0, &get_shape_editor_options_pages),
4010, 4010,
"edt::Service(Polygons)" "edt::Service(Polygons)"
); );
static tl::RegisteredClass<lay::PluginDeclaration> config_decl2 ( static tl::RegisteredClass<lay::PluginDeclaration> config_decl2 (
new edt::PluginDeclaration<edt::BoxService> (tl::to_string (QObject::tr ("Boxes")), "box:edit_mode\t" + tl::to_string (QObject::tr ("Box")) + "\t<:box.png>" + tl::to_string (QObject::tr ("{Create a box}")), 0, &get_shape_editor_options_pages), new edt::PluginDeclaration<edt::BoxService> (tl::to_string (tr ("Boxes")), "box:edit_mode\t" + tl::to_string (tr ("Box")) + "\t<:box.png>" + tl::to_string (tr ("{Create a box}")), 0, &get_shape_editor_options_pages),
4011, 4011,
"edt::Service(Boxes)" "edt::Service(Boxes)"
); );
static tl::RegisteredClass<lay::PluginDeclaration> config_decl3 ( static tl::RegisteredClass<lay::PluginDeclaration> config_decl3 (
new edt::PluginDeclaration<edt::TextService> (tl::to_string (QObject::tr ("Texts")), "text:edit_mode\t" + tl::to_string (QObject::tr ("Text")) + "\t<:text.png>" + tl::to_string (QObject::tr ("{Create a text object}")), &get_text_options, &get_text_editor_options_pages), new edt::PluginDeclaration<edt::TextService> (tl::to_string (tr ("Texts")), "text:edit_mode\t" + tl::to_string (tr ("Text")) + "\t<:text.png>" + tl::to_string (tr ("{Create a text object}")), &get_text_options, &get_text_editor_options_pages),
4012, 4012,
"edt::Service(Texts)" "edt::Service(Texts)"
); );
static tl::RegisteredClass<lay::PluginDeclaration> config_decl4 ( static tl::RegisteredClass<lay::PluginDeclaration> config_decl4 (
new edt::PluginDeclaration<edt::PathService> (tl::to_string (QObject::tr ("Paths")), "path:edit_mode\t" + tl::to_string (QObject::tr ("Path")) + "\t<:path.png>" + tl::to_string (QObject::tr ("{Create a path}")), &get_path_options, &get_path_editor_options_pages), new edt::PluginDeclaration<edt::PathService> (tl::to_string (tr ("Paths")), "path:edit_mode\t" + tl::to_string (tr ("Path")) + "\t<:path.png>" + tl::to_string (tr ("{Create a path}")), &get_path_options, &get_path_editor_options_pages),
4013, 4013,
"edt::Service(Paths)" "edt::Service(Paths)"
); );
static tl::RegisteredClass<lay::PluginDeclaration> config_decl5 ( static tl::RegisteredClass<lay::PluginDeclaration> config_decl5 (
new edt::PluginDeclaration<edt::InstService> (tl::to_string (QObject::tr ("Instances")), "instance:edit_mode\t" + tl::to_string (QObject::tr ("Instance")) + "\t<:instance.png>" + tl::to_string (QObject::tr ("{Create a cell instance}")), &get_inst_options, &get_inst_editor_options_pages), new edt::PluginDeclaration<edt::InstService> (tl::to_string (tr ("Instances")), "instance:edit_mode\t" + tl::to_string (tr ("Instance")) + "\t<:instance.png>" + tl::to_string (tr ("{Create a cell instance}")), &get_inst_options, &get_inst_editor_options_pages),
4020, 4020,
"edt::Service(CellInstances)" "edt::Service(CellInstances)"
); );
@ -264,41 +307,43 @@ public:
options.push_back (std::pair<std::string, std::string> (cfg_edit_combine_mode, "add")); options.push_back (std::pair<std::string, std::string> (cfg_edit_combine_mode, "add"));
} }
#if defined(HAVE_QT)
virtual lay::ConfigPage *config_page (QWidget * /*parent*/, std::string & /*title*/) const virtual lay::ConfigPage *config_page (QWidget * /*parent*/, std::string & /*title*/) const
{ {
return 0; return 0;
} }
#endif
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
{ {
lay::PluginDeclaration::get_menu_entries (menu_entries); lay::PluginDeclaration::get_menu_entries (menu_entries);
menu_entries.push_back (lay::separator ("edt::hier_group", "zoom_menu.end")); menu_entries.push_back (lay::separator ("edt::hier_group", "zoom_menu.end"));
menu_entries.push_back (lay::menu_item ("edt::descend", "descend", "zoom_menu.end", tl::to_string (QObject::tr ("Descend")) + "(Ctrl+D)")); menu_entries.push_back (lay::menu_item ("edt::descend", "descend", "zoom_menu.end", tl::to_string (tr ("Descend")) + "(Ctrl+D)"));
menu_entries.push_back (lay::menu_item ("edt::ascend", "ascend", "zoom_menu.end", tl::to_string (QObject::tr ("Ascend")) + "(Ctrl+A)")); menu_entries.push_back (lay::menu_item ("edt::ascend", "ascend", "zoom_menu.end", tl::to_string (tr ("Ascend")) + "(Ctrl+A)"));
menu_entries.push_back (lay::menu_item ("edt::sel_make_array", "make_array:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Array")))); menu_entries.push_back (lay::menu_item ("edt::sel_make_array", "make_array:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Make Array"))));
menu_entries.push_back (lay::separator ("selection_group:edit_mode", "edit_menu.selection_menu.end")); menu_entries.push_back (lay::separator ("selection_group:edit_mode", "edit_menu.selection_menu.end"));
menu_entries.push_back (lay::menu_item ("edt::sel_change_layer", "change_layer:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Change Layer")))); menu_entries.push_back (lay::menu_item ("edt::sel_change_layer", "change_layer:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Change Layer"))));
menu_entries.push_back (lay::menu_item ("edt::sel_tap", "tap", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Tap")) + "(T)")); menu_entries.push_back (lay::menu_item ("edt::sel_tap", "tap", "edit_menu.selection_menu.end", tl::to_string (tr ("Tap")) + "(T)"));
menu_entries.push_back (lay::menu_item ("edt::sel_align", "align:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Align")))); menu_entries.push_back (lay::menu_item ("edt::sel_align", "align:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Align"))));
menu_entries.push_back (lay::menu_item ("edt::sel_distribute", "distribute:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Distribute")))); menu_entries.push_back (lay::menu_item ("edt::sel_distribute", "distribute:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Distribute"))));
menu_entries.push_back (lay::menu_item ("edt::sel_round_corners", "round_corners:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Round Corners")))); menu_entries.push_back (lay::menu_item ("edt::sel_round_corners", "round_corners:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Round Corners"))));
menu_entries.push_back (lay::menu_item ("edt::sel_size", "size:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Size Shapes")))); menu_entries.push_back (lay::menu_item ("edt::sel_size", "size:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Size Shapes"))));
menu_entries.push_back (lay::menu_item ("edt::sel_union", "union:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Merge Shapes")))); menu_entries.push_back (lay::menu_item ("edt::sel_union", "union:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Merge Shapes"))));
menu_entries.push_back (lay::menu_item ("edt::sel_intersection", "intersection:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Intersection - Others With First")))); menu_entries.push_back (lay::menu_item ("edt::sel_intersection", "intersection:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Intersection - Others With First"))));
menu_entries.push_back (lay::menu_item ("edt::sel_difference", "difference:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Subtraction - Others From First")))); menu_entries.push_back (lay::menu_item ("edt::sel_difference", "difference:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Subtraction - Others From First"))));
menu_entries.push_back (lay::menu_item ("edt::sel_separate", "separate:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Separate - First into Inside/Outside Others")))); menu_entries.push_back (lay::menu_item ("edt::sel_separate", "separate:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Separate - First into Inside/Outside Others"))));
menu_entries.push_back (lay::separator ("hier_group:edit_mode", "edit_menu.selection_menu.end")); menu_entries.push_back (lay::separator ("hier_group:edit_mode", "edit_menu.selection_menu.end"));
menu_entries.push_back (lay::menu_item ("edt::sel_flatten_insts", "flatten_insts:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Flatten Instances")))); menu_entries.push_back (lay::menu_item ("edt::sel_flatten_insts", "flatten_insts:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Flatten Instances"))));
menu_entries.push_back (lay::menu_item ("edt::sel_resolve_arefs", "resolve_arefs:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Resolve Arrays")))); menu_entries.push_back (lay::menu_item ("edt::sel_resolve_arefs", "resolve_arefs:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Resolve Arrays"))));
menu_entries.push_back (lay::menu_item ("edt::sel_move_hier_up", "move_hier_up:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Move Up In Hierarchy")))); menu_entries.push_back (lay::menu_item ("edt::sel_move_hier_up", "move_hier_up:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Move Up In Hierarchy"))));
menu_entries.push_back (lay::menu_item ("edt::sel_make_cell", "make_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Cell")))); menu_entries.push_back (lay::menu_item ("edt::sel_make_cell", "make_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Make Cell"))));
menu_entries.push_back (lay::menu_item ("edt::sel_make_cell_variants", "make_cell_variants:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Make Cell Variants")))); menu_entries.push_back (lay::menu_item ("edt::sel_make_cell_variants", "make_cell_variants:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Make Cell Variants"))));
menu_entries.push_back (lay::menu_item ("edt::sel_convert_to_pcell", "convert_to_pcell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Convert To PCell")))); menu_entries.push_back (lay::menu_item ("edt::sel_convert_to_pcell", "convert_to_pcell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Convert To PCell"))));
menu_entries.push_back (lay::menu_item ("edt::sel_convert_to_cell", "convert_to_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::tr ("Convert To Static Cell")))); menu_entries.push_back (lay::menu_item ("edt::sel_convert_to_cell", "convert_to_cell:edit_mode", "edit_menu.selection_menu.end", tl::to_string (tr ("Convert To Static Cell"))));
menu_entries.push_back (lay::menu_item ("edt::combine_mode", "combine_mode:edit_mode", "@toolbar.end_modes", tl::to_string (QObject::tr ("Combine{Select background combination mode}")))); menu_entries.push_back (lay::menu_item ("edt::combine_mode", "combine_mode:edit_mode", "@toolbar.end_modes", tl::to_string (tr ("Combine{Select background combination mode}"))));
} }
bool configure (const std::string &name, const std::string &value) bool configure (const std::string &name, const std::string &value)
@ -327,12 +372,14 @@ public:
return false; return false;
} }
#if defined(HAVE_QT)
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutView *view, lay::Dispatcher *dispatcher) const virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutView *view, lay::Dispatcher *dispatcher) const
{ {
// NOTE: we do not set plugin_declaration which makes the page unspecific // NOTE: we do not set plugin_declaration which makes the page unspecific
EditorOptionsGeneric *generic_opt = new EditorOptionsGeneric (view, dispatcher); EditorOptionsGeneric *generic_opt = new EditorOptionsGeneric (view, dispatcher);
pages.push_back (generic_opt); pages.push_back (generic_opt);
} }
#endif
virtual void initialize (lay::Dispatcher *root) virtual void initialize (lay::Dispatcher *root)
{ {
@ -343,18 +390,21 @@ public:
mp_root = root; mp_root = root;
#if defined(HAVE_QT)
// add entries to the combine mode dialog // add entries to the combine mode dialog
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_add", new lay::ConfigureAction (tl::to_string (QObject::tr ("Add<:/cm_add.png>{Add shapes}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Add))); mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_add", new lay::ConfigureAction (tl::to_string (tr ("Add<:/cm_add.png>{Add shapes}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Add)));
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_merge", new lay::ConfigureAction (tl::to_string (QObject::tr ("Merge<:/cm_merge.png>{Merge shapes with background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Merge))); mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_merge", new lay::ConfigureAction (tl::to_string (tr ("Merge<:/cm_merge.png>{Merge shapes with background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Merge)));
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_erase", new lay::ConfigureAction (tl::to_string (QObject::tr ("Erase<:/cm_erase.png>{Erase shape from background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Erase))); mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_erase", new lay::ConfigureAction (tl::to_string (tr ("Erase<:/cm_erase.png>{Erase shape from background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Erase)));
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_mask", new lay::ConfigureAction (tl::to_string (QObject::tr ("Mask<:/cm_mask.png>{Mask background with shape}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Mask))); mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_mask", new lay::ConfigureAction (tl::to_string (tr ("Mask<:/cm_mask.png>{Mask background with shape}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Mask)));
mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_diff", new lay::ConfigureAction (tl::to_string (QObject::tr ("Diff<:/cm_diff.png>{Compute difference of shape with background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Diff))); mp->menu ()->insert_item ("@toolbar.combine_mode.end", "combine_mode_diff", new lay::ConfigureAction (tl::to_string (tr ("Diff<:/cm_diff.png>{Compute difference of shape with background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Diff)));
update_menu (CM_Add); update_menu (CM_Add);
#endif
} }
void update_menu (combine_mode_type cm) void update_menu (combine_mode_type cm)
{ {
#if defined(HAVE_QT)
lay::Dispatcher *mp = lay::Dispatcher::instance (); lay::Dispatcher *mp = lay::Dispatcher::instance ();
if (! mp || ! mp->has_ui ()) { if (! mp || ! mp->has_ui ()) {
return; return;
@ -363,21 +413,22 @@ public:
lay::Action *combine_menu = mp->menu ()->action ("@toolbar.combine_mode"); lay::Action *combine_menu = mp->menu ()->action ("@toolbar.combine_mode");
if (cm == CM_Add) { if (cm == CM_Add) {
combine_menu->set_title (tl::to_string (QObject::tr ("Add"))); combine_menu->set_title (tl::to_string (tr ("Add")));
combine_menu->set_icon (":/cm_add.png"); combine_menu->set_icon (":/cm_add.png");
} else if (cm == CM_Merge) { } else if (cm == CM_Merge) {
combine_menu->set_title (tl::to_string (QObject::tr ("Merge"))); combine_menu->set_title (tl::to_string (tr ("Merge")));
combine_menu->set_icon (":/cm_merge.png"); combine_menu->set_icon (":/cm_merge.png");
} else if (cm == CM_Erase) { } else if (cm == CM_Erase) {
combine_menu->set_title (tl::to_string (QObject::tr ("Erase"))); combine_menu->set_title (tl::to_string (tr ("Erase")));
combine_menu->set_icon (":/cm_erase.png"); combine_menu->set_icon (":/cm_erase.png");
} else if (cm == CM_Mask) { } else if (cm == CM_Mask) {
combine_menu->set_title (tl::to_string (QObject::tr ("Mask"))); combine_menu->set_title (tl::to_string (tr ("Mask")));
combine_menu->set_icon (":/cm_mask.png"); combine_menu->set_icon (":/cm_mask.png");
} else if (cm == CM_Diff) { } else if (cm == CM_Diff) {
combine_menu->set_title (tl::to_string (QObject::tr ("Diff"))); combine_menu->set_title (tl::to_string (tr ("Diff")));
combine_menu->set_icon (":/cm_diff.png"); combine_menu->set_icon (":/cm_diff.png");
} }
#endif
} }
void initialized (lay::Dispatcher *root) void initialized (lay::Dispatcher *root)
@ -387,22 +438,27 @@ public:
return; return;
} }
lay::Action *combine_menu = mp->menu ()->action ("@toolbar.combine_mode"); #if defined(HAVE_QT)
// Do some more initialization here. // generate a warning if the combine mode isn't "Add"
combine_mode_type cm = CM_Add; combine_mode_type cm = CM_Add;
root->config_get (cfg_edit_combine_mode, cm, CMConverter ()); root->config_get (cfg_edit_combine_mode, cm, CMConverter ());
lay::Action *combine_menu = mp->menu ()->action ("@toolbar.combine_mode");
if (cm != CM_Add && combine_menu->is_visible ()) { if (cm != CM_Add && combine_menu->is_visible ()) {
lay::TipDialog td (QApplication::activeWindow (), lay::TipDialog td (QApplication::activeWindow (),
tl::to_string (QObject::tr ("The background combination mode of the shape editor is set to some other mode than 'Add'.\n" tl::to_string (tr ("The background combination mode of the shape editor is set to some other mode than 'Add'.\n"
"This can be confusing, because a shape may not be drawn as expected.\n\nTo switch back to normal mode, choose 'Add' for the background combination mode in the toolbar.")), "This can be confusing, because a shape may not be drawn as expected.\n\nTo switch back to normal mode, choose 'Add' for the background combination mode in the toolbar.")),
"has-non-add-edit-combine-mode"); "has-non-add-edit-combine-mode");
if (td.exec_dialog ()) { if (td.exec_dialog ()) {
// Don't bother the user with more dialogs. // Don't bother the user with more dialogs.
return; return;
} }
} }
#endif
} }
private: private:
@ -410,11 +466,12 @@ private:
std::string m_title; std::string m_title;
}; };
static tl::RegisteredClass<lay::PluginDeclaration> config_decl_main (new edt::MainPluginDeclaration (tl::to_string (QObject::tr ("Instances and shapes"))), 4000, "edt::MainService"); static tl::RegisteredClass<lay::PluginDeclaration> config_decl_main (new edt::MainPluginDeclaration (tl::to_string (tr ("Instances and shapes"))), 4000, "edt::MainService");
void void
commit_recent (lay::LayoutView *view) commit_recent (lay::LayoutView *view)
{ {
#if defined(HAVE_QT)
lay::EditorOptionsPages *eo_pages = view->editor_options_pages (); lay::EditorOptionsPages *eo_pages = view->editor_options_pages ();
if (!eo_pages) { if (!eo_pages) {
return; return;
@ -425,6 +482,7 @@ commit_recent (lay::LayoutView *view)
(*op)->commit_recent (view); (*op)->commit_recent (view);
} }
} }
#endif
} }
class PartialPluginDeclaration class PartialPluginDeclaration
@ -470,7 +528,7 @@ private:
}; };
static tl::RegisteredClass<lay::PluginDeclaration> config_decl30 ( static tl::RegisteredClass<lay::PluginDeclaration> config_decl30 (
new edt::PartialPluginDeclaration (tl::to_string (QObject::tr ("Partial shapes")), "partial:edit_mode\t" + tl::to_string (QObject::tr ("Partial{Edit points and edges of shapes}")) + "<:partial.png>"), new edt::PartialPluginDeclaration (tl::to_string (tr ("Partial shapes")), "partial:edit_mode\t" + tl::to_string (tr ("Partial{Edit points and edges of shapes}")) + "<:partial.png>"),
4030, 4030,
"edt::PartialService" "edt::PartialService"
); );

View File

@ -26,8 +26,10 @@
#include "dbLibrary.h" #include "dbLibrary.h"
#include "edtPlugin.h" #include "edtPlugin.h"
#include "edtService.h" #include "edtService.h"
#include "edtEditorOptionsPages.h" #if defined(HAVE_QT)
#include "edtDialogs.h" # include "edtEditorOptionsPages.h"
# include "edtDialogs.h"
#endif
#include "layFinder.h" #include "layFinder.h"
#include "layLayoutView.h" #include "layLayoutView.h"
#include "laySnap.h" #include "laySnap.h"
@ -312,6 +314,7 @@ Service::copy ()
void void
Service::copy_selected () Service::copy_selected ()
{ {
#if defined(HAVE_QT)
edt::CopyModeDialog mode_dialog (view ()->widget ()); edt::CopyModeDialog mode_dialog (view ()->widget ());
bool need_to_ask_for_copy_mode = false; bool need_to_ask_for_copy_mode = false;
@ -340,33 +343,49 @@ Service::copy_selected ()
dispatcher ()->config_end (); dispatcher ()->config_end ();
} }
// create one ClipboardData object per cv_index because, this one assumes that there is copy_selected (inst_mode);
// only one source layout object.
std::set <unsigned int> cv_indices; }
#else
unsigned int inst_mode = 0;
if (m_hier_copy_mode >= 0) {
inst_mode = int (m_hier_copy_mode);
}
copy_selected (inst_mode);
#endif
}
void
Service::copy_selected (unsigned int inst_mode)
{
// create one ClipboardData object per cv_index because, this one assumes that there is
// only one source layout object.
std::set <unsigned int> cv_indices;
for (objects::const_iterator r = m_selection.begin (); r != m_selection.end (); ++r) {
cv_indices.insert (r->cv_index ());
}
for (std::set <unsigned int>::const_iterator cvi = cv_indices.begin (); cvi != cv_indices.end (); ++cvi) {
db::ClipboardValue<edt::ClipboardData> *cd = new db::ClipboardValue<edt::ClipboardData> ();
// add the selected objects to the clipboard data objects.
const lay::CellView &cv = view ()->cellview (*cvi);
for (objects::const_iterator r = m_selection.begin (); r != m_selection.end (); ++r) { for (objects::const_iterator r = m_selection.begin (); r != m_selection.end (); ++r) {
cv_indices.insert (r->cv_index ()); if (r->cv_index () == *cvi) {
} if (! r->is_cell_inst ()) {
cd->get ().add (cv->layout (), r->layer (), r->shape (), cv.context_trans () * r->trans ());
for (std::set <unsigned int>::const_iterator cvi = cv_indices.begin (); cvi != cv_indices.end (); ++cvi) { } else {
cd->get ().add (cv->layout (), r->back ().inst_ptr, inst_mode, cv.context_trans () * r->trans ());
db::ClipboardValue<edt::ClipboardData> *cd = new db::ClipboardValue<edt::ClipboardData> ();
// add the selected objects to the clipboard data objects.
const lay::CellView &cv = view ()->cellview (*cvi);
for (objects::const_iterator r = m_selection.begin (); r != m_selection.end (); ++r) {
if (r->cv_index () == *cvi) {
if (! r->is_cell_inst ()) {
cd->get ().add (cv->layout (), r->layer (), r->shape (), cv.context_trans () * r->trans ());
} else {
cd->get ().add (cv->layout (), r->back ().inst_ptr, inst_mode, cv.context_trans () * r->trans ());
}
} }
} }
db::Clipboard::instance () += cd;
} }
db::Clipboard::instance () += cd;
} }
} }
@ -799,7 +818,7 @@ Service::mouse_click_event (const db::DPoint &p, unsigned int buttons, bool prio
bool bool
Service::key_event (unsigned int key, unsigned int buttons) Service::key_event (unsigned int key, unsigned int buttons)
{ {
if (view ()->is_editable () && m_editing && buttons == 0 && key == Qt::Key_Backspace) { if (view ()->is_editable () && m_editing && buttons == 0 && key == lay::KeyBackspace) {
do_delete (); do_delete ();
return true; return true;
} else { } else {
@ -1141,7 +1160,7 @@ Service::display_status (bool transient)
std::string msg; std::string msg;
if (! transient) { if (! transient) {
msg = tl::to_string (QObject::tr ("selected: ")); msg = tl::to_string (tr ("selected: "));
} }
db::Instance inst = r->back ().inst_ptr; db::Instance inst = r->back ().inst_ptr;
@ -1149,12 +1168,12 @@ Service::display_status (bool transient)
db::Vector a, b; db::Vector a, b;
unsigned long amax = 0, bmax = 0; unsigned long amax = 0, bmax = 0;
if (! inst.is_regular_array (a, b, amax, bmax)) { if (! inst.is_regular_array (a, b, amax, bmax)) {
msg += tl::sprintf (tl::to_string (QObject::tr ("instance(\"%s\" %s)")), layout.display_name (inst.cell_index ()), inst.complex_trans ().to_string ()); msg += tl::sprintf (tl::to_string (tr ("instance(\"%s\" %s)")), layout.display_name (inst.cell_index ()), inst.complex_trans ().to_string ());
} else { } else {
msg += tl::sprintf (tl::to_string (QObject::tr ("instance(\"%s\" %s %ldx%ld)")), layout.display_name (inst.cell_index ()), inst.complex_trans ().to_string (), amax, bmax); msg += tl::sprintf (tl::to_string (tr ("instance(\"%s\" %s %ldx%ld)")), layout.display_name (inst.cell_index ()), inst.complex_trans ().to_string (), amax, bmax);
} }
msg += tl::to_string (QObject::tr (" in ")); msg += tl::to_string (tr (" in "));
msg += path_to_string (layout, *r); msg += path_to_string (layout, *r);
view ()->message (msg, transient ? 10 : 10000); view ()->message (msg, transient ? 10 : 10000);
@ -1163,31 +1182,31 @@ Service::display_status (bool transient)
std::string msg; std::string msg;
if (! transient) { if (! transient) {
msg = tl::to_string (QObject::tr ("selected: ")); msg = tl::to_string (tr ("selected: "));
} }
if (r->shape ().is_box ()) { if (r->shape ().is_box ()) {
db::Box b (r->shape ().bbox ()); db::Box b (r->shape ().bbox ());
msg += tl::sprintf (tl::to_string (QObject::tr ("box(%d,%d %d,%d)")), int (b.left ()), int (b.bottom ()), int (b.right ()), int (b.top ())); msg += tl::sprintf (tl::to_string (tr ("box(%d,%d %d,%d)")), int (b.left ()), int (b.bottom ()), int (b.right ()), int (b.top ()));
} else if (r->shape ().is_text ()) { } else if (r->shape ().is_text ()) {
msg += tl::sprintf (tl::to_string (QObject::tr ("text(\"%s\" %s)")), tl::escape_string (r->shape ().text_string ()), r->shape ().text_trans ().to_string ()); msg += tl::sprintf (tl::to_string (tr ("text(\"%s\" %s)")), tl::escape_string (r->shape ().text_string ()), r->shape ().text_trans ().to_string ());
} else if (r->shape ().is_polygon ()) { } else if (r->shape ().is_polygon ()) {
size_t npoints = 0; size_t npoints = 0;
for (db::Shape::polygon_edge_iterator e = r->shape ().begin_edge (); ! e.at_end (); ++e) { for (db::Shape::polygon_edge_iterator e = r->shape ().begin_edge (); ! e.at_end (); ++e) {
++npoints; ++npoints;
} }
msg += tl::sprintf (tl::to_string (QObject::tr ("polygon(#points=%lu)")), npoints); msg += tl::sprintf (tl::to_string (tr ("polygon(#points=%lu)")), npoints);
} else if (r->shape ().is_path ()) { } else if (r->shape ().is_path ()) {
size_t npoints = 0; size_t npoints = 0;
for (db::Shape::point_iterator p = r->shape ().begin_point (); p != r->shape ().end_point (); ++p) { for (db::Shape::point_iterator p = r->shape ().begin_point (); p != r->shape ().end_point (); ++p) {
++npoints; ++npoints;
} }
msg += tl::sprintf (tl::to_string (QObject::tr ("path(w=%d #points=%lu)")), int (r->shape ().path_width ()), npoints); msg += tl::sprintf (tl::to_string (tr ("path(w=%d #points=%lu)")), int (r->shape ().path_width ()), npoints);
} }
if (! msg.empty ()) { if (! msg.empty ()) {
msg += tl::to_string (QObject::tr (" on ")); msg += tl::to_string (tr (" on "));
std::string ln = layout.get_properties (r->layer ()).to_string (); std::string ln = layout.get_properties (r->layer ()).to_string ();
for (lay::LayerPropertiesConstIterator lp = view ()->begin_layers (); ! lp.at_end (); ++lp) { for (lay::LayerPropertiesConstIterator lp = view ()->begin_layers (); ! lp.at_end (); ++lp) {
@ -1198,7 +1217,7 @@ Service::display_status (bool transient)
} }
msg += ln; msg += ln;
msg += tl::to_string (QObject::tr (" in ")); msg += tl::to_string (tr (" in "));
msg += path_to_string (layout, *r); msg += path_to_string (layout, *r);
view ()->message (msg, transient ? 10 : 10000); view ()->message (msg, transient ? 10 : 10000);

View File

@ -32,6 +32,7 @@
#include "layMarker.h" #include "layMarker.h"
#include "laySnap.h" #include "laySnap.h"
#include "layObjectInstPath.h" #include "layObjectInstPath.h"
#include "layColor.h"
#include "dbLayout.h" #include "dbLayout.h"
#include "dbShape.h" #include "dbShape.h"
#include "edtUtils.h" #include "edtUtils.h"
@ -219,7 +220,7 @@ public:
/** /**
* @brief Color accessor * @brief Color accessor
*/ */
QColor color () const lay::Color color () const
{ {
return m_color; return m_color;
} }
@ -592,7 +593,7 @@ private:
db::ShapeIterator::flags_type m_flags; db::ShapeIterator::flags_type m_flags;
// The look of the markers // The look of the markers
QColor m_color; lay::Color m_color;
// The current transformation on movement // The current transformation on movement
db::DTrans m_move_trans; db::DTrans m_move_trans;
@ -644,6 +645,9 @@ private:
* @brief Display the status bar message for the given selection * @brief Display the status bar message for the given selection
*/ */
void display_status (bool transient); void display_status (bool transient);
private:
void copy_selected (unsigned int inst_mode);
}; };
} }

View File

@ -23,8 +23,10 @@
#include "edtMainService.h" #include "edtMainService.h"
#include "edtServiceImpl.h" #include "edtServiceImpl.h"
#include "edtPropertiesPages.h" #if defined(HAVE_QT)
#include "edtInstPropertiesPage.h" # include "edtPropertiesPages.h"
# include "edtInstPropertiesPage.h"
#endif
#include "edtService.h" #include "edtService.h"
#include "edtPlugin.h" #include "edtPlugin.h"
#include "dbEdge.h" #include "dbEdge.h"
@ -36,11 +38,15 @@
#include "layMarker.h" #include "layMarker.h"
#include "layLayerProperties.h" #include "layLayerProperties.h"
#include "layLayoutView.h" #include "layLayoutView.h"
#include "layTipDialog.h"
#include "layDragDropData.h"
#include <QInputDialog> #if defined(HAVE_QT)
#include <QApplication> # include "layTipDialog.h"
# include "layDragDropData.h"
#endif
#if defined(HAVE_QT)
# include <QApplication>
#endif
namespace edt namespace edt
{ {
@ -72,7 +78,7 @@ ShapeEditService::get_edit_layer ()
lay::LayerPropertiesConstIterator cl = view ()->current_layer (); lay::LayerPropertiesConstIterator cl = view ()->current_layer ();
if (cl.is_null ()) { if (cl.is_null ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Please select a layer first"))); throw tl::Exception (tl::to_string (tr ("Please select a layer first")));
} }
int cv_index = cl->cellview_index (); int cv_index = cl->cellview_index ();
@ -80,20 +86,22 @@ ShapeEditService::get_edit_layer ()
int layer = cl->layer_index (); int layer = cl->layer_index ();
if (cv_index < 0 || ! cv.is_valid ()) { if (cv_index < 0 || ! cv.is_valid ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Please select a cell first"))); throw tl::Exception (tl::to_string (tr ("Please select a cell first")));
} }
#if defined(HAVE_QT)
if (! cl->visible (true)) { if (! cl->visible (true)) {
lay::TipDialog td (QApplication::activeWindow (), lay::TipDialog td (QApplication::activeWindow (),
tl::to_string (QObject::tr ("You are about to draw on a hidden layer. The result won't be visible.")), tl::to_string (tr ("You are about to draw on a hidden layer. The result won't be visible.")),
"drawing-on-invisible-layer"); "drawing-on-invisible-layer");
td.exec_dialog (); td.exec_dialog ();
} }
#endif
if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) { if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) {
if (cl->has_children ()) { if (cl->has_children ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Please select a valid drawing layer first"))); throw tl::Exception (tl::to_string (tr ("Please select a valid drawing layer first")));
} else { } else {
// create this layer now // create this layer now
@ -126,7 +134,7 @@ ShapeEditService::get_edit_layer ()
mp_cell = &(mp_layout->cell (cv.cell_index ())); mp_cell = &(mp_layout->cell (cv.cell_index ()));
if (mp_cell->is_proxy ()) { if (mp_cell->is_proxy ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Cannot put a shape into a PCell or library cell"))); throw tl::Exception (tl::to_string (tr ("Cannot put a shape into a PCell or library cell")));
} }
} }
@ -153,12 +161,14 @@ ShapeEditService::update_edit_layer (const lay::LayerPropertiesConstIterator &cl
return; return;
} }
#if defined(HAVE_QT)
if (! cl->visible (true)) { if (! cl->visible (true)) {
lay::TipDialog td (QApplication::activeWindow (), lay::TipDialog td (QApplication::activeWindow (),
tl::to_string (QObject::tr ("You are now drawing on a hidden layer. The result won't be visible.")), tl::to_string (tr ("You are now drawing on a hidden layer. The result won't be visible.")),
"drawing-on-invisible-layer"); "drawing-on-invisible-layer");
td.exec_dialog (); td.exec_dialog ();
} }
#endif
if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) { if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) {
@ -256,7 +266,7 @@ ShapeEditService::deliver_shape (const db::Polygon &poly)
{ {
if (m_combine_mode == CM_Add) { if (m_combine_mode == CM_Add) {
manager ()->transaction (tl::to_string (QObject::tr ("Create polygon"))); manager ()->transaction (tl::to_string (tr ("Create polygon")));
cell ().shapes (layer ()).insert (poly); cell ().shapes (layer ()).insert (poly);
manager ()->commit (); manager ()->commit ();
@ -316,7 +326,7 @@ ShapeEditService::deliver_shape (const db::Polygon &poly)
result = input; result = input;
} }
manager ()->transaction (tl::to_string (QObject::tr ("Combine shape with background"))); manager ()->transaction (tl::to_string (tr ("Combine shape with background")));
// Erase existing shapes // Erase existing shapes
for (std::vector<db::Shape>::const_iterator s = shapes.begin (); s != shapes.end (); ++s) { for (std::vector<db::Shape>::const_iterator s = shapes.begin (); s != shapes.end (); ++s) {
@ -340,7 +350,7 @@ void
ShapeEditService::deliver_shape (const db::Path &path) ShapeEditService::deliver_shape (const db::Path &path)
{ {
if (m_combine_mode == CM_Add) { if (m_combine_mode == CM_Add) {
manager ()->transaction (tl::to_string (QObject::tr ("Create path"))); manager ()->transaction (tl::to_string (tr ("Create path")));
cell ().shapes (layer ()).insert (path); cell ().shapes (layer ()).insert (path);
manager ()->commit (); manager ()->commit ();
} else { } else {
@ -352,7 +362,7 @@ void
ShapeEditService::deliver_shape (const db::Box &box) ShapeEditService::deliver_shape (const db::Box &box)
{ {
if (m_combine_mode == CM_Add) { if (m_combine_mode == CM_Add) {
manager ()->transaction (tl::to_string (QObject::tr ("Create box"))); manager ()->transaction (tl::to_string (tr ("Create box")));
cell ().shapes (layer ()).insert (box); cell ().shapes (layer ()).insert (box);
manager ()->commit (); manager ()->commit ();
} else { } else {
@ -370,11 +380,13 @@ PolygonService::PolygonService (db::Manager *manager, lay::LayoutView *view)
// .. nothing yet .. // .. nothing yet ..
} }
#if defined(HAVE_QT)
lay::PropertiesPage * lay::PropertiesPage *
PolygonService::properties_page (db::Manager *manager, QWidget *parent) PolygonService::properties_page (db::Manager *manager, QWidget *parent)
{ {
return new edt::PolygonPropertiesPage (this, manager, parent); return new edt::PolygonPropertiesPage (this, manager, parent);
} }
#endif
void void
PolygonService::do_begin_edit (const db::DPoint &p) PolygonService::do_begin_edit (const db::DPoint &p)
@ -469,7 +481,7 @@ PolygonService::get_polygon () const
db::Polygon poly; db::Polygon poly;
if (m_points.size () < 4) { if (m_points.size () < 4) {
throw tl::Exception (tl::to_string (QObject::tr ("A polygon must have at least 3 points"))); throw tl::Exception (tl::to_string (tr ("A polygon must have at least 3 points")));
} }
std::vector<db::Point> points_dbu; std::vector<db::Point> points_dbu;
@ -486,7 +498,7 @@ PolygonService::get_polygon () const
poly.assign_hull (points_dbu.begin (), points_dbu.end (), true, true /*remove reflected*/); poly.assign_hull (points_dbu.begin (), points_dbu.end (), true, true /*remove reflected*/);
if (poly.hull ().size () < 3) { if (poly.hull ().size () < 3) {
throw tl::Exception (tl::to_string (QObject::tr ("A polygon must have at least 3 effective points"))); throw tl::Exception (tl::to_string (tr ("A polygon must have at least 3 effective points")));
} }
return poly; return poly;
@ -699,11 +711,13 @@ BoxService::BoxService (db::Manager *manager, lay::LayoutView *view)
// .. nothing yet .. // .. nothing yet ..
} }
#if defined(HAVE_QT)
lay::PropertiesPage * lay::PropertiesPage *
BoxService::properties_page (db::Manager *manager, QWidget *parent) BoxService::properties_page (db::Manager *manager, QWidget *parent)
{ {
return new edt::BoxPropertiesPage (this, manager, parent); return new edt::BoxPropertiesPage (this, manager, parent);
} }
#endif
void void
BoxService::do_begin_edit (const db::DPoint &p) BoxService::do_begin_edit (const db::DPoint &p)
@ -797,11 +811,13 @@ TextService::~TextService ()
// .. nothing yet .. // .. nothing yet ..
} }
#if defined(HAVE_QT)
lay::PropertiesPage * lay::PropertiesPage *
TextService::properties_page (db::Manager *manager, QWidget *parent) TextService::properties_page (db::Manager *manager, QWidget *parent)
{ {
return new edt::TextPropertiesPage (this, manager, parent); return new edt::TextPropertiesPage (this, manager, parent);
} }
#endif
void void
TextService::do_begin_edit (const db::DPoint &p) TextService::do_begin_edit (const db::DPoint &p)
@ -890,16 +906,17 @@ TextService::do_finish_edit ()
{ {
get_edit_layer (); get_edit_layer ();
manager ()->transaction (tl::to_string (QObject::tr ("Create text"))); manager ()->transaction (tl::to_string (tr ("Create text")));
cell ().shapes (layer ()).insert (get_text ()); cell ().shapes (layer ()).insert (get_text ());
manager ()->commit (); manager ()->commit ();
commit_recent (view ()); commit_recent (view ());
#if defined(HAVE_QT)
if (! view ()->text_visible ()) { if (! view ()->text_visible ()) {
lay::TipDialog td (QApplication::activeWindow (), lay::TipDialog td (QApplication::activeWindow (),
tl::to_string (QObject::tr ("A text object is created but texts are disabled for drawing and are not visible. Do you want to enable drawing of texts?\n\nChoose \"Yes\" to enable text drawing now.")), tl::to_string (tr ("A text object is created but texts are disabled for drawing and are not visible. Do you want to enable drawing of texts?\n\nChoose \"Yes\" to enable text drawing now.")),
"text-created-but-not-visible", "text-created-but-not-visible",
lay::TipDialog::yesno_buttons); lay::TipDialog::yesno_buttons);
@ -910,6 +927,7 @@ TextService::do_finish_edit ()
} }
} }
#endif
} }
void void
@ -985,6 +1003,7 @@ PathService::~PathService ()
// .. nothing yet .. // .. nothing yet ..
} }
#if defined(HAVE_QT)
lay::PropertiesPage * lay::PropertiesPage *
PathService::properties_page (db::Manager *manager, QWidget *parent) PathService::properties_page (db::Manager *manager, QWidget *parent)
{ {
@ -994,6 +1013,7 @@ PathService::properties_page (db::Manager *manager, QWidget *parent)
return new edt::PathPropertiesPage (this, manager, parent); return new edt::PathPropertiesPage (this, manager, parent);
} }
} }
#endif
void void
PathService::do_begin_edit (const db::DPoint &p) PathService::do_begin_edit (const db::DPoint &p)
@ -1084,7 +1104,7 @@ PathService::do_finish_edit ()
{ {
// one point is reserved for the "current one" // one point is reserved for the "current one"
if (m_points.size () < 3) { if (m_points.size () < 3) {
throw tl::Exception (tl::to_string (QObject::tr ("A path must have at least 2 points"))); throw tl::Exception (tl::to_string (tr ("A path must have at least 2 points")));
} }
m_points.pop_back (); m_points.pop_back ();
@ -1225,11 +1245,13 @@ InstService::InstService (db::Manager *manager, lay::LayoutView *view)
// .. nothing yet .. // .. nothing yet ..
} }
#if defined(HAVE_QT)
lay::PropertiesPage * lay::PropertiesPage *
InstService::properties_page (db::Manager *manager, QWidget *parent) InstService::properties_page (db::Manager *manager, QWidget *parent)
{ {
return new edt::InstPropertiesPage (this, manager, parent); return new edt::InstPropertiesPage (this, manager, parent);
} }
#endif
bool bool
InstService::do_activated () InstService::do_activated ()
@ -1254,6 +1276,7 @@ InstService::get_default_layer_for_pcell ()
return tl::Variant (); return tl::Variant ();
} }
#if defined(HAVE_QT)
bool bool
InstService::drag_enter_event (const db::DPoint &p, const lay::DragDropDataBase *data) InstService::drag_enter_event (const db::DPoint &p, const lay::DragDropDataBase *data)
{ {
@ -1324,7 +1347,7 @@ InstService::drag_enter_event (const db::DPoint &p, const lay::DragDropDataBase
return false; return false;
} }
bool bool
InstService::drag_move_event (const db::DPoint &p, const lay::DragDropDataBase * /*data*/) InstService::drag_move_event (const db::DPoint &p, const lay::DragDropDataBase * /*data*/)
{ {
if (m_in_drag_drop) { if (m_in_drag_drop) {
@ -1344,19 +1367,20 @@ InstService::drag_leave_event ()
} }
} }
bool
InstService::drop_event (const db::DPoint & /*p*/, const lay::DragDropDataBase * /*data*/)
{
m_in_drag_drop = false;
return false;
}
#endif
bool bool
InstService::selection_applies (const lay::ObjectInstPath &sel) const InstService::selection_applies (const lay::ObjectInstPath &sel) const
{ {
return sel.is_cell_inst (); return sel.is_cell_inst ();
} }
bool
InstService::drop_event (const db::DPoint & /*p*/, const lay::DragDropDataBase * /*data*/)
{
m_in_drag_drop = false;
return false;
}
void void
InstService::sync_to_config () InstService::sync_to_config ()
{ {
@ -1384,7 +1408,7 @@ InstService::do_begin_edit (const db::DPoint &p)
} }
if (cv.cell ()->is_proxy ()) { if (cv.cell ()->is_proxy ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Cannot put an instance into a PCell or library cell"))); throw tl::Exception (tl::to_string (tr ("Cannot put an instance into a PCell or library cell")));
} }
m_trans = cv.context_trans (); m_trans = cv.context_trans ();
@ -1430,7 +1454,7 @@ InstService::make_cell (const lay::CellView &cv)
// NOTE: do this at the beginning: creating a transaction might delete transactions behind the // NOTE: do this at the beginning: creating a transaction might delete transactions behind the
// head transaction, hence releasing (thus: deleting) cells. To prevert interference, create // head transaction, hence releasing (thus: deleting) cells. To prevert interference, create
// the transaction at the beginning. // the transaction at the beginning.
db::Transaction tr (manager (), tl::to_string (QObject::tr ("Create reference cell")), m_reference_transaction_id); db::Transaction transaction (manager (), tl::to_string (tr ("Create reference cell")), m_reference_transaction_id);
lay::LayerState layer_state = view ()->layer_snapshot (); lay::LayerState layer_state = view ()->layer_snapshot ();
@ -1498,8 +1522,8 @@ InstService::make_cell (const lay::CellView &cv)
m_has_valid_cell = true; m_has_valid_cell = true;
m_current_cell = inst_cell_index; m_current_cell = inst_cell_index;
if (! tr.is_empty ()) { if (! transaction.is_empty ()) {
m_reference_transaction_id = tr.id (); m_reference_transaction_id = transaction.id ();
} }
return std::pair<bool, db::cell_index_type> (true, inst_cell_index); return std::pair<bool, db::cell_index_type> (true, inst_cell_index);
@ -1597,10 +1621,10 @@ InstService::do_finish_edit ()
std::vector <db::cell_index_type> intersection; std::vector <db::cell_index_type> intersection;
std::set_intersection (called.begin (), called.end (), callers.begin (), callers.end (), std::back_inserter (intersection)); std::set_intersection (called.begin (), called.end (), callers.begin (), callers.end (), std::back_inserter (intersection));
if (! intersection.empty ()) { if (! intersection.empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Inserting this instance would create a recursive hierarchy"))); throw tl::Exception (tl::to_string (tr ("Inserting this instance would create a recursive hierarchy")));
} }
manager ()->transaction (tl::to_string (QObject::tr ("Create instance")), m_reference_transaction_id); manager ()->transaction (tl::to_string (tr ("Create instance")), m_reference_transaction_id);
m_reference_transaction_id = 0; m_reference_transaction_id = 0;
db::Instance i = cv->layout ().cell (cv.cell_index ()).insert (inst); db::Instance i = cv->layout ().cell (cv.cell_index ()).insert (inst);
cv->layout ().cleanup (); cv->layout ().cleanup ();

View File

@ -88,7 +88,9 @@ class PolygonService
public: public:
PolygonService (db::Manager *manager, lay::LayoutView *view); PolygonService (db::Manager *manager, lay::LayoutView *view);
#if defined(HAVE_QT)
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
#endif
virtual void do_delete (); virtual void do_delete ();
virtual void do_begin_edit (const db::DPoint &p); virtual void do_begin_edit (const db::DPoint &p);
virtual void do_mouse_move (const db::DPoint &p); virtual void do_mouse_move (const db::DPoint &p);
@ -119,7 +121,9 @@ class BoxService
public: public:
BoxService (db::Manager *manager, lay::LayoutView *view); BoxService (db::Manager *manager, lay::LayoutView *view);
#if defined(HAVE_QT)
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
#endif
virtual void do_begin_edit (const db::DPoint &p); virtual void do_begin_edit (const db::DPoint &p);
virtual void do_mouse_move (const db::DPoint &p); virtual void do_mouse_move (const db::DPoint &p);
virtual void do_mouse_move_inactive (const db::DPoint &p); virtual void do_mouse_move_inactive (const db::DPoint &p);
@ -145,7 +149,9 @@ public:
TextService (db::Manager *manager, lay::LayoutView *view); TextService (db::Manager *manager, lay::LayoutView *view);
~TextService (); ~TextService ();
#if defined(HAVE_QT)
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
#endif
virtual void do_begin_edit (const db::DPoint &p); virtual void do_begin_edit (const db::DPoint &p);
virtual void do_mouse_transform (const db::DPoint &p, db::DFTrans trans); virtual void do_mouse_transform (const db::DPoint &p, db::DFTrans trans);
virtual void do_mouse_move (const db::DPoint &p); virtual void do_mouse_move (const db::DPoint &p);
@ -177,7 +183,9 @@ public:
PathService (db::Manager *manager, lay::LayoutView *view); PathService (db::Manager *manager, lay::LayoutView *view);
~PathService (); ~PathService ();
#if defined(HAVE_QT)
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
#endif
virtual void do_begin_edit (const db::DPoint &p); virtual void do_begin_edit (const db::DPoint &p);
virtual void do_mouse_move (const db::DPoint &p); virtual void do_mouse_move (const db::DPoint &p);
virtual bool do_mouse_click (const db::DPoint &p); virtual bool do_mouse_click (const db::DPoint &p);
@ -213,7 +221,9 @@ class InstService
public: public:
InstService (db::Manager *manager, lay::LayoutView *view); InstService (db::Manager *manager, lay::LayoutView *view);
#if defined(HAVE_QT)
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent); virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
#endif
virtual void do_begin_edit (const db::DPoint &p); virtual void do_begin_edit (const db::DPoint &p);
virtual void do_mouse_move_inactive (const db::DPoint &p); virtual void do_mouse_move_inactive (const db::DPoint &p);
virtual void do_mouse_move (const db::DPoint &p); virtual void do_mouse_move (const db::DPoint &p);
@ -222,10 +232,12 @@ public:
virtual void do_finish_edit (); virtual void do_finish_edit ();
virtual void do_cancel_edit (); virtual void do_cancel_edit ();
virtual bool do_activated (); virtual bool do_activated ();
#if defined(HAVE_QT)
virtual bool drag_enter_event (const db::DPoint &p, const lay::DragDropDataBase *data); virtual bool drag_enter_event (const db::DPoint &p, const lay::DragDropDataBase *data);
virtual bool drag_move_event (const db::DPoint &p, const lay::DragDropDataBase *data); virtual bool drag_move_event (const db::DPoint &p, const lay::DragDropDataBase *data);
virtual void drag_leave_event (); virtual void drag_leave_event ();
virtual bool drop_event (const db::DPoint &p, const lay::DragDropDataBase *data); virtual bool drop_event (const db::DPoint &p, const lay::DragDropDataBase *data);
#endif
virtual bool selection_applies (const lay::ObjectInstPath &sel) const; virtual bool selection_applies (const lay::ObjectInstPath &sel) const;
protected: protected:

View File

@ -29,8 +29,6 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <QDialog>
#include "layObjectInstPath.h" #include "layObjectInstPath.h"
#include "dbInstElement.h" #include "dbInstElement.h"

View File

@ -14,6 +14,9 @@ SUBDIRS = \
buddies \ buddies \
lym \ lym \
laybasic \ laybasic \
ant \
img \
edt \
equals(HAVE_RUBY, "1") { equals(HAVE_RUBY, "1") {
SUBDIRS += drc lvs SUBDIRS += drc lvs
@ -25,9 +28,6 @@ equals(HAVE_RUBY, "1") {
SUBDIRS += \ SUBDIRS += \
klayout_main \ klayout_main \
lay \ lay \
ant \
img \
edt \
fontgen \ fontgen \
} }
@ -62,12 +62,16 @@ db.depends += gsi
rdb.depends += db rdb.depends += db
lib.depends += db lib.depends += db
plugins.depends += lib rdb db
buddies.depends += plugins lym $$LANG_DEPENDS buddies.depends += plugins lym $$LANG_DEPENDS
lym.depends += gsi $$LANG_DEPENDS lym.depends += gsi $$LANG_DEPENDS
laybasic.depends += rdb lym laybasic.depends += rdb lym
ant.depends += laybasic
img.depends += laybasic
edt.depends += laybasic
plugins.depends += lib rdb db ant
equals(HAVE_RUBY, "1") { equals(HAVE_RUBY, "1") {
MAIN_DEPENDS += drc lvs MAIN_DEPENDS += drc lvs
drc.depends += rdb lym drc.depends += rdb lym
@ -93,11 +97,7 @@ equals(HAVE_RUBY, "1") {
} }
plugins.depends += lay ant plugins.depends += lay
ant.depends += laybasic
img.depends += laybasic
edt.depends += laybasic
lay.depends += laybasic ant img edt lay.depends += laybasic ant img edt

View File

@ -26,6 +26,10 @@
#include "laybasicConfig.h" #include "laybasicConfig.h"
#include "layConverters.h" #include "layConverters.h"
#if defined(HAVE_QT)
# include <QMessageBox>
#endif
namespace lay namespace lay
{ {
@ -298,4 +302,13 @@ EditorServiceBase::deactivated ()
clear_mouse_cursors (); clear_mouse_cursors ();
} }
void
EditorServiceBase::show_error (tl::Exception &ex)
{
tl::error << ex.msg ();
#if defined(HAVE_QT)
QMessageBox::critical (0, tr ("Error"), tl::to_qstring (ex.msg ()));
#endif
}
} }

View File

@ -121,6 +121,11 @@ public:
return m_tracking_position; return m_tracking_position;
} }
/**
* @brief Shows an error where an exception is not applicable
*/
void show_error (tl::Exception &ex);
protected: protected:
virtual bool configure (const std::string &name, const std::string &value); virtual bool configure (const std::string &name, const std::string &value);
virtual void deactivated (); virtual void deactivated ();

View File

@ -112,7 +112,6 @@ DEFINES += MAKE_LAYBASIC_LIBRARY
layEditorOptionsFrame.cc \ layEditorOptionsFrame.cc \
layEditorOptionsPage.cc \ layEditorOptionsPage.cc \
layEditorOptionsPages.cc \ layEditorOptionsPages.cc \
layEditorServiceBase.cc \
layFileDialog.cc \ layFileDialog.cc \
layGenericSyntaxHighlighter.cc \ layGenericSyntaxHighlighter.cc \
layGridNetConfigPage.cc \ layGridNetConfigPage.cc \
@ -182,7 +181,6 @@ DEFINES += MAKE_LAYBASIC_LIBRARY
layEditorOptionsFrame.h \ layEditorOptionsFrame.h \
layEditorOptionsPage.h \ layEditorOptionsPage.h \
layEditorOptionsPages.h \ layEditorOptionsPages.h \
layEditorServiceBase.h \
layFileDialog.h \ layFileDialog.h \
layGenericSyntaxHighlighter.h \ layGenericSyntaxHighlighter.h \
layGridNetConfigPage.h \ layGridNetConfigPage.h \
@ -246,6 +244,7 @@ SOURCES += \
layDitherPattern.cc \ layDitherPattern.cc \
layDrawing.cc \ layDrawing.cc \
layEditable.cc \ layEditable.cc \
layEditorServiceBase.cc \
layFinder.cc \ layFinder.cc \
layGridNet.cc \ layGridNet.cc \
layFixedFont.cc \ layFixedFont.cc \
@ -292,6 +291,7 @@ HEADERS += \
layDitherPattern.h \ layDitherPattern.h \
layDrawing.h \ layDrawing.h \
layEditable.h \ layEditable.h \
layEditorServiceBase.h \
layLayoutCanvas.h \ layLayoutCanvas.h \
layLayoutView.h \ layLayoutView.h \
layFinder.h \ layFinder.h \