avoid warnings about double-to-float conversion
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76293 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
23aa1404be
commit
75297d8842
@ -55,7 +55,7 @@ wxString Col2SVG(wxColour c, float *opacity)
|
||||
{
|
||||
if ( c.Alpha() != wxALPHA_OPAQUE )
|
||||
{
|
||||
*opacity = c.Alpha()/255.;
|
||||
*opacity = c.Alpha() / 255.0f;
|
||||
|
||||
// Remove the alpha before using GetAsString(wxC2S_HTML_SYNTAX) as it
|
||||
// doesn't support colours with alpha channel.
|
||||
|
@ -1081,8 +1081,8 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
|
||||
//
|
||||
// TODO: Adapt this to generic recenter code.
|
||||
//
|
||||
float centerX = (float)(pg->m_width/2);
|
||||
float splitterX;
|
||||
double centerX = pg->m_width / 2.0;
|
||||
double splitterX;
|
||||
|
||||
if ( m_fSplitterX < 0.0 )
|
||||
{
|
||||
@ -1093,8 +1093,8 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
|
||||
//float centerX = float(pg->GetSize().x) * 0.5;
|
||||
|
||||
// Recenter?
|
||||
splitterX = m_fSplitterX + (float(widthChange) * 0.5);
|
||||
float deviation = fabs(centerX - splitterX);
|
||||
splitterX = m_fSplitterX + (widthChange * 0.5);
|
||||
double deviation = fabs(centerX - splitterX);
|
||||
|
||||
// If deviating from center, adjust towards it
|
||||
if ( deviation > 20.0 )
|
||||
@ -1109,7 +1109,7 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
|
||||
{
|
||||
// No width change, just keep sure we keep splitter position intact
|
||||
splitterX = m_fSplitterX;
|
||||
float deviation = fabs(centerX - splitterX);
|
||||
double deviation = fabs(centerX - splitterX);
|
||||
if ( deviation > 50.0 )
|
||||
{
|
||||
splitterX = centerX;
|
||||
|
@ -206,8 +206,8 @@ void wxRibbonAUIArtProvider::SetColourScheme(
|
||||
wxRibbonHSLColour tertiary_hsl(tertiary);
|
||||
|
||||
// Map primary & secondary luminance from [0, 1] to [0.15, 0.85]
|
||||
primary_hsl.luminance = cos(primary_hsl.luminance * M_PI) * -0.35 + 0.5;
|
||||
secondary_hsl.luminance = cos(secondary_hsl.luminance * M_PI) * -0.35 + 0.5;
|
||||
primary_hsl.luminance = float(cos(primary_hsl.luminance * M_PI) * -0.35 + 0.5);
|
||||
secondary_hsl.luminance = float(cos(secondary_hsl.luminance * M_PI) * -0.35 + 0.5);
|
||||
|
||||
// TODO: Remove next line once this provider stops piggybacking MSW
|
||||
wxRibbonMSWArtProvider::SetColourScheme(primary, secondary, tertiary);
|
||||
|
@ -121,12 +121,12 @@ wxBitmap wxRibbonLoadPixmap(const char* const* bits, wxColour fore)
|
||||
|
||||
wxRibbonHSLColour::wxRibbonHSLColour(const wxColour& col)
|
||||
{
|
||||
float red = float(col.Red()) / 255.0;
|
||||
float green = float(col.Green()) / 255.0;
|
||||
float blue = float(col.Blue()) / 255.0;
|
||||
float red = col.Red() / 255.0f;
|
||||
float green = col.Green() / 255.0f;
|
||||
float blue = col.Blue() / 255.0f;
|
||||
float Min = wxMin(red, wxMin(green, blue));
|
||||
float Max = wxMax(red, wxMax(green, blue));
|
||||
luminance = 0.5 * (Max + Min);
|
||||
luminance = 0.5f * (Max + Min);
|
||||
if (Min == Max)
|
||||
{
|
||||
// colour is a shade of grey
|
||||
@ -138,30 +138,30 @@ wxRibbonHSLColour::wxRibbonHSLColour(const wxColour& col)
|
||||
if(luminance <= 0.5)
|
||||
saturation = (Max - Min) / (Max + Min);
|
||||
else
|
||||
saturation = (Max - Min) / (2.0 - (Max + Min));
|
||||
saturation = (Max - Min) / (2.0f - (Max + Min));
|
||||
|
||||
if(Max == red)
|
||||
{
|
||||
hue = 60.0 * (green - blue) / (Max - Min);
|
||||
hue = 60.0f * (green - blue) / (Max - Min);
|
||||
if(hue < 0.0)
|
||||
hue += 360.0;
|
||||
hue += 360.0f;
|
||||
}
|
||||
else if(Max == green)
|
||||
{
|
||||
hue = 60.0 * (blue - red) / (Max - Min);
|
||||
hue += 120.0;
|
||||
hue = 60.0f * (blue - red) / (Max - Min);
|
||||
hue += 120.0f;
|
||||
}
|
||||
else // Max == blue
|
||||
{
|
||||
hue = 60.0 * (red - green) / (Max - Min);
|
||||
hue += 240.0;
|
||||
hue = 60.0f * (red - green) / (Max - Min);
|
||||
hue += 240.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxColour wxRibbonHSLColour::ToRGB() const
|
||||
{
|
||||
float _hue = (hue - floor(hue / 360.0f) * 360.0f);
|
||||
float _hue = (hue - float(floor(hue / 360.0f)) * 360.0f);
|
||||
float _saturation = saturation;
|
||||
float _luminance = luminance;
|
||||
if(_saturation > 1.0) _saturation = 1.0;
|
||||
@ -177,51 +177,51 @@ wxColour wxRibbonHSLColour::ToRGB() const
|
||||
}
|
||||
else
|
||||
{
|
||||
double tmp2 = (_luminance < 0.5)
|
||||
? _luminance * (1.0 + _saturation)
|
||||
float tmp2 = (_luminance < 0.5)
|
||||
? _luminance * (1.0f + _saturation)
|
||||
: (_luminance + _saturation) - (_luminance * _saturation);
|
||||
double tmp1 = 2.0 * _luminance - tmp2;
|
||||
float tmp1 = 2.0f * _luminance - tmp2;
|
||||
|
||||
double tmp3R = _hue + 120.0;
|
||||
float tmp3R = _hue + 120.0f;
|
||||
if(tmp3R > 360.0)
|
||||
tmp3R -= 360.0;
|
||||
tmp3R -= 360.0f;
|
||||
if(tmp3R < 60.0)
|
||||
red = tmp1 + (tmp2 - tmp1) * tmp3R / 60.0;
|
||||
red = tmp1 + (tmp2 - tmp1) * tmp3R / 60.0f;
|
||||
else if(tmp3R < 180.0)
|
||||
red = tmp2;
|
||||
else if(tmp3R < 240.0)
|
||||
red = tmp1 + (tmp2 - tmp1) * (240.0 - tmp3R) / 60.0;
|
||||
red = tmp1 + (tmp2 - tmp1) * (240.0f - tmp3R) / 60.0f;
|
||||
else
|
||||
red = tmp1;
|
||||
|
||||
double tmp3G = _hue;
|
||||
float tmp3G = _hue;
|
||||
if(tmp3G > 360.0)
|
||||
tmp3G -= 360.0;
|
||||
tmp3G -= 360.0f;
|
||||
if(tmp3G < 60.0)
|
||||
green = tmp1 + (tmp2 - tmp1) * tmp3G / 60.0;
|
||||
green = tmp1 + (tmp2 - tmp1) * tmp3G / 60.0f;
|
||||
else if(tmp3G < 180.0)
|
||||
green = tmp2;
|
||||
else if(tmp3G < 240.0)
|
||||
green = tmp1 + (tmp2 - tmp1) * (240.0 - tmp3G) / 60.0;
|
||||
green = tmp1 + (tmp2 - tmp1) * (240.0f - tmp3G) / 60.0f;
|
||||
else
|
||||
green = tmp1;
|
||||
|
||||
double tmp3B = _hue + 240.0;
|
||||
float tmp3B = _hue + 240.0f;
|
||||
if(tmp3B > 360.0)
|
||||
tmp3B -= 360.0;
|
||||
tmp3B -= 360.0f;
|
||||
if(tmp3B < 60.0)
|
||||
blue = tmp1 + (tmp2 - tmp1) * tmp3B / 60.0;
|
||||
blue = tmp1 + (tmp2 - tmp1) * tmp3B / 60.0f;
|
||||
else if(tmp3B < 180.0)
|
||||
blue = tmp2;
|
||||
else if(tmp3B < 240.0)
|
||||
blue = tmp1 + (tmp2 - tmp1) * (240.0 - tmp3B) / 60.0;
|
||||
blue = tmp1 + (tmp2 - tmp1) * (240.0f - tmp3B) / 60.0f;
|
||||
else
|
||||
blue = tmp1;
|
||||
}
|
||||
return wxColour(
|
||||
(unsigned char)(red * 255.0),
|
||||
(unsigned char)(green * 255.0),
|
||||
(unsigned char)(blue * 255.0));
|
||||
(unsigned char)(red * 255.0f),
|
||||
(unsigned char)(green * 255.0f),
|
||||
(unsigned char)(blue * 255.0f));
|
||||
}
|
||||
|
||||
wxRibbonHSLColour wxRibbonHSLColour::Darker(float delta) const
|
||||
|
@ -338,12 +338,12 @@ void wxRibbonMSWArtProvider::SetColourScheme(
|
||||
primary_is_gray = true;
|
||||
else
|
||||
{
|
||||
primary_hsl.saturation = cos(primary_hsl.saturation * M_PI)
|
||||
* -0.25 + 0.5;
|
||||
primary_hsl.saturation = float(cos(primary_hsl.saturation * M_PI)
|
||||
* -0.25 + 0.5);
|
||||
}
|
||||
|
||||
// Map primary luminance from [0, 1] to [.23, .83]
|
||||
primary_hsl.luminance = cos(primary_hsl.luminance * M_PI) * -0.3 + 0.53;
|
||||
primary_hsl.luminance = float(cos(primary_hsl.luminance * M_PI) * -0.3 + 0.53);
|
||||
|
||||
// Map secondary saturation from [0, 1] to [0.16, 0.84]
|
||||
bool secondary_is_gray = false;
|
||||
@ -351,12 +351,12 @@ void wxRibbonMSWArtProvider::SetColourScheme(
|
||||
secondary_is_gray = true;
|
||||
else
|
||||
{
|
||||
secondary_hsl.saturation = cos(secondary_hsl.saturation * M_PI)
|
||||
* -0.34 + 0.5;
|
||||
secondary_hsl.saturation = float(cos(secondary_hsl.saturation * M_PI)
|
||||
* -0.34 + 0.5);
|
||||
}
|
||||
|
||||
// Map secondary luminance from [0, 1] to [0.1, 0.9]
|
||||
secondary_hsl.luminance = cos(secondary_hsl.luminance * M_PI) * -0.4 + 0.5;
|
||||
secondary_hsl.luminance = float(cos(secondary_hsl.luminance * M_PI) * -0.4 + 0.5);
|
||||
|
||||
#define LikePrimary(h, s, l) \
|
||||
primary_hsl.ShiftHue(h ## f).Saturated(primary_is_gray ? 0 : s ## f) \
|
||||
|
@ -637,7 +637,7 @@ void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxT
|
||||
else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_TENTHS_MM)
|
||||
{
|
||||
unitsIdx = 1; // By default, the 2nd in the list.
|
||||
float value = float(dim.GetValue()) / 100.0;
|
||||
float value = dim.GetValue() / 100.0f;
|
||||
valueCtrl->SetValue(wxString::Format(wxT("%.2f"), value));
|
||||
}
|
||||
else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_PERCENTAGE)
|
||||
@ -648,7 +648,7 @@ void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxT
|
||||
else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT)
|
||||
{
|
||||
unitsIdx = 3; // By default, the 4th in the list.
|
||||
float value = float(dim.GetValue()) / 100.0;
|
||||
float value = dim.GetValue() / 100.0f;
|
||||
valueCtrl->SetValue(wxString::Format(wxT("%.2f"), value));
|
||||
}
|
||||
else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_POINTS)
|
||||
|
@ -324,29 +324,29 @@ void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxRichTextAttr& WXUNU
|
||||
|
||||
if ((GetFlags() & wxRICHTEXT_HANDLER_USE_CSS) && thisStyle.HasParagraphSpacingBefore())
|
||||
{
|
||||
float spacingBeforeMM = thisStyle.GetParagraphSpacingBefore() / 10.0;
|
||||
float spacingBeforeMM = thisStyle.GetParagraphSpacingBefore() / 10.0f;
|
||||
|
||||
styleStr += wxString::Format(wxT("margin-top: %.2fmm; "), spacingBeforeMM);
|
||||
}
|
||||
if ((GetFlags() & wxRICHTEXT_HANDLER_USE_CSS) && thisStyle.HasParagraphSpacingAfter())
|
||||
{
|
||||
float spacingAfterMM = thisStyle.GetParagraphSpacingAfter() / 10.0;
|
||||
float spacingAfterMM = thisStyle.GetParagraphSpacingAfter() / 10.0f;
|
||||
|
||||
styleStr += wxString::Format(wxT("margin-bottom: %.2fmm; "), spacingAfterMM);
|
||||
}
|
||||
|
||||
float indentLeftMM = (thisStyle.GetLeftIndent() + thisStyle.GetLeftSubIndent())/10.0;
|
||||
float indentLeftMM = (thisStyle.GetLeftIndent() + thisStyle.GetLeftSubIndent())/10.0f;
|
||||
if ((GetFlags() & wxRICHTEXT_HANDLER_USE_CSS) && (indentLeftMM > 0.0))
|
||||
{
|
||||
styleStr += wxString::Format(wxT("margin-left: %.2fmm; "), indentLeftMM);
|
||||
}
|
||||
float indentRightMM = thisStyle.GetRightIndent()/10.0;
|
||||
float indentRightMM = thisStyle.GetRightIndent()/10.0f;
|
||||
if ((GetFlags() & wxRICHTEXT_HANDLER_USE_CSS) && thisStyle.HasRightIndent() && (indentRightMM > 0.0))
|
||||
{
|
||||
styleStr += wxString::Format(wxT("margin-right: %.2fmm; "), indentRightMM);
|
||||
}
|
||||
// First line indentation
|
||||
float firstLineIndentMM = - thisStyle.GetLeftSubIndent() / 10.0;
|
||||
float firstLineIndentMM = - thisStyle.GetLeftSubIndent() / 10.0f;
|
||||
if ((GetFlags() & wxRICHTEXT_HANDLER_USE_CSS) && (firstLineIndentMM > 0.0))
|
||||
{
|
||||
styleStr += wxString::Format(wxT("text-indent: %.2fmm; "), firstLineIndentMM);
|
||||
@ -384,13 +384,13 @@ void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxRichTextAttr& WXUNU
|
||||
|
||||
if ((GetFlags() & wxRICHTEXT_HANDLER_USE_CSS) && thisStyle.HasParagraphSpacingBefore())
|
||||
{
|
||||
float spacingBeforeMM = thisStyle.GetParagraphSpacingBefore() / 10.0;
|
||||
float spacingBeforeMM = thisStyle.GetParagraphSpacingBefore() / 10.0f;
|
||||
|
||||
styleStr += wxString::Format(wxT("margin-top: %.2fmm; "), spacingBeforeMM);
|
||||
}
|
||||
if ((GetFlags() & wxRICHTEXT_HANDLER_USE_CSS) && thisStyle.HasParagraphSpacingAfter())
|
||||
{
|
||||
float spacingAfterMM = thisStyle.GetParagraphSpacingAfter() / 10.0;
|
||||
float spacingAfterMM = thisStyle.GetParagraphSpacingAfter() / 10.0f;
|
||||
|
||||
styleStr += wxString::Format(wxT("margin-bottom: %.2fmm; "), spacingAfterMM);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user