more HP-UX compilation warnings fixed (187th try)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -77,31 +77,32 @@ void wxPlotArea::OnMouse( wxMouseEvent &event )
|
||||
m_owner->GetViewStart( &view_x, &view_y );
|
||||
view_x *= 10;
|
||||
view_y *= 10;
|
||||
|
||||
int x = event.GetX();
|
||||
int y = event.GetY();
|
||||
|
||||
wxPoint pos = event.GetPosition();
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
x += view_x;
|
||||
y += view_y;
|
||||
|
||||
|
||||
wxNode *node = m_owner->m_curves.First();
|
||||
while (node)
|
||||
{
|
||||
wxPlotCurve *curve = (wxPlotCurve*)node->Data();
|
||||
|
||||
|
||||
double double_client_height = (double)client_height;
|
||||
double range = curve->GetEndY() - curve->GetStartY();
|
||||
double end = curve->GetEndY();
|
||||
wxCoord offset_y = curve->GetOffsetY();
|
||||
|
||||
|
||||
double dy = (end - curve->GetY( x )) / range;
|
||||
wxCoord curve_y = (wxCoord)(dy * double_client_height) - offset_y - 1;
|
||||
|
||||
|
||||
if ((y-curve_y < 4) && (y-curve_y > -4))
|
||||
{
|
||||
m_owner->SetCurrent( curve );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
@@ -120,17 +121,17 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to )
|
||||
int view_y;
|
||||
m_owner->GetViewStart( &view_x, &view_y );
|
||||
view_x *= 10;
|
||||
|
||||
|
||||
if (from == -1)
|
||||
from = view_x;
|
||||
|
||||
int client_width;
|
||||
int client_height;
|
||||
GetClientSize( &client_width, &client_height);
|
||||
|
||||
|
||||
if (to == -1)
|
||||
to = view_x + client_width;
|
||||
|
||||
|
||||
int start_x = wxMax( from, curve->GetStartX() );
|
||||
int end_x = wxMin( to, curve->GetEndX() );
|
||||
|
||||
@@ -141,16 +142,16 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to )
|
||||
double range = curve->GetEndY() - curve->GetStartY();
|
||||
double end = curve->GetEndY();
|
||||
wxCoord offset_y = curve->GetOffsetY();
|
||||
|
||||
|
||||
wxCoord y=0,last_y=0;
|
||||
for (int x = start_x; x < end_x; x++)
|
||||
{
|
||||
double dy = (end - curve->GetY( x )) / range;
|
||||
y = (wxCoord)(dy * double_client_height) - offset_y - 1;
|
||||
|
||||
|
||||
if (x != start_x)
|
||||
dc->DrawLine( x-1, last_y, x, y );
|
||||
|
||||
|
||||
last_y = y;
|
||||
}
|
||||
}
|
||||
@@ -167,16 +168,16 @@ void wxPlotArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
m_owner->PrepareDC( dc );
|
||||
|
||||
wxRegionIterator upd( GetUpdateRegion() );
|
||||
|
||||
|
||||
while (upd)
|
||||
{
|
||||
int update_x = upd.GetX();
|
||||
int update_y = upd.GetY();
|
||||
int update_width = upd.GetWidth();
|
||||
|
||||
|
||||
update_x += view_x;
|
||||
update_y += view_y;
|
||||
|
||||
|
||||
/*
|
||||
if (m_owner->m_current)
|
||||
{
|
||||
@@ -185,17 +186,17 @@ void wxPlotArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
dc.DrawLine( update_x-1, base_line-1, update_x+update_width+2, base_line-1 );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
wxNode *node = m_owner->m_curves.First();
|
||||
while (node)
|
||||
{
|
||||
wxPlotCurve *curve = (wxPlotCurve*)node->Data();
|
||||
|
||||
|
||||
if (curve == m_owner->GetCurrent())
|
||||
dc.SetPen( *wxBLACK_PEN );
|
||||
else
|
||||
dc.SetPen( *wxLIGHT_GREY_PEN );
|
||||
|
||||
|
||||
DrawCurve( &dc, curve, update_x-1, update_x+update_width+2 );
|
||||
|
||||
node = node->Next();
|
||||
@@ -223,7 +224,7 @@ BEGIN_EVENT_TABLE(wxPlotWindow, wxScrolledWindow)
|
||||
EVT_PAINT( wxPlotWindow::OnPaint)
|
||||
EVT_BUTTON( ID_MOVE_UP, wxPlotWindow::OnMoveUp)
|
||||
EVT_BUTTON( ID_MOVE_DOWN, wxPlotWindow::OnMoveDown)
|
||||
|
||||
|
||||
EVT_BUTTON( ID_ENLARGE_100, wxPlotWindow::OnEnlarge100)
|
||||
EVT_BUTTON( ID_ENLARGE_50, wxPlotWindow::OnEnlarge50)
|
||||
EVT_BUTTON( ID_SHRINK_50, wxPlotWindow::OnShrink50)
|
||||
@@ -234,9 +235,9 @@ wxPlotWindow::wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
||||
: wxScrolledWindow( parent, id, pos, size, flag, "plotcanvas" )
|
||||
{
|
||||
m_area = new wxPlotArea( this );
|
||||
|
||||
|
||||
wxBoxSizer *mainsizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
wxBoxSizer *buttonlist = new wxBoxSizer( wxVERTICAL );
|
||||
buttonlist->Add( new wxButton( this, ID_ENLARGE_100, _("+ 100%") ), 0, wxEXPAND|wxALL, 5 );
|
||||
buttonlist->Add( new wxButton( this, ID_ENLARGE_50, _("+ 50%") ), 0, wxEXPAND|wxALL, 5 );
|
||||
@@ -246,18 +247,18 @@ wxPlotWindow::wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
||||
buttonlist->Add( new wxButton( this, ID_MOVE_UP, _("Up") ), 0, wxEXPAND|wxALL, 5 );
|
||||
buttonlist->Add( new wxButton( this, ID_MOVE_DOWN, _("Down") ), 0, wxEXPAND|wxALL, 5 );
|
||||
buttonlist->Add( 20,20, 1 );
|
||||
|
||||
|
||||
mainsizer->Add( buttonlist, 0, wxEXPAND );
|
||||
|
||||
|
||||
mainsizer->Add( m_area, 1, wxEXPAND|wxLEFT, 50 );
|
||||
|
||||
|
||||
SetAutoLayout( TRUE );
|
||||
SetSizer( mainsizer );
|
||||
|
||||
SetTargetWindow( m_area );
|
||||
|
||||
SetBackgroundColour( *wxWHITE );
|
||||
|
||||
|
||||
m_current = (wxPlotCurve*) NULL;
|
||||
}
|
||||
|
||||
@@ -281,7 +282,7 @@ wxPlotCurve *wxPlotWindow::GetAt( size_t n )
|
||||
wxNode *node = m_curves.Nth( n );
|
||||
if (!node)
|
||||
return (wxPlotCurve*) NULL;
|
||||
|
||||
|
||||
return (wxPlotCurve*) node->Data();
|
||||
}
|
||||
|
||||
@@ -289,7 +290,7 @@ void wxPlotWindow::SetCurrent( wxPlotCurve* current )
|
||||
{
|
||||
m_current = current;
|
||||
m_area->Refresh( FALSE );
|
||||
|
||||
|
||||
RedrawYAxis();
|
||||
}
|
||||
|
||||
@@ -301,68 +302,68 @@ wxPlotCurve *wxPlotWindow::GetCurrent()
|
||||
void wxPlotWindow::Move( wxPlotCurve* curve, int pixels_up )
|
||||
{
|
||||
m_area->DeleteCurve( curve );
|
||||
|
||||
|
||||
curve->SetOffsetY( curve->GetOffsetY() + pixels_up );
|
||||
|
||||
|
||||
m_area->Refresh( FALSE );
|
||||
|
||||
|
||||
RedrawYAxis();
|
||||
}
|
||||
|
||||
void wxPlotWindow::OnMoveUp( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (!m_current) return;
|
||||
|
||||
|
||||
Move( m_current, 25 );
|
||||
}
|
||||
|
||||
void wxPlotWindow::OnMoveDown( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (!m_current) return;
|
||||
|
||||
|
||||
Move( m_current, -25 );
|
||||
}
|
||||
|
||||
void wxPlotWindow::Enlarge( wxPlotCurve *curve, double factor )
|
||||
{
|
||||
m_area->DeleteCurve( curve );
|
||||
|
||||
|
||||
double range = curve->GetEndY() - curve->GetStartY();
|
||||
double new_range = range * factor;
|
||||
double middle = curve->GetEndY() - range/2;
|
||||
curve->SetStartY( middle - new_range / 2 );
|
||||
curve->SetEndY( middle + new_range / 2 );
|
||||
|
||||
|
||||
m_area->Refresh( FALSE );
|
||||
|
||||
|
||||
RedrawYAxis();
|
||||
}
|
||||
|
||||
void wxPlotWindow::OnEnlarge100( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (!m_current) return;
|
||||
|
||||
|
||||
Enlarge( m_current, 2.0 );
|
||||
}
|
||||
|
||||
void wxPlotWindow::OnEnlarge50( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (!m_current) return;
|
||||
|
||||
|
||||
Enlarge( m_current, 1.5 );
|
||||
}
|
||||
|
||||
void wxPlotWindow::OnShrink50( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (!m_current) return;
|
||||
|
||||
|
||||
Enlarge( m_current, 0.5 );
|
||||
}
|
||||
|
||||
void wxPlotWindow::OnShrink33( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (!m_current) return;
|
||||
|
||||
|
||||
Enlarge( m_current, 0.6666666 );
|
||||
}
|
||||
|
||||
@@ -371,9 +372,9 @@ void wxPlotWindow::RedrawYAxis()
|
||||
int client_width;
|
||||
int client_height;
|
||||
GetClientSize( &client_width, &client_height);
|
||||
|
||||
|
||||
wxPoint pos( m_area->GetPosition() );
|
||||
|
||||
|
||||
wxRect rect(pos.x-45,0,45,client_height);
|
||||
Refresh(TRUE,&rect);
|
||||
}
|
||||
@@ -381,17 +382,17 @@ void wxPlotWindow::RedrawYAxis()
|
||||
void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
wxPaintDC dc( this );
|
||||
|
||||
|
||||
if (!m_current) return;
|
||||
|
||||
|
||||
int client_width;
|
||||
int client_height;
|
||||
GetClientSize( &client_width, &client_height);
|
||||
|
||||
dc.SetPen( *wxBLACK_PEN );
|
||||
|
||||
|
||||
wxPoint pos( m_area->GetPosition() );
|
||||
|
||||
|
||||
double range = m_current->GetEndY() - m_current->GetStartY();
|
||||
double offset = ((double) m_current->GetOffsetY() / (double)client_height ) * range;
|
||||
double start = m_current->GetStartY() - offset;
|
||||
@@ -401,16 +402,16 @@ void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
if (int_log_range > 0)
|
||||
{
|
||||
for (int i = 0; i < int_log_range; i++)
|
||||
step *= 10;
|
||||
step *= 10;
|
||||
}
|
||||
if (int_log_range < 0)
|
||||
{
|
||||
for (int i = 0; i < -int_log_range; i++)
|
||||
step /= 10;
|
||||
step /= 10;
|
||||
}
|
||||
double lower = ceil(start / step) * step;
|
||||
double upper = floor(end / step) * step;
|
||||
|
||||
|
||||
// if too few values, shrink size
|
||||
int steps = (int)ceil((upper-lower)/step);
|
||||
if (steps < 4)
|
||||
@@ -419,7 +420,7 @@ void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
if (lower-step > start) lower -= step;
|
||||
if (upper+step < end) upper += step;
|
||||
}
|
||||
|
||||
|
||||
// if still too few, again
|
||||
steps = (int)ceil((upper-lower)/step);
|
||||
if (steps < 4)
|
||||
@@ -428,7 +429,7 @@ void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
if (lower-step > start) lower -= step;
|
||||
if (upper+step < end) upper += step;
|
||||
}
|
||||
|
||||
|
||||
double current = lower;
|
||||
while (current < upper+(step/2))
|
||||
{
|
||||
@@ -444,10 +445,10 @@ void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
|
||||
current += step;
|
||||
}
|
||||
|
||||
|
||||
dc.DrawLine( pos.x-15, 6, pos.x-15, client_height-5 );
|
||||
dc.DrawLine( pos.x-19, 8, pos.x-15, 2 );
|
||||
dc.DrawLine( pos.x-10, 9, pos.x-15, 2 );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user