Merge branch 'salt'

This commit is contained in:
Matthias Koefferlein
2017-05-07 23:55:22 +02:00
142 changed files with 14394 additions and 1391 deletions
+7 -6
View File
@@ -635,7 +635,6 @@ ConfigureAction::triggered ()
}
m_pr->config_set (m_cname, m_cvalue);
m_pr->config_end ();
}
void
@@ -874,7 +873,6 @@ AbstractMenu::build (QToolBar *t, std::list<AbstractMenuItem> &items)
}
}
}
QMenu *
@@ -1123,14 +1121,17 @@ AbstractMenu::find_item (const std::string &path)
return std::make_pair ((AbstractMenuItem *) 0, m_root.children.end ());
}
} else if (extr.test ("begin")) {
return std::make_pair (parent, parent->children.begin ());
} else if (extr.test ("end")) {
return std::make_pair (parent, parent->children.end ());
} else {
std::string n;
extr.read (n, ".+");
if (n == "begin") {
return std::make_pair (parent, parent->children.begin ());
} else if (n == "end") {
return std::make_pair (parent, parent->children.end ());
}
std::string name (parent->name ());
if (! name.empty ()) {
name += ".";
+5 -1
View File
@@ -217,7 +217,11 @@ void
LayoutHandle::set_tech_name (const std::string &tn)
{
if (tn != m_tech_name) {
m_tech_name = tn;
if (lay::Technologies::instance ()->has_technology (tn)) {
m_tech_name = tn;
} else {
m_tech_name = std::string ();
}
technology_changed_event ();
}
}
+5 -2
View File
@@ -3028,10 +3028,11 @@ LayoutView::load_layout (const std::string &filename, const db::LoadLayoutOption
try {
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Loading")));
// load the file
{
tl::log << tl::to_string (QObject::tr ("Loading file: ")) << filename << tl::to_string (QObject::tr (" with technology: ")) << technology;
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Loading")));
lmap = cv->load (options, technology);
}
@@ -3039,7 +3040,6 @@ LayoutView::load_layout (const std::string &filename, const db::LoadLayoutOption
// implicitly at some other time. This may throw an exception
// if the operation was cancelled.
{
tl::SelfTimer timer (tl::verbosity () >= 11, tl::to_string (QObject::tr ("Sorting")));
cv->layout ().update ();
}
@@ -3124,6 +3124,9 @@ LayoutView::load_layout (const std::string &filename, const db::LoadLayoutOption
}
update_content ();
// this event may not be generated otherwise:
active_cellview_changed (cv_index);
return cv_index;
}
+1 -1
View File
@@ -196,7 +196,7 @@ PluginDeclaration::init_menu ()
m_mouse_mode_action.qaction ()->setData (QVariant (id ()));
menu.insert_item ("edit_menu.mode_menu.end", name, m_mouse_mode_action);
menu.insert_item ("@toolbar.end", name, m_mouse_mode_action);
menu.insert_item ("@toolbar.end_modes", name, m_mouse_mode_action);
gtf::action_connect (m_mouse_mode_action.qaction (), SIGNAL (triggered ()), this, SLOT (mode_triggered ()));
+4
View File
@@ -103,6 +103,10 @@ save_dialog_state (QWidget *w)
void
restore_dialog_state (QWidget *dialog, const std::string &s)
{
if (! dialog) {
return;
}
tl::Extractor ex (s.c_str ());
while (! ex.at_end ()) {
+62 -7
View File
@@ -38,6 +38,8 @@ namespace lay
Technologies::Technologies ()
{
m_technologies.push_back (new Technology (std::string (""), "(Default)"));
m_changed = false;
m_in_update = false;
}
Technologies::Technologies (const Technologies &other)
@@ -128,7 +130,7 @@ Technologies::add (Technology *technology)
technology->technology_changed_with_sender_event.add (this, &Technologies::technology_changed);
}
technologies_changed_event ();
technologies_changed ();
}
void
@@ -137,12 +139,58 @@ Technologies::remove (const std::string &name)
for (tl::stable_vector<Technology>::iterator t = m_technologies.begin (); t != m_technologies.end (); ++t) {
if (t->name () == name) {
m_technologies.erase (t);
technologies_changed_event ();
technologies_changed ();
break;
}
}
}
void
Technologies::clear ()
{
if (! m_technologies.empty ()) {
m_technologies.clear ();
technologies_changed ();
}
}
void
Technologies::technologies_changed ()
{
if (m_in_update) {
m_changed = true;
} else {
technologies_changed_event ();
}
}
void
Technologies::begin_updates ()
{
tl_assert (! m_in_update);
m_in_update = true;
m_changed = false;
}
void
Technologies::end_updates ()
{
if (m_in_update) {
m_in_update = false;
if (m_changed) {
m_changed = false;
technologies_changed ();
}
}
}
void
Technologies::end_updates_no_event ()
{
m_in_update = false;
m_changed = false;
}
bool
Technologies::has_technology (const std::string &name) const
{
@@ -171,13 +219,13 @@ Technologies::technology_by_name (const std::string &name)
// Technology implementation
Technology::Technology ()
: m_name (), m_description (), m_dbu (0.001), m_persisted (true)
: m_name (), m_description (), m_dbu (0.001), m_persisted (true), m_readonly (false)
{
init ();
}
Technology::Technology (const std::string &name, const std::string &description)
: m_name (name), m_description (description), m_dbu (0.001), m_persisted (true)
: m_name (name), m_description (description), m_dbu (0.001), m_persisted (true), m_readonly (false)
{
init ();
}
@@ -204,11 +252,12 @@ Technology::~Technology ()
Technology::Technology (const Technology &d)
: tl::Object (),
m_name (d.m_name), m_description (d.m_description), m_dbu (d.m_dbu),
m_name (d.m_name), m_description (d.m_description), m_grain_name (d.m_grain_name), m_dbu (d.m_dbu),
m_explicit_base_path (d.m_explicit_base_path), m_default_base_path (d.m_default_base_path),
m_load_layout_options (d.m_load_layout_options),
m_save_layout_options (d.m_save_layout_options),
m_lyp_path (d.m_lyp_path), m_add_other_layers (d.m_add_other_layers), m_persisted (d.m_persisted)
m_lyp_path (d.m_lyp_path), m_add_other_layers (d.m_add_other_layers), m_persisted (d.m_persisted),
m_readonly (d.m_readonly), m_lyt_file (d.m_lyt_file)
{
for (std::vector <TechnologyComponent *>::const_iterator c = d.m_components.begin (); c != d.m_components.end (); ++c) {
m_components.push_back ((*c)->clone ());
@@ -221,6 +270,7 @@ Technology &Technology::operator= (const Technology &d)
m_name = d.m_name;
m_description = d.m_description;
m_grain_name = d.m_grain_name;
m_dbu = d.m_dbu;
m_default_base_path = d.m_default_base_path;
m_explicit_base_path = d.m_explicit_base_path;
@@ -229,6 +279,8 @@ Technology &Technology::operator= (const Technology &d)
m_lyp_path = d.m_lyp_path;
m_add_other_layers = d.m_add_other_layers;
m_persisted = d.m_persisted;
m_readonly = d.m_readonly;
m_lyt_file = d.m_lyt_file;
for (std::vector <TechnologyComponent *>::const_iterator c = m_components.begin (); c != m_components.end (); ++c) {
delete *c;
@@ -350,7 +402,10 @@ Technology::load (const std::string &fn)
xml_struct.parse (source, *this);
// use the tech file's path as the default base path
set_default_base_path (tl::to_string (QFileInfo (tl::to_qstring (fn)).absoluteDir ().path ()));
std::string lyt_file = tl::to_string (QFileInfo (tl::to_qstring (fn)).absoluteDir ().path ());
set_default_base_path (lyt_file);
set_tech_file_path (fn);
}
void
+88
View File
@@ -133,6 +133,30 @@ public:
*/
void remove (const std::string &name);
/**
* @brief Clears the list of technologies
*/
void clear ();
/**
* @brief Begins a bulk operation
* This method will disable "technologies_changed" events until (later) end_updates () is called.
*/
void begin_updates ();
/**
* @brief Ends a bulk operation
*/
void end_updates ();
/**
* @brief Ends a bulk operation
* This version does not send an technologies_changed event but just cancels the bulk
* operation. begin_updates/end_updates_no_event is essentially equivalent to blocking
* signals.
*/
void end_updates_no_event ();
/**
* @brief Checks, if a technology with the given name exists
*/
@@ -191,8 +215,15 @@ protected:
technology_changed_event (t);
}
/**
* @brief Sends the technologies_changed event
*/
void technologies_changed ();
private:
tl::stable_vector<Technology> m_technologies;
bool m_changed;
bool m_in_update;
};
/**
@@ -249,6 +280,24 @@ public:
}
}
/**
* @brief Sets the package source
*
* This attribute indicates that this technology was contributed by a package
*/
void set_grain_name (const std::string &g)
{
m_grain_name = g;
}
/**
* @brief Gets the package source
*/
const std::string &grain_name () const
{
return m_grain_name;
}
/**
* @brief Gets the base path
*
@@ -308,6 +357,23 @@ public:
}
}
/**
* @brief Gets the path of the tech file if the technology was loaded from a tech file
*/
const std::string &tech_file_path () const
{
return m_lyt_file;
}
/**
* @brief Sets the path of the tech file
* This method is intended for internal use only.
*/
void set_tech_file_path (const std::string &lyt_file)
{
m_lyt_file = lyt_file;
}
/**
* @brief Gets the description
*/
@@ -497,6 +563,24 @@ public:
m_persisted = f;
}
/**
* @brief Returns a flag indicating whether the technology is readonly
*
* If the flag is false, the technology can be edited. Otherwise it's locked for editing.
*/
bool is_readonly () const
{
return m_readonly;
}
/**
* @brief Sets a flag indicating whether the technology is readonly
*/
void set_readonly (bool f)
{
m_readonly = f;
}
/**
* @brief An event indicating that the technology has changed
*/
@@ -509,14 +593,18 @@ public:
private:
std::string m_name, m_description;
std::string m_grain_name;
double m_dbu;
std::string m_explicit_base_path, m_default_base_path;
db::LoadLayoutOptions m_load_layout_options;
db::SaveLayoutOptions m_save_layout_options;
std::string m_lyp_path;
std::string m_lyt_path;
bool m_add_other_layers;
std::vector <TechnologyComponent *> m_components;
bool m_persisted;
bool m_readonly;
std::string m_lyt_file;
void init ();
+31 -7
View File
@@ -230,7 +230,8 @@ struct CellViewSelectionComboBoxPrivateData
const lay::LayoutView *layout_view;
};
CellViewSelectionComboBox::CellViewSelectionComboBox (QWidget * /*parent*/)
CellViewSelectionComboBox::CellViewSelectionComboBox (QWidget *parent)
: QComboBox (parent)
{
mp_private = new CellViewSelectionComboBoxPrivateData ();
mp_private->layout_view = 0;
@@ -299,7 +300,8 @@ struct LayerSelectionComboBoxPrivateData
int cv_index;
};
LayerSelectionComboBox::LayerSelectionComboBox (QWidget * /*parent*/)
LayerSelectionComboBox::LayerSelectionComboBox (QWidget *parent)
: QComboBox (parent)
{
mp_private = new LayerSelectionComboBoxPrivateData ();
mp_private->no_layer_available = false;
@@ -569,11 +571,22 @@ LayerSelectionComboBox::current_layer_props () const
// -------------------------------------------------------------
// LibrarySelectionComboBox implementation
LibrarySelectionComboBox::LibrarySelectionComboBox (QWidget * /*parent*/)
LibrarySelectionComboBox::LibrarySelectionComboBox (QWidget *parent)
: QComboBox (parent), m_tech_set (false)
{
update_list ();
}
void
LibrarySelectionComboBox::set_technology_filter (const std::string &tech, bool enabled)
{
if (m_tech != tech || m_tech_set != enabled) {
m_tech = tech;
m_tech_set = enabled;
update_list ();
}
}
void
LibrarySelectionComboBox::update_list ()
{
@@ -585,12 +598,23 @@ LibrarySelectionComboBox::update_list ()
addItem (QObject::tr ("Local (no library)"), QVariant ());
for (db::LibraryManager::iterator l = db::LibraryManager::instance ().begin (); l != db::LibraryManager::instance ().end (); ++l) {
db::Library *lib = db::LibraryManager::instance ().lib (l->second);
if (! lib->get_description ().empty ()) {
addItem (tl::to_qstring (lib->get_name () + " - " + lib->get_description ()), QVariant ((unsigned int) lib->get_id ()));
} else {
addItem (tl::to_qstring (lib->get_name ()), QVariant ((unsigned int) lib->get_id ()));
if (! m_tech_set || lib->get_technology ().empty () || m_tech == lib->get_technology ()) {
std::string item_text = lib->get_name ();
if (! lib->get_description ().empty ()) {
item_text += " - " + lib->get_description ();
}
if (m_tech_set && !lib->get_technology ().empty ()) {
item_text += " ";
item_text += tl::to_string (QObject::tr ("[Technology %1]").arg (tl::to_qstring (lib->get_technology ())));
}
addItem (tl::to_qstring (item_text), QVariant ((unsigned int) lib->get_id ()));
}
}
set_current_library (lib);
+13
View File
@@ -147,6 +147,19 @@ public:
* @brief Update the list of libraries
*/
void update_list ();
/**
* @brief Sets the technology filter
*
* If a technology filter is set, only the libraries associated with the given
* technology are shown. If enable is false, the technology name is ignored and
* all libraries are shown.
*/
void set_technology_filter (const std::string &tech, bool enable);
private:
std::string m_tech;
bool m_tech_set;
};
/**
+4 -22
View File
@@ -1820,24 +1820,6 @@ MarkerBrowserPage::set_max_marker_count (size_t max_marker_count)
}
}
static void
escape_to_html (std::string &out, const std::string &in)
{
for (const char *cp = in.c_str (); *cp; ++cp) {
if (*cp == '<') {
out += "&lt;";
} else if (*cp == '>') {
out += "&gt;";
} else if (*cp == '&') {
out += "&amp;";
} else if (*cp == '\n') {
out += "<br/>";
} else {
out += *cp;
}
}
}
void
MarkerBrowserPage::enable_updates (bool f)
{
@@ -1955,13 +1937,13 @@ MarkerBrowserPage::update_info_text ()
if (category && n_category == 1 && ! category->description ().empty ()) {
info += "<p style=\"color:blue; font-weight: bold\">";
escape_to_html (info, category->description ());
tl::escape_to_html (info, category->description ());
info += "</p>";
}
if (! m_error_text.empty ()) {
info += "<p style=\"color:red; font-weight: bold\">";
escape_to_html (info, m_error_text);
tl::escape_to_html (info, m_error_text);
info += "</p>";
}
@@ -1978,7 +1960,7 @@ MarkerBrowserPage::update_info_text ()
if (v->tag_id () != 0) {
const rdb::Tag &tag = mp_database->tags ().tag (v->tag_id ());
info += "<b>";
escape_to_html (info, tag.name ());
tl::escape_to_html (info, tag.name ());
info += ":</br> ";
}
@@ -1989,7 +1971,7 @@ MarkerBrowserPage::update_info_text ()
value_string = std::string (value_string.begin (), value_string.begin () + max_length) + "...";
}
escape_to_html (info, value_string);
tl::escape_to_html (info, value_string);
info += "<br/>";