]> git.saurik.com Git - wxWidgets.git/commitdiff
more HP-UX compilation warnings fixed (187th try)
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 9 Feb 2000 17:51:16 +0000 (17:51 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 9 Feb 2000 17:51:16 +0000 (17:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/timer.h
include/wx/tokenzr.h
src/common/image.cpp
src/generic/dcpsg.cpp
src/generic/logg.cpp
src/generic/plot.cpp
src/generic/treectrl.cpp
src/gtk/gsockgtk.c
src/gtk1/gsockgtk.c

index aee24ca764e350f9b132b8d3740996e4b8ea0502..30491db2ff37b96b57a7df4a574841d385e79b43 100644 (file)
@@ -41,7 +41,7 @@ public:
     // class: the owner will get timer notifications which can be handled with
     // EVT_TIMER
     wxTimerBase(wxEvtHandler *owner, int id = -1)
-        { Init(); SetOwner(owner, -1); }
+        { Init(); SetOwner(owner, id); }
 
     // same as ctor above
     void SetOwner(wxEvtHandler *owner, int id = -1)
index 9a08ddb460bb7f147d006dc55269fd0a1579092e..34fd0630321faef07dd5392d0562fb5810efcfad 100644 (file)
@@ -92,7 +92,7 @@ public:
     // compatibility only, don't use
     void SetString(const wxString& to_tokenize,
                    const wxString& delims,
-                   bool ret_delim)
+                   bool WXUNUSED(ret_delim))
     {
         SetString(to_tokenize, delims, wxTOKEN_RET_DELIMS);
     }
index e9435b5a4667a9360153a5c754dc782cac97cc8d..d28425992d5d69531265f680a5324966fb4d81a8 100644 (file)
@@ -231,7 +231,7 @@ void wxImage::Replace( unsigned char r1, unsigned char g1, unsigned char b1,
     wxCHECK_RET( Ok(), wxT("invalid image") );
 
     char unsigned *data = GetData();
-    
+
     const int w = GetWidth();
     const int h = GetHeight();
 
@@ -888,7 +888,7 @@ wxBitmap wxImage::ConvertToBitmap() const
                         unsigned char cr = (*(ptdata++)) ;
                         unsigned char cg = (*(ptdata++)) ;
                         unsigned char cb = (*(ptdata++)) ;
-                        
+
                     if( ( cr !=r) || (cg!=g) || (cb!=b) )
                     {
                         *(ptbits++) = one;
@@ -1111,7 +1111,7 @@ wxBitmap wxImage::ConvertToBitmap() const
 
                 CGrafPtr         origPort ;
                 GDHandle        origDevice ;
-                
+
                 GetGWorld( &origPort , &origDevice ) ;
                 SetGWorld( bitmap.GetHBITMAP() , NULL ) ;
 
@@ -1230,7 +1230,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
             ptbits += 3;
         }
         ptbits += padding;
-    }        
+    }
 
     // similarly, set data according to the possible mask bitmap
     if( bitmap.GetMask() && bitmap.GetMask()->GetMaskBitmap() )
@@ -1307,16 +1307,16 @@ wxBitmap wxImage::ConvertToMonoBitmap( unsigned char red, unsigned char green, u
     bitmap.SetWidth( width );
 
     bitmap.SetBitmap( gdk_pixmap_new( wxRootWindow->window, width, height, 1 ) );
-    
+
     bitmap.SetDepth( 1 );
 
     GdkVisual *visual = gdk_window_get_visual( wxRootWindow->window );
     wxASSERT( visual );
-    
+
     // Create picture image
 
     unsigned char *data_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
-    
+
     GdkImage *data_image =
         gdk_image_new_bitmap( visual, data_data, width, height );
 
@@ -1361,10 +1361,10 @@ wxBitmap wxImage::ConvertToMonoBitmap( unsigned char red, unsigned char green, u
                 else
                     gdk_image_put_pixel( mask_image, x, y, 0 );
             }
-            
+
             if ((r == red) && (b == blue) && (g == green))
                 gdk_image_put_pixel( data_image, x, y, 1 );
-            else   
+            else
                 gdk_image_put_pixel( data_image, x, y, 0 );
 
         } // for
@@ -1413,7 +1413,7 @@ wxBitmap wxImage::ConvertToBitmap() const
 
     GdkVisual *visual = gdk_window_get_visual( wxRootWindow->window );
     wxASSERT( visual );
-    
+
     int bpp = visual->depth;
 
     bitmap.SetDepth( bpp );
@@ -1648,7 +1648,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
     int green_shift_left = 0;
     int blue_shift_left = 0;
     bool use_shift = FALSE;
-    
+
     if (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;
         blue_shift_right = visual->blue_shift;
         blue_shift_left = 8-visual->blue_prec;
-        
+
         use_shift = (visual->type == GDK_VISUAL_TRUE_COLOR) || (visual->type == GDK_VISUAL_DIRECT_COLOR);
     }
     if (bitmap.GetBitmap())
@@ -1670,7 +1670,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
         bpp = 1;
     }
 
-    
+
     GdkColormap *cmap = gtk_widget_get_default_colormap();
 
     long pos = 0;
@@ -1699,17 +1699,17 @@ wxImage::wxImage( const wxBitmap &bitmap )
                 data[pos] =   (pixel >> red_shift_right)   << red_shift_left;
                 data[pos+1] = (pixel >> green_shift_right) << green_shift_left;
                 data[pos+2] = (pixel >> blue_shift_right)  << blue_shift_left;
-                } 
+                }
             else if (cmap->colors)
             {
                 data[pos] =   cmap->colors[pixel].red   >> 8;
                 data[pos+1] = cmap->colors[pixel].green >> 8;
                 data[pos+2] = cmap->colors[pixel].blue  >> 8;
-            } 
+            }
             else
             {
                 wxFAIL_MSG( wxT("Image conversion failed. Unknown visual type.") );
-            } 
+            }
 
             if (gdk_image_mask)
             {
@@ -2694,9 +2694,9 @@ struct wxRotationPixel
 
 struct wxRotationPoint
 {
-       wxRotationPoint (double _x, double _y) : x(_x), y(_y) {}
-       wxRotationPoint (const wxPoint & p) : x(p.x), y(p.y) {}
-       double x, y;
+    wxRotationPoint (double _x, double _y) : x(_x), y(_y) {}
+    wxRotationPoint (const wxPoint & p) : x(p.x), y(p.y) {}
+    double x, y;
 };
 
 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)
     {
-       *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
                         // 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)
                     {
-                       result_data[y][x] = v2;
+                        result_data[y][x] = v2;
                     }
                     else if (d3 < gs_Epsilon)
                     {
-                       result_data[y][x] = v3;
+                        result_data[y][x] = v3;
                     }
                     else if (d4 < gs_Epsilon)
                     {
-                       result_data[y][x] = v4;
+                        result_data[y][x] = v4;
                     }
                     else
                     {
-                               // 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;
-                       
-                           for (int i = 0; i < 3; i++)     // repeat calculation for R, G, and B
-                       {
-                               result_data[y][x].rgb[i] =
-                               (unsigned char) ( (w1 * v1.rgb[i] + w2 * v2.rgb[i] +
-                                                                w3 * v3.rgb[i] + w4 * v4.rgb[i]) /
-                                                            (w1 + w2 + w3 + w4) );
-                           }
+                        // 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;
+
+                        for (int i = 0; i < 3; i++)     // repeat calculation for R, G, and B
+                        {
+                            result_data[y][x].rgb[i] =
+                                (unsigned char) ( (w1 * v1.rgb[i] + w2 * v2.rgb[i] +
+                                                             w3 * v3.rgb[i] + w4 * v4.rgb[i]) /
+                                                             (w1 + w2 + w3 + w4) );
+                        }
                     }
                 }
                 else
index edc1fa8513944a7065d298f4f66a73f4ed0f8d6d..96b05d4f7cf9a334c35e0f62f5534dfd022d6493 100644 (file)
@@ -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
 
     // 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);
 
     /* 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())
     {
-        long uy = (long)(y + size - m_underlinePosition);
-        long w, h;
+        wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
+        wxCoord w, h;
         GetTextExtent(text, &w, &h);
 
         fprintf( m_pstream,
index cce25ffc671d4fa59bb7be2fdcbc00a346b74c3b..01f50833e29bcd443c8d6792a00200910f010f59 100644 (file)
@@ -335,7 +335,7 @@ void wxLogGui::DoLog(wxLogLevel level, const wxChar *szString, time_t t)
             }
 
             m_aMessages.Add(szString);
-            m_aSeverity.Add(level);
+            m_aSeverity.Add((int)level);
             m_aTimes.Add((long)t);
             m_bHasMessages = TRUE;
             break;
@@ -660,7 +660,7 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
     m_btnDetails = new wxButton(this, wxID_MORE, _T("&Details >>"));
     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);
     const wxString& message = messages.Last();
     sizerAll->Add(CreateTextSizer(message), 0, wxCENTRE|wxLEFT|wxRIGHT, MARGIN);
index cf2dfddf960875c7e38c9be4a2d241a8a379a5d8..57c197c8753be0e0c1809e9f0d11582d756e5742 100644 (file)
@@ -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 );
-    
+
 }
 
index af2d4cf2e3e93b664d218e594e725c02824a4d4e..656560dec35e9259d4dd3c9a597852ab325ddcfa 100644 (file)
@@ -182,6 +182,23 @@ private:
 // 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)
@@ -302,7 +319,7 @@ wxGenericTreeItem::wxGenericTreeItem(wxGenericTreeItem *parent,
     m_parent = parent;
 
     m_attr = (wxTreeItemAttr *)NULL;
-  
+
     // We don't know the height here yet.
     m_width = 0;
     m_height = 0;
@@ -458,7 +475,7 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest( const wxPoint& point,
     }
 
     flags|=wxTREE_HITTEST_NOWHERE;
-    
+
     return (wxGenericTreeItem*) NULL;
 }
 
@@ -781,7 +798,7 @@ wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& item, long& cookie) co
   wxArrayGenericTreeItems& children = item.m_pItem->GetChildren();
   if ( (size_t)cookie < children.Count() )
   {
-    return children.Item(cookie++);
+    return children.Item((size_t)cookie++);
   }
   else
   {
@@ -913,7 +930,7 @@ wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text,
     if (!HasFlag(wxTR_MULTIPLE))
     {
         m_current = m_key_current = m_anchor;
-           m_current->SetHilight( TRUE );
+        m_current->SetHilight( TRUE );
     }
 
     Refresh();
@@ -946,7 +963,7 @@ wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parentId,
     int index = parent->GetChildren().Index(idPrevious.m_pItem);
     wxASSERT_MSG( index != wxNOT_FOUND,
                   wxT("previous item in wxTreeCtrl::InsertItem() is not a sibling") );
-                
+
     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);
     RefreshLine(crt_item);
 
-    if (crt_item==last_item) 
+    if (crt_item==last_item)
         return TRUE;
 
     if (crt_item->HasChildren())
@@ -1180,9 +1197,9 @@ bool wxTreeCtrl::TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxGenericT
         size_t count = children.Count();
         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 FALSE;
@@ -1195,7 +1212,7 @@ void wxTreeCtrl::SelectItemRange(wxGenericTreeItem *item1, wxGenericTreeItem *it
 
     // choice first' and 'last' between item1 and item2
     if (item1->GetY()<item2->GetY())
-    {   
+    {
         first=item1;
         last=item2;
     }
@@ -1433,16 +1450,16 @@ void wxTreeCtrl::SetImageList(wxImageList *imageList)
     m_lineHeight = (int)(dc.GetCharHeight() + 4);
     int width = 0, height = 0,
         n = m_imageListNormal->GetImageCount();
-        
+
     for (int i = 0; i < n ; i++)
     {
         m_imageListNormal->GetSize(i, width, height);
         if (height > m_lineHeight) m_lineHeight = height;
     }
 
-    if (m_lineHeight < 40) 
+    if (m_lineHeight < 40)
         m_lineHeight += 2;                 // at least 2 pixels
-    else 
+    else
         m_lineHeight += m_lineHeight/10;   // otherwise 10% extra spacing
 #endif
 }
@@ -1713,7 +1730,7 @@ void wxTreeCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
 void wxTreeCtrl::OnChar( wxKeyEvent &event )
 {
     wxTreeEvent te( wxEVT_COMMAND_TREE_KEY_DOWN, GetId() );
-    te.m_code = event.KeyCode();
+    te.m_code = (int)event.KeyCode();
     te.SetEventObject( this );
     GetEventHandler()->ProcessEvent( te );
 
@@ -1723,9 +1740,12 @@ void wxTreeCtrl::OnChar( wxKeyEvent &event )
         return;
     }
 
-    bool is_multiple=(GetWindowStyleFlag() & wxTR_MULTIPLE);
-    bool extended_select=(event.ShiftDown() && is_multiple);
-    bool unselect_others=!(extended_select || (event.ControlDown() && is_multiple));
+    // how should the selection work for this event?
+    bool is_multiple, extended_select, unselect_others;
+    EventFlagsToSelType(GetWindowStyleFlag(),
+                        event.ShiftDown(),
+                        event.ControlDown(),
+                        &is_multiple, &extended_select, &unselect_others);
 
     switch (event.KeyCode())
     {
@@ -1905,8 +1925,8 @@ wxTreeItemId wxTreeCtrl::HitTest(const wxPoint& point, int& flags)
 
     wxClientDC dc(this);
     PrepareDC(dc);
-    long x = dc.DeviceToLogicalX( (long)point.x );
-    long y = dc.DeviceToLogicalY( (long)point.y );
+    wxCoord x = dc.DeviceToLogicalX( point.x );
+    wxCoord y = dc.DeviceToLogicalY( point.y );
     int w, h;
     GetSize(&w, &h);
 
@@ -1993,8 +2013,8 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
 
     wxClientDC dc(this);
     PrepareDC(dc);
-    long x = dc.DeviceToLogicalX( (long)event.GetX() );
-    long y = dc.DeviceToLogicalY( (long)event.GetY() );
+    wxCoord x = dc.DeviceToLogicalX( event.GetX() );
+    wxCoord y = dc.DeviceToLogicalY( event.GetY() );
 
     int flags=0;
     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 (event.RightDown()) {
-       wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK,GetId());
-       nevent.m_item=item;
-       nevent.m_code=0;
-       nevent.SetEventObject(this);
-       GetEventHandler()->ProcessEvent(nevent);
-       return;
+        wxTreeEvent nevent(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK,GetId());
+        nevent.m_item=item;
+        nevent.m_code=0;
+        nevent.SetEventObject(this);
+        GetEventHandler()->ProcessEvent(nevent);
+        return;
     }
 
     if (event.LeftUp() && (item == m_current) &&
@@ -2042,9 +2062,12 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
         return;
     }
 
-    bool is_multiple=(GetWindowStyleFlag() & wxTR_MULTIPLE);
-    bool extended_select=(event.ShiftDown() && is_multiple);
-    bool unselect_others=!(extended_select || (event.ControlDown() && is_multiple));
+    // how should the selection work for this event?
+    bool is_multiple, extended_select, unselect_others;
+    EventFlagsToSelType(GetWindowStyleFlag(),
+                        event.ShiftDown(),
+                        event.ControlDown(),
+                        &is_multiple, &extended_select, &unselect_others);
 
     if (onButton)
     {
@@ -2105,9 +2128,9 @@ void wxTreeCtrl::CalculateSize( wxGenericTreeItem *item, wxDC &dc )
 
     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
-    else 
+    else
         total_h += total_h/10;   // otherwise 10% extra spacing
 
     item->SetHeight(total_h);
index 7c464b5e52dae49f46ed28a8a58bca03c0acd0b2..65a462a348f1304a1db3cd7fd5d580fc08922f60 100644 (file)
@@ -58,7 +58,7 @@ void _GSocket_Install_Callback(GSocket *socket, GSocketEvent event)
   switch (event)
   {
     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_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
     default: return;
@@ -81,7 +81,7 @@ void _GSocket_Uninstall_Callback(GSocket *socket, GSocketEvent event)
   switch (event)
   {
     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_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
     default: return;
@@ -105,4 +105,9 @@ void _GSocket_Disable_Events(GSocket *socket)
   _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 */
index 7c464b5e52dae49f46ed28a8a58bca03c0acd0b2..65a462a348f1304a1db3cd7fd5d580fc08922f60 100644 (file)
@@ -58,7 +58,7 @@ void _GSocket_Install_Callback(GSocket *socket, GSocketEvent event)
   switch (event)
   {
     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_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
     default: return;
@@ -81,7 +81,7 @@ void _GSocket_Uninstall_Callback(GSocket *socket, GSocketEvent event)
   switch (event)
   {
     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_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
     default: return;
@@ -105,4 +105,9 @@ void _GSocket_Disable_Events(GSocket *socket)
   _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 */