Compare commits
1 Commits
BEFORE_KO_
...
before_gtk
Author | SHA1 | Date | |
---|---|---|---|
|
3cbe6adda0 |
90
include/wx/generic/scrolwin.h
Normal file
90
include/wx/generic/scrolwin.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/scrolwin.h
|
||||
// Purpose: wxGenericScrolledWindow class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GENERIC_SCROLLWIN_H_
|
||||
#define _WX_GENERIC_SCROLLWIN_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
extern WXDLLEXPORT_DATA(const wxChar*) wxPanelNameStr;
|
||||
|
||||
// default scrolled window style
|
||||
#ifndef wxScrolledWindowStyle
|
||||
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGenericScrolledWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxGenericScrolledWindow : public wxPanel,
|
||||
public wxScrollHelper
|
||||
{
|
||||
public:
|
||||
wxGenericScrolledWindow() : wxScrollHelper(this) { }
|
||||
wxGenericScrolledWindow(wxWindow *parent,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
: wxScrollHelper(this)
|
||||
{
|
||||
Create(parent, winid, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxGenericScrolledWindow();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
|
||||
|
||||
// lay out the window and its children
|
||||
virtual bool Layout();
|
||||
|
||||
virtual void DoSetVirtualSize(int x, int y);
|
||||
|
||||
// wxWindow's GetBestVirtualSize returns the actual window size,
|
||||
// whereas we want to return the virtual size
|
||||
virtual wxSize GetBestVirtualSize() const;
|
||||
|
||||
// Return the size best suited for the current window
|
||||
// (this isn't a virtual size, this is a sensible size for the window)
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
protected:
|
||||
// this is needed for wxEVT_PAINT processing hack described in
|
||||
// wxScrollHelperEvtHandler::ProcessEvent()
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
// we need to return a special WM_GETDLGCODE value to process just the
|
||||
// arrows but let the other navigation characters through
|
||||
#ifdef __WXMSW__
|
||||
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
#endif // __WXMSW__
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericScrolledWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // _WX_GENERIC_SCROLLWIN_H_
|
||||
|
193
include/wx/gtk/scrolwin.h
Normal file
193
include/wx/gtk/scrolwin.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/scrolwin.h
|
||||
// Purpose: wxScrolledWindow class
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_SCROLLWIN_H_
|
||||
#define _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||
|
||||
// default scrolled window style
|
||||
#ifndef wxScrolledWindowStyle
|
||||
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrolledWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrolledWindow : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxScrolledWindow()
|
||||
{ Init(); }
|
||||
|
||||
wxScrolledWindow(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{ Create(parent, id, pos, size, style, name); }
|
||||
|
||||
void Init();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// Normally the wxScrolledWindow will scroll itself, but in
|
||||
// some rare occasions you might want it to scroll another
|
||||
// window (e.g. a child of it in order to scroll only a portion
|
||||
// the area between the scrollbars (spreadsheet: only cell area
|
||||
// will move).
|
||||
virtual void SetTargetWindow( wxWindow *target, bool pushEventHandler = FALSE );
|
||||
virtual wxWindow *GetTargetWindow() const;
|
||||
|
||||
// Set the scrolled area of the window.
|
||||
virtual void DoSetVirtualSize( int x, int y );
|
||||
|
||||
// wxWindow's GetBestVirtualSize returns the actual window size,
|
||||
// whereas we want to return the virtual size
|
||||
virtual wxSize GetBestVirtualSize() const;
|
||||
|
||||
// Return the size best suited for the current window
|
||||
// (this isn't a virtual size, this is a sensible size for the window)
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// Set the x, y scrolling increments.
|
||||
void SetScrollRate( int xstep, int ystep );
|
||||
|
||||
// Number of pixels per user unit (0 or -1 for no scrollbar)
|
||||
// Length of virtual canvas in user units
|
||||
// Length of page in user units
|
||||
// Default action is to set the virtual size and alter scrollbars
|
||||
// accordingly.
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = FALSE );
|
||||
|
||||
// Physically scroll the window
|
||||
virtual void Scroll(int x_pos, int y_pos);
|
||||
|
||||
int GetScrollPageSize(int orient) const;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
|
||||
|
||||
// Enable/disable Windows scrolling in either direction.
|
||||
// If TRUE, wxWidgets scrolls the canvas and only a bit of
|
||||
// the canvas is invalidated; no Clear() is necessary.
|
||||
// If FALSE, the whole canvas is invalidated and a Clear() is
|
||||
// necessary. Disable for when the scroll increment is used
|
||||
// to actually scroll a non-constant distance
|
||||
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
||||
|
||||
// Get the view start
|
||||
virtual void GetViewStart(int *x, int *y) const;
|
||||
|
||||
// translate between scrolled and unscrolled coordinates
|
||||
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcScrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcScrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
|
||||
// Override this function to draw the graphic (or just process EVT_PAINT)
|
||||
virtual void OnDraw(wxDC& WXUNUSED(dc)) {}
|
||||
|
||||
// Override this function if you don't want to have wxScrolledWindow
|
||||
// automatically change the origin according to the scroll position.
|
||||
void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
|
||||
|
||||
// lay out the window and its children
|
||||
virtual bool Layout();
|
||||
|
||||
// Adjust the scrollbars
|
||||
virtual void AdjustScrollbars();
|
||||
|
||||
// Set the scale factor, used in PrepareDC
|
||||
void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
|
||||
double GetScaleX() const { return m_scaleX; }
|
||||
double GetScaleY() const { return m_scaleY; }
|
||||
|
||||
// implementation from now on
|
||||
void OnScroll(wxScrollWinEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
|
||||
void GtkVScroll( float value, unsigned int scroll_type );
|
||||
void GtkHScroll( float value, unsigned int scroll_type );
|
||||
void GtkVConnectEvent();
|
||||
void GtkHConnectEvent();
|
||||
void GtkVDisconnectEvent();
|
||||
void GtkHDisconnectEvent();
|
||||
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||
|
||||
// Overridden from wxWidgets due callback being static
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
|
||||
virtual void DoPrepareDC(wxDC& dc);
|
||||
|
||||
protected:
|
||||
wxWindow *m_targetWindow;
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
|
||||
// FIXME: these next four members are duplicated in the GtkAdjustment
|
||||
// members of wxWindow. Can they be safely removed from here?
|
||||
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
|
||||
double m_scaleY,m_scaleX;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxScrolledWindow)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// vi:sts=4:sw=4:et
|
300
include/wx/gtk/window.h
Normal file
300
include/wx/gtk/window.h
Normal file
@@ -0,0 +1,300 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/window.h
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GTKWINDOWH__
|
||||
#define __GTKWINDOWH__
|
||||
|
||||
// helper structure that holds class that holds GtkIMContext object and
|
||||
// some additional data needed for key events processing
|
||||
struct wxGtkIMData;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// callback definition for inserting a window (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK;
|
||||
typedef void (*wxInsertChildFunction)( wxWindowGTK*, wxWindowGTK* );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindowGTK
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase
|
||||
{
|
||||
public:
|
||||
// creating the window
|
||||
// -------------------
|
||||
wxWindowGTK();
|
||||
wxWindowGTK(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxWindowGTK();
|
||||
|
||||
// implement base class (pure) virtual methods
|
||||
// -------------------------------------------
|
||||
|
||||
virtual bool Destroy();
|
||||
|
||||
virtual void Raise();
|
||||
virtual void Lower();
|
||||
|
||||
virtual bool Show( bool show = TRUE );
|
||||
virtual bool Enable( bool enable = TRUE );
|
||||
|
||||
virtual bool IsRetained() const;
|
||||
|
||||
virtual void SetFocus();
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
virtual bool Reparent( wxWindowBase *newParent );
|
||||
|
||||
virtual void WarpPointer(int x, int y);
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE,
|
||||
const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Update();
|
||||
virtual void ClearBackground();
|
||||
|
||||
virtual bool SetBackgroundColour( const wxColour &colour );
|
||||
virtual bool SetForegroundColour( const wxColour &colour );
|
||||
virtual bool SetCursor( const wxCursor &cursor );
|
||||
virtual bool SetFont( const wxFont &font );
|
||||
|
||||
virtual bool SetBackgroundStyle(wxBackgroundStyle style) ;
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = TRUE );
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
virtual int GetScrollPos( int orient ) const;
|
||||
virtual int GetScrollThumb( int orient ) const;
|
||||
virtual int GetScrollRange( int orient ) const;
|
||||
virtual void ScrollWindow( int dx, int dy,
|
||||
const wxRect* rect = (wxRect *) NULL );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void AddChild( wxWindowBase *child );
|
||||
virtual void RemoveChild( wxWindowBase *child );
|
||||
#endif
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
virtual WXWidget GetHandle() const { return m_widget; }
|
||||
|
||||
// I don't want users to override what's done in idle so everything that
|
||||
// has to be done in idle time in order for wxGTK to work is done in
|
||||
// OnInternalIdle
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// Internal represention of Update()
|
||||
void GtkUpdate();
|
||||
|
||||
// For compatibility across platforms (not in event table)
|
||||
void OnIdle(wxIdleEvent& WXUNUSED(event)) {}
|
||||
|
||||
// wxGTK-specific: called recursively by Enable,
|
||||
// to give widgets an oppprtunity to correct their colours after they
|
||||
// have been changed by Enable
|
||||
virtual void OnParentEnable( bool WXUNUSED(enable) ) {}
|
||||
|
||||
// Used by all window classes in the widget creation process.
|
||||
bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size );
|
||||
void PostCreation();
|
||||
|
||||
// Internal addition of child windows. differs from class
|
||||
// to class not by using virtual functions but by using
|
||||
// the m_insertCallback.
|
||||
void DoAddChild(wxWindowGTK *child);
|
||||
|
||||
// This methods sends wxPaintEvents to the window. It reads the
|
||||
// update region, breaks it up into rects and sends an event
|
||||
// for each rect. It is also responsible for background erase
|
||||
// events and NC paint events. It is called from "draw" and
|
||||
// "expose" handlers as well as from ::Update()
|
||||
void GtkSendPaintEvents();
|
||||
|
||||
// The methods below are required because many native widgets
|
||||
// are composed of several subwidgets and setting a style for
|
||||
// the widget means setting it for all subwidgets as well.
|
||||
// also, it is nor clear, which native widget is the top
|
||||
// widget where (most of) the input goes. even tooltips have
|
||||
// to be applied to all subwidgets.
|
||||
virtual GtkWidget* GetConnectWidget();
|
||||
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ConnectWidget( GtkWidget *widget );
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
// Returns the default context which usually is anti-aliased
|
||||
PangoContext *GtkGetPangoDefaultContext();
|
||||
|
||||
// Returns the X11 context which renders on the X11 client
|
||||
// side (which can be remote) and which usually is not
|
||||
// anti-aliased and is thus faster
|
||||
// MR: Now returns the default pango_context for the widget as GtkGetPangoDefaultContext to
|
||||
// not depend on libpangox - which is completely deprecated.
|
||||
//BCI: Remove GtkGetPangoX11Context and m_x11Context completely when symbols may be removed
|
||||
PangoContext *GtkGetPangoX11Context();
|
||||
PangoContext *m_x11Context; // MR: Now unused
|
||||
#endif
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// Called from GTK signales handlers. it indicates that
|
||||
// the layouting functions have to be called later on
|
||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
||||
|
||||
// fix up the mouse event coords, used by wxListBox only so far
|
||||
virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget),
|
||||
wxCoord& WXUNUSED(x),
|
||||
wxCoord& WXUNUSED(y)) { }
|
||||
|
||||
// is this window transparent for the mouse events (as wxStaticBox is)?
|
||||
virtual bool IsTransparentForMouse() const { return FALSE; }
|
||||
|
||||
// is this a radiobutton (used by radiobutton code itself only)?
|
||||
virtual bool IsRadioButton() const { return FALSE; }
|
||||
|
||||
// position and size of the window
|
||||
int m_x, m_y;
|
||||
int m_width, m_height;
|
||||
int m_oldClientWidth,m_oldClientHeight;
|
||||
|
||||
// see the docs in src/gtk/window.cpp
|
||||
GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
|
||||
GtkWidget *m_wxwindow; // mostly the client area as per wxWidgets
|
||||
|
||||
// this widget will be queried for GTK's focus events
|
||||
GtkWidget *m_focusWidget;
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
wxGtkIMData *m_imData;
|
||||
#else // GTK 1
|
||||
#ifdef HAVE_XIM
|
||||
// XIM support for wxWidgets
|
||||
GdkIC *m_ic;
|
||||
GdkICAttr *m_icattr;
|
||||
#endif // HAVE_XIM
|
||||
#endif // GTK 2/1
|
||||
|
||||
#ifndef __WXGTK20__
|
||||
// The area to be cleared (and not just refreshed)
|
||||
// We cannot make this distinction under GTK 2.0.
|
||||
wxRegion m_clearRegion;
|
||||
#endif
|
||||
|
||||
// scrolling stuff
|
||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||
float m_oldHorizontalPos;
|
||||
float m_oldVerticalPos;
|
||||
|
||||
// extra (wxGTK-specific) flags
|
||||
bool m_needParent:1; // ! wxFrame, wxDialog, wxNotebookPage ?
|
||||
bool m_noExpose:1; // wxGLCanvas has its own redrawing
|
||||
bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size"
|
||||
bool m_hasScrolling:1;
|
||||
bool m_hasVMT:1;
|
||||
bool m_sizeSet:1;
|
||||
bool m_resizing:1;
|
||||
bool m_acceptsFocus:1; // true if not static
|
||||
bool m_hasFocus:1; // true if == FindFocus()
|
||||
bool m_isScrolling:1; // dragging scrollbar thumb?
|
||||
bool m_clipPaintRegion:1; // TRUE after ScrollWindow()
|
||||
#ifdef __WXGTK20__
|
||||
bool m_dirtyTabOrder:1; // tab order changed, GTK focus
|
||||
// chain needs update
|
||||
#endif
|
||||
bool m_needsStyleChange:1; // May not be able to change
|
||||
// background style until OnIdle
|
||||
|
||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||
// different methods of inserting a child window into a wxFrame,
|
||||
// wxMDIFrame, wxNotebook etc. this is the callback that will get used.
|
||||
wxInsertChildFunction m_insertCallback;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
virtual void DoGetSize( int *width, int *height ) const;
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void DoCaptureMouse();
|
||||
virtual void DoReleaseMouse();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
protected:
|
||||
// common part of all ctors (not virtual because called from ctor)
|
||||
void Init();
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move);
|
||||
|
||||
// Copies m_children tab order to GTK focus chain:
|
||||
void RealizeTabOrder();
|
||||
#endif
|
||||
|
||||
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
||||
// SetXXXColour etc to apply style changed to native widgets) to create
|
||||
// modified GTK style with non-standard attributes. If forceStyle=true,
|
||||
// creates empty GtkRcStyle if there are no modifications, otherwise
|
||||
// returns NULL in such case.
|
||||
GtkRcStyle *CreateWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// Overridden in many GTK widgets who have to handle subwidgets
|
||||
virtual void ApplyWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// helper function to ease native widgets wrapping, called by
|
||||
// ApplyWidgetStyle -- override this, not ApplyWidgetStyle
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowGTK)
|
||||
DECLARE_NO_COPY_CLASS(wxWindowGTK)
|
||||
};
|
||||
|
||||
extern WXDLLIMPEXP_CORE wxWindow *wxFindFocusedChild(wxWindowGTK *win);
|
||||
|
||||
#endif // __GTKWINDOWH__
|
193
include/wx/gtk1/scrolwin.h
Normal file
193
include/wx/gtk1/scrolwin.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/scrolwin.h
|
||||
// Purpose: wxScrolledWindow class
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_SCROLLWIN_H_
|
||||
#define _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||
|
||||
// default scrolled window style
|
||||
#ifndef wxScrolledWindowStyle
|
||||
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrolledWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrolledWindow : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxScrolledWindow()
|
||||
{ Init(); }
|
||||
|
||||
wxScrolledWindow(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{ Create(parent, id, pos, size, style, name); }
|
||||
|
||||
void Init();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// Normally the wxScrolledWindow will scroll itself, but in
|
||||
// some rare occasions you might want it to scroll another
|
||||
// window (e.g. a child of it in order to scroll only a portion
|
||||
// the area between the scrollbars (spreadsheet: only cell area
|
||||
// will move).
|
||||
virtual void SetTargetWindow( wxWindow *target, bool pushEventHandler = FALSE );
|
||||
virtual wxWindow *GetTargetWindow() const;
|
||||
|
||||
// Set the scrolled area of the window.
|
||||
virtual void DoSetVirtualSize( int x, int y );
|
||||
|
||||
// wxWindow's GetBestVirtualSize returns the actual window size,
|
||||
// whereas we want to return the virtual size
|
||||
virtual wxSize GetBestVirtualSize() const;
|
||||
|
||||
// Return the size best suited for the current window
|
||||
// (this isn't a virtual size, this is a sensible size for the window)
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// Set the x, y scrolling increments.
|
||||
void SetScrollRate( int xstep, int ystep );
|
||||
|
||||
// Number of pixels per user unit (0 or -1 for no scrollbar)
|
||||
// Length of virtual canvas in user units
|
||||
// Length of page in user units
|
||||
// Default action is to set the virtual size and alter scrollbars
|
||||
// accordingly.
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = FALSE );
|
||||
|
||||
// Physically scroll the window
|
||||
virtual void Scroll(int x_pos, int y_pos);
|
||||
|
||||
int GetScrollPageSize(int orient) const;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
|
||||
|
||||
// Enable/disable Windows scrolling in either direction.
|
||||
// If TRUE, wxWidgets scrolls the canvas and only a bit of
|
||||
// the canvas is invalidated; no Clear() is necessary.
|
||||
// If FALSE, the whole canvas is invalidated and a Clear() is
|
||||
// necessary. Disable for when the scroll increment is used
|
||||
// to actually scroll a non-constant distance
|
||||
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
||||
|
||||
// Get the view start
|
||||
virtual void GetViewStart(int *x, int *y) const;
|
||||
|
||||
// translate between scrolled and unscrolled coordinates
|
||||
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcScrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcScrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
|
||||
// Override this function to draw the graphic (or just process EVT_PAINT)
|
||||
virtual void OnDraw(wxDC& WXUNUSED(dc)) {}
|
||||
|
||||
// Override this function if you don't want to have wxScrolledWindow
|
||||
// automatically change the origin according to the scroll position.
|
||||
void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
|
||||
|
||||
// lay out the window and its children
|
||||
virtual bool Layout();
|
||||
|
||||
// Adjust the scrollbars
|
||||
virtual void AdjustScrollbars();
|
||||
|
||||
// Set the scale factor, used in PrepareDC
|
||||
void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
|
||||
double GetScaleX() const { return m_scaleX; }
|
||||
double GetScaleY() const { return m_scaleY; }
|
||||
|
||||
// implementation from now on
|
||||
void OnScroll(wxScrollWinEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
|
||||
void GtkVScroll( float value, unsigned int scroll_type );
|
||||
void GtkHScroll( float value, unsigned int scroll_type );
|
||||
void GtkVConnectEvent();
|
||||
void GtkHConnectEvent();
|
||||
void GtkVDisconnectEvent();
|
||||
void GtkHDisconnectEvent();
|
||||
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||
|
||||
// Overridden from wxWidgets due callback being static
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
|
||||
virtual void DoPrepareDC(wxDC& dc);
|
||||
|
||||
protected:
|
||||
wxWindow *m_targetWindow;
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
|
||||
// FIXME: these next four members are duplicated in the GtkAdjustment
|
||||
// members of wxWindow. Can they be safely removed from here?
|
||||
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
|
||||
double m_scaleY,m_scaleX;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxScrolledWindow)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// vi:sts=4:sw=4:et
|
300
include/wx/gtk1/window.h
Normal file
300
include/wx/gtk1/window.h
Normal file
@@ -0,0 +1,300 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/window.h
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GTKWINDOWH__
|
||||
#define __GTKWINDOWH__
|
||||
|
||||
// helper structure that holds class that holds GtkIMContext object and
|
||||
// some additional data needed for key events processing
|
||||
struct wxGtkIMData;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// callback definition for inserting a window (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK;
|
||||
typedef void (*wxInsertChildFunction)( wxWindowGTK*, wxWindowGTK* );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindowGTK
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase
|
||||
{
|
||||
public:
|
||||
// creating the window
|
||||
// -------------------
|
||||
wxWindowGTK();
|
||||
wxWindowGTK(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxWindowGTK();
|
||||
|
||||
// implement base class (pure) virtual methods
|
||||
// -------------------------------------------
|
||||
|
||||
virtual bool Destroy();
|
||||
|
||||
virtual void Raise();
|
||||
virtual void Lower();
|
||||
|
||||
virtual bool Show( bool show = TRUE );
|
||||
virtual bool Enable( bool enable = TRUE );
|
||||
|
||||
virtual bool IsRetained() const;
|
||||
|
||||
virtual void SetFocus();
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
virtual bool Reparent( wxWindowBase *newParent );
|
||||
|
||||
virtual void WarpPointer(int x, int y);
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE,
|
||||
const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Update();
|
||||
virtual void ClearBackground();
|
||||
|
||||
virtual bool SetBackgroundColour( const wxColour &colour );
|
||||
virtual bool SetForegroundColour( const wxColour &colour );
|
||||
virtual bool SetCursor( const wxCursor &cursor );
|
||||
virtual bool SetFont( const wxFont &font );
|
||||
|
||||
virtual bool SetBackgroundStyle(wxBackgroundStyle style) ;
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = TRUE );
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
virtual int GetScrollPos( int orient ) const;
|
||||
virtual int GetScrollThumb( int orient ) const;
|
||||
virtual int GetScrollRange( int orient ) const;
|
||||
virtual void ScrollWindow( int dx, int dy,
|
||||
const wxRect* rect = (wxRect *) NULL );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void AddChild( wxWindowBase *child );
|
||||
virtual void RemoveChild( wxWindowBase *child );
|
||||
#endif
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
virtual WXWidget GetHandle() const { return m_widget; }
|
||||
|
||||
// I don't want users to override what's done in idle so everything that
|
||||
// has to be done in idle time in order for wxGTK to work is done in
|
||||
// OnInternalIdle
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// Internal represention of Update()
|
||||
void GtkUpdate();
|
||||
|
||||
// For compatibility across platforms (not in event table)
|
||||
void OnIdle(wxIdleEvent& WXUNUSED(event)) {}
|
||||
|
||||
// wxGTK-specific: called recursively by Enable,
|
||||
// to give widgets an oppprtunity to correct their colours after they
|
||||
// have been changed by Enable
|
||||
virtual void OnParentEnable( bool WXUNUSED(enable) ) {}
|
||||
|
||||
// Used by all window classes in the widget creation process.
|
||||
bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size );
|
||||
void PostCreation();
|
||||
|
||||
// Internal addition of child windows. differs from class
|
||||
// to class not by using virtual functions but by using
|
||||
// the m_insertCallback.
|
||||
void DoAddChild(wxWindowGTK *child);
|
||||
|
||||
// This methods sends wxPaintEvents to the window. It reads the
|
||||
// update region, breaks it up into rects and sends an event
|
||||
// for each rect. It is also responsible for background erase
|
||||
// events and NC paint events. It is called from "draw" and
|
||||
// "expose" handlers as well as from ::Update()
|
||||
void GtkSendPaintEvents();
|
||||
|
||||
// The methods below are required because many native widgets
|
||||
// are composed of several subwidgets and setting a style for
|
||||
// the widget means setting it for all subwidgets as well.
|
||||
// also, it is nor clear, which native widget is the top
|
||||
// widget where (most of) the input goes. even tooltips have
|
||||
// to be applied to all subwidgets.
|
||||
virtual GtkWidget* GetConnectWidget();
|
||||
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ConnectWidget( GtkWidget *widget );
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
// Returns the default context which usually is anti-aliased
|
||||
PangoContext *GtkGetPangoDefaultContext();
|
||||
|
||||
// Returns the X11 context which renders on the X11 client
|
||||
// side (which can be remote) and which usually is not
|
||||
// anti-aliased and is thus faster
|
||||
// MR: Now returns the default pango_context for the widget as GtkGetPangoDefaultContext to
|
||||
// not depend on libpangox - which is completely deprecated.
|
||||
//BCI: Remove GtkGetPangoX11Context and m_x11Context completely when symbols may be removed
|
||||
PangoContext *GtkGetPangoX11Context();
|
||||
PangoContext *m_x11Context; // MR: Now unused
|
||||
#endif
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// Called from GTK signales handlers. it indicates that
|
||||
// the layouting functions have to be called later on
|
||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
||||
|
||||
// fix up the mouse event coords, used by wxListBox only so far
|
||||
virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget),
|
||||
wxCoord& WXUNUSED(x),
|
||||
wxCoord& WXUNUSED(y)) { }
|
||||
|
||||
// is this window transparent for the mouse events (as wxStaticBox is)?
|
||||
virtual bool IsTransparentForMouse() const { return FALSE; }
|
||||
|
||||
// is this a radiobutton (used by radiobutton code itself only)?
|
||||
virtual bool IsRadioButton() const { return FALSE; }
|
||||
|
||||
// position and size of the window
|
||||
int m_x, m_y;
|
||||
int m_width, m_height;
|
||||
int m_oldClientWidth,m_oldClientHeight;
|
||||
|
||||
// see the docs in src/gtk/window.cpp
|
||||
GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
|
||||
GtkWidget *m_wxwindow; // mostly the client area as per wxWidgets
|
||||
|
||||
// this widget will be queried for GTK's focus events
|
||||
GtkWidget *m_focusWidget;
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
wxGtkIMData *m_imData;
|
||||
#else // GTK 1
|
||||
#ifdef HAVE_XIM
|
||||
// XIM support for wxWidgets
|
||||
GdkIC *m_ic;
|
||||
GdkICAttr *m_icattr;
|
||||
#endif // HAVE_XIM
|
||||
#endif // GTK 2/1
|
||||
|
||||
#ifndef __WXGTK20__
|
||||
// The area to be cleared (and not just refreshed)
|
||||
// We cannot make this distinction under GTK 2.0.
|
||||
wxRegion m_clearRegion;
|
||||
#endif
|
||||
|
||||
// scrolling stuff
|
||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||
float m_oldHorizontalPos;
|
||||
float m_oldVerticalPos;
|
||||
|
||||
// extra (wxGTK-specific) flags
|
||||
bool m_needParent:1; // ! wxFrame, wxDialog, wxNotebookPage ?
|
||||
bool m_noExpose:1; // wxGLCanvas has its own redrawing
|
||||
bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size"
|
||||
bool m_hasScrolling:1;
|
||||
bool m_hasVMT:1;
|
||||
bool m_sizeSet:1;
|
||||
bool m_resizing:1;
|
||||
bool m_acceptsFocus:1; // true if not static
|
||||
bool m_hasFocus:1; // true if == FindFocus()
|
||||
bool m_isScrolling:1; // dragging scrollbar thumb?
|
||||
bool m_clipPaintRegion:1; // TRUE after ScrollWindow()
|
||||
#ifdef __WXGTK20__
|
||||
bool m_dirtyTabOrder:1; // tab order changed, GTK focus
|
||||
// chain needs update
|
||||
#endif
|
||||
bool m_needsStyleChange:1; // May not be able to change
|
||||
// background style until OnIdle
|
||||
|
||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||
// different methods of inserting a child window into a wxFrame,
|
||||
// wxMDIFrame, wxNotebook etc. this is the callback that will get used.
|
||||
wxInsertChildFunction m_insertCallback;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
virtual void DoGetSize( int *width, int *height ) const;
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void DoCaptureMouse();
|
||||
virtual void DoReleaseMouse();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
protected:
|
||||
// common part of all ctors (not virtual because called from ctor)
|
||||
void Init();
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move);
|
||||
|
||||
// Copies m_children tab order to GTK focus chain:
|
||||
void RealizeTabOrder();
|
||||
#endif
|
||||
|
||||
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
||||
// SetXXXColour etc to apply style changed to native widgets) to create
|
||||
// modified GTK style with non-standard attributes. If forceStyle=true,
|
||||
// creates empty GtkRcStyle if there are no modifications, otherwise
|
||||
// returns NULL in such case.
|
||||
GtkRcStyle *CreateWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// Overridden in many GTK widgets who have to handle subwidgets
|
||||
virtual void ApplyWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// helper function to ease native widgets wrapping, called by
|
||||
// ApplyWidgetStyle -- override this, not ApplyWidgetStyle
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowGTK)
|
||||
DECLARE_NO_COPY_CLASS(wxWindowGTK)
|
||||
};
|
||||
|
||||
extern WXDLLIMPEXP_CORE wxWindow *wxFindFocusedChild(wxWindowGTK *win);
|
||||
|
||||
#endif // __GTKWINDOWH__
|
238
include/wx/scrolwin.h
Normal file
238
include/wx/scrolwin.h
Normal file
@@ -0,0 +1,238 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: include/wx/scrolwin.h
|
||||
// Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 30.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SCROLWIN_H_BASE_
|
||||
#define _WX_SCROLWIN_H_BASE_
|
||||
|
||||
#include "wx/window.h"
|
||||
|
||||
class WXDLLEXPORT wxScrollHelperEvtHandler;
|
||||
class WXDLLEXPORT wxTimer;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrollHelper: this class implements the scrolling logic which is used by
|
||||
// wxScrolledWindow and wxScrolledControl. It is a mix-in: just derive from it
|
||||
// to implement scrolling in your class.
|
||||
// ----------------------------------------------------------------------------
|
||||
#if !defined(__WXGTK__) || defined(__WXUNIVERSAL__)
|
||||
|
||||
class WXDLLEXPORT wxScrollHelper
|
||||
{
|
||||
public:
|
||||
// ctor and dtor
|
||||
wxScrollHelper(wxWindow *winToScroll = (wxWindow *)NULL);
|
||||
void SetWindow(wxWindow *winToScroll);
|
||||
virtual ~wxScrollHelper();
|
||||
|
||||
// configure the scrolling
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = false );
|
||||
|
||||
// scroll to the given (in logical coords) position
|
||||
virtual void Scroll(int x, int y);
|
||||
|
||||
// get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL)
|
||||
int GetScrollPageSize(int orient) const;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
// Set the x, y scrolling increments.
|
||||
void SetScrollRate( int xstep, int ystep );
|
||||
|
||||
// get the size of one logical unit in physical ones
|
||||
virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX,
|
||||
int *pixelsPerUnitY) const;
|
||||
|
||||
// Enable/disable Windows scrolling in either direction. If true, wxWidgets
|
||||
// scrolls the canvas and only a bit of the canvas is invalidated; no
|
||||
// Clear() is necessary. If false, the whole canvas is invalidated and a
|
||||
// Clear() is necessary. Disable for when the scroll increment is used to
|
||||
// actually scroll a non-constant distance
|
||||
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
||||
|
||||
// Get the view start
|
||||
virtual void GetViewStart(int *x, int *y) const;
|
||||
|
||||
// Set the scale factor, used in PrepareDC
|
||||
void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
|
||||
double GetScaleX() const { return m_scaleX; }
|
||||
double GetScaleY() const { return m_scaleY; }
|
||||
|
||||
// translate between scrolled and unscrolled coordinates
|
||||
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcScrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcScrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
|
||||
// Adjust the scrollbars
|
||||
virtual void AdjustScrollbars(void);
|
||||
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||
|
||||
// Normally the wxScrolledWindow will scroll itself, but in some rare
|
||||
// occasions you might want it to scroll [part of] another window (e.g. a
|
||||
// child of it in order to scroll only a portion the area between the
|
||||
// scrollbars (spreadsheet: only cell area will move).
|
||||
virtual void SetTargetWindow(wxWindow *target);
|
||||
virtual wxWindow *GetTargetWindow() const;
|
||||
|
||||
void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; }
|
||||
wxRect GetTargetRect() const { return m_rectToScroll; }
|
||||
|
||||
// Override this function to draw the graphic (or just process EVT_PAINT)
|
||||
virtual void OnDraw(wxDC& WXUNUSED(dc)) { }
|
||||
|
||||
// change the DC origin according to the scroll position.
|
||||
virtual void DoPrepareDC(wxDC& dc);
|
||||
|
||||
// are we generating the autoscroll events?
|
||||
bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; }
|
||||
|
||||
// stop generating the scroll events when mouse is held outside the window
|
||||
void StopAutoScrolling();
|
||||
|
||||
// this method can be overridden in a derived class to forbid sending the
|
||||
// auto scroll events - note that unlike StopAutoScrolling() it doesn't
|
||||
// stop the timer, so it will be called repeatedly and will typically
|
||||
// return different values depending on the current mouse position
|
||||
//
|
||||
// the base class version just returns true
|
||||
virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
|
||||
|
||||
// the methods to be called from the window event handlers
|
||||
void HandleOnScroll(wxScrollWinEvent& event);
|
||||
void HandleOnSize(wxSizeEvent& event);
|
||||
void HandleOnPaint(wxPaintEvent& event);
|
||||
void HandleOnChar(wxKeyEvent& event);
|
||||
void HandleOnMouseEnter(wxMouseEvent& event);
|
||||
void HandleOnMouseLeave(wxMouseEvent& event);
|
||||
#if wxUSE_MOUSEWHEEL
|
||||
void HandleOnMouseWheel(wxMouseEvent& event);
|
||||
#endif // wxUSE_MOUSEWHEEL
|
||||
|
||||
// FIXME: this is needed for now for wxPlot compilation, should be removed
|
||||
// once it is fixed!
|
||||
void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); }
|
||||
|
||||
protected:
|
||||
// get pointer to our scroll rect if we use it or NULL
|
||||
const wxRect *GetScrollRect() const
|
||||
{
|
||||
return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL;
|
||||
}
|
||||
|
||||
// get the size of the target window
|
||||
wxSize GetTargetSize() const
|
||||
{
|
||||
return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize()
|
||||
: m_targetWindow->GetClientSize();
|
||||
}
|
||||
|
||||
void GetTargetSize(int *w, int *h)
|
||||
{
|
||||
wxSize size = GetTargetSize();
|
||||
if ( w )
|
||||
*w = size.x;
|
||||
if ( h )
|
||||
*h = size.y;
|
||||
}
|
||||
|
||||
// change just the target window (unlike SetWindow which changes m_win as
|
||||
// well)
|
||||
void DoSetTargetWindow(wxWindow *target);
|
||||
|
||||
// delete the event handler we installed
|
||||
void DeleteEvtHandler();
|
||||
|
||||
double m_scaleX;
|
||||
double m_scaleY;
|
||||
|
||||
wxWindow *m_win,
|
||||
*m_targetWindow;
|
||||
|
||||
wxRect m_rectToScroll;
|
||||
|
||||
wxTimer *m_timerAutoScroll;
|
||||
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
int m_xScrollLines;
|
||||
int m_yScrollLines;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
|
||||
#if wxUSE_MOUSEWHEEL
|
||||
int m_wheelRotation;
|
||||
#endif // wxUSE_MOUSEWHEEL
|
||||
|
||||
wxScrollHelperEvtHandler *m_handler;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxScrollHelper)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrolledWindow: a wxWindow which knows how to scroll
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
|
||||
#include "wx/gtk/scrolwin.h"
|
||||
#else // !wxGTK
|
||||
#include "wx/generic/scrolwin.h"
|
||||
|
||||
class WXDLLEXPORT wxScrolledWindow : public wxGenericScrolledWindow
|
||||
{
|
||||
public:
|
||||
wxScrolledWindow() { }
|
||||
wxScrolledWindow(wxWindow *parent,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
: wxGenericScrolledWindow(parent, winid, pos, size, style, name)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow)
|
||||
};
|
||||
|
||||
#define wxSCROLLED_WINDOW_IS_GENERIC 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_SCROLWIN_H_BASE_
|
||||
|
1533
include/wx/window.h
Normal file
1533
include/wx/window.h
Normal file
File diff suppressed because it is too large
Load Diff
3023
src/common/wincmn.cpp
Normal file
3023
src/common/wincmn.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1374
src/generic/scrlwing.cpp
Normal file
1374
src/generic/scrlwing.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1044
src/gtk/scrolwin.cpp
Normal file
1044
src/gtk/scrolwin.cpp
Normal file
File diff suppressed because it is too large
Load Diff
4904
src/gtk/window.cpp
Normal file
4904
src/gtk/window.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1044
src/gtk1/scrolwin.cpp
Normal file
1044
src/gtk1/scrolwin.cpp
Normal file
File diff suppressed because it is too large
Load Diff
4904
src/gtk1/window.cpp
Normal file
4904
src/gtk1/window.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,37 +0,0 @@
|
||||
The collection of scripts in this directory are an attempt to fully
|
||||
automate the build of the wxPython source and binary packages on all
|
||||
build platforms. It does this through creative use of ssh and scp
|
||||
commands to the remote build machines, so this will likely only work
|
||||
in my somewhat unique environment.
|
||||
|
||||
The goal here is to be able to start a build on one machine and have
|
||||
it take care of all the steps, including moving the source tarball to
|
||||
the other build machines, initiating the build there, and collecting
|
||||
the results. Depending on the type of build, (see below) the results
|
||||
may be copied to a public server for others to play with.
|
||||
|
||||
Types of builds:
|
||||
|
||||
dryrun
|
||||
Nothing extra is done with the build, this is just for
|
||||
my own testing.
|
||||
|
||||
daily
|
||||
The version number is temporarily adjusted to include a
|
||||
datestamp, and if the build is successful the results
|
||||
are copied to a daily build folder on starship.
|
||||
|
||||
release
|
||||
The results are uploaded to the previews foler on
|
||||
starship if the build is successful.
|
||||
|
||||
|
||||
The master script in this folder is build-all (written in Python)
|
||||
which will setup and control the whole process. The other scripts
|
||||
(using bash) are launched from build-all either to do specific tasks
|
||||
locally, or to run on each individual build machine to manage the
|
||||
build process there, usually by calling out to other scripts that
|
||||
already exist. The build-all script uses the taskrunner.py and
|
||||
subprocess Python modules.
|
||||
|
||||
|
@@ -1,266 +0,0 @@
|
||||
#!/usr/bin/python -u
|
||||
#----------------------------------------------------------------------
|
||||
# Name: build-all.py
|
||||
# Purpose: Master build script for building all the installers and
|
||||
# such on all the build machines in my lab, and then
|
||||
# distributing the results as needed.
|
||||
#
|
||||
# This will replace the build-all bash script and is
|
||||
# needed because the needs of the build have outgrown
|
||||
# what I can do with bash.
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 05-Nov-2004
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 2004 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
from taskrunner import Job, Task, TaskRunner
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Configuration items
|
||||
|
||||
class Config:
|
||||
def write(self, filename="config", outfile=None):
|
||||
if outfile is None:
|
||||
f = file(filename, "w")
|
||||
else:
|
||||
f = outfile
|
||||
for k, v in self.__dict__.items():
|
||||
f.write('%s="%s"\n' % (k, v))
|
||||
|
||||
config = Config()
|
||||
|
||||
# the local spot that we put everything when done, before possibly copying
|
||||
# to remote hosts
|
||||
config.STAGING_DIR = "./BUILD"
|
||||
|
||||
|
||||
# host name of the machine to use for windows builds
|
||||
config.WIN_HOST = "beast"
|
||||
# Where is the build dir from the remote machine's perspective?
|
||||
config.WIN_BUILD = "/c/BUILD"
|
||||
|
||||
|
||||
# Just like the above
|
||||
config.OSX_HOST_panther = "bigmac"
|
||||
config.OSX_HOST_jaguar = "whopper"
|
||||
config.OSX_BUILD = "/BUILD"
|
||||
|
||||
|
||||
# Alsmost the same... See below for hosts and other info
|
||||
config.LINUX_BUILD = "/tmp/BUILD"
|
||||
|
||||
|
||||
# Upload server locations
|
||||
config.UPLOAD_HOST = "starship.python.net"
|
||||
config.UPLOAD_DAILY_ROOT = "/home/crew/robind/public_html/wxPython/daily"
|
||||
config.UPLOAD_PREVIEW_ROOT = "/home/crew/robind/public_html/wxPython/rc"
|
||||
|
||||
# defaults for build options
|
||||
config.KIND = "dryrun"
|
||||
config.skipsource = "no"
|
||||
config.onlysource = "no"
|
||||
config.skipdocs = "no"
|
||||
config.skipwin = "no"
|
||||
config.skiposx = "no"
|
||||
config.skiplinux = "no"
|
||||
config.skipclean = "no"
|
||||
config.skipupload = "no"
|
||||
config.skipnewdocs = "no"
|
||||
config.startcohost = "yes"
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Define all the build tasks
|
||||
|
||||
class Job(Job):
|
||||
LOGBASE = "./tmp"
|
||||
|
||||
CFGFILE = "./tmp/config"
|
||||
|
||||
|
||||
# Things that need to be done before any of the builds
|
||||
initialTask = Task([ Job("", ["distrib/all/build-setup", CFGFILE]),
|
||||
Job("", ["distrib/all/build-docs", CFGFILE]),
|
||||
Job("", ["distrib/all/build-sources", CFGFILE]),
|
||||
])
|
||||
|
||||
# Build tasks. Anything that can be done in parallel (depends greatly
|
||||
# on the nature of the build machines configurations...) is a separate
|
||||
# task.
|
||||
|
||||
jaguarTask = Task( Job("whopper.23",
|
||||
["distrib/all/build-osx", CFGFILE, config.OSX_HOST_jaguar, "jaguar", "2.3"]) )
|
||||
|
||||
pantherTask = Task([ Job("bigmac.23",
|
||||
["distrib/all/build-osx", CFGFILE, config.OSX_HOST_panther, "panther", "2.3"]),
|
||||
Job("bigmac.24",
|
||||
["distrib/all/build-osx", CFGFILE, config.OSX_HOST_panther, "panther", "2.4"])
|
||||
])
|
||||
|
||||
beastTask1 = Task([ Job("beast.23", ["distrib/all/build-windows", CFGFILE, "2.3"]),
|
||||
Job("beast.24", ["distrib/all/build-windows", CFGFILE, "2.4"]),
|
||||
Job("co-mdk102.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk102","mdk102","2.4"]),
|
||||
])
|
||||
|
||||
beastTask2 = Task([ Job("co-fc2.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.3"]),
|
||||
Job("co-mdk101.23", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.3"]),
|
||||
Job("co-fc2.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-fc2", "fc2", "2.4"]),
|
||||
#Job("co-mdk101.24", ["distrib/all/build-rpm", CFGFILE, "beast", "co-mdk101","mdk101","2.4"]),
|
||||
])
|
||||
|
||||
cyclopsTask = Task([ Job("co-mdk92.23", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-mdk92", "mdk92", "2.3"]),
|
||||
Job("co-rh9.23", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-rh9", "rh9", "2.3"]),
|
||||
Job("co-mdk92.24", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-mdk92", "mdk92", "2.4"]),
|
||||
Job("co-rh9.24", ["distrib/all/build-rpm", CFGFILE, "cyclops", "co-rh9", "rh9", "2.4"]),
|
||||
])
|
||||
|
||||
buildTasks = [ jaguarTask,
|
||||
pantherTask,
|
||||
beastTask1,
|
||||
beastTask2,
|
||||
cyclopsTask,
|
||||
]
|
||||
|
||||
# Finalization. This is for things that must wait until all the
|
||||
# builds are done, such as copying the installers someplace, sending
|
||||
# emails, etc.
|
||||
finalizationTask = Task( Job("", ["distrib/all/build-finalize", CFGFILE]) )
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def usage():
|
||||
print ""
|
||||
print "Usage: build-all [command flags...]"
|
||||
print ""
|
||||
print "build types:"
|
||||
print " dryrun Do the build, but don't copy anywhere (default)"
|
||||
print " daily Do a daily build, copy to starship"
|
||||
print " release Do a normal release (cantidate) build, copy to starship"
|
||||
print ""
|
||||
print "optional command flags:"
|
||||
print " skipsource Don't build the source archives, use the ones"
|
||||
print " already in the staging dir."
|
||||
print " onlysource Exit after building the source and docs archives"
|
||||
print " skipdocs Don't rebuild the docs"
|
||||
print " skipwin Don't do the remote Windows build"
|
||||
print " skiposx Don't do the remote OSX build"
|
||||
print " skiplinux Don't do the remote Linux build"
|
||||
print " skipclean Don't do the cleanup step on the remote builds"
|
||||
print " skipupload Don't upload the builds to starship"
|
||||
print ""
|
||||
print " nocohost Don't start the coLinux sessions if they are"
|
||||
print " not already online"
|
||||
print ""
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def main(args):
|
||||
# Make sure we are running in the right directory. TODO: make
|
||||
# this test more robust. Currenly we just test for the presence
|
||||
# of 'wxPython' and 'wx' subdirs.
|
||||
if not os.path.isdir("wxPython") or not os.path.isdir("wx"):
|
||||
print "Please run this script from the root wxPython directory."
|
||||
sys.exit(1)
|
||||
|
||||
# Check command line flags
|
||||
for flag in args:
|
||||
if flag in ["dryrun", "daily", "release"]:
|
||||
config.KIND = flag
|
||||
|
||||
elif flag == "skipsource":
|
||||
config.skipsource = "yes"
|
||||
|
||||
elif flag == "onlysource":
|
||||
config.onlysource = "yes"
|
||||
|
||||
elif flag == "skipdocs":
|
||||
config.skipdocs = "yes"
|
||||
|
||||
elif flag == "skipnewdocs":
|
||||
config.skipnewdocs = "yes"
|
||||
|
||||
elif flag == "skipwin":
|
||||
config.skipwin = "yes"
|
||||
|
||||
elif flag == "skiposx":
|
||||
config.skiposx = "yes"
|
||||
|
||||
elif flag == "skiplinux":
|
||||
config.skiplinux = "yes"
|
||||
|
||||
elif flag == "skipclean":
|
||||
config.skipclean = "yes"
|
||||
|
||||
elif flag == "skipupload":
|
||||
config.skipupload = "yes"
|
||||
|
||||
elif flag == "nocohost":
|
||||
config.startcohost = "no"
|
||||
|
||||
else:
|
||||
print 'Unknown flag: "%s"' % flag
|
||||
usage()
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
# ensure the staging area exists
|
||||
if not os.path.exists(config.STAGING_DIR):
|
||||
os.makedirs(config.STAGING_DIR)
|
||||
|
||||
# Figure out the wxPython version number, possibly adjusted for being a daily build
|
||||
if config.KIND == "daily":
|
||||
t = time.localtime()
|
||||
config.DAILY = time.strftime("%Y%m%d") # should it include the hour too? 2-digit year?
|
||||
file("DAILY_BUILD", "w").write(config.DAILY)
|
||||
sys.path.append('.')
|
||||
import setup
|
||||
config.VERSION = setup.VERSION
|
||||
|
||||
# write the config file where the build scripts can find it
|
||||
config.write(CFGFILE)
|
||||
print "Build getting started at: ", time.ctime()
|
||||
|
||||
|
||||
# Run the first task, which will create the docs and sources tarballs
|
||||
tr = TaskRunner(initialTask)
|
||||
rc = tr.run()
|
||||
|
||||
# cleanup the DAILY_BUILD file
|
||||
if config.KIND == "daily":
|
||||
os.unlink("DAILY_BUILD")
|
||||
|
||||
# Quit now?
|
||||
if rc != 0 or config.onlysource == "yes":
|
||||
sys.exit(rc)
|
||||
|
||||
|
||||
# Run the main build tasks
|
||||
tr = TaskRunner(buildTasks)
|
||||
rc = tr.run()
|
||||
if rc != 0:
|
||||
sys.exit(rc)
|
||||
|
||||
|
||||
# when all the builds are done, run the finalization task
|
||||
tr = TaskRunner(finalizationTask)
|
||||
rc = tr.run()
|
||||
if rc != 0:
|
||||
sys.exit(rc)
|
||||
|
||||
|
||||
print "Build finished at: ", time.ctime()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
@@ -1,36 +0,0 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
|
||||
if [ $skipdocs != yes ]; then
|
||||
# Regenerate the reST docs
|
||||
echo "Regenerating the reST docs..."
|
||||
cd docs
|
||||
for x in *.txt; do
|
||||
docutils-html $x `basename $x .txt`.html
|
||||
done
|
||||
cd -
|
||||
for doc in CHANGES BUILD INSTALL MigrationGuide default; do
|
||||
cp docs/$doc.* $STAGING_DIR
|
||||
done
|
||||
|
||||
# build the doc and demo tarballs
|
||||
distrib/makedemo
|
||||
distrib/makedocs
|
||||
mv dist/wxPython-docs-$VERSION.tar.gz $STAGING_DIR
|
||||
mv dist/wxPython-demo-$VERSION.tar.gz $STAGING_DIR
|
||||
|
||||
|
||||
# build the new docs too
|
||||
if [ $skipnewdocs != yes ]; then
|
||||
docs/bin/everything
|
||||
mv dist/wxPython-newdocs-$VERSION.tar.gz $STAGING_DIR
|
||||
fi
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------------------
|
@@ -1,115 +0,0 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
|
||||
|
||||
|
||||
chmod a+r $STAGING_DIR/*
|
||||
|
||||
if [ $KIND = dryrun ]; then
|
||||
# we're done leave the files in the staging dir and quit
|
||||
echo "Not uploading dryrun."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ $KIND = daily ]; then
|
||||
|
||||
echo "Copying to the local file server..."
|
||||
destdir=/stuff/temp/$VERSION
|
||||
mkdir -p $destdir
|
||||
cp $STAGING_DIR/* $destdir
|
||||
|
||||
if [ $skipupload != yes ]; then
|
||||
destdir=$UPLOAD_DAILY_ROOT/$DAILY
|
||||
echo "Copying to the starship at $destdir..."
|
||||
ssh $UPLOAD_HOST "mkdir -p $destdir"
|
||||
scp -p $STAGING_DIR/* $UPLOAD_HOST:/$destdir
|
||||
ssh $UPLOAD_HOST "cd $destdir && ls -al"
|
||||
|
||||
|
||||
# TODO: something to remove old builds from starship, keeping
|
||||
# only N days worth
|
||||
|
||||
# Send email to wxPython-dev
|
||||
DATE=`date`
|
||||
TO=wxPython-dev@lists.wxwidgets.org
|
||||
|
||||
cat <<EOF | /usr/sbin/sendmail $TO
|
||||
From: R'bot <rbot@wxpython.org>
|
||||
To: $TO
|
||||
Subject: $DAILY test build uploaded
|
||||
Date: $DATE
|
||||
|
||||
Hi,
|
||||
|
||||
A new test build of wxPython has been uploaded to starship.
|
||||
|
||||
Version: $VERSION
|
||||
URL: http://starship.python.net/crew/robind/wxPython/daily/$DAILY
|
||||
Changes: http://starship.python.net/crew/robind/wxPython/daily/$DAILY/CHANGES.html
|
||||
|
||||
Have fun!
|
||||
R'bot
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo "Cleaning up staging dir..."
|
||||
rm $STAGING_DIR/*
|
||||
rmdir $STAGING_DIR
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ $KIND = release ]; then
|
||||
|
||||
echo "Copying to the local file server..."
|
||||
destdir=/stuff/Development/wxPython/dist/$VERSION
|
||||
mkdir -p $destdir
|
||||
cp $STAGING_DIR/* $destdir
|
||||
|
||||
if [ $skipupload != yes ]; then
|
||||
echo "Copying to the starship..."
|
||||
destdir=$UPLOAD_PREVIEW_ROOT/$VERSION
|
||||
ssh $UPLOAD_HOST "mkdir -p $destdir"
|
||||
scp -p $STAGING_DIR/* $UPLOAD_HOST:/$destdir
|
||||
|
||||
# Send email to wxPython-dev
|
||||
DATE=`date`
|
||||
TO=wxPython-dev@lists.wxwidgets.org
|
||||
|
||||
cat <<EOF | /usr/sbin/sendmail $TO
|
||||
From: R'bot <rbot@wxpython.org>
|
||||
To: $TO
|
||||
Subject: $VERSION release candidate build uploaded
|
||||
Date: $DATE
|
||||
|
||||
Hi,
|
||||
|
||||
A new RC build of wxPython has been uploaded to starship.
|
||||
|
||||
Version: $VERSION
|
||||
URL: http://starship.python.net/crew/robind/wxPython/rc/$VERSION
|
||||
Changes: http://starship.python.net/crew/robind/wxPython/rc/$VERSION/CHANGES.html
|
||||
|
||||
Have fun!
|
||||
R'bot
|
||||
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
echo "Cleaning up staging dir..."
|
||||
rm $STAGING_DIR/*
|
||||
rmdir $STAGING_DIR
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
@@ -1,44 +0,0 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
|
||||
host=$2
|
||||
flavor=$3
|
||||
pyver=$4
|
||||
|
||||
if [ $skiposx != yes ]; then
|
||||
# test if the target machine is online
|
||||
if ping -q -c1 -w1 $host > /dev/null; then
|
||||
echo " The $host machine is online, OSX-$flavor build continuing..."
|
||||
else
|
||||
echo "The $host machine is **OFFLINE**, skipping the OSX-$flavor build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Copying source files and build script..."
|
||||
ssh root@$host "mkdir -p $OSX_BUILD && rm -rf $OSX_BUILD/* || true"
|
||||
|
||||
scp $STAGING_DIR/wxPython-src-$VERSION.tar.gz \
|
||||
$STAGING_DIR/wxPython-docs-$VERSION.tar.gz \
|
||||
$STAGING_DIR/wxPython-demo-$VERSION.tar.gz \
|
||||
distrib/all/do-build-osx \
|
||||
root@$host:$OSX_BUILD
|
||||
|
||||
echo "Running build script on $host..."
|
||||
wxdir=$OSX_BUILD/wxPython-src-$VERSION
|
||||
cmd=./do-build-osx
|
||||
ssh root@$host "cd $OSX_BUILD && $cmd $wxdir $OSX_BUILD $skipclean $VERSION $flavor $pyver && rm $cmd"
|
||||
|
||||
echo "Fetching the results..."
|
||||
scp "root@$host:$OSX_BUILD/wxPython*-osx*" $STAGING_DIR
|
||||
ssh root@$host "rm $OSX_BUILD/wxPython*-osx*"
|
||||
|
||||
echo "Done!"
|
||||
sleep 1
|
||||
fi
|
||||
|
@@ -1,102 +0,0 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
coHost=$2
|
||||
host=$3
|
||||
reltag=$4
|
||||
shift;shift;shift;shift
|
||||
pyver=$@
|
||||
|
||||
if [ $pyver = config ]; then
|
||||
pyver=$PYVER
|
||||
fi
|
||||
|
||||
|
||||
function TestOnline {
|
||||
local host=$1
|
||||
local message=$2
|
||||
|
||||
if ping -q -c1 -w1 $host > /dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [ $skiplinux != yes ]; then
|
||||
|
||||
startedCoHost=no
|
||||
hostAvailable=no
|
||||
|
||||
# test if the target machine is online
|
||||
if TestOnline $host; then
|
||||
hostAvailable=yes
|
||||
else
|
||||
# Attempt to start the host via it's coLinux host, if there is one
|
||||
if [ $coHost != none -a $startcohost == yes ]; then
|
||||
if TestOnline $coHost; then
|
||||
echo "Attempting to start $host via coLinux on $coHost..."
|
||||
ssh $coHost "/c/coLinux/VMs/$host.bat -d > /dev/null 2>&1 &"
|
||||
|
||||
# Give it time to boot and be ready for conenctions,
|
||||
# and then test with ssh, limiting retries.
|
||||
for x in `seq 36`; do
|
||||
sleep 5
|
||||
echo "checking..."
|
||||
if ssh root@$host "true" >/dev/null 2>&1; then
|
||||
# success! the host is ready so we can break out of the loop
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
# test if the host is ready
|
||||
if TestOnline $host; then
|
||||
echo "coLinux start of $host on $coHost successful."
|
||||
startedCoHost=yes
|
||||
hostAvailable=yes
|
||||
fi
|
||||
else
|
||||
echo "The $coHost machine is offline, unable to start coLinux for $host"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $hostAvailable = yes ]; then
|
||||
echo "The $host machine is online, build continuing..."
|
||||
else
|
||||
echo "The $host machine is **OFFLINE**, skipping the binary RPM build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
echo "Copying source files and build script..."
|
||||
ssh root@$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*"
|
||||
scp $STAGING_DIR/wxPython-src* $STAGING_DIR/wxPython.spec\
|
||||
distrib/all/do-build-rpm \
|
||||
root@$host:$LINUX_BUILD
|
||||
|
||||
echo "Running build script on $host..."
|
||||
cmd=./do-build-rpm
|
||||
ssh root@$host "cd $LINUX_BUILD && $cmd $reltag $skipclean $VERSION $pyver"
|
||||
|
||||
echo "Fetching the results..."
|
||||
scp "root@$host:$LINUX_BUILD/wxPython*.i[0-9]86.rpm" $STAGING_DIR
|
||||
ssh root@$host "rm $LINUX_BUILD/wxPython*.i[0-9]86.rpm"
|
||||
|
||||
|
||||
if [ $startedCoHost = yes ]; then
|
||||
echo "Halting $host on $coHost..."
|
||||
ssh root@$host "/sbin/halt"
|
||||
sleep 10
|
||||
fi
|
||||
sleep 30
|
||||
|
||||
echo "Done!"
|
||||
fi
|
||||
|
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
|
||||
# clean out the local dist dir
|
||||
rm -f dist/*
|
||||
|
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
if [ $skipsource != yes -o $onlysource = yes ]; then
|
||||
|
||||
# make the source tarball and srpm
|
||||
distrib/makerpm 2.4 srpm
|
||||
|
||||
# Copy everything to the staging dir
|
||||
echo "Moving stuff to $STAGING_DIR..."
|
||||
mv dist/* $STAGING_DIR
|
||||
|
||||
fi
|
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
|
||||
# read the config variables from the file given on the command line
|
||||
. $1
|
||||
|
||||
PYVER=$2
|
||||
|
||||
if [ $skipwin != yes ]; then
|
||||
# test if the target machine is online
|
||||
if ping -q -c1 -w1 $WIN_HOST > /dev/null; then
|
||||
echo " The $WIN_HOST machine is online, Windows build continuing..."
|
||||
else
|
||||
echo "The $WIN_HOST machine is **OFFLINE**, skipping the Windows build."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Copying source file and build script..."
|
||||
scp $STAGING_DIR/wxPython-src-$VERSION.tar.gz \
|
||||
distrib/all/do-build-windows \
|
||||
$WIN_HOST:$WIN_BUILD
|
||||
|
||||
echo "Running build script on $WIN_HOST..."
|
||||
wxdir=$WIN_BUILD/wxPython-src-$VERSION
|
||||
cmd=./do-build-windows
|
||||
ssh $WIN_HOST "cd $WIN_BUILD && $cmd $wxdir $WIN_BUILD $skipclean $VERSION $PYVER && rm $cmd"
|
||||
|
||||
echo "Fetching the results..."
|
||||
scp "$WIN_HOST:$WIN_BUILD/wxPython*-win32*" $STAGING_DIR
|
||||
ssh $WIN_HOST "rm $WIN_BUILD/wxPython*-win32*"
|
||||
|
||||
echo "Done!"
|
||||
fi
|
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
distrib/all/build-all daily $* 2>&1 | tee tmp/daily.log
|
@@ -1,70 +0,0 @@
|
||||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------------
|
||||
# Build wxWidgets and wxPython on a OSX box. This is normally
|
||||
# called from build-all but it should be able to be used standalone too...
|
||||
#
|
||||
# The command line must have the following parameters:
|
||||
#
|
||||
# 1. the path to the base of the wx source tree
|
||||
# 2. the path of where to put the resulting installers
|
||||
# 3. skipclean flag (yes|no)
|
||||
# 4. the VERSION
|
||||
# 5. the KIND (panther or jaguar)
|
||||
# *. the remaining args are the versions of Python to build for
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
#set -o xtrace
|
||||
|
||||
echo "-=-=-=- Hello from $HOSTNAME -=-=-=-"
|
||||
|
||||
if [ $# -lt 6 ]; then
|
||||
echo "Usage: $0 WXDIR DESTDIR SKIPCLEAN VERSION KIND PYVER"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WXDIR=$1
|
||||
DESTDIR=$2
|
||||
SKIPCLEAN=$3
|
||||
VERSION=$4
|
||||
KIND=$5
|
||||
PYVER=$6
|
||||
|
||||
|
||||
#export PATH=/sw/bin:/usr/local/bin:$PATH
|
||||
export PATH=/sw/bin:/sw/sbin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:.:/usr/X11R6/bin
|
||||
echo "PATH =" $PATH
|
||||
echo "which gcc = " `which gcc`
|
||||
#exit 0
|
||||
|
||||
# untar the source
|
||||
echo "Unarchiving wxPython-src-$VERSION.tar.gz"
|
||||
cd $DESTDIR
|
||||
tar xzf wxPython-src-$VERSION.tar.gz
|
||||
rm wxPython-src-$VERSION.tar.gz
|
||||
|
||||
|
||||
echo "Invoking wxPythonOSX build script..."
|
||||
cd $WXDIR/wxPython
|
||||
export TARBALLDIR=$DESTDIR
|
||||
mkdir -p dist
|
||||
if [ $KIND = panther ]; then
|
||||
distrib/mac/wxPythonOSX/build $PYVER $KIND inplace unicode
|
||||
fi
|
||||
distrib/mac/wxPythonOSX/build $PYVER $KIND inplace
|
||||
|
||||
|
||||
echo "Copying installers to $DESTDIR..."
|
||||
cp dist/*.dmg $DESTDIR
|
||||
cd $DESTDIR
|
||||
|
||||
|
||||
if [ $SKIPCLEAN != yes ]; then
|
||||
echo "Cleaning up..."
|
||||
rm -r $WXDIR || true
|
||||
rm wxPython-docs-$VERSION.tar.gz
|
||||
rm wxPython-demo-$VERSION.tar.gz
|
||||
fi
|
||||
|
||||
echo "-=-=-=- Goodbye! -=-=-=-"
|
@@ -1,99 +0,0 @@
|
||||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------------
|
||||
# Build the wxPython source RPMs on a Linux box. This is normally called
|
||||
# from build-all but it should be able to be used standalone too...
|
||||
#
|
||||
# The command line must have the following parameters:
|
||||
#
|
||||
# 1. the path of the build dir. The src RPMs will be here when we start
|
||||
# and the binary RPMs will be left here when we're done.
|
||||
# 2. skipclean flag (yes|no)
|
||||
# 3. the VERSION
|
||||
# 4. the remaining args are the versions of Python to build for
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
#set -o xtrace
|
||||
|
||||
echo "-=-=-=- Hello from $HOSTNAME -=-=-=-"
|
||||
|
||||
if [ $# -lt 4 ]; then
|
||||
echo "Usage: $0 WXDIR DESTDIR SKIPCLEAN VERSION PYVER..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE=$1
|
||||
SKIPCLEAN=$2
|
||||
VERSION=$3
|
||||
shift;shift;shift
|
||||
PYVER=$@
|
||||
|
||||
rpmtop=_rpm_top
|
||||
|
||||
if which rpmbuild > /dev/null 2>&1; then
|
||||
RPMBUILD=rpmbuild
|
||||
else
|
||||
RPMBUILD=rpm
|
||||
fi
|
||||
|
||||
|
||||
function DoRPMBuild {
|
||||
# $1 : python version
|
||||
# $2 : port
|
||||
# $3 : unicode
|
||||
|
||||
echo "-=-=-=-=-=-=-=-=-=-=-"
|
||||
echo $1 $2 $3
|
||||
echo "-=-=-=-=-=-=-=-=-=-=-"
|
||||
|
||||
$RPMBUILD --define "_topdir $PWD/$rpmtop" \
|
||||
--define "_tmppath $PWD/$rpmtop/tmp" \
|
||||
--define "release ${RELEASE}_py$1" \
|
||||
--define "pyver $1" \
|
||||
--define "port $2" \
|
||||
--define "unicode $3" \
|
||||
-bb wxPython.spec
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
return $?
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo "*** Setting up RPM build dirs"
|
||||
for dir in SPECS BUILD RPMS SOURCES SRPMS tmp; do
|
||||
if [ ! -d $rpmtop/$dir ]; then
|
||||
mkdir -p $rpmtop/$dir
|
||||
fi
|
||||
done
|
||||
|
||||
cp wxPython-src-$VERSION.tar.gz $rpmtop/SOURCES
|
||||
|
||||
echo "******************** PYVER = " $PYVER
|
||||
for ver in $PYVER; do
|
||||
echo "Building the RPMs for Python $ver..."
|
||||
|
||||
## for now let's just do the gtk2 builds
|
||||
##DoRPMBuild $ver gtk 0
|
||||
|
||||
DoRPMBuild $ver gtk2 0
|
||||
DoRPMBuild $ver gtk2 1
|
||||
done
|
||||
|
||||
|
||||
echo "*** Moving RPMs to ."
|
||||
find $rpmtop -name "*.rpm"
|
||||
mv -f `find $rpmtop -name "*.rpm"` .
|
||||
|
||||
|
||||
if [ $SKIPCLEAN != yes ]; then
|
||||
echo "*** Cleaning up $rpmtop"
|
||||
rm -rf $rpmtop
|
||||
|
||||
echo "Cleaning up..."
|
||||
rm *.spec *.tar.gz
|
||||
fi
|
||||
|
||||
echo "-=-=-=- Goodbye! -=-=-=-"
|
@@ -1,135 +0,0 @@
|
||||
#!/bin/bash
|
||||
# ---------------------------------------------------------------------------
|
||||
# Build wxWidgets and wxPython on a Windows box. This is normally called
|
||||
# from build-all but it should be able to be used standalone too...
|
||||
#
|
||||
# The command line must have the following parameters:
|
||||
#
|
||||
# 1. the path to the base of the wx source tree
|
||||
# 2. the path of where to put the resulting installers
|
||||
# 3. skipclean flag (yes|no)
|
||||
# 4. the VERSION
|
||||
# 5. the remaining args are the versions of Python to build for
|
||||
#
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
set -o errexit
|
||||
#set -o xtrace
|
||||
|
||||
echo "-=-=-=- Hello from $HOSTNAME -=-=-=-"
|
||||
|
||||
if [ $# -lt 5 ]; then
|
||||
echo "Usage: $0 WXDIR DESTDIR SKIPCLEAN VERSION PYVER..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WXDIR=$1
|
||||
DESTDIR=$2
|
||||
SKIPCLEAN=$3
|
||||
VERSION=$4
|
||||
PYVER=$5
|
||||
|
||||
|
||||
# WXDIR is the cygwin path, WXWIN is the DOS path
|
||||
WXWIN_OLD=$WXWIN
|
||||
WXWIN=`cygpath -w $WXDIR`
|
||||
export WXWIN
|
||||
|
||||
|
||||
|
||||
# setup the compiler
|
||||
if [ $PYVER = 2.3 ]; then
|
||||
echo "Using MSVC ver 6"
|
||||
. msvcset local 6
|
||||
echo `which cl.exe`
|
||||
else
|
||||
echo "Using MSVC ver 7"
|
||||
. msvcset local 7
|
||||
echo `which cl.exe`
|
||||
fi
|
||||
|
||||
|
||||
# untar the source
|
||||
echo "Unarchiving wxPython-src-$VERSION.tar.gz"
|
||||
cd $DESTDIR
|
||||
tar xzf wxPython-src-$VERSION.tar.gz
|
||||
rm wxPython-src-$VERSION.tar.gz
|
||||
|
||||
|
||||
# Fix line endings
|
||||
echo "Converting wxPython line endings to CRLF..."
|
||||
cd $WXDIR
|
||||
names=`find wxPython -name "*.py" -o -name "*.txt" -o -name "*.htm*" -o -name "*.css" -o -name "*.xml" `
|
||||
unix2dos -D $names
|
||||
|
||||
|
||||
# change to the right spot in the source tree and copy our build scripts
|
||||
echo "Setting up for the build..."
|
||||
cd $WXDIR/build/msw
|
||||
cp $WXDIR/wxPython/distrib/msw/.m* .
|
||||
chmod +x .m*
|
||||
|
||||
|
||||
# replace some settings in setup0.h and write to setup.h
|
||||
cat > .my.sedexpr <<EOF
|
||||
s/wxDIALOG_UNIT_COMPATIBILITY *1/wxDIALOG_UNIT_COMPATIBILITY 0/g
|
||||
s/wxUSE_EXCEPTIONS *1/wxUSE_EXCEPTIONS 0/g
|
||||
s/wxUSE_DEBUG_CONTEXT *0/wxUSE_DEBUG_CONTEXT 1/g
|
||||
s/wxUSE_MEMORY_TRACING *0/wxUSE_MEMORY_TRACING 1/g
|
||||
s/wxUSE_DIALUP_MANAGER *1/wxUSE_DIALUP_MANAGER 0/g
|
||||
s/wxUSE_GLCANVAS *0/wxUSE_GLCANVAS 1/g
|
||||
s/wxUSE_POSTSCRIPT *0/wxUSE_POSTSCRIPT 1/g
|
||||
s/wxUSE_AFM_FOR_POSTSCRIPT *1/wxUSE_AFM_FOR_POSTSCRIPT 0/g
|
||||
s/wxUSE_DISPLAY *0/wxUSE_DISPLAY 1/g
|
||||
s/wxUSE_DIB_FOR_BITMAP *0/wxUSE_DIB_FOR_BITMAP 1/g
|
||||
s/wxUSE_DEBUGREPORT *1/wxUSE_DEBUGREPORT 0/g
|
||||
EOF
|
||||
cat $WXDIR/include/wx/msw/setup0.h | sed -f .my.sedexpr > $WXDIR/include/wx/msw/setup.h
|
||||
rm .my.sedexpr
|
||||
|
||||
|
||||
echo "Building the wx DLLs..."
|
||||
.make hybrid
|
||||
.make hybrid-uni
|
||||
|
||||
|
||||
#echo "Building the wx tools..."
|
||||
#.make_tools
|
||||
|
||||
# cheat and just copy the .CHM files from the regular project dir
|
||||
# TODO: Copy over the wxPython-docs fle and run hhc on the contents of that.
|
||||
mkdir -p $WXDIR/docs/htmlhelp
|
||||
cp `cygpath $WXWIN_OLD/docs/htmlhelp`/*.chm $WXDIR/docs/htmlhelp
|
||||
|
||||
|
||||
echo "Building wxPython and installers..."
|
||||
cd $WXDIR/wxPython
|
||||
mkdir -p dist
|
||||
|
||||
for ver in $PYVER; do
|
||||
echo $ver
|
||||
b $ver d UNICODE=0 USE_SWIG=0
|
||||
b $ver h UNICODE=0 USE_SWIG=0 EP_ADD_OPTS=1
|
||||
b $ver r UNICODE=0 USE_SWIG=0
|
||||
b $ver d UNICODE=1 USE_SWIG=0
|
||||
b $ver h UNICODE=1 USE_SWIG=0 EP_ADD_OPTS=1
|
||||
b $ver r UNICODE=1 USE_SWIG=0
|
||||
done
|
||||
|
||||
echo "Building the developer package..."
|
||||
WXWIN=`cygpath -w $WXDIR`
|
||||
export WXWIN
|
||||
4nt /c distrib/makedev.bat $VERSION
|
||||
|
||||
|
||||
echo "Copying installers to $DESTDIR..."
|
||||
mv dist/wxPython* $DESTDIR
|
||||
cd $DESTDIR
|
||||
|
||||
|
||||
if [ $SKIPCLEAN != yes ]; then
|
||||
echo "Cleaning up..."
|
||||
rm -r $WXDIR || true
|
||||
fi
|
||||
|
||||
echo "-=-=-=- Goodbye! -=-=-=-"
|
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
distrib/all/build-all dryrun $* 2>&1 | tee tmp/dryrun.log
|
||||
|
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
distrib/all/build-all release $* 2>&1 | tee tmp/release.log
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,232 +0,0 @@
|
||||
#----------------------------------------------------------------------
|
||||
# Name: taskrunner.py
|
||||
# Purpose: Classes that can manage running of external processes,
|
||||
# either consecutively, simultaneously, or both, and can
|
||||
# log the output of those jobs
|
||||
#
|
||||
# Author: Robin Dunn
|
||||
#
|
||||
# Created: 05-Nov-2004
|
||||
# RCS-ID: $Id$
|
||||
# Copyright: (c) 2004 by Total Control Software
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
import os
|
||||
import signal
|
||||
import select
|
||||
import fcntl
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
|
||||
|
||||
__all__ = ["Job", "Task", "TaskRunner"]
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
class Job(object):
|
||||
"""
|
||||
Each Job is a monitor wrapped around an externally executing
|
||||
process. It handles starting the process, polling if it is still
|
||||
running, reading and logging it's output, and killing it if
|
||||
needed.
|
||||
"""
|
||||
|
||||
LOGBASE="."
|
||||
|
||||
def __init__(self, label, args):
|
||||
self.label = label
|
||||
self.args = args
|
||||
self.proc = None
|
||||
if self.label:
|
||||
self.log = file("%s/%s.log" % (self.LOGBASE, label), "w", 0)
|
||||
|
||||
def start(self):
|
||||
self.proc = Popen(self.args, # the command and args to execute
|
||||
stdout=PIPE, stderr=STDOUT,
|
||||
bufsize=0, # line-buffered
|
||||
)
|
||||
# put the file in non-blocking mode
|
||||
#flags = fcntl.fcntl (self.proc.stdout, fcntl.F_GETFL, 0)
|
||||
#flags = flags | os.O_NONBLOCK
|
||||
#fcntl.fcntl (self.proc.stdout, fcntl.F_SETFL, flags)
|
||||
|
||||
|
||||
def stop(self):
|
||||
if self.proc is not None and self.proc.returncode is None:
|
||||
os.kill(self.proc.pid, signal.SIGTERM)
|
||||
self.logLines()
|
||||
|
||||
|
||||
def fileno(self):
|
||||
if self.proc is not None:
|
||||
return self.proc.stdout.fileno()
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
def logLines(self):
|
||||
if self.proc is not None:
|
||||
while self.linesAvailable():
|
||||
line = self.proc.stdout.readline()
|
||||
if not line: break
|
||||
if self.label:
|
||||
self.log.write(line)
|
||||
line = "** %s: %s" % (self.label, line)
|
||||
sys.stdout.write(line)
|
||||
|
||||
|
||||
def linesAvailable(self):
|
||||
if self.proc is None:
|
||||
return False
|
||||
ind, outd, err = select.select([self], [], [], 0)
|
||||
if ind:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def finished(self):
|
||||
if self.proc is None:# or self.linesAvailable():
|
||||
return False
|
||||
return self.proc.poll() is not None
|
||||
|
||||
|
||||
def wait(self):
|
||||
if self.proc is None: return None
|
||||
return self.proc.wait()
|
||||
|
||||
|
||||
def poll(self):
|
||||
if self.proc is None: return None
|
||||
return self.proc.poll()
|
||||
|
||||
|
||||
def returnCode(self):
|
||||
if self.proc is None: return None
|
||||
return self.proc.returncode
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class Task(object):
|
||||
"""
|
||||
This class helps manage the running of a Task, which is a simply a
|
||||
sequence of one or more Jobs, where subesquent jobs are not
|
||||
started until prior ones are completed.
|
||||
"""
|
||||
def __init__(self, jobs=[]):
|
||||
if type(jobs) != list:
|
||||
jobs = [jobs]
|
||||
self.jobs = jobs[:]
|
||||
self.active = 0
|
||||
|
||||
def append(self, job):
|
||||
self.jobs.append(job)
|
||||
|
||||
def activeJob(self):
|
||||
if self.active > len(self.jobs)-1:
|
||||
return None
|
||||
else:
|
||||
return self.jobs[self.active]
|
||||
|
||||
def next(self):
|
||||
self.active += 1
|
||||
if self.active < len(self.jobs):
|
||||
self.jobs[self.active].start()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TaskRunner(object):
|
||||
"""
|
||||
Manages the running of multiple tasks.
|
||||
"""
|
||||
def __init__(self, tasks=[]):
|
||||
if type(tasks) != list:
|
||||
tasks = [tasks]
|
||||
self.tasks = tasks[:]
|
||||
|
||||
def append(self, task):
|
||||
self.tasks.append(task)
|
||||
|
||||
def run(self):
|
||||
# start all the active jobs
|
||||
for task in self.tasks:
|
||||
task.activeJob().start()
|
||||
|
||||
try:
|
||||
# loop, getting output from the jobs, etc.
|
||||
while True:
|
||||
# get all active Jobs
|
||||
jobs = [t.activeJob() for t in self.tasks if t.activeJob()]
|
||||
if not jobs:
|
||||
break
|
||||
|
||||
# wait for a job to have output ready, then log it
|
||||
input, output, err = select.select(jobs, [], [], 1)
|
||||
for job in input:
|
||||
job.logLines()
|
||||
|
||||
# check for finished jobs
|
||||
for task in self.tasks:
|
||||
job = task.activeJob()
|
||||
if job and job.finished():
|
||||
if job.returnCode() != 0:
|
||||
rc = job.returnCode()
|
||||
print "JOB RETURNED FAILURE CODE! (%d)" % rc
|
||||
self.stopAllJobs()
|
||||
return rc
|
||||
else:
|
||||
task.next()
|
||||
except KeyboardInterrupt:
|
||||
print "STOPPING JOBS..."
|
||||
self.stopAllJobs()
|
||||
return 1
|
||||
|
||||
except:
|
||||
print "Unknown exception..."
|
||||
self.stopAllJobs()
|
||||
raise
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def stopAllJobs(self):
|
||||
for task in self.tasks:
|
||||
job = task.activeJob()
|
||||
if job:
|
||||
job.stop()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
j1 = Job("label1", ["./tmp/job-1.py", "TEST-1"])
|
||||
j2 = Job("label2", ["./tmp/job-2.sh", "TEST-2"])
|
||||
|
||||
t1 = Task()
|
||||
t1.append(j1)
|
||||
t1.append(j2)
|
||||
|
||||
j3 = Job("task2a", ["./tmp/job-1.py", "TASK-2a"])
|
||||
j4 = Job("task2b", ["./tmp/job-2.sh", "TASK-2b"])
|
||||
|
||||
t2 = Task()
|
||||
t2.append(j4)
|
||||
t2.append(j3)
|
||||
|
||||
t3 = Task([Job("error", ["./tmp/job-3.sh", "TASK-3"])])
|
||||
|
||||
tr = TaskRunner()
|
||||
tr.append(t1)
|
||||
tr.append(t2)
|
||||
tr.append(t3)
|
||||
|
||||
for task in tr.tasks:
|
||||
for job in task.jobs:
|
||||
print job.label
|
||||
|
||||
print tr.run()
|
||||
|
Reference in New Issue
Block a user