mirror of https://github.com/KLayout/klayout.git
WIP
This commit is contained in:
parent
b6d8ce9f45
commit
ade8a54ede
|
|
@ -2288,7 +2288,7 @@ bool
|
||||||
PartialService::key_event (unsigned int key, unsigned int buttons)
|
PartialService::key_event (unsigned int key, unsigned int buttons)
|
||||||
{
|
{
|
||||||
if (m_moving && buttons == 0 && (key == lay::KeyEnter || key == lay::KeyReturn)) {
|
if (m_moving && buttons == 0 && (key == lay::KeyEnter || key == lay::KeyReturn)) {
|
||||||
mp_view->move_service ()->end_move ();
|
mp_view->move_service ()->finish_move ();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -389,9 +389,13 @@ BitmapRenderer::draw (const db::Shape &shape, const db::CplxTrans &trans,
|
||||||
db::DCoord h = trans.mag () * m_default_text_size;
|
db::DCoord h = trans.mag () * m_default_text_size;
|
||||||
db::Font font = shape.text_font () == db::NoFont ? m_font : shape.text_font ();
|
db::Font font = shape.text_font () == db::NoFont ? m_font : shape.text_font ();
|
||||||
|
|
||||||
if (m_apply_text_trans && font != db::NoFont && font != db::DefaultFont) {
|
if (font != db::NoFont && font != db::DefaultFont) {
|
||||||
fp = db::DFTrans (trans.fp_trans () * shape.text_trans ());
|
if ((m_apply_text_trans_mode & 2) != 0) {
|
||||||
h = trans.mag () * (shape.text_size () > 0 ? shape.text_size () : m_default_text_size);
|
fp = db::DFTrans (trans.fp_trans () * shape.text_trans ());
|
||||||
|
}
|
||||||
|
if ((m_apply_text_trans_mode & 1) != 0) {
|
||||||
|
h = trans.mag () * (shape.text_size () > 0 ? shape.text_size () : m_default_text_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
db::HAlign halign = shape.text_halign ();
|
db::HAlign halign = shape.text_halign ();
|
||||||
|
|
@ -1090,9 +1094,13 @@ BitmapRenderer::draw (const db::Text &txt, const db::CplxTrans &trans,
|
||||||
db::DCoord h = trans.mag () * m_default_text_size;
|
db::DCoord h = trans.mag () * m_default_text_size;
|
||||||
db::Font font = txt.font () == db::NoFont ? m_font : txt.font ();
|
db::Font font = txt.font () == db::NoFont ? m_font : txt.font ();
|
||||||
|
|
||||||
if (m_apply_text_trans && font != db::NoFont && font != db::DefaultFont) {
|
if (font != db::NoFont && font != db::DefaultFont) {
|
||||||
fp = db::DFTrans (trans.fp_trans () * txt.trans ());
|
if ((m_apply_text_trans_mode & 2) != 0) {
|
||||||
h = trans.mag () * (txt.size () > 0 ? txt.size () : m_default_text_size);
|
fp = db::DFTrans (trans.fp_trans () * txt.trans ());
|
||||||
|
}
|
||||||
|
if ((m_apply_text_trans_mode & 1) != 0) {
|
||||||
|
h = trans.mag () * (txt.size () > 0 ? txt.size () : m_default_text_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double fy = 0.0;
|
double fy = 0.0;
|
||||||
|
|
@ -1161,9 +1169,13 @@ BitmapRenderer::draw (const db::DText &txt, const db::DCplxTrans &trans,
|
||||||
db::DCoord h = trans.ctrans (m_default_text_size_dbl);
|
db::DCoord h = trans.ctrans (m_default_text_size_dbl);
|
||||||
db::Font font = txt.font () == db::NoFont ? m_font : txt.font ();
|
db::Font font = txt.font () == db::NoFont ? m_font : txt.font ();
|
||||||
|
|
||||||
if (m_apply_text_trans && font != db::NoFont && font != db::DefaultFont) {
|
if (font != db::NoFont && font != db::DefaultFont) {
|
||||||
fp = trans.fp_trans () * db::DFTrans (txt.trans ());
|
if ((m_apply_text_trans_mode & 2) != 0) {
|
||||||
h = trans.ctrans (txt.size () > 0 ? txt.size () : m_default_text_size_dbl);
|
fp = trans.fp_trans () * db::DFTrans (txt.trans ());
|
||||||
|
}
|
||||||
|
if ((m_apply_text_trans_mode & 1) != 0) {
|
||||||
|
h = trans.ctrans (txt.size () > 0 ? txt.size () : m_default_text_size_dbl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double fy = 0.0;
|
double fy = 0.0;
|
||||||
|
|
|
||||||
|
|
@ -351,6 +351,7 @@ LayoutViewBase::init (db::Manager *mgr)
|
||||||
m_bitmap_caching = true;
|
m_bitmap_caching = true;
|
||||||
m_show_properties = false;
|
m_show_properties = false;
|
||||||
m_apply_text_trans = true;
|
m_apply_text_trans = true;
|
||||||
|
m_apply_text_trans_mode = 3;
|
||||||
m_default_text_size = 0.1;
|
m_default_text_size = 0.1;
|
||||||
m_text_point_mode = false;
|
m_text_point_mode = false;
|
||||||
m_text_font = 0;
|
m_text_font = 0;
|
||||||
|
|
@ -1029,6 +1030,13 @@ LayoutViewBase::configure (const std::string &name, const std::string &value)
|
||||||
apply_text_trans (flag);
|
apply_text_trans (flag);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
} else if (name == cfg_apply_text_trans_mode) {
|
||||||
|
|
||||||
|
unsigned int mode;
|
||||||
|
tl::from_string (value, mode);
|
||||||
|
apply_text_trans_mode (mode);
|
||||||
|
return true;
|
||||||
|
|
||||||
} else if (name == cfg_markers_visible) {
|
} else if (name == cfg_markers_visible) {
|
||||||
|
|
||||||
bool flag;
|
bool flag;
|
||||||
|
|
@ -5541,7 +5549,16 @@ LayoutViewBase::apply_text_trans (bool f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
LayoutViewBase::apply_text_trans_mode (unsigned int m)
|
||||||
|
{
|
||||||
|
if (m_apply_text_trans_mode != m) {
|
||||||
|
m_apply_text_trans_mode = m;
|
||||||
|
redraw ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
LayoutViewBase::offset_stipples (bool f)
|
LayoutViewBase::offset_stipples (bool f)
|
||||||
{
|
{
|
||||||
if (m_stipple_offset != f) {
|
if (m_stipple_offset != f) {
|
||||||
|
|
|
||||||
|
|
@ -1400,6 +1400,26 @@ public:
|
||||||
return m_apply_text_trans;
|
return m_apply_text_trans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the mode how to apply the text transformation
|
||||||
|
*
|
||||||
|
* The mode value has two bits:
|
||||||
|
* - bit 0: apply scaling
|
||||||
|
* - bit 1: apply rotation
|
||||||
|
*
|
||||||
|
* The default is mode "3" (scaling and rotation).
|
||||||
|
* The mode is effective only if "apply_text_trans" is true.
|
||||||
|
*/
|
||||||
|
void apply_text_trans_mode (unsigned int m);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the mode how to apply the text transformation
|
||||||
|
*/
|
||||||
|
unsigned int apply_text_trans_mode () const
|
||||||
|
{
|
||||||
|
return m_apply_text_trans ? m_apply_text_trans_mode : 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Text object color
|
* @brief Text object color
|
||||||
*/
|
*/
|
||||||
|
|
@ -3074,6 +3094,7 @@ private:
|
||||||
bool m_show_properties;
|
bool m_show_properties;
|
||||||
tl::Color m_text_color;
|
tl::Color m_text_color;
|
||||||
bool m_apply_text_trans;
|
bool m_apply_text_trans;
|
||||||
|
unsigned int m_apply_text_trans_mode;
|
||||||
double m_default_text_size;
|
double m_default_text_size;
|
||||||
bool m_text_point_mode;
|
bool m_text_point_mode;
|
||||||
unsigned int m_text_font;
|
unsigned int m_text_font;
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ public:
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_bitmap_caching, "true"));
|
options.push_back (std::pair<std::string, std::string> (cfg_bitmap_caching, "true"));
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_show_properties, "false"));
|
options.push_back (std::pair<std::string, std::string> (cfg_show_properties, "false"));
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_apply_text_trans, "true"));
|
options.push_back (std::pair<std::string, std::string> (cfg_apply_text_trans, "true"));
|
||||||
|
options.push_back (std::pair<std::string, std::string> (cfg_apply_text_trans_mode, "3"));
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_global_trans, "r0"));
|
options.push_back (std::pair<std::string, std::string> (cfg_global_trans, "r0"));
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_default_text_size, "0.1"));
|
options.push_back (std::pair<std::string, std::string> (cfg_default_text_size, "0.1"));
|
||||||
options.push_back (std::pair<std::string, std::string> (cfg_text_point_mode, "false"));
|
options.push_back (std::pair<std::string, std::string> (cfg_text_point_mode, "false"));
|
||||||
|
|
|
||||||
|
|
@ -640,7 +640,7 @@ ShapeMarker::render (const Viewport &vp, ViewObjectCanvas &canvas)
|
||||||
lay::Renderer &r = canvas.renderer ();
|
lay::Renderer &r = canvas.renderer ();
|
||||||
|
|
||||||
r.set_font (db::Font (view ()->text_font ()));
|
r.set_font (db::Font (view ()->text_font ()));
|
||||||
r.apply_text_trans (view ()->apply_text_trans ());
|
r.apply_text_trans_mode (view ()->apply_text_trans_mode ());
|
||||||
r.default_text_size (view ()->default_text_size () / ly->dbu ());
|
r.default_text_size (view ()->default_text_size () / ly->dbu ());
|
||||||
r.set_precise (true);
|
r.set_precise (true);
|
||||||
|
|
||||||
|
|
@ -1171,7 +1171,7 @@ Marker::render (const Viewport &vp, ViewObjectCanvas &canvas)
|
||||||
lay::Renderer &r = canvas.renderer ();
|
lay::Renderer &r = canvas.renderer ();
|
||||||
|
|
||||||
r.set_font (db::Font (view ()->text_font ()));
|
r.set_font (db::Font (view ()->text_font ()));
|
||||||
r.apply_text_trans (view ()->apply_text_trans ());
|
r.apply_text_trans_mode (view ()->apply_text_trans_mode ());
|
||||||
r.default_text_size (view ()->default_text_size () / dbu ());
|
r.default_text_size (view ()->default_text_size () / dbu ());
|
||||||
r.set_precise (true);
|
r.set_precise (true);
|
||||||
|
|
||||||
|
|
@ -1319,7 +1319,7 @@ DMarker::render (const Viewport &vp, ViewObjectCanvas &canvas)
|
||||||
lay::Renderer &r = canvas.renderer ();
|
lay::Renderer &r = canvas.renderer ();
|
||||||
|
|
||||||
r.set_font (db::Font (view ()->text_font ()));
|
r.set_font (db::Font (view ()->text_font ()));
|
||||||
r.apply_text_trans (view ()->apply_text_trans ());
|
r.apply_text_trans_mode (view ()->apply_text_trans_mode ());
|
||||||
r.default_text_size_dbl (view ()->default_text_size ());
|
r.default_text_size_dbl (view ()->default_text_size ());
|
||||||
r.set_precise (true);
|
r.set_precise (true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ MoveService::key_event (unsigned int key, unsigned int buttons)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttons == 0 && (key == lay::KeyEnter || key == lay::KeyReturn)) {
|
if (buttons == 0 && (key == lay::KeyEnter || key == lay::KeyReturn)) {
|
||||||
end_move ();
|
finish_move ();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -378,7 +378,7 @@ MoveService::start_move (db::Transaction *transaction, bool transient_selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MoveService::end_move ()
|
MoveService::finish_move ()
|
||||||
{
|
{
|
||||||
if (m_dragging) {
|
if (m_dragging) {
|
||||||
handle_click (m_mouse_pos, 0, false, 0);
|
handle_click (m_mouse_pos, 0, false, 0);
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public:
|
||||||
~MoveService ();
|
~MoveService ();
|
||||||
|
|
||||||
bool start_move (db::Transaction *transaction = 0, bool transient_selection = false);
|
bool start_move (db::Transaction *transaction = 0, bool transient_selection = false);
|
||||||
void end_move ();
|
void finish_move ();
|
||||||
|
|
||||||
bool configure (const std::string &name, const std::string &value);
|
bool configure (const std::string &name, const std::string &value);
|
||||||
void function (const std::string &name, const std::string &value);
|
void function (const std::string &name, const std::string &value);
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ RedrawThreadWorker::RedrawThreadWorker (RedrawThread *redraw_thread)
|
||||||
m_text_lazy_rendering = false;
|
m_text_lazy_rendering = false;
|
||||||
m_bitmap_caching = false;
|
m_bitmap_caching = false;
|
||||||
m_show_properties = false;
|
m_show_properties = false;
|
||||||
m_apply_text_trans = false;
|
m_apply_text_trans_mode = 0;
|
||||||
m_default_text_size = 0.0;
|
m_default_text_size = 0.0;
|
||||||
m_drop_small_cells = false;
|
m_drop_small_cells = false;
|
||||||
m_drop_small_cells_value = 0;
|
m_drop_small_cells_value = 0;
|
||||||
|
|
@ -291,7 +291,7 @@ RedrawThreadWorker::perform_task (tl::Task *task)
|
||||||
mp_renderer->draw_description_property (false);
|
mp_renderer->draw_description_property (false);
|
||||||
mp_renderer->default_text_size (m_default_text_size / mp_layout->dbu ());
|
mp_renderer->default_text_size (m_default_text_size / mp_layout->dbu ());
|
||||||
mp_renderer->set_font (db::Font (m_text_font));
|
mp_renderer->set_font (db::Font (m_text_font));
|
||||||
mp_renderer->apply_text_trans (m_apply_text_trans);
|
mp_renderer->apply_text_trans_mode (m_apply_text_trans_mode);
|
||||||
|
|
||||||
for (std::vector<db::DCplxTrans>::const_iterator t = li.trans.begin (); t != li.trans.end (); ++t) {
|
for (std::vector<db::DCplxTrans>::const_iterator t = li.trans.begin (); t != li.trans.end (); ++t) {
|
||||||
db::CplxTrans trans = m_vp_trans * *t * db::CplxTrans (mp_layout->dbu ());
|
db::CplxTrans trans = m_vp_trans * *t * db::CplxTrans (mp_layout->dbu ());
|
||||||
|
|
@ -533,7 +533,7 @@ RedrawThreadWorker::perform_task (tl::Task *task)
|
||||||
mp_renderer->draw_description_property (true);
|
mp_renderer->draw_description_property (true);
|
||||||
mp_renderer->default_text_size (db::Coord (m_default_text_size / mp_layout->dbu ()));
|
mp_renderer->default_text_size (db::Coord (m_default_text_size / mp_layout->dbu ()));
|
||||||
mp_renderer->set_font (db::Font (m_text_font));
|
mp_renderer->set_font (db::Font (m_text_font));
|
||||||
mp_renderer->apply_text_trans (m_apply_text_trans);
|
mp_renderer->apply_text_trans_mode (m_apply_text_trans_mode);
|
||||||
|
|
||||||
bool f = m_text_lazy_rendering;
|
bool f = m_text_lazy_rendering;
|
||||||
|
|
||||||
|
|
@ -693,7 +693,7 @@ RedrawThreadWorker::setup (LayoutViewBase *view, RedrawThreadCanvas *canvas, con
|
||||||
m_text_lazy_rendering = view->text_lazy_rendering ();
|
m_text_lazy_rendering = view->text_lazy_rendering ();
|
||||||
m_bitmap_caching = view->bitmap_caching ();
|
m_bitmap_caching = view->bitmap_caching ();
|
||||||
m_show_properties = view->show_properties_as_text ();
|
m_show_properties = view->show_properties_as_text ();
|
||||||
m_apply_text_trans = view->apply_text_trans ();
|
m_apply_text_trans_mode = view->apply_text_trans_mode ();
|
||||||
m_default_text_size = view->default_text_size ();
|
m_default_text_size = view->default_text_size ();
|
||||||
m_drop_small_cells = view->drop_small_cells ();
|
m_drop_small_cells = view->drop_small_cells ();
|
||||||
m_drop_small_cells_value = view->drop_small_cells_value ();
|
m_drop_small_cells_value = view->drop_small_cells_value ();
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ private:
|
||||||
bool m_text_lazy_rendering;
|
bool m_text_lazy_rendering;
|
||||||
bool m_bitmap_caching;
|
bool m_bitmap_caching;
|
||||||
bool m_show_properties;
|
bool m_show_properties;
|
||||||
bool m_apply_text_trans;
|
unsigned int m_apply_text_trans_mode;
|
||||||
double m_default_text_size;
|
double m_default_text_size;
|
||||||
bool m_drop_small_cells;
|
bool m_drop_small_cells;
|
||||||
unsigned int m_drop_small_cells_value;
|
unsigned int m_drop_small_cells_value;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ Renderer::Renderer (unsigned int width, unsigned int height, double resolution,
|
||||||
m_draw_description_property (false),
|
m_draw_description_property (false),
|
||||||
m_default_text_size (1000),
|
m_default_text_size (1000),
|
||||||
m_default_text_size_dbl (1.0),
|
m_default_text_size_dbl (1.0),
|
||||||
m_apply_text_trans (true),
|
m_apply_text_trans_mode (3),
|
||||||
m_precise (false),
|
m_precise (false),
|
||||||
m_xfill (false),
|
m_xfill (false),
|
||||||
m_font (db::DefaultFont),
|
m_font (db::DefaultFont),
|
||||||
|
|
|
||||||
|
|
@ -164,19 +164,23 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Apply text transformations to text or not for draw(db::Text..).
|
* @brief How to apply text transformations for draw(db::Text..).
|
||||||
|
*
|
||||||
|
* This is a bit field:
|
||||||
|
* - bit 0: apply scaling
|
||||||
|
* - bit 1: apply rotation
|
||||||
*/
|
*/
|
||||||
void apply_text_trans (bool f)
|
void apply_text_trans_mode (unsigned int m)
|
||||||
{
|
{
|
||||||
m_apply_text_trans = f;
|
m_apply_text_trans_mode = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the flag which determines to apply text transformations for draw(db::Text..)
|
* @brief Get the value indicating how to apply text transformation for draw(db::Text..).
|
||||||
*/
|
*/
|
||||||
bool apply_text_trans () const
|
unsigned int apply_text_trans_mode () const
|
||||||
{
|
{
|
||||||
return m_apply_text_trans;
|
return m_apply_text_trans_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -415,7 +419,7 @@ protected:
|
||||||
bool m_draw_description_property;
|
bool m_draw_description_property;
|
||||||
db::DCoord m_default_text_size;
|
db::DCoord m_default_text_size;
|
||||||
double m_default_text_size_dbl;
|
double m_default_text_size_dbl;
|
||||||
bool m_apply_text_trans;
|
unsigned int m_apply_text_trans_mode;
|
||||||
bool m_precise;
|
bool m_precise;
|
||||||
bool m_xfill;
|
bool m_xfill;
|
||||||
db::Font m_font;
|
db::Font m_font;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace lay
|
||||||
TextInfo::TextInfo (const LayoutViewBase *view)
|
TextInfo::TextInfo (const LayoutViewBase *view)
|
||||||
: m_default_text_size (view->default_text_size ()),
|
: m_default_text_size (view->default_text_size ()),
|
||||||
m_default_font (db::Font (view->text_font ())),
|
m_default_font (db::Font (view->text_font ())),
|
||||||
m_apply_text_trans (view->apply_text_trans ()),
|
m_apply_text_trans_mode (view->apply_text_trans_mode ()),
|
||||||
m_resolution (view->canvas ()->font_resolution ()),
|
m_resolution (view->canvas ()->font_resolution ()),
|
||||||
m_point_mode (view->text_point_mode ())
|
m_point_mode (view->text_point_mode ())
|
||||||
{
|
{
|
||||||
|
|
@ -49,14 +49,18 @@ TextInfo::bbox (const db::DText &text, const db::DCplxTrans &vp_trans) const
|
||||||
// offset in pixels (space between origin and text)
|
// offset in pixels (space between origin and text)
|
||||||
const double offset = 2.0 / vp_trans.mag ();
|
const double offset = 2.0 / vp_trans.mag ();
|
||||||
|
|
||||||
db::DTrans tt = text.trans ();
|
db::DTrans tt;
|
||||||
db::DCoord h;
|
db::DCoord h;
|
||||||
db::Font font = text.font () == db::NoFont ? m_default_font : text.font ();
|
db::Font font = text.font () == db::NoFont ? m_default_font : text.font ();
|
||||||
|
|
||||||
if (m_apply_text_trans && font != db::NoFont && font != db::DefaultFont) {
|
if ((m_apply_text_trans_mode & 2) != 0 && font != db::NoFont && font != db::DefaultFont) {
|
||||||
h = text.size () > 0 ? text.size () : m_default_text_size;
|
tt = text.trans ();
|
||||||
} else {
|
} else {
|
||||||
tt = db::DTrans (vp_trans.fp_trans ().inverted ().angle (), tt.disp ());
|
tt = db::DTrans (vp_trans.fp_trans ().inverted ().angle (), tt.disp ());
|
||||||
|
}
|
||||||
|
if (((m_apply_text_trans_mode & 1) != 0) && font != db::NoFont && font != db::DefaultFont) {
|
||||||
|
h = text.size () > 0 ? text.size () : m_default_text_size;
|
||||||
|
} else {
|
||||||
h = m_default_text_size;
|
h = m_default_text_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public:
|
||||||
private:
|
private:
|
||||||
double m_default_text_size;
|
double m_default_text_size;
|
||||||
db::Font m_default_font;
|
db::Font m_default_font;
|
||||||
bool m_apply_text_trans;
|
unsigned int m_apply_text_trans_mode;
|
||||||
double m_resolution;
|
double m_resolution;
|
||||||
bool m_point_mode;
|
bool m_point_mode;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ static const std::string cfg_text_lazy_rendering ("text-lazy-rendering");
|
||||||
static const std::string cfg_bitmap_caching ("bitmap-caching");
|
static const std::string cfg_bitmap_caching ("bitmap-caching");
|
||||||
static const std::string cfg_show_properties ("show-properties");
|
static const std::string cfg_show_properties ("show-properties");
|
||||||
static const std::string cfg_apply_text_trans ("apply-text-trans");
|
static const std::string cfg_apply_text_trans ("apply-text-trans");
|
||||||
|
static const std::string cfg_apply_text_trans_mode ("apply-text-trans-mode");
|
||||||
static const std::string cfg_global_trans ("global-trans");
|
static const std::string cfg_global_trans ("global-trans");
|
||||||
static const std::string cfg_no_stipple ("no-stipple");
|
static const std::string cfg_no_stipple ("no-stipple");
|
||||||
static const std::string cfg_stipple_offset ("stipple-offset");
|
static const std::string cfg_stipple_offset ("stipple-offset");
|
||||||
|
|
|
||||||
|
|
@ -123,4 +123,26 @@ TEST(1)
|
||||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans ()).to_string (), "(12,20.6;24,27)");
|
EXPECT_EQ (ti.bbox (text, db::DCplxTrans ()).to_string (), "(12,20.6;24,27)");
|
||||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (2.0)).to_string (), "(11,19.6;23,26)");
|
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (2.0)).to_string (), "(11,19.6;23,26)");
|
||||||
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (db::DFTrans (1))).to_string (), "(10.6,6;17,18)");
|
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (db::DFTrans (1))).to_string (), "(10.6,6;17,18)");
|
||||||
|
|
||||||
|
// apply_text_trans = true, scale only
|
||||||
|
lv.apply_text_trans (true);
|
||||||
|
lv.apply_text_trans_mode (1);
|
||||||
|
ti = lay::TextInfo (&lv);
|
||||||
|
EXPECT_EQ (ti.bbox (text3, db::DCplxTrans ()).to_string (), "(12,20.6;36.4,34.2)");
|
||||||
|
// with apply_text_trans false, the global transformation does change the text
|
||||||
|
// bounding box.
|
||||||
|
EXPECT_EQ (ti.bbox (text, db::DCplxTrans ()).to_string (), "(12,20.6;24,27)");
|
||||||
|
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (2.0)).to_string (), "(11,19.6;23,26)");
|
||||||
|
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (db::DFTrans (1))).to_string (), "(10.6,6;17,18)");
|
||||||
|
|
||||||
|
// apply_text_trans = true, rotation only
|
||||||
|
lv.apply_text_trans (true);
|
||||||
|
lv.apply_text_trans_mode (2);
|
||||||
|
ti = lay::TextInfo (&lv);
|
||||||
|
EXPECT_EQ (ti.bbox (text3, db::DCplxTrans ()).to_string (), "(12,20.6;36.4,34.2)");
|
||||||
|
// with apply_text_trans false, the global transformation does change the text
|
||||||
|
// bounding box.
|
||||||
|
EXPECT_EQ (ti.bbox (text, db::DCplxTrans ()).to_string (), "(12,20.6;24,27)");
|
||||||
|
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (2.0)).to_string (), "(11,19.6;23,26)");
|
||||||
|
EXPECT_EQ (ti.bbox (text, db::DCplxTrans (db::DFTrans (1))).to_string (), "(10.6,6;17,18)");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>LayoutViewConfigPage2b</class>
|
<class>LayoutViewConfigPage2b</class>
|
||||||
<widget class="QFrame" name="LayoutViewConfigPage2b" >
|
<widget class="QFrame" name="LayoutViewConfigPage2b">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
|
|
@ -9,57 +10,55 @@
|
||||||
<height>276</height>
|
<height>276</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout">
|
||||||
<property name="margin" >
|
<property name="margin" stdset="0">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="QGroupBox" name="text_group" >
|
<widget class="QGroupBox" name="text_group">
|
||||||
<property name="title" >
|
<property name="title">
|
||||||
<string>Show texts or properties</string>
|
<string>Show texts or properties</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable" >
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout">
|
||||||
<property name="margin" >
|
<property name="margin" stdset="0">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing" >
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="2" column="1" >
|
<item row="2" column="1">
|
||||||
<widget class="QFrame" name="frame_3" >
|
<widget class="QFrame" name="frame_3">
|
||||||
<property name="frameShape" >
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow" >
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="margin" stdset="0">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="text_def_size_edit" >
|
<widget class="QLineEdit" name="text_def_size_edit">
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy>
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<hsizetype>0</hsizetype>
|
|
||||||
<vsizetype>0</vsizetype>
|
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
|
|
@ -68,26 +67,24 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="textLabel2_2_2" >
|
<widget class="QLabel" name="textLabel2_2_2">
|
||||||
<property name="sizePolicy" >
|
<property name="sizePolicy">
|
||||||
<sizepolicy>
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<hsizetype>0</hsizetype>
|
|
||||||
<vsizetype>0</vsizetype>
|
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>micron</string>
|
<string>micron</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
|
|
@ -98,34 +95,34 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1">
|
||||||
<widget class="QFrame" name="frame_2" >
|
<widget class="QFrame" name="frame_2">
|
||||||
<property name="frameShape" >
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow" >
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="margin" stdset="0">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="lay::ColorButton" name="text_color_pb" >
|
<widget class="lay::ColorButton" name="text_color_pb">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
|
|
@ -136,30 +133,30 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1">
|
||||||
<widget class="QFrame" name="frame" >
|
<widget class="QFrame" name="frame">
|
||||||
<property name="frameShape" >
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow" >
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout">
|
||||||
<property name="margin" >
|
<property name="spacing">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="margin" stdset="0">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="text_font_cb" />
|
<widget class="QComboBox" name="text_font_cb"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
|
|
@ -170,15 +167,15 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2" >
|
<item row="3" column="0" colspan="2">
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType" >
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>561</width>
|
<width>561</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
|
|
@ -186,47 +183,54 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2" >
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="text_apply_trans_cbx" >
|
<widget class="QCheckBox" name="text_apply_trans_scale_cbx">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Apply text scaling and rotation (not available for "Default" font)</string>
|
<string>Apply text scaling (not available for "Default" font)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="2" >
|
<item row="6" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="show_properties_cbx" >
|
<widget class="QCheckBox" name="show_properties_cbx">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Show properties also</string>
|
<string>Show properties also</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="textLabel3_3" >
|
<widget class="QLabel" name="textLabel3_3">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Color</string>
|
<string>Color</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="textLabel1_2_2_2" >
|
<widget class="QLabel" name="textLabel1_2_2_2">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Standard text size</string>
|
<string>Standard text size</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="textLabel1_3_2" >
|
<widget class="QLabel" name="textLabel1_3_2">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Text font</string>
|
<string>Text font</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="text_apply_trans_rotate_cbx">
|
||||||
|
<property name="text">
|
||||||
|
<string>Apply text rotation (not available for "Default" font)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11" />
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>lay::ColorButton</class>
|
<class>lay::ColorButton</class>
|
||||||
|
|
@ -237,7 +241,7 @@
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>text_group</tabstop>
|
<tabstop>text_group</tabstop>
|
||||||
<tabstop>text_font_cb</tabstop>
|
<tabstop>text_font_cb</tabstop>
|
||||||
<tabstop>text_apply_trans_cbx</tabstop>
|
<tabstop>text_apply_trans_scale_cbx</tabstop>
|
||||||
<tabstop>text_def_size_edit</tabstop>
|
<tabstop>text_def_size_edit</tabstop>
|
||||||
<tabstop>text_color_pb</tabstop>
|
<tabstop>text_color_pb</tabstop>
|
||||||
<tabstop>show_properties_cbx</tabstop>
|
<tabstop>show_properties_cbx</tabstop>
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,15 @@ LayoutViewConfigPage2b::setup (lay::Dispatcher *root)
|
||||||
|
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
root->config_get (cfg_apply_text_trans, flag);
|
root->config_get (cfg_apply_text_trans, flag);
|
||||||
mp_ui->text_apply_trans_cbx->setChecked (flag);
|
|
||||||
|
unsigned int mode = 0;
|
||||||
|
if (flag) {
|
||||||
|
mode = 3;
|
||||||
|
root->config_get (cfg_apply_text_trans_mode, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
mp_ui->text_apply_trans_scale_cbx->setChecked ((mode & 1) != 0);
|
||||||
|
mp_ui->text_apply_trans_rotate_cbx->setChecked ((mode & 2) != 0);
|
||||||
|
|
||||||
root->config_get (cfg_text_visible, flag);
|
root->config_get (cfg_text_visible, flag);
|
||||||
mp_ui->text_group->setChecked (flag);
|
mp_ui->text_group->setChecked (flag);
|
||||||
|
|
@ -327,8 +335,11 @@ LayoutViewConfigPage2b::setup (lay::Dispatcher *root)
|
||||||
void
|
void
|
||||||
LayoutViewConfigPage2b::commit (lay::Dispatcher *root)
|
LayoutViewConfigPage2b::commit (lay::Dispatcher *root)
|
||||||
{
|
{
|
||||||
|
unsigned int mode = (mp_ui->text_apply_trans_scale_cbx->isChecked () ? 1 : 0) | (mp_ui->text_apply_trans_rotate_cbx->isChecked () ? 2 : 0);
|
||||||
|
root->config_set (cfg_apply_text_trans, mode != 0); // for backward compatibility before version 0.30.8
|
||||||
|
root->config_set (cfg_apply_text_trans_mode, mode);
|
||||||
|
|
||||||
root->config_set (cfg_text_color, mp_ui->text_color_pb->get_color (), ColorConverter ());
|
root->config_set (cfg_text_color, mp_ui->text_color_pb->get_color (), ColorConverter ());
|
||||||
root->config_set (cfg_apply_text_trans, mp_ui->text_apply_trans_cbx->isChecked ());
|
|
||||||
root->config_set (cfg_text_visible, mp_ui->text_group->isChecked ());
|
root->config_set (cfg_text_visible, mp_ui->text_group->isChecked ());
|
||||||
root->config_set (cfg_show_properties, mp_ui->show_properties_cbx->isChecked ());
|
root->config_set (cfg_show_properties, mp_ui->show_properties_cbx->isChecked ());
|
||||||
root->config_set (cfg_text_font, mp_ui->text_font_cb->currentIndex ());
|
root->config_set (cfg_text_font, mp_ui->text_font_cb->currentIndex ());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue