mirror of https://github.com/KLayout/klayout.git
Basic feature implemented. Needs improvement.
This commit is contained in:
parent
a5ea8eb590
commit
cd69f29508
|
|
@ -151,6 +151,7 @@ LayoutCanvas::LayoutCanvas (lay::LayoutViewBase *view)
|
||||||
m_background (0), m_foreground (0), m_active (0),
|
m_background (0), m_foreground (0), m_active (0),
|
||||||
m_oversampling (1),
|
m_oversampling (1),
|
||||||
m_hrm (false),
|
m_hrm (false),
|
||||||
|
m_srm (false),
|
||||||
m_need_redraw (false),
|
m_need_redraw (false),
|
||||||
m_redraw_clearing (false),
|
m_redraw_clearing (false),
|
||||||
m_redraw_force_update (true),
|
m_redraw_force_update (true),
|
||||||
|
|
@ -201,11 +202,7 @@ LayoutCanvas::~LayoutCanvas ()
|
||||||
double
|
double
|
||||||
LayoutCanvas::resolution () const
|
LayoutCanvas::resolution () const
|
||||||
{
|
{
|
||||||
if (m_hrm) {
|
return (m_srm ? 1.0 : 1.0 / m_oversampling) * (m_hrm ? 1.0 : 1.0 / dpr ());
|
||||||
return 1.0 / m_oversampling;
|
|
||||||
} else {
|
|
||||||
return 1.0 / (m_oversampling * dpr ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_QT)
|
#if defined(HAVE_QT)
|
||||||
|
|
@ -283,6 +280,16 @@ LayoutCanvas::set_highres_mode (bool hrm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LayoutCanvas::set_subres_mode (bool srm)
|
||||||
|
{
|
||||||
|
if (srm != m_srm) {
|
||||||
|
m_image_cache.clear ();
|
||||||
|
m_srm = srm;
|
||||||
|
do_redraw_all ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
LayoutCanvas::dpr () const
|
LayoutCanvas::dpr () const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,19 @@ public:
|
||||||
return m_hrm;
|
return m_hrm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set sub resolution mode (sub-pixel resolution in oversampling mode)
|
||||||
|
*/
|
||||||
|
void set_subres_mode (bool srm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the sub resolution mode flag
|
||||||
|
*/
|
||||||
|
bool subres_mode () const
|
||||||
|
{
|
||||||
|
return m_srm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the default device pixel ratio for this canvas
|
* @brief Gets the default device pixel ratio for this canvas
|
||||||
*/
|
*/
|
||||||
|
|
@ -412,6 +425,7 @@ private:
|
||||||
std::map<unsigned int, std::vector <lay::ViewOp> > m_scaled_view_ops;
|
std::map<unsigned int, std::vector <lay::ViewOp> > m_scaled_view_ops;
|
||||||
unsigned int m_oversampling;
|
unsigned int m_oversampling;
|
||||||
bool m_hrm;
|
bool m_hrm;
|
||||||
|
bool m_srm;
|
||||||
double m_gamma;
|
double m_gamma;
|
||||||
|
|
||||||
bool m_need_redraw;
|
bool m_need_redraw;
|
||||||
|
|
|
||||||
|
|
@ -790,6 +790,13 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
|
||||||
mp_canvas->set_highres_mode (hrm);
|
mp_canvas->set_highres_mode (hrm);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
} else if (name == cfg_subres_mode) {
|
||||||
|
|
||||||
|
bool srm = false;
|
||||||
|
tl::from_string (value, srm);
|
||||||
|
mp_canvas->set_subres_mode (srm);
|
||||||
|
return true;
|
||||||
|
|
||||||
} else if (name == cfg_image_cache_size) {
|
} else if (name == cfg_image_cache_size) {
|
||||||
|
|
||||||
int sz = 0;
|
int sz = 0;
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,7 @@ public:
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_array_border_instances, "false"));
|
options.push_back (std::pair<std::string, std::string> (cfg_array_border_instances, "false"));
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_bitmap_oversampling, "1"));
|
options.push_back (std::pair<std::string, std::string> (cfg_bitmap_oversampling, "1"));
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_highres_mode, "false"));
|
options.push_back (std::pair<std::string, std::string> (cfg_highres_mode, "false"));
|
||||||
|
options.push_back (std::pair<std::string, std::string> (cfg_subres_mode, "false"));
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_image_cache_size, "1"));
|
options.push_back (std::pair<std::string, std::string> (cfg_image_cache_size, "1"));
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_default_font_size, "0"));
|
options.push_back (std::pair<std::string, std::string> (cfg_default_font_size, "0"));
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_color_palette, lay::ColorPalette ().to_string ()));
|
options.push_back (std::pair<std::string, std::string> (cfg_color_palette, lay::ColorPalette ().to_string ()));
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ static const std::string cfg_tip_window_hidden ("tip-window-hidden");
|
||||||
|
|
||||||
static const std::string cfg_bitmap_oversampling ("bitmap-oversampling");
|
static const std::string cfg_bitmap_oversampling ("bitmap-oversampling");
|
||||||
static const std::string cfg_highres_mode ("highres-mode");
|
static const std::string cfg_highres_mode ("highres-mode");
|
||||||
|
static const std::string cfg_subres_mode ("subres-mode");
|
||||||
static const std::string cfg_image_cache_size ("image-cache-size");
|
static const std::string cfg_image_cache_size ("image-cache-size");
|
||||||
static const std::string cfg_default_font_size ("default-font-size");
|
static const std::string cfg_default_font_size ("default-font-size");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>791</width>
|
<width>613</width>
|
||||||
<height>403</height>
|
<height>496</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
@ -50,18 +50,14 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0">
|
<item row="3" column="0" colspan="3">
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Oversampling mode</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="3">
|
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>High resolution mode utilizes the full pixel density on high-DPI displays. Features may look small but rich in details.</string>
|
<string>High resolution mode utilizes the full pixel density on high-DPI displays. Features may look small but rich in details.</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
|
|
@ -83,6 +79,13 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Oversampling mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
@ -99,20 +102,27 @@
|
||||||
<item row="0" column="0" colspan="3">
|
<item row="0" column="0" colspan="3">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Oversampling increases the image quality by using an internal resolution larger than the image resolution. Drawing speed is somewhat reduced and lines may appear thinner.</string>
|
<string>Oversampling increases the image quality by using an internal resolution larger than the image resolution. Drawing speed is somewhat reduced.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="3">
|
<item row="4" column="0" colspan="3">
|
||||||
<widget class="QCheckBox" name="highres_mode">
|
<widget class="QCheckBox" name="highres_mode">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>High resolution mode enabled</string>
|
<string>High resolution mode enabled</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0" colspan="3">
|
||||||
|
<widget class="QCheckBox" name="subres_mode">
|
||||||
|
<property name="text">
|
||||||
|
<string>Subresolution mode - scale down line widths and stipples with oversampling</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
||||||
|
|
@ -210,8 +210,6 @@ LayerControlPanel::LayerControlPanel (lay::LayoutViewBase *view, db::Manager *ma
|
||||||
m_hidden_flags_need_update (true),
|
m_hidden_flags_need_update (true),
|
||||||
m_in_update (false),
|
m_in_update (false),
|
||||||
m_phase (0),
|
m_phase (0),
|
||||||
m_oversampling (1),
|
|
||||||
m_hrm (false),
|
|
||||||
m_do_update_content_dm (this, &LayerControlPanel::do_update_content),
|
m_do_update_content_dm (this, &LayerControlPanel::do_update_content),
|
||||||
m_do_update_visibility_dm (this, &LayerControlPanel::do_update_visibility),
|
m_do_update_visibility_dm (this, &LayerControlPanel::do_update_visibility),
|
||||||
m_no_stipples (false),
|
m_no_stipples (false),
|
||||||
|
|
@ -1792,24 +1790,6 @@ LayerControlPanel::set_phase (int phase)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
LayerControlPanel::set_highres_mode (bool hrm)
|
|
||||||
{
|
|
||||||
if (m_hrm != hrm) {
|
|
||||||
m_hrm = hrm;
|
|
||||||
m_do_update_content_dm ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
LayerControlPanel::set_oversampling (int os)
|
|
||||||
{
|
|
||||||
if (m_oversampling != os) {
|
|
||||||
m_oversampling = os;
|
|
||||||
m_do_update_content_dm ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_hidden_flags_rec (LayerTreeModel *model, QTreeView *tree_view, const QModelIndex &parent)
|
set_hidden_flags_rec (LayerTreeModel *model, QTreeView *tree_view, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -220,16 +220,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void set_phase (int phase);
|
void set_phase (int phase);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets highres mode
|
|
||||||
*/
|
|
||||||
void set_highres_mode (bool hrm);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets oversampling mode
|
|
||||||
*/
|
|
||||||
void set_oversampling (int os);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Tell, if the model has been updated already (true) or if it is still under construction (false)
|
* @brief Tell, if the model has been updated already (true) or if it is still under construction (false)
|
||||||
*/
|
*/
|
||||||
|
|
@ -373,8 +363,6 @@ private:
|
||||||
bool m_in_update;
|
bool m_in_update;
|
||||||
std::vector<size_t> m_new_sel;
|
std::vector<size_t> m_new_sel;
|
||||||
int m_phase;
|
int m_phase;
|
||||||
int m_oversampling;
|
|
||||||
bool m_hrm;
|
|
||||||
tl::DeferredMethod<LayerControlPanel> m_do_update_content_dm;
|
tl::DeferredMethod<LayerControlPanel> m_do_update_content_dm;
|
||||||
tl::DeferredMethod<LayerControlPanel> m_do_update_visibility_dm;
|
tl::DeferredMethod<LayerControlPanel> m_do_update_visibility_dm;
|
||||||
bool m_no_stipples;
|
bool m_no_stipples;
|
||||||
|
|
|
||||||
|
|
@ -1501,6 +1501,10 @@ LayoutViewConfigPage7::setup (lay::Dispatcher *root)
|
||||||
root->config_get (cfg_highres_mode, highres_mode);
|
root->config_get (cfg_highres_mode, highres_mode);
|
||||||
mp_ui->highres_mode->setChecked (highres_mode);
|
mp_ui->highres_mode->setChecked (highres_mode);
|
||||||
|
|
||||||
|
bool subres_mode = false;
|
||||||
|
root->config_get (cfg_subres_mode, subres_mode);
|
||||||
|
mp_ui->subres_mode->setChecked (subres_mode);
|
||||||
|
|
||||||
int default_font_size = 0;
|
int default_font_size = 0;
|
||||||
root->config_get (cfg_default_font_size, default_font_size);
|
root->config_get (cfg_default_font_size, default_font_size);
|
||||||
mp_ui->default_font_size->setCurrentIndex (default_font_size);
|
mp_ui->default_font_size->setCurrentIndex (default_font_size);
|
||||||
|
|
@ -1525,6 +1529,7 @@ LayoutViewConfigPage7::commit (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
root->config_set (cfg_bitmap_oversampling, mp_ui->oversampling->currentIndex () + 1);
|
root->config_set (cfg_bitmap_oversampling, mp_ui->oversampling->currentIndex () + 1);
|
||||||
root->config_set (cfg_highres_mode, mp_ui->highres_mode->isChecked ());
|
root->config_set (cfg_highres_mode, mp_ui->highres_mode->isChecked ());
|
||||||
|
root->config_set (cfg_subres_mode, mp_ui->subres_mode->isChecked ());
|
||||||
root->config_set (cfg_default_font_size, mp_ui->default_font_size->currentIndex ());
|
root->config_set (cfg_default_font_size, mp_ui->default_font_size->currentIndex ());
|
||||||
root->config_set (cfg_global_trans, db::DCplxTrans (db::DFTrans (mp_ui->global_trans->currentIndex ())).to_string ());
|
root->config_set (cfg_global_trans, db::DCplxTrans (db::DFTrans (mp_ui->global_trans->currentIndex ())).to_string ());
|
||||||
root->config_set (cfg_initial_hier_depth, mp_ui->def_depth->value ());
|
root->config_set (cfg_initial_hier_depth, mp_ui->def_depth->value ());
|
||||||
|
|
|
||||||
|
|
@ -873,24 +873,6 @@ LayoutView::update_menu (lay::LayoutView *view, lay::AbstractMenu &menu)
|
||||||
bool
|
bool
|
||||||
LayoutView::configure (const std::string &name, const std::string &value)
|
LayoutView::configure (const std::string &name, const std::string &value)
|
||||||
{
|
{
|
||||||
if (name == cfg_bitmap_oversampling) {
|
|
||||||
|
|
||||||
int os = 1;
|
|
||||||
tl::from_string (value, os);
|
|
||||||
if (mp_control_panel) {
|
|
||||||
mp_control_panel->set_oversampling (os);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (name == cfg_highres_mode) {
|
|
||||||
|
|
||||||
bool hrm = false;
|
|
||||||
tl::from_string (value, hrm);
|
|
||||||
if (mp_control_panel) {
|
|
||||||
mp_control_panel->set_highres_mode (hrm);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LayoutViewBase::configure (name, value)) {
|
if (LayoutViewBase::configure (name, value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue