remove deprecated code
This commit is contained in:
parent
e1992fb0d4
commit
fe185e382b
@ -809,7 +809,6 @@ namespace nana
|
||||
/// operate with absolute positions and contain only the position but montain pointers to parts of the real items
|
||||
/// item_proxy self, it references and iterators are not invalidated by sort()
|
||||
class item_proxy
|
||||
//: public std::iterator<std::input_iterator_tag, item_proxy> //deprecated
|
||||
: public ::nana::widgets::detail::widget_iterator<std::input_iterator_tag, item_proxy>
|
||||
{
|
||||
public:
|
||||
@ -984,7 +983,6 @@ namespace nana
|
||||
};
|
||||
|
||||
class cat_proxy
|
||||
//: public std::iterator<std::input_iterator_tag, cat_proxy> //deprecated
|
||||
: public ::nana::widgets::detail::widget_iterator<std::input_iterator_tag, cat_proxy>
|
||||
{
|
||||
public:
|
||||
|
@ -96,13 +96,6 @@ namespace nana{ namespace widgets{ namespace skeletons
|
||||
return std::stoi(idstr_, nullptr, 0);
|
||||
}
|
||||
private:
|
||||
/*
|
||||
static bool _m_unicode_word_breakable(wchar_t ch) //deprecated
|
||||
{
|
||||
return ((0x4E00 <= ch) && (ch <= 0x9FFF));
|
||||
}
|
||||
*/
|
||||
|
||||
static bool _m_unicode_word_breakable(const wchar_t* ch) noexcept
|
||||
{
|
||||
if (*ch)
|
||||
|
@ -656,38 +656,6 @@ namespace detail
|
||||
msg_dispatcher_->erase(reinterpret_cast<Window>(wd));
|
||||
|
||||
platform_scope_guard lock;
|
||||
#if 0
|
||||
auto i = wincontext_.find(wd);
|
||||
if(i == wincontext_.end()) return;
|
||||
|
||||
if(i->second.owner)
|
||||
{
|
||||
auto u = wincontext_.find(i->second.owner);
|
||||
if(u != wincontext_.end())
|
||||
{
|
||||
auto * vec = u->second.owned;
|
||||
if(vec)
|
||||
{
|
||||
auto j = std::find(vec->begin(), vec->end(), i->first);
|
||||
if(j != vec->end())
|
||||
vec->erase(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto * vec = i->second.owned;
|
||||
if(vec)
|
||||
{
|
||||
set_error_handler();
|
||||
auto & wd_manager = detail::bedrock::instance().wd_manager();
|
||||
for(auto u = vec->rbegin(); u != vec->rend(); ++u)
|
||||
wd_manager.close(wd_manager.root(*u));
|
||||
|
||||
rev_error_handler();
|
||||
}
|
||||
delete vec;
|
||||
wincontext_.erase(i);
|
||||
#else
|
||||
if(umake_owner(wd))
|
||||
{
|
||||
auto i = wincontext_.find(wd);
|
||||
@ -708,7 +676,6 @@ namespace detail
|
||||
wincontext_.erase(i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
iconbase_.erase(wd);
|
||||
}
|
||||
|
||||
|
@ -1133,62 +1133,11 @@ namespace detail
|
||||
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
//Fall through
|
||||
case XLookupChars:
|
||||
if (msgwnd->flags.enabled)
|
||||
{
|
||||
const wchar_t* charbuf;
|
||||
|
||||
nana::detail::charset_conv charset(NANA_UNICODE, "UTF-8");
|
||||
const std::string& str = charset.charset(std::string(keybuf, keybuf + len));
|
||||
charbuf = reinterpret_cast<const wchar_t*>(str.c_str());
|
||||
len = str.size() / sizeof(wchar_t);
|
||||
|
||||
for(int i = 0; i < len; ++i)
|
||||
{
|
||||
arg_keyboard arg = modifiers_status;
|
||||
arg.ignore = false;
|
||||
arg.key = charbuf[i];
|
||||
|
||||
// ignore Unicode BOM (it may or may not appear)
|
||||
if (arg.key == 0xFEFF) continue;
|
||||
|
||||
//Only accept tab when it is not ignored.
|
||||
if ((keyboard::tab == arg.key) && root_runtime->condition.ignore_tab)
|
||||
continue;
|
||||
|
||||
if(context.is_alt_pressed)
|
||||
{
|
||||
arg.ctrl = arg.shift = false;
|
||||
arg.evt_code = event_code::shortkey;
|
||||
brock.shortkey_occurred(true);
|
||||
auto shr_wd = wd_manager.find_shortkey(native_window, arg.key);
|
||||
if(shr_wd)
|
||||
{
|
||||
arg.window_handle = reinterpret_cast<window>(shr_wd);
|
||||
brock.emit(event_code::shortkey, shr_wd, arg, true, &context);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
arg.evt_code = event_code::key_char;
|
||||
arg.window_handle = reinterpret_cast<window>(msgwnd);
|
||||
msgwnd->annex.events_ptr->key_char.emit(arg, reinterpret_cast<window>(msgwnd));
|
||||
if(arg.ignore == false && wd_manager.available(msgwnd))
|
||||
draw_invoker(&drawer::key_char, msgwnd, arg, &context);
|
||||
}
|
||||
|
||||
if(brock.shortkey_occurred(false))
|
||||
context.is_alt_pressed = false;
|
||||
}
|
||||
break;
|
||||
#else
|
||||
x_lookup_chars(root_runtime, msgwnd, keybuf, len, modifiers_status);
|
||||
break;
|
||||
case XLookupChars:
|
||||
x_lookup_chars(root_runtime, msgwnd, keybuf, len, modifiers_status);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
wd_manager.do_lazy_refresh(msgwnd, false);
|
||||
|
@ -835,17 +835,6 @@ namespace API
|
||||
|
||||
size inner_size = sz;
|
||||
|
||||
#if 0
|
||||
if (inner_size.width < iwd->extra_width)
|
||||
inner_size.width = 0;
|
||||
else
|
||||
inner_size.width -= iwd->extra_width;
|
||||
|
||||
if (inner_size.height < iwd->extra_height)
|
||||
inner_size.height = 0;
|
||||
else
|
||||
inner_size.height -= iwd->extra_height;
|
||||
#else
|
||||
if (inner_size.width < static_cast<unsigned>(fm_extents.left + fm_extents.right))
|
||||
inner_size.width = 0;
|
||||
else
|
||||
@ -855,7 +844,6 @@ namespace API
|
||||
inner_size.height = 0;
|
||||
else
|
||||
inner_size.height -= static_cast<unsigned>(fm_extents.top + fm_extents.bottom);
|
||||
#endif
|
||||
|
||||
window_size(wd, inner_size);
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
||||
#define VISUAL_LINES
|
||||
|
||||
namespace nana
|
||||
{
|
||||
namespace drawerbase
|
||||
@ -30,17 +28,6 @@ namespace nana
|
||||
{
|
||||
class renderer
|
||||
{
|
||||
#ifndef VISUAL_LINES
|
||||
typedef widgets::skeletons::dstream::linecontainer::iterator iterator;
|
||||
|
||||
struct pixel_tag
|
||||
{
|
||||
int x_base; //The x position where this line starts.
|
||||
std::size_t pixels;
|
||||
std::size_t baseline; //The baseline for drawing text.
|
||||
std::vector<iterator> values; //line values
|
||||
};
|
||||
#else
|
||||
//Iterator of content element in a line.
|
||||
using content_element_iterator = widgets::skeletons::dstream::linecontainer::const_iterator; //subsitute for member type iterator
|
||||
|
||||
@ -65,8 +52,6 @@ namespace nana
|
||||
std::vector<element> elements; //description of text element in this rendering line.
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//this is a helper variable, it just keeps the status while drawing.
|
||||
struct render_status
|
||||
{
|
||||
@ -75,11 +60,7 @@ namespace nana
|
||||
align_v text_align_v;
|
||||
|
||||
nana::point pos;
|
||||
#ifndef VISUAL_LINES
|
||||
std::vector<pixel_tag> pixels;
|
||||
#else
|
||||
std::vector<visual_line> vslines; //The lines description of a line of text. substitute of member pixels.
|
||||
#endif
|
||||
std::size_t index; //indicates the current rendering visual line.
|
||||
};
|
||||
|
||||
@ -135,32 +116,19 @@ namespace nana
|
||||
rs.text_align = th;
|
||||
rs.text_align_v = tv;
|
||||
|
||||
#ifndef VISUAL_LINES
|
||||
std::deque<std::vector<pixel_tag> > pixel_lines;
|
||||
#else
|
||||
//All visual lines data of whole text.
|
||||
std::deque<std::vector<visual_line>> content_lines;
|
||||
#endif
|
||||
|
||||
std::size_t extent_v_pixels = 0; //the pixels, in height, that text will be painted.
|
||||
|
||||
for (auto & line : dstream_)
|
||||
{
|
||||
#ifndef VISUAL_LINES
|
||||
_m_line_pixels(line, def_line_pixels, rs);
|
||||
|
||||
for (auto & m : rs.pixels)
|
||||
extent_v_pixels += m.pixels;
|
||||
|
||||
pixel_lines.emplace_back(std::move(rs.pixels));
|
||||
#else
|
||||
_m_prepare_visual_lines(graph, line, def_line_pixels, rs);
|
||||
|
||||
for (auto & vsline : rs.vslines)
|
||||
extent_v_pixels += vsline.extent_height_px;
|
||||
|
||||
content_lines.emplace_back(std::move(rs.vslines));
|
||||
#endif
|
||||
|
||||
if(extent_v_pixels >= graph.height())
|
||||
break;
|
||||
@ -176,30 +144,12 @@ namespace nana
|
||||
else
|
||||
rs.pos.y = 0;
|
||||
|
||||
#ifndef VISUAL_LINES
|
||||
auto pixels_iterator = pixel_lines.begin();
|
||||
#else
|
||||
auto vsline_iterator = content_lines.begin();
|
||||
#endif
|
||||
for (auto & line : dstream_)
|
||||
{
|
||||
if (rs.pos.y >= static_cast<int>(graph.height()))
|
||||
break;
|
||||
|
||||
#ifndef VISUAL_LINES
|
||||
rs.index = 0;
|
||||
rs.pixels.clear();
|
||||
|
||||
rs.pixels.swap(*pixels_iterator++);
|
||||
|
||||
rs.pos.x = rs.pixels.front().x_base;
|
||||
|
||||
//Stop drawing when it goes out of range.
|
||||
if(false == _m_each_line(graph, line, rs))
|
||||
break;
|
||||
|
||||
rs.pos.y += static_cast<int>(rs.pixels.back().pixels);
|
||||
#else
|
||||
rs.index = 0;
|
||||
rs.vslines.clear();
|
||||
rs.vslines.swap(*vsline_iterator++);
|
||||
@ -209,7 +159,6 @@ namespace nana
|
||||
break;
|
||||
|
||||
rs.pos.y += static_cast<int>(rs.vslines.back().extent_height_px);
|
||||
#endif
|
||||
}
|
||||
|
||||
graph.typeface(pre_font);
|
||||
@ -256,13 +205,8 @@ namespace nana
|
||||
|
||||
for(auto & line: dstream_)
|
||||
{
|
||||
#ifndef VISUAL_LINES
|
||||
rs.pixels.clear();
|
||||
unsigned w = _m_line_pixels(line, def_line_pixels, rs);
|
||||
#else
|
||||
rs.vslines.clear();
|
||||
auto w = _m_prepare_visual_lines(graph, line, def_line_pixels, rs);
|
||||
#endif
|
||||
|
||||
if(limited && (w > limited))
|
||||
w = limited;
|
||||
@ -270,13 +214,8 @@ namespace nana
|
||||
if(retsize.width < w)
|
||||
retsize.width = w;
|
||||
|
||||
#ifndef VISUAL_LINES
|
||||
for (auto & px : rs.pixels)
|
||||
retsize.height += static_cast<unsigned>(px.pixels);
|
||||
#else
|
||||
for (auto& vsline : rs.vslines)
|
||||
retsize.height += static_cast<unsigned>(vsline.extent_height_px);
|
||||
#endif
|
||||
}
|
||||
|
||||
return retsize;
|
||||
@ -387,23 +326,6 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef VISUAL_LINES
|
||||
void _m_align_x_base(const render_status& rs, pixel_tag & px, unsigned w) noexcept
|
||||
{
|
||||
switch(rs.text_align)
|
||||
{
|
||||
case align::left:
|
||||
px.x_base = 0;
|
||||
break;
|
||||
case align::center:
|
||||
px.x_base = (static_cast<int>(rs.allowed_width - w) >> 1);
|
||||
break;
|
||||
case align::right:
|
||||
px.x_base = static_cast<int>(rs.allowed_width - w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void _m_prepare_x(const render_status& rs, visual_line & vsline, unsigned w) noexcept
|
||||
{
|
||||
switch (rs.text_align)
|
||||
@ -419,9 +341,6 @@ namespace nana
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VISUAL_LINES
|
||||
|
||||
/**
|
||||
* prepare data for rendering a line of text.
|
||||
@ -605,180 +524,7 @@ namespace nana
|
||||
}
|
||||
return text.size();
|
||||
}
|
||||
#else
|
||||
unsigned _m_line_pixels(dstream::linecontainer& line, unsigned def_line_pixels, render_status & rs)
|
||||
{
|
||||
if (line.empty())
|
||||
{
|
||||
pixel_tag px;
|
||||
px.baseline = 0;
|
||||
px.pixels = def_line_pixels;
|
||||
px.x_base = 0;
|
||||
|
||||
rs.pixels.emplace_back(px);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned total_w = 0;
|
||||
unsigned w = 0;
|
||||
unsigned max_ascent = 0;
|
||||
unsigned max_descent = 0;
|
||||
unsigned max_px = 0;
|
||||
|
||||
//Bidi reorder is requried here
|
||||
|
||||
std::vector<iterator> line_values;
|
||||
|
||||
for(auto i = line.begin(); i != line.end(); ++i)
|
||||
{
|
||||
data * data_ptr = i->data_ptr;
|
||||
nana::size sz = data_ptr->size();
|
||||
total_w += sz.width;
|
||||
|
||||
unsigned as = 0; //ascent
|
||||
unsigned ds = 0; //descent
|
||||
|
||||
if(fblock::aligns::baseline == i->fblock_ptr->text_align)
|
||||
{
|
||||
as = static_cast<unsigned>(data_ptr->ascent());
|
||||
ds = static_cast<unsigned>(sz.height - as);
|
||||
|
||||
if(max_descent < ds)
|
||||
max_descent = ds;
|
||||
|
||||
if((false == data_ptr->is_text()) && (sz.height < max_ascent + max_descent))
|
||||
sz.height = max_ascent + max_descent;
|
||||
}
|
||||
|
||||
//Check if the content is displayed in a new line.
|
||||
if((0 == rs.allowed_width) || (w + sz.width <= rs.allowed_width))
|
||||
{
|
||||
w += sz.width;
|
||||
|
||||
if(max_ascent < as) max_ascent = as;
|
||||
if(max_descent < ds) max_descent = ds;
|
||||
if(max_px < sz.height) max_px = sz.height;
|
||||
line_values.emplace_back(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
pixel_tag px;
|
||||
_m_align_x_base(rs, px, (w ? w : sz.width));
|
||||
|
||||
if(w)
|
||||
{
|
||||
if(max_ascent + max_descent > max_px)
|
||||
max_px = max_descent + max_ascent;
|
||||
else
|
||||
max_ascent = max_px - max_descent;
|
||||
|
||||
px.pixels = max_px;
|
||||
px.baseline = max_ascent;
|
||||
px.values.swap(line_values);
|
||||
|
||||
w = sz.width;
|
||||
max_px = sz.height;
|
||||
max_ascent = as;
|
||||
max_descent = ds;
|
||||
line_values.emplace_back(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
px.pixels = sz.height;
|
||||
px.baseline = as;
|
||||
|
||||
px.values.emplace_back(i);
|
||||
|
||||
max_px = 0;
|
||||
max_ascent = max_descent = 0;
|
||||
}
|
||||
|
||||
rs.pixels.emplace_back(px);
|
||||
}
|
||||
}
|
||||
|
||||
if (max_px)
|
||||
{
|
||||
pixel_tag px;
|
||||
|
||||
_m_align_x_base(rs, px, w);
|
||||
|
||||
if (max_ascent + max_descent > max_px)
|
||||
max_px = max_descent + max_ascent;
|
||||
else
|
||||
max_ascent = max_px - max_descent;
|
||||
|
||||
px.pixels = max_px;
|
||||
px.baseline = max_ascent;
|
||||
px.values.swap(line_values);
|
||||
rs.pixels.emplace_back(px);
|
||||
}
|
||||
return total_w;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef VISUAL_LINES
|
||||
bool _m_each_line(graph_reference graph, dstream::linecontainer&, render_status& rs)
|
||||
{
|
||||
std::wstring text;
|
||||
iterator block_start;
|
||||
|
||||
const int lastpos = static_cast<int>(graph.height()) - 1;
|
||||
|
||||
for(auto & px : rs.pixels)
|
||||
{
|
||||
for(auto & render_iterator: px.values)
|
||||
{
|
||||
auto & value = *render_iterator;
|
||||
if (value.data_ptr->is_text())
|
||||
{
|
||||
//hold the block while the text is empty,
|
||||
//it stands for the first block
|
||||
if (text.empty())
|
||||
block_start = render_iterator;
|
||||
|
||||
text += value.data_ptr->text();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(text.size())
|
||||
{
|
||||
_m_draw_block(graph, text, block_start, rs);
|
||||
if(lastpos <= rs.pos.y)
|
||||
return false;
|
||||
text.clear();
|
||||
}
|
||||
nana::size sz = value.data_ptr->size();
|
||||
|
||||
pixel_tag px = rs.pixels[rs.index];
|
||||
if ((rs.allowed_width < rs.pos.x + sz.width) && (rs.pos.x != px.x_base))
|
||||
{
|
||||
//Change a line.
|
||||
rs.pos.y += static_cast<int>(px.pixels);
|
||||
px = rs.pixels[++rs.index];
|
||||
rs.pos.x = px.x_base;
|
||||
}
|
||||
|
||||
int y = rs.pos.y + _m_text_top(px, value.fblock_ptr, value.data_ptr);
|
||||
|
||||
value.data_ptr->nontext_render(graph, rs.pos.x, y);
|
||||
_m_insert_if_traceable(rs.pos.x, y, sz, value.fblock_ptr);
|
||||
rs.pos.x += static_cast<int>(sz.width);
|
||||
|
||||
if(lastpos < y)
|
||||
return false;
|
||||
}
|
||||
|
||||
if(text.size())
|
||||
{
|
||||
_m_draw_block(graph, text, block_start, rs);
|
||||
text.clear();
|
||||
}
|
||||
}
|
||||
return (rs.pos.y <= lastpos);
|
||||
}
|
||||
#else
|
||||
bool _m_foreach_visual_line(graph_reference graph, render_status& rs)
|
||||
{
|
||||
std::wstring text;
|
||||
@ -804,20 +550,7 @@ namespace nana
|
||||
|
||||
return (rs.pos.y <= bottom);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0 //deprecated
|
||||
static bool _m_overline(const render_status& rs, int right, bool equal_required) noexcept
|
||||
{
|
||||
if(align::left == rs.text_align)
|
||||
return (equal_required ? right >= static_cast<int>(rs.allowed_width) : right > static_cast<int>(rs.allowed_width));
|
||||
|
||||
return (equal_required ? rs.pixels[rs.index].x_base <= 0 : rs.pixels[rs.index].x_base < 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VISUAL_LINES
|
||||
static int _m_vsline_element_top(const visual_line& vsline, fblock* fblock_ptr, const data* data_ptr) noexcept
|
||||
{
|
||||
switch (fblock_ptr->text_align)
|
||||
@ -832,24 +565,7 @@ namespace nana
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static int _m_text_top(const pixel_tag& px, fblock* fblock_ptr, const data* data_ptr)
|
||||
{
|
||||
switch(fblock_ptr->text_align)
|
||||
{
|
||||
case fblock::aligns::center:
|
||||
return static_cast<int>(px.pixels - data_ptr->size().height) / 2;
|
||||
case fblock::aligns::bottom:
|
||||
return static_cast<int>(px.pixels - data_ptr->size().height);
|
||||
case fblock::aligns::baseline:
|
||||
return static_cast<int>(px.baseline - (data_ptr->is_text() ? data_ptr->ascent() : data_ptr->size().height));
|
||||
default: break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VISUAL_LINES
|
||||
void _m_draw_vsline_element(graph_reference graph, const visual_line::element& vsline_elm, render_status& rs)
|
||||
{
|
||||
auto data = vsline_elm.content_element->data_ptr;
|
||||
@ -892,110 +608,6 @@ namespace nana
|
||||
rs.pos.x += static_cast<int>(data->size().width);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void _m_draw_block(graph_reference graph, const std::wstring& s, dstream::linecontainer::iterator block_start, render_status& rs)
|
||||
{
|
||||
auto const reordered = unicode_reorder(s.data(), s.length());
|
||||
|
||||
pixel_tag px = rs.pixels[rs.index];
|
||||
|
||||
for(auto & bidi : reordered)
|
||||
{
|
||||
std::size_t pos = bidi.begin - s.data();
|
||||
std::size_t len = bidi.end - bidi.begin;
|
||||
|
||||
while (true)
|
||||
{
|
||||
auto i = block_start;
|
||||
|
||||
//Text range indicates the position of text where begin to output
|
||||
//The output length is the min between len and the second of text range.
|
||||
auto text_range = _m_locate(i, pos);
|
||||
|
||||
if (text_range.second > len)
|
||||
text_range.second = len;
|
||||
|
||||
fblock * fblock_ptr = i->fblock_ptr;
|
||||
data * data_ptr = i->data_ptr;
|
||||
|
||||
#if 1
|
||||
const int range_text_area = static_cast<int>(rs.allowed_width) - rs.pos.x;
|
||||
|
||||
_m_change_font(graph, fblock_ptr);
|
||||
|
||||
auto text_extent_size = data_ptr->size();
|
||||
#ifndef _nana_std_has_string_view
|
||||
std::wstring_view text_sv{ data_ptr->text().c_str() + text_range.first, text_range.second };
|
||||
if (data_ptr->text().size() != text_sv.size())
|
||||
text_extent_size = graph.text_extent_size(text_sv);
|
||||
#else
|
||||
auto text_sv = data_ptr->text().substr(text_range.first, text_range.second);
|
||||
if (data_ptr->text().size() != text_sv.size())
|
||||
text_extent_size = graph.text_extent_size(text_sv);
|
||||
#endif
|
||||
if ((static_cast<int>(text_extent_size.width) > range_text_area) && (rs.pos.x != px.x_base))
|
||||
{
|
||||
//Change a new line
|
||||
rs.pos.y += static_cast<int>(px.pixels);
|
||||
px = rs.pixels[++rs.index];
|
||||
rs.pos.x = px.x_base;
|
||||
}
|
||||
|
||||
const int y = rs.pos.y + _m_text_top(px, fblock_ptr, data_ptr);
|
||||
graph.string({ rs.pos.x, y }, text_sv, _m_fgcolor(fblock_ptr));
|
||||
#else
|
||||
const int w = static_cast<int>(rs.allowed_width) - rs.pos.x;
|
||||
nana::size text_extent_size = data_ptr->size();
|
||||
if ((static_cast<int>(text_extent_size.width) > w) && (rs.pos.x != px.x_base))
|
||||
{
|
||||
//Change a new line
|
||||
rs.pos.y += static_cast<int>(px.pixels);
|
||||
px = rs.pixels[++rs.index];
|
||||
rs.pos.x = px.x_base;
|
||||
}
|
||||
|
||||
const int y = rs.pos.y + _m_text_top(px, fblock_ptr, data_ptr);
|
||||
|
||||
_m_change_font(graph, fblock_ptr);
|
||||
|
||||
#ifdef _nana_std_has_string_view
|
||||
std::wstring_view text_sv{ data_ptr->text() };
|
||||
if (text_range.second != text_sv.size())
|
||||
{
|
||||
text_sv = text_sv.substr(text_range.first, text_range.second);
|
||||
text_extent_size = graph.text_extent_size(text_sv);
|
||||
}
|
||||
|
||||
graph.string({ rs.pos.x, y }, text_sv, _m_fgcolor(fblock_ptr));
|
||||
#else
|
||||
if (text_range.second == data_ptr->text().length())
|
||||
{
|
||||
graph.string({ rs.pos.x, y }, data_ptr->text(), _m_fgcolor(fblock_ptr));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto str = data_ptr->text().substr(text_range.first, text_range.second);
|
||||
text_extent_size = graph.text_extent_size(str);
|
||||
|
||||
graph.string({ rs.pos.x, y }, str, _m_fgcolor(fblock_ptr));
|
||||
}
|
||||
#endif
|
||||
#endif //#if 0
|
||||
|
||||
_m_insert_if_traceable(rs.pos.x, y, text_extent_size, fblock_ptr);
|
||||
rs.pos.x += static_cast<int>(text_extent_size.width);
|
||||
|
||||
if(text_range.second < len)
|
||||
{
|
||||
len -= text_range.second;
|
||||
pos += text_range.second;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //VISUAL_LINES
|
||||
|
||||
static std::pair<std::size_t, std::size_t> _m_locate(dstream::linecontainer::iterator& i, std::size_t pos)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user