fix some MinGW compiling errors
This commit is contained in:
		
							parent
							
								
									766b9a1e24
								
							
						
					
					
						commit
						ad0dcc0bcf
					
				@ -449,7 +449,7 @@ namespace detail
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
             (msgbox(modal_window, STR("An uncaptured std::exception during message pumping: ")).icon(msgbox::icon_information)
 | 
					             (msgbox(modal_window, STR("An uncaptured std::exception during message pumping: ")).icon(msgbox::icon_information)
 | 
				
			||||||
                                 <<STR("\n   in form: ") << API::window_caption(modal_window)
 | 
					                                 <<STR("\n   in form: ") << API::window_caption(modal_window)
 | 
				
			||||||
                                 <<STR("\n   exception : ") << e.what() 
 | 
					                                 <<STR("\n   exception : ") << e.what()
 | 
				
			||||||
             ).show();
 | 
					             ).show();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			 internal_scope_guard lock;
 | 
								 internal_scope_guard lock;
 | 
				
			||||||
@ -550,7 +550,7 @@ namespace detail
 | 
				
			|||||||
		::ScreenToClient(reinterpret_cast<HWND>(wd->root), &point);
 | 
							::ScreenToClient(reinterpret_cast<HWND>(wd->root), &point);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		arg.upwards = (pmdec.mouse.button.wheel_delta >= 0);
 | 
							arg.upwards = (pmdec.mouse.button.wheel_delta >= 0);
 | 
				
			||||||
		arg.distance = std::abs(pmdec.mouse.button.wheel_delta);
 | 
							arg.distance = static_cast<unsigned>(arg.upwards ? pmdec.mouse.button.wheel_delta : -pmdec.mouse.button.wheel_delta);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		arg.pos.x = static_cast<int>(point.x) - wd->pos_root.x;
 | 
							arg.pos.x = static_cast<int>(point.x) - wd->pos_root.x;
 | 
				
			||||||
		arg.pos.y = static_cast<int>(point.y) - wd->pos_root.y;
 | 
							arg.pos.y = static_cast<int>(point.y) - wd->pos_root.y;
 | 
				
			||||||
@ -1641,7 +1641,7 @@ namespace detail
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			if (try_destroy)
 | 
								if (try_destroy)
 | 
				
			||||||
				native_interface::close_window(impl_->menu.window);
 | 
									native_interface::close_window(impl_->menu.window);
 | 
				
			||||||
			
 | 
					
 | 
				
			||||||
			impl_->menu.window = impl_->menu.owner = nullptr;
 | 
								impl_->menu.window = impl_->menu.owner = nullptr;
 | 
				
			||||||
			impl_->menu.has_keyboard = false;
 | 
								impl_->menu.has_keyboard = false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -1687,7 +1687,7 @@ namespace detail
 | 
				
			|||||||
			else if (::nana::category::flags::lite_widget == child->other.category)
 | 
								else if (::nana::category::flags::lite_widget == child->other.category)
 | 
				
			||||||
				map_through_widgets(child, drawable);
 | 
									map_through_widgets(child, drawable);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#endif	
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool bedrock::emit(event_code evt_code, core_window_t* wd, const arg_mouse& arg, bool ask_update, thread_context* thrd)
 | 
						bool bedrock::emit(event_code evt_code, core_window_t* wd, const arg_mouse& arg, bool ask_update, thread_context* thrd)
 | 
				
			||||||
 | 
				
			|||||||
@ -3,8 +3,8 @@
 | 
				
			|||||||
 *	Nana C++ Library(http://www.nanapro.org)
 | 
					 *	Nana C++ Library(http://www.nanapro.org)
 | 
				
			||||||
 *	Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
 | 
					 *	Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *	Distributed under the Boost Software License, Version 1.0. 
 | 
					 *	Distributed under the Boost Software License, Version 1.0.
 | 
				
			||||||
 *	(See accompanying file LICENSE_1_0.txt or copy at 
 | 
					 *	(See accompanying file LICENSE_1_0.txt or copy at
 | 
				
			||||||
 *	http://www.boost.org/LICENSE_1_0.txt)
 | 
					 *	http://www.boost.org/LICENSE_1_0.txt)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *	@file: nana/gui/msgbox.hpp
 | 
					 *	@file: nana/gui/msgbox.hpp
 | 
				
			||||||
@ -23,6 +23,7 @@
 | 
				
			|||||||
#include <nana/internationalization.hpp>
 | 
					#include <nana/internationalization.hpp>
 | 
				
			||||||
#include <nana/gui/filebox.hpp>
 | 
					#include <nana/gui/filebox.hpp>
 | 
				
			||||||
#include <functional>
 | 
					#include <functional>
 | 
				
			||||||
 | 
					#include <cstdlib>  //include std::abs
 | 
				
			||||||
#if defined(NANA_WINDOWS)
 | 
					#if defined(NANA_WINDOWS)
 | 
				
			||||||
	#include <windows.h>
 | 
						#include <windows.h>
 | 
				
			||||||
#elif defined(NANA_X11)
 | 
					#elif defined(NANA_X11)
 | 
				
			||||||
@ -489,7 +490,7 @@ namespace nana
 | 
				
			|||||||
				close();
 | 
									close();
 | 
				
			||||||
				valid_input_ = true;
 | 
									valid_input_ = true;
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
			
 | 
					
 | 
				
			||||||
			btn_cancel_.create(*this);
 | 
								btn_cancel_.create(*this);
 | 
				
			||||||
			btn_cancel_.i18n(i18n_eval("Cancel"));
 | 
								btn_cancel_.i18n(i18n_eval("Cancel"));
 | 
				
			||||||
			btn_cancel_.events().click.connect_unignorable([this]{
 | 
								btn_cancel_.events().click.connect_unignorable([this]{
 | 
				
			||||||
@ -501,7 +502,7 @@ namespace nana
 | 
				
			|||||||
			place_.bind(*this);
 | 
								place_.bind(*this);
 | 
				
			||||||
			std::stringstream ss_content;
 | 
								std::stringstream ss_content;
 | 
				
			||||||
			ss_content << "<margin=10 vert <desc weight=" << desc_extent.height << "><vert margin=[10]";
 | 
								ss_content << "<margin=10 vert <desc weight=" << desc_extent.height << "><vert margin=[10]";
 | 
				
			||||||
			
 | 
					
 | 
				
			||||||
			for (std::size_t i = 0; i < contents; ++i)
 | 
								for (std::size_t i = 0; i < contents; ++i)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				unsigned px = 27;
 | 
									unsigned px = 27;
 | 
				
			||||||
@ -978,7 +979,7 @@ namespace nana
 | 
				
			|||||||
	window inputbox::date::create(window parent, unsigned label_px)
 | 
						window inputbox::date::create(window parent, unsigned label_px)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		auto today = ::nana::date().read();
 | 
							auto today = ::nana::date().read();
 | 
				
			||||||
		
 | 
					
 | 
				
			||||||
		auto impl = impl_.get();
 | 
							auto impl = impl_.get();
 | 
				
			||||||
		impl->dock.create(parent);
 | 
							impl->dock.create(parent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1043,7 +1044,7 @@ namespace nana
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			auto day = impl->wdg_day.to_int();
 | 
								auto day = impl->wdg_day.to_int();
 | 
				
			||||||
			impl->wdg_day.range(1, days, 1); //It resets the current value of wdg_day
 | 
								impl->wdg_day.range(1, days, 1); //It resets the current value of wdg_day
 | 
				
			||||||
			
 | 
					
 | 
				
			||||||
			if (day > days)
 | 
								if (day > days)
 | 
				
			||||||
				day = days;
 | 
									day = days;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1078,7 +1079,7 @@ namespace nana
 | 
				
			|||||||
			: fbox(fb), label_text(std::move(labelstr))
 | 
								: fbox(fb), label_text(std::move(labelstr))
 | 
				
			||||||
		{}
 | 
							{}
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	inputbox::path::path(::nana::string label, const filebox& fb)
 | 
						inputbox::path::path(::nana::string label, const filebox& fb)
 | 
				
			||||||
		: impl_(new implement(fb, std::move(label)))
 | 
							: impl_(new implement(fb, std::move(label)))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@ -1094,7 +1095,7 @@ namespace nana
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		return impl_->value;
 | 
							return impl_->value;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	//Implementation of abstract_content
 | 
						//Implementation of abstract_content
 | 
				
			||||||
	const ::nana::string& inputbox::path::label() const
 | 
						const ::nana::string& inputbox::path::label() const
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
				
			|||||||
@ -59,7 +59,6 @@ namespace nana{ namespace system{
 | 
				
			|||||||
			HDC hDC = ::GetDC(NULL);
 | 
								HDC hDC = ::GetDC(NULL);
 | 
				
			||||||
			if (::GetDIBits(hDC, (HBITMAP)g.pixmap(), 0, 1, NULL, (BITMAPINFO *)&bmi, DIB_RGB_COLORS) == 0) {
 | 
								if (::GetDIBits(hDC, (HBITMAP)g.pixmap(), 0, 1, NULL, (BITMAPINFO *)&bmi, DIB_RGB_COLORS) == 0) {
 | 
				
			||||||
				assert(false);
 | 
									assert(false);
 | 
				
			||||||
				int err = ::GetLastError();
 | 
					 | 
				
			||||||
				::ReleaseDC(NULL, hDC);
 | 
									::ReleaseDC(NULL, hDC);
 | 
				
			||||||
				return false;
 | 
									return false;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@ -72,41 +71,26 @@ namespace nana{ namespace system{
 | 
				
			|||||||
			// Bitmaps are huge, so to avoid unnegligible extra copy, this routine does not use private _m_set method.
 | 
								// Bitmaps are huge, so to avoid unnegligible extra copy, this routine does not use private _m_set method.
 | 
				
			||||||
			HGLOBAL h_gmem = ::GlobalAlloc(GHND | GMEM_SHARE, header_size + bitmap_bytes);
 | 
								HGLOBAL h_gmem = ::GlobalAlloc(GHND | GMEM_SHARE, header_size + bitmap_bytes);
 | 
				
			||||||
			void * gmem = ::GlobalLock(h_gmem);
 | 
								void * gmem = ::GlobalLock(h_gmem);
 | 
				
			||||||
			if (!gmem) {
 | 
								if (gmem) {
 | 
				
			||||||
				assert(false);
 | 
					                char* p = (char*)gmem;
 | 
				
			||||||
				goto Label_GlobalFree;
 | 
					                // Fix BITMAPINFOHEADER obtained from GetDIBits WinAPI
 | 
				
			||||||
 | 
					                bmi.bmiHeader.biCompression = BI_RGB;
 | 
				
			||||||
 | 
					                bmi.bmiHeader.biHeight = ::abs(bmi.bmiHeader.biHeight);
 | 
				
			||||||
 | 
					                memcpy(p, &bmi, header_size);
 | 
				
			||||||
 | 
					                p += header_size;
 | 
				
			||||||
 | 
					                // many programs do not support bottom-up DIB, so reversing row order is needed.
 | 
				
			||||||
 | 
					                for (int y=0; y<bmi.bmiHeader.biHeight; ++y) {
 | 
				
			||||||
 | 
					                    memcpy(p, pbuffer.raw_ptr(bmi.bmiHeader.biHeight - 1 - y), bytes_per_line);
 | 
				
			||||||
 | 
					                    p += bytes_per_line;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (::GlobalUnlock(h_gmem) || GetLastError() == NO_ERROR)
 | 
				
			||||||
 | 
					                    if (::OpenClipboard(::GetFocus()))
 | 
				
			||||||
 | 
					                        if (::EmptyClipboard())
 | 
				
			||||||
 | 
					                            if (::SetClipboardData(CF_DIB, h_gmem))
 | 
				
			||||||
 | 
					                                if (::CloseClipboard())
 | 
				
			||||||
 | 
					                                    return true;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			char* p = (char*)gmem;
 | 
							    assert(false);
 | 
				
			||||||
			// Fix BITMAPINFOHEADER obtained from GetDIBits WinAPI
 | 
					 | 
				
			||||||
			bmi.bmiHeader.biCompression = BI_RGB;
 | 
					 | 
				
			||||||
			bmi.bmiHeader.biHeight = ::abs(bmi.bmiHeader.biHeight);
 | 
					 | 
				
			||||||
			memcpy(p, &bmi, header_size);
 | 
					 | 
				
			||||||
			p += header_size;
 | 
					 | 
				
			||||||
			// many programs do not support bottom-up DIB, so reversing row order is needed.
 | 
					 | 
				
			||||||
			for (int y=0; y<bmi.bmiHeader.biHeight; ++y) {
 | 
					 | 
				
			||||||
				memcpy(p, pbuffer.raw_ptr(bmi.bmiHeader.biHeight - 1 - y), bytes_per_line);
 | 
					 | 
				
			||||||
				p += bytes_per_line;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (!::GlobalUnlock(h_gmem) && GetLastError() != NO_ERROR) {
 | 
					 | 
				
			||||||
				assert(false);
 | 
					 | 
				
			||||||
				goto Label_GlobalFree;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (!::OpenClipboard(::GetFocus())) {
 | 
					 | 
				
			||||||
				goto Label_GlobalFree;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (!::EmptyClipboard()) {
 | 
					 | 
				
			||||||
				goto Label_GlobalFree;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (!::SetClipboardData(CF_DIB, h_gmem)) {
 | 
					 | 
				
			||||||
				goto Label_GlobalFree;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if (!::CloseClipboard()) {
 | 
					 | 
				
			||||||
				// really?
 | 
					 | 
				
			||||||
				return false;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			return true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		Label_GlobalFree:
 | 
					 | 
				
			||||||
			::GlobalFree(h_gmem);
 | 
								::GlobalFree(h_gmem);
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -128,7 +112,7 @@ namespace nana{ namespace system{
 | 
				
			|||||||
				const std::string & utf32str = conv.charset(reinterpret_cast<char*>(res), size);
 | 
									const std::string & utf32str = conv.charset(reinterpret_cast<char*>(res), size);
 | 
				
			||||||
				const nana::char_t * utf32ptr = reinterpret_cast<const nana::char_t*>(utf32str.c_str());
 | 
									const nana::char_t * utf32ptr = reinterpret_cast<const nana::char_t*>(utf32str.c_str());
 | 
				
			||||||
				str.append(utf32ptr + 1, utf32ptr + utf32str.size() / sizeof(nana::char_t));
 | 
									str.append(utf32ptr + 1, utf32ptr + utf32str.size() / sizeof(nana::char_t));
 | 
				
			||||||
#else 
 | 
					#else
 | 
				
			||||||
				str.reserve(size / sizeof(nana::char_t));
 | 
									str.reserve(size / sizeof(nana::char_t));
 | 
				
			||||||
				str.append(reinterpret_cast<nana::char_t*>(res), reinterpret_cast<nana::char_t*>(res) + size / sizeof(nana::char_t));
 | 
									str.append(reinterpret_cast<nana::char_t*>(res), reinterpret_cast<nana::char_t*>(res) + size / sizeof(nana::char_t));
 | 
				
			||||||
				nana::string::size_type pos = str.find_last_not_of(nana::char_t(0));
 | 
									nana::string::size_type pos = str.find_last_not_of(nana::char_t(0));
 | 
				
			||||||
@ -226,7 +210,7 @@ namespace nana{ namespace system{
 | 
				
			|||||||
			nana::detail::platform_spec & spec = nana::detail::platform_spec::instance();
 | 
								nana::detail::platform_spec & spec = nana::detail::platform_spec::instance();
 | 
				
			||||||
			native_window_type requester = nullptr;
 | 
								native_window_type requester = nullptr;
 | 
				
			||||||
			spec.lock_xlib();
 | 
								spec.lock_xlib();
 | 
				
			||||||
			
 | 
					
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				internal_scope_guard isg;
 | 
									internal_scope_guard isg;
 | 
				
			||||||
				detail::bedrock::core_window_t * wd = detail::bedrock::instance().focus();
 | 
									detail::bedrock::core_window_t * wd = detail::bedrock::instance().focus();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user