From bbc39906c00950b537d40876e433de412ef408bb Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 15 Feb 2019 06:27:17 +0800 Subject: [PATCH] remove deprecated code and debug code --- include/nana/datetime.hpp | 2 +- include/nana/gui/effects.hpp | 2 +- include/nana/gui/widgets/detail/compset.hpp | 11 - include/nana/gui/widgets/treebox.hpp | 21 -- source/detail/platform_spec_posix.cpp | 69 +---- source/detail/posix/msg_dispatcher.hpp | 6 - source/detail/posix/theme.cpp | 14 - source/detail/posix/xdnd_protocol.hpp | 91 +------ source/gui/detail/bedrock_posix.cpp | 2 - source/gui/detail/drawer.cpp | 2 +- source/gui/detail/native_window_interface.cpp | 17 -- source/gui/dragdrop.cpp | 99 +------ source/gui/filebox.cpp | 256 +----------------- source/gui/widgets/listbox.cpp | 9 +- source/gui/widgets/skeletons/text_editor.cpp | 1 - source/gui/widgets/treebox.cpp | 40 --- 16 files changed, 28 insertions(+), 614 deletions(-) diff --git a/include/nana/datetime.hpp b/include/nana/datetime.hpp index 3abe9500..c87d58a3 100644 --- a/include/nana/datetime.hpp +++ b/include/nana/datetime.hpp @@ -1,6 +1,6 @@ /* * A Date Time Implementation - * Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2019 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/include/nana/gui/effects.hpp b/include/nana/gui/effects.hpp index c7a8f0a4..c405f8ef 100644 --- a/include/nana/gui/effects.hpp +++ b/include/nana/gui/effects.hpp @@ -1,6 +1,6 @@ /* * Background Effects Implementation - * Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2019 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/include/nana/gui/widgets/detail/compset.hpp b/include/nana/gui/widgets/detail/compset.hpp index 8518b85c..363bb6a7 100644 --- a/include/nana/gui/widgets/detail/compset.hpp +++ b/include/nana/gui/widgets/detail/compset.hpp @@ -59,21 +59,10 @@ namespace nana{ namespace widgets{ namespace detail /// Widget scheme. typedef WidgetScheme widget_scheme_t; - - //widget_scheme_t * wdg_scheme_ptr_{ nullptr }; //deprecated - public: /// The destructor. virtual ~compset_placer(){} - /* - /// Init the scheme pointer - void init_scheme(widget_scheme_t* wdg_scheme_ptr) //deprecated - { - wdg_scheme_ptr_ = wdg_scheme_ptr; - } - */ - /// Enable/Disable the specified component. virtual void enable(component_t, bool) = 0; virtual bool enabled(component_t) const = 0; diff --git a/include/nana/gui/widgets/treebox.hpp b/include/nana/gui/widgets/treebox.hpp index 0d78bbde..ba40c4c1 100644 --- a/include/nana/gui/widgets/treebox.hpp +++ b/include/nana/gui/widgets/treebox.hpp @@ -105,15 +105,8 @@ namespace nana class trigger :public drawer_trigger { - //template - //struct basic_implement; //deprecated - class implementation; - - //class item_renderer; //deprecated class item_locator; - - //typedef basic_implement implement; //deprecated public: struct treebox_node_type { @@ -142,17 +135,12 @@ namespace nana pat::cloneable& renderer() const; - //void renderer(::nana::pat::cloneable&&); - //const ::nana::pat::cloneable& renderer() const; //deprecated void placer(::nana::pat::cloneable&&); const ::nana::pat::cloneable& placer() const; node_type* insert(node_type*, const std::string& key, std::string&&); node_type* insert(const std::string& path, std::string&&); - //node_type * selected() const; //deprecated - //void selected(node_type*); - node_image_tag& icon(const ::std::string&); void icon_erase(const ::std::string&); void node_icon(node_type*, const ::std::string& id); @@ -314,15 +302,6 @@ namespace nana return *p; } - /* - template - item_proxy & value(const T& t) //deprecated - { - _m_value() = t; - return *this; - } - */ - template item_proxy & value(T&& t) { diff --git a/source/detail/platform_spec_posix.cpp b/source/detail/platform_spec_posix.cpp index f607e9a3..bca68ea8 100644 --- a/source/detail/platform_spec_posix.cpp +++ b/source/detail/platform_spec_posix.cpp @@ -36,8 +36,6 @@ #include "posix/msg_dispatcher.hpp" -#include //debug - namespace nana { namespace detail @@ -1121,12 +1119,7 @@ namespace detail platform_scope_guard lock; if(0 != xdnd_.dragdrop.count(wd)) return false; -#if 0 //deprecated - std::cout<<"ChangeProperty XdndAware"<(wd), atombase_.xdnd_aware, XA_ATOM, sizeof(int) * 8, - PropModeReplace, reinterpret_cast(&dndver), 1); -#endif + xdnd_.dragdrop[wd] = ddrop; return true; } @@ -1140,7 +1133,6 @@ namespace detail new_val = (xdnd_.targets[wd] += count); if(1 == new_val) { - std::cout<<"ChangeProperty XdndAware"<(wd), atombase_.xdnd_aware, XA_ATOM, sizeof(int) * 8, PropModeReplace, reinterpret_cast(&dndver), 1); @@ -1235,7 +1227,6 @@ namespace detail } else if(evt.xselection.property == self.atombase_.xdnd_selection) { - std::cout<<"Platform SelectionNotfy by XdndSelection, type="<push_back(file); } - std::cout<<" file size:"<size()<size()) { msg.u.mouse_drop.window = evt.xselection.requestor; @@ -1285,8 +1274,6 @@ namespace detail accepted = true; ::XFree(data); } - else - std::cout<<" invalid property"<(&(evt.xclient.data.l[2])); unsigned long len = 3; unsigned char * data = 0; @@ -1380,32 +1360,19 @@ namespace detail Atom type; int format; unsigned long bytes_left; - auto status = ::XGetWindowProperty(self.display_, self.xdnd_.wd_src, self.atombase_.xdnd_typelist, 0, 0, False, + ::XGetWindowProperty(self.display_, self.xdnd_.wd_src, self.atombase_.xdnd_typelist, 0, 0, False, XA_ATOM, &type, &format, &len, &bytes_left, &data); - std::cout<<", XGetWindowProperty xdnd_typelist = "<> 16); int y = (evt.xclient.data.l[2] & 0xFFFF); @@ -1482,7 +1433,6 @@ namespace detail Window child; ::XTranslateCoordinates(self.display_, self.root_window(), evt.xclient.window, x, y, &self.xdnd_.pos.x, &self.xdnd_.pos.y, &child); - std::cout<<" find_window"<(evt.xclient.window), self.xdnd_.pos); if(wd && wd->flags.dropable) { @@ -1491,8 +1441,6 @@ namespace detail self.xdnd_.pos = wd->pos_root; accepted = 1; } - - std::cout<<" return,"< #include -#include //debug - namespace nana { namespace detail @@ -231,10 +229,6 @@ namespace detail if(keymap[event.xkey.keycode / 8] & (1 << (event.xkey.keycode % 8))) continue; } - else if(SelectionRequest == event.type) - { - std::cout<<"Dispatcher SelectionRequest"< #include -#include //debug namespace nana { namespace detail @@ -179,13 +178,7 @@ namespace nana auto name = find_kde_theme_name(); if(name.empty()) - { - name = find_gnome_theme_name(); - std::cout<<"GNOME:"< directories_; }; - void test() - { - theme thm; - auto png = thm.icon("folder", 30); - std::cout<<"Icon Theme="< -#define DEBUG_XDND_PROTOCOL - -#ifdef DEBUG_XDND_PROTOCOL -#include //debug -#endif - namespace nana{ namespace detail { @@ -58,15 +52,6 @@ namespace nana{ detail::platform_scope_guard lock; ::XSetSelectionOwner(disp, spec_.atombase().xdnd_selection, source, CurrentTime); -#ifdef DEBUG_XDND_PROTOCOL - std::cout<<"XSetSelectionOwner "<(xclient.data.l[0]); bool is_accepted_by_target = (xclient.data.l[1] & 1); -#ifdef DEBUG_XDND_PROTOCOL - std::cout<<"XdndStatus: Accepted="< #include -#include //debug namespace nana { @@ -445,7 +444,6 @@ namespace detail case nana::detail::msg_packet_tag::pkt_family::mouse_drop: msgwd = brock.wd_manager().find_window(native_window, {msg.u.mouse_drop.x, msg.u.mouse_drop.y}); - std::cout<<" MouseDrop msgwd="<& evt_codes, const bool bDisabled) { - for (const auto& evt_code : evt_codes) + for (auto evt_code : evt_codes) { filter_event(evt_code, bDisabled); } diff --git a/source/gui/detail/native_window_interface.cpp b/source/gui/detail/native_window_interface.cpp index cf01e33d..a9753bc7 100644 --- a/source/gui/detail/native_window_interface.cpp +++ b/source/gui/detail/native_window_interface.cpp @@ -955,14 +955,6 @@ namespace nana{ auto fm_extents = window_frame_extents(wd); origin.x = -fm_extents.left; origin.y = -fm_extents.top; -#if 0 //deprecated - if(reinterpret_cast(coord_wd) != restrict::spec.root_window()) - { - fm_extents = window_frame_extents(coord_wd); - origin.x += fm_extents.left; - origin.y += fm_extents.top; - } -#endif } else coord_wd = get_window(wd, window_relationship::parent); @@ -1601,10 +1593,6 @@ namespace nana{ if(True == ::XTranslateCoordinates(restrict::spec.open_display(), reinterpret_cast(wd), restrict::spec.root_window(), x, y, &pos.x, &pos.y, &child)) { - //deprecated - //auto fm_extents = window_frame_extents(wd); - //pos.x += fm_extents.left; - //pos.y += fm_extents.top; return true; } #endif @@ -1627,11 +1615,6 @@ namespace nana{ Window child; if(True == ::XTranslateCoordinates(restrict::spec.open_display(), restrict::spec.root_window(), reinterpret_cast(wd), x, y, &pos.x, &pos.y, &child)) { - //deprecated - //Now the origin of pos is the left-top corner of the window(including titlebar and border) - //auto fm_extents = window_frame_extents(wd); - //pos.x += fm_extents.left; - //pos.y += fm_extents.top; return true; } #endif diff --git a/source/gui/dragdrop.cpp b/source/gui/dragdrop.cpp index 2c2d394a..18f51e52 100644 --- a/source/gui/dragdrop.cpp +++ b/source/gui/dragdrop.cpp @@ -308,66 +308,6 @@ namespace nana class win32_dropdata : public win32com_iunknown { -#if 0 //deprecated - class enumer : public win32com_iunknown - { - public: - enumer(drop_data& data) : - data_(data) - {} - - enumer(const enumer& rhs): - data_(rhs.data_), - cursor_(rhs.cursor_) - { - } - private: - // Implement IEnumFORMATETC - HRESULT Clone(IEnumFORMATETC **ppenum) override - { - *ppenum = new enumer{ *this }; - return S_OK; - } - - HRESULT Next(ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched) override - { - HRESULT result = (cursor_ + celt <= data_.entries_.size() ? S_OK : S_FALSE); - - auto const fetched = (std::min)(std::size_t(celt), data_.entries_.size() - cursor_); - - for (std::size_t i = 0; i < fetched; ++i) - *rgelt++ = data_.entries_[cursor_++]->format; - - if (pceltFetched) - *pceltFetched = static_cast(fetched); - else if (celt > 1) - return S_FALSE; - - return (celt == fetched ? S_OK : S_FALSE); - } - - HRESULT Reset() override - { - cursor_ = 0; - return S_OK; - } - - HRESULT Skip(ULONG celt) override - { - if (cursor_ + celt < data_.entries_.size()) - { - cursor_ += celt; - return S_OK; - } - - cursor_ = data_.entries_.size(); - return S_FALSE; - } - private: - drop_data & data_; - std::size_t cursor_; - }; -#endif public: struct data_entry { @@ -625,8 +565,6 @@ namespace nana #elif defined(NANA_X11) - constexpr int xdnd_version = 5; - class x11_dropdata { public: @@ -839,17 +777,13 @@ namespace nana auto cur_wd = API::find_window(API::cursor_position()); - std::cout<<" Hovered="<has(drag_wd, cur_wd)) ? "dnd-move" : "dnd-none"); - std::cout<<" ICON="<(window_handle); + auto real_wd = reinterpret_cast(window_handle); real_wd->other.dnd_state = dragdrop_status::not_ready; } @@ -1072,8 +1001,7 @@ namespace nana { impl_->dragging = ((!impl_->predicate) || impl_->predicate()); - using basic_window = ::nana::detail::basic_window; - auto real_wd = reinterpret_cast<::nana::detail::basic_window*>(impl_->window_handle); + auto real_wd = reinterpret_cast(impl_->window_handle); real_wd->other.dnd_state = dragdrop_status::ready; } }); @@ -1082,8 +1010,7 @@ namespace nana if (!(arg.is_left_button() && impl_->dragging && API::is_window(arg.window_handle))) return; - using basic_window = ::nana::detail::basic_window; - auto real_wd = reinterpret_cast<::nana::detail::basic_window*>(arg.window_handle); + auto real_wd = reinterpret_cast(arg.window_handle); real_wd->other.dnd_state = dragdrop_status::in_progress; std::unique_ptr dropdata{new dragdrop_service::dropdata_type}; @@ -1190,8 +1117,7 @@ namespace nana { impl_->dragging = ((!impl_->predicate) || impl_->predicate()); - using basic_window = ::nana::detail::basic_window; - auto real_wd = reinterpret_cast<::nana::detail::basic_window*>(impl_->source_handle); + auto real_wd = reinterpret_cast(impl_->source_handle); real_wd->other.dnd_state = dragdrop_status::ready; } }); @@ -1200,27 +1126,14 @@ namespace nana if (!(arg.is_left_button() && impl_->dragging && API::is_window(arg.window_handle))) return; - using basic_window = ::nana::detail::basic_window; - auto real_wd = reinterpret_cast<::nana::detail::basic_window*>(arg.window_handle); + auto real_wd = reinterpret_cast(arg.window_handle); real_wd->other.dnd_state = dragdrop_status::in_progress; impl_->make_drop(); - //deprecated - //auto has_dropped = dragdrop_service::instance().dragdrop(arg.window_handle); real_wd->other.dnd_state = dragdrop_status::not_ready; impl_->dragging = false; - - /* //deprecated - if (has_dropped) - { - auto drop_wd = API::find_window(API::cursor_position()); - //auto i = impl_->targets.find(drop_wd); - //if ((impl_->targets.end() != i) && i->second) - // i->second(); - } - */ }); } diff --git a/source/gui/filebox.cpp b/source/gui/filebox.cpp index a8848e1e..b830b8e5 100644 --- a/source/gui/filebox.cpp +++ b/source/gui/filebox.cpp @@ -250,19 +250,14 @@ namespace nana else if(event_code::mouse_up == arg.evt_code) { selection_.is_deselect_delayed = false; -#if 0 - this->_m_delay_deselect(true); -#endif + if(_m_sync_with_selection()) _m_display_target_filenames(); } else if(event_code::mouse_move == arg.evt_code) { if(arg.left_button) - { selection_.is_deselect_delayed = false; - std::cout<<"MouseMove set is_deselect_delayed = true"< files() const { if(kind::none == selection_.type) @@ -1005,53 +984,8 @@ namespace nana else _m_load_cat_path(addr_.filesystem + m.name + "/"); } -#if 0 - else - { - if((mode::open_directory == mode_) || (false == m.directory)) - { - if(ls_file_.is_single_enabled(true) || !arg.ctrl) - { - std::cout<<"assign by click select "<(fattr.type()); - - //Check if the selected name is a directory - auto is_dir = fs::is_directory(fattr); - - if(!is_dir && _m_append_def_extension(tar)) - { - //Add the extension, then check if it is a directory again. - fattr = fs::status(tar); - ftype = static_cast(fattr.type()); - is_dir = fs::is_directory(fattr); - } - - if(is_dir) - { - _m_load_cat_path(tar); - tb_file_.caption(std::string{}); - return; - } - - if(mode::write_file != mode_) - { - if(fs::file_type::not_found == ftype) - { - msgbox mb(*this, caption()); - mb.icon(msgbox::icon_information); - if(mode::open_file == mode_) - mb << i18n("NANA_FILEBOX_ERROR_NOT_EXISTING_AND_RETRY", tar); - else - mb << i18n("NANA_FILEBOX_ERROR_DIRECTORY_NOT_EXISTING_AND_RETRY", tar); - mb(); - - return; - } - } - else - { - if(fs::file_type::not_found != ftype) - { - msgbox mb(*this, caption(), msgbox::yes_no); - mb.icon(msgbox::icon_question); - mb<(fattr.type()); - - //Check if the selected name is a directory - auto is_dir = fs::is_directory(fattr); - - if(!is_dir && _m_append_def_extension(tar)) - { - //Add the extension, then check if it is a directory again. - fattr = fs::status(tar); - ftype = static_cast(fattr.type()); - is_dir = fs::is_directory(fattr); - } - - if(is_dir) - { - //Enter the directory if this is the first tar. - if(0 == tar_idx) - { - _m_load_cat_path(tar); - tb_file_.caption(std::string{}); - return; - } - - //Other folders are ignored - continue; - } - - if(mode::write_file != mode_) - { - if(fs::file_type::not_found == ftype) - { - msgbox mb(*this, caption()); - mb.icon(msgbox::icon_information); - if(mode::open_file == mode_) - mb << i18n("NANA_FILEBOX_ERROR_NOT_EXISTING_AND_RETRY", tar); - else - mb << i18n("NANA_FILEBOX_ERROR_DIRECTORY_NOT_EXISTING_AND_RETRY", tar); - mb(); - - return; - } - } - else - { - if(fs::file_type::not_found != ftype) - { - msgbox mb(*this, caption(), msgbox::yes_no); - mb.icon(msgbox::icon_question); - mb< targets; -#if 0 - std::vector delay_deselect; -#endif bool is_deselect_delayed{ false }; }selection_; diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 28f8c409..29105225 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -144,8 +144,6 @@ namespace nana const std::string&, nana::any*, bool reverse)> weak_ordering; std::shared_ptr font; ///< The exclusive column font - - column() = default; column(const column&) = default; @@ -6186,10 +6184,9 @@ namespace nana const nana::any *rowval, bool reverse)> comp) { - if (first_col<0 || last_col<=first_col) - return; - if (last_col >= column_size()) + if (last_col <= first_col || last_col >= column_size()) return; + std::vector new_idx; for(size_type i=first_col; i<=last_col; ++i) new_idx.push_back(i); @@ -6207,7 +6204,7 @@ namespace nana //Only change the view position of columns for(size_t i=0; ishape; - switch(affect) { case 0: break; @@ -1692,7 +1682,6 @@ namespace nana { impl_->data.trigger_ptr = this; impl_->data.renderer = nana::pat::cloneable(internal_renderer()); - //impl_->data.comp_placer = nana::pat::cloneable(internal_placer()); //deprecated impl_->adjust.timer.elapse([this] { @@ -1827,18 +1816,6 @@ namespace nana } } - /* //deprecated - void trigger::renderer(::nana::pat::cloneable&& r) - { - impl_->data.renderer = std::move(r); - } - - const ::nana::pat::cloneable& trigger::renderer() const - { - return impl_->data.renderer; - } - */ - ::nana::pat::cloneable& trigger::renderer() const { return impl_->data.renderer; @@ -1876,21 +1853,6 @@ namespace nana return x; } - /* - trigger::node_type* trigger::selected() const //deprecated - { - return impl_->node_state.selected; - } - */ - - /* - void trigger::selected(node_type* node) //deprecated - { - if(impl_->attr.tree_cont.verify(node) && impl_->set_selected(node)) - impl_->draw(true); - } - */ - node_image_tag& trigger::icon(const std::string& id) { auto i = impl_->shape.image_table.find(id); @@ -1958,7 +1920,6 @@ namespace nana widget.bgcolor(colors::white); impl_->data.widget_ptr = static_cast<::nana::treebox*>(&widget); impl_->data.scheme_ptr = static_cast<::nana::treebox::scheme_type*>(API::dev::get_scheme(widget)); - //impl_->data.comp_placer->init_scheme(impl_->data.scheme_ptr); //deprecated impl_->data.comp_placer = nana::pat::cloneable(internal_placer{ *impl_->data.scheme_ptr }); widget.caption("nana treebox"); @@ -2386,7 +2347,6 @@ namespace nana treebox::item_proxy treebox::selected() const { - //return item_proxy(const_cast(&get_drawer_trigger()), get_drawer_trigger().selected()); //deprecated auto dw = &get_drawer_trigger(); return item_proxy(const_cast(dw), dw->impl()->node_state.selected); }