Merge branch 'library-browser'

This commit is contained in:
Matthias Koefferlein 2019-08-20 23:14:37 +02:00
commit 908ddbfb5b
5 changed files with 205 additions and 139 deletions

View File

@ -6,14 +6,48 @@
<rect>
<x>0</x>
<y>0</y>
<width>568</width>
<height>353</height>
<width>604</width>
<height>498</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="3">
<widget class="QToolButton" name="browse_pb">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="desc_le"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="name_le">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<widget class="QLabel" name="label_3">
<property name="text">
<string>The base path is used to locate auxiliary files if those are specified with a relative path. If none is specified, the default path is used. The default path is the one from which a technology was imported.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -21,9 +55,6 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="base_path_le"/>
</item>
<item row="8" column="0" colspan="4">
<spacer name="verticalSpacer">
<property name="orientation">
@ -40,135 +71,6 @@
</property>
</spacer>
</item>
<item row="6" column="1" colspan="3">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="dbu_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>µm</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="10" column="0" colspan="4">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>27</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="4">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="1" colspan="3">
<widget class="QLabel" name="label_3">
<property name="text">
<string>The base path is used to locate auxiliary files if those are specified with a relative path. If none is specified, the default path is used. The default path is the one from which a technology was imported.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Base path</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="4">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QToolButton" name="browse_pb">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="name_le">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>(Use the rename button to change this)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="desc_le"/>
</item>
<item row="9" column="1" colspan="3">
<widget class="QGroupBox" name="lyp_grp">
<property name="title">
@ -223,10 +125,10 @@
</layout>
</widget>
</item>
<item row="7" column="1" colspan="3">
<widget class="QLabel" name="label_8">
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>The default database unit is used as database unit for freshly created layouts</string>
<string>Base path</string>
</property>
</widget>
</item>
@ -252,6 +154,127 @@ unit</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="5" column="0" colspan="4">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>(Use the rename button to change this)</string>
</property>
</widget>
</item>
<item row="7" column="1" colspan="3">
<widget class="QLabel" name="label_8">
<property name="text">
<string>The default database unit is used as database unit for freshly created layouts</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="dbu_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>µm</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="2" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="base_path_le"/>
</item>
<item row="11" column="0">
<widget class="QLabel" name="libs_lbl">
<property name="text">
<string>Technology
specific
libraries</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="4">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="12" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="1" rowspan="2" colspan="3">
<widget class="QListWidget" name="libs_lw">
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -2414,7 +2414,6 @@ MainWindow::cm_undo ()
(*vp)->cancel ();
}
m_manager.undo ();
current_view ()->update_content ();
}
END_PROTECTED
@ -2431,7 +2430,6 @@ MainWindow::cm_redo ()
(*vp)->cancel ();
}
m_manager.redo ();
current_view ()->update_content ();
}
END_PROTECTED

View File

@ -37,6 +37,8 @@
#include "tlStream.h"
#include "tlClassRegistry.h"
#include "dbStream.h"
#include "dbLibraryManager.h"
#include "dbLibrary.h"
#include "ui_TechSetupDialog.h"
#include "ui_TechMacrosPage.h"
@ -51,6 +53,7 @@
#include <QHeaderView>
#include <QFileDialog>
#include <QScrollArea>
#include <QListWidgetItem>
#include <stdio.h>
#include <fstream>
@ -114,6 +117,38 @@ TechBaseEditorPage::setup ()
mp_ui->lyp_grp->setChecked (! lyp.empty ());
mp_ui->lyp_le->setText (tl::to_qstring (lyp));
mp_ui->add_other_layers_cbx->setChecked (tech ()->add_other_layers ());
mp_ui->libs_lw->clear ();
if (! tech ()->name ().empty ()) {
mp_ui->libs_lbl->setEnabled (true);
mp_ui->libs_lw->setEnabled (true);
std::vector<std::string> libs;
for (db::LibraryManager::iterator l = db::LibraryManager::instance ().begin (); l != db::LibraryManager::instance ().end (); ++l) {
const db::Library *lib = db::LibraryManager::instance ().lib (l->second);
if (lib->get_technology () == tech ()->name ()) {
std::string text = lib->get_name ();
if (! lib->get_description ().empty ()) {
text += " - " + lib->get_description ();
}
libs.push_back (text);
}
}
std::sort (libs.begin (), libs.end ());
for (std::vector<std::string>::const_iterator l = libs.begin (); l != libs.end (); ++l) {
mp_ui->libs_lw->addItem (new QListWidgetItem (tl::to_qstring (*l)));
}
} else {
mp_ui->libs_lbl->setEnabled (false);
mp_ui->libs_lw->setEnabled (false);
mp_ui->libs_lw->addItem (tr ("The default technology can't have libraries"));
}
}
void

View File

@ -1706,9 +1706,12 @@ LayoutView::insert_layer_list (unsigned index, const LayerPropertiesList &props)
m_current_layer_list = index;
current_layer_list_changed_event (index);
layer_list_inserted_event (index);
redraw ();
dm_prop_changed ();
}
void
@ -1750,6 +1753,7 @@ LayoutView::delete_layer_list (unsigned index)
}
layer_list_deleted_event (index);
dm_prop_changed ();
}
void
@ -1986,6 +1990,7 @@ LayoutView::insert_layer (unsigned int index, const LayerPropertiesConstIterator
if (index == current_layer_list ()) {
layer_list_changed_event (2);
redraw ();
dm_prop_changed ();
}
return ret;
@ -2013,6 +2018,7 @@ LayoutView::delete_layer (unsigned int index, LayerPropertiesConstIterator &iter
if (index == current_layer_list ()) {
layer_list_changed_event (2);
redraw ();
dm_prop_changed ();
}
// invalidate the iterator so it can be used to refer to the next element

View File

@ -795,6 +795,10 @@ LibrariesView::display_string (int n) const
if (! lib->get_description ().empty ()) {
text += " - " + lib->get_description ();
}
if (! lib->get_technology ().empty ()) {
text += " ";
text += tl::to_string (QObject::tr ("[Technology %1]").arg (tl::to_qstring (lib->get_technology ())));
}
return text;
}