*** empty log message ***

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4160 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
1999-10-24 15:57:35 +00:00
parent ace03f87d6
commit e6ebb51430
42 changed files with 663 additions and 4402 deletions

View File

@@ -16,7 +16,7 @@
#elif defined(__WXMAC__)
#include "wx/generic/listctrl.h"
#elif defined(__WXPM__)
#include "wx/os2/listctrl.h"
#include "wx/generic/listctrl.h"
#elif defined(__WXSTUBS__)
#include "wx/generic/listctrl.h"
#endif

View File

@@ -1,42 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: colordlg.h
// Purpose: wxColourDialog class. Use generic version if no
// platform-specific implementation.
// Author: David Webster
// Modified by:
// Created: 10/13/99
// RCS-ID: $Id$
// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLORDLG_H_
#define _WX_COLORDLG_H_
#include "wx/setup.h"
#include "wx/dialog.h"
#include "wx/cmndata.h"
/*
* Platform-specific colour dialog implementation
*/
class WXDLLEXPORT wxColourDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxColourDialog)
public:
wxColourDialog();
wxColourDialog(wxWindow *parent, wxColourData *data = NULL);
bool Create(wxWindow *parent, wxColourData *data = NULL);
int ShowModal();
wxColourData& GetColourData() { return m_colourData; }
protected:
wxColourData m_colourData;
wxWindow* m_dialogParent;
};
#endif
// _WX_COLORDLG_H_

View File

@@ -33,7 +33,7 @@ public:
/* constructor for setting one data object */
wxDropSource( wxDataObject& rData,
wxWindow* pWin,
wxWindow* pWin
);
virtual ~wxDropSource();

View File

@@ -55,9 +55,6 @@ public:
virtual bool Destroy();
virtual void ClientToScreen(int *x, int *y) const;
virtual void ScreenToClient(int *x, int *y) const;
void OnSize(wxSizeEvent& event);
void OnMenuHighlight(wxMenuEvent& event);
void OnActivate(wxActivateEvent& event);
@@ -177,6 +174,9 @@ protected:
virtual void DoSetClientSize(int width, int height);
virtual void DoClientToScreen(int *x, int *y) const;
virtual void DoScreenToClient(int *x, int *y) const;
// a plug in for MDI frame classes which need to do something special when
// the menubar is set
virtual void InternalSetMenuBar();

View File

@@ -1,131 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: imaglist.h
// Purpose: wxImageList class. Note: if your GUI doesn't have
// an image list equivalent, you can use the generic class
// in src/generic.
// Author: David Webster
// Modified by:
// Created: 10/09/99
// RCS-ID: $Id$
// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_IMAGLIST_H_
#define _WX_IMAGLIST_H_
#include "wx/bitmap.h"
/*
* wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to
* images for their items by an index into an image list.
* A wxImageList is capable of creating images with optional masks from
* a variety of sources - a single bitmap plus a colour to indicate the mask,
* two bitmaps, or an icon.
*
*/
// Flags for Draw
#define wxIMAGELIST_DRAW_NORMAL 0x0001
#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002
#define wxIMAGELIST_DRAW_SELECTED 0x0004
#define wxIMAGELIST_DRAW_FOCUSED 0x0008
// Flag values for Set/GetImageList
enum {
wxIMAGE_LIST_NORMAL, // Normal icons
wxIMAGE_LIST_SMALL, // Small icons
wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation)
};
// Eventually we'll make this a reference-counted wxGDIObject. For
// now, the app must take care of ownership issues. That is, the
// image lists must be explicitly deleted after the control(s) that uses them
// is (are) deleted, or when the app exits.
class WXDLLEXPORT wxImageList: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxImageList)
public:
/*
* Public interface
*/
wxImageList();
// Creates an image list.
// Specify the width and height of the images in the list,
// whether there are masks associated with them (e.g. if creating images
// from icons), and the initial size of the list.
inline wxImageList(int width, int height, bool mask = TRUE, int initialCount = 1)
{
Create(width, height, mask, initialCount);
}
~wxImageList();
// Attributes
////////////////////////////////////////////////////////////////////////////
// Returns the number of images in the image list.
int GetImageCount() const;
// Operations
////////////////////////////////////////////////////////////////////////////
// Creates an image list
// width, height specify the size of the images in the list (all the same).
// mask specifies whether the images have masks or not.
// initialNumber is the initial number of images to reserve.
bool Create(int width, int height, bool mask = TRUE, int initialNumber = 1);
// Adds a bitmap, and optionally a mask bitmap.
// Note that wxImageList creates *new* bitmaps, so you may delete
// 'bitmap' and 'mask' after calling Add.
int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
// Adds a bitmap, using the specified colour to create the mask bitmap
// Note that wxImageList creates *new* bitmaps, so you may delete
// 'bitmap' after calling Add.
int Add(const wxBitmap& bitmap, const wxColour& maskColour);
// Adds a bitmap and mask from an icon.
int Add(const wxIcon& icon);
// Replaces a bitmap, optionally passing a mask bitmap.
// Note that wxImageList creates new bitmaps, so you may delete
// 'bitmap' and 'mask' after calling Replace.
bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
// Replaces a bitmap and mask from an icon.
// You can delete 'icon' after calling Replace.
bool Replace(int index, const wxIcon& icon);
// Removes the image at the given index.
bool Remove(int index);
// Remove all images
bool RemoveAll();
// Draws the given image on a dc at the specified position.
// If 'solidBackground' is TRUE, Draw sets the image list background
// colour to the background colour of the wxDC, to speed up
// drawing by eliminating masked drawing where possible.
bool Draw(int index, wxDC& dc, int x, int y,
int flags = wxIMAGELIST_DRAW_NORMAL, bool solidBackground = FALSE);
/* TODO (optional?)
wxIcon *MakeIcon(int index);
*/
// Implementation
////////////////////////////////////////////////////////////////////////////
// Returns the native image list handle
inline WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; }
protected:
WXHIMAGELIST m_hImageList;
};
#endif
// _WX_IMAGLIST_H_

View File

@@ -1,421 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: listctrl.h
// Purpose: wxListCtrl class
// Author: David Webster
// Modified by:
// Created: 10/10/99
// RCS-ID: $Id$
// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LISTCTRL_H_
#define _WX_LISTCTRL_H_
#include "wx/control.h"
#include "wx/event.h"
#include "wx/imaglist.h"
/*
The wxListCtrl can show lists of items in four different modes:
wxLC_LIST: multicolumn list view, with optional small icons (icons could be
optional for some platforms). Columns are computed automatically,
i.e. you don't set columns as in wxLC_REPORT. In other words,
the list wraps, unlike a wxListBox.
wxLC_REPORT: single or multicolumn report view (with optional header)
wxLC_ICON: large icon view, with optional labels
wxLC_SMALL_ICON: small icon view, with optional labels
You can change the style dynamically, either with SetSingleStyle or
SetWindowStyleFlag.
Further window styles:
wxLC_ALIGN_TOP icons align to the top (default)
wxLC_ALIGN_LEFT icons align to the left
wxLC_AUTOARRANGE icons arrange themselves
wxLC_USER_TEXT the app provides label text on demand, except for column headers
wxLC_EDIT_LABELS labels are editable: app will be notified.
wxLC_NO_HEADER no header in report mode
wxLC_NO_SORT_HEADER can't click on header
wxLC_SINGLE_SEL single selection
wxLC_SORT_ASCENDING sort ascending (must still supply a comparison callback in SortItems)
wxLC_SORT_DESCENDING sort descending (ditto)
Items are referred to by their index (position in the list starting from zero).
Label text is supplied via insertion/setting functions and is stored by the
control, unless the wxLC_USER_TEXT style has been specified, in which case
the app will be notified when text is required (see sample).
Images are dealt with by (optionally) associating 3 image lists with the control.
Zero-based indexes into these image lists indicate which image is to be used for
which item. Each image in an image list can contain a mask, and can be made out
of either a bitmap, two bitmaps or an icon. See ImagList.h for more details.
Notifications are passed via the wxWindows 2.0 event system.
See the sample wxListCtrl app for API usage.
*/
// Mask flags to tell app/GUI what fields of wxListItem are valid
#define wxLIST_MASK_STATE 0x0001
#define wxLIST_MASK_TEXT 0x0002
#define wxLIST_MASK_IMAGE 0x0004
#define wxLIST_MASK_DATA 0x0008
#define wxLIST_SET_ITEM 0x0010
#define wxLIST_MASK_WIDTH 0x0020
#define wxLIST_MASK_FORMAT 0x0040
// State flags for indicating the state of an item
#define wxLIST_STATE_DONTCARE 0x0000
#define wxLIST_STATE_DROPHILITED 0x0001
#define wxLIST_STATE_FOCUSED 0x0002
#define wxLIST_STATE_SELECTED 0x0004
#define wxLIST_STATE_CUT 0x0008
// Hit test flags, used in HitTest
#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area.
#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area.
#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item.
#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item.
#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item.
#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item.
#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state.
#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area.
#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area.
#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL wxLIST_HITTEST_ONITEMSTATEICON)
// Flags for GetNextItem
enum {
wxLIST_NEXT_ABOVE, // Searches for an item above the specified item
wxLIST_NEXT_ALL, // Searches for subsequent item by index
wxLIST_NEXT_BELOW, // Searches for an item below the specified item
wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
};
// Alignment flags for Arrange
enum {
wxLIST_ALIGN_DEFAULT,
wxLIST_ALIGN_LEFT,
wxLIST_ALIGN_TOP,
wxLIST_ALIGN_SNAP_TO_GRID
};
// Column format
enum {
wxLIST_FORMAT_LEFT,
wxLIST_FORMAT_RIGHT,
wxLIST_FORMAT_CENTRE,
wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
};
// Autosize values for SetColumnWidth
enum {
wxLIST_AUTOSIZE = -1,
wxLIST_AUTOSIZE_USEHEADER = -2
};
// Flag values for GetItemRect
enum {
wxLIST_RECT_BOUNDS,
wxLIST_RECT_ICON,
wxLIST_RECT_LABEL
};
// Flag values for FindItem
enum {
wxLIST_FIND_UP,
wxLIST_FIND_DOWN,
wxLIST_FIND_LEFT,
wxLIST_FIND_RIGHT
};
// wxListItem: data representing an item, or report field.
// It also doubles up to represent entire column information
// when inserting or setting a column.
class WXDLLEXPORT wxListItem: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxListItem)
public:
long m_mask; // Indicates what fields are valid
long m_itemId; // The zero-based item position
int m_col; // Zero-based column, if in report mode
long m_state; // The state of the item
long m_stateMask; // Which flags of m_state are valid (uses same flags)
wxString m_text; // The label/header text
int m_image; // The zero-based index into an image list
long m_data; // App-defined data
// For columns only
int m_format; // left, right, centre
int m_width; // width of column
wxListItem();
};
// type of compare function for wxListCtrl sort operation
typedef int (*wxListCtrlCompare)(long item1, long item2, long sortData);
class WXDLLEXPORT wxListCtrl: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxListCtrl)
public:
/*
* Public interface
*/
wxListCtrl();
inline wxListCtrl(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
const wxString& name = "listCtrl")
{
Create(parent, id, pos, size, style, validator, name);
}
~wxListCtrl();
bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = "wxListCtrl");
// Attributes
////////////////////////////////////////////////////////////////////////////
// Sets the background colour (GetBackgroundColour already implicit in
// wxWindow class)
bool SetBackgroundColour(const wxColour& col);
// Gets information about this column
bool GetColumn(int col, wxListItem& item) const;
// Sets information about this column
bool SetColumn(int col, wxListItem& item) ;
// Gets the column width
int GetColumnWidth(int col) const;
// Sets the column width
bool SetColumnWidth(int col, int width) ;
// Gets the number of items that can fit vertically in the
// visible area of the list control (list or report view)
// or the total number of items in the list control (icon
// or small icon view)
int GetCountPerPage() const;
// Gets the edit control for editing labels.
wxTextCtrl* GetEditControl() const;
// Gets information about the item
bool GetItem(wxListItem& info) const ;
// Sets information about the item
bool SetItem(wxListItem& info) ;
// Sets a string field at a particular column
long SetItem(long index, int col, const wxString& label, int imageId = -1);
// Gets the item state
int GetItemState(long item, long stateMask) const ;
// Sets the item state
bool SetItemState(long item, long state, long stateMask) ;
// Sets the item image
bool SetItemImage(long item, int image, int selImage) ;
// Gets the item text
wxString GetItemText(long item) const ;
// Sets the item text
void SetItemText(long item, const wxString& str) ;
// Gets the item data
long GetItemData(long item) const ;
// Sets the item data
bool SetItemData(long item, long data) ;
// Gets the item rectangle
bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ;
// Gets the item position
bool GetItemPosition(long item, wxPoint& pos) const ;
// Sets the item position
bool SetItemPosition(long item, const wxPoint& pos) ;
// Gets the number of items in the list control
int GetItemCount() const;
// Gets the number of columns in the list control
int GetColumnCount() const;
// Retrieves the spacing between icons in pixels.
// If small is TRUE, gets the spacing for the small icon
// view, otherwise the large icon view.
int GetItemSpacing(bool isSmall) const;
// Gets the number of selected items in the list control
int GetSelectedItemCount() const;
// Gets the text colour of the listview
wxColour GetTextColour() const;
// Sets the text colour of the listview
void SetTextColour(const wxColour& col);
// Gets the index of the topmost visible item when in
// list or report view
long GetTopItem() const ;
// Add or remove a single window style
void SetSingleStyle(long style, bool add = TRUE) ;
// Set the whole window style
void SetWindowStyleFlag(long style) ;
// Searches for an item, starting from 'item'.
// item can be -1 to find the first item that matches the
// specified flags.
// Returns the item or -1 if unsuccessful.
long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ;
// Implementation: converts wxWindows style to OS2 style.
// Can be a single style flag or a bit list.
// oldStyle is 'normalised' so that it doesn't contain
// conflicting styles.
long ConvertToOS2Style(long& oldStyle, long style) const;
// Gets one of the three image lists
wxImageList *GetImageList(int which) const ;
// Sets the image list
// N.B. There's a quirk in the Win95 list view implementation.
// If in wxLC_LIST mode, it'll *still* display images by the labels if
// there's a small-icon image list set for the control - even though you
// haven't specified wxLIST_MASK_IMAGE when inserting.
// So you have to set a NULL small-icon image list to be sure that
// the wxLC_LIST mode works without icons. Of course, you may want icons...
void SetImageList(wxImageList *imageList, int which) ;
// Operations
////////////////////////////////////////////////////////////////////////////
// Arranges the items
bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
// Deletes an item
bool DeleteItem(long item);
// Deletes all items
bool DeleteAllItems() ;
// Deletes a column
bool DeleteColumn(int col);
// Deletes all columns
bool DeleteAllColumns();
// Clears items, and columns if there are any.
void ClearAll();
// Edit the label
wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl));
// End label editing, optionally cancelling the edit
bool EndEditLabel(bool cancel);
// Ensures this item is visible
bool EnsureVisible(long item) ;
// Find an item whose label matches this string, starting from the item after 'start'
// or the beginning if 'start' is -1.
long FindItem(long start, const wxString& str, bool partial = FALSE);
// Find an item whose data matches this data, starting from the item after 'start'
// or the beginning if 'start' is -1.
long FindItem(long start, long data);
// Find an item nearest this position in the specified direction, starting from
// the item after 'start' or the beginning if 'start' is -1.
long FindItem(long start, const wxPoint& pt, int direction);
// Determines which item (if any) is at the specified point,
// giving details in 'flags' (see wxLIST_HITTEST_... flags above)
long HitTest(const wxPoint& point, int& flags);
// Inserts an item, returning the index of the new item if successful,
// -1 otherwise.
// TOD: Should also have some further convenience functions
// which don't require setting a wxListItem object
long InsertItem(wxListItem& info);
// Insert a string item
long InsertItem(long index, const wxString& label);
// Insert an image item
long InsertItem(long index, int imageIndex);
// Insert an image/string item
long InsertItem(long index, const wxString& label, int imageIndex);
// For list view mode (only), inserts a column.
long InsertColumn(long col, wxListItem& info);
long InsertColumn(long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT,
int width = -1);
// Scrolls the list control. If in icon, small icon or report view mode,
// x specifies the number of pixels to scroll. If in list view mode, x
// specifies the number of columns to scroll.
// If in icon, small icon or list view mode, y specifies the number of pixels
// to scroll. If in report view mode, y specifies the number of lines to scroll.
bool ScrollList(int dx, int dy);
// Sort items.
// fn is a function which takes 3 long arguments: item1, item2, data.
// item1 is the long data associated with a first item (NOT the index).
// item2 is the long data associated with a second item (NOT the index).
// data is the same value as passed to SortItems.
// The return value is a negative number if the first item should precede the second
// item, a positive number of the second item should precede the first,
// or zero if the two items are equivalent.
// data is arbitrary data to be passed to the sort function.
bool SortItems(wxListCtrlCompare fn, long data);
// IMPLEMENTATION
virtual bool OS2Command(WXUINT param, WXWORD id);
virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
// bring the control in sync with current m_windowStyle value
void UpdateStyle();
// Add to pool: necessary because Windows needs to have a string
// still exist across 3 callbacks.
wxChar *AddPool(const wxString& str);
protected:
wxTextCtrl* m_textCtrl; // The control used for editing a label
wxImageList * m_imageListNormal; // The image list for normal icons
wxImageList * m_imageListSmall; // The image list for small icons
wxImageList * m_imageListState; // The image list state icons (not implemented yet)
long m_baseStyle; // Basic Windows style flags, for recreation purposes
wxStringList m_stringPool; // Pool of 3 strings to satisfy Windows callback
// requirements
int m_colCount; // Windows doesn't have GetColumnCount so must
// keep track of inserted/deleted columns
private:
bool DoCreateControl(int x, int y, int w, int h);
};
#endif
// _WX_LISTCTRL_H_

View File

@@ -8,8 +8,8 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_STATLINE_H_
#define _WX_MSW_STATLINE_H_
#ifndef _WX_OS2_STATLINE_H_
#define _WX_OS2_STATLINE_H_
#ifdef __GNUG__
#pragma interface
@@ -45,6 +45,6 @@ public:
const wxString &name = wxStaticTextNameStr );
};
#endif // _WX_MSW_STATLINE_H_
#endif // _WX_OS2_STATLINE_H_

View File

@@ -1,48 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
// Name: statusbr.h
// Purpose: native implementation of wxStatusBar. Optional; can use generic
// version instead.
// Author: David Webster
// Modified by:
// Created: 10/17/99
// RCS-ID: $Id$
// Copyright: (c) David Webster
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATBAR_H_
#define _WX_STATBAR_H_
class WXDLLEXPORT wxStatusBarPM : public wxStatusBar
{
DECLARE_DYNAMIC_CLASS(wxStatusBarPM);
public:
// ctors
wxStatusBarPM();
wxStatusBarPM(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP);
// create status line
bool Create(wxWindow *parent, wxWindowID id = -1, long style = wxST_SIZEGRIP);
// a status line can have several (<256) fields numbered from 0
virtual void SetFieldsCount(int number = 1, const int widths[] = NULL);
// each field of status line has its own text
virtual void SetStatusText(const wxString& text, int number = 0);
virtual wxString GetStatusText(int number = 0) const;
// set status line fields' widths
virtual void SetStatusWidths(int n, const int widths_field[]);
void OnSize(wxSizeEvent& event);
DECLARE_EVENT_TABLE()
protected:
void CopyFieldsWidth(const int widths[]);
void SetFieldsWidth();
};
#endif // _WX_STATBAR_H_

View File

@@ -1,497 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: treectrl.h
// Purpose: wxTreeCtrl class
// Author: David Webster
// Modified by:
// Created: 10/17/99
// RCS-ID: $Id$
// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TREECTRL_H_
#define _WX_TREECTRL_H_
#include "wx/textctrl.h"
#include "wx/dynarray.h"
// the type for "untyped" data
typedef long wxDataType;
// fwd decl
class WXDLLEXPORT wxImageList;
struct WXDLLEXPORT wxTreeViewItem;
// a callback function used for sorting tree items, it should return -1 if the
// first item precedes the second, +1 if the second precedes the first or 0 if
// they're equivalent
class wxTreeItemData;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine
// where exactly the specified point is situated:
// above the client area.
static const int wxTREE_HITTEST_ABOVE = 0x0001;
// below the client area.
static const int wxTREE_HITTEST_BELOW = 0x0002;
// in the client area but below the last item.
static const int wxTREE_HITTEST_NOWHERE = 0x0004;
// on the button associated with an item.
static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0010;
// on the bitmap associated with an item.
static const int wxTREE_HITTEST_ONITEMICON = 0x0020;
// in the indentation associated with an item.
static const int wxTREE_HITTEST_ONITEMINDENT = 0x0040;
// on the label (string) associated with an item.
static const int wxTREE_HITTEST_ONITEMLABEL = 0x0080;
// in the area to the right of an item.
static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0100;
// on the state icon for a tree view item that is in a user-defined state.
static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0200;
// to the right of the client area.
static const int wxTREE_HITTEST_TOLEFT = 0x0400;
// to the left of the client area.
static const int wxTREE_HITTEST_TORIGHT = 0x0800;
// anywhere on the item
static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON |
wxTREE_HITTEST_ONITEMLABEL |
wxTREE_HITTEST_ONITEMSTATEICON;
// NB: all the following flags are for compatbility only and will be removed in the
// next versions
// flags for deprecated `Expand(int action)'
enum
{
wxTREE_EXPAND_EXPAND,
wxTREE_EXPAND_COLLAPSE,
wxTREE_EXPAND_COLLAPSE_RESET,
wxTREE_EXPAND_TOGGLE
};
// flags for deprecated InsertItem() variant
#define wxTREE_INSERT_FIRST 0xFFFF0001
#define wxTREE_INSERT_LAST 0xFFFF0002
// ----------------------------------------------------------------------------
// wxTreeItemId identifies an element of the tree. In this implementation, it's
// just a trivial wrapper around Win32 HTREEITEM. It's opaque for the
// application.
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxTreeItemId
{
public:
// ctors
// 0 is invalid value for HTREEITEM
wxTreeItemId() { m_itemId = 0; }
// default copy ctor/assignment operator are ok for us
// accessors
// is this a valid tree item?
bool IsOk() const { return m_itemId != 0; }
// conversion to/from either real (system-dependent) tree item id or
// to "long" which used to be the type for tree item ids in previous
// versions of wxWindows
// for wxTreeCtrl usage only
wxTreeItemId(WXHTREEITEM itemId) { m_itemId = (long)itemId; }
operator WXHTREEITEM() const { return (WXHTREEITEM)m_itemId; }
void operator=(WXHTREEITEM item) { m_itemId = (long) item; }
protected:
long m_itemId;
};
WX_DEFINE_EXPORTED_ARRAY(wxTreeItemId, wxArrayTreeItemIds);
// ----------------------------------------------------------------------------
// wxTreeItemData is some (arbitrary) user class associated with some item. The
// main advantage of having this class (compared to old untyped interface) is
// that wxTreeItemData's are destroyed automatically by the tree and, as this
// class has virtual dtor, it means that the memory will be automatically
// freed. OTOH, we don't just use wxObject instead of wxTreeItemData because
// the size of this class is critical: in any real application, each tree leaf
// will have wxTreeItemData associated with it and number of leaves may be
// quite big.
//
// Because the objects of this class are deleted by the tree, they should
// always be allocated on the heap!
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxTreeItemData : private wxTreeItemId
{
public:
// default ctor/copy ctor/assignment operator are ok
// dtor is virtual and all the items are deleted by the tree control when
// it's deleted, so you normally don't have to care about freeing memory
// allocated in your wxTreeItemData-derived class
virtual ~wxTreeItemData() { }
// accessors: set/get the item associated with this node
void SetId(const wxTreeItemId& id) { m_itemId = id; }
const wxTreeItemId GetId() const { return *this; }
};
// ----------------------------------------------------------------------------
// wxTreeCtrl
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxTreeCtrl : public wxControl
{
public:
// creation
// --------
wxTreeCtrl() { Init(); }
wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "wxTreeCtrl")
{
Create(parent, id, pos, size, style, validator, name);
}
virtual ~wxTreeCtrl();
bool Create(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "wxTreeCtrl");
// accessors
// ---------
// get the total number of items in the control
size_t GetCount() const;
// indent is the number of pixels the children are indented relative to
// the parents position. SetIndent() also redraws the control
// immediately.
unsigned int GetIndent() const;
void SetIndent(unsigned int indent);
// spacing is the number of pixels between the start and the Text
// not implemented under wxMSW
unsigned int GetSpacing() const { return 18; } // return wxGTK default
void SetSpacing(unsigned int WXUNUSED(spacing)) { }
// image list: these functions allow to associate an image list with
// the control and retrieve it. Note that the control does _not_ delete
// the associated image list when it's deleted in order to allow image
// lists to be shared between different controls.
//
// The normal image list is for the icons which correspond to the
// normal tree item state (whether it is selected or not).
// Additionally, the application might choose to show a state icon
// which corresponds to an app-defined item state (for example,
// checked/unchecked) which are taken from the state image list.
wxImageList *GetImageList() const;
wxImageList *GetStateImageList() const;
void SetImageList(wxImageList *imageList);
void SetStateImageList(wxImageList *imageList);
// Functions to work with tree ctrl items. Unfortunately, they can _not_ be
// member functions of wxTreeItem because they must know the tree the item
// belongs to for Windows implementation and storing the pointer to
// wxTreeCtrl in each wxTreeItem is just too much waste.
// accessors
// ---------
// retrieve items label
wxString GetItemText(const wxTreeItemId& item) const;
// get one of the images associated with the item (normal by default)
int GetItemImage(const wxTreeItemId& item,
wxTreeItemIcon which = wxTreeItemIcon_Normal) const;
// get the data associated with the item
wxTreeItemData *GetItemData(const wxTreeItemId& item) const;
// modifiers
// ---------
// set items label
void SetItemText(const wxTreeItemId& item, const wxString& text);
// get one of the images associated with the item (normal by default)
void SetItemImage(const wxTreeItemId& item, int image,
wxTreeItemIcon which = wxTreeItemIcon_Normal);
// associate some data with the item
void SetItemData(const wxTreeItemId& item, wxTreeItemData *data);
// force appearance of [+] button near the item. This is useful to
// allow the user to expand the items which don't have any children now
// - but instead add them only when needed, thus minimizing memory
// usage and loading time.
void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE);
// the item will be shown in bold
void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
// the item will be shown with a drop highlight
void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = TRUE);
// item status inquiries
// ---------------------
// is the item visible (it might be outside the view or not expanded)?
bool IsVisible(const wxTreeItemId& item) const;
// does the item has any children?
bool ItemHasChildren(const wxTreeItemId& item) const;
// is the item expanded (only makes sense if HasChildren())?
bool IsExpanded(const wxTreeItemId& item) const;
// is this item currently selected (the same as has focus)?
bool IsSelected(const wxTreeItemId& item) const;
// is item text in bold font?
bool IsBold(const wxTreeItemId& item) const;
// number of children
// ------------------
// if 'recursively' is FALSE, only immediate children count, otherwise
// the returned number is the number of all items in this branch
size_t GetChildrenCount(const wxTreeItemId& item,
bool recursively = TRUE) const;
// navigation
// ----------
// wxTreeItemId.IsOk() will return FALSE if there is no such item
// get the root tree item
wxTreeItemId GetRootItem() const;
// get the item currently selected (may return NULL if no selection)
wxTreeItemId GetSelection() const;
// get the items currently selected, return the number of such item
//
// NB: this operation is expensive and can take a long time for a
// control with a lot of items (~ O(number of items)).
size_t GetSelections(wxArrayTreeItemIds& selections) const;
// get the parent of this item (may return NULL if root)
wxTreeItemId GetParent(const wxTreeItemId& item) const;
// for this enumeration function you must pass in a "cookie" parameter
// which is opaque for the application but is necessary for the library
// to make these functions reentrant (i.e. allow more than one
// enumeration on one and the same object simultaneously). Of course,
// the "cookie" passed to GetFirstChild() and GetNextChild() should be
// the same!
// get the first child of this item
wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& _cookie) const;
// get the next child
wxTreeItemId GetNextChild(const wxTreeItemId& item, long& _cookie) const;
// get the last child of this item - this method doesn't use cookies
wxTreeItemId GetLastChild(const wxTreeItemId& item) const;
// get the next sibling of this item
wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
// get the previous sibling
wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
// get first visible item
wxTreeItemId GetFirstVisibleItem() const;
// get the next visible item: item must be visible itself!
// see IsVisible() and wxTreeCtrl::GetFirstVisibleItem()
wxTreeItemId GetNextVisible(const wxTreeItemId& item) const;
// get the previous visible item: item must be visible itself!
wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
// operations
// ----------
// add the root node to the tree
wxTreeItemId AddRoot(const wxString& text,
int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL);
// insert a new item in as the first child of the parent
wxTreeItemId PrependItem(const wxTreeItemId& parent,
const wxString& text,
int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL);
// insert a new item after a given one
wxTreeItemId InsertItem(const wxTreeItemId& parent,
const wxTreeItemId& idPrevious,
const wxString& text,
int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL);
// insert a new item in as the last child of the parent
wxTreeItemId AppendItem(const wxTreeItemId& parent,
const wxString& text,
int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL);
// delete this item and associated data if any
void Delete(const wxTreeItemId& item);
// delete all children (but don't delete the item itself)
// NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
void DeleteChildren(const wxTreeItemId& item);
// delete all items from the tree
// NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
void DeleteAllItems();
// expand this item
void Expand(const wxTreeItemId& item);
// collapse the item without removing its children
void Collapse(const wxTreeItemId& item);
// collapse the item and remove all children
void CollapseAndReset(const wxTreeItemId& item);
// toggles the current state
void Toggle(const wxTreeItemId& item);
// remove the selection from currently selected item (if any)
void Unselect();
// unselect all items (only makes sense for multiple selection control)
void UnselectAll();
// select this item
void SelectItem(const wxTreeItemId& item);
// make sure this item is visible (expanding the parent item and/or
// scrolling to this item if necessary)
void EnsureVisible(const wxTreeItemId& item);
// scroll to this item (but don't expand its parent)
void ScrollTo(const wxTreeItemId& item);
// start editing the item label: this (temporarily) replaces the item
// with a one line edit control. The item will be selected if it hadn't
// been before. textCtrlClass parameter allows you to create an edit
// control of arbitrary user-defined class deriving from wxTextCtrl.
wxTextCtrl* EditLabel(const wxTreeItemId& item,
wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl));
// returns the same pointer as StartEdit() if the item is being edited,
// NULL otherwise (it's assumed that no more than one item may be
// edited simultaneously)
wxTextCtrl* GetEditControl() const;
// end editing and accept or discard the changes to item label
void EndEditLabel(const wxTreeItemId& item, bool discardChanges = FALSE);
// sorting
// this function is called to compare 2 items and should return -1, 0
// or +1 if the first item is less than, equal to or greater than the
// second one. The base class version performs alphabetic comparaison
// of item labels (GetText)
virtual int OnCompareItems(const wxTreeItemId& item1,
const wxTreeItemId& item2);
// sort the children of this item using OnCompareItems
//
// NB: this function is not reentrant and not MT-safe (FIXME)!
void SortChildren(const wxTreeItemId& item);
// helpers
// -------
// determine to which item (if any) belongs the given point (the
// coordinates specified are relative to the client area of tree ctrl)
// and fill the flags parameter with a bitmask of wxTREE_HITTEST_xxx
// constants.
//
// The first function is more portable (because easier to implement
// on other platforms), but the second one returns some extra info.
wxTreeItemId HitTest(const wxPoint& point)
{ int dummy; return HitTest(point, dummy); }
wxTreeItemId HitTest(const wxPoint& point, int& flags);
// get the bounding rectangle of the item (or of its label only)
bool GetBoundingRect(const wxTreeItemId& item,
wxRect& rect,
bool textOnly = FALSE) const;
// deprecated
// ----------
// these methods are deprecated and will be removed in future versions of
// wxWindows, they're here for compatibility only, don't use them in new
// code (the comments indicate why these methods are now useless and how to
// replace them)
// use Expand, Collapse, CollapseAndReset or Toggle
void ExpandItem(const wxTreeItemId& item, int action);
// use AddRoot, PrependItem or AppendItem
wxTreeItemId InsertItem(const wxTreeItemId& parent,
const wxString& text,
int image = -1, int selImage = -1,
long insertAfter = wxTREE_INSERT_LAST);
// use Set/GetImageList and Set/GetStateImageList
wxImageList *GetImageList(int) const
{ return GetImageList(); }
void SetImageList(wxImageList *imageList, int)
{ SetImageList(imageList); }
// use Set/GetItemImage directly
// get the selected item image
int GetItemSelectedImage(const wxTreeItemId& item) const
{ return GetItemImage(item, wxTreeItemIcon_Selected); }
// set the selected item image
void SetItemSelectedImage(const wxTreeItemId& item, int image)
{ SetItemImage(item, image, wxTreeItemIcon_Selected); }
// implementation
// --------------
virtual bool OS2Command(WXUINT param, WXWORD id);
virtual bool OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
// get/set the check state for the item (only for wxTR_MULTIPLE)
bool IsItemChecked(const wxTreeItemId& item) const;
void SetItemCheck(const wxTreeItemId& item, bool check = TRUE);
protected:
// SetImageList helper
void SetAnyImageList(wxImageList *imageList, int which);
wxTextCtrl *m_textCtrl; // used while editing the item label
wxImageList *m_imageListNormal, // images for tree elements
*m_imageListState; // special images for app defined states
private:
// the common part of all ctors
void Init();
// helper functions
inline bool DoGetItem(wxTreeViewItem *tvItem) const;
inline void DoSetItem(wxTreeViewItem *tvItem);
inline void DoExpand(const wxTreeItemId& item, int flag);
wxTreeItemId DoInsertItem(const wxTreeItemId& parent,
wxTreeItemId hInsertAfter,
const wxString& text,
int image, int selectedImage,
wxTreeItemData *data);
int DoGetItemImageFromData(const wxTreeItemId& item,
wxTreeItemIcon which) const;
void DoSetItemImageFromData(const wxTreeItemId& item,
int image,
wxTreeItemIcon which) const;
void DoSetItemImages(const wxTreeItemId& item, int image, int imageSel);
void DeleteTextCtrl();
// support for additional item images
friend class wxTreeItemIndirectData;
void SetIndirectItemData(const wxTreeItemId& item,
wxTreeItemIndirectData *data);
bool HasIndirectData(const wxTreeItemId& item) const;
wxArrayTreeItemIds m_itemsWithIndirectData;
DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
};
#endif
// _WX_TREECTRL_H_

View File

@@ -89,7 +89,7 @@ public:
wxWindow* m_propertyWindow; // Panel that the controls will appear on
wxWindow* m_managedWindow; // Frame or dialog
wxButton* m_windowCloseButton; // Or OK
wxButton* m_windowCancelButton;
wxButton* m_windowHelpButton;
@@ -97,7 +97,7 @@ public:
DECLARE_EVENT_TABLE()
};
/*
* The type of validator used for forms (wxForm style but using an existing panel
* or dialog box).
@@ -120,10 +120,10 @@ class WXDLLEXPORT wxPropertyFormValidator: public wxPropertyValidator
public:
wxPropertyFormValidator(long flags = 0): wxPropertyValidator(flags) { }
~wxPropertyFormValidator(void) {}
// Called to check value is OK (e.g. when OK is pressed)
// Return FALSE if value didn't check out; signal to restore old value.
virtual bool OnCheckValue( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
virtual bool OnCheckValue( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { return TRUE; }
// Does the transferance from the property editing area to the property itself.
@@ -133,20 +133,27 @@ class WXDLLEXPORT wxPropertyFormValidator: public wxPropertyValidator
// Called by the view to transfer the property to the window.
virtual bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0;
virtual void OnDoubleClick( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { }
virtual void OnSetFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
virtual void OnDoubleClick( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { }
virtual void OnKillFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
virtual void OnSetFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { }
virtual void OnCommand( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
virtual void OnKillFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { }
virtual void OnCommand( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow), wxCommandEvent& WXUNUSED(event) ) {}
private:
// Virtual function hiding suppression
#if WXWIN_COMPATIBILITY_2
virtual void OnCommand(wxWindow& win,
wxCommandEvent& event)
{ wxEvtHandler::OnCommand(win, event); }
#endif
};
/*
* Some default validators
*/
class WXDLLEXPORT wxRealFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxRealFormValidator)
@@ -226,7 +233,7 @@ class WXDLLEXPORT wxStringFormValidator: public wxPropertyFormValidator
/*
* A default dialog box class to use.
*/
class WXDLLEXPORT wxPropertyFormDialog: public wxDialog
{
DECLARE_CLASS(wxPropertyFormDialog)
@@ -251,7 +258,7 @@ DECLARE_EVENT_TABLE()
/*
* A default panel class to use.
*/
class WXDLLEXPORT wxPropertyFormPanel: public wxPanel
{
DECLARE_CLASS(wxPropertyFormPanel)
@@ -275,7 +282,7 @@ class WXDLLEXPORT wxPropertyFormPanel: public wxPanel
/*
* A default frame class to use.
*/
class WXDLLEXPORT wxPropertyFormFrame: public wxFrame
{
DECLARE_CLASS(wxPropertyFormFrame)

View File

@@ -48,7 +48,7 @@ enum wxTreeItemIcon
#elif defined(__WXMAC__)
#include "wx/generic/treectrl.h"
#elif defined(__WXPM__)
#include "wx/os2/treectrl.h"
#include "wx/generic/treectrl.h"
#elif defined(__WXSTUBS__)
#include "wx/generic/treectrl.h"
#endif

View File

@@ -190,13 +190,12 @@ void* wxChoice::DoGetItemClientData( int n ) const
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
{
DoSetClientData(n, clientData);
DoSetItemClientData(n, clientData);
}
wxClientData* wxChoice::DoGetItemClientObject( int n ) const
{
// TODO: return (wxClientData *)DoGetClientData(n);
return NULL;
return (wxClientData *)DoGetItemClientData(n);
}
// ----------------------------------------------------------------------------

View File

@@ -31,6 +31,8 @@
#include "wx/log.h"
#include "wx/dataobj.h"
#include "wx/mstream.h"
#include "wx/image.h"
#define INCL_DOS
#include <os2.h>
@@ -47,11 +49,8 @@
// wxDataFormat
// ----------------------------------------------------------------------------
wxDataFormat::wxDataFormat(
wxDataFormatId vType
)
wxDataFormat::wxDataFormat()
{
PrepareFormats();
m_vType = wxDF_INVALID;
m_vFormat = 0;
}
@@ -184,7 +183,7 @@ bool wxDataObject::IsSupportedFormat(
else
{
wxDataFormat* pFormats = new wxDataFormat[nFormatCount];
GetAllFormats( rFormats
GetAllFormats( pFormats
,vDir
);
@@ -192,11 +191,11 @@ bool wxDataObject::IsSupportedFormat(
for (n = 0; n < nFormatCount; n++)
{
if (rFormats[n] == rFormat)
if (pFormats[n] == rFormat)
break;
}
delete [] rFormats;
delete [] pFormats;
// found?
return n < nFormatCount;
@@ -215,11 +214,11 @@ bool wxFileDataObject::GetDataHere(
for (size_t i = 0; i < m_filenames.GetCount(); i++)
{
filenames += m_filenames[i];
filenames += (wxChar)0;
sFilenames += m_filenames[i];
sFilenames += (wxChar)0;
}
memcpy(pBuf, filenames.mbc_str(), filenames.Len() + 1);
memcpy(pBuf, sFilenames.mbc_str(), sFilenames.Len() + 1);
return TRUE;
}
@@ -336,12 +335,13 @@ void wxBitmapDataObject::DoConvertToPng()
wxPNGHandler vHandler;
wxCountingOutputStream vCount;
vHandler.SaveFile(&rImage, vCount);
vHandler.SaveFile(&vImage, vCount);
m_pngSize = vCount.GetSize() + 100; // sometimes the size seems to vary ???
m_pngData = malloc(m_pngSize);
wxMemoryOutputStream mstream((char*) m_pngData, m_pngSize);
wxMemoryOutputStream vMstream((char*) m_pngData, m_pngSize);
vHandler.SaveFile(&vImage, vMstream );
}

View File

@@ -13,10 +13,12 @@
#pragma implementation "dnd.h"
#endif
#include "wx/dnd.h"
#define INCL_PM
#include <os2.h>
#include "wx/window.h"
#include "wx/app.h"
#include "wx/gdicmn.h"
#include "wx/dnd.h"
// ----------------------------------------------------------------------------
// global

View File

@@ -683,7 +683,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
return pt;
}
void wxFrame::ScreenToClient(int *x, int *y) const
void wxFrame::DoScreenToClient(int *x, int *y) const
{
wxWindow::ScreenToClient(x, y);
@@ -695,7 +695,7 @@ void wxFrame::ScreenToClient(int *x, int *y) const
*y -= pt.y;
}
void wxFrame::ClientToScreen(int *x, int *y) const
void wxFrame::DoClientToScreen(int *x, int *y) const
{
// We may be faking the client origin.
// So a window that's really at (0, 30) may appear
@@ -704,7 +704,7 @@ void wxFrame::ClientToScreen(int *x, int *y) const
*x += pt1.x;
*y += pt1.y;
wxWindow::ClientToScreen(x, y);
wxWindow::DoClientToScreen(x, y);
}
#if wxUSE_TOOLBAR

View File

@@ -46,7 +46,7 @@
#define ZYZGS_3D 0x8000L /* control will be 3D */
/* public function prototypes */
BOOL _Optlink gaugeInit(HINSTANCE hInstance);
// BOOL _Optlink gaugeInit(HINSTANCE hInstance);
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
@@ -64,8 +64,11 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
if ( !wxGaugeOS2Initialised )
{
//TODO:
/*
if (!gaugeInit((HINSTANCE) wxGetInstance()))
wxFatalError("Cannot initalize Gauge library");
*/
wxGaugeOS2Initialised = TRUE;
}

View File

@@ -1,192 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: imaglist.cpp
// Purpose: wxImageList. You may wish to use the generic version.
// Author: David Webster
// Modified by:
// Created: 10/09/99
// RCS-ID: $Id$
// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include <stdio.h>
#include "wx/setup.h"
#include "wx/window.h"
#include "wx/icon.h"
#include "wx/dc.h"
#include "wx/string.h"
#endif
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/os2/imaglist.h"
#include "wx/os2/private.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject)
#endif
wxImageList::wxImageList()
{
m_hImageList = 0;
}
wxImageList::~wxImageList()
{
if ( m_hImageList )
return;
// TODO: ImageList_Destroy((HIMAGELIST) m_hImageList);
m_hImageList = 0;
}
// Attributes
////////////////////////////////////////////////////////////////////////////
// Returns the number of images in the image list.
int wxImageList::GetImageCount() const
{
// TODO:: return ImageList_GetImageCount((HIMAGELIST) m_hImageList);
return 0;
}
// Operations
////////////////////////////////////////////////////////////////////////////
// Creates an image list
bool wxImageList::Create(int width, int height, bool mask, int initial)
{
UINT flags = 0;
// if ( mask )
// TODO flags |= ILC_MASK;
// Grow by 1, I guess this is reasonable behaviour most of the time
// m_hImageList = (WXHIMAGELIST) ImageList_Create(width, height, flags, initial, 1);
return (m_hImageList != 0);
}
// Adds a bitmap, and optionally a mask bitmap.
// Note that wxImageList creates new bitmaps, so you may delete
// 'bitmap' and 'mask'.
int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask)
{
HBITMAP hBitmap1 = (HBITMAP) bitmap.GetHBITMAP();
HBITMAP hBitmap2 = 0;
if ( mask.Ok() )
hBitmap2 = (HBITMAP) mask.GetHBITMAP();
int index; // = ImageList_Add((HIMAGELIST) GetHIMAGELIST(), hBitmap1, hBitmap2);
if ( index == -1 )
{
wxLogError(wxT("Couldn't add an image to the image list."));
}
return index;
}
// Adds a bitmap, using the specified colour to create the mask bitmap
// Note that wxImageList creates new bitmaps, so you may delete
// 'bitmap'.
int wxImageList::Add(const wxBitmap& bitmap, const wxColour& maskColour)
{
HBITMAP hBitmap1 = (HBITMAP) bitmap.GetHBITMAP();
//TODO:
// COLORREF colorRef = PALETTERGB(maskColour.Red(), maskColour.Green(), maskColour.Blue());
// return ImageList_AddMasked((HIMAGELIST) GetHIMAGELIST(), hBitmap1, colorRef);
return 0;
}
// Adds a bitmap and mask from an icon.
int wxImageList::Add(const wxIcon& icon)
{
HICON hIcon = (HICON) icon.GetHICON();
// TODO: return ImageList_AddIcon((HIMAGELIST) GetHIMAGELIST(), hIcon);
return 0;
}
// Replaces a bitmap, optionally passing a mask bitmap.
// Note that wxImageList creates new bitmaps, so you may delete
// 'bitmap' and 'mask'.
bool wxImageList::Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask)
{
HBITMAP hBitmap1 = (HBITMAP) bitmap.GetHBITMAP();
HBITMAP hBitmap2 = 0;
if ( mask.Ok() )
hBitmap2 = (HBITMAP) mask.GetHBITMAP();
// TODO: return (ImageList_Replace((HIMAGELIST) GetHIMAGELIST(), index, hBitmap1, hBitmap2) != 0);
return TRUE;
}
// Replaces a bitmap and mask from an icon.
bool wxImageList::Replace(int index, const wxIcon& icon)
{
HICON hIcon = (HICON) icon.GetHICON();
// TODO: return (ImageList_ReplaceIcon((HIMAGELIST) GetHIMAGELIST(), index, hIcon) != 0);
return FALSE;
}
// Removes the image at the given index.
bool wxImageList::Remove(int index)
{
// TODO return (ImageList_Remove((HIMAGELIST) GetHIMAGELIST(), index) != 0);
return FALSE;
}
bool wxImageList::RemoveAll(void)
{
// TODO: Is this correct?
while ( GetImageCount() > 0 )
{
Remove(0);
}
return TRUE;
}
// Draws the given image on a dc at the specified position.
// If 'solidBackground' is TRUE, Draw sets the image list background
// colour to the background colour of the wxDC, to speed up
// drawing by eliminating masked drawing where possible.
bool wxImageList::Draw(int index, wxDC& dc, int x, int y,
int flags, bool solidBackground)
{
HDC hDC = (HDC) dc.GetHDC();
if ( !hDC )
return FALSE;
if ( solidBackground )
{
wxBrush *brush = & dc.GetBackground();
if ( brush && brush->Ok())
{
wxColour col(brush->GetColour());
// ImageList_SetBkColor((HIMAGELIST) GetHIMAGELIST(),
// PALETTERGB(col.Red(), col.Green(), col.Blue()));
}
// else
// ImageList_SetBkColor((HIMAGELIST) GetHIMAGELIST(),
// CLR_NONE);
}
// else
// ImageList_SetBkColor((HIMAGELIST) GetHIMAGELIST(),
// CLR_NONE);
UINT style = 0;
/*
if ( flags & wxIMAGELIST_DRAW_NORMAL )
style |= ILD_NORMAL;
if ( flags & wxIMAGELIST_DRAW_TRANSPARENT )
style |= ILD_TRANSPARENT;
if ( flags & wxIMAGELIST_DRAW_SELECTED )
style |= ILD_SELECTED;
if ( flags & wxIMAGELIST_DRAW_FOCUSED )
style |= ILD_FOCUS;
return (ImageList_Draw((HIMAGELIST) GetHIMAGELIST(), index, hDC,
x, y, style) != 0);
*/
return TRUE;
}

View File

@@ -701,7 +701,7 @@ WXHBRUSH wxListBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
backgroundBrush->RealizeResource();
return (WXHBRUSH) backgroundBrush->GetResourceHandle();
*/
reutrn (WXBRUSH)0;
return (WXHBRUSH)0;
}
// ----------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@@ -24,6 +24,7 @@ DUMMYOBJ=$D\dummydll.obj
LIBTARGET=$(WXLIB)
COMTEMPTGT1=$(WXDIR)\lib\wxcom1.lib
COMTEMPTGT2=$(WXDIR)\lib\wxcom2.lib
COMTEMPTGT3=$(WXDIR)\lib\wxcom3.lib
GENTEMPTGT=$(WXDIR)\lib\wxgen.lib
NONESTEMPTGT=$(WXDIR)\lib\wxnones.lib
OS2TEMPTGT1=$(WXDIR)\lib\wxos21.lib
@@ -81,11 +82,25 @@ $(CPPFLAGS) /Fo$@ /Tp $<
<<
GENERICOBJS= \
..\generic\$D\busyinfo.obj \
..\generic\$D\caret.obj \
..\generic\$D\choicdgg.obj \
..\generic\$D\colrdlgg.obj \
..\generic\$D\dcpsg.obj \
..\generic\$D\grid.obj \
..\generic\$D\gridg.obj \
..\generic\$D\helpext.obj \
..\generic\$D\helphtml.obj \
..\generic\$D\helpwxht.obj \
..\generic\$D\helpxlp.obj \
..\generic\$D\imaglist.obj \
..\generic\$D\laywin.obj \
..\generic\$D\listctrl.obj \
..\generic\$D\logg.obj \
..\generic\$D\numdlgg.obj \
..\generic\$D\panelg.obj \
..\generic\$D\printps.obj \
..\generic\$D\prntdlgg.obj \
..\generic\$D\progdlgg.obj \
..\generic\$D\prop.obj \
..\generic\$D\propform.obj \
@@ -96,20 +111,31 @@ GENERICOBJS= \
..\generic\$D\statusbr.obj \
..\generic\$D\tabg.obj \
..\generic\$D\textdlgg.obj \
..\generic\$D\tipdlg.obj \
..\generic\$D\busyinfo.obj
..\generic\$D\treectrl.obj \
..\generic\$D\tipdlg.obj
# ..\generic\$D\imaglist.obj \
# ..\generic\$D\treectrl.obj \
# ..\generic\$D\listctrl.obj \
# ..\generic\$D\notebook.obj \
GENLIBOBJS= \
busyinfo.obj \
caret.obj \
choicdgg.obj \
colrdlgg.obj \
dcpsg.obj \
grid.obj \
gridg.obj \
helpext.obj \
helphtml.obj \
helpwxht.obj \
helpxlp.obj \
imaglist.obj \
laywin.obj \
listctrl.obj \
logg.obj \
numdlgg.obj \
panelg.obj \
printps.obj \
prntdlgg.obj \
progdlgg.obj \
prop.obj \
propform.obj \
@@ -120,17 +146,13 @@ GENLIBOBJS= \
statusbr.obj \
tabg.obj \
textdlgg.obj \
tipdlg.obj \
busyinfo.obj
treectrl.obj \
tipdlg.obj
# These are generic things that don't need to be compiled on PM,
# but sometimes it's useful to do so for testing purposes.
NONESSENTIALOBJS= \
..\generic\$D\printps.obj \
..\generic\$D\prntdlgg.obj \
..\generic\$D\msgdlgg.obj \
..\generic\$D\helpxlp.obj \
..\generic\$D\colrdlgg.obj \
..\generic\$D\fontdlgg.obj
COMMONOBJS = \
@@ -274,14 +296,14 @@ COMLIBOBJS1 = \
imagpcx.obj \
imagpng.obj \
imagpnm.obj \
intl.obj \
intl.obj
COMLIBOBJS2 = \
ipcbase.obj \
layout.obj \
lboxcmn.obj \
list.obj \
log.obj
COMLIBOBJS2 = \
log.obj \
longlong.obj \
matrix.obj \
memory.obj \
@@ -319,7 +341,9 @@ COMLIBOBJS2 = \
utilscmn.obj \
valgen.obj \
validate.obj \
valtext.obj \
valtext.obj
COMLIBOBJS3 = \
variant.obj \
wfstream.obj \
wincmn.obj \
@@ -363,11 +387,9 @@ OS2OBJS = \
..\os2\$D\gsocket.obj \
..\os2\$D\helpwin.obj \
..\os2\$D\icon.obj \
..\os2\$D\imaglist.obj \
..\os2\$D\iniconf.obj \
..\os2\$D\joystick.obj \
..\os2\$D\listbox.obj \
..\os2\$D\listctrl.obj \
..\os2\$D\main.obj \
..\os2\$D\mdi.obj \
..\os2\$D\menu.obj \
@@ -392,8 +414,8 @@ OS2OBJS = \
..\os2\$D\spinctrl.obj \
..\os2\$D\statbmp.obj \
..\os2\$D\statbox.obj \
..\os2\$D\statline.obj \
..\os2\$D\stattext.obj \
..\os2\$D\statbrpm.obj \
..\os2\$D\tabctrl.obj \
..\os2\$D\taskbar.obj \
..\os2\$D\textctrl.obj \
@@ -401,7 +423,6 @@ OS2OBJS = \
..\os2\$D\timer.obj \
..\os2\$D\toolbar.obj \
..\os2\$D\tooltip.obj \
..\os2\$D\treectrl.obj \
..\os2\$D\utils.obj \
..\os2\$D\utilsexc.obj \
..\os2\$D\wave.obj \
@@ -473,6 +494,7 @@ OS2LIBOBJS2 = \
statbmp.obj \
statbox.obj \
stattext.obj \
statline.obj \
statbrpm.obj \
tabctrl.obj \
taskbar.obj \
@@ -540,7 +562,7 @@ $(COMLIBOBJS1):
copy ..\common\$D\cmndata.obj
copy ..\common\$D\config.obj
copy ..\common\$D\ctrlcmn.obj
copy ..\common\$D\ctrlsub.obj
copy ..\common\$D\ctrlsub.obj
copy ..\common\$D\date.obj
copy ..\common\$D\datstrm.obj
copy ..\common\$D\db.obj
@@ -578,66 +600,82 @@ $(COMLIBOBJS1):
copy ..\common\$D\imagpng.obj
copy ..\common\$D\imagpnm.obj
copy ..\common\$D\intl.obj
$(COMLIBOBJS2):
copy ..\common\$D\ipcbase.obj
copy ..\common\$D\layout.obj
copy ..\common\$D\lboxcmn.obj
copy ..\common\$D\list.obj
copy ..\common\$D\log.obj
copy ..\common\$D\longlong.obj
copy ..\common\$D\matrix.obj
copy ..\common\$D\memory.obj
copy ..\common\$D\mimetype.obj
copy ..\common\$D\module.obj
copy ..\common\$D\mstream.obj
copy ..\common\$D\object.obj
copy ..\common\$D\objstrm.obj
copy ..\common\$D\odbc.obj
copy ..\common\$D\paper.obj
copy ..\common\$D\prntbase.obj
copy ..\common\$D\process.obj
copy ..\common\$D\protocol.obj
copy ..\common\$D\resource.obj
copy ..\common\$D\sckaddr.obj
copy ..\common\$D\sckfile.obj
copy ..\common\$D\sckipc.obj
copy ..\common\$D\sckstrm.obj
copy ..\common\$D\serbase.obj
copy ..\common\$D\sizer.obj
copy ..\common\$D\socket.obj
copy ..\common\$D\strconv.obj
copy ..\common\$D\stream.obj
copy ..\common\$D\string.obj
copy ..\common\$D\tbarbase.obj
copy ..\common\$D\tbarsmpl.obj
copy ..\common\$D\textcmn.obj
copy ..\common\$D\textfile.obj
copy ..\common\$D\time.obj
copy ..\common\$D\timercmn.obj
copy ..\common\$D\tokenzr.obj
copy ..\common\$D\txtstrm.obj
copy ..\common\$D\unzip.obj
copy ..\common\$D\url.obj
copy ..\common\$D\utilscmn.obj
copy ..\common\$D\valgen.obj
copy ..\common\$D\validate.obj
copy ..\common\$D\valtext.obj
copy ..\common\$D\variant.obj
$(COMLIBOBJS2):
copy ..\common\$D\longlong.obj \
copy ..\common\$D\matrix.obj \
copy ..\common\$D\memory.obj \
copy ..\common\$D\mimetype.obj \
copy ..\common\$D\module.obj \
copy ..\common\$D\mstream.obj \
copy ..\common\$D\object.obj \
copy ..\common\$D\objstrm.obj \
copy ..\common\$D\odbc.obj \
copy ..\common\$D\paper.obj \
copy ..\common\$D\prntbase.obj \
copy ..\common\$D\process.obj \
copy ..\common\$D\protocol.obj \
copy ..\common\$D\resource.obj \
copy ..\common\$D\sckaddr.obj \
copy ..\common\$D\sckfile.obj \
copy ..\common\$D\sckipc.obj \
copy ..\common\$D\sckstrm.obj \
copy ..\common\$D\serbase.obj \
copy ..\common\$D\sizer.obj \
copy ..\common\$D\socket.obj \
copy ..\common\$D\strconv.obj \
copy ..\common\$D\stream.obj \
copy ..\common\$D\string.obj \
copy ..\common\$D\tbarbase.obj \
copy ..\common\$D\tbarsmpl.obj \
copy ..\common\$D\textcmn.obj \
copy ..\common\$D\textfile.obj \
copy ..\common\$D\time.obj \
copy ..\common\$D\timercmn.obj \
copy ..\common\$D\tokenzr.obj \
copy ..\common\$D\txtstrm.obj \
copy ..\common\$D\unzip.obj \
copy ..\common\$D\url.obj \
copy ..\common\$D\utilscmn.obj \
copy ..\common\$D\valgen.obj \
copy ..\common\$D\validate.obj \
copy ..\common\$D\valtext.obj \
copy ..\common\$D\variant.obj \
copy ..\common\$D\wfstream.obj \
copy ..\common\$D\wincmn.obj \
copy ..\common\$D\wxchar.obj \
copy ..\common\$D\wxexpr.obj \
copy ..\common\$D\y_tab.obj \
copy ..\common\$D\zipstrm.obj \
$(COMLIBOBJS3):
copy ..\common\$D\wfstream.obj
copy ..\common\$D\wincmn.obj
copy ..\common\$D\wxchar.obj
copy ..\common\$D\wxexpr.obj
copy ..\common\$D\y_tab.obj
copy ..\common\$D\zipstrm.obj
copy ..\common\$D\zstream.obj
$(GENLIBOBJS):
copy ..\generic\$D\busyinfo.obj
copy ..\generic\$D\caret.obj
copy ..\generic\$D\choicdgg.obj
copy ..\generic\$D\colrdlgg.obj
copy ..\generic\$D\dcpsg.obj
copy ..\generic\$D\grid.obj
copy ..\generic\$D\gridg.obj
copy ..\generic\$D\helpext.obj
copy ..\generic\$D\helphtml.obj
copy ..\generic\$D\helpwxht.obj
copy ..\generic\$D\helpxlp.obj
copy ..\generic\$D\imaglist.obj
copy ..\generic\$D\laywin.obj
copy ..\generic\$D\listctrl.obj
copy ..\generic\$D\logg.obj
copy ..\generic\$D\numdlgg.obj
copy ..\generic\$D\panelg.obj
copy ..\generic\$D\printps.obj
copy ..\generic\$D\prntdlgg.obj
copy ..\generic\$D\progdlgg.obj
copy ..\generic\$D\prop.obj
copy ..\generic\$D\propform.obj
@@ -648,8 +686,8 @@ $(GENLIBOBJS):
copy ..\generic\$D\statusbr.obj
copy ..\generic\$D\tabg.obj
copy ..\generic\$D\textdlgg.obj
copy ..\generic\$D\treectrl.obj
copy ..\generic\$D\tipdlg.obj
copy ..\generic\$D\busyinfo.obj
$(OS2LIBOBJS1):
copy ..\os2\$D\accel.obj
@@ -667,6 +705,7 @@ $(OS2LIBOBJS1):
copy ..\os2\$D\control.obj
copy ..\os2\$D\cursor.obj
copy ..\os2\$D\data.obj
copy ..\os2\$D\dataobj.obj
copy ..\os2\$D\dc.obj
copy ..\os2\$D\dcclient.obj
copy ..\os2\$D\dcmemory.obj
@@ -696,9 +735,9 @@ $(OS2LIBOBJS1):
copy ..\os2\$D\metafile.obj
copy ..\os2\$D\minifram.obj
copy ..\os2\$D\msgdlg.obj
copy ..\os2\$D\nativdlg.obj
$(OS2LIBOBJS2):
copy ..\os2\$D\nativdlg.obj
copy ..\os2\$D\notebook.obj
copy ..\os2\$D\ownerdrw.obj
copy ..\os2\$D\palette.obj
@@ -715,6 +754,7 @@ $(OS2LIBOBJS2):
copy ..\os2\$D\spinctrl.obj
copy ..\os2\$D\statbmp.obj
copy ..\os2\$D\statbox.obj
copy ..\os2\$D\statline.obj
copy ..\os2\$D\stattext.obj
copy ..\os2\$D\statbrpm.obj
copy ..\os2\$D\tabctrl.obj
@@ -779,6 +819,13 @@ $(WXDIR)\lib\wxcom2.lib: $(COMLIBOBJS2)
$**;
<<
$(WXDIR)\lib\wxcom3.lib: $(COMLIBOBJS3)
touch $(WXDIR)\lib\wxcom3.lib
del $(WXDIR)\lib\wxcom3.lib
ilib $(LIBFLAGS) $@ @<<
$**;
<<
$(WXDIR)\lib\wxgen.lib: $(GENLIBOBJS)
touch $(WXDIR)\lib\wxgen.lib
del $(WXDIR)\lib\wxgen.lib
@@ -812,6 +859,7 @@ $(WXDIR)\lib\wx.lib: \
$D\dummy.obj \
$(COMTEMPTGT1) \
$(COMTEMPTGT2) \
$(COMTEMPTGT3) \
$(GENTEMPTGT) \
$(NONESTEMPTGT) \
$(OS2TEMPTGT1) \
@@ -824,6 +872,7 @@ $(WXDIR)\lib\wx.lib: \
<<
del $(COMTEMPTGT1)
del $(COMTEMPTGT2)
del $(COMTEMPTGT3)
del $(GENTEMPTGT)
del $(NONESTEMPTGT)
del $(OS2TEMPTGT1)
@@ -847,11 +896,9 @@ $(WXDIR)\lib\wx200.dll: $(OBJECTS) $(WXDIR)\lib\wx210.lib
!endif
$D\dummy.obj: dummy.$(SRCSUFF) $(WXDIR)\include\wx\wx.h $(WXDIR)\include\wx\os2\setup.h
@echo $<
icc $(CPPFLAGS) $(MAKEPRECOMP) /Fo$D\dummy.obj /Tp dummy.cpp
$D\dummydll.obj: dummydll.$(SRCSUFF) $(WXDIR)\include\wx\wx.h $(WXDIR)\include\wx\os2\setup.h
@echo $<
icc @<<
$(CPPFLAGS) $(MAKEPRECOMP) /Fo$D\dummydll.obj /c /Tp dummydll.cpp
<<
@@ -862,13 +909,11 @@ $(WXDIR)\include\wx\os2\setup.h: $(WXDIR)\include\wx\os2\setup0.h
copy "$(WXDIR)"\include\wx\os2\setup0.h "$(WXDIR)"\include\wx\os2\setup.h
..\common\$D\extended.obj: ..\common\extended.c
@echo $<
icc @<<
$(CPPFLAGS2) /Fo$@ $(COMMDIR)\extended.c
<<
..\common\$D\y_tab.obj: ..\common\y_tab.c ..\common\lex_yy.c
@echo $<
icc @<<
$(CPPFLAGS2) /DUSE_DEFINE /DYY_USE_PROTOS /Fo$@ ..\common\y_tab.c
<<
@@ -882,7 +927,6 @@ $(CPPFLAGS2) /DUSE_DEFINE /DYY_USE_PROTOS /Fo$@ ..\common\y_tab.c
$(OBJECTS): $(WXDIR)/include/wx/setup.h
..\common\$D\unzip.obj: ..\common\unzip.c
@echo $<
icc @<<
$(CPPFLAGS2) /Fo$@ $(COMMDIR)\unzip.c
<<

View File

@@ -140,6 +140,11 @@ bool wxPen::FreeResource(bool force)
else return FALSE;
}
bool wxPen::IsFree() const
{
return (M_PENDATA && M_PENDATA->m_hPen == 0);
}
void wxPen::Unshare()
{
// Don't change shared data

File diff suppressed because it is too large Load Diff

View File

@@ -70,13 +70,13 @@ bool wxGetHostName(
unsigned long ulBuffer;
unsigned long* pulTotalAvail;
NetBios32GetInfo( (const unsigned char*)zServer
,(const unsigned char*)zComputer
,ulLevel
,zBuffer
,ulBuffer
,pulTotalAvail
);
NetBiosGetInfo( (const unsigned char*)zServer
,(const unsigned char*)zComputer
,ulLevel
,zBuffer
,ulBuffer
,pulTotalAvail
);
strcpy(zBuf, zServer);
#else
wxChar* zSysname;

View File

@@ -8,29 +8,29 @@
*
* Y2K compliance in libpng:
* =========================
*
*
* January 13, 1999
*
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
*
* This is your unofficial assurance that libpng from version 0.81 and
* upward are Y2K compliant. It is my belief that earlier versions were
* also Y2K compliant.
*
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
* that will hold years up to 65535. The other two hold the date in text
* format, and will hold years up to 9999.
*
*
* The integer is
* "png_uint_16 year" in png_time_struct.
*
*
* The strings are
* "png_charp time_buffer" in png_struct and
* "near_time_buffer", which is a local character string in png.c.
*
*
* There are seven time-related functions:
* png.c: png_convert_to_rfc_1123() in png.c
* png.c: png_convert_to_rfc_1123() in png.c
* (formerly png_convert_to_rfc_1152() in error)
* png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
* png_convert_from_time_t() in pngwrite.c
@@ -38,8 +38,8 @@
* png_handle_tIME() in pngrutil.c, called in pngread.c
* png_set_tIME() in pngset.c
* png_write_tIME() in pngwutil.c, called in pngwrite.c
*
* All handle dates properly in a Y2K environment. The
*
* All handle dates properly in a Y2K environment. The
* png_convert_from_time_t() function calls gmtime() to convert from system
* clock time, which returns (year - 1900), which we properly convert to
* the full 4-digit year. There is a possibility that applications using
@@ -49,17 +49,17 @@
* is not under our control. The libpng documentation has always stated
* that it works with 4-digit years, and the APIs have been documented as
* such.
*
*
* The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
* integer to hold the year, and can hold years as large as 65535.
*
*
*
*
* Glenn Randers-Pehrson
* libpng maintainer
* PNG Development Group
*
*
* Note about libpng version numbers:
*
*
* Due to various miscommunications, unforeseen code incompatibilities
* and occasional factors outside the authors' control, version numbering
* on the library has not always been consistent and straightforward.

View File

@@ -39,8 +39,13 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
read_data function and use it at run time with png_set_read_fn(), rather
than changing the library. */
#ifndef USE_FAR_KEYWORD
#ifdef __VISAGECPP__
static void _Optlink
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#else
static void
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#endif
{
png_size_t check;

View File

@@ -39,8 +39,13 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
write_data function and use it at run time with png_set_write_fn(), rather
than changing the library. */
#ifndef USE_FAR_KEYWORD
#ifdef __VISAGECPP__
static void _Optlink
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#else
static void
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#endif
{
png_uint_32 check;
@@ -59,8 +64,13 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b)
#ifdef __VISAGECPP__
static void _Optlink
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#else
static void
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#endif
{
png_uint_32 check;
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
@@ -114,8 +124,13 @@ png_flush(png_structp png_ptr)
}
#if !defined(PNG_NO_STDIO)
#ifdef __VISAGECPP__
static void _Optlink
png_default_flush(png_structp png_ptr)
#else
static void
png_default_flush(png_structp png_ptr)
#endif
{
FILE *io_ptr;
io_ptr = (FILE *)CVT_PTR((png_ptr->io_ptr));

View File

@@ -1,6 +1,6 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
@@ -18,10 +18,14 @@
#define DO16(buf) DO8(buf,0); DO8(buf,8);
/* ========================================================================= */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
uLong ZEXPORT adler32 (uLong adler, const Bytef* buf, uInt len)
#else
uLong ZEXPORT adler32(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
#endif
{
unsigned long s1 = adler & 0xffff;
unsigned long s2 = (adler >> 16) & 0xffff;

View File

@@ -1,6 +1,6 @@
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-1998 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
@@ -18,12 +18,16 @@
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT compress2 (Bytef* dest, uLongf* destLen, const Bytef* source, uLong sourceLen, int level)
#else
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
int level;
#endif
{
z_stream stream;
int err;
@@ -58,11 +62,15 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
/* ===========================================================================
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT compress (Bytef* dest, uLongf* destLen, const Bytef* source, uLong sourceLen)
#else
int ZEXPORT compress (dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
#endif
{
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}

View File

@@ -1,6 +1,6 @@
/* crc32.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
@@ -51,7 +51,7 @@ local void make_crc_table()
poly = 0L;
for (n = 0; n < sizeof(p)/sizeof(Byte); n++)
poly |= 1L << (31 - p[n]);
for (n = 0; n < 256; n++)
{
c = (uLong)n;
@@ -139,10 +139,14 @@ const uLongf * ZEXPORT get_crc_table()
#define DO8(buf) DO4(buf); DO4(buf);
/* ========================================================================= */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
uLong ZEXPORT crc32(uLong crc, const Bytef* buf, uInt len)
#else
uLong ZEXPORT crc32(crc, buf, len)
uLong crc;
const Bytef *buf;
uInt len;
#endif
{
if (buf == Z_NULL) return 0L;
#ifdef DYNAMIC_CRC_TABLE

View File

@@ -1,6 +1,6 @@
/* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-1998 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
@@ -187,11 +187,15 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
/* ========================================================================= */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT deflateInit_(z_streamp strm, int level, const char* version, int stream_size)
#else
int ZEXPORT deflateInit_(strm, level, version, stream_size)
z_streamp strm;
int level;
const char *version;
int stream_size;
#endif
{
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
Z_DEFAULT_STRATEGY, version, stream_size);
@@ -199,6 +203,10 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size)
}
/* ========================================================================= */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits,
int memLevel, int strategy, const char* version, int stream_size)
#else
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
version, stream_size)
z_streamp strm;
@@ -209,6 +217,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
int strategy;
const char *version;
int stream_size;
#endif
{
deflate_state *s;
int noheader = 0;
@@ -288,10 +297,14 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
}
/* ========================================================================= */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef* dictionary, uInt dictLength)
#else
int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
z_streamp strm;
const Bytef *dictionary;
uInt dictLength;
#endif
{
deflate_state *s;
uInt length = dictLength;
@@ -329,11 +342,15 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
}
/* ========================================================================= */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT deflateReset (z_streamp strm)
#else
int ZEXPORT deflateReset (strm)
z_streamp strm;
#endif
{
deflate_state *s;
if (strm == Z_NULL || strm->state == Z_NULL ||
strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR;
@@ -359,10 +376,14 @@ int ZEXPORT deflateReset (strm)
}
/* ========================================================================= */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
#else
int ZEXPORT deflateParams(strm, level, strategy)
z_streamp strm;
int level;
int strategy;
#endif
{
deflate_state *s;
compress_func func;
@@ -399,13 +420,17 @@ int ZEXPORT deflateParams(strm, level, strategy)
* IN assertion: the stream state is correct and there is enough room in
* pending_buf.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void putShortMSB (deflate_state* s, uInt b)
#else
local void putShortMSB (s, b)
deflate_state *s;
uInt b;
#endif
{
put_byte(s, (Byte)(b >> 8));
put_byte(s, (Byte)(b & 0xff));
}
}
/* =========================================================================
* Flush as much pending output as possible. All deflate() output goes
@@ -413,8 +438,12 @@ local void putShortMSB (s, b)
* to avoid allocating a large strm->next_out buffer and copying into it.
* (See also read_buf()).
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void flush_pending(z_streamp strm)
#else
local void flush_pending(strm)
z_streamp strm;
#endif
{
unsigned len = strm->state->pending;
@@ -433,9 +462,13 @@ local void flush_pending(strm)
}
/* ========================================================================= */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT deflate (z_streamp strm, int flush)
#else
int ZEXPORT deflate (strm, flush)
z_streamp strm;
int flush;
#endif
{
int old_flush; /* value of flush param for previous deflate call */
deflate_state *s;
@@ -567,8 +600,12 @@ int ZEXPORT deflate (strm, flush)
}
/* ========================================================================= */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT deflateEnd (z_streamp strm)
#else
int ZEXPORT deflateEnd (strm)
z_streamp strm;
#endif
{
int status;
@@ -597,9 +634,13 @@ int ZEXPORT deflateEnd (strm)
* To simplify the source, this is not supported for 16-bit MSDOS (which
* doesn't have enough memory anyway to duplicate compression states).
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT deflateCopy (z_streamp dest, z_streamp source)
#else
int ZEXPORT deflateCopy (dest, source)
z_streamp dest;
z_streamp source;
#endif
{
#ifdef MAXSEG_64K
return Z_STREAM_ERROR;
@@ -657,10 +698,14 @@ int ZEXPORT deflateCopy (dest, source)
* allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()).
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local int read_buf(z_streamp strm, Bytef* buf, unsigned size)
#else
local int read_buf(strm, buf, size)
z_streamp strm;
Bytef *buf;
unsigned size;
#endif
{
unsigned len = strm->avail_in;
@@ -682,8 +727,12 @@ local int read_buf(strm, buf, size)
/* ===========================================================================
* Initialize the "longest match" routines for a new zlib stream
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void lm_init (deflate_state* s)
#else
local void lm_init (s)
deflate_state *s;
#endif
{
s->window_size = (ulg)2L*s->w_size;
@@ -721,9 +770,13 @@ local void lm_init (s)
* match.S. The code will be functionally equivalent.
*/
#ifndef FASTEST
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local uInt longest_match(deflate_state* s, IPos cur_match)
#else
local uInt longest_match(s, cur_match)
deflate_state *s;
IPos cur_match; /* current match */
#endif
{
unsigned chain_length = s->max_chain_length;/* max hash chain length */
register Bytef *scan = s->window + s->strstart; /* current string */
@@ -863,9 +916,13 @@ local uInt longest_match(s, cur_match)
/* ---------------------------------------------------------------------------
* Optimized version for level == 1 only
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local uInt longest_match(deflate_state* s, IPos cur_match)
#else
local uInt longest_match(s, cur_match)
deflate_state *s;
IPos cur_match; /* current match */
#endif
{
register Bytef *scan = s->window + s->strstart; /* current string */
register Bytef *match; /* matched string */
@@ -922,10 +979,14 @@ local uInt longest_match(s, cur_match)
/* ===========================================================================
* Check that the match at match_start is indeed a match.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void check_match(deflate_state* s, IPos start, IPos match, int length)
#else
local void check_match(s, start, match, length)
deflate_state *s;
IPos start, match;
int length;
#endif
{
/* check that the match is indeed a match */
if (zmemcmp(s->window + match,
@@ -956,8 +1017,12 @@ local void check_match(s, start, match, length)
* performed for at least two bytes (required for the zip translate_eol
* option -- not supported here).
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void fill_window(deflate_state* s)
#else
local void fill_window(s)
deflate_state *s;
#endif
{
register unsigned n, m;
register Posf *p;
@@ -1076,9 +1141,13 @@ local void fill_window(s)
* NOTE: this function should be optimized to avoid extra copying from
* window to pending_buf.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local block_state deflate_stored(deflate_state* s, int flush)
#else
local block_state deflate_stored(s, flush)
deflate_state *s;
int flush;
#endif
{
/* Stored blocks are limited to 0xffff bytes, pending_buf is limited
* to pending_buf_size, and each stored block has a 5 byte header:
@@ -1134,9 +1203,13 @@ local block_state deflate_stored(s, flush)
* new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local block_state deflate_fast(deflate_state* s, int flush)
#else
local block_state deflate_fast(s, flush)
deflate_state *s;
int flush;
#endif
{
IPos hash_head = NIL; /* head of the hash chain */
int bflush; /* set if current block must be flushed */
@@ -1197,7 +1270,7 @@ local block_state deflate_fast(s, flush)
* always MIN_MATCH bytes ahead.
*/
} while (--s->match_length != 0);
s->strstart++;
s->strstart++;
} else
#endif
{
@@ -1217,7 +1290,7 @@ local block_state deflate_fast(s, flush)
Tracevv((stderr,"%c", s->window[s->strstart]));
_tr_tally_lit (s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
s->strstart++;
}
if (bflush) FLUSH_BLOCK(s, 0);
}
@@ -1230,9 +1303,13 @@ local block_state deflate_fast(s, flush)
* evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local block_state deflate_slow(deflate_state* s, int flush)
#else
local block_state deflate_slow(s, flush)
deflate_state *s;
int flush;
#endif
{
IPos hash_head = NIL; /* head of hash chain */
int bflush; /* set if current block must be flushed */

View File

@@ -70,10 +70,14 @@ local uLong getLong OF((gz_stream *s));
can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR).
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local gzFile gz_open (const char* path, const char* mode, int fd)
#else
local gzFile gz_open (path, mode, fd)
const char *path;
const char *mode;
int fd;
#endif
{
int err;
int level = Z_DEFAULT_COMPRESSION; /* compression level */
@@ -122,7 +126,7 @@ local gzFile gz_open (path, mode, fd)
}
} while (*p++ && m != fmode + sizeof(fmode));
if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
if (s->mode == 'w') {
#ifdef NO_DEFLATE
err = Z_STREAM_ERROR;
@@ -173,16 +177,20 @@ local gzFile gz_open (path, mode, fd)
check_header(s); /* skip the .gz header */
s->startpos = (ftell(s->file) - s->stream.avail_in);
}
return (gzFile)s;
}
/* ===========================================================================
Opens a gzip (.gz) file for reading or writing.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
gzFile ZEXPORT gzopen (const char* path, const char* mode)
#else
gzFile ZEXPORT gzopen (path, mode)
const char *path;
const char *mode;
#endif
{
return gz_open (path, mode, -1);
}
@@ -191,9 +199,13 @@ gzFile ZEXPORT gzopen (path, mode)
Associate a gzFile with the file descriptor fd. fd is not dup'ed here
to mimic the behavio(u)r of fdopen.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
gzFile ZEXPORT gzdopen (int fd, const char* mode)
#else
gzFile ZEXPORT gzdopen (fd, mode)
int fd;
const char *mode;
#endif
{
char name[20];
@@ -206,10 +218,14 @@ gzFile ZEXPORT gzdopen (fd, mode)
/* ===========================================================================
* Update the compression level and strategy
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT gzsetparams (gzFile file, int level, int strategy)
#else
int ZEXPORT gzsetparams (file, level, strategy)
gzFile file;
int level;
int strategy;
#endif
{
gz_stream *s = (gz_stream*)file;
@@ -233,8 +249,12 @@ int ZEXPORT gzsetparams (file, level, strategy)
for end of file.
IN assertion: the stream s has been sucessfully opened for reading.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local int get_byte(gz_stream* s)
#else
local int get_byte(s)
gz_stream *s;
#endif
{
if (s->z_eof) return EOF;
if (s->stream.avail_in == 0) {
@@ -260,8 +280,12 @@ local int get_byte(s)
s->stream.avail_in is zero for the first time, but may be non-zero
for concatenated .gz files.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void check_header(gz_stream* s)
#else
local void check_header(s)
gz_stream *s;
#endif
{
int method; /* method byte */
int flags; /* flags byte */
@@ -313,8 +337,12 @@ local void check_header(s)
* Cleanup then free the given gz_stream. Return a zlib error code.
Try freeing in the reverse order of allocations.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local int destroy (gz_stream* s)
#else
local int destroy (s)
gz_stream *s;
#endif
{
int err = Z_OK;
@@ -352,10 +380,14 @@ local int destroy (s)
Reads the given number of uncompressed bytes from the compressed file.
gzread returns the number of bytes actually read (0 for end of file).
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT gzread (gzFile file, voidp buf, unsigned len)
#else
int ZEXPORT gzread (file, buf, len)
gzFile file;
voidp buf;
unsigned len;
#endif
{
gz_stream *s = (gz_stream*)file;
Bytef *start = (Bytef*)buf; /* starting point for crc computation */
@@ -442,8 +474,12 @@ int ZEXPORT gzread (file, buf, len)
Reads one byte from the compressed file. gzgetc returns this byte
or -1 in case of end of file or error.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT gzgetc(gzFile file)
#else
int ZEXPORT gzgetc(file)
gzFile file;
#endif
{
unsigned char c;
@@ -460,10 +496,14 @@ int ZEXPORT gzgetc(file)
The current implementation is not optimized at all.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
char* ZEXPORT gzgets(gzFile file, char* buf, int len)
#else
char * ZEXPORT gzgets(file, buf, len)
gzFile file;
char *buf;
int len;
#endif
{
char *b = buf;
if (buf == Z_NULL || len <= 0) return Z_NULL;
@@ -479,10 +519,14 @@ char * ZEXPORT gzgets(file, buf, len)
Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of bytes actually written (0 in case of error).
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT gzwrite (gzFile file, const voidp buf, unsigned len)
#else
int ZEXPORT gzwrite (file, buf, len)
gzFile file;
const voidp buf;
unsigned len;
#endif
{
gz_stream *s = (gz_stream*)file;
@@ -538,12 +582,18 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
}
#else /* not ANSI C */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORTVA gzprintf (gzFile file const char* format, int a1, int a2, int a3, int a4,
int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12
int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20)
#else
int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
gzFile file;
const char *format;
int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
#endif
{
char buf[Z_PRINTF_BUFSIZE];
int len;
@@ -566,9 +616,13 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
Writes c, converted to an unsigned char, into the compressed file.
gzputc returns the value that was written, or -1 in case of error.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT gzputc(gzFile file, int c)
#else
int ZEXPORT gzputc(file, c)
gzFile file;
int c;
#endif
{
unsigned char cc = (unsigned char) c; /* required for big endian systems */
@@ -581,9 +635,13 @@ int ZEXPORT gzputc(file, c)
the terminating null character.
gzputs returns the number of characters written, or -1 in case of error.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT gzputs(gzFile file, const char* s)
#else
int ZEXPORT gzputs(file, s)
gzFile file;
const char *s;
#endif
{
return gzwrite(file, (char*)s, (unsigned)strlen(s));
}
@@ -593,9 +651,13 @@ int ZEXPORT gzputs(file, s)
Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local int do_flush (gzFile file, int flush)
#else
local int do_flush (file, flush)
gzFile file;
int flush;
#endif
{
uInt len;
int done = 0;
@@ -623,18 +685,22 @@ local int do_flush (file, flush)
if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
/* deflate has finished flushing only when it hasn't used up
* all the available space in the output buffer:
* all the available space in the output buffer:
*/
done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
}
return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT gzflush (gzFile file, int flush)
#else
int ZEXPORT gzflush (file, flush)
gzFile file;
int flush;
#endif
{
gz_stream *s = (gz_stream*)file;
int err = do_flush (file, flush);
@@ -653,10 +719,14 @@ int ZEXPORT gzflush (file, flush)
SEEK_END is not implemented, returns error.
In this version of the library, gzseek can be extremely slow.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
z_off_t ZEXPORT gzseek (gzFile file, z_off_t offset, int whence)
#else
z_off_t ZEXPORT gzseek (file, offset, whence)
gzFile file;
z_off_t offset;
int whence;
#endif
{
gz_stream *s = (gz_stream*)file;
@@ -664,7 +734,7 @@ z_off_t ZEXPORT gzseek (file, offset, whence)
s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
return -1L;
}
if (s->mode == 'w') {
#ifdef NO_DEFLATE
return -1L;
@@ -732,13 +802,17 @@ z_off_t ZEXPORT gzseek (file, offset, whence)
}
/* ===========================================================================
Rewinds input file.
Rewinds input file.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT gzrewind (gzFile file)
#else
int ZEXPORT gzrewind (file)
gzFile file;
#endif
{
gz_stream *s = (gz_stream*)file;
if (s == NULL || s->mode != 'r') return -1;
s->z_err = Z_OK;
@@ -760,8 +834,12 @@ int ZEXPORT gzrewind (file)
given compressed file. This position represents a number of bytes in the
uncompressed data stream.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
z_off_t ZEXPORT gztell (gzFile file)
#else
z_off_t ZEXPORT gztell (file)
gzFile file;
#endif
{
return gzseek(file, 0L, SEEK_CUR);
}
@@ -770,20 +848,28 @@ z_off_t ZEXPORT gztell (file)
Returns 1 when EOF has previously been detected reading the given
input stream, otherwise zero.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT gzeof (gzFile file)
#else
int ZEXPORT gzeof (file)
gzFile file;
#endif
{
gz_stream *s = (gz_stream*)file;
return (s == NULL || s->mode != 'r') ? 0 : s->z_eof;
}
/* ===========================================================================
Outputs a long in LSB order to the given file
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void putLong (FILE* file, uLong x)
#else
local void putLong (file, x)
FILE *file;
uLong x;
#endif
{
int n;
for (n = 0; n < 4; n++) {
@@ -793,10 +879,14 @@ local void putLong (file, x)
}
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets
Reads a long in LSB order from the given gz_stream. Sets
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local uLong getLong (gz_stream* s)
#else
local uLong getLong (s)
gz_stream *s;
#endif
{
uLong x = (uLong)get_byte(s);
int c;
@@ -813,8 +903,12 @@ local uLong getLong (s)
Flushes all pending output if necessary, closes the compressed file
and deallocates all the (de)compression state.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT gzclose (gzFile file)
#else
int ZEXPORT gzclose (file)
gzFile file;
#endif
{
int err;
gz_stream *s = (gz_stream*)file;
@@ -842,9 +936,13 @@ int ZEXPORT gzclose (file)
errnum is set to Z_ERRNO and the application may consult errno
to get the exact error code.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
const char* ZEXPORT gzerror (gzFile file, int* errnum)
#else
const char* ZEXPORT gzerror (file, errnum)
gzFile file;
int *errnum;
#endif
{
char *m;
gz_stream *s = (gz_stream*)file;

View File

@@ -1,6 +1,6 @@
/* infblock.c -- interpret and process block types to last block
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zutil.h"
@@ -65,10 +65,14 @@ local const uInt border[] = { /* Order of the bit length code lengths */
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
void inflate_blocks_reset(inflate_blocks_statef* s, z_streamp z, uLongf* c)
#else
void inflate_blocks_reset(s, z, c)
inflate_blocks_statef *s;
z_streamp z;
uLongf *c;
#endif
{
if (c != Z_NULL)
*c = s->check;
@@ -85,11 +89,14 @@ uLongf *c;
Tracev((stderr, "inflate: blocks reset\n"));
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
inflate_blocks_statef *inflate_blocks_new(z_streamp z, check_func c, uInt w)
#else
inflate_blocks_statef *inflate_blocks_new(z, c, w)
z_streamp z;
check_func c;
uInt w;
#endif
{
inflate_blocks_statef *s;
@@ -116,11 +123,14 @@ uInt w;
return s;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int inflate_blocks(inflate_blocks_statef* s, z_streamp z, int r)
#else
int inflate_blocks(s, z, r)
inflate_blocks_statef *s;
z_streamp z;
int r;
#endif
{
uInt t; /* temporary storage */
uLong b; /* bit buffer */
@@ -370,10 +380,13 @@ int r;
}
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int inflate_blocks_free(inflate_blocks_statef* s, z_streamp z)
#else
int inflate_blocks_free(s, z)
inflate_blocks_statef *s;
z_streamp z;
#endif
{
inflate_blocks_reset(s, z, Z_NULL);
ZFREE(z, s->window);
@@ -383,23 +396,29 @@ z_streamp z;
return Z_OK;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
void inflate_set_dictionary(inflate_blocks_statef* s, const Bytef* d, uInt n)
#else
void inflate_set_dictionary(s, d, n)
inflate_blocks_statef *s;
const Bytef *d;
uInt n;
#endif
{
zmemcpy(s->window, d, n);
s->read = s->write = s->window + n;
}
/* Returns true if inflate is currently at the end of a block generated
* by Z_SYNC_FLUSH or Z_FULL_FLUSH.
* by Z_SYNC_FLUSH or Z_FULL_FLUSH.
* IN assertion: s != Z_NULL
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int inflate_blocks_sync_point(inflate_blocks_statef* s)
#else
int inflate_blocks_sync_point(s)
inflate_blocks_statef *s;
#endif
{
return s->mode == LENS;
}

View File

@@ -1,6 +1,6 @@
/* infcodes.c -- process literals and length/distance pairs
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zutil.h"
@@ -55,12 +55,15 @@ struct inflate_codes_state {
};
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
inflate_codes_statef* inflate_codes_new(uInt bl, uInt bd, inflate_huft* tl, inflate_huft* td, z_streamp z)
#else
inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
uInt bl, bd;
inflate_huft *tl;
inflate_huft *td; /* need separate declaration for Borland C++ */
z_streamp z;
#endif
{
inflate_codes_statef *c;
@@ -77,11 +80,14 @@ z_streamp z;
return c;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int inflate_codes(inflate_blocks_statef* s, z_streamp z, int r)
#else
int inflate_codes(s, z, r)
inflate_blocks_statef *s;
z_streamp z;
int r;
#endif
{
uInt j; /* temporary storage */
inflate_huft *t; /* temporary pointer */
@@ -240,10 +246,13 @@ int r;
#endif
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
void inflate_codes_free(inflate_codes_statef* c, z_streamp z)
#else
void inflate_codes_free(c, z)
inflate_codes_statef *c;
z_streamp z;
#endif
{
ZFREE(z, c);
Tracev((stderr, "inflate: codes free\n"));

View File

@@ -1,6 +1,6 @@
/* inffast.c -- process literals and length/distance pairs fast
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zutil.h"
@@ -25,12 +25,16 @@ struct inflate_codes_state {int dummy;}; /* for buggy compilers */
at least ten. The ten bytes are six bytes for the longest length/
distance pair plus four bytes for overloading the bit buffer. */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int inflate_fast(uInt bl, uInt bd, inflate_huft* tl, inflate_huft* td, inflate_blocks_statef* s, z_streamp z)
#else
int inflate_fast(bl, bd, tl, td, s, z)
uInt bl, bd;
inflate_huft *tl;
inflate_huft *td; /* need separate declaration for Borland C++ */
inflate_blocks_statef *s;
z_streamp z;
#endif
{
inflate_huft *t; /* temporary pointer */
uInt e; /* extra bits or operation */

View File

@@ -1,6 +1,6 @@
/* inflate.c -- zlib interface to inflate modules
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zutil.h"
@@ -44,14 +44,18 @@ struct internal_state {
/* mode independent information */
int nowrap; /* flag for no wrapper */
uInt wbits; /* log2(window size) (8..15, defaults to 15) */
inflate_blocks_statef
inflate_blocks_statef
*blocks; /* current inflate_blocks state */
};
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT inflateReset(z_streamp z)
#else
int ZEXPORT inflateReset(z)
z_streamp z;
#endif
{
if (z == Z_NULL || z->state == Z_NULL)
return Z_STREAM_ERROR;
@@ -64,8 +68,12 @@ z_streamp z;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT inflateEnd(z_streamp z)
#else
int ZEXPORT inflateEnd(z)
z_streamp z;
#endif
{
if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
return Z_STREAM_ERROR;
@@ -77,12 +85,15 @@ z_streamp z;
return Z_OK;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT inflateInit2_(z_streamp z, int w, const char* version, int stream_size)
#else
int ZEXPORT inflateInit2_(z, w, version, stream_size)
z_streamp z;
int w;
const char *version;
int stream_size;
#endif
{
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
stream_size != sizeof(z_stream))
@@ -134,22 +145,28 @@ int stream_size;
return Z_OK;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT inflateInit_(z_streamp z, const char* version, int stream_size)
#else
int ZEXPORT inflateInit_(z, version, stream_size)
z_streamp z;
const char *version;
int stream_size;
#endif
{
return inflateInit2_(z, DEF_WBITS, version, stream_size);
}
#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT inflate(z_streamp z, int f)
#else
int ZEXPORT inflate(z, f)
z_streamp z;
int f;
#endif
{
int r;
uInt b;
@@ -274,11 +291,14 @@ int f;
#endif
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT inflateSetDictionary(z_streamp z, const Bytef* dictionary, uInt dictLength)
#else
int ZEXPORT inflateSetDictionary(z, dictionary, dictLength)
z_streamp z;
const Bytef *dictionary;
uInt dictLength;
#endif
{
uInt length = dictLength;
@@ -298,9 +318,12 @@ uInt dictLength;
return Z_OK;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT inflateSync(z_streamp z)
#else
int ZEXPORT inflateSync(z)
z_streamp z;
#endif
{
uInt n; /* number of bytes to look at */
Bytef *p; /* pointer to bytes */
@@ -349,7 +372,6 @@ z_streamp z;
return Z_OK;
}
/* Returns true if inflate is currently at the end of a block generated
* by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
* implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH
@@ -357,8 +379,12 @@ z_streamp z;
* decompressing, PPP checks that at the end of input packet, inflate is
* waiting for these length bytes.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT inflateSyncPoint(z_streamp z)
#else
int ZEXPORT inflateSyncPoint(z)
z_streamp z;
#endif
{
if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
return Z_STREAM_ERROR;

View File

@@ -1,6 +1,6 @@
/* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zutil.h"
@@ -24,7 +24,6 @@ struct internal_state {int dummy;}; /* for buggy compilers */
#define exop word.what.Exop
#define bits word.what.Bits
local int huft_build OF((
uIntf *, /* code lengths in bits */
uInt, /* number of codes */
@@ -90,6 +89,10 @@ local const uInt cpdext[30] = { /* Extra bits for distance codes */
/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
#define BMAX 15 /* maximum bit length of any code */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local int huft_build(uIntf* b, uInt n, uInt s, const uIntf* d, const uIntf* e,
inflate_huft* FAR *t, uIntf* m, inflate_huft* hp, uInt* hn, uIntf* v)
#else
local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
uInt n; /* number of codes (assumed <= 288) */
@@ -106,6 +109,7 @@ uIntf *v; /* working area: values in order of bit length */
if the given code set is incomplete (the tables are still built in this
case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of
lengths), or Z_MEM_ERROR if not enough memory. */
#endif
{
uInt a; /* counter for codes of length k */
@@ -290,13 +294,16 @@ uIntf *v; /* working area: values in order of bit length */
return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int inflate_trees_bits(uIntf* c, uIntf* bb, inflate_huft* FAR *tb, inflate_huft* hp, z_streamp z)
#else
int inflate_trees_bits(c, bb, tb, hp, z)
uIntf *c; /* 19 code lengths */
uIntf *bb; /* bits tree desired/actual depth */
inflate_huft * FAR *tb; /* bits tree result */
inflate_huft *hp; /* space for trees */
z_streamp z; /* for messages */
#endif
{
int r;
uInt hn = 0; /* hufts used in space */
@@ -317,7 +324,10 @@ z_streamp z; /* for messages */
return r;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int inflate_trees_dynamic(uInt nl, uInt nd, uInt* c, uInt* bl, uInt *bd, inflate_huft* FAR *tl,
inflate_huft* FAR *td, inflate_huft* hp, z_streamp z)
#else
int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
uInt nl; /* number of literal/length codes */
uInt nd; /* number of distance codes */
@@ -328,6 +338,7 @@ inflate_huft * FAR *tl; /* literal/length tree result */
inflate_huft * FAR *td; /* distance tree result */
inflate_huft *hp; /* space for trees */
z_streamp z; /* for messages */
#endif
{
int r;
uInt hn = 0; /* hufts used in space */
@@ -381,7 +392,6 @@ z_streamp z; /* for messages */
return Z_OK;
}
/* build fixed tables only once--keep them here */
#ifdef BUILDFIXED
local int fixed_built = 0;
@@ -395,13 +405,17 @@ local inflate_huft *fixed_td;
#include "inffixed.h"
#endif
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int inflate_trees_fixed(uIntf* bl, uIntf *bd, inflate_huft* FAR *tl,
inflate_huft* FAR *td, z_streamp z)
#else
int inflate_trees_fixed(bl, bd, tl, td, z)
uIntf *bl; /* literal desired/actual bit depth */
uIntf *bd; /* distance desired/actual bit depth */
inflate_huft * FAR *tl; /* literal/length tree result */
inflate_huft * FAR *td; /* distance tree result */
z_streamp z; /* for memory allocation */
#endif
{
#ifdef BUILDFIXED
/* build fixed tables if not already */

View File

@@ -1,6 +1,6 @@
/* inflate_util.c -- data and routines common to blocks and codes
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zutil.h"
@@ -20,10 +20,14 @@ uInt inflate_mask[17] = {
/* copy as much as possible from the sliding window to the output area */
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int inflate_flush(inflate_blocks_statef* s, z_streamp z, int r)
#else
int inflate_flush(s, z, r)
inflate_blocks_statef *s;
z_streamp z;
int r;
#endif
{
uInt n;
Bytef *p;

View File

@@ -1,6 +1,6 @@
/* trees.c -- output deflated data using Huffman coding
* Copyright (C) 1995-1998 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
@@ -189,10 +189,14 @@ local void gen_trees_header OF((void));
#ifdef __WXDEBUG__
local void send_bits OF((deflate_state *s, int value, int length));
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void send_bits(deflate_state* s, int value, int length)
#else
local void send_bits(s, value, length)
deflate_state *s;
int value; /* value to send */
int length; /* number of bits */
#endif
{
Tracevv((stderr," l %2d v %4x ", length, value));
Assert(length > 0 && length <= 15, "invalid length");
@@ -373,8 +377,12 @@ void gen_trees_header()
/* ===========================================================================
* Initialize the tree data structures for a new zlib stream.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
void _tr_init(deflate_state* s)
#else
void _tr_init(s)
deflate_state *s;
#endif
{
tr_static_init();
@@ -403,8 +411,12 @@ void _tr_init(s)
/* ===========================================================================
* Initialize a new block.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void init_block(deflate_state* s)
#else
local void init_block(s)
deflate_state *s;
#endif
{
int n; /* iterates over tree elements */
@@ -447,10 +459,14 @@ local void init_block(s)
* when the heap property is re-established (each father smaller than its
* two sons).
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void pqdownheap(deflate_state* s, ct_data* tree, int k)
#else
local void pqdownheap(s, tree, k)
deflate_state *s;
ct_data *tree; /* the tree to restore */
int k; /* node to move down */
#endif
{
int v = s->heap[k];
int j = k << 1; /* left son of k */
@@ -482,9 +498,13 @@ local void pqdownheap(s, tree, k)
* The length opt_len is updated; static_len is also updated if stree is
* not null.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void gen_bitlen(deflate_state* s, tree_desc* desc)
#else
local void gen_bitlen(s, desc)
deflate_state *s;
tree_desc *desc; /* the tree descriptor */
#endif
{
ct_data *tree = desc->dyn_tree;
int max_code = desc->max_code;
@@ -569,10 +589,14 @@ local void gen_bitlen(s, desc)
* OUT assertion: the field code is set for all tree elements of non
* zero code length.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void gen_codes (ct_data* tree, int max_code, ushf* bl_count)
#else
local void gen_codes (tree, max_code, bl_count)
ct_data *tree; /* the tree to decorate */
int max_code; /* largest code with non zero frequency */
ushf *bl_count; /* number of codes at each bit length */
#endif
{
ush next_code[MAX_BITS+1]; /* next code value for each bit length */
ush code = 0; /* running code value */
@@ -611,9 +635,13 @@ local void gen_codes (tree, max_code, bl_count)
* and corresponding code. The length opt_len is updated; static_len is
* also updated if stree is not null. The field max_code is set.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void build_tree(deflate_state* s, tree_desc* desc)
#else
local void build_tree(s, desc)
deflate_state *s;
tree_desc *desc; /* the tree descriptor */
#endif
{
ct_data *tree = desc->dyn_tree;
const ct_data *stree = desc->stat_desc->static_tree;
@@ -698,10 +726,14 @@ local void build_tree(s, desc)
* Scan a literal or distance tree to determine the frequencies of the codes
* in the bit length tree.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void scan_tree (deflate_state* s, ct_data* tree, int max_code)
#else
local void scan_tree (s, tree, max_code)
deflate_state *s;
ct_data *tree; /* the tree to be scanned */
int max_code; /* and its largest code of non zero frequency */
#endif
{
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
@@ -743,10 +775,14 @@ local void scan_tree (s, tree, max_code)
* Send a literal or distance tree in compressed form, using the codes in
* bl_tree.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void send_tree (deflate_state* s, ct_data* tree, int max_code)
#else
local void send_tree (s, tree, max_code)
deflate_state *s;
ct_data *tree; /* the tree to be scanned */
int max_code; /* and its largest code of non zero frequency */
#endif
{
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
@@ -794,8 +830,12 @@ local void send_tree (s, tree, max_code)
* Construct the Huffman tree for the bit lengths and return the index in
* bl_order of the last bit length code to send.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local int build_bl_tree( deflate_state* s)
#else
local int build_bl_tree(s)
deflate_state *s;
#endif
{
int max_blindex; /* index of last bit length code of non zero freq */
@@ -829,9 +869,13 @@ local int build_bl_tree(s)
* lengths of the bit length codes, the literal tree and the distance tree.
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void send_all_trees(deflate_state* s, int lcodes, int dcodes, int blcodes)
#else
local void send_all_trees(s, lcodes, dcodes, blcodes)
deflate_state *s;
int lcodes, dcodes, blcodes; /* number of codes for each tree */
#endif
{
int rank; /* index in bl_order */
@@ -858,11 +902,15 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
/* ===========================================================================
* Send a stored block
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
void _tr_stored_block(deflate_state* s, charf* buf, ulg stored_len, int eof)
#else
void _tr_stored_block(s, buf, stored_len, eof)
deflate_state *s;
charf *buf; /* input block */
ulg stored_len; /* length of input block */
int eof; /* true if this is the last block for a file */
#endif
{
send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
@@ -882,8 +930,12 @@ void _tr_stored_block(s, buf, stored_len, eof)
* To simplify the code, we assume the worst case of last real code encoded
* on one bit only.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
void _tr_align(deflate_state* s)
#else
void _tr_align(s)
deflate_state *s;
#endif
{
send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree);
@@ -908,11 +960,15 @@ void _tr_align(s)
* trees or store, and output the encoded block to the zip file. This function
* returns the total compressed length for the file so far.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
ulg _tr_flush_block(deflate_state* s, charf* buf, ulg stored_len, int eof)
#else
ulg _tr_flush_block(s, buf, stored_len, eof)
deflate_state *s;
charf *buf; /* input block, or NULL if too old */
ulg stored_len; /* length of input block */
int eof; /* true if this is the last block for a file */
#endif
{
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
int max_blindex = 0; /* index of last bit length code of non zero freq */
@@ -1020,10 +1076,14 @@ ulg _tr_flush_block(s, buf, stored_len, eof)
* Save the match info and tally the frequency counts. Return true if
* the current block must be flushed.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int _tr_tally (deflate_state* s, unsigned dist, unsigned lc)
#else
int _tr_tally (s, dist, lc)
deflate_state *s;
unsigned dist; /* distance of matched string */
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
#endif
{
s->d_buf[s->last_lit] = (ush)dist;
s->l_buf[s->last_lit++] = (uch)lc;
@@ -1070,10 +1130,14 @@ int _tr_tally (s, dist, lc)
/* ===========================================================================
* Send the block data compressed using the given Huffman trees
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void compress_block(deflate_state* s, ct_data* ltree, ct_data* dtree)
#else
local void compress_block(s, ltree, dtree)
deflate_state *s;
ct_data *ltree; /* literal tree */
ct_data *dtree; /* distance tree */
#endif
{
unsigned dist; /* distance of matched string */
int lc; /* match length or unmatched char (if dist == 0) */
@@ -1123,8 +1187,12 @@ local void compress_block(s, ltree, dtree)
* IN assertion: the fields freq of dyn_ltree are set and the total of all
* frequencies does not exceed 64K (to fit in an int on 16 bit machines).
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void set_data_type(deflate_state* s)
#else
local void set_data_type(s)
deflate_state *s;
#endif
{
int n = 0;
unsigned ascii_freq = 0;
@@ -1140,9 +1208,13 @@ local void set_data_type(s)
* method would use a table)
* IN assertion: 1 <= len <= 15
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local unsigned bi_reverse(unsigned code, int len)
#else
local unsigned bi_reverse(code, len)
unsigned code; /* the value to invert */
int len; /* its bit length */
#endif
{
register unsigned res = 0;
do {
@@ -1155,8 +1227,12 @@ local unsigned bi_reverse(code, len)
/* ===========================================================================
* Flush the bit buffer, keeping at most 7 bits in it.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void bi_flush(deflate_state* s)
#else
local void bi_flush(s)
deflate_state *s;
#endif
{
if (s->bi_valid == 16) {
put_short(s, s->bi_buf);
@@ -1172,8 +1248,12 @@ local void bi_flush(s)
/* ===========================================================================
* Flush the bit buffer and align the output on a byte boundary
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void bi_windup(deflate_state* s)
#else
local void bi_windup(s)
deflate_state *s;
#endif
{
if (s->bi_valid > 8) {
put_short(s, s->bi_buf);
@@ -1191,17 +1271,21 @@ local void bi_windup(s)
* Copy a stored block, storing first the length and its
* one's complement if requested.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
local void copy_block(deflate_state* s, charf* buf, unsigned len, int header)
#else
local void copy_block(s, buf, len, header)
deflate_state *s;
charf *buf; /* the input data */
unsigned len; /* its length */
int header; /* true if block header must be written */
#endif
{
bi_windup(s); /* align on byte boundary */
s->last_eob_len = 8; /* enough lookahead for inflate */
if (header) {
put_short(s, (ush)len);
put_short(s, (ush)len);
put_short(s, (ush)~len);
#ifdef __WXDEBUG__
s->bits_sent += 2*16;

View File

@@ -1,6 +1,6 @@
/* uncompr.c -- decompress a memory buffer
* Copyright (C) 1995-1998 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
@@ -22,11 +22,15 @@
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted.
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int ZEXPORT uncompress (Bytef* dest, uLongf* destLen, const Bytef* source, uLong sourceLen)
#else
int ZEXPORT uncompress (dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
#endif
{
z_stream stream;
int err;

View File

@@ -1,6 +1,6 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-1998 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
@@ -51,7 +51,7 @@
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
#if defined(__GNUC__) || defined(WIN32) || defined(OS232) || defined(__386__) || defined(i386)
# ifndef __32BIT__
# define __32BIT__
# endif
@@ -71,7 +71,7 @@
# define UNALIGNED_OK
#endif
#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32) || defined(OS232)) && !defined(STDC)
# define STDC
#endif
#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
@@ -196,6 +196,9 @@ typedef unsigned long uLong; /* 32 bits or more */
#else
typedef Byte FAR Bytef;
#endif
#if defined(__VISAGECPP__)
# define Bytef Byte FAR
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;

View File

@@ -1,6 +1,6 @@
/* zutil.c -- target dependent utility functions for the compression library
* Copyright (C) 1995-1998 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
@@ -38,8 +38,12 @@ const char * ZEXPORT zlibVersion()
# endif
int z_verbose = verbose;
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
void z_error (char* m)
#else
void z_error (m)
char *m;
#endif
{
fprintf(stderr, "%s\n", m);
exit(1);
@@ -49,8 +53,12 @@ void z_error (m)
/* exported to allow conversion of error code to string for compress() and
* uncompress()
*/
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
const char* ZEXPORT zError(int err)
#else
const char * ZEXPORT zError(err)
int err;
#endif
{
return ERR_MSG(err);
}
@@ -58,10 +66,14 @@ const char * ZEXPORT zError(err)
#ifndef HAVE_MEMCPY
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
void zmemcpy(Bytef* dest, Bytef* source, Uint len)
#else
void zmemcpy(dest, source, len)
Bytef* dest;
Bytef* source;
uInt len;
#endif
{
if (len == 0) return;
do {
@@ -69,10 +81,14 @@ void zmemcpy(dest, source, len)
} while (--len != 0);
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
int zmemcmp(Bytef* s1, Bytef* s2, int len)
#else
int zmemcmp(s1, s2, len)
Bytef* s1;
Bytef* s2;
uInt len;
#endif
{
uInt j;
@@ -82,9 +98,13 @@ int zmemcmp(s1, s2, len)
return 0;
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
void zmemzero(Bytef* dest, uInt len)
#else
void zmemzero(dest, len)
Bytef* dest;
uInt len;
#endif
{
if (len == 0) return;
do {
@@ -205,18 +225,26 @@ extern voidp calloc OF((uInt items, uInt size));
extern void free OF((voidpf ptr));
#endif
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
#else
voidpf zcalloc (opaque, items, size)
voidpf opaque;
unsigned items;
unsigned size;
#endif
{
if (opaque) items += size - size; /* make compiler happy */
return (voidpf)calloc(items, size);
}
#if defined(__VISAGECPP__) // Visual game can't handle this antiquated interface
void zcfree(voidpf opaque, voidpf ptr)
#else
void zcfree (opaque, ptr)
voidpf opaque;
voidpf ptr;
#endif
{
free(ptr);
if (opaque) return; /* make compiler happy */

View File

@@ -208,10 +208,15 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
#endif
typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
typedef uLong (ZEXPORT _Optlink *check_func) OF((uLong check, const Bytef *buf,
uInt len));
#if defined(__VISAGECPP__)
voidpf _Optlink zcalloc OF((voidpf opaque, unsigned items, unsigned size));
void _Optlink zcfree OF((voidpf opaque, voidpf ptr));
#else
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
void zcfree OF((voidpf opaque, voidpf ptr));
#endif
#define ZALLOC(strm, items, size) \
(*((strm)->zalloc))((strm)->opaque, (items), (size))