Merge branch 'develop'

This commit is contained in:
Jinhao 2018-05-22 15:04:36 +08:00
commit bd2fc63b20
9 changed files with 32 additions and 26 deletions

View File

@ -142,7 +142,11 @@ endif()
# #
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-std=gnu++14 -Wall") if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
set(CMAKE_CXX_FLAGS "-std=gnu++14 -Wall -I/usr/local/include")
else()
set(CMAKE_CXX_FLAGS "-std=gnu++14 -Wall")
endif()
else() else()
set(CMAKE_CXX_FLAGS "-std=c++14 -Wall") set(CMAKE_CXX_FLAGS "-std=c++14 -Wall")
endif() endif()

View File

@ -1541,7 +1541,7 @@ the nana::detail::basic_window member pointer scheme
nana::any* _m_anyobj(size_type cat, size_type index, bool allocate_if_empty) const override; nana::any* _m_anyobj(size_type cat, size_type index, bool allocate_if_empty) const override;
drawerbase::listbox::category_t* _m_assoc(std::shared_ptr<nana::detail::key_interface>, bool create_if_not_exists); drawerbase::listbox::category_t* _m_assoc(std::shared_ptr<nana::detail::key_interface>, bool create_if_not_exists);
void _m_erase_key(nana::detail::key_interface*) noexcept; void _m_erase_key(nana::detail::key_interface*) noexcept;
std::shared_ptr<scroll_operation_interface> _m_scroll_operation(); std::shared_ptr<scroll_operation_interface> _m_scroll_operation() override;
}; };
}//end namespace nana }//end namespace nana

View File

@ -279,7 +279,7 @@ namespace nana
native_string_type _m_caption() const throw() override; native_string_type _m_caption() const throw() override;
void _m_caption(native_string_type&&) override; void _m_caption(native_string_type&&) override;
void _m_typeface(const paint::font&) override; void _m_typeface(const paint::font&) override;
std::shared_ptr<scroll_operation_interface> _m_scroll_operation() const; std::shared_ptr<scroll_operation_interface> _m_scroll_operation() override;
}; };
}//end namespace nana }//end namespace nana
#include <nana/pop_ignore_diagnostic> #include <nana/pop_ignore_diagnostic>

View File

@ -446,7 +446,7 @@ namespace nana
item_proxy selected() const; ///< returns the selected node item_proxy selected() const; ///< returns the selected node
private: private:
std::shared_ptr<scroll_operation_interface> _m_scroll_operation() const; std::shared_ptr<scroll_operation_interface> _m_scroll_operation() override;
};//end class treebox };//end class treebox
}//end namespace nana }//end namespace nana

View File

@ -12,7 +12,9 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
static bool get_default_audio(std::string &, bool); # ifndef NANA_LINUX
static bool get_default_audio(std::string &, bool);
# endif
#endif #endif
namespace nana{namespace audio namespace nana{namespace audio
@ -47,14 +49,13 @@ namespace nana{namespace audio
}wave_native_if; }wave_native_if;
#endif #endif
//class audio_device //class audio_device
audio_device::audio_device() audio_device::audio_device():
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS) || defined(NANA_LINUX)
: handle_(nullptr), buf_prep_(nullptr) handle_(nullptr),
#elif defined(NANA_POSIX) #elif defined(NANA_POSIX)
: handle_(-1), buf_prep_(nullptr) handle_(-1),
#elif defined(NANA_LINUX)
: handle_(nullptr), buf_prep_(nullptr)
#endif #endif
buf_prep_(nullptr)
{} {}
audio_device::~audio_device() audio_device::~audio_device()
@ -64,11 +65,11 @@ namespace nana{namespace audio
bool audio_device::empty() const bool audio_device::empty() const
{ {
#ifdef NANA_POSIX #if defined(NANA_POSIX) && not defined(NANA_LINUX)
return (-1 == handle_); return (-1 == handle_);
#else #else
return (nullptr == handle_); return (nullptr == handle_);
#endif #endif
} }
bool audio_device::open(std::size_t channels, std::size_t rate, std::size_t bits_per_sample) bool audio_device::open(std::size_t channels, std::size_t rate, std::size_t bits_per_sample)
@ -249,11 +250,6 @@ namespace nana{namespace audio
wave_native_if.out_prepare(handle_, m, sizeof(WAVEHDR)); wave_native_if.out_prepare(handle_, m, sizeof(WAVEHDR));
wave_native_if.out_write(handle_, m, sizeof(WAVEHDR)); wave_native_if.out_write(handle_, m, sizeof(WAVEHDR));
#elif defined(NANA_POSIX)
// consider moving this to a background thread.
// currently this blocks calling thread.
::write(handle_, m->buf, m->bufsize);
buf_prep_->revert(m);
#elif defined(NANA_LINUX) #elif defined(NANA_LINUX)
std::size_t frames = m->bufsize / bytes_per_frame_; std::size_t frames = m->bufsize / bytes_per_frame_;
std::size_t buffered = 0; //in bytes std::size_t buffered = 0; //in bytes
@ -269,6 +265,11 @@ namespace nana{namespace audio
::snd_pcm_prepare(handle_); ::snd_pcm_prepare(handle_);
} }
buf_prep_->revert(m); buf_prep_->revert(m);
#elif defined(NANA_POSIX)
// consider moving this to a background thread.
// currently this blocks calling thread.
::write(handle_, m->buf, m->bufsize);
buf_prep_->revert(m);
#endif #endif
} }
@ -304,7 +305,7 @@ namespace nana{namespace audio
}//end namespace audio }//end namespace audio
}//end namespace nana }//end namespace nana
#ifdef NANA_POSIX #if defined(NANA_POSIX) && not defined(NANA_LINUX)
// parse input securely, no-overruns or overflows. // parse input securely, no-overruns or overflows.
static bool match(char *&cursor, const char *pattern, const char *tail) static bool match(char *&cursor, const char *pattern, const char *tail)
{ {

View File

@ -2583,8 +2583,9 @@ namespace nana
: public division : public division
{ {
public: public:
div_switchable(std::string && name, implement* impl) noexcept div_switchable(std::string && name, implement* /*impl*/) noexcept:
: division(kind::switchable, std::move(name)), impl_(impl) division(kind::switchable, std::move(name))//,
//impl_(impl) //deprecated
{} {}
private: private:
void collocate(window wd) override void collocate(window wd) override
@ -2613,7 +2614,7 @@ namespace nana
} }
} }
private: private:
implement * const impl_; //implement * const impl_; //deprecated
}; };
place::implement::~implement() place::implement::~implement()

View File

@ -817,7 +817,7 @@ namespace drawerbase {
editor->reset_caret_pixels(); editor->reset_caret_pixels();
} }
std::shared_ptr<scroll_operation_interface> textbox::_m_scroll_operation() const std::shared_ptr<scroll_operation_interface> textbox::_m_scroll_operation()
{ {
internal_scope_guard lock; internal_scope_guard lock;
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();

View File

@ -2234,7 +2234,7 @@ namespace nana
return item_proxy(const_cast<drawer_trigger_t*>(&get_drawer_trigger()), get_drawer_trigger().selected()); return item_proxy(const_cast<drawer_trigger_t*>(&get_drawer_trigger()), get_drawer_trigger().selected());
} }
std::shared_ptr<scroll_operation_interface> treebox::_m_scroll_operation() const std::shared_ptr<scroll_operation_interface> treebox::_m_scroll_operation()
{ {
internal_scope_guard lock; internal_scope_guard lock;
return std::make_shared<drawerbase::treebox::exclusive_scroll_operation>(get_drawer_trigger().impl()->shape.scroll); return std::make_shared<drawerbase::treebox::exclusive_scroll_operation>(get_drawer_trigger().impl()->shape.scroll);

View File

@ -34,7 +34,7 @@ static void posix_open_url(const char *url_utf8)
const char *home = getenv("HOME"); const char *home = getenv("HOME");
std::string cheat(home); std::string cheat(home);
cheat += "/.mozilla"; cheat += "/.mozilla";
struct stat exists{}; struct stat exists;
// TODO: generalize this for chromium, opera, waterfox, etc. // TODO: generalize this for chromium, opera, waterfox, etc.
// Most desktop environments (KDE, Gnome, Lumina etc.) provide a way to set // Most desktop environments (KDE, Gnome, Lumina etc.) provide a way to set