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:
@@ -41,7 +41,7 @@ public:
|
|||||||
// class: the owner will get timer notifications which can be handled with
|
// class: the owner will get timer notifications which can be handled with
|
||||||
// EVT_TIMER
|
// EVT_TIMER
|
||||||
wxTimerBase(wxEvtHandler *owner, int id = -1)
|
wxTimerBase(wxEvtHandler *owner, int id = -1)
|
||||||
{ Init(); SetOwner(owner, -1); }
|
{ Init(); SetOwner(owner, id); }
|
||||||
|
|
||||||
// same as ctor above
|
// same as ctor above
|
||||||
void SetOwner(wxEvtHandler *owner, int id = -1)
|
void SetOwner(wxEvtHandler *owner, int id = -1)
|
||||||
|
@@ -92,7 +92,7 @@ public:
|
|||||||
// compatibility only, don't use
|
// compatibility only, don't use
|
||||||
void SetString(const wxString& to_tokenize,
|
void SetString(const wxString& to_tokenize,
|
||||||
const wxString& delims,
|
const wxString& delims,
|
||||||
bool ret_delim)
|
bool WXUNUSED(ret_delim))
|
||||||
{
|
{
|
||||||
SetString(to_tokenize, delims, wxTOKEN_RET_DELIMS);
|
SetString(to_tokenize, delims, wxTOKEN_RET_DELIMS);
|
||||||
}
|
}
|
||||||
|
@@ -231,7 +231,7 @@ void wxImage::Replace( unsigned char r1, unsigned char g1, unsigned char b1,
|
|||||||
wxCHECK_RET( Ok(), wxT("invalid image") );
|
wxCHECK_RET( Ok(), wxT("invalid image") );
|
||||||
|
|
||||||
char unsigned *data = GetData();
|
char unsigned *data = GetData();
|
||||||
|
|
||||||
const int w = GetWidth();
|
const int w = GetWidth();
|
||||||
const int h = GetHeight();
|
const int h = GetHeight();
|
||||||
|
|
||||||
@@ -888,7 +888,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
unsigned char cr = (*(ptdata++)) ;
|
unsigned char cr = (*(ptdata++)) ;
|
||||||
unsigned char cg = (*(ptdata++)) ;
|
unsigned char cg = (*(ptdata++)) ;
|
||||||
unsigned char cb = (*(ptdata++)) ;
|
unsigned char cb = (*(ptdata++)) ;
|
||||||
|
|
||||||
if( ( cr !=r) || (cg!=g) || (cb!=b) )
|
if( ( cr !=r) || (cg!=g) || (cb!=b) )
|
||||||
{
|
{
|
||||||
*(ptbits++) = one;
|
*(ptbits++) = one;
|
||||||
@@ -1111,7 +1111,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
|
|
||||||
CGrafPtr origPort ;
|
CGrafPtr origPort ;
|
||||||
GDHandle origDevice ;
|
GDHandle origDevice ;
|
||||||
|
|
||||||
GetGWorld( &origPort , &origDevice ) ;
|
GetGWorld( &origPort , &origDevice ) ;
|
||||||
SetGWorld( bitmap.GetHBITMAP() , NULL ) ;
|
SetGWorld( bitmap.GetHBITMAP() , NULL ) ;
|
||||||
|
|
||||||
@@ -1230,7 +1230,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
|||||||
ptbits += 3;
|
ptbits += 3;
|
||||||
}
|
}
|
||||||
ptbits += padding;
|
ptbits += padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
// similarly, set data according to the possible mask bitmap
|
// similarly, set data according to the possible mask bitmap
|
||||||
if( bitmap.GetMask() && bitmap.GetMask()->GetMaskBitmap() )
|
if( bitmap.GetMask() && bitmap.GetMask()->GetMaskBitmap() )
|
||||||
@@ -1307,16 +1307,16 @@ wxBitmap wxImage::ConvertToMonoBitmap( unsigned char red, unsigned char green, u
|
|||||||
bitmap.SetWidth( width );
|
bitmap.SetWidth( width );
|
||||||
|
|
||||||
bitmap.SetBitmap( gdk_pixmap_new( wxRootWindow->window, width, height, 1 ) );
|
bitmap.SetBitmap( gdk_pixmap_new( wxRootWindow->window, width, height, 1 ) );
|
||||||
|
|
||||||
bitmap.SetDepth( 1 );
|
bitmap.SetDepth( 1 );
|
||||||
|
|
||||||
GdkVisual *visual = gdk_window_get_visual( wxRootWindow->window );
|
GdkVisual *visual = gdk_window_get_visual( wxRootWindow->window );
|
||||||
wxASSERT( visual );
|
wxASSERT( visual );
|
||||||
|
|
||||||
// Create picture image
|
// Create picture image
|
||||||
|
|
||||||
unsigned char *data_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
|
unsigned char *data_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
|
||||||
|
|
||||||
GdkImage *data_image =
|
GdkImage *data_image =
|
||||||
gdk_image_new_bitmap( visual, data_data, width, height );
|
gdk_image_new_bitmap( visual, data_data, width, height );
|
||||||
|
|
||||||
@@ -1361,10 +1361,10 @@ wxBitmap wxImage::ConvertToMonoBitmap( unsigned char red, unsigned char green, u
|
|||||||
else
|
else
|
||||||
gdk_image_put_pixel( mask_image, x, y, 0 );
|
gdk_image_put_pixel( mask_image, x, y, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((r == red) && (b == blue) && (g == green))
|
if ((r == red) && (b == blue) && (g == green))
|
||||||
gdk_image_put_pixel( data_image, x, y, 1 );
|
gdk_image_put_pixel( data_image, x, y, 1 );
|
||||||
else
|
else
|
||||||
gdk_image_put_pixel( data_image, x, y, 0 );
|
gdk_image_put_pixel( data_image, x, y, 0 );
|
||||||
|
|
||||||
} // for
|
} // for
|
||||||
@@ -1413,7 +1413,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
|
|
||||||
GdkVisual *visual = gdk_window_get_visual( wxRootWindow->window );
|
GdkVisual *visual = gdk_window_get_visual( wxRootWindow->window );
|
||||||
wxASSERT( visual );
|
wxASSERT( visual );
|
||||||
|
|
||||||
int bpp = visual->depth;
|
int bpp = visual->depth;
|
||||||
|
|
||||||
bitmap.SetDepth( bpp );
|
bitmap.SetDepth( bpp );
|
||||||
@@ -1648,7 +1648,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
|||||||
int green_shift_left = 0;
|
int green_shift_left = 0;
|
||||||
int blue_shift_left = 0;
|
int blue_shift_left = 0;
|
||||||
bool use_shift = FALSE;
|
bool use_shift = FALSE;
|
||||||
|
|
||||||
if (bitmap.GetPixmap())
|
if (bitmap.GetPixmap())
|
||||||
{
|
{
|
||||||
GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() );
|
GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() );
|
||||||
@@ -1662,7 +1662,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
|||||||
green_shift_left = 8-visual->green_prec;
|
green_shift_left = 8-visual->green_prec;
|
||||||
blue_shift_right = visual->blue_shift;
|
blue_shift_right = visual->blue_shift;
|
||||||
blue_shift_left = 8-visual->blue_prec;
|
blue_shift_left = 8-visual->blue_prec;
|
||||||
|
|
||||||
use_shift = (visual->type == GDK_VISUAL_TRUE_COLOR) || (visual->type == GDK_VISUAL_DIRECT_COLOR);
|
use_shift = (visual->type == GDK_VISUAL_TRUE_COLOR) || (visual->type == GDK_VISUAL_DIRECT_COLOR);
|
||||||
}
|
}
|
||||||
if (bitmap.GetBitmap())
|
if (bitmap.GetBitmap())
|
||||||
@@ -1670,7 +1670,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
|||||||
bpp = 1;
|
bpp = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GdkColormap *cmap = gtk_widget_get_default_colormap();
|
GdkColormap *cmap = gtk_widget_get_default_colormap();
|
||||||
|
|
||||||
long pos = 0;
|
long pos = 0;
|
||||||
@@ -1699,17 +1699,17 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
|||||||
data[pos] = (pixel >> red_shift_right) << red_shift_left;
|
data[pos] = (pixel >> red_shift_right) << red_shift_left;
|
||||||
data[pos+1] = (pixel >> green_shift_right) << green_shift_left;
|
data[pos+1] = (pixel >> green_shift_right) << green_shift_left;
|
||||||
data[pos+2] = (pixel >> blue_shift_right) << blue_shift_left;
|
data[pos+2] = (pixel >> blue_shift_right) << blue_shift_left;
|
||||||
}
|
}
|
||||||
else if (cmap->colors)
|
else if (cmap->colors)
|
||||||
{
|
{
|
||||||
data[pos] = cmap->colors[pixel].red >> 8;
|
data[pos] = cmap->colors[pixel].red >> 8;
|
||||||
data[pos+1] = cmap->colors[pixel].green >> 8;
|
data[pos+1] = cmap->colors[pixel].green >> 8;
|
||||||
data[pos+2] = cmap->colors[pixel].blue >> 8;
|
data[pos+2] = cmap->colors[pixel].blue >> 8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("Image conversion failed. Unknown visual type.") );
|
wxFAIL_MSG( wxT("Image conversion failed. Unknown visual type.") );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gdk_image_mask)
|
if (gdk_image_mask)
|
||||||
{
|
{
|
||||||
@@ -2694,9 +2694,9 @@ struct wxRotationPixel
|
|||||||
|
|
||||||
struct wxRotationPoint
|
struct wxRotationPoint
|
||||||
{
|
{
|
||||||
wxRotationPoint (double _x, double _y) : x(_x), y(_y) {}
|
wxRotationPoint (double _x, double _y) : x(_x), y(_y) {}
|
||||||
wxRotationPoint (const wxPoint & p) : x(p.x), y(p.y) {}
|
wxRotationPoint (const wxPoint & p) : x(p.x), y(p.y) {}
|
||||||
double x, y;
|
double x, y;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const wxRotationPixel gs_BlankPixel = {0,0,0};
|
static const wxRotationPixel gs_BlankPixel = {0,0,0};
|
||||||
@@ -2766,7 +2766,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i
|
|||||||
|
|
||||||
if (offset_after_rotation != NULL)
|
if (offset_after_rotation != NULL)
|
||||||
{
|
{
|
||||||
*offset_after_rotation = wxPoint (x1, y1);
|
*offset_after_rotation = wxPoint (x1, y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2822,34 +2822,34 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i
|
|||||||
// If the point is exactly at one point of the grid of the source
|
// If the point is exactly at one point of the grid of the source
|
||||||
// image, then don't interpolate -- just assign the pixel
|
// image, then don't interpolate -- just assign the pixel
|
||||||
|
|
||||||
if (d1 < gs_Epsilon) // d1,d2,d3,d4 are positive -- no need for abs()
|
if (d1 < gs_Epsilon) // d1,d2,d3,d4 are positive -- no need for abs()
|
||||||
{
|
{
|
||||||
result_data[y][x] = v1;
|
result_data[y][x] = v1;
|
||||||
}
|
}
|
||||||
else if (d2 < gs_Epsilon)
|
else if (d2 < gs_Epsilon)
|
||||||
{
|
{
|
||||||
result_data[y][x] = v2;
|
result_data[y][x] = v2;
|
||||||
}
|
}
|
||||||
else if (d3 < gs_Epsilon)
|
else if (d3 < gs_Epsilon)
|
||||||
{
|
{
|
||||||
result_data[y][x] = v3;
|
result_data[y][x] = v3;
|
||||||
}
|
}
|
||||||
else if (d4 < gs_Epsilon)
|
else if (d4 < gs_Epsilon)
|
||||||
{
|
{
|
||||||
result_data[y][x] = v4;
|
result_data[y][x] = v4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// weights for the weighted average are proportional to the inverse of the distance
|
// weights for the weighted average are proportional to the inverse of the distance
|
||||||
const double w1 = 1/d1, w2 = 1/d2, w3 = 1/d3, w4 = 1/d4;
|
const double w1 = 1/d1, w2 = 1/d2, w3 = 1/d3, w4 = 1/d4;
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) // repeat calculation for R, G, and B
|
for (int i = 0; i < 3; i++) // repeat calculation for R, G, and B
|
||||||
{
|
{
|
||||||
result_data[y][x].rgb[i] =
|
result_data[y][x].rgb[i] =
|
||||||
(unsigned char) ( (w1 * v1.rgb[i] + w2 * v2.rgb[i] +
|
(unsigned char) ( (w1 * v1.rgb[i] + w2 * v2.rgb[i] +
|
||||||
w3 * v3.rgb[i] + w4 * v4.rgb[i]) /
|
w3 * v3.rgb[i] + w4 * v4.rgb[i]) /
|
||||||
(w1 + w2 + w3 + w4) );
|
(w1 + w2 + w3 + w4) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -1298,7 +1298,8 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord
|
|||||||
long by = y + (long)floor( double(size) * 2.0 / 3.0 ); // approximate baseline
|
long by = y + (long)floor( double(size) * 2.0 / 3.0 ); // approximate baseline
|
||||||
|
|
||||||
// FIXME only correct for 90 degrees
|
// FIXME only correct for 90 degrees
|
||||||
fprintf(m_pstream, "%d %d moveto\n", XLOG2DEV(x + size), YLOG2DEV(by) );
|
fprintf(m_pstream, "%d %d moveto\n",
|
||||||
|
XLOG2DEV((wxCoord)(x + size)), YLOG2DEV(by) );
|
||||||
fprintf(m_pstream, "%.8f rotate\n", angle);
|
fprintf(m_pstream, "%.8f rotate\n", angle);
|
||||||
|
|
||||||
/* I don't know how to write char to a stream, so I use a mini string */
|
/* I don't know how to write char to a stream, so I use a mini string */
|
||||||
@@ -1336,8 +1337,8 @@ void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord
|
|||||||
|
|
||||||
if (m_font.GetUnderlined())
|
if (m_font.GetUnderlined())
|
||||||
{
|
{
|
||||||
long uy = (long)(y + size - m_underlinePosition);
|
wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
|
||||||
long w, h;
|
wxCoord w, h;
|
||||||
GetTextExtent(text, &w, &h);
|
GetTextExtent(text, &w, &h);
|
||||||
|
|
||||||
fprintf( m_pstream,
|
fprintf( m_pstream,
|
||||||
|
@@ -335,7 +335,7 @@ void wxLogGui::DoLog(wxLogLevel level, const wxChar *szString, time_t t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_aMessages.Add(szString);
|
m_aMessages.Add(szString);
|
||||||
m_aSeverity.Add(level);
|
m_aSeverity.Add((int)level);
|
||||||
m_aTimes.Add((long)t);
|
m_aTimes.Add((long)t);
|
||||||
m_bHasMessages = TRUE;
|
m_bHasMessages = TRUE;
|
||||||
break;
|
break;
|
||||||
@@ -660,7 +660,7 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
|
|||||||
m_btnDetails = new wxButton(this, wxID_MORE, _T("&Details >>"));
|
m_btnDetails = new wxButton(this, wxID_MORE, _T("&Details >>"));
|
||||||
sizerButtons->Add(m_btnDetails, 0, wxCENTRE|wxTOP, MARGIN/2 - 1);
|
sizerButtons->Add(m_btnDetails, 0, wxCENTRE|wxTOP, MARGIN/2 - 1);
|
||||||
|
|
||||||
wxIcon icon = wxTheApp->GetStdIcon(style & wxICON_MASK);
|
wxIcon icon = wxTheApp->GetStdIcon((int)(style & wxICON_MASK));
|
||||||
sizerAll->Add(new wxStaticBitmap(this, -1, icon), 0, wxCENTRE);
|
sizerAll->Add(new wxStaticBitmap(this, -1, icon), 0, wxCENTRE);
|
||||||
const wxString& message = messages.Last();
|
const wxString& message = messages.Last();
|
||||||
sizerAll->Add(CreateTextSizer(message), 0, wxCENTRE|wxLEFT|wxRIGHT, MARGIN);
|
sizerAll->Add(CreateTextSizer(message), 0, wxCENTRE|wxLEFT|wxRIGHT, MARGIN);
|
||||||
|
@@ -77,31 +77,32 @@ void wxPlotArea::OnMouse( wxMouseEvent &event )
|
|||||||
m_owner->GetViewStart( &view_x, &view_y );
|
m_owner->GetViewStart( &view_x, &view_y );
|
||||||
view_x *= 10;
|
view_x *= 10;
|
||||||
view_y *= 10;
|
view_y *= 10;
|
||||||
|
|
||||||
int x = event.GetX();
|
wxPoint pos = event.GetPosition();
|
||||||
int y = event.GetY();
|
int x = pos.x;
|
||||||
|
int y = pos.y;
|
||||||
x += view_x;
|
x += view_x;
|
||||||
y += view_y;
|
y += view_y;
|
||||||
|
|
||||||
wxNode *node = m_owner->m_curves.First();
|
wxNode *node = m_owner->m_curves.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxPlotCurve *curve = (wxPlotCurve*)node->Data();
|
wxPlotCurve *curve = (wxPlotCurve*)node->Data();
|
||||||
|
|
||||||
double double_client_height = (double)client_height;
|
double double_client_height = (double)client_height;
|
||||||
double range = curve->GetEndY() - curve->GetStartY();
|
double range = curve->GetEndY() - curve->GetStartY();
|
||||||
double end = curve->GetEndY();
|
double end = curve->GetEndY();
|
||||||
wxCoord offset_y = curve->GetOffsetY();
|
wxCoord offset_y = curve->GetOffsetY();
|
||||||
|
|
||||||
double dy = (end - curve->GetY( x )) / range;
|
double dy = (end - curve->GetY( x )) / range;
|
||||||
wxCoord curve_y = (wxCoord)(dy * double_client_height) - offset_y - 1;
|
wxCoord curve_y = (wxCoord)(dy * double_client_height) - offset_y - 1;
|
||||||
|
|
||||||
if ((y-curve_y < 4) && (y-curve_y > -4))
|
if ((y-curve_y < 4) && (y-curve_y > -4))
|
||||||
{
|
{
|
||||||
m_owner->SetCurrent( curve );
|
m_owner->SetCurrent( curve );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,17 +121,17 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to )
|
|||||||
int view_y;
|
int view_y;
|
||||||
m_owner->GetViewStart( &view_x, &view_y );
|
m_owner->GetViewStart( &view_x, &view_y );
|
||||||
view_x *= 10;
|
view_x *= 10;
|
||||||
|
|
||||||
if (from == -1)
|
if (from == -1)
|
||||||
from = view_x;
|
from = view_x;
|
||||||
|
|
||||||
int client_width;
|
int client_width;
|
||||||
int client_height;
|
int client_height;
|
||||||
GetClientSize( &client_width, &client_height);
|
GetClientSize( &client_width, &client_height);
|
||||||
|
|
||||||
if (to == -1)
|
if (to == -1)
|
||||||
to = view_x + client_width;
|
to = view_x + client_width;
|
||||||
|
|
||||||
int start_x = wxMax( from, curve->GetStartX() );
|
int start_x = wxMax( from, curve->GetStartX() );
|
||||||
int end_x = wxMin( to, curve->GetEndX() );
|
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 range = curve->GetEndY() - curve->GetStartY();
|
||||||
double end = curve->GetEndY();
|
double end = curve->GetEndY();
|
||||||
wxCoord offset_y = curve->GetOffsetY();
|
wxCoord offset_y = curve->GetOffsetY();
|
||||||
|
|
||||||
wxCoord y=0,last_y=0;
|
wxCoord y=0,last_y=0;
|
||||||
for (int x = start_x; x < end_x; x++)
|
for (int x = start_x; x < end_x; x++)
|
||||||
{
|
{
|
||||||
double dy = (end - curve->GetY( x )) / range;
|
double dy = (end - curve->GetY( x )) / range;
|
||||||
y = (wxCoord)(dy * double_client_height) - offset_y - 1;
|
y = (wxCoord)(dy * double_client_height) - offset_y - 1;
|
||||||
|
|
||||||
if (x != start_x)
|
if (x != start_x)
|
||||||
dc->DrawLine( x-1, last_y, x, y );
|
dc->DrawLine( x-1, last_y, x, y );
|
||||||
|
|
||||||
last_y = y;
|
last_y = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,16 +168,16 @@ void wxPlotArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
m_owner->PrepareDC( dc );
|
m_owner->PrepareDC( dc );
|
||||||
|
|
||||||
wxRegionIterator upd( GetUpdateRegion() );
|
wxRegionIterator upd( GetUpdateRegion() );
|
||||||
|
|
||||||
while (upd)
|
while (upd)
|
||||||
{
|
{
|
||||||
int update_x = upd.GetX();
|
int update_x = upd.GetX();
|
||||||
int update_y = upd.GetY();
|
int update_y = upd.GetY();
|
||||||
int update_width = upd.GetWidth();
|
int update_width = upd.GetWidth();
|
||||||
|
|
||||||
update_x += view_x;
|
update_x += view_x;
|
||||||
update_y += view_y;
|
update_y += view_y;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (m_owner->m_current)
|
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 );
|
dc.DrawLine( update_x-1, base_line-1, update_x+update_width+2, base_line-1 );
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxNode *node = m_owner->m_curves.First();
|
wxNode *node = m_owner->m_curves.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxPlotCurve *curve = (wxPlotCurve*)node->Data();
|
wxPlotCurve *curve = (wxPlotCurve*)node->Data();
|
||||||
|
|
||||||
if (curve == m_owner->GetCurrent())
|
if (curve == m_owner->GetCurrent())
|
||||||
dc.SetPen( *wxBLACK_PEN );
|
dc.SetPen( *wxBLACK_PEN );
|
||||||
else
|
else
|
||||||
dc.SetPen( *wxLIGHT_GREY_PEN );
|
dc.SetPen( *wxLIGHT_GREY_PEN );
|
||||||
|
|
||||||
DrawCurve( &dc, curve, update_x-1, update_x+update_width+2 );
|
DrawCurve( &dc, curve, update_x-1, update_x+update_width+2 );
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
@@ -223,7 +224,7 @@ BEGIN_EVENT_TABLE(wxPlotWindow, wxScrolledWindow)
|
|||||||
EVT_PAINT( wxPlotWindow::OnPaint)
|
EVT_PAINT( wxPlotWindow::OnPaint)
|
||||||
EVT_BUTTON( ID_MOVE_UP, wxPlotWindow::OnMoveUp)
|
EVT_BUTTON( ID_MOVE_UP, wxPlotWindow::OnMoveUp)
|
||||||
EVT_BUTTON( ID_MOVE_DOWN, wxPlotWindow::OnMoveDown)
|
EVT_BUTTON( ID_MOVE_DOWN, wxPlotWindow::OnMoveDown)
|
||||||
|
|
||||||
EVT_BUTTON( ID_ENLARGE_100, wxPlotWindow::OnEnlarge100)
|
EVT_BUTTON( ID_ENLARGE_100, wxPlotWindow::OnEnlarge100)
|
||||||
EVT_BUTTON( ID_ENLARGE_50, wxPlotWindow::OnEnlarge50)
|
EVT_BUTTON( ID_ENLARGE_50, wxPlotWindow::OnEnlarge50)
|
||||||
EVT_BUTTON( ID_SHRINK_50, wxPlotWindow::OnShrink50)
|
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" )
|
: wxScrolledWindow( parent, id, pos, size, flag, "plotcanvas" )
|
||||||
{
|
{
|
||||||
m_area = new wxPlotArea( this );
|
m_area = new wxPlotArea( this );
|
||||||
|
|
||||||
wxBoxSizer *mainsizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer *mainsizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
wxBoxSizer *buttonlist = new wxBoxSizer( wxVERTICAL );
|
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_100, _("+ 100%") ), 0, wxEXPAND|wxALL, 5 );
|
||||||
buttonlist->Add( new wxButton( this, ID_ENLARGE_50, _("+ 50%") ), 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_UP, _("Up") ), 0, wxEXPAND|wxALL, 5 );
|
||||||
buttonlist->Add( new wxButton( this, ID_MOVE_DOWN, _("Down") ), 0, wxEXPAND|wxALL, 5 );
|
buttonlist->Add( new wxButton( this, ID_MOVE_DOWN, _("Down") ), 0, wxEXPAND|wxALL, 5 );
|
||||||
buttonlist->Add( 20,20, 1 );
|
buttonlist->Add( 20,20, 1 );
|
||||||
|
|
||||||
mainsizer->Add( buttonlist, 0, wxEXPAND );
|
mainsizer->Add( buttonlist, 0, wxEXPAND );
|
||||||
|
|
||||||
mainsizer->Add( m_area, 1, wxEXPAND|wxLEFT, 50 );
|
mainsizer->Add( m_area, 1, wxEXPAND|wxLEFT, 50 );
|
||||||
|
|
||||||
SetAutoLayout( TRUE );
|
SetAutoLayout( TRUE );
|
||||||
SetSizer( mainsizer );
|
SetSizer( mainsizer );
|
||||||
|
|
||||||
SetTargetWindow( m_area );
|
SetTargetWindow( m_area );
|
||||||
|
|
||||||
SetBackgroundColour( *wxWHITE );
|
SetBackgroundColour( *wxWHITE );
|
||||||
|
|
||||||
m_current = (wxPlotCurve*) NULL;
|
m_current = (wxPlotCurve*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +282,7 @@ wxPlotCurve *wxPlotWindow::GetAt( size_t n )
|
|||||||
wxNode *node = m_curves.Nth( n );
|
wxNode *node = m_curves.Nth( n );
|
||||||
if (!node)
|
if (!node)
|
||||||
return (wxPlotCurve*) NULL;
|
return (wxPlotCurve*) NULL;
|
||||||
|
|
||||||
return (wxPlotCurve*) node->Data();
|
return (wxPlotCurve*) node->Data();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +290,7 @@ void wxPlotWindow::SetCurrent( wxPlotCurve* current )
|
|||||||
{
|
{
|
||||||
m_current = current;
|
m_current = current;
|
||||||
m_area->Refresh( FALSE );
|
m_area->Refresh( FALSE );
|
||||||
|
|
||||||
RedrawYAxis();
|
RedrawYAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,68 +302,68 @@ wxPlotCurve *wxPlotWindow::GetCurrent()
|
|||||||
void wxPlotWindow::Move( wxPlotCurve* curve, int pixels_up )
|
void wxPlotWindow::Move( wxPlotCurve* curve, int pixels_up )
|
||||||
{
|
{
|
||||||
m_area->DeleteCurve( curve );
|
m_area->DeleteCurve( curve );
|
||||||
|
|
||||||
curve->SetOffsetY( curve->GetOffsetY() + pixels_up );
|
curve->SetOffsetY( curve->GetOffsetY() + pixels_up );
|
||||||
|
|
||||||
m_area->Refresh( FALSE );
|
m_area->Refresh( FALSE );
|
||||||
|
|
||||||
RedrawYAxis();
|
RedrawYAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::OnMoveUp( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnMoveUp( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
Move( m_current, 25 );
|
Move( m_current, 25 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::OnMoveDown( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnMoveDown( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
Move( m_current, -25 );
|
Move( m_current, -25 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::Enlarge( wxPlotCurve *curve, double factor )
|
void wxPlotWindow::Enlarge( wxPlotCurve *curve, double factor )
|
||||||
{
|
{
|
||||||
m_area->DeleteCurve( curve );
|
m_area->DeleteCurve( curve );
|
||||||
|
|
||||||
double range = curve->GetEndY() - curve->GetStartY();
|
double range = curve->GetEndY() - curve->GetStartY();
|
||||||
double new_range = range * factor;
|
double new_range = range * factor;
|
||||||
double middle = curve->GetEndY() - range/2;
|
double middle = curve->GetEndY() - range/2;
|
||||||
curve->SetStartY( middle - new_range / 2 );
|
curve->SetStartY( middle - new_range / 2 );
|
||||||
curve->SetEndY( middle + new_range / 2 );
|
curve->SetEndY( middle + new_range / 2 );
|
||||||
|
|
||||||
m_area->Refresh( FALSE );
|
m_area->Refresh( FALSE );
|
||||||
|
|
||||||
RedrawYAxis();
|
RedrawYAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::OnEnlarge100( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnEnlarge100( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
Enlarge( m_current, 2.0 );
|
Enlarge( m_current, 2.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::OnEnlarge50( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnEnlarge50( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
Enlarge( m_current, 1.5 );
|
Enlarge( m_current, 1.5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::OnShrink50( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnShrink50( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
Enlarge( m_current, 0.5 );
|
Enlarge( m_current, 0.5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::OnShrink33( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnShrink33( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
Enlarge( m_current, 0.6666666 );
|
Enlarge( m_current, 0.6666666 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,9 +372,9 @@ void wxPlotWindow::RedrawYAxis()
|
|||||||
int client_width;
|
int client_width;
|
||||||
int client_height;
|
int client_height;
|
||||||
GetClientSize( &client_width, &client_height);
|
GetClientSize( &client_width, &client_height);
|
||||||
|
|
||||||
wxPoint pos( m_area->GetPosition() );
|
wxPoint pos( m_area->GetPosition() );
|
||||||
|
|
||||||
wxRect rect(pos.x-45,0,45,client_height);
|
wxRect rect(pos.x-45,0,45,client_height);
|
||||||
Refresh(TRUE,&rect);
|
Refresh(TRUE,&rect);
|
||||||
}
|
}
|
||||||
@@ -381,17 +382,17 @@ void wxPlotWindow::RedrawYAxis()
|
|||||||
void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
|
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
int client_width;
|
int client_width;
|
||||||
int client_height;
|
int client_height;
|
||||||
GetClientSize( &client_width, &client_height);
|
GetClientSize( &client_width, &client_height);
|
||||||
|
|
||||||
dc.SetPen( *wxBLACK_PEN );
|
dc.SetPen( *wxBLACK_PEN );
|
||||||
|
|
||||||
wxPoint pos( m_area->GetPosition() );
|
wxPoint pos( m_area->GetPosition() );
|
||||||
|
|
||||||
double range = m_current->GetEndY() - m_current->GetStartY();
|
double range = m_current->GetEndY() - m_current->GetStartY();
|
||||||
double offset = ((double) m_current->GetOffsetY() / (double)client_height ) * range;
|
double offset = ((double) m_current->GetOffsetY() / (double)client_height ) * range;
|
||||||
double start = m_current->GetStartY() - offset;
|
double start = m_current->GetStartY() - offset;
|
||||||
@@ -401,16 +402,16 @@ void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if (int_log_range > 0)
|
if (int_log_range > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < int_log_range; i++)
|
for (int i = 0; i < int_log_range; i++)
|
||||||
step *= 10;
|
step *= 10;
|
||||||
}
|
}
|
||||||
if (int_log_range < 0)
|
if (int_log_range < 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < -int_log_range; i++)
|
for (int i = 0; i < -int_log_range; i++)
|
||||||
step /= 10;
|
step /= 10;
|
||||||
}
|
}
|
||||||
double lower = ceil(start / step) * step;
|
double lower = ceil(start / step) * step;
|
||||||
double upper = floor(end / step) * step;
|
double upper = floor(end / step) * step;
|
||||||
|
|
||||||
// if too few values, shrink size
|
// if too few values, shrink size
|
||||||
int steps = (int)ceil((upper-lower)/step);
|
int steps = (int)ceil((upper-lower)/step);
|
||||||
if (steps < 4)
|
if (steps < 4)
|
||||||
@@ -419,7 +420,7 @@ void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if (lower-step > start) lower -= step;
|
if (lower-step > start) lower -= step;
|
||||||
if (upper+step < end) upper += step;
|
if (upper+step < end) upper += step;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if still too few, again
|
// if still too few, again
|
||||||
steps = (int)ceil((upper-lower)/step);
|
steps = (int)ceil((upper-lower)/step);
|
||||||
if (steps < 4)
|
if (steps < 4)
|
||||||
@@ -428,7 +429,7 @@ void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if (lower-step > start) lower -= step;
|
if (lower-step > start) lower -= step;
|
||||||
if (upper+step < end) upper += step;
|
if (upper+step < end) upper += step;
|
||||||
}
|
}
|
||||||
|
|
||||||
double current = lower;
|
double current = lower;
|
||||||
while (current < upper+(step/2))
|
while (current < upper+(step/2))
|
||||||
{
|
{
|
||||||
@@ -444,10 +445,10 @@ void wxPlotWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
current += step;
|
current += step;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.DrawLine( pos.x-15, 6, pos.x-15, client_height-5 );
|
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-19, 8, pos.x-15, 2 );
|
||||||
dc.DrawLine( pos.x-10, 9, pos.x-15, 2 );
|
dc.DrawLine( pos.x-10, 9, pos.x-15, 2 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -182,6 +182,23 @@ private:
|
|||||||
// implementation
|
// implementation
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// private functions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// translate the key or mouse event flags to the type of selection we're
|
||||||
|
// dealing with
|
||||||
|
static void EventFlagsToSelType(long style,
|
||||||
|
bool shiftDown,
|
||||||
|
bool ctrlDown,
|
||||||
|
bool *is_multiple,
|
||||||
|
bool *extended_select,
|
||||||
|
bool *unselect_others)
|
||||||
|
{
|
||||||
|
*is_multiple = (style & wxTR_MULTIPLE) != 0;
|
||||||
|
*extended_select = shiftDown && is_multiple;
|
||||||
|
*unselect_others = !(extended_select || (ctrlDown && is_multiple));
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// wxTreeRenameTimer (internal)
|
// wxTreeRenameTimer (internal)
|
||||||
@@ -302,7 +319,7 @@ wxGenericTreeItem::wxGenericTreeItem(wxGenericTreeItem *parent,
|
|||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
|
|
||||||
m_attr = (wxTreeItemAttr *)NULL;
|
m_attr = (wxTreeItemAttr *)NULL;
|
||||||
|
|
||||||
// We don't know the height here yet.
|
// We don't know the height here yet.
|
||||||
m_width = 0;
|
m_width = 0;
|
||||||
m_height = 0;
|
m_height = 0;
|
||||||
@@ -458,7 +475,7 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest( const wxPoint& point,
|
|||||||
}
|
}
|
||||||
|
|
||||||
flags|=wxTREE_HITTEST_NOWHERE;
|
flags|=wxTREE_HITTEST_NOWHERE;
|
||||||
|
|
||||||
return (wxGenericTreeItem*) NULL;
|
return (wxGenericTreeItem*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -781,7 +798,7 @@ wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& item, long& cookie) co
|
|||||||
wxArrayGenericTreeItems& children = item.m_pItem->GetChildren();
|
wxArrayGenericTreeItems& children = item.m_pItem->GetChildren();
|
||||||
if ( (size_t)cookie < children.Count() )
|
if ( (size_t)cookie < children.Count() )
|
||||||
{
|
{
|
||||||
return children.Item(cookie++);
|
return children.Item((size_t)cookie++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -913,7 +930,7 @@ wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text,
|
|||||||
if (!HasFlag(wxTR_MULTIPLE))
|
if (!HasFlag(wxTR_MULTIPLE))
|
||||||
{
|
{
|
||||||
m_current = m_key_current = m_anchor;
|
m_current = m_key_current = m_anchor;
|
||||||
m_current->SetHilight( TRUE );
|
m_current->SetHilight( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
@@ -946,7 +963,7 @@ wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parentId,
|
|||||||
int index = parent->GetChildren().Index(idPrevious.m_pItem);
|
int index = parent->GetChildren().Index(idPrevious.m_pItem);
|
||||||
wxASSERT_MSG( index != wxNOT_FOUND,
|
wxASSERT_MSG( index != wxNOT_FOUND,
|
||||||
wxT("previous item in wxTreeCtrl::InsertItem() is not a sibling") );
|
wxT("previous item in wxTreeCtrl::InsertItem() is not a sibling") );
|
||||||
|
|
||||||
return DoInsertItem(parentId, (size_t)++index, text, image, selImage, data);
|
return DoInsertItem(parentId, (size_t)++index, text, image, selImage, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1171,7 +1188,7 @@ bool wxTreeCtrl::TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxGenericT
|
|||||||
crt_item->SetHilight(select);
|
crt_item->SetHilight(select);
|
||||||
RefreshLine(crt_item);
|
RefreshLine(crt_item);
|
||||||
|
|
||||||
if (crt_item==last_item)
|
if (crt_item==last_item)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (crt_item->HasChildren())
|
if (crt_item->HasChildren())
|
||||||
@@ -1180,9 +1197,9 @@ bool wxTreeCtrl::TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxGenericT
|
|||||||
size_t count = children.Count();
|
size_t count = children.Count();
|
||||||
for ( size_t n = 0; n < count; ++n )
|
for ( size_t n = 0; n < count; ++n )
|
||||||
{
|
{
|
||||||
if (TagAllChildrenUntilLast(children[n], last_item, select))
|
if (TagAllChildrenUntilLast(children[n], last_item, select))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1195,7 +1212,7 @@ void wxTreeCtrl::SelectItemRange(wxGenericTreeItem *item1, wxGenericTreeItem *it
|
|||||||
|
|
||||||
// choice first' and 'last' between item1 and item2
|
// choice first' and 'last' between item1 and item2
|
||||||
if (item1->GetY()<item2->GetY())
|
if (item1->GetY()<item2->GetY())
|
||||||
{
|
{
|
||||||
first=item1;
|
first=item1;
|
||||||
last=item2;
|
last=item2;
|
||||||
}
|
}
|
||||||
@@ -1433,16 +1450,16 @@ void wxTreeCtrl::SetImageList(wxImageList *imageList)
|
|||||||
m_lineHeight = (int)(dc.GetCharHeight() + 4);
|
m_lineHeight = (int)(dc.GetCharHeight() + 4);
|
||||||
int width = 0, height = 0,
|
int width = 0, height = 0,
|
||||||
n = m_imageListNormal->GetImageCount();
|
n = m_imageListNormal->GetImageCount();
|
||||||
|
|
||||||
for (int i = 0; i < n ; i++)
|
for (int i = 0; i < n ; i++)
|
||||||
{
|
{
|
||||||
m_imageListNormal->GetSize(i, width, height);
|
m_imageListNormal->GetSize(i, width, height);
|
||||||
if (height > m_lineHeight) m_lineHeight = height;
|
if (height > m_lineHeight) m_lineHeight = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_lineHeight < 40)
|
if (m_lineHeight < 40)
|
||||||
m_lineHeight += 2; // at least 2 pixels
|
m_lineHeight += 2; // at least 2 pixels
|
||||||
else
|
else
|
||||||
m_lineHeight += m_lineHeight/10; // otherwise 10% extra spacing
|
m_lineHeight += m_lineHeight/10; // otherwise 10% extra spacing
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1713,7 +1730,7 @@ void wxTreeCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
|
|||||||
void wxTreeCtrl::OnChar( wxKeyEvent &event )
|
void wxTreeCtrl::OnChar( wxKeyEvent &event )
|
||||||
{
|
{
|
||||||
wxTreeEvent te( wxEVT_COMMAND_TREE_KEY_DOWN, GetId() );
|
wxTreeEvent te( wxEVT_COMMAND_TREE_KEY_DOWN, GetId() );
|
||||||
te.m_code = event.KeyCode();
|
te.m_code = (int)event.KeyCode();
|
||||||
te.SetEventObject( this );
|
te.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent( te );
|
GetEventHandler()->ProcessEvent( te );
|
||||||
|
|
||||||
@@ -1723,9 +1740,12 @@ void wxTreeCtrl::OnChar( wxKeyEvent &event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_multiple=(GetWindowStyleFlag() & wxTR_MULTIPLE);
|
// how should the selection work for this event?
|
||||||
bool extended_select=(event.ShiftDown() && is_multiple);
|
bool is_multiple, extended_select, unselect_others;
|
||||||
bool unselect_others=!(extended_select || (event.ControlDown() && is_multiple));
|
EventFlagsToSelType(GetWindowStyleFlag(),
|
||||||
|
event.ShiftDown(),
|
||||||
|
event.ControlDown(),
|
||||||
|
&is_multiple, &extended_select, &unselect_others);
|
||||||
|
|
||||||
switch (event.KeyCode())
|
switch (event.KeyCode())
|
||||||
{
|
{
|
||||||
@@ -1905,8 +1925,8 @@ wxTreeItemId wxTreeCtrl::HitTest(const wxPoint& point, int& flags)
|
|||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
PrepareDC(dc);
|
PrepareDC(dc);
|
||||||
long x = dc.DeviceToLogicalX( (long)point.x );
|
wxCoord x = dc.DeviceToLogicalX( point.x );
|
||||||
long y = dc.DeviceToLogicalY( (long)point.y );
|
wxCoord y = dc.DeviceToLogicalY( point.y );
|
||||||
int w, h;
|
int w, h;
|
||||||
GetSize(&w, &h);
|
GetSize(&w, &h);
|
||||||
|
|
||||||
@@ -1993,8 +2013,8 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
|
|||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
PrepareDC(dc);
|
PrepareDC(dc);
|
||||||
long x = dc.DeviceToLogicalX( (long)event.GetX() );
|
wxCoord x = dc.DeviceToLogicalX( event.GetX() );
|
||||||
long y = dc.DeviceToLogicalY( (long)event.GetY() );
|
wxCoord y = dc.DeviceToLogicalY( event.GetY() );
|
||||||
|
|
||||||
int flags=0;
|
int flags=0;
|
||||||
wxGenericTreeItem *item = m_anchor->HitTest( wxPoint(x,y), this, flags);
|
wxGenericTreeItem *item = m_anchor->HitTest( wxPoint(x,y), this, flags);
|
||||||
@@ -2026,12 +2046,12 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
|
|||||||
if (item == NULL) return; /* we hit the blank area */
|
if (item == NULL) return; /* we hit the blank area */
|
||||||
|
|
||||||
if (event.RightDown()) {
|
if (event.RightDown()) {
|
||||||
wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK,GetId());
|
wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK,GetId());
|
||||||
nevent.m_item=item;
|
nevent.m_item=item;
|
||||||
nevent.m_code=0;
|
nevent.m_code=0;
|
||||||
nevent.SetEventObject(this);
|
nevent.SetEventObject(this);
|
||||||
GetEventHandler()->ProcessEvent(nevent);
|
GetEventHandler()->ProcessEvent(nevent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.LeftUp() && (item == m_current) &&
|
if (event.LeftUp() && (item == m_current) &&
|
||||||
@@ -2042,9 +2062,12 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_multiple=(GetWindowStyleFlag() & wxTR_MULTIPLE);
|
// how should the selection work for this event?
|
||||||
bool extended_select=(event.ShiftDown() && is_multiple);
|
bool is_multiple, extended_select, unselect_others;
|
||||||
bool unselect_others=!(extended_select || (event.ControlDown() && is_multiple));
|
EventFlagsToSelType(GetWindowStyleFlag(),
|
||||||
|
event.ShiftDown(),
|
||||||
|
event.ControlDown(),
|
||||||
|
&is_multiple, &extended_select, &unselect_others);
|
||||||
|
|
||||||
if (onButton)
|
if (onButton)
|
||||||
{
|
{
|
||||||
@@ -2105,9 +2128,9 @@ void wxTreeCtrl::CalculateSize( wxGenericTreeItem *item, wxDC &dc )
|
|||||||
|
|
||||||
int total_h = (image_h > text_h) ? image_h : text_h;
|
int total_h = (image_h > text_h) ? image_h : text_h;
|
||||||
|
|
||||||
if (total_h < 40)
|
if (total_h < 40)
|
||||||
total_h += 2; // at least 2 pixels
|
total_h += 2; // at least 2 pixels
|
||||||
else
|
else
|
||||||
total_h += total_h/10; // otherwise 10% extra spacing
|
total_h += total_h/10; // otherwise 10% extra spacing
|
||||||
|
|
||||||
item->SetHeight(total_h);
|
item->SetHeight(total_h);
|
||||||
|
@@ -58,7 +58,7 @@ void _GSocket_Install_Callback(GSocket *socket, GSocketEvent event)
|
|||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case GSOCK_LOST: /* fall-through */
|
case GSOCK_LOST: /* fall-through */
|
||||||
case GSOCK_INPUT: c = 0; break;
|
case GSOCK_INPUT: c = 0; break;
|
||||||
case GSOCK_OUTPUT: c = 1; break;
|
case GSOCK_OUTPUT: c = 1; break;
|
||||||
case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
|
case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
|
||||||
default: return;
|
default: return;
|
||||||
@@ -81,7 +81,7 @@ void _GSocket_Uninstall_Callback(GSocket *socket, GSocketEvent event)
|
|||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case GSOCK_LOST: /* fall-through */
|
case GSOCK_LOST: /* fall-through */
|
||||||
case GSOCK_INPUT: c = 0; break;
|
case GSOCK_INPUT: c = 0; break;
|
||||||
case GSOCK_OUTPUT: c = 1; break;
|
case GSOCK_OUTPUT: c = 1; break;
|
||||||
case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
|
case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
|
||||||
default: return;
|
default: return;
|
||||||
@@ -105,4 +105,9 @@ void _GSocket_Disable_Events(GSocket *socket)
|
|||||||
_GSocket_Uninstall_Callback(socket, GSOCK_OUTPUT);
|
_GSocket_Uninstall_Callback(socket, GSOCK_OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* wxUSE_SOCKETS */
|
#else /* !wxUSE_SOCKETS */
|
||||||
|
|
||||||
|
/* some compilers don't like having empty source files */
|
||||||
|
static int wxDummyGsockVar = 0;
|
||||||
|
|
||||||
|
#endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */
|
||||||
|
@@ -58,7 +58,7 @@ void _GSocket_Install_Callback(GSocket *socket, GSocketEvent event)
|
|||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case GSOCK_LOST: /* fall-through */
|
case GSOCK_LOST: /* fall-through */
|
||||||
case GSOCK_INPUT: c = 0; break;
|
case GSOCK_INPUT: c = 0; break;
|
||||||
case GSOCK_OUTPUT: c = 1; break;
|
case GSOCK_OUTPUT: c = 1; break;
|
||||||
case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
|
case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
|
||||||
default: return;
|
default: return;
|
||||||
@@ -81,7 +81,7 @@ void _GSocket_Uninstall_Callback(GSocket *socket, GSocketEvent event)
|
|||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case GSOCK_LOST: /* fall-through */
|
case GSOCK_LOST: /* fall-through */
|
||||||
case GSOCK_INPUT: c = 0; break;
|
case GSOCK_INPUT: c = 0; break;
|
||||||
case GSOCK_OUTPUT: c = 1; break;
|
case GSOCK_OUTPUT: c = 1; break;
|
||||||
case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
|
case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
|
||||||
default: return;
|
default: return;
|
||||||
@@ -105,4 +105,9 @@ void _GSocket_Disable_Events(GSocket *socket)
|
|||||||
_GSocket_Uninstall_Callback(socket, GSOCK_OUTPUT);
|
_GSocket_Uninstall_Callback(socket, GSOCK_OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* wxUSE_SOCKETS */
|
#else /* !wxUSE_SOCKETS */
|
||||||
|
|
||||||
|
/* some compilers don't like having empty source files */
|
||||||
|
static int wxDummyGsockVar = 0;
|
||||||
|
|
||||||
|
#endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */
|
||||||
|
Reference in New Issue
Block a user