mirror of https://github.com/KLayout/klayout.git
WIP: reader starts becoming functional.
This commit is contained in:
parent
aece8b299f
commit
211524a0c0
|
|
@ -1147,21 +1147,10 @@ void DecoratedLineEdit::resizeEvent (QResizeEvent * /*event*/)
|
|||
// InteractiveListWidget implementation
|
||||
|
||||
InteractiveListWidget::InteractiveListWidget (QWidget *parent)
|
||||
: QListWidget (parent), m_drag_and_drop_enabled (false)
|
||||
: QListWidget (parent)
|
||||
{
|
||||
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||
setDragDropMode (QAbstractItemView::InternalMove);
|
||||
enable_drag_and_drop (true);
|
||||
}
|
||||
|
||||
void
|
||||
InteractiveListWidget::enable_drag_and_drop (bool f)
|
||||
{
|
||||
if (f != m_drag_and_drop_enabled) {
|
||||
m_drag_and_drop_enabled = f;
|
||||
setDragEnabled (f);
|
||||
refresh_flags ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1296,7 +1285,7 @@ void
|
|||
InteractiveListWidget::refresh_flags ()
|
||||
{
|
||||
for (int i = 0; i < count (); ++i) {
|
||||
item (i)->setFlags (Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled | (m_drag_and_drop_enabled ? Qt::ItemIsDragEnabled : Qt::ItemFlags ()));
|
||||
item (i)->setFlags (Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -475,14 +475,6 @@ public:
|
|||
*/
|
||||
InteractiveListWidget (QWidget *parent = 0);
|
||||
|
||||
/**
|
||||
* @brief Configures this list for drag and drop
|
||||
*
|
||||
* Call this method with a "true" value to enable drag and drop or "false" to disable.
|
||||
* By default, drag and drop is enabled.
|
||||
*/
|
||||
void enable_drag_and_drop (bool f);
|
||||
|
||||
/**
|
||||
* @brief Sets the items in the widget
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public:
|
|||
virtual std::string format_name () const { return "MAG"; }
|
||||
virtual std::string format_desc () const { return "Magic"; }
|
||||
virtual std::string format_title () const { return "MAG (Magic layout format)"; }
|
||||
virtual std::string file_format () const { return "MAG files (*.MAG *.msg *.mag.gz *.MAG.gz)"; }
|
||||
virtual std::string file_format () const { return "Magic files (*.MAG *.mag *.mag.gz *.MAG.gz)"; }
|
||||
|
||||
virtual bool detect (tl::InputStream &s) const
|
||||
{
|
||||
|
|
@ -89,6 +89,7 @@ public:
|
|||
tl::make_member (&db::MAGReaderOptions::layer_map, "layer-map") +
|
||||
tl::make_member (&db::MAGReaderOptions::create_other_layers, "create-other-layers") +
|
||||
tl::make_member (&db::MAGReaderOptions::keep_layer_names, "keep-layer-names") +
|
||||
tl::make_member (&db::MAGReaderOptions::merge, "merge") +
|
||||
tl::make_element<std::vector<std::string>, db::MAGReaderOptions> (&db::MAGReaderOptions::lib_paths, "lib-paths",
|
||||
tl::make_member<std::string, std::vector<std::string>::const_iterator, std::vector<std::string> > (&std::vector<std::string>::begin, &std::vector<std::string>::end, &std::vector<std::string>::push_back, "lib-path")
|
||||
)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ public:
|
|||
: lambda (1.0),
|
||||
dbu (0.001),
|
||||
create_other_layers (true),
|
||||
keep_layer_names (false)
|
||||
keep_layer_names (false),
|
||||
merge (true)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
|
@ -95,6 +96,14 @@ public:
|
|||
*/
|
||||
bool keep_layer_names;
|
||||
|
||||
/**
|
||||
* @brief A flag indicating whether to merge boxes into polygons
|
||||
*
|
||||
* If this flag is set to true (the default), the boxes of the Magic
|
||||
* layout files are merged into polygons.
|
||||
*/
|
||||
bool merge;
|
||||
|
||||
/**
|
||||
* @brief The library paths
|
||||
*
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -133,11 +133,26 @@ public:
|
|||
|
||||
private:
|
||||
tl::TextInputStream m_stream;
|
||||
tl::TextInputStream *mp_current_stream;
|
||||
tl::AbsoluteProgress m_progress;
|
||||
double m_lambda, m_dbu;
|
||||
std::vector<std::string> m_lib_paths;
|
||||
bool m_merge;
|
||||
std::map<std::string, db::cell_index_type> m_cells_read;
|
||||
std::map<std::string, std::pair<std::string, db::cell_index_type> > m_cells_to_read;
|
||||
std::map<std::string, std::string> m_use_lib_paths;
|
||||
db::VCplxTrans m_dbu_trans_inv;
|
||||
std::string m_tech;
|
||||
|
||||
void do_read (db::Layout &layout);
|
||||
void do_read (db::Layout &layout, db::cell_index_type to_cell, tl::TextInputStream &stream);
|
||||
void do_read_part (db::Layout &layout, db::cell_index_type cell_index, tl::TextInputStream &stream);
|
||||
void do_merge_part (db::Layout &layout, db::cell_index_type cell_index);
|
||||
bool resolve_path(const std::string &path, std::string &real_path);
|
||||
std::string cell_name_from_path (const std::string &path);
|
||||
db::cell_index_type cell_from_path (const std::string &path, Layout &layout);
|
||||
void read_rect (tl::Extractor &ex, Layout &layout, cell_index_type cell_index, unsigned int layer);
|
||||
void read_rlabel (tl::Extractor &ex, Layout &layout, cell_index_type cell_index);
|
||||
void read_cell_instance (tl::Extractor &ex, tl::TextInputStream &stream, Layout &layout, cell_index_type cell_index);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,16 @@ static void set_keep_layer_names (db::LoadLayoutOptions *options, bool l)
|
|||
options->get_options<db::MAGReaderOptions> ().keep_layer_names = l;
|
||||
}
|
||||
|
||||
static bool merge (const db::LoadLayoutOptions *options)
|
||||
{
|
||||
return options->get_options<db::MAGReaderOptions> ().merge;
|
||||
}
|
||||
|
||||
static void set_merge (db::LoadLayoutOptions *options, bool l)
|
||||
{
|
||||
options->get_options<db::MAGReaderOptions> ().merge = l;
|
||||
}
|
||||
|
||||
// extend lay::LoadLayoutOptions with the MAG options
|
||||
static
|
||||
gsi::ClassExt<db::LoadLayoutOptions> mag_reader_options (
|
||||
|
|
@ -171,6 +181,22 @@ gsi::ClassExt<db::LoadLayoutOptions> mag_reader_options (
|
|||
"\n"
|
||||
"This method has been added in version 0.26.2."
|
||||
) +
|
||||
gsi::method_ext ("mag_merge?", &merge,
|
||||
"@brief Gets a value indicating whether boxes are merged into polygons\n"
|
||||
"@return True, if boxes are merged.\n"
|
||||
"\n"
|
||||
"When set to true, the boxes of the Magic layout files are merged into (manhattan) polygons where possible.\n"
|
||||
"\n"
|
||||
"This method has been added in version 0.26.2."
|
||||
) +
|
||||
gsi::method_ext ("mag_merge=", &set_merge, gsi::arg ("merge"),
|
||||
"@brief sets a value indicating whether boxes are merged into polygons\n"
|
||||
"@param merge True, if boxes to be merged into polygons.\n"
|
||||
"\n"
|
||||
"See \\mag_merge? for a description of this property.\n"
|
||||
"\n"
|
||||
"This method has been added in version 0.26.2."
|
||||
) +
|
||||
gsi::method_ext ("mag_library_paths=", &set_mag_library_paths, gsi::arg ("lib_paths"),
|
||||
"@brief Specifies the locations where to look up libraries (in this order)\n"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -35,13 +35,24 @@
|
|||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="dbu_le">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Lambda value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Micron</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="keep_names_cbx">
|
||||
<property name="text">
|
||||
<string>Don't attempt to translate into layer/datatype numbers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -58,37 +69,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="keep_names_cbx">
|
||||
<property name="text">
|
||||
<string>Don't attempt to translate into layer/datatype numbers</string>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="dbu_le">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Keep layer names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lambda_le"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Micron</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Lambda value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
|
|
@ -96,6 +93,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lambda_le"/>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="merge_cbx">
|
||||
<property name="text">
|
||||
<string>Merge boxes into polygons</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Layout healing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ MAGReaderOptionPage::setup (const db::FormatSpecificReaderOptions *o, const db::
|
|||
mp_ui->layer_map->set_layer_map (options->layer_map);
|
||||
mp_ui->read_all_cbx->setChecked (options->create_other_layers);
|
||||
mp_ui->keep_names_cbx->setChecked (options->keep_layer_names);
|
||||
mp_ui->merge_cbx->setChecked (options->merge);
|
||||
|
||||
mp_ui->lib_path->set_values (options->lib_paths);
|
||||
}
|
||||
|
|
@ -92,6 +93,7 @@ MAGReaderOptionPage::commit (db::FormatSpecificReaderOptions *o, const db::Techn
|
|||
options->layer_map = mp_ui->layer_map->get_layer_map ();
|
||||
options->create_other_layers = mp_ui->read_all_cbx->isChecked ();
|
||||
options->keep_layer_names = mp_ui->keep_names_cbx->isChecked ();
|
||||
options->merge = mp_ui->merge_cbx->isChecked ();
|
||||
|
||||
options->lib_paths = mp_ui->lib_path->get_values ();
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,14 @@ public:
|
|||
return m_scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the scheme
|
||||
*/
|
||||
void set_scheme (const std::string &s)
|
||||
{
|
||||
m_scheme = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the authority part or an empty string if there is no authority
|
||||
* The leading slashes and not part of the authority.
|
||||
|
|
@ -69,6 +77,14 @@ public:
|
|||
return m_authority;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the authority
|
||||
*/
|
||||
void set_authority (const std::string &s)
|
||||
{
|
||||
m_authority = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the path part or an empty string if there is no path
|
||||
* The path contains the leading slash if there is a path.
|
||||
|
|
@ -79,6 +95,14 @@ public:
|
|||
return m_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the path
|
||||
*/
|
||||
void set_path (const std::string &s)
|
||||
{
|
||||
m_path = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the query part or an empty map if there is no query
|
||||
* The map is a map of keys vs. values. Percent escaping is undone
|
||||
|
|
@ -89,6 +113,14 @@ public:
|
|||
return m_query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the query part or an empty map if there is no query (non-const version)
|
||||
*/
|
||||
std::map<std::string, std::string> &query ()
|
||||
{
|
||||
return m_query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the fragment or an empty string if there is none
|
||||
* Percent escaping is undone on the fragment already.
|
||||
|
|
@ -98,6 +130,14 @@ public:
|
|||
return m_fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the fragment
|
||||
*/
|
||||
void set_fragment (const std::string &s)
|
||||
{
|
||||
m_fragment = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Turns the URI into a string
|
||||
* Percent escaping is employed to escape special characters
|
||||
|
|
|
|||
Loading…
Reference in New Issue