From 431f0af8931d918bf5b56e85928d2d00e0bf88f8 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 17 Mar 2017 07:29:34 +0800 Subject: [PATCH] fix syntax errors and warnings --- include/nana/optional.hpp | 12 ++++++------ source/gui/detail/bedrock_posix.cpp | 2 +- source/gui/place.cpp | 15 --------------- source/gui/widgets/button.cpp | 2 +- source/gui/widgets/combox.cpp | 6 +++--- source/gui/widgets/listbox.cpp | 16 ---------------- source/gui/widgets/picture.cpp | 4 ++-- source/gui/widgets/skeletons/text_editor.cpp | 16 ++++++++-------- source/gui/widgets/treebox.cpp | 3 +-- 9 files changed, 22 insertions(+), 54 deletions(-) diff --git a/include/nana/optional.hpp b/include/nana/optional.hpp index 4fe5bf47..49b81d88 100644 --- a/include/nana/optional.hpp +++ b/include/nana/optional.hpp @@ -96,7 +96,7 @@ namespace nana *ptr() = std::forward(value); else { - ::new (data) value_type(std::forward(value)); + ::new (data_) value_type(std::forward(value)); initialized_ = true; } } @@ -110,10 +110,10 @@ namespace nana } if (initialized_) - *ptr = *other.ptr(); + *ptr() = *other.ptr(); else { - ::new (data) value_type(*other.ptr()); + ::new (data_) value_type(*other.ptr()); initialized_ = true; } } @@ -130,7 +130,7 @@ namespace nana *ptr() = std::move(*other.ptr()); else { - ::new (data) value_type(std::move(*other.ptr())); + ::new (data_) value_type(std::move(*other.ptr())); initialized_ = true; } } @@ -203,9 +203,9 @@ namespace nana { if (this != &other) { - storage_.assign(std::move(other.storage_)) + storage_.assign(std::move(other.storage_)); } - return *this;l + return *this; } template diff --git a/source/gui/detail/bedrock_posix.cpp b/source/gui/detail/bedrock_posix.cpp index f47ca96a..408022a0 100644 --- a/source/gui/detail/bedrock_posix.cpp +++ b/source/gui/detail/bedrock_posix.cpp @@ -1,7 +1,7 @@ /* * A Bedrock Implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at diff --git a/source/gui/place.cpp b/source/gui/place.cpp index e3ffd163..102c4208 100644 --- a/source/gui/place.cpp +++ b/source/gui/place.cpp @@ -1150,21 +1150,6 @@ namespace nana px = (vert ? move_r.height : move_r.width); moved = true; } - /* - auto extent = API::content_extent(el.handle, 0, false); //deprecated - if (extent) - { - move_r.dimension(extent->second); - - if (vert) - move_r.x += place_parts::differ(area_margined.width, move_r.width) / 2; - else - move_r.y += place_parts::differ(area_margined.height, move_r.height) / 2; - - px = (vert ? move_r.height : move_r.width); - moved = true; - } - */ } if (!moved) diff --git a/source/gui/widgets/button.cpp b/source/gui/widgets/button.cpp index 16cf441b..2e2d4d9f 100644 --- a/source/gui/widgets/button.cpp +++ b/source/gui/widgets/button.cpp @@ -27,7 +27,7 @@ namespace nana{ namespace drawerbase : trigger_{ t } {} - optional measure(graph_reference graph, unsigned limit_pixels, bool limit_width) const override + optional measure(graph_reference graph, unsigned limit_pixels, bool /*limit_width*/) const override { //Button doesn't provide a support of vfit and hfit if (limit_pixels) diff --git a/source/gui/widgets/combox.cpp b/source/gui/widgets/combox.cpp index 77f199ab..84965aec 100644 --- a/source/gui/widgets/combox.cpp +++ b/source/gui/widgets/combox.cpp @@ -90,14 +90,14 @@ namespace nana : drw_{ drwimpl } {} - optional measure(graph_reference graph, unsigned limit_pixels, bool limit_width) const override + optional measure(graph_reference graph, unsigned limit_pixels, bool /*limit_width*/) const override { - //Button doesn't provide a support of vfit and hfit + //Combox doesn't provide a support of vfit and hfit if (limit_pixels) return{}; size content_size; - for (auto i = 0; i < drw_->the_number_of_options(); ++i) + for (std::size_t i = 0; i < drw_->the_number_of_options(); ++i) { auto & m = drw_->at(i); auto sz = graph.text_extent_size(m.item_text); diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 6beb60e2..ad52db59 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -3406,9 +3406,6 @@ namespace nana /// is ignored if no change (maybe set last_selected anyway??), but if change emit event, deselect others if need ans set/unset last_selected item_proxy::from_display(ess_, next_selected_dpl).select(true); - - //if (trace_selected) - // ess_->trace_item_dpl(next_selected_dpl); //deprecated } break; } @@ -4576,16 +4573,7 @@ namespace nana if (essence_->header.sortable() && essence_->pointer_where.first == parts::header && prev_state == item_state::pressed) { if(essence_->pointer_where.second < essence_->header.cont().size()) - { - /* - if(essence_->lister.sort_column(essence_->pointer_where.second, nullptr)) - { - //essence_->trace_item_dpl(index_pair{0,0}); //deprecated - need_refresh = true; - } - */ need_refresh = essence_->lister.sort_column(essence_->pointer_where.second, nullptr); - } } else if (item_state::grabbed == prev_state) { @@ -4720,8 +4708,6 @@ namespace nana else if (!essence_->lister.single_status(true)) //not selected essence_->lister.cat_status(idx.cat, true, true); - //essence_->trace_last_selected_item (); //deprecated - break; } case keyboard::os_home: @@ -4734,13 +4720,11 @@ namespace nana else if (!essence_->lister.single_status(true)) //not selected essence_->lister.cat_status(frst.cat, true, true); - //essence_->trace_last_selected_item (); //deprecated break; } case keyboard::os_end: essence_->lister.select_for_all(false); item_proxy::from_display(essence_, essence_->lister.last()).select(true); - //essence_->trace_last_selected_item (); //deprecated break; default: return; diff --git a/source/gui/widgets/picture.cpp b/source/gui/widgets/picture.cpp index 650f434c..b07f68d9 100644 --- a/source/gui/widgets/picture.cpp +++ b/source/gui/widgets/picture.cpp @@ -58,9 +58,9 @@ namespace nana : impl_{impl} {} - optional measure(graph_reference graph, unsigned limit_pixels, bool limit_width) const override + optional measure(graph_reference /*graph*/, unsigned limit_pixels, bool /*limit_width*/) const override { - //Button doesn't provide a support of vfit and hfit + //Picture doesn't provide a support of vfit and hfit if (!limit_pixels) { if (impl_->backimg.valid_area.empty()) diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index f77ec32c..2437b900 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -446,8 +446,11 @@ namespace nana{ namespace widgets std::swap(first, second); if (second < this->sections_.size()) +#ifdef _MSC_VER this->sections_.erase(this->sections_.cbegin() + (first + 1), this->sections_.cbegin() + second); - +#else + this->sections_.erase(this->sections_.begin() + (first + 1), this->sections_.begin() + second); +#endif pre_calc_line(first, 0); //textbase is implement by using deque, and the linemtr holds the text pointers @@ -468,8 +471,11 @@ namespace nana{ namespace widgets if (pos < this->sections_.size()) { for (std::size_t i = 0; i < line_size; ++i) +#ifdef _MSC_VER this->sections_.emplace(this->sections_.cbegin() + (pos + i)); - +#else + this->sections_.emplace(this->sections_.begin() + (pos + i)); +#endif //textbase is implement by using deque, and the linemtr holds the text pointers //If the textbase is changed, it will check the text pointers. std::size_t line = 0; @@ -2664,7 +2670,6 @@ namespace nana{ namespace widgets unicode_bidi{}.linestr(text_ptr, text_size, reordered); nana::upoint res(static_cast(real_str.begin - sections.front().begin), static_cast(row.first)); - //scrpos.x += points_.offset.x - text_area_.area.x; //deprecated scrpos.x -= _m_text_x(sections[row.second]); if (scrpos.x < 0) @@ -3440,12 +3445,9 @@ namespace nana{ namespace widgets void text_editor::_m_draw_string(int top, const ::nana::color& clr, const nana::upoint& text_coord, const text_section& sct, bool if_mask) const { - auto const behavior = impl_->capacities.behavior; point text_draw_pos{ _m_text_x(sct), top }; const int text_right = text_area_.area.right(); - - //auto text_ptr = &text; //deprecated auto const text_len = static_cast(sct.end - sct.begin); auto text_ptr = sct.begin; @@ -3482,8 +3484,6 @@ namespace nana{ namespace widgets { if (a.y < text_coord.y && text_coord.y < b.y) { - //sbegin = text_ptr->c_str(); //deprecated - //send = sbegin + text_ptr->size(); sbegin = sct.begin; send = sct.end; } diff --git a/source/gui/widgets/treebox.cpp b/source/gui/widgets/treebox.cpp index 350a4210..e62e728f 100644 --- a/source/gui/widgets/treebox.cpp +++ b/source/gui/widgets/treebox.cpp @@ -611,7 +611,7 @@ namespace nana { scroll.create(*data.widget_ptr, nana::rectangle(data.graph->width() - 16, 0, 16, data.graph->height())); - scroll.events().value_changed.connect_unignorable([this](const arg_scroll& arg) + scroll.events().value_changed.connect_unignorable([this](const arg_scroll&) { adjust.scroll_timestamp = nana::system::timestamp(); adjust.timer.start(); @@ -1791,7 +1791,6 @@ namespace nana if (!node) return; - auto & node_state = impl_->node_state; switch (nl.what()) { case component::icon: