Fixed some MinGW warnings

This commit is contained in:
cnjinhao 2015-01-12 05:27:11 +08:00
parent 41b04d0bbd
commit 0474299bdc
5 changed files with 102 additions and 110 deletions

View File

@ -1,24 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file> <CodeBlocks_layout_file>
<ActiveTarget name="Debug" /> <ActiveTarget name="Debug" />
<File name="..\..\source\gui\element.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\widgets\categorize.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="20890" topLine="542" /> <Cursor1 position="6160" topLine="196" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\gui\filebox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\animation.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="22934" topLine="871" /> <Cursor1 position="1164" topLine="43" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\audio\detail\buffer_preparation.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\widgets\checkbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="1924" topLine="62" /> <Cursor1 position="6998" topLine="275" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\gui\msgbox.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\widgets\combox.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="48249" topLine="407" /> <Cursor1 position="16572" topLine="610" />
</Cursor>
</File>
<File name="..\..\source\threads\pool.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5569" topLine="249" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\date_chooser.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="457" topLine="3" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\listbox.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="12428" topLine="532" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\menu.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="27717" topLine="1044" />
</Cursor>
</File>
<File name="..\..\source\gui\detail\native_window_interface.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4901" topLine="171" />
</Cursor>
</File>
<File name="..\..\source\gui\detail\window_layout.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5198" topLine="161" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\gui\widgets\tabbar.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\widgets\tabbar.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -26,9 +56,9 @@
<Cursor1 position="18615" topLine="760" /> <Cursor1 position="18615" topLine="760" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\audio\detail\audio_device.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\detail\window_manager.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="6256" topLine="215" /> <Cursor1 position="30124" topLine="1046" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\gui\widgets\textbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\widgets\textbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -36,9 +66,9 @@
<Cursor1 position="11188" topLine="459" /> <Cursor1 position="11188" topLine="459" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\charset.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\dragger.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="412" topLine="15" /> <Cursor1 position="1316" topLine="59" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\gui\widgets\toolbar.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\widgets\toolbar.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -56,19 +86,54 @@
<Cursor1 position="587" topLine="2" /> <Cursor1 position="587" topLine="2" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\gui\element.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="20890" topLine="542" />
</Cursor>
</File>
<File name="..\..\source\gui\filebox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="22934" topLine="871" />
</Cursor>
</File>
<File name="..\..\source\charset.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="412" topLine="15" />
</Cursor>
</File>
<File name="..\..\source\gui\msgbox.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="48249" topLine="407" />
</Cursor>
</File>
<File name="..\..\source\audio\detail\buffer_preparation.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1924" topLine="62" />
</Cursor>
</File>
<File name="..\..\source\paint\graphics.cpp" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="30961" topLine="1020" />
</Cursor>
</File>
<File name="..\..\source\gui\programming_interface.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\programming_interface.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="5022" topLine="159" /> <Cursor1 position="5022" topLine="159" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\filesystem\fs_utility.cpp" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\paint\image.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="1562" topLine="57" /> <Cursor1 position="3714" topLine="168" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\gui\animation.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\audio\detail\audio_device.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="1164" topLine="43" /> <Cursor1 position="6256" topLine="215" />
</Cursor>
</File>
<File name="..\..\source\paint\text_renderer.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5894" topLine="205" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\gui\tooltip.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\gui\tooltip.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -81,74 +146,9 @@
<Cursor1 position="7080" topLine="291" /> <Cursor1 position="7080" topLine="291" />
</Cursor> </Cursor>
</File> </File>
<File name="..\..\source\paint\graphics.cpp" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> <File name="..\..\source\filesystem\fs_utility.cpp" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor> <Cursor>
<Cursor1 position="30961" topLine="1020" /> <Cursor1 position="1562" topLine="57" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\categorize.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6160" topLine="196" />
</Cursor>
</File>
<File name="..\..\source\paint\image.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3714" topLine="168" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\checkbox.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6998" topLine="275" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\combox.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="16572" topLine="610" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\date_chooser.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="457" topLine="3" />
</Cursor>
</File>
<File name="..\..\source\paint\text_renderer.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5894" topLine="205" />
</Cursor>
</File>
<File name="..\..\source\threads\pool.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5569" topLine="249" />
</Cursor>
</File>
<File name="..\..\source\gui\detail\native_window_interface.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4901" topLine="171" />
</Cursor>
</File>
<File name="..\..\source\gui\detail\window_layout.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5198" topLine="161" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\listbox.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="12428" topLine="532" />
</Cursor>
</File>
<File name="..\..\source\gui\detail\window_manager.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="30124" topLine="1046" />
</Cursor>
</File>
<File name="..\..\source\gui\widgets\menu.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="27717" topLine="1044" />
</Cursor>
</File>
<File name="..\..\source\gui\dragger.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1316" topLine="59" />
</Cursor> </Cursor>
</File> </File>
</CodeBlocks_layout_file> </CodeBlocks_layout_file>

View File

@ -63,10 +63,9 @@ namespace nana
struct frame_tag: widget_tag{ static const flags value = flags::frame; }; struct frame_tag: widget_tag{ static const flags value = flags::frame; };
}// end namespace category }// end namespace category
typedef detail::native_window_handle_impl * native_window_type; using native_window_type = detail::native_window_handle_impl*;
using window = detail::window_handle_impl*; ///< \see [What is window class ](https://sourceforge.net/p/nanapro/discussion/general/thread/bd0fabfb/)
typedef detail::window_handle_impl* window; ///< \see [What is window class ](https://sourceforge.net/p/nanapro/discussion/general/thread/bd0fabfb/) using event_handle = detail::event_handle_impl*;
typedef detail::event_handle_impl* event_handle;
struct keyboard struct keyboard

View File

@ -7,7 +7,7 @@
* (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/color_schemes.hpp * @file: nana/gui/widget_colors.hpp
* @description: * @description:
*/ */
#ifndef NANA_DETAIL_WIDGET_COLORS_HPP #ifndef NANA_DETAIL_WIDGET_COLORS_HPP

View File

@ -2,8 +2,8 @@
* Basic Types definition * Basic Types definition
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2013 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/basic_types.cpp * @file: nana/basic_types.cpp
@ -44,12 +44,12 @@ namespace nana
{} {}
color::color(unsigned red, unsigned green, unsigned blue) color::color(unsigned red, unsigned green, unsigned blue)
: a_(1.0), r_(red), g_(green), b_(blue) : r_(red), g_(green), b_(blue), a_(1.0)
{ {
} }
color::color(unsigned red, unsigned green, unsigned blue, double alpha) color::color(unsigned red, unsigned green, unsigned blue, double alpha)
: a_(alpha), r_(red), g_(green), b_(blue) : r_(red), g_(green), b_(blue), a_(alpha)
{ {
if (alpha < 0.0) if (alpha < 0.0)
a_ = 0.0; a_ = 0.0;
@ -168,7 +168,7 @@ namespace nana
{ {
return argb(); return argb();
} }
pixel_argb_t color::argb() const pixel_argb_t color::argb() const
{ {
pixel_argb_t argb; pixel_argb_t argb;

View File

@ -102,7 +102,7 @@ namespace nana{ namespace paint
delete [] raw_pixel_buffer; delete [] raw_pixel_buffer;
throw std::runtime_error("Nana.pixel_buffer: XCreateImage failed"); throw std::runtime_error("Nana.pixel_buffer: XCreateImage failed");
} }
if(static_cast<int>(bytes_per_line) != x11.image->bytes_per_line) if(static_cast<int>(bytes_per_line) != x11.image->bytes_per_line)
{ {
x11.image->data = nullptr; x11.image->data = nullptr;
@ -127,7 +127,7 @@ namespace nana{ namespace paint
{ {
#if defined(NANA_X11) #if defined(NANA_X11)
nana::detail::platform_spec & spec = nana::detail::platform_spec::instance(); nana::detail::platform_spec & spec = nana::detail::platform_spec::instance();
//Ensure that the pixmap is updated before we copy its content. //Ensure that the pixmap is updated before we copy its content.
::XFlush(spec.open_display()); ::XFlush(spec.open_display());
x11.image = ::XGetImage(spec.open_display(), drawable->pixmap, valid_r.x, valid_r.y, valid_r.width, valid_r.height, AllPlanes, ZPixmap); x11.image = ::XGetImage(spec.open_display(), drawable->pixmap, valid_r.x, valid_r.y, valid_r.width, valid_r.height, AllPlanes, ZPixmap);
@ -168,7 +168,7 @@ namespace nana{ namespace paint
if(x11.image->data != reinterpret_cast<char*>(raw_pixel_buffer)) if(x11.image->data != reinterpret_cast<char*>(raw_pixel_buffer))
delete [] raw_pixel_buffer; delete [] raw_pixel_buffer;
XDestroyImage(x11.image); XDestroyImage(x11.image);
#else #else
if(nullptr == drawable) //not attached if(nullptr == drawable) //not attached
@ -228,18 +228,11 @@ namespace nana{ namespace paint
auto d = rawptr; auto d = rawptr;
const unsigned char* s; const unsigned char* s;
int src_bytes_per_line;
if (is_negative) if (is_negative)
{
s = rawbits; s = rawbits;
src_bytes_per_line = -static_cast<int>(bytes_per_line);
}
else else
{
s = rawbits + bytes_per_line * (height - 1); s = rawbits + bytes_per_line * (height - 1);
src_bytes_per_line = static_cast<int>(bytes_per_line);
}
for(std::size_t i = 0; i < height; ++i) for(std::size_t i = 0; i < height; ++i)
{ {
@ -311,14 +304,14 @@ namespace nana{ namespace paint
} }
void put(Drawable dw, GC gc, int src_x, int src_y, int x, int y, unsigned width, unsigned height) void put(Drawable dw, GC gc, int src_x, int src_y, int x, int y, unsigned width, unsigned height)
{ {
auto & spec = nana::detail::platform_spec::instance(); auto & spec = nana::detail::platform_spec::instance();
Display * disp = spec.open_display(); Display * disp = spec.open_display();
const int depth = spec.screen_depth(); const int depth = spec.screen_depth();
XImage* img = ::XCreateImage(disp, spec.screen_visual(), depth, ZPixmap, 0, 0, pixel_size.width, pixel_size.height, (16 == depth ? 16 : 32), 0); XImage* img = ::XCreateImage(disp, spec.screen_visual(), depth, ZPixmap, 0, 0, pixel_size.width, pixel_size.height, (16 == depth ? 16 : 32), 0);
if(sizeof(pixel_color_t) * 8 == depth || 24 == depth) if(sizeof(pixel_color_t) * 8 == depth || 24 == depth)
{ {
img->data = reinterpret_cast<char*>(raw_pixel_buffer); img->data = reinterpret_cast<char*>(raw_pixel_buffer);
::XPutImage(disp, dw, gc, ::XPutImage(disp, dw, gc,
img, src_x, src_y, x, y, width, height); img, src_x, src_y, x, y, width, height);
@ -330,7 +323,7 @@ namespace nana{ namespace paint
unsigned short * const fast_table = table_holder.get(); unsigned short * const fast_table = table_holder.get();
for(int i = 0; i < 256; ++i) for(int i = 0; i < 256; ++i)
fast_table[i] = i * 31 / 255; fast_table[i] = i * 31 / 255;
std::size_t length = width * height; std::size_t length = width * height;
std::unique_ptr<unsigned short[]> px_holder(new unsigned short[length]); std::unique_ptr<unsigned short[]> px_holder(new unsigned short[length]);
@ -347,7 +340,7 @@ namespace nana{ namespace paint
{ {
unsigned sp_line_len = pixel_size.width; unsigned sp_line_len = pixel_size.width;
auto sp = raw_pixel_buffer + (src_x + sp_line_len * src_y); auto sp = raw_pixel_buffer + (src_x + sp_line_len * src_y);
unsigned top = 0; unsigned top = 0;
while(true) while(true)
{ {
@ -363,7 +356,7 @@ namespace nana{ namespace paint
img->data = reinterpret_cast<char*>(px_holder.get()); img->data = reinterpret_cast<char*>(px_holder.get());
::XPutImage(disp, dw, gc, ::XPutImage(disp, dw, gc,
img, src_x, src_y, x, y, width, height); img, src_x, src_y, x, y, width, height);
} }
img->data = nullptr; //Set null pointer to avoid XDestroyImage destroyes the buffer. img->data = nullptr; //Set null pointer to avoid XDestroyImage destroyes the buffer.
XDestroyImage(img); XDestroyImage(img);
@ -529,7 +522,7 @@ namespace nana{ namespace paint
} }
img_data += image->bytes_per_line; img_data += image->bytes_per_line;
pixbuf += want_r.width; pixbuf += want_r.width;
} }
} }
else else
{ {