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
HEADERS = \
edtConfig.h \
edtDialogs.h \
edtEditorOptionsPages.h \
edtInstPropertiesPage.h \
edtMainService.h \
edtPartialService.h \
edtPCellParametersPage.h \
edtPlugin.h \
edtPropertiesPages.h \
edtPropertiesPageUtils.h \
edtService.h \
edtServiceImpl.h \
edtUtils.h \
edtCommon.h \
edtDistribute.h \
!equals(HAVE_QT, "0") {
HEADERS = \
edtDialogs.h \
edtEditorOptionsPages.h \
edtInstPropertiesPage.h \
edtPCellParametersPage.h \
edtPropertiesPages.h \
edtPropertiesPageUtils.h \
edtRecentConfigurationPage.h
FORMS = \
AlignOptionsDialog.ui \
BoxPropertiesPage.ui \
CopyModeDialog.ui \
ChangeLayerOptionsDialog.ui \
EditablePathPropertiesPage.ui \
EditorOptionsGeneric.ui \
EditorOptionsInst.ui \
EditorOptionsPath.ui \
EditorOptionsText.ui \
InstantiationForm.ui \
InstPropertiesPage.ui \
MakeArrayOptionsDialog.ui \
MakeCellOptionsDialog.ui \
PathPropertiesPage.ui \
PolygonPropertiesPage.ui \
RoundCornerOptionsDialog.ui \
TextPropertiesPage.ui \
FORMS = \
AlignOptionsDialog.ui \
BoxPropertiesPage.ui \
CopyModeDialog.ui \
ChangeLayerOptionsDialog.ui \
EditablePathPropertiesPage.ui \
EditorOptionsGeneric.ui \
EditorOptionsInst.ui \
EditorOptionsPath.ui \
EditorOptionsText.ui \
InstantiationForm.ui \
InstPropertiesPage.ui \
MakeArrayOptionsDialog.ui \
MakeCellOptionsDialog.ui \
PathPropertiesPage.ui \
PolygonPropertiesPage.ui \
RoundCornerOptionsDialog.ui \
TextPropertiesPage.ui \
DistributeOptionsDialog.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 = \
edtConfig.cc \
edtDialogs.cc \
edtEditorOptionsPages.cc \
edtInstPropertiesPage.cc \
edtMainService.cc \
edtPartialService.cc \
edtPCellParametersPage.cc \
edtPlugin.cc \
edtPropertiesPages.cc \
edtPropertiesPageUtils.cc \
edtService.cc \
edtServiceImpl.cc \
edtUtils.cc \
gsiDeclEdt.cc \
edtDistribute.cc \
edtRecentConfigurationPage.cc
edtDistribute.cc \
INCLUDEPATH += $$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;
}
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);
}

View File

@ -21,33 +21,37 @@
*/
#include <QInputDialog>
#include "dbEdgeProcessor.h"
#include "dbPolygonTools.h"
#include "dbLibrary.h"
#include "dbLibraryManager.h"
#include "tlExceptions.h"
#include "layLayoutView.h"
#include "layDialogs.h"
#include "laySelector.h"
#include "layCellSelectionForm.h"
#include "layFinder.h"
#include "layLayerProperties.h"
#include "layLayerTreeModel.h"
#include "tlProgress.h"
#include "edtPlugin.h"
#include "edtMainService.h"
#include "edtService.h"
#include "edtServiceImpl.h"
#include "edtConfig.h"
#include "edtDialogs.h"
#include "edtEditorOptionsPages.h"
#include "edtDistribute.h"
#include <QMessageBox>
#include <QFontInfo>
#include <QWidgetAction>
#if defined(HAVE_QT)
# include "layDialogs.h"
# 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
{
@ -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_array_a (0.0, 1.0), m_array_b (1.0, 0.0),
m_array_na (1), m_array_nb (1),
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)
m_router (0.0), m_rinner (0.0), m_npoints (64), m_undo_before_apply (true)
{
// .. 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 ()
@ -89,6 +94,8 @@ MainService::~MainService ()
// .. nothing yet ..
}
#if defined(HAVE_QT)
edt::RoundCornerOptionsDialog *
MainService::round_corners_dialog ()
{
@ -143,6 +150,8 @@ MainService::make_array_options_dialog ()
return mp_make_array_options_dialog;
}
#endif
void
MainService::menu_activated (const std::string &symbol)
{
@ -298,10 +307,10 @@ MainService::cm_descend ()
}
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 ()) {
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
@ -391,56 +400,58 @@ MainService::cm_flatten_insts ()
tl_assert (view ()->is_editable ());
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> ();
for (std::vector<edt::Service *>::const_iterator es = edt_services.begin (); es != edt_services.end (); ++es) {
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 (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 ());
if (cv.is_valid ()) {
const lay::CellView &cv = view ()->cellview (r->cv_index ());
if (cv.is_valid ()) {
db::Cell &target_cell = cv->layout ().cell (r->cell_index ());
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);
db::Cell &target_cell = cv->layout ().cell (r->cell_index ());
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);
}
}
}
// 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
@ -449,7 +460,7 @@ MainService::cm_move_hier_up ()
view ()->cancel_edits ();
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> ();
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) {
cv_index = 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 ();
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;
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
// 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) {
@ -901,7 +912,7 @@ MainService::cm_resolve_arefs ()
cv_index = r->cv_index ();
} else if (cv_index != int (r->cv_index ())) {
// 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);
}
@ -917,7 +928,7 @@ MainService::cm_resolve_arefs ()
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) {
@ -972,7 +983,7 @@ MainService::cm_make_cell ()
if (cv_index < 0) {
cv_index = 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);
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
db::Box selection_bbox;
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 (edt::Service::objects::const_iterator r = (*es)->selection ().begin (); r != (*es)->selection ().end (); ++r) {
if (r->is_cell_inst ()) {
selection_bbox += db::ICplxTrans (r->trans ()) * r->back ().bbox (bc);
} else {
selection_bbox += db::ICplxTrans (r->trans ()) * r->shape ().bbox ();
}
// Compute the selection's bbox to establish a good origin for the new cell
db::Box selection_bbox;
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 (edt::Service::objects::const_iterator r = (*es)->selection ().begin (); r != (*es)->selection ().end (); ++r) {
if (r->is_cell_inst ()) {
selection_bbox += db::ICplxTrans (r->trans ()) * r->back ().bbox (bc);
} else {
selection_bbox += db::ICplxTrans (r->trans ()) * r->shape ().bbox ();
}
}
}
if (selection_bbox.empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("The selection is empty. Cannot create a cell from an empty selection.")));
}
if (selection_bbox.empty ()) {
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 ());
// create target cell
db::Cell &target_cell = cv->layout ().cell (target_ci);
db::cell_index_type target_ci = cv->layout ().add_cell (m_make_cell_name.c_str ());
// create target cell
db::Cell &target_cell = cv->layout ().cell (target_ci);
// create target cell instance
db::Vector ref;
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);
}
// create target cell instance
db::Vector ref;
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);
}
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::Instance target_cell_inst = cv.cell ()->insert (db::CellInstArray (db::CellInst (target_ci), 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);
target_cell.transform (new_inst, to * db::ICplxTrans (r->trans ()));
db::Instance new_inst = target_cell.insert (r->back ().inst_ptr);
target_cell.transform (new_inst, to * db::ICplxTrans (r->trans ()));
} else {
} else {
db::Shapes &target_shapes = target_cell.shapes (r->layer ());
db::Shape new_shape = target_shapes.insert (r->shape ());
target_shapes.transform (new_shape, to * db::ICplxTrans (r->trans ()));
}
db::Shapes &target_shapes = target_cell.shapes (r->layer ());
db::Shape new_shape = target_shapes.insert (r->shape ());
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 {
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> ();
@ -1110,7 +1123,7 @@ MainService::cm_convert_to_cell ()
}
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.
@ -1132,6 +1145,7 @@ MainService::cm_convert_to_cell ()
void
MainService::cm_convert_to_pcell ()
{
#if defined(HAVE_QT) // @@@
tl_assert (view ()->is_editable ());
check_no_guiding_shapes ();
@ -1143,7 +1157,7 @@ MainService::cm_convert_to_pcell ()
num_selected += (*es)->selection ().size ();
for (edt::Service::obj_iterator s = (*es)->selection ().begin (); s != (*es)->selection ().end (); ++s) {
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;
QString item = QInputDialog::getItem (view ()->widget (),
QObject::tr ("Select Target PCell"),
QObject::tr ("Select the PCell the shape should be converted into"),
tr ("Select Target PCell"),
tr ("Select the PCell the shape should be converted into"),
items, 0, false, &ok);
if (! ok) {
return;
@ -1210,7 +1224,7 @@ MainService::cm_convert_to_pcell ()
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<lay::ObjectInstPath> new_selection;
@ -1219,7 +1233,7 @@ MainService::cm_convert_to_pcell ()
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
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) {
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
@ -1290,7 +1304,7 @@ MainService::cm_convert_to_pcell ()
}
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 ();
@ -1299,6 +1313,7 @@ MainService::cm_convert_to_pcell ()
manager ()->commit ();
throw;
}
#endif
}
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 (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 ());
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 ());
@ -1380,7 +1395,7 @@ MainService::cm_round_corners ()
}
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
@ -1403,9 +1418,11 @@ MainService::cm_round_corners ()
rinner *= 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)) {
return;
}
#endif
if (! m_undo_before_apply || ! has_extracted) {
out.swap (in);
@ -1420,7 +1437,7 @@ MainService::cm_round_corners ()
ep.merge (out, primary, 0 /*min_wc*/, true /*resolve holes*/, true /*min coherence*/);
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
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
MainService::cm_size ()
{
#if defined(HAVE_QT) // @@@
tl_assert (view ()->is_editable ());
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 (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 ());
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 ());
@ -1502,13 +1520,13 @@ MainService::cm_size ()
}
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;
QString s = QInputDialog::getText (view ()->widget (),
QObject::tr ("Sizing"),
QObject::tr ("Sizing (in micron, positive or negative). Two values (dx, dy) for anisotropic sizing."),
tr ("Sizing"),
tr ("Sizing (in micron, positive or negative). Two values (dx, dy) for anisotropic sizing."),
QLineEdit::Normal, QString::fromUtf8 ("0.0"),
&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*/);
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
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 ();
#endif
}
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 (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 ());
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 ());
@ -1618,7 +1637,7 @@ MainService::boolean_op (int mode)
}
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;
@ -1656,7 +1675,7 @@ MainService::boolean_op (int mode)
}
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
// 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> ();
#if defined(HAVE_QT)
if (! align_options_dialog ()->exec_dialog (m_align_hmode, m_align_vmode, m_align_visible_layers)) {
return;
}
#endif
db::DBox prim_box;
bool has_secondary = false;
@ -1812,7 +1833,7 @@ MainService::cm_align ()
if (! prim_box.empty ()) {
view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Alignment")));
manager ()->transaction (tl::to_string (tr ("Alignment")));
// do the alignment
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> ();
#if defined(HAVE_QT)
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_distribute_visible_layers)) {
return;
}
#endif
if (! m_hdistribute && ! m_vdistribute) {
return;
@ -1946,7 +1969,7 @@ MainService::cm_distribute ()
{
view ()->cancel_edits ();
manager ()->transaction (tl::to_string (QObject::tr ("Distribution")));
manager ()->transaction (tl::to_string (tr ("Distribution")));
// do the distribution
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) {
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
bool has_undo = (m_array_na * m_array_nb < 1000);
// undo support for small arrays only
bool has_undo = (m_array_na * m_array_nb < 1000);
// No undo support currently - the undo buffering is pretty inefficient right now.
if (! has_undo) {
manager ()->clear ();
} else {
manager ()->transaction (tl::to_string (QObject::tr ("Make array")));
}
// No undo support currently - the undo buffering is pretty inefficient right now.
if (! has_undo) {
manager ()->clear ();
} else {
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 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;
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;
}
} 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
MainService::cm_tap ()
{
#if defined(HAVE_QT) // @@@
if (! view ()->view_object_widget ()->mouse_in_window ()) {
return;
}
@ -2134,6 +2160,7 @@ MainService::cm_tap ()
}
}
#endif
}
void
@ -2147,7 +2174,7 @@ MainService::cm_change_layer ()
// get (common) cellview index of the selected shapes
for (SelectionIterator s (view ()); ! s.at_end (); ++s) {
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 ());
}
@ -2159,24 +2186,24 @@ MainService::cm_change_layer ()
lay::LayerPropertiesConstIterator cl = view ()->current_layer ();
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 ()) {
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);
int layer = cl->layer_index ();
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 (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 {
// create this layer now
@ -2205,7 +2232,7 @@ MainService::cm_change_layer ()
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 ();
@ -2266,7 +2293,7 @@ MainService::cm_change_layer ()
manager ()->commit ();
} 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) {
if (! s->is_cell_inst ()) {
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 (! 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);

View File

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

View File

@ -21,8 +21,6 @@
*/
#include <QMessageBox>
#include "dbVector.h"
#include "layLayoutView.h"
#include "laySnap.h"
@ -31,9 +29,12 @@
#include "edtPartialService.h"
#include "edtService.h"
#include "edtConfig.h"
#include "edtDialogs.h"
#include "edtPlugin.h"
#include "edtEditorOptionsPages.h"
#if defined(HAVE_QT)
# include "edtDialogs.h"
# include "edtEditorOptionsPages.h"
#endif
#include <cmath>
@ -1010,8 +1011,10 @@ PartialShapeFinder::visit_cell (const db::Cell &cell, const db::Box &search_box,
// -----------------------------------------------------------------------------
// Main Service implementation
PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root)
: QObject (),
PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay::Dispatcher *root) :
#if defined(HAVE_QT)
QObject (),
#endif
lay::EditorServiceBase (view),
db::Object (manager),
mp_view (view),
@ -1027,9 +1030,11 @@ PartialService::PartialService (db::Manager *manager, lay::LayoutView *view, lay
m_hover (false),
m_hover_wait (false)
{
#if defined(HAVE_QT)
m_timer.setInterval (100 /*hover time*/);
m_timer.setSingleShot (true);
connect (&m_timer, SIGNAL (timeout ()), this, SLOT (timeout ()));
#endif
}
PartialService::~PartialService ()
@ -1077,7 +1082,9 @@ void
PartialService::hover_reset ()
{
if (m_hover_wait) {
#if defined(HAVE_QT)
m_timer.stop ();
#endif
m_hover_wait = false;
}
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 ()
{
m_hover_wait = false;
@ -1209,6 +1218,7 @@ PartialService::timeout ()
resize_inst_markers (n_inst_marker, true);
}
#endif
void
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 ()) {
m_hover_wait = true;
#if defined(HAVE_QT)
m_timer.start ();
#endif
m_hover_point = p;
}
@ -1622,8 +1634,7 @@ PartialService::mouse_press_event (const db::DPoint &p, unsigned int buttons, bo
try {
partial_select (db::DBox (p, p), lay::Editable::Replace);
} catch (tl::Exception &ex) {
tl::error << ex.msg ();
QMessageBox::critical (0, QObject::tr ("Error"), tl::to_qstring (ex.msg ()));
show_error (ex);
// clear selection
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
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
// 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 ();
} catch (tl::Exception &ex) {
tl::error << ex.msg ();
QMessageBox::critical (0, QObject::tr ("Error"), tl::to_qstring (ex.msg ()));
show_error (ex);
// clear selection
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
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
db::DPoint new_point_d = snap (p);
@ -2018,8 +2028,7 @@ PartialService::mouse_release_event (const db::DPoint &p, unsigned int buttons,
try {
partial_select (db::DBox (m_p1, m_p2), mode);
} catch (tl::Exception &ex) {
tl::error << ex.msg ();
QMessageBox::critical (0, QObject::tr ("Error"), tl::to_qstring (ex.msg ()));
show_error (ex);
// clear selection
partial_select (db::DBox (), lay::Editable::Reset);
}

View File

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

View File

@ -21,8 +21,11 @@
*/
#include "layTipDialog.h"
#include "layEditorOptionsPages.h"
#if defined(HAVE_QT)
# include "layTipDialog.h"
# include "layEditorOptionsPages.h"
#endif
#include "layDispatcher.h"
#include "layLayoutView.h"
#include "edtPlugin.h"
@ -31,26 +34,36 @@
#include "edtServiceImpl.h"
#include "edtMainService.h"
#include "edtPartialService.h"
#include "edtEditorOptionsPages.h"
#include "edtRecentConfigurationPage.h"
#if defined(HAVE_QT)
# include "edtEditorOptionsPages.h"
# include "edtRecentConfigurationPage.h"
#endif
#include <QApplication>
#include <QLayout>
#if defined(HAVE_QT)
# include <QApplication>
# include <QLayout>
#endif
namespace edt
{
#if defined(HAVE_QT)
edt::RecentConfigurationPage::ConfigurationDescriptor shape_cfg_descriptors[] =
{
edt::RecentConfigurationPage::ConfigurationDescriptor ("", tl::to_string (tr ("Layer")), edt::RecentConfigurationPage::Layer),
};
#endif
#if defined(HAVE_QT)
static
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",
&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
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"));
}
#if defined(HAVE_QT)
static
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])]));
ret.push_back (new edt::EditorOptionsText (view, dispatcher));
}
#else
static void get_text_editor_options_pages () { }
#endif
static
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"));
}
#if defined(HAVE_QT)
static
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])]));
ret.push_back (new EditorOptionsPath (view, dispatcher));
}
#else
static void get_path_editor_options_pages () { }
#endif
static
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"));
}
#if defined(HAVE_QT)
static
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 EditorOptionsInst (view, dispatcher));
}
#else
static void get_inst_editor_options_pages () { }
#endif
template <class Svc>
class PluginDeclaration
: public PluginDeclarationBase
{
public:
#if defined(HAVE_QT)
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) (std::vector <lay::EditorOptionsPage *> &, lay::LayoutView *, lay::Dispatcher *) = 0)
@ -161,6 +187,15 @@ public:
{
// .. 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
{
@ -169,16 +204,19 @@ public:
}
}
#if defined(HAVE_QT)
virtual lay::ConfigPage *config_page (QWidget * /*parent*/, std::string & /*title*/) const
{
return 0;
}
#endif
virtual void get_menu_entries (std::vector<lay::MenuEntry> & /*menu_entries*/) const
{
// .. nothing yet ..
}
#if defined(HAVE_QT)
virtual void get_editor_options_pages (std::vector<lay::EditorOptionsPage *> &pages, lay::LayoutView *view, lay::Dispatcher *root) const
{
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
{
@ -214,31 +253,35 @@ private:
std::string m_mouse_mode;
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 *);
#else
void (*mp_pages_f) ();
#endif
};
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,
"edt::Service(Polygons)"
);
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,
"edt::Service(Boxes)"
);
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,
"edt::Service(Texts)"
);
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,
"edt::Service(Paths)"
);
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,
"edt::Service(CellInstances)"
);
@ -264,41 +307,43 @@ public:
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
{
return 0;
}
#endif
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
{
lay::PluginDeclaration::get_menu_entries (menu_entries);
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::ascend", "ascend", "zoom_menu.end", tl::to_string (QObject::tr ("Ascend")) + "(Ctrl+A)"));
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 (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::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_tap", "tap", "edit_menu.selection_menu.end", tl::to_string (QObject::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_distribute", "distribute:edit_mode", "edit_menu.selection_menu.end", tl::to_string (QObject::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_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_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_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_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_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_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 (tr ("Tap")) + "(T)"));
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 (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 (tr ("Round Corners"))));
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 (tr ("Merge Shapes"))));
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 (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 (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::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_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_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_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_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_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_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_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 (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 (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 (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 (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 (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 (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)
@ -327,12 +372,14 @@ public:
return false;
}
#if defined(HAVE_QT)
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
EditorOptionsGeneric *generic_opt = new EditorOptionsGeneric (view, dispatcher);
pages.push_back (generic_opt);
}
#endif
virtual void initialize (lay::Dispatcher *root)
{
@ -343,18 +390,21 @@ public:
mp_root = root;
#if defined(HAVE_QT)
// 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_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_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_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_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_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 (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 (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 (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 (tr ("Diff<:/cm_diff.png>{Compute difference of shape with background}")), cfg_edit_combine_mode, CMConverter ().to_string (CM_Diff)));
update_menu (CM_Add);
#endif
}
void update_menu (combine_mode_type cm)
{
#if defined(HAVE_QT)
lay::Dispatcher *mp = lay::Dispatcher::instance ();
if (! mp || ! mp->has_ui ()) {
return;
@ -363,21 +413,22 @@ public:
lay::Action *combine_menu = mp->menu ()->action ("@toolbar.combine_mode");
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");
} 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");
} 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");
} 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");
} 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");
}
#endif
}
void initialized (lay::Dispatcher *root)
@ -387,22 +438,27 @@ public:
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;
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 ()) {
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"
"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.")),
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.")),
"has-non-add-edit-combine-mode");
if (td.exec_dialog ()) {
// Don't bother the user with more dialogs.
return;
}
}
#endif
}
private:
@ -410,11 +466,12 @@ private:
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
commit_recent (lay::LayoutView *view)
{
#if defined(HAVE_QT)
lay::EditorOptionsPages *eo_pages = view->editor_options_pages ();
if (!eo_pages) {
return;
@ -425,6 +482,7 @@ commit_recent (lay::LayoutView *view)
(*op)->commit_recent (view);
}
}
#endif
}
class PartialPluginDeclaration
@ -470,7 +528,7 @@ private:
};
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,
"edt::PartialService"
);

View File

@ -26,8 +26,10 @@
#include "dbLibrary.h"
#include "edtPlugin.h"
#include "edtService.h"
#include "edtEditorOptionsPages.h"
#include "edtDialogs.h"
#if defined(HAVE_QT)
# include "edtEditorOptionsPages.h"
# include "edtDialogs.h"
#endif
#include "layFinder.h"
#include "layLayoutView.h"
#include "laySnap.h"
@ -312,6 +314,7 @@ Service::copy ()
void
Service::copy_selected ()
{
#if defined(HAVE_QT)
edt::CopyModeDialog mode_dialog (view ()->widget ());
bool need_to_ask_for_copy_mode = false;
@ -340,33 +343,49 @@ Service::copy_selected ()
dispatcher ()->config_end ();
}
// 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;
copy_selected (inst_mode);
}
#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) {
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) {
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 ());
}
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
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 ();
return true;
} else {
@ -1141,7 +1160,7 @@ Service::display_status (bool transient)
std::string msg;
if (! transient) {
msg = tl::to_string (QObject::tr ("selected: "));
msg = tl::to_string (tr ("selected: "));
}
db::Instance inst = r->back ().inst_ptr;
@ -1149,12 +1168,12 @@ Service::display_status (bool transient)
db::Vector a, b;
unsigned long amax = 0, bmax = 0;
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 {
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);
view ()->message (msg, transient ? 10 : 10000);
@ -1163,31 +1182,31 @@ Service::display_status (bool transient)
std::string msg;
if (! transient) {
msg = tl::to_string (QObject::tr ("selected: "));
msg = tl::to_string (tr ("selected: "));
}
if (r->shape ().is_box ()) {
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 ()) {
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 ()) {
size_t npoints = 0;
for (db::Shape::polygon_edge_iterator e = r->shape ().begin_edge (); ! e.at_end (); ++e) {
++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 ()) {
size_t npoints = 0;
for (db::Shape::point_iterator p = r->shape ().begin_point (); p != r->shape ().end_point (); ++p) {
++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 ()) {
msg += tl::to_string (QObject::tr (" on "));
msg += tl::to_string (tr (" on "));
std::string ln = layout.get_properties (r->layer ()).to_string ();
for (lay::LayerPropertiesConstIterator lp = view ()->begin_layers (); ! lp.at_end (); ++lp) {
@ -1198,7 +1217,7 @@ Service::display_status (bool transient)
}
msg += ln;
msg += tl::to_string (QObject::tr (" in "));
msg += tl::to_string (tr (" in "));
msg += path_to_string (layout, *r);
view ()->message (msg, transient ? 10 : 10000);

View File

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

View File

@ -23,8 +23,10 @@
#include "edtMainService.h"
#include "edtServiceImpl.h"
#include "edtPropertiesPages.h"
#include "edtInstPropertiesPage.h"
#if defined(HAVE_QT)
# include "edtPropertiesPages.h"
# include "edtInstPropertiesPage.h"
#endif
#include "edtService.h"
#include "edtPlugin.h"
#include "dbEdge.h"
@ -36,11 +38,15 @@
#include "layMarker.h"
#include "layLayerProperties.h"
#include "layLayoutView.h"
#include "layTipDialog.h"
#include "layDragDropData.h"
#include <QInputDialog>
#include <QApplication>
#if defined(HAVE_QT)
# include "layTipDialog.h"
# include "layDragDropData.h"
#endif
#if defined(HAVE_QT)
# include <QApplication>
#endif
namespace edt
{
@ -72,7 +78,7 @@ ShapeEditService::get_edit_layer ()
lay::LayerPropertiesConstIterator cl = view ()->current_layer ();
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 ();
@ -80,20 +86,22 @@ ShapeEditService::get_edit_layer ()
int layer = cl->layer_index ();
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)) {
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");
td.exec_dialog ();
}
#endif
if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) {
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 {
// create this layer now
@ -126,7 +134,7 @@ ShapeEditService::get_edit_layer ()
mp_cell = &(mp_layout->cell (cv.cell_index ()));
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;
}
#if defined(HAVE_QT)
if (! cl->visible (true)) {
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");
td.exec_dialog ();
}
#endif
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) {
manager ()->transaction (tl::to_string (QObject::tr ("Create polygon")));
manager ()->transaction (tl::to_string (tr ("Create polygon")));
cell ().shapes (layer ()).insert (poly);
manager ()->commit ();
@ -316,7 +326,7 @@ ShapeEditService::deliver_shape (const db::Polygon &poly)
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
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)
{
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);
manager ()->commit ();
} else {
@ -352,7 +362,7 @@ void
ShapeEditService::deliver_shape (const db::Box &box)
{
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);
manager ()->commit ();
} else {
@ -370,11 +380,13 @@ PolygonService::PolygonService (db::Manager *manager, lay::LayoutView *view)
// .. nothing yet ..
}
#if defined(HAVE_QT)
lay::PropertiesPage *
PolygonService::properties_page (db::Manager *manager, QWidget *parent)
{
return new edt::PolygonPropertiesPage (this, manager, parent);
}
#endif
void
PolygonService::do_begin_edit (const db::DPoint &p)
@ -469,7 +481,7 @@ PolygonService::get_polygon () const
db::Polygon poly;
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;
@ -486,7 +498,7 @@ PolygonService::get_polygon () const
poly.assign_hull (points_dbu.begin (), points_dbu.end (), true, true /*remove reflected*/);
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;
@ -699,11 +711,13 @@ BoxService::BoxService (db::Manager *manager, lay::LayoutView *view)
// .. nothing yet ..
}
#if defined(HAVE_QT)
lay::PropertiesPage *
BoxService::properties_page (db::Manager *manager, QWidget *parent)
{
return new edt::BoxPropertiesPage (this, manager, parent);
}
#endif
void
BoxService::do_begin_edit (const db::DPoint &p)
@ -797,11 +811,13 @@ TextService::~TextService ()
// .. nothing yet ..
}
#if defined(HAVE_QT)
lay::PropertiesPage *
TextService::properties_page (db::Manager *manager, QWidget *parent)
{
return new edt::TextPropertiesPage (this, manager, parent);
}
#endif
void
TextService::do_begin_edit (const db::DPoint &p)
@ -890,16 +906,17 @@ TextService::do_finish_edit ()
{
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 ());
manager ()->commit ();
commit_recent (view ());
#if defined(HAVE_QT)
if (! view ()->text_visible ()) {
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",
lay::TipDialog::yesno_buttons);
@ -910,6 +927,7 @@ TextService::do_finish_edit ()
}
}
#endif
}
void
@ -985,6 +1003,7 @@ PathService::~PathService ()
// .. nothing yet ..
}
#if defined(HAVE_QT)
lay::PropertiesPage *
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);
}
}
#endif
void
PathService::do_begin_edit (const db::DPoint &p)
@ -1084,7 +1104,7 @@ PathService::do_finish_edit ()
{
// one point is reserved for the "current one"
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 ();
@ -1225,11 +1245,13 @@ InstService::InstService (db::Manager *manager, lay::LayoutView *view)
// .. nothing yet ..
}
#if defined(HAVE_QT)
lay::PropertiesPage *
InstService::properties_page (db::Manager *manager, QWidget *parent)
{
return new edt::InstPropertiesPage (this, manager, parent);
}
#endif
bool
InstService::do_activated ()
@ -1254,6 +1276,7 @@ InstService::get_default_layer_for_pcell ()
return tl::Variant ();
}
#if defined(HAVE_QT)
bool
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;
}
bool
bool
InstService::drag_move_event (const db::DPoint &p, const lay::DragDropDataBase * /*data*/)
{
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
InstService::selection_applies (const lay::ObjectInstPath &sel) const
{
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
InstService::sync_to_config ()
{
@ -1384,7 +1408,7 @@ InstService::do_begin_edit (const db::DPoint &p)
}
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 ();
@ -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
// head transaction, hence releasing (thus: deleting) cells. To prevert interference, create
// 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 ();
@ -1498,8 +1522,8 @@ InstService::make_cell (const lay::CellView &cv)
m_has_valid_cell = true;
m_current_cell = inst_cell_index;
if (! tr.is_empty ()) {
m_reference_transaction_id = tr.id ();
if (! transaction.is_empty ()) {
m_reference_transaction_id = transaction.id ();
}
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::set_intersection (called.begin (), called.end (), callers.begin (), callers.end (), std::back_inserter (intersection));
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;
db::Instance i = cv->layout ().cell (cv.cell_index ()).insert (inst);
cv->layout ().cleanup ();

View File

@ -88,7 +88,9 @@ class PolygonService
public:
PolygonService (db::Manager *manager, lay::LayoutView *view);
#if defined(HAVE_QT)
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
#endif
virtual void do_delete ();
virtual void do_begin_edit (const db::DPoint &p);
virtual void do_mouse_move (const db::DPoint &p);
@ -119,7 +121,9 @@ class BoxService
public:
BoxService (db::Manager *manager, lay::LayoutView *view);
#if defined(HAVE_QT)
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
#endif
virtual void do_begin_edit (const db::DPoint &p);
virtual void do_mouse_move (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 ();
#if defined(HAVE_QT)
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
#endif
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_move (const db::DPoint &p);
@ -177,7 +183,9 @@ public:
PathService (db::Manager *manager, lay::LayoutView *view);
~PathService ();
#if defined(HAVE_QT)
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
#endif
virtual void do_begin_edit (const db::DPoint &p);
virtual void do_mouse_move (const db::DPoint &p);
virtual bool do_mouse_click (const db::DPoint &p);
@ -213,7 +221,9 @@ class InstService
public:
InstService (db::Manager *manager, lay::LayoutView *view);
#if defined(HAVE_QT)
virtual lay::PropertiesPage *properties_page (db::Manager *manager, QWidget *parent);
#endif
virtual void do_begin_edit (const db::DPoint &p);
virtual void do_mouse_move_inactive (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_cancel_edit ();
virtual bool do_activated ();
#if defined(HAVE_QT)
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 void drag_leave_event ();
virtual bool drop_event (const db::DPoint &p, const lay::DragDropDataBase *data);
#endif
virtual bool selection_applies (const lay::ObjectInstPath &sel) const;
protected:

View File

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

View File

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

View File

@ -26,6 +26,10 @@
#include "laybasicConfig.h"
#include "layConverters.h"
#if defined(HAVE_QT)
# include <QMessageBox>
#endif
namespace lay
{
@ -298,4 +302,13 @@ EditorServiceBase::deactivated ()
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;
}
/**
* @brief Shows an error where an exception is not applicable
*/
void show_error (tl::Exception &ex);
protected:
virtual bool configure (const std::string &name, const std::string &value);
virtual void deactivated ();

View File

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