Compare commits
1 Commits
LIBTIFF_3_
...
LAST_WITH_
Author | SHA1 | Date | |
---|---|---|---|
|
5335e9ae5e |
123
include/wx/accel.h
Normal file
123
include/wx/accel.h
Normal file
@@ -0,0 +1,123 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/accel.h
|
||||
// Purpose: wxAcceleratorEntry and wxAcceleratorTable classes
|
||||
// Author: Julian Smart, Robert Roebling, Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 31.05.01 (extracted from other files)
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_ACCEL_H_BASE_
|
||||
#define _WX_ACCEL_H_BASE_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
|
||||
#include "wx/object.h"
|
||||
|
||||
class WXDLLEXPORT wxAcceleratorTable;
|
||||
class WXDLLEXPORT wxMenuItem;
|
||||
class WXDLLEXPORT wxKeyEvent;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// wxAcceleratorEntry flags
|
||||
enum
|
||||
{
|
||||
wxACCEL_NORMAL = 0x0000, // no modifiers
|
||||
wxACCEL_ALT = 0x0001, // hold Alt key down
|
||||
wxACCEL_CTRL = 0x0002, // hold Ctrl key down
|
||||
wxACCEL_SHIFT = 0x0004 // hold Shift key down
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// an entry in wxAcceleratorTable corresponds to one accelerator
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxAcceleratorEntry
|
||||
{
|
||||
public:
|
||||
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0,
|
||||
wxMenuItem *item = NULL)
|
||||
{
|
||||
Set(flags, keyCode, cmd, item);
|
||||
}
|
||||
|
||||
void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL)
|
||||
{
|
||||
m_flags = flags;
|
||||
m_keyCode = keyCode;
|
||||
m_command = cmd;
|
||||
m_item = item;
|
||||
}
|
||||
|
||||
void SetMenuItem(wxMenuItem *item) { m_item = item; }
|
||||
|
||||
int GetFlags() const { return m_flags; }
|
||||
int GetKeyCode() const { return m_keyCode; }
|
||||
int GetCommand() const { return m_command; }
|
||||
|
||||
wxMenuItem *GetMenuItem() const { return m_item; }
|
||||
|
||||
bool operator==(const wxAcceleratorEntry& entry) const
|
||||
{
|
||||
return m_flags == entry.m_flags &&
|
||||
m_keyCode == entry.m_keyCode &&
|
||||
m_command == entry.m_command &&
|
||||
m_item == entry.m_item;
|
||||
}
|
||||
|
||||
bool operator!=(const wxAcceleratorEntry& entry) const
|
||||
{ return !(*this == entry); }
|
||||
|
||||
#ifdef __WXMOTIF__
|
||||
// Implementation use only
|
||||
bool MatchesEvent(const wxKeyEvent& event) const ;
|
||||
#endif
|
||||
|
||||
private:
|
||||
int m_flags; // combination of wxACCEL_XXX constants
|
||||
int m_keyCode; // ASCII or virtual keycode
|
||||
int m_command; // Command id to generate
|
||||
|
||||
// the menu item this entry corresponds to, may be NULL
|
||||
wxMenuItem *m_item;
|
||||
|
||||
// for compatibility with old code, use accessors now!
|
||||
friend class WXDLLEXPORT wxMenu;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include wxAcceleratorTable class declaration, it is only used by the library
|
||||
// and so doesn't have any published user visible interface
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/generic/accel.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/accel.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/accel.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/accel.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/accel.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/accel.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/accel.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/accel.h"
|
||||
#endif
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
|
||||
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
#endif
|
||||
// _WX_ACCEL_H_BASE_
|
512
include/wx/app.h
Normal file
512
include/wx/app.h
Normal file
@@ -0,0 +1,512 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: app.h
|
||||
// Purpose: wxAppBase class and macros used for declaration of wxApp
|
||||
// derived class in the user code
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_APP_H_BASE_
|
||||
#define _WX_APP_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "appbase.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// typedefs
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if (defined(__WXMSW__) && !defined(__WXMICROWIN__)) || defined (__WXPM__)
|
||||
class WXDLLEXPORT wxApp;
|
||||
typedef wxApp* (*wxAppInitializerFunction)();
|
||||
#else
|
||||
// returning wxApp* won't work with gcc
|
||||
#include "wx/object.h"
|
||||
|
||||
typedef wxObject* (*wxAppInitializerFunction)();
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxCmdLineParser;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers we have to include here
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/event.h" // for the base class
|
||||
|
||||
#if wxUSE_GUI
|
||||
#include "wx/window.h" // for wxTopLevelWindows
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
#if wxUSE_LOG
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static const int wxPRINT_WINDOWS = 1;
|
||||
static const int wxPRINT_POSTSCRIPT = 2;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the common part of wxApp implementations for all platforms
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxAppBase : public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
wxAppBase();
|
||||
|
||||
// the virtual functions which may/must be overridden in the derived class
|
||||
// -----------------------------------------------------------------------
|
||||
#ifdef __DARWIN__
|
||||
virtual ~wxAppBase() { }
|
||||
#endif
|
||||
|
||||
// called during the program initialization, returning FALSE from here
|
||||
// prevents the program from continuing - it's a good place to create
|
||||
// the top level program window and return TRUE.
|
||||
//
|
||||
// Override: always in GUI application, rarely in console ones.
|
||||
virtual bool OnInit();
|
||||
|
||||
#if wxUSE_GUI
|
||||
// a platform-dependent version of OnInit(): the code here is likely to
|
||||
// depend on the toolkit. default version does nothing.
|
||||
//
|
||||
// Override: rarely.
|
||||
virtual bool OnInitGui();
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// called to start program execution - the default version just enters
|
||||
// the main GUI loop in which events are received and processed until
|
||||
// the last window is not deleted (if GetExitOnFrameDelete) or
|
||||
// ExitMainLoop() is called. In console mode programs, the execution
|
||||
// of the program really starts here
|
||||
//
|
||||
// Override: rarely in GUI applications, always in console ones.
|
||||
#if wxUSE_GUI
|
||||
virtual int OnRun() { return MainLoop(); };
|
||||
#else // !GUI
|
||||
virtual int OnRun() = 0;
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// called after the main loop termination. This is a good place for
|
||||
// cleaning up (it may be too late in dtor) and is also useful if you
|
||||
// want to return some non-default exit code - this is just the return
|
||||
// value of this method.
|
||||
//
|
||||
// Override: often.
|
||||
virtual int OnExit();
|
||||
|
||||
// called when a fatal exception occurs, this function should take care
|
||||
// not to do anything which might provoke a nested exception! It may be
|
||||
// overridden if you wish to react somehow in non-default way (core
|
||||
// dump under Unix, application crash under Windows) to fatal program
|
||||
// errors, however extreme care should be taken if you don't want this
|
||||
// function to crash.
|
||||
//
|
||||
// Override: rarely.
|
||||
virtual void OnFatalException() { }
|
||||
|
||||
// the worker functions - usually not used directly by the user code
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
#if wxUSE_GUI
|
||||
// execute the main GUI loop, the function returns when the loop ends
|
||||
virtual int MainLoop() = 0;
|
||||
|
||||
// exit the main GUI loop during the next iteration (i.e. it does not
|
||||
// stop the program immediately!)
|
||||
virtual void ExitMainLoop() = 0;
|
||||
|
||||
// returns TRUE if the program is initialized
|
||||
virtual bool Initialized() = 0;
|
||||
|
||||
// returns TRUE if there are unprocessed events in the event queue
|
||||
virtual bool Pending() = 0;
|
||||
|
||||
// process the first event in the event queue (blocks until an event
|
||||
// apperas if there are none currently)
|
||||
virtual void Dispatch() = 0;
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// application info: name, description, vendor
|
||||
// -------------------------------------------
|
||||
|
||||
// NB: all these should be set by the application itself, there are no
|
||||
// reasonable default except for the application name which is taken to
|
||||
// be argv[0]
|
||||
|
||||
// set/get the application name
|
||||
wxString GetAppName() const
|
||||
{
|
||||
if ( !m_appName )
|
||||
return m_className;
|
||||
else
|
||||
return m_appName;
|
||||
}
|
||||
void SetAppName(const wxString& name) { m_appName = name; }
|
||||
|
||||
// set/get the app class name
|
||||
wxString GetClassName() const { return m_className; }
|
||||
void SetClassName(const wxString& name) { m_className = name; }
|
||||
|
||||
// set/get the vendor name
|
||||
const wxString& GetVendorName() const { return m_vendorName; }
|
||||
void SetVendorName(const wxString& name) { m_vendorName = name; }
|
||||
|
||||
#if wxUSE_GUI
|
||||
// top level window functions
|
||||
// --------------------------
|
||||
|
||||
// return TRUE if our app has focus
|
||||
virtual bool IsActive() const { return m_isActive; }
|
||||
|
||||
// set the "main" top level window
|
||||
void SetTopWindow(wxWindow *win) { m_topWindow = win; }
|
||||
|
||||
// return the "main" top level window (if it hadn't been set previously
|
||||
// with SetTopWindow(), will return just some top level window and, if
|
||||
// there are none, will return NULL)
|
||||
virtual wxWindow *GetTopWindow() const
|
||||
{
|
||||
if (m_topWindow)
|
||||
return m_topWindow;
|
||||
else if (wxTopLevelWindows.GetCount() > 0)
|
||||
return wxTopLevelWindows.GetFirst()->GetData();
|
||||
else
|
||||
return (wxWindow *)NULL;
|
||||
}
|
||||
|
||||
// control the exit behaviour: by default, the program will exit the
|
||||
// main loop (and so, usually, terminate) when the last top-level
|
||||
// program window is deleted. Beware that if you disabel this (with
|
||||
// SetExitOnFrameDelete(FALSE)), you'll have to call ExitMainLoop()
|
||||
// explicitly from somewhere.
|
||||
void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
|
||||
bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
|
||||
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// cmd line parsing stuff
|
||||
// ----------------------
|
||||
|
||||
// all of these methods may be overridden in the derived class to
|
||||
// customize the command line parsing (by default only a few standard
|
||||
// options are handled)
|
||||
//
|
||||
// you also need to call wxApp::OnInit() from YourApp::OnInit() for all
|
||||
// this to work
|
||||
|
||||
#if wxUSE_CMDLINE_PARSER
|
||||
// this one is called from OnInit() to add all supported options
|
||||
// to the given parser
|
||||
virtual void OnInitCmdLine(wxCmdLineParser& parser);
|
||||
|
||||
// called after successfully parsing the command line, return TRUE
|
||||
// to continue and FALSE to exit
|
||||
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
|
||||
|
||||
// called if "--help" option was specified, return TRUE to continue
|
||||
// and FALSE to exit
|
||||
virtual bool OnCmdLineHelp(wxCmdLineParser& parser);
|
||||
|
||||
// called if incorrect command line options were given, return
|
||||
// FALSE to abort and TRUE to continue
|
||||
virtual bool OnCmdLineError(wxCmdLineParser& parser);
|
||||
#endif // wxUSE_CMDLINE_PARSER
|
||||
|
||||
// miscellaneous customization functions
|
||||
// -------------------------------------
|
||||
|
||||
#if wxUSE_LOG
|
||||
// override this function to create default log target of arbitrary
|
||||
// user-defined class (default implementation creates a wxLogGui
|
||||
// object) - this log object is used by default by all wxLogXXX()
|
||||
// functions.
|
||||
virtual wxLog *CreateLogTarget()
|
||||
#if wxUSE_GUI && wxUSE_LOGGUI && !defined(__WXMICROWIN__)
|
||||
{ return new wxLogGui; }
|
||||
#else // !GUI
|
||||
{ return new wxLogStderr; }
|
||||
#endif // wxUSE_GUI
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
#if wxUSE_GUI
|
||||
// get the standard icon used by wxWin dialogs - this allows the user
|
||||
// to customize the standard dialogs. The 'which' parameter is one of
|
||||
// wxICON_XXX values
|
||||
virtual wxIcon GetStdIcon(int which) const = 0;
|
||||
|
||||
// VZ: what does this do exactly?
|
||||
void SetWantDebugOutput( bool flag ) { m_wantDebugOutput = flag; }
|
||||
bool GetWantDebugOutput() const { return m_wantDebugOutput; }
|
||||
|
||||
// set use of best visual flag (see below)
|
||||
void SetUseBestVisual( bool flag ) { m_useBestVisual = flag; }
|
||||
bool GetUseBestVisual() const { return m_useBestVisual; }
|
||||
|
||||
// set/get printing mode: see wxPRINT_XXX constants.
|
||||
//
|
||||
// default behaviour is the normal one for Unix: always use PostScript
|
||||
// printing.
|
||||
virtual void SetPrintMode(int WXUNUSED(mode)) { }
|
||||
int GetPrintMode() const { return wxPRINT_POSTSCRIPT; }
|
||||
|
||||
// called by toolkit-specific code to set the app status: active (we have
|
||||
// focus) or not and also the last window which had focus before we were
|
||||
// deactivated
|
||||
virtual void SetActive(bool isActive, wxWindow *lastFocus);
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// debugging support
|
||||
// -----------------
|
||||
|
||||
// this function is called when an assert failure occurs, the base class
|
||||
// version does the normal processing (i.e. shows the usual assert failure
|
||||
// dialog box)
|
||||
#ifdef __WXDEBUG__
|
||||
virtual void OnAssert(const wxChar *file, int line, const wxChar *msg);
|
||||
#endif // __WXDEBUG__
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
// helpers for dynamic wxApp construction
|
||||
static void SetInitializerFunction(wxAppInitializerFunction fn)
|
||||
{ m_appInitFn = fn; }
|
||||
static wxAppInitializerFunction GetInitializerFunction()
|
||||
{ return m_appInitFn; }
|
||||
|
||||
// process all events in the wxPendingEvents list
|
||||
virtual void ProcessPendingEvents();
|
||||
|
||||
// access to the command line arguments
|
||||
int argc;
|
||||
wxChar **argv;
|
||||
|
||||
protected:
|
||||
// function used for dynamic wxApp creation
|
||||
static wxAppInitializerFunction m_appInitFn;
|
||||
|
||||
// application info (must be set from the user code)
|
||||
wxString m_vendorName, // vendor name (ACME Inc)
|
||||
m_appName, // app name
|
||||
m_className; // class name
|
||||
|
||||
// TRUE if the application wants to get debug output
|
||||
bool m_wantDebugOutput;
|
||||
|
||||
#if wxUSE_GUI
|
||||
// the main top level window - may be NULL
|
||||
wxWindow *m_topWindow;
|
||||
|
||||
// if TRUE, exit the main loop when the last top level window is deleted
|
||||
bool m_exitOnFrameDelete;
|
||||
|
||||
// TRUE if the apps whats to use the best visual on systems where
|
||||
// more than one are available (Sun, SGI, XFree86 4.0 ?)
|
||||
bool m_useBestVisual;
|
||||
|
||||
// does any of our windows has focus?
|
||||
bool m_isActive;
|
||||
#endif // wxUSE_GUI
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// now include the declaration of the real class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_GUI
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/app.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/app.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/app.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/app.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/app.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/app.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/app.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/app.h"
|
||||
#endif
|
||||
#else // !GUI
|
||||
// can't use typedef because wxApp forward declared as a class
|
||||
class WXDLLEXPORT wxApp : public wxAppBase
|
||||
{
|
||||
};
|
||||
#endif // GUI/!GUI
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the global data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// the one and only application object - use of wxTheApp in application code
|
||||
// is discouraged, consider using DECLARE_APP() after which you may call
|
||||
// wxGetApp() which will return the object of the correct type (i.e. MyApp and
|
||||
// not wxApp)
|
||||
WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// event loop related functions only work in GUI programs
|
||||
// ------------------------------------------------------
|
||||
|
||||
// Force an exit from main loop
|
||||
extern void WXDLLEXPORT wxExit();
|
||||
|
||||
// Yield to other apps/messages
|
||||
extern bool WXDLLEXPORT wxYield();
|
||||
|
||||
// Yield to other apps/messages
|
||||
extern void WXDLLEXPORT wxWakeUpIdle();
|
||||
|
||||
// Post a message to the given eventhandler which will be processed during the
|
||||
// next event loop iteration
|
||||
inline void wxPostEvent(wxEvtHandler *dest, wxEvent& event)
|
||||
{
|
||||
wxCHECK_RET( dest, wxT("need an object to post event to in wxPostEvent") );
|
||||
|
||||
#if wxUSE_GUI
|
||||
dest->AddPendingEvent(event);
|
||||
#else
|
||||
dest->ProcessEvent(event);
|
||||
#endif // wxUSE_GUI
|
||||
}
|
||||
|
||||
// console applications may avoid using DECLARE_APP and IMPLEMENT_APP macros
|
||||
// and call these functions instead at the program startup and termination
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
#if !wxUSE_GUI
|
||||
|
||||
// initialize the library (may be called as many times as needed, but each
|
||||
// call to wxInitialize() must be matched by wxUninitialize())
|
||||
extern bool WXDLLEXPORT wxInitialize();
|
||||
|
||||
// clean up - the library can't be used any more after the last call to
|
||||
// wxUninitialize()
|
||||
extern void WXDLLEXPORT wxUninitialize();
|
||||
|
||||
// create an object of this class on stack to initialize/cleanup thel ibrary
|
||||
// automatically
|
||||
class WXDLLEXPORT wxInitializer
|
||||
{
|
||||
public:
|
||||
// initialize the library
|
||||
wxInitializer() { m_ok = wxInitialize(); }
|
||||
|
||||
// has the initialization been successful? (explicit test)
|
||||
bool IsOk() const { return m_ok; }
|
||||
|
||||
// has the initialization been successful? (implicit test)
|
||||
operator bool() const { return m_ok; }
|
||||
|
||||
// dtor only does clean up if we initialized the library properly
|
||||
~wxInitializer() { if ( m_ok ) wxUninitialize(); }
|
||||
|
||||
private:
|
||||
bool m_ok;
|
||||
};
|
||||
|
||||
#endif // !wxUSE_GUI
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros for dynamic creation of the application object
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Having a global instance of this class allows wxApp to be aware of the app
|
||||
// creator function. wxApp can then call this function to create a new app
|
||||
// object. Convoluted, but necessary.
|
||||
|
||||
class WXDLLEXPORT wxAppInitializer
|
||||
{
|
||||
public:
|
||||
wxAppInitializer(wxAppInitializerFunction fn)
|
||||
{ wxApp::SetInitializerFunction(fn); }
|
||||
};
|
||||
|
||||
// Here's a macro you can use if your compiler really, really wants main() to
|
||||
// be in your main program (e.g. hello.cpp). Now IMPLEMENT_APP should add this
|
||||
// code if required.
|
||||
|
||||
#if !wxUSE_GUI || defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMGL__)
|
||||
#define IMPLEMENT_WXWIN_MAIN \
|
||||
extern int wxEntry( int argc, char *argv[] ); \
|
||||
int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
|
||||
#elif defined(__WXMAC__) && defined(__UNIX__)
|
||||
// wxMac seems to have a specific wxEntry prototype
|
||||
#define IMPLEMENT_WXWIN_MAIN \
|
||||
extern int wxEntry( int argc, char *argv[], bool enterLoop = 1 ); \
|
||||
int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
|
||||
#elif defined(__WXMSW__) && defined(WXUSINGDLL)
|
||||
// NT defines APIENTRY, 3.x not
|
||||
#if !defined(WXAPIENTRY)
|
||||
#define WXAPIENTRY WXFAR wxSTDCALL
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include "wx/msw/winundef.h"
|
||||
|
||||
#define IMPLEMENT_WXWIN_MAIN \
|
||||
extern "C" int WXAPIENTRY WinMain(HINSTANCE hInstance,\
|
||||
HINSTANCE hPrevInstance,\
|
||||
LPSTR m_lpCmdLine, int nCmdShow)\
|
||||
{\
|
||||
return wxEntry((WXHINSTANCE) hInstance,\
|
||||
(WXHINSTANCE) hPrevInstance,\
|
||||
m_lpCmdLine, nCmdShow);\
|
||||
}
|
||||
#else
|
||||
#define IMPLEMENT_WXWIN_MAIN
|
||||
#endif
|
||||
|
||||
#ifdef __WXUNIVERSAL__
|
||||
#include "wx/univ/theme.h"
|
||||
|
||||
#define IMPLEMENT_WX_THEME_SUPPORT \
|
||||
WX_USE_THEME(win32); \
|
||||
WX_USE_THEME(gtk);
|
||||
#else
|
||||
#define IMPLEMENT_WX_THEME_SUPPORT
|
||||
#endif
|
||||
|
||||
// Use this macro if you want to define your own main() or WinMain() function
|
||||
// and call wxEntry() from there.
|
||||
#define IMPLEMENT_APP_NO_MAIN(appname) \
|
||||
wxApp *wxCreateApp() { return new appname; } \
|
||||
wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
|
||||
appname& wxGetApp() { return *(appname *)wxTheApp; }
|
||||
|
||||
// Same as IMPLEMENT_APP() normally but doesn't include themes support in
|
||||
// wxUniversal builds
|
||||
#define IMPLEMENT_APP_NO_THEMES(appname) \
|
||||
IMPLEMENT_APP_NO_MAIN(appname) \
|
||||
IMPLEMENT_WXWIN_MAIN
|
||||
|
||||
// Use this macro exactly once, the argument is the name of the wxApp-derived
|
||||
// class which is the class of your application.
|
||||
#define IMPLEMENT_APP(appname) \
|
||||
IMPLEMENT_APP_NO_THEMES(appname) \
|
||||
IMPLEMENT_WX_THEME_SUPPORT
|
||||
|
||||
// this macro can be used multiple times and just allows you to use wxGetApp()
|
||||
// function
|
||||
#define DECLARE_APP(appname) extern appname& wxGetApp();
|
||||
|
||||
#endif
|
||||
// _WX_APP_H_BASE_
|
175
include/wx/bitmap.h
Normal file
175
include/wx/bitmap.h
Normal file
@@ -0,0 +1,175 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/bitmap.h
|
||||
// Purpose: wxBitmap class interface
|
||||
// Author: Vaclav Slavik
|
||||
// Modified by:
|
||||
// Created: 22.04.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_BITMAP_H_BASE_
|
||||
#define _WX_BITMAP_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "bitmapbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/gdicmn.h" // for wxBitmapType
|
||||
|
||||
class WXDLLEXPORT wxBitmap;
|
||||
class WXDLLEXPORT wxBitmapHandler;
|
||||
class WXDLLEXPORT wxImage;
|
||||
class WXDLLEXPORT wxMask;
|
||||
class WXDLLEXPORT wxPalette;
|
||||
|
||||
#if defined(__WXMGL__) || defined(__WXMAC__)
|
||||
// Only used by some ports
|
||||
// FIXME -- make all ports (but MSW which uses wxGDIImage) use these base classes
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBitmapHandler: class which knows how to create/load/save bitmaps in
|
||||
// different formats
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxBitmapHandlerBase : public wxObject
|
||||
{
|
||||
public:
|
||||
wxBitmapHandlerBase()
|
||||
{
|
||||
m_type = wxBITMAP_TYPE_INVALID;
|
||||
}
|
||||
|
||||
virtual ~wxBitmapHandlerBase() { }
|
||||
|
||||
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
|
||||
int width, int height, int depth = 1) = 0;
|
||||
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||
int desiredWidth, int desiredHeight) = 0;
|
||||
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
|
||||
int type, const wxPalette *palette = NULL) = 0;
|
||||
|
||||
void SetName(const wxString& name) { m_name = name; }
|
||||
void SetExtension(const wxString& ext) { m_extension = ext; }
|
||||
void SetType(wxBitmapType type) { m_type = type; }
|
||||
wxString GetName() const { return m_name; }
|
||||
wxString GetExtension() const { return m_extension; }
|
||||
wxBitmapType GetType() const { return m_type; }
|
||||
|
||||
protected:
|
||||
wxString m_name;
|
||||
wxString m_extension;
|
||||
wxBitmapType m_type;
|
||||
|
||||
DECLARE_ABSTRACT_CLASS(wxBitmapHandlerBase)
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBitmapBase : public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxBitmapBase() : wxGDIObject() {}
|
||||
virtual ~wxBitmapBase() {}
|
||||
|
||||
/*
|
||||
Derived class must implement these:
|
||||
|
||||
wxBitmap();
|
||||
wxBitmap(int width, int height, int depth = -1);
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
wxBitmap(const char **bits);
|
||||
wxBitmap(char **bits);
|
||||
wxBitmap(const wxBitmap& bmp);
|
||||
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM);
|
||||
wxBitmap(const wxImage& image, int depth = -1);
|
||||
wxBitmap& operator = (const wxBitmap& bmp);
|
||||
bool operator == (const wxBitmap& bmp) const;
|
||||
bool operator != (const wxBitmap& bmp) const;
|
||||
|
||||
bool Create(int width, int height, int depth = -1);
|
||||
|
||||
static void InitStandardHandlers();
|
||||
*/
|
||||
|
||||
virtual bool Ok() const = 0;
|
||||
|
||||
virtual int GetHeight() const = 0;
|
||||
virtual int GetWidth() const = 0;
|
||||
virtual int GetDepth() const = 0;
|
||||
|
||||
virtual wxImage ConvertToImage() const = 0;
|
||||
|
||||
virtual wxMask *GetMask() const = 0;
|
||||
virtual void SetMask(wxMask *mask) = 0;
|
||||
|
||||
virtual wxBitmap GetSubBitmap(const wxRect& rect) const = 0;
|
||||
|
||||
virtual bool SaveFile(const wxString &name, wxBitmapType type,
|
||||
const wxPalette *palette = (wxPalette *)NULL) const = 0;
|
||||
virtual bool LoadFile(const wxString &name, wxBitmapType type) = 0;
|
||||
|
||||
virtual wxPalette *GetPalette() const = 0;
|
||||
virtual void SetPalette(const wxPalette& palette) = 0;
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
wxPalette *GetColourMap() const { return GetPalette(); }
|
||||
void SetColourMap(wxPalette *cmap) { SetPalette(*cmap); };
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
// copies the contents and mask of the given (colour) icon to the bitmap
|
||||
virtual bool CopyFromIcon(const wxIcon& icon) = 0;
|
||||
|
||||
// implementation:
|
||||
virtual void SetHeight(int height) = 0;
|
||||
virtual void SetWidth(int width) = 0;
|
||||
virtual void SetDepth(int depth) = 0;
|
||||
|
||||
// Format handling
|
||||
static inline wxList& GetHandlers() { return sm_handlers; }
|
||||
static void AddHandler(wxBitmapHandlerBase *handler);
|
||||
static void InsertHandler(wxBitmapHandlerBase *handler);
|
||||
static bool RemoveHandler(const wxString& name);
|
||||
static wxBitmapHandler *FindHandler(const wxString& name);
|
||||
static wxBitmapHandler *FindHandler(const wxString& extension, wxBitmapType bitmapType);
|
||||
static wxBitmapHandler *FindHandler(wxBitmapType bitmapType);
|
||||
|
||||
//static void InitStandardHandlers();
|
||||
// (wxBitmap must implement this one)
|
||||
|
||||
static void CleanUpHandlers();
|
||||
|
||||
protected:
|
||||
static wxList sm_handlers;
|
||||
|
||||
DECLARE_ABSTRACT_CLASS(wxBitmapBase)
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/bitmap.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/bitmap.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/bitmap.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/bitmap.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/bitmap.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/bitmap.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/bitmap.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/bitmap.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_BITMAP_H_BASE_
|
98
include/wx/bmpbuttn.h
Normal file
98
include/wx/bmpbuttn.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/bmpbutton.h
|
||||
// Purpose: wxBitmapButton class interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 25.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_BMPBUTTON_H_BASE_
|
||||
#define _WX_BMPBUTTON_H_BASE_
|
||||
|
||||
#if wxUSE_BMPBUTTON
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/button.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBitmapButton: a button which shows bitmaps instead of the usual string.
|
||||
// It has different bitmaps for different states (focused/disabled/pressed)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxBitmapButtonBase : public wxButton
|
||||
{
|
||||
public:
|
||||
wxBitmapButtonBase() { m_marginX = m_marginY = 0; }
|
||||
|
||||
// set the bitmaps
|
||||
void SetBitmapLabel(const wxBitmap& bitmap)
|
||||
{ m_bmpNormal = bitmap; OnSetBitmap(); }
|
||||
void SetBitmapSelected(const wxBitmap& sel)
|
||||
{ m_bmpSelected = sel; OnSetBitmap(); };
|
||||
void SetBitmapFocus(const wxBitmap& focus)
|
||||
{ m_bmpFocus = focus; OnSetBitmap(); };
|
||||
void SetBitmapDisabled(const wxBitmap& disabled)
|
||||
{ m_bmpDisabled = disabled; OnSetBitmap(); };
|
||||
void SetLabel(const wxBitmap& bitmap)
|
||||
{ SetBitmapLabel(bitmap); }
|
||||
|
||||
// retrieve the bitmaps
|
||||
const wxBitmap& GetBitmapLabel() const { return m_bmpNormal; }
|
||||
const wxBitmap& GetBitmapSelected() const { return m_bmpSelected; }
|
||||
const wxBitmap& GetBitmapFocus() const { return m_bmpFocus; }
|
||||
const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; }
|
||||
wxBitmap& GetBitmapLabel() { return m_bmpNormal; }
|
||||
wxBitmap& GetBitmapSelected() { return m_bmpSelected; }
|
||||
wxBitmap& GetBitmapFocus() { return m_bmpFocus; }
|
||||
wxBitmap& GetBitmapDisabled() { return m_bmpDisabled; }
|
||||
|
||||
// set/get the margins around the button
|
||||
virtual void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
|
||||
int GetMarginX() const { return m_marginX; }
|
||||
int GetMarginY() const { return m_marginY; }
|
||||
|
||||
protected:
|
||||
// function called when any of the bitmaps changes
|
||||
virtual void OnSetBitmap() { }
|
||||
|
||||
// the bitmaps for various states
|
||||
wxBitmap m_bmpNormal,
|
||||
m_bmpSelected,
|
||||
m_bmpFocus,
|
||||
m_bmpDisabled;
|
||||
|
||||
// the margins around the bitmap
|
||||
int m_marginX,
|
||||
m_marginY;
|
||||
private:
|
||||
// Prevent Virtual function hiding warnings
|
||||
void SetLabel(const wxString& rsLabel)
|
||||
{ wxWindowBase::SetLabel(rsLabel); }
|
||||
};
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/bmpbuttn.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/bmpbuttn.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/bmpbuttn.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/bmpbuttn.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/bmpbuttn.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/bmpbuttn.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/bmpbuttn.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/bmpbuttn.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_BMPBUTTON
|
||||
|
||||
#endif // _WX_BMPBUTTON_H_BASE_
|
23
include/wx/brush.h
Normal file
23
include/wx/brush.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_BRUSH_H_BASE_
|
||||
#define _WX_BRUSH_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/brush.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/brush.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/brush.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/brush.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/brush.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/brush.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/brush.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/brush.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_BRUSH_H_BASE_
|
82
include/wx/button.h
Normal file
82
include/wx/button.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/button.h
|
||||
// Purpose: wxButtonBase class
|
||||
// Author: Vadim Zetlin
|
||||
// Modified by:
|
||||
// Created: 15.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vadim Zetlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_BUTTON_H_BASE_
|
||||
#define _WX_BUTTON_H_BASE_
|
||||
|
||||
#if wxUSE_BUTTON
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxButton flags
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// all these flags are obsolete
|
||||
#define wxBU_NOAUTODRAW 0x0000
|
||||
#define wxBU_AUTODRAW 0x0004
|
||||
#define wxBU_LEFT 0x0040
|
||||
#define wxBU_TOP 0x0080
|
||||
#define wxBU_RIGHT 0x0100
|
||||
#define wxBU_BOTTOM 0x0200
|
||||
|
||||
// by default, the buttons will be created with some (system dependent)
|
||||
// minimal size to make them look nicer, giving this style will make them as
|
||||
// small as possible
|
||||
#define wxBU_EXACTFIT 0x0001
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
class WXDLLEXPORT wxBitmap;
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxButton: a push button
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxButtonBase : public wxControl
|
||||
{
|
||||
public:
|
||||
// show the image in the button in addition to the label
|
||||
virtual void SetImageLabel(const wxBitmap& WXUNUSED(bitmap)) { }
|
||||
|
||||
// set the margins around the image
|
||||
virtual void SetImageMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { }
|
||||
|
||||
// this wxButton method is called when the button becomes the default one
|
||||
// on its panel
|
||||
virtual void SetDefault() { }
|
||||
|
||||
// returns the default button size for this platform
|
||||
static wxSize GetDefaultSize();
|
||||
};
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/button.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/button.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/button.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/button.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/button.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/button.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/button.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/button.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_BUTTON
|
||||
|
||||
#endif
|
||||
// _WX_BUTTON_H_BASE_
|
56
include/wx/checkbox.h
Normal file
56
include/wx/checkbox.h
Normal file
@@ -0,0 +1,56 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/checkbox.h
|
||||
// Purpose: wxCheckBox class interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 07.09.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CHECKBOX_H_BASE_
|
||||
#define _WX_CHECKBOX_H_BASE_
|
||||
|
||||
#if wxUSE_CHECKBOX
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxCheckBoxNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxCheckBox: a control which shows a label and a box which may be checked
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxCheckBoxBase : public wxControl
|
||||
{
|
||||
public:
|
||||
// set/get the checked status of the listbox
|
||||
virtual void SetValue(bool value) = 0;
|
||||
virtual bool GetValue() const = 0;
|
||||
|
||||
bool IsChecked() const { return GetValue(); }
|
||||
};
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/checkbox.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/checkbox.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/checkbox.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/checkbox.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/checkbox.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/checkbox.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/checkbox.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/checkbox.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_CHECKBOX
|
||||
|
||||
#endif
|
||||
// _WX_CHECKBOX_H_BASE_
|
52
include/wx/checklst.h
Normal file
52
include/wx/checklst.h
Normal file
@@ -0,0 +1,52 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/checklst.h
|
||||
// Purpose: wxCheckListBox class interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 12.09.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CHECKLST_H_BASE_
|
||||
#define _WX_CHECKLST_H_BASE_
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
|
||||
#include "wx/listbox.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxCheckListBox: a listbox whose items may be checked
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxCheckListBoxBase : public wxListBox
|
||||
{
|
||||
public:
|
||||
// check list box specific methods
|
||||
virtual bool IsChecked(size_t item) const = 0;
|
||||
virtual void Check(size_t item, bool check = TRUE) = 0;
|
||||
};
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/checklst.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/checklst.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/checklst.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/checklst.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/checklst.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/checklst.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/checklst.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/checklst.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_CHECKLISTBOX
|
||||
|
||||
#endif
|
||||
// _WX_CHECKLST_H_BASE_
|
85
include/wx/choice.h
Normal file
85
include/wx/choice.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/choice.h
|
||||
// Purpose: wxChoice class interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 26.07.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CHOICE_H_BASE_
|
||||
#define _WX_CHOICE_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "choicebase.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_CHOICE
|
||||
|
||||
#include "wx/ctrlsub.h" // the base class
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxChoice allows to select one of a non-modifiable list of strings
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxChoiceBase : public wxControlWithItems
|
||||
{
|
||||
public:
|
||||
// all generic methods are in wxControlWithItems
|
||||
#ifdef __DARWIN__
|
||||
virtual ~wxChoiceBase() {}
|
||||
#endif
|
||||
|
||||
// single selection logic
|
||||
virtual void SetSelection(int n) = 0;
|
||||
virtual bool SetStringSelection(const wxString& s);
|
||||
|
||||
// don't override this
|
||||
virtual void Select(int n) { SetSelection(n); }
|
||||
|
||||
// set/get the number of columns in the control (as they're not supporte on
|
||||
// most platforms, they do nothing by default)
|
||||
virtual void SetColumns(int WXUNUSED(n) = 1 ) { }
|
||||
virtual int GetColumns() const { return 1 ; }
|
||||
|
||||
// emulate selecting the item event.GetInt()
|
||||
void Command(wxCommandEvent& event);
|
||||
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the platform-dependent class definition
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/choice.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/choice.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/choice.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/choice.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/choice.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/choice.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/choice.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_CHOICE
|
||||
|
||||
#endif
|
||||
// _WX_CHOICE_H_BASE_
|
142
include/wx/clipbrd.h
Normal file
142
include/wx/clipbrd.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/clipbrd.h
|
||||
// Purpose: wxClipboad class and clipboard functions
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 19.10.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows Team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CLIPBRD_H_BASE_
|
||||
#define _WX_CLIPBRD_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "clipboardbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/wxchar.h"
|
||||
|
||||
class WXDLLEXPORT wxDataFormat;
|
||||
class WXDLLEXPORT wxDataObject;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxClipboard represents the system clipboard. Normally, you should use
|
||||
// wxTheClipboard which is a global pointer to the (unique) clipboard.
|
||||
//
|
||||
// Clipboard can be used to copy data to/paste data from. It works together
|
||||
// with wxDataObject.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxClipboardBase : public wxObject
|
||||
{
|
||||
public:
|
||||
wxClipboardBase();
|
||||
|
||||
// open the clipboard before Add/SetData() and GetData()
|
||||
virtual bool Open() = 0;
|
||||
|
||||
// close the clipboard after Add/SetData() and GetData()
|
||||
virtual void Close() = 0;
|
||||
|
||||
// query whether the clipboard is opened
|
||||
virtual bool IsOpened() const = 0;
|
||||
|
||||
// add to the clipboard data
|
||||
//
|
||||
// NB: the clipboard owns the pointer and will delete it, so data must be
|
||||
// allocated on the heap
|
||||
virtual bool AddData( wxDataObject *data ) = 0;
|
||||
|
||||
// set the clipboard data, this is the same as Clear() followed by
|
||||
// AddData()
|
||||
virtual bool SetData( wxDataObject *data ) = 0;
|
||||
|
||||
// ask if data in correct format is available
|
||||
virtual bool IsSupported( const wxDataFormat& format ) = 0;
|
||||
|
||||
// fill data with data on the clipboard (if available)
|
||||
virtual bool GetData( wxDataObject& data ) = 0;
|
||||
|
||||
// clears wxTheClipboard and the system's clipboard if possible
|
||||
virtual void Clear() = 0;
|
||||
|
||||
// flushes the clipboard: this means that the data which is currently on
|
||||
// clipboard will stay available even after the application exits (possibly
|
||||
// eating memory), otherwise the clipboard will be emptied on exit
|
||||
virtual bool Flush() { return FALSE; }
|
||||
|
||||
// X11 has two clipboards which get selected by this call. Empty on MSW.
|
||||
virtual void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
|
||||
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include platform-specific class declaration
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/clipbrd.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/clipbrd.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/clipbrd.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/clipbrd.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/gtk/clipbrd.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/clipbrd.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/clipbrd.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/clipbrd.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// The global clipboard object
|
||||
WXDLLEXPORT_DATA(extern wxClipboard *) wxTheClipboard;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helpful class for opening the clipboard and automatically closing it
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxClipboardLocker
|
||||
{
|
||||
public:
|
||||
wxClipboardLocker(wxClipboard *clipboard = (wxClipboard *)NULL)
|
||||
{
|
||||
m_clipboard = clipboard ? clipboard : wxTheClipboard;
|
||||
if ( m_clipboard )
|
||||
{
|
||||
m_clipboard->Open();
|
||||
}
|
||||
}
|
||||
|
||||
bool operator!() const { return !m_clipboard->IsOpened(); }
|
||||
|
||||
~wxClipboardLocker()
|
||||
{
|
||||
if ( m_clipboard )
|
||||
{
|
||||
m_clipboard->Close();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
wxClipboard *m_clipboard;
|
||||
};
|
||||
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
#endif // _WX_CLIPBRD_H_BASE_
|
25
include/wx/colour.h
Normal file
25
include/wx/colour.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _WX_COLOUR_H_BASE_
|
||||
#define _WX_COLOUR_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/colour.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/colour.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/colour.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/colour.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/colour.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/colour.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/colour.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/colour.h"
|
||||
#endif
|
||||
|
||||
#define wxColor wxColour
|
||||
|
||||
#endif
|
||||
// _WX_COLOUR_H_BASE_
|
75
include/wx/combobox.h
Normal file
75
include/wx/combobox.h
Normal file
@@ -0,0 +1,75 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/combobox.h
|
||||
// Purpose: wxComboBox declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 24.12.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1996-2000 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COMBOBOX_H_BASE_
|
||||
#define _WX_COMBOBOX_H_BASE_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_COMBOBOX
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxComboBoxBase: this interface defines the methods wxComboBox must implement
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/ctrlsub.h"
|
||||
|
||||
class WXDLLEXPORT wxComboBoxBase : public wxItemContainer
|
||||
{
|
||||
public:
|
||||
// wxTextCtrl-like methods wxComboBox must implement
|
||||
virtual wxString GetValue() const = 0;
|
||||
virtual void SetValue(const wxString& value) = 0;
|
||||
|
||||
virtual void Copy() = 0;
|
||||
virtual void Cut() = 0;
|
||||
virtual void Paste() = 0;
|
||||
virtual void SetInsertionPoint(long pos) = 0;
|
||||
virtual long GetInsertionPoint() const = 0;
|
||||
virtual long GetLastPosition() const = 0;
|
||||
virtual void Replace(long from, long to, const wxString& value) = 0;
|
||||
virtual void SetSelection(long from, long to) = 0;
|
||||
virtual void SetEditable(bool editable) = 0;
|
||||
|
||||
virtual void SetInsertionPointEnd()
|
||||
{ SetInsertionPoint(GetLastPosition()); }
|
||||
virtual void Remove(long from, long to)
|
||||
{ Replace(from, to, wxEmptyString); }
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the platform-dependent header defining the real class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/combobox.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/combobox.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/combobox.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/combobox.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/combobox.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/combobox.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/combobox.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/combobox.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_COMBOBOX
|
||||
|
||||
#endif
|
||||
// _WX_COMBOBOX_H_BASE_
|
98
include/wx/control.h
Normal file
98
include/wx/control.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/control.h
|
||||
// Purpose: wxControl common interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 26.07.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CONTROL_H_BASE_
|
||||
#define _WX_CONTROL_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "controlbase.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_CONTROLS
|
||||
|
||||
#include "wx/window.h" // base class
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControl is the base class for all controls
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControlBase : public wxWindow
|
||||
{
|
||||
public:
|
||||
// Create() function adds the validator parameter
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxControlNameStr);
|
||||
|
||||
// simulates the event of given type (i.e. wxButton::Command() is just as
|
||||
// if the button was clicked)
|
||||
virtual void Command(wxCommandEvent &event);
|
||||
|
||||
// get the control alignment (left/right/centre, top/bottom/centre)
|
||||
int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }
|
||||
|
||||
#ifdef __DARWIN__
|
||||
virtual ~wxControlBase() { }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// creates the control (calls wxWindowBase::CreateBase inside) and adds it
|
||||
// to the list of parents children
|
||||
bool CreateControl(wxWindowBase *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name);
|
||||
|
||||
// inherit colour and font settings from the parent window
|
||||
void InheritAttributes();
|
||||
|
||||
// initialize the common fields of wxCommandEvent
|
||||
void InitCommandEvent(wxCommandEvent& event) const;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include platform-dependent wxControl declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/control.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/control.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/control.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/control.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/control.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/control.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/control.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/control.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_CONTROLS
|
||||
|
||||
#endif
|
||||
// _WX_CONTROL_H_BASE_
|
60
include/wx/cursor.h
Normal file
60
include/wx/cursor.h
Normal file
@@ -0,0 +1,60 @@
|
||||
#ifndef _WX_CURSOR_H_BASE_
|
||||
#define _WX_CURSOR_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/cursor.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/cursor.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/cursor.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/cursor.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/cursor.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/cursor.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/cursor.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/cursor.h"
|
||||
#endif
|
||||
|
||||
#include "wx/utils.h"
|
||||
|
||||
/* This is a small class which can be used by all ports
|
||||
to temporarily suspend the busy cursor. Useful in modal
|
||||
dialogs.
|
||||
|
||||
Actually that is not (any longer) quite true.. currently it is
|
||||
only used in wxGTK Dialog::ShowModal() and now uses static
|
||||
wxBusyCursor methods that are only implemented for wxGTK so far.
|
||||
The BusyCursor handling code should probably be implemented in
|
||||
common code somewhere instead of the separate implementations we
|
||||
currently have. Also the name BusyCursorSuspender is a little
|
||||
misleading since it doesn't actually suspend the BusyCursor, just
|
||||
masks one that is already showing.
|
||||
If another call to wxBeginBusyCursor is made while this is active
|
||||
the Busy Cursor will again be shown. But at least now it doesn't
|
||||
interfere with the state of wxIsBusy() -- RL
|
||||
|
||||
*/
|
||||
class wxBusyCursorSuspender
|
||||
{
|
||||
public:
|
||||
wxBusyCursorSuspender()
|
||||
{
|
||||
if( wxIsBusy() )
|
||||
{
|
||||
wxSetCursor( wxBusyCursor::GetStoredCursor() );
|
||||
}
|
||||
}
|
||||
~wxBusyCursorSuspender()
|
||||
{
|
||||
if( wxIsBusy() )
|
||||
{
|
||||
wxSetCursor( wxBusyCursor::GetBusyCursor() );
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
// _WX_CURSOR_H_BASE_
|
467
include/wx/dataobj.h
Normal file
467
include/wx/dataobj.h
Normal file
@@ -0,0 +1,467 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dataobj.h
|
||||
// Purpose: common data object classes
|
||||
// Author: Vadim Zeitlin, Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 26.05.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows Team
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DATAOBJ_H_BASE_
|
||||
#define _WX_DATAOBJ_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dataobjbase.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/list.h"
|
||||
|
||||
// ============================================================================
|
||||
/*
|
||||
Generic data transfer related classes. The class hierarchy is as follows:
|
||||
|
||||
- wxDataObject-
|
||||
/ \
|
||||
/ \
|
||||
wxDataObjectSimple wxDataObjectComposite
|
||||
/ | \
|
||||
/ | \
|
||||
wxTextDataObject | wxBitmapDataObject
|
||||
|
|
||||
wxCustomDataObject
|
||||
|
||||
*/
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataFormat class is declared in platform-specific headers: it represents
|
||||
// a format for data which may be either one of the standard ones (text,
|
||||
// bitmap, ...) or a custom one which is then identified by a unique string.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/* the class interface looks like this (pseudo code):
|
||||
|
||||
class wxDataFormat
|
||||
{
|
||||
public:
|
||||
typedef <integral type> NativeFormat;
|
||||
|
||||
wxDataFormat(NativeFormat format = wxDF_INVALID);
|
||||
wxDataFormat(const wxChar *format);
|
||||
|
||||
wxDataFormat& operator=(NativeFormat format);
|
||||
wxDataFormat& operator=(const wxDataFormat& format);
|
||||
|
||||
bool operator==(NativeFormat format) const;
|
||||
bool operator!=(NativeFormat format) const;
|
||||
|
||||
void SetType(NativeFormat format);
|
||||
NativeFormat GetType() const;
|
||||
|
||||
wxString GetId() const;
|
||||
void SetId(const wxChar *format);
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/ole/dataform.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dataform.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dataform.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dataform.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dataform.h"
|
||||
#endif
|
||||
|
||||
// the value for default argument to some functions (corresponds to
|
||||
// wxDF_INVALID)
|
||||
extern WXDLLEXPORT const wxDataFormat& wxFormatInvalid;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataObject represents a piece of data which knows which formats it
|
||||
// supports and knows how to render itself in each of them - GetDataHere(),
|
||||
// and how to restore data from the buffer (SetData()).
|
||||
//
|
||||
// Although this class may be used directly (i.e. custom classes may be
|
||||
// derived from it), in many cases it might be simpler to use either
|
||||
// wxDataObjectSimple or wxDataObjectComposite classes.
|
||||
//
|
||||
// A data object may be "read only", i.e. support only GetData() functions or
|
||||
// "read-write", i.e. support both GetData() and SetData() (in principle, it
|
||||
// might be "write only" too, but this is rare). Moreover, it doesn't have to
|
||||
// support the same formats in Get() and Set() directions: for example, a data
|
||||
// object containing JPEG image might accept BMPs in GetData() because JPEG
|
||||
// image may be easily transformed into BMP but not in SetData(). Accordingly,
|
||||
// all methods dealing with formats take an additional "direction" argument
|
||||
// which is either SET or GET and which tells the function if the format needs
|
||||
// to be supported by SetData() or GetDataHere().
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDataObjectBase
|
||||
{
|
||||
public:
|
||||
enum Direction
|
||||
{
|
||||
Get = 0x01, // format is supported by GetDataHere()
|
||||
Set = 0x02, // format is supported by SetData()
|
||||
Both = 0x03 // format is supported by both (unused currently)
|
||||
};
|
||||
|
||||
// this class is polymorphic, hence it needs a virtual dtor
|
||||
virtual ~wxDataObjectBase();
|
||||
|
||||
// get the best suited format for rendering our data
|
||||
virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const = 0;
|
||||
|
||||
// get the number of formats we support
|
||||
virtual size_t GetFormatCount(Direction dir = Get) const = 0;
|
||||
|
||||
// return all formats in the provided array (of size GetFormatCount())
|
||||
virtual void GetAllFormats(wxDataFormat *formats,
|
||||
Direction dir = Get) const = 0;
|
||||
|
||||
// get the (total) size of data for the given format
|
||||
virtual size_t GetDataSize(const wxDataFormat& format) const = 0;
|
||||
|
||||
// copy raw data (in the specified format) to the provided buffer, return
|
||||
// TRUE if data copied successfully, FALSE otherwise
|
||||
virtual bool GetDataHere(const wxDataFormat& format, void *buf) const = 0;
|
||||
|
||||
// get data from the buffer of specified length (in the given format),
|
||||
// return TRUE if the data was read successfully, FALSE otherwise
|
||||
virtual bool SetData(const wxDataFormat& WXUNUSED(format),
|
||||
size_t WXUNUSED(len), const void * WXUNUSED(buf))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// returns TRUE if this format is supported
|
||||
bool IsSupported(const wxDataFormat& format, Direction dir = Get) const;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the platform-specific declarations of wxDataObject
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/ole/dataobj.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dataobj.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dataobj.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dnd.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dataobj.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dataobj.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dnd.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataObjectSimple is a wxDataObject which only supports one format (in
|
||||
// both Get and Set directions, but you may return FALSE from GetDataHere() or
|
||||
// SetData() if one of them is not supported). This is the simplest possible
|
||||
// wxDataObject implementation.
|
||||
//
|
||||
// This is still an "abstract base class" (although it doesn't have any pure
|
||||
// virtual functions), to use it you should derive from it and implement
|
||||
// GetDataSize(), GetDataHere() and SetData() functions because the base class
|
||||
// versions don't do anything - they just return "not implemented".
|
||||
//
|
||||
// This class should be used when you provide data in only one format (no
|
||||
// conversion to/from other formats), either a standard or a custom one.
|
||||
// Otherwise, you should use wxDataObjectComposite or wxDataObject directly.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDataObjectSimple : public wxDataObject
|
||||
{
|
||||
public:
|
||||
// ctor takes the format we support, but it can also be set later with
|
||||
// SetFormat()
|
||||
wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid)
|
||||
: m_format(format)
|
||||
{
|
||||
}
|
||||
|
||||
// get/set the format we support
|
||||
const wxDataFormat& GetFormat() const { return m_format; }
|
||||
void SetFormat(const wxDataFormat& format) { m_format = format; }
|
||||
|
||||
// virtual functions to override in derived class (the base class versions
|
||||
// just return "not implemented")
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// get the size of our data
|
||||
virtual size_t GetDataSize() const
|
||||
{ return 0; }
|
||||
|
||||
// copy our data to the buffer
|
||||
virtual bool GetDataHere(void *WXUNUSED(buf)) const
|
||||
{ return FALSE; }
|
||||
|
||||
// copy data from buffer to our data
|
||||
virtual bool SetData(size_t WXUNUSED(len), const void *WXUNUSED(buf))
|
||||
{ return FALSE; }
|
||||
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const
|
||||
{ return m_format; }
|
||||
virtual size_t GetFormatCount(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const
|
||||
{ return 1; }
|
||||
virtual void GetAllFormats(wxDataFormat *formats,
|
||||
wxDataObjectBase::Direction WXUNUSED(dir) = Get) const
|
||||
{ *formats = m_format; }
|
||||
virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const
|
||||
{ return GetDataSize(); }
|
||||
virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format),
|
||||
void *buf) const
|
||||
{ return GetDataHere(buf); }
|
||||
virtual bool SetData(const wxDataFormat& WXUNUSED(format),
|
||||
size_t len, const void *buf)
|
||||
{ return SetData(len, buf); }
|
||||
|
||||
private:
|
||||
// the one and only format we support
|
||||
wxDataFormat m_format;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataObjectComposite is the simplest way to implement wxDataObject
|
||||
// supporting multiple formats. It contains several wxDataObjectSimple and
|
||||
// supports all formats supported by any of them.
|
||||
//
|
||||
// This class shouldn't be (normally) derived from, but may be used directly.
|
||||
// If you need more flexibility than what it provides, you should probably use
|
||||
// wxDataObject directly.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList);
|
||||
|
||||
class WXDLLEXPORT wxDataObjectComposite : public wxDataObject
|
||||
{
|
||||
public:
|
||||
// ctor
|
||||
wxDataObjectComposite() { m_preferred = 0; }
|
||||
|
||||
// add data object (it will be deleted by wxDataObjectComposite, hence it
|
||||
// must be allocated on the heap) whose format will become the preferred
|
||||
// one if preferred == TRUE
|
||||
void Add(wxDataObjectSimple *dataObject, bool preferred = FALSE);
|
||||
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const;
|
||||
virtual size_t GetFormatCount(wxDataObjectBase::Direction dir = Get) const;
|
||||
virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir = Get) const;
|
||||
virtual size_t GetDataSize(const wxDataFormat& format) const;
|
||||
virtual bool GetDataHere(const wxDataFormat& format, void *buf) const;
|
||||
virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf);
|
||||
|
||||
protected:
|
||||
// returns the pointer to the object which supports this format or NULL
|
||||
wxDataObjectSimple *GetObject(const wxDataFormat& format) const;
|
||||
|
||||
private:
|
||||
// the list of all (simple) data objects whose formats we support
|
||||
wxSimpleDataObjectList m_dataObjects;
|
||||
|
||||
// the index of the preferred one (0 initially, so by default the first
|
||||
// one is the preferred)
|
||||
size_t m_preferred;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// Standard implementations of wxDataObjectSimple which can be used directly
|
||||
// (i.e. without having to derive from them) for standard data type transfers.
|
||||
//
|
||||
// Note that although all of them can work with provided data, you can also
|
||||
// override their virtual GetXXX() functions to only provide data on demand.
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextDataObject contains text data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTextDataObject : public wxDataObjectSimple
|
||||
{
|
||||
public:
|
||||
// ctor: you can specify the text here or in SetText(), or override
|
||||
// GetText()
|
||||
wxTextDataObject(const wxString& text = wxEmptyString)
|
||||
: wxDataObjectSimple(wxDF_TEXT), m_text(text)
|
||||
{
|
||||
}
|
||||
|
||||
// virtual functions which you may override if you want to provide text on
|
||||
// demand only - otherwise, the trivial default versions will be used
|
||||
virtual size_t GetTextLength() const { return m_text.Len() + 1; }
|
||||
virtual wxString GetText() const { return m_text; }
|
||||
virtual void SetText(const wxString& text) { m_text = text; }
|
||||
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
virtual size_t GetDataSize() const;
|
||||
virtual bool GetDataHere(void *buf) const;
|
||||
virtual bool SetData(size_t len, const void *buf);
|
||||
|
||||
private:
|
||||
wxString m_text;
|
||||
|
||||
// virtual function hiding supression
|
||||
size_t GetDataSize(const wxDataFormat& format) const
|
||||
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||
bool GetDataHere(const wxDataFormat& format, void *pBuf) const
|
||||
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBitmapDataObject contains a bitmap
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxBitmapDataObjectBase : public wxDataObjectSimple
|
||||
{
|
||||
public:
|
||||
// ctor: you can specify the bitmap here or in SetBitmap(), or override
|
||||
// GetBitmap()
|
||||
wxBitmapDataObjectBase(const wxBitmap& bitmap = wxNullBitmap)
|
||||
: wxDataObjectSimple(wxDF_BITMAP), m_bitmap(bitmap)
|
||||
{
|
||||
}
|
||||
|
||||
// virtual functions which you may override if you want to provide data on
|
||||
// demand only - otherwise, the trivial default versions will be used
|
||||
virtual wxBitmap GetBitmap() const { return m_bitmap; }
|
||||
virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
|
||||
|
||||
protected:
|
||||
wxBitmap m_bitmap;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileDataObject contains a list of filenames
|
||||
//
|
||||
// NB: notice that this is a "write only" object, it can only be filled with
|
||||
// data from drag and drop operation.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFileDataObjectBase : public wxDataObjectSimple
|
||||
{
|
||||
public:
|
||||
// ctor: use AddFile() later to fill the array
|
||||
wxFileDataObjectBase() : wxDataObjectSimple(wxDF_FILENAME) { }
|
||||
|
||||
// get a reference to our array
|
||||
const wxArrayString& GetFilenames() const { return m_filenames; }
|
||||
|
||||
// the Get() functions do nothing for us
|
||||
virtual size_t GetDataSize() const { return 0; }
|
||||
virtual bool GetDataHere(void *WXUNUSED(buf)) const { return FALSE; }
|
||||
|
||||
protected:
|
||||
wxArrayString m_filenames;
|
||||
|
||||
private:
|
||||
// Virtual function hiding supression
|
||||
size_t GetDataSize(const wxDataFormat& format) const
|
||||
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxCustomDataObject contains arbitrary untyped user data.
|
||||
//
|
||||
// It is understood that this data can be copied bitwise.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxCustomDataObject : public wxDataObjectSimple
|
||||
{
|
||||
public:
|
||||
// if you don't specify the format in the ctor, you can still use
|
||||
// SetFormat() later
|
||||
wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid);
|
||||
|
||||
// the dtor calls Free()
|
||||
virtual ~wxCustomDataObject();
|
||||
|
||||
// you can call SetData() to set m_data: it will make a copy of the data
|
||||
// you pass - or you can use TakeData() which won't copy anything, but
|
||||
// will take ownership of data (i.e. will call Free() on it later)
|
||||
void TakeData(size_t size, void *data);
|
||||
|
||||
// this function is called to allocate "size" bytes of memory from
|
||||
// SetData(). The default version uses operator new[].
|
||||
virtual void *Alloc(size_t size);
|
||||
|
||||
// this function is called when the data is freed, you may override it to
|
||||
// anything you want (or may be nothing at all). The default version calls
|
||||
// operator delete[] on m_data
|
||||
virtual void Free();
|
||||
|
||||
// get data: you may override these functions if you wish to provide data
|
||||
// only when it's requested
|
||||
virtual size_t GetSize() const { return m_size; }
|
||||
virtual void *GetData() const { return m_data; }
|
||||
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
virtual size_t GetDataSize() const;
|
||||
virtual bool GetDataHere(void *buf) const;
|
||||
virtual bool SetData(size_t size, const void *buf);
|
||||
|
||||
private:
|
||||
size_t m_size;
|
||||
void *m_data;
|
||||
|
||||
// virtual function hiding supression
|
||||
size_t GetDataSize(const wxDataFormat& format) const
|
||||
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include platform-specific declarations of wxXXXBase classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/ole/dataobj2.h"
|
||||
|
||||
// wxURLDataObject defined in msw/ole/dataobj2.h
|
||||
#else // !__WXMSW__
|
||||
#if defined(__WXGTK__)
|
||||
#include "wx/gtk/dataobj2.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dataobj2.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dataobj2.h"
|
||||
#endif
|
||||
|
||||
// wxURLDataObject is simply wxTextDataObject with a different name
|
||||
class WXDLLEXPORT wxURLDataObject : public wxTextDataObject
|
||||
{
|
||||
public:
|
||||
wxString GetURL() const { return GetText(); }
|
||||
};
|
||||
#endif // __WXMSW__/!__WXMSW__
|
||||
|
||||
#endif // _WX_DATAOBJ_H_BASE_
|
812
include/wx/dc.h
Normal file
812
include/wx/dc.h
Normal file
@@ -0,0 +1,812 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dc.h
|
||||
// Purpose: wxDC class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 05/25/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DC_H_BASE_
|
||||
#define _WX_DC_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dcbase.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers which we must include here
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/object.h" // the base class
|
||||
|
||||
#include "wx/cursor.h" // we have member variables of these classes
|
||||
#include "wx/font.h" // so we can't do without them
|
||||
#include "wx/colour.h"
|
||||
#include "wx/brush.h"
|
||||
#include "wx/pen.h"
|
||||
#include "wx/palette.h"
|
||||
|
||||
#include "wx/list.h" // we use wxList in inline functions
|
||||
|
||||
class WXDLLEXPORT wxDCBase;
|
||||
|
||||
class WXDLLEXPORT wxDrawObject
|
||||
{
|
||||
public:
|
||||
|
||||
wxDrawObject()
|
||||
{
|
||||
ResetBoundingBox();
|
||||
}
|
||||
|
||||
virtual ~wxDrawObject() { }
|
||||
|
||||
virtual void Draw(wxDCBase&) const { }
|
||||
|
||||
virtual void CalcBoundingBox(wxCoord x, wxCoord y)
|
||||
{
|
||||
if ( m_isBBoxValid )
|
||||
{
|
||||
if ( x < m_minX ) m_minX = x;
|
||||
if ( y < m_minY ) m_minY = y;
|
||||
if ( x > m_maxX ) m_maxX = x;
|
||||
if ( y > m_maxY ) m_maxY = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isBBoxValid = TRUE;
|
||||
|
||||
m_minX = x;
|
||||
m_minY = y;
|
||||
m_maxX = x;
|
||||
m_maxY = y;
|
||||
}
|
||||
}
|
||||
|
||||
void ResetBoundingBox()
|
||||
{
|
||||
m_isBBoxValid = FALSE;
|
||||
|
||||
m_minX = m_maxX = m_minY = m_maxY = 0;
|
||||
}
|
||||
|
||||
// Get the final bounding box of the PostScript or Metafile picture.
|
||||
|
||||
wxCoord MinX() const { return m_minX; }
|
||||
wxCoord MaxX() const { return m_maxX; }
|
||||
wxCoord MinY() const { return m_minY; }
|
||||
wxCoord MaxY() const { return m_maxY; }
|
||||
|
||||
//to define the type of object for derived objects
|
||||
virtual int GetType()=0;
|
||||
|
||||
protected:
|
||||
//for boundingbox calculation
|
||||
bool m_isBBoxValid:1;
|
||||
//for boundingbox calculation
|
||||
wxCoord m_minX, m_minY, m_maxX, m_maxY;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern int) wxPageNumber;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxDC is the device context - object on which any drawing is done
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDCBase : public wxObject
|
||||
{
|
||||
public:
|
||||
wxDCBase()
|
||||
{
|
||||
m_clipping = FALSE;
|
||||
m_ok = TRUE;
|
||||
|
||||
ResetBoundingBox();
|
||||
|
||||
m_signX = m_signY = 1;
|
||||
|
||||
m_logicalOriginX = m_logicalOriginY =
|
||||
m_deviceOriginX = m_deviceOriginY = 0;
|
||||
|
||||
m_logicalScaleX = m_logicalScaleY =
|
||||
m_userScaleX = m_userScaleY =
|
||||
m_scaleX = m_scaleY = 1.0;
|
||||
|
||||
m_logicalFunction = wxCOPY;
|
||||
|
||||
m_backgroundMode = wxTRANSPARENT;
|
||||
|
||||
m_mappingMode = wxMM_TEXT;
|
||||
|
||||
m_backgroundBrush = *wxTRANSPARENT_BRUSH;
|
||||
|
||||
m_textForegroundColour = *wxBLACK;
|
||||
m_textBackgroundColour = *wxWHITE;
|
||||
|
||||
m_colour = wxColourDisplay();
|
||||
}
|
||||
|
||||
~wxDCBase() { }
|
||||
|
||||
virtual void BeginDrawing() { }
|
||||
virtual void EndDrawing() { }
|
||||
|
||||
// graphic primitives
|
||||
// ------------------
|
||||
|
||||
virtual void DrawObject(wxDrawObject* drawobject)
|
||||
{
|
||||
drawobject->Draw(*this);
|
||||
CalcBoundingBox(drawobject->MinX(),drawobject->MinY());
|
||||
CalcBoundingBox(drawobject->MaxX(),drawobject->MaxY());
|
||||
}
|
||||
|
||||
void FloodFill(wxCoord x, wxCoord y, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE)
|
||||
{ DoFloodFill(x, y, col, style); }
|
||||
void FloodFill(const wxPoint& pt, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE)
|
||||
{ DoFloodFill(pt.x, pt.y, col, style); }
|
||||
|
||||
bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const
|
||||
{ return DoGetPixel(x, y, col); }
|
||||
bool GetPixel(const wxPoint& pt, wxColour *col) const
|
||||
{ return DoGetPixel(pt.x, pt.y, col); }
|
||||
|
||||
void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
|
||||
{ DoDrawLine(x1, y1, x2, y2); }
|
||||
void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
|
||||
{ DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); }
|
||||
|
||||
void CrossHair(wxCoord x, wxCoord y)
|
||||
{ DoCrossHair(x, y); }
|
||||
void CrossHair(const wxPoint& pt)
|
||||
{ DoCrossHair(pt.x, pt.y); }
|
||||
|
||||
void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
|
||||
wxCoord xc, wxCoord yc)
|
||||
{ DoDrawArc(x1, y1, x2, y2, xc, yc); }
|
||||
void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
|
||||
{ DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); }
|
||||
|
||||
void DrawCheckMark(wxCoord x, wxCoord y,
|
||||
wxCoord width, wxCoord height)
|
||||
{ DoDrawCheckMark(x, y, width, height); }
|
||||
void DrawCheckMark(const wxRect& rect)
|
||||
{ DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); }
|
||||
|
||||
void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
|
||||
double sa, double ea)
|
||||
{ DoDrawEllipticArc(x, y, w, h, sa, ea); }
|
||||
void DrawEllipticArc(const wxPoint& pt, const wxSize& sz,
|
||||
double sa, double ea)
|
||||
{ DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); }
|
||||
|
||||
void DrawPoint(wxCoord x, wxCoord y)
|
||||
{ DoDrawPoint(x, y); }
|
||||
void DrawPoint(const wxPoint& pt)
|
||||
{ DoDrawPoint(pt.x, pt.y); }
|
||||
|
||||
void DrawLines(int n, wxPoint points[],
|
||||
wxCoord xoffset = 0, wxCoord yoffset = 0)
|
||||
{ DoDrawLines(n, points, xoffset, yoffset); }
|
||||
void DrawLines(const wxList *list,
|
||||
wxCoord xoffset = 0, wxCoord yoffset = 0);
|
||||
|
||||
void DrawPolygon(int n, wxPoint points[],
|
||||
wxCoord xoffset = 0, wxCoord yoffset = 0,
|
||||
int fillStyle = wxODDEVEN_RULE)
|
||||
{ DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
|
||||
|
||||
void DrawPolygon(const wxList *list,
|
||||
wxCoord xoffset = 0, wxCoord yoffset = 0,
|
||||
int fillStyle = wxODDEVEN_RULE);
|
||||
|
||||
void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||
{ DoDrawRectangle(x, y, width, height); }
|
||||
void DrawRectangle(const wxPoint& pt, const wxSize& sz)
|
||||
{ DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); }
|
||||
void DrawRectangle(const wxRect& rect)
|
||||
{ DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); }
|
||||
|
||||
void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height,
|
||||
double radius)
|
||||
{ DoDrawRoundedRectangle(x, y, width, height, radius); }
|
||||
void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz,
|
||||
double radius)
|
||||
{ DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); }
|
||||
void DrawRoundedRectangle(const wxRect& r, double radius)
|
||||
{ DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); }
|
||||
|
||||
void DrawCircle(wxCoord x, wxCoord y, wxCoord radius)
|
||||
{ DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); }
|
||||
void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||
{ DoDrawEllipse(x, y, width, height); }
|
||||
void DrawEllipse(const wxPoint& pt, const wxSize& sz)
|
||||
{ DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); }
|
||||
void DrawEllipse(const wxRect& rect)
|
||||
{ DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); }
|
||||
|
||||
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
|
||||
{ DoDrawIcon(icon, x, y); }
|
||||
void DrawIcon(const wxIcon& icon, const wxPoint& pt)
|
||||
{ DoDrawIcon(icon, pt.x, pt.y); }
|
||||
|
||||
void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
|
||||
bool useMask = FALSE)
|
||||
{ DoDrawBitmap(bmp, x, y, useMask); }
|
||||
void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt,
|
||||
bool useMask = FALSE)
|
||||
{ DoDrawBitmap(bmp, pt.x, pt.y, useMask); }
|
||||
|
||||
void DrawText(const wxString& text, wxCoord x, wxCoord y)
|
||||
{ DoDrawText(text, x, y); }
|
||||
void DrawText(const wxString& text, const wxPoint& pt)
|
||||
{ DoDrawText(text, pt.x, pt.y); }
|
||||
|
||||
void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
|
||||
{ DoDrawRotatedText(text, x, y, angle); }
|
||||
void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle)
|
||||
{ DoDrawRotatedText(text, pt.x, pt.y, angle); }
|
||||
|
||||
// this version puts both optional bitmap and the text into the given
|
||||
// rectangle and aligns is as specified by alignment parameter; it also
|
||||
// will emphasize the character with the given index if it is != -1 and
|
||||
// return the bounding rectangle if required
|
||||
virtual void DrawLabel(const wxString& text,
|
||||
const wxBitmap& image,
|
||||
const wxRect& rect,
|
||||
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
|
||||
int indexAccel = -1,
|
||||
wxRect *rectBounding = NULL);
|
||||
|
||||
void DrawLabel(const wxString& text, const wxRect& rect,
|
||||
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
|
||||
int indexAccel = -1)
|
||||
{ DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); }
|
||||
|
||||
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
||||
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
||||
int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1)
|
||||
{
|
||||
return DoBlit(xdest, ydest, width, height,
|
||||
source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask);
|
||||
}
|
||||
bool Blit(const wxPoint& destPt, const wxSize& sz,
|
||||
wxDC *source, const wxPoint& srcPt,
|
||||
int rop = wxCOPY, bool useMask = FALSE, const wxPoint& srcPtMask = wxPoint(-1, -1))
|
||||
{
|
||||
return DoBlit(destPt.x, destPt.y, sz.x, sz.y,
|
||||
source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y);
|
||||
}
|
||||
|
||||
#if wxUSE_SPLINES
|
||||
// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
|
||||
void DrawSpline(wxCoord x1, wxCoord y1,
|
||||
wxCoord x2, wxCoord y2,
|
||||
wxCoord x3, wxCoord y3);
|
||||
void DrawSpline(int n, wxPoint points[]);
|
||||
|
||||
void DrawSpline(wxList *points) { DoDrawSpline(points); }
|
||||
#endif // wxUSE_SPLINES
|
||||
|
||||
// global DC operations
|
||||
// --------------------
|
||||
|
||||
virtual void Clear() = 0;
|
||||
|
||||
virtual bool StartDoc(const wxString& WXUNUSED(message)) { return TRUE; }
|
||||
virtual void EndDoc() { }
|
||||
|
||||
virtual void StartPage() { }
|
||||
virtual void EndPage() { }
|
||||
|
||||
// set objects to use for drawing
|
||||
// ------------------------------
|
||||
|
||||
virtual void SetFont(const wxFont& font) = 0;
|
||||
virtual void SetPen(const wxPen& pen) = 0;
|
||||
virtual void SetBrush(const wxBrush& brush) = 0;
|
||||
virtual void SetBackground(const wxBrush& brush) = 0;
|
||||
virtual void SetBackgroundMode(int mode) = 0;
|
||||
virtual void SetPalette(const wxPalette& palette) = 0;
|
||||
|
||||
// clipping region
|
||||
// ---------------
|
||||
|
||||
void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||
{ DoSetClippingRegion(x, y, width, height); }
|
||||
void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
|
||||
{ DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); }
|
||||
void SetClippingRegion(const wxRect& rect)
|
||||
{ DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); }
|
||||
void SetClippingRegion(const wxRegion& region)
|
||||
{ DoSetClippingRegionAsRegion(region); }
|
||||
|
||||
virtual void DestroyClippingRegion() = 0;
|
||||
|
||||
void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
|
||||
{ DoGetClippingBox(x, y, w, h); }
|
||||
void GetClippingBox(wxRect& rect) const
|
||||
{
|
||||
// Necessary to use intermediate variables for 16-bit compilation
|
||||
wxCoord x, y, w, h;
|
||||
DoGetClippingBox(&x, &y, &w, &h);
|
||||
rect.x = x; rect.y = y; rect.width = w; rect.height = h;
|
||||
}
|
||||
|
||||
// text extent
|
||||
// -----------
|
||||
|
||||
virtual wxCoord GetCharHeight() const = 0;
|
||||
virtual wxCoord GetCharWidth() const = 0;
|
||||
|
||||
// only works for single line strings
|
||||
void GetTextExtent(const wxString& string,
|
||||
wxCoord *x, wxCoord *y,
|
||||
wxCoord *descent = NULL,
|
||||
wxCoord *externalLeading = NULL,
|
||||
wxFont *theFont = NULL) const
|
||||
{ DoGetTextExtent(string, x, y, descent, externalLeading, theFont); }
|
||||
|
||||
// works for single as well as multi-line strings
|
||||
virtual void GetMultiLineTextExtent(const wxString& text,
|
||||
wxCoord *width,
|
||||
wxCoord *height,
|
||||
wxCoord *heightLine = NULL,
|
||||
wxFont *font = NULL);
|
||||
|
||||
// size and resolution
|
||||
// -------------------
|
||||
|
||||
// in device units
|
||||
void GetSize(int *width, int *height) const
|
||||
{ DoGetSize(width, height); }
|
||||
wxSize GetSize() const
|
||||
{
|
||||
int w, h;
|
||||
DoGetSize(&w, &h);
|
||||
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
// in mm
|
||||
void GetSizeMM(int* width, int* height) const
|
||||
{ DoGetSizeMM(width, height); }
|
||||
wxSize GetSizeMM() const
|
||||
{
|
||||
int w, h;
|
||||
DoGetSizeMM(&w, &h);
|
||||
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
// coordinates conversions
|
||||
// -----------------------
|
||||
|
||||
// This group of functions does actual conversion of the input, as you'd
|
||||
// expect.
|
||||
wxCoord DeviceToLogicalX(wxCoord x) const;
|
||||
wxCoord DeviceToLogicalY(wxCoord y) const;
|
||||
wxCoord DeviceToLogicalXRel(wxCoord x) const;
|
||||
wxCoord DeviceToLogicalYRel(wxCoord y) const;
|
||||
wxCoord LogicalToDeviceX(wxCoord x) const;
|
||||
wxCoord LogicalToDeviceY(wxCoord y) const;
|
||||
wxCoord LogicalToDeviceXRel(wxCoord x) const;
|
||||
wxCoord LogicalToDeviceYRel(wxCoord y) const;
|
||||
|
||||
// query DC capabilities
|
||||
// ---------------------
|
||||
|
||||
virtual bool CanDrawBitmap() const = 0;
|
||||
virtual bool CanGetTextExtent() const = 0;
|
||||
|
||||
// colour depth
|
||||
virtual int GetDepth() const = 0;
|
||||
|
||||
// Resolution in Pixels per inch
|
||||
virtual wxSize GetPPI() const = 0;
|
||||
|
||||
virtual bool Ok() const { return m_ok; }
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// const...
|
||||
int GetBackgroundMode() const { return m_backgroundMode; }
|
||||
const wxBrush& GetBackground() const { return m_backgroundBrush; }
|
||||
const wxBrush& GetBrush() const { return m_brush; }
|
||||
const wxFont& GetFont() const { return m_font; }
|
||||
const wxPen& GetPen() const { return m_pen; }
|
||||
const wxColour& GetTextBackground() const { return m_textBackgroundColour; }
|
||||
const wxColour& GetTextForeground() const { return m_textForegroundColour; }
|
||||
|
||||
// ... and non const
|
||||
wxBrush& GetBackground() { return m_backgroundBrush; }
|
||||
wxBrush& GetBrush() { return m_brush; }
|
||||
wxFont& GetFont() { return m_font; }
|
||||
wxPen& GetPen() { return m_pen; }
|
||||
wxColour& GetTextBackground() { return m_textBackgroundColour; }
|
||||
wxColour& GetTextForeground() { return m_textForegroundColour; }
|
||||
|
||||
virtual void SetTextForeground(const wxColour& colour)
|
||||
{ m_textForegroundColour = colour; }
|
||||
virtual void SetTextBackground(const wxColour& colour)
|
||||
{ m_textBackgroundColour = colour; }
|
||||
|
||||
int GetMapMode() const { return m_mappingMode; }
|
||||
virtual void SetMapMode(int mode) = 0;
|
||||
|
||||
virtual void GetUserScale(double *x, double *y) const
|
||||
{
|
||||
if ( x ) *x = m_userScaleX;
|
||||
if ( y ) *y = m_userScaleY;
|
||||
}
|
||||
virtual void SetUserScale(double x, double y) = 0;
|
||||
|
||||
virtual void GetLogicalScale(double *x, double *y)
|
||||
{
|
||||
if ( x ) *x = m_logicalScaleX;
|
||||
if ( y ) *y = m_logicalScaleY;
|
||||
}
|
||||
virtual void SetLogicalScale(double x, double y)
|
||||
{
|
||||
m_logicalScaleX = x;
|
||||
m_logicalScaleY = y;
|
||||
}
|
||||
|
||||
void GetLogicalOrigin(wxCoord *x, wxCoord *y) const
|
||||
{ DoGetLogicalOrigin(x, y); }
|
||||
wxPoint GetLogicalOrigin() const
|
||||
{ wxCoord x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); }
|
||||
virtual void SetLogicalOrigin(wxCoord x, wxCoord y) = 0;
|
||||
|
||||
void GetDeviceOrigin(wxCoord *x, wxCoord *y) const
|
||||
{ DoGetDeviceOrigin(x, y); }
|
||||
wxPoint GetDeviceOrigin() const
|
||||
{ wxCoord x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); }
|
||||
virtual void SetDeviceOrigin(wxCoord x, wxCoord y) = 0;
|
||||
|
||||
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0;
|
||||
|
||||
int GetLogicalFunction() const { return m_logicalFunction; }
|
||||
virtual void SetLogicalFunction(int function) = 0;
|
||||
|
||||
// Sometimes we need to override optimization, e.g. if other software is
|
||||
// drawing onto our surface and we can't be sure of who's done what.
|
||||
//
|
||||
// FIXME: is this (still) used?
|
||||
virtual void SetOptimization(bool WXUNUSED(opt)) { }
|
||||
virtual bool GetOptimization() { return FALSE; }
|
||||
|
||||
// Some platforms have a DC cache, which should be cleared
|
||||
// at appropriate points such as after a series of DC operations.
|
||||
// Put ClearCache in the wxDC implementation class, since it has to be
|
||||
// static.
|
||||
// static void ClearCache() ;
|
||||
#if 0 // wxUSE_DC_CACHEING
|
||||
static void EnableCache(bool cacheing) { sm_cacheing = cacheing; }
|
||||
static bool CacheEnabled() { return sm_cacheing ; }
|
||||
#endif
|
||||
|
||||
// bounding box
|
||||
// ------------
|
||||
|
||||
virtual void CalcBoundingBox(wxCoord x, wxCoord y)
|
||||
{
|
||||
if ( m_isBBoxValid )
|
||||
{
|
||||
if ( x < m_minX ) m_minX = x;
|
||||
if ( y < m_minY ) m_minY = y;
|
||||
if ( x > m_maxX ) m_maxX = x;
|
||||
if ( y > m_maxY ) m_maxY = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isBBoxValid = TRUE;
|
||||
|
||||
m_minX = x;
|
||||
m_minY = y;
|
||||
m_maxX = x;
|
||||
m_maxY = y;
|
||||
}
|
||||
}
|
||||
|
||||
void ResetBoundingBox()
|
||||
{
|
||||
m_isBBoxValid = FALSE;
|
||||
|
||||
m_minX = m_maxX = m_minY = m_maxY = 0;
|
||||
}
|
||||
|
||||
// Get the final bounding box of the PostScript or Metafile picture.
|
||||
wxCoord MinX() const { return m_minX; }
|
||||
wxCoord MaxX() const { return m_maxX; }
|
||||
wxCoord MinY() const { return m_minY; }
|
||||
wxCoord MaxY() const { return m_maxY; }
|
||||
|
||||
// misc old functions
|
||||
// ------------------
|
||||
|
||||
// for compatibility with the old code when wxCoord was long everywhere
|
||||
#ifndef __WIN16__
|
||||
void GetTextExtent(const wxString& string,
|
||||
long *x, long *y,
|
||||
long *descent = NULL,
|
||||
long *externalLeading = NULL,
|
||||
wxFont *theFont = NULL) const
|
||||
{
|
||||
wxCoord x2, y2, descent2, externalLeading2;
|
||||
DoGetTextExtent(string, &x2, &y2,
|
||||
&descent2, &externalLeading2,
|
||||
theFont);
|
||||
if ( x )
|
||||
*x = x2;
|
||||
if ( y )
|
||||
*y = y2;
|
||||
if ( descent )
|
||||
*descent = descent2;
|
||||
if ( externalLeading )
|
||||
*externalLeading = externalLeading2;
|
||||
}
|
||||
|
||||
void GetLogicalOrigin(long *x, long *y) const
|
||||
{
|
||||
wxCoord x2, y2;
|
||||
DoGetLogicalOrigin(&x2, &y2);
|
||||
if ( x )
|
||||
*x = x2;
|
||||
if ( y )
|
||||
*y = y2;
|
||||
}
|
||||
|
||||
void GetDeviceOrigin(long *x, long *y) const
|
||||
{
|
||||
wxCoord x2, y2;
|
||||
DoGetDeviceOrigin(&x2, &y2);
|
||||
if ( x )
|
||||
*x = x2;
|
||||
if ( y )
|
||||
*y = y2;
|
||||
}
|
||||
void GetClippingBox(long *x, long *y, long *w, long *h) const
|
||||
{
|
||||
wxCoord xx,yy,ww,hh;
|
||||
DoGetClippingBox(&xx, &yy, &ww, &hh);
|
||||
if (x) *x = xx;
|
||||
if (y) *y = yy;
|
||||
if (w) *w = ww;
|
||||
if (h) *h = hh;
|
||||
}
|
||||
#endif // !Win16
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
virtual void SetColourMap(const wxPalette& palette) { SetPalette(palette); }
|
||||
void GetTextExtent(const wxString& string, float *x, float *y,
|
||||
float *descent = NULL, float *externalLeading = NULL,
|
||||
wxFont *theFont = NULL, bool use16bit = FALSE) const ;
|
||||
void GetSize(float* width, float* height) const { int w, h; GetSize(& w, & h); *width = w; *height = h; }
|
||||
void GetSizeMM(float *width, float *height) const { long w, h; GetSizeMM(& w, & h); *width = (float) w; *height = (float) h; }
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
protected:
|
||||
// the pure virtual functions which should be implemented by wxDC
|
||||
virtual void DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE) = 0;
|
||||
|
||||
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0;
|
||||
|
||||
virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0;
|
||||
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0;
|
||||
|
||||
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
|
||||
wxCoord x2, wxCoord y2,
|
||||
wxCoord xc, wxCoord yc) = 0;
|
||||
virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
|
||||
wxCoord width, wxCoord height);
|
||||
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
|
||||
double sa, double ea) = 0;
|
||||
|
||||
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0;
|
||||
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
|
||||
wxCoord width, wxCoord height,
|
||||
double radius) = 0;
|
||||
virtual void DoDrawEllipse(wxCoord x, wxCoord y,
|
||||
wxCoord width, wxCoord height) = 0;
|
||||
|
||||
virtual void DoCrossHair(wxCoord x, wxCoord y) = 0;
|
||||
|
||||
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0;
|
||||
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
|
||||
bool useMask = FALSE) = 0;
|
||||
|
||||
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0;
|
||||
virtual void DoDrawRotatedText(const wxString& text,
|
||||
wxCoord x, wxCoord y, double angle) = 0;
|
||||
|
||||
virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
|
||||
wxCoord width, wxCoord height,
|
||||
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
||||
int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1) = 0;
|
||||
|
||||
virtual void DoGetSize(int *width, int *height) const = 0;
|
||||
virtual void DoGetSizeMM(int* width, int* height) const = 0;
|
||||
|
||||
virtual void DoDrawLines(int n, wxPoint points[],
|
||||
wxCoord xoffset, wxCoord yoffset) = 0;
|
||||
virtual void DoDrawPolygon(int n, wxPoint points[],
|
||||
wxCoord xoffset, wxCoord yoffset,
|
||||
int fillStyle = wxODDEVEN_RULE) = 0;
|
||||
|
||||
virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0;
|
||||
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
|
||||
wxCoord width, wxCoord height) = 0;
|
||||
|
||||
// FIXME are these functions really different?
|
||||
virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y,
|
||||
wxCoord *w, wxCoord *h)
|
||||
{ DoGetClippingBox(x, y, w, h); }
|
||||
virtual void DoGetClippingBox(wxCoord *x, wxCoord *y,
|
||||
wxCoord *w, wxCoord *h) const
|
||||
{
|
||||
if ( m_clipping )
|
||||
{
|
||||
if ( x ) *x = m_clipX1;
|
||||
if ( y ) *y = m_clipY1;
|
||||
if ( w ) *w = m_clipX2 - m_clipX1;
|
||||
if ( h ) *h = m_clipY2 - m_clipY1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = *y = *w = *h = 0;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const
|
||||
{
|
||||
if ( x ) *x = m_logicalOriginX;
|
||||
if ( y ) *y = m_logicalOriginY;
|
||||
}
|
||||
|
||||
virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const
|
||||
{
|
||||
if ( x ) *x = m_deviceOriginX;
|
||||
if ( y ) *y = m_deviceOriginY;
|
||||
}
|
||||
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
wxCoord *x, wxCoord *y,
|
||||
wxCoord *descent = NULL,
|
||||
wxCoord *externalLeading = NULL,
|
||||
wxFont *theFont = NULL) const = 0;
|
||||
|
||||
#if wxUSE_SPLINES
|
||||
virtual void DoDrawSpline(wxList *points);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// flags
|
||||
bool m_colour:1;
|
||||
bool m_ok:1;
|
||||
bool m_clipping:1;
|
||||
bool m_isInteractive:1;
|
||||
bool m_isBBoxValid:1;
|
||||
#if wxUSE_DC_CACHEING
|
||||
// static bool sm_cacheing;
|
||||
#endif
|
||||
|
||||
// coordinate system variables
|
||||
|
||||
// TODO short descriptions of what exactly they are would be nice...
|
||||
|
||||
wxCoord m_logicalOriginX, m_logicalOriginY;
|
||||
wxCoord m_deviceOriginX, m_deviceOriginY;
|
||||
|
||||
double m_logicalScaleX, m_logicalScaleY;
|
||||
double m_userScaleX, m_userScaleY;
|
||||
double m_scaleX, m_scaleY;
|
||||
|
||||
// Used by SetAxisOrientation() to invert the axes
|
||||
int m_signX, m_signY;
|
||||
|
||||
// bounding and clipping boxes
|
||||
wxCoord m_minX, m_minY, m_maxX, m_maxY;
|
||||
wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2;
|
||||
|
||||
int m_logicalFunction;
|
||||
int m_backgroundMode;
|
||||
int m_mappingMode;
|
||||
|
||||
// GDI objects
|
||||
wxPen m_pen;
|
||||
wxBrush m_brush;
|
||||
wxBrush m_backgroundBrush;
|
||||
wxColour m_textForegroundColour;
|
||||
wxColour m_textBackgroundColour;
|
||||
wxFont m_font;
|
||||
wxPalette m_palette;
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxDCBase)
|
||||
DECLARE_ABSTRACT_CLASS(wxDCBase)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// now include the declaration of wxDC class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dc.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dc.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dc.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/dc.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dc.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dc.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dc.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dc.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helper class: you can use it to temporarily change the DC text colour and
|
||||
// restore it automatically when the object goes out of scope
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDCTextColourChanger
|
||||
{
|
||||
public:
|
||||
wxDCTextColourChanger(wxDC& dc) : m_dc(dc) { }
|
||||
|
||||
~wxDCTextColourChanger()
|
||||
{
|
||||
if ( m_colFgOld.Ok() )
|
||||
m_dc.SetTextForeground(m_colFgOld);
|
||||
}
|
||||
|
||||
void Set(const wxColour& col)
|
||||
{
|
||||
if ( !m_colFgOld.Ok() )
|
||||
m_colFgOld = m_dc.GetTextForeground();
|
||||
m_dc.SetTextForeground(col);
|
||||
}
|
||||
|
||||
private:
|
||||
wxDC& m_dc;
|
||||
|
||||
wxColour m_colFgOld;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// another small helper class: sets the clipping region in its ctor and
|
||||
// destroys it in the dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDCClipper
|
||||
{
|
||||
public:
|
||||
wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc)
|
||||
{ dc.SetClippingRegion(r.x, r.y, r.width, r.height); }
|
||||
wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc)
|
||||
{ dc.SetClippingRegion(x, y, w, h); }
|
||||
|
||||
~wxDCClipper() { m_dc.DestroyClippingRegion(); }
|
||||
|
||||
private:
|
||||
wxDC& m_dc;
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_DC_H_BASE_
|
23
include/wx/dcclient.h
Normal file
23
include/wx/dcclient.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_DCCLIENT_H_BASE_
|
||||
#define _WX_DCCLIENT_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dcclient.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dcclient.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dcclient.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/dcclient.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dcclient.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dcclient.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dcclient.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dcclient.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DCCLIENT_H_BASE_
|
23
include/wx/dcmemory.h
Normal file
23
include/wx/dcmemory.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_DCMEMORY_H_BASE_
|
||||
#define _WX_DCMEMORY_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dcmemory.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dcmemory.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dcmemory.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/dcmemory.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dcmemory.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dcmemory.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dcmemory.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dcmemory.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DCMEMORY_H_BASE_
|
23
include/wx/dcscreen.h
Normal file
23
include/wx/dcscreen.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_DCSCREEN_H_BASE_
|
||||
#define _WX_DCSCREEN_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dcscreen.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dcscreen.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dcscreen.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/dcscreen.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dcscreen.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dcscreen.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dcscreen.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dcscreen.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DCSCREEN_H_BASE_
|
21
include/wx/dde.h
Normal file
21
include/wx/dde.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_DDE_H_BASE_
|
||||
#define _WX_DDE_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dde.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dde.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dde.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dde.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dde.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dde.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dde.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DDE_H_BASE_
|
2094
include/wx/defs.h
Normal file
2094
include/wx/defs.h
Normal file
File diff suppressed because it is too large
Load Diff
69
include/wx/dialog.h
Normal file
69
include/wx/dialog.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dialog.h
|
||||
// Purpose: wxDialogBase class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 29.06.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DIALOG_H_BASE_
|
||||
#define _WX_DIALOG_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dialogbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
class WXDLLEXPORT wxDialogBase : public wxPanel
|
||||
{
|
||||
public:
|
||||
#ifdef __DARWIN__
|
||||
~wxDialogBase() { }
|
||||
#endif
|
||||
// the modal dialogs have a return code - usually the id of the last
|
||||
// pressed button
|
||||
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
|
||||
int GetReturnCode() const { return m_returnCode; }
|
||||
|
||||
#if wxUSE_STATTEXT && wxUSE_TEXTCTRL
|
||||
// splits text up at newlines and places the
|
||||
// lines into a vertical wxBoxSizer
|
||||
wxSizer *CreateTextSizer( const wxString &message );
|
||||
#endif // wxUSE_STATTEXT && wxUSE_TEXTCTRL
|
||||
|
||||
#if wxUSE_BUTTON
|
||||
// places buttons into a horizontal wxBoxSizer
|
||||
wxSizer *CreateButtonSizer( long flags );
|
||||
#endif // wxUSE_BUTTON
|
||||
|
||||
protected:
|
||||
// the return code from modal dialog
|
||||
int m_returnCode;
|
||||
};
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dialog.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dialog.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dialog.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/dialog.h"
|
||||
// FIXME_MGL -- belongs to wxUniv
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dialog.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dialog.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dialog.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dialog.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DIALOG_H_BASE_
|
41
include/wx/dirdlg.h
Normal file
41
include/wx/dirdlg.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _WX_DIRDLG_H_BASE_
|
||||
#define _WX_DIRDLG_H_BASE_
|
||||
|
||||
#if wxUSE_DIRDLG
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxDirDialogNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxDirDialogDefaultFolderStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#if defined(__WIN16__) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) || defined(__SALFORDC__)
|
||||
#include "wx/generic/dirdlgg.h"
|
||||
#else
|
||||
#include "wx/msw/dirdlg.h"
|
||||
#endif
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/generic/dirdlgg.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/dirdlgg.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dirdlg.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#ifdef __DARWIN__
|
||||
#include "wx/generic/dirdlgg.h"
|
||||
#else
|
||||
#include "wx/mac/dirdlg.h"
|
||||
#endif
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dirdlg.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dirdlg.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_DIRDLG
|
||||
|
||||
#endif
|
||||
// _WX_DIRDLG_H_BASE_
|
232
include/wx/dnd.h
Normal file
232
include/wx/dnd.h
Normal file
@@ -0,0 +1,232 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dnd.h
|
||||
// Purpose: Drag and drop classes declarations
|
||||
// Author: Vadim Zeitlin, Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 26.05.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows Team
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DND_H_BASE_
|
||||
#define _WX_DND_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dndbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
|
||||
#include "wx/dataobj.h"
|
||||
#include "wx/cursor.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// result of wxDropSource::DoDragDrop() call
|
||||
enum wxDragResult
|
||||
{
|
||||
wxDragError, // error prevented the d&d operation from completing
|
||||
wxDragNone, // drag target didn't accept the data
|
||||
wxDragCopy, // the data was successfully copied
|
||||
wxDragMove, // the data was successfully moved (MSW only)
|
||||
wxDragCancel // the operation was cancelled by user (not an error)
|
||||
};
|
||||
|
||||
inline WXDLLEXPORT bool wxIsDragResultOk(wxDragResult res)
|
||||
{
|
||||
return res == wxDragCopy || res == wxDragMove;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDropSource is the object you need to create (and call DoDragDrop on it)
|
||||
// to initiate a drag-and-drop operation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDropSourceBase
|
||||
{
|
||||
public:
|
||||
wxDropSourceBase(const wxCursor &cursorCopy = wxNullCursor,
|
||||
const wxCursor &cursorMove = wxNullCursor,
|
||||
const wxCursor &cursorStop = wxNullCursor)
|
||||
: m_cursorCopy(cursorCopy),
|
||||
m_cursorMove(cursorMove),
|
||||
m_cursorStop(cursorStop)
|
||||
{ m_data = (wxDataObject *)NULL; }
|
||||
virtual ~wxDropSourceBase() { }
|
||||
|
||||
// set the data which is transfered by drag and drop
|
||||
void SetData(wxDataObject& data)
|
||||
{ m_data = &data; }
|
||||
|
||||
wxDataObject *GetDataObject()
|
||||
{ return m_data; }
|
||||
|
||||
// set the icon corresponding to given drag result
|
||||
void SetCursor(wxDragResult res, const wxCursor& cursor)
|
||||
{
|
||||
if ( res == wxDragCopy )
|
||||
m_cursorCopy = cursor;
|
||||
else if ( res == wxDragMove )
|
||||
m_cursorMove = cursor;
|
||||
else
|
||||
m_cursorStop = cursor;
|
||||
}
|
||||
|
||||
// start drag action, see enum wxDragResult for return value description
|
||||
//
|
||||
// if bAllowMove is TRUE, data can be moved, if not - only copied
|
||||
virtual wxDragResult DoDragDrop(bool bAllowMove = FALSE) = 0;
|
||||
|
||||
// override to give feedback depending on the current operation result
|
||||
// "effect" and return TRUE if you did something, FALSE to let the library
|
||||
// give the default feedback
|
||||
virtual bool GiveFeedback(wxDragResult WXUNUSED(effect)) { return FALSE; }
|
||||
|
||||
protected:
|
||||
const wxCursor& GetCursor(wxDragResult res) const
|
||||
{
|
||||
if ( res == wxDragCopy )
|
||||
return m_cursorCopy;
|
||||
else if ( res == wxDragMove )
|
||||
return m_cursorMove;
|
||||
else
|
||||
return m_cursorStop;
|
||||
}
|
||||
|
||||
wxDataObject *m_data;
|
||||
|
||||
// the cursors to use for feedback
|
||||
wxCursor m_cursorCopy, m_cursorMove, m_cursorStop;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDropTarget should be associated with a window if it wants to be able to
|
||||
// receive data via drag and drop.
|
||||
//
|
||||
// To use this class, you should derive from wxDropTarget and implement
|
||||
// OnData() pure virtual method. You may also wish to override OnDrop() if you
|
||||
// want to accept the data only inside some region of the window (this may
|
||||
// avoid having to copy the data to this application which happens only when
|
||||
// OnData() is called)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDropTargetBase
|
||||
{
|
||||
public:
|
||||
// ctor takes a pointer to heap-allocated wxDataObject which will be owned
|
||||
// by wxDropTarget and deleted by it automatically. If you don't give it
|
||||
// here, you can use SetDataObject() later.
|
||||
wxDropTargetBase(wxDataObject *dataObject = (wxDataObject*)NULL)
|
||||
{ m_dataObject = dataObject; }
|
||||
// dtor deletes our data object
|
||||
virtual ~wxDropTargetBase()
|
||||
{ delete m_dataObject; }
|
||||
|
||||
// get/set the associated wxDataObject
|
||||
wxDataObject *GetDataObject() const
|
||||
{ return m_dataObject; }
|
||||
void SetDataObject(wxDataObject *dataObject)
|
||||
{ if (m_dataObject) delete m_dataObject;
|
||||
m_dataObject = dataObject; }
|
||||
|
||||
// these functions are called when data is moved over position (x, y) and
|
||||
// may return either wxDragCopy, wxDragMove or wxDragNone depending on
|
||||
// what would happen if the data were dropped here.
|
||||
//
|
||||
// the last parameter is what would happen by default and is determined by
|
||||
// the platform-specific logic (for example, under Windows it's wxDragCopy
|
||||
// if Ctrl key is pressed and wxDragMove otherwise) except that it will
|
||||
// always be wxDragNone if the carried data is in an unsupported format.
|
||||
|
||||
// called when the mouse enters the window (only once until OnLeave())
|
||||
virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def)
|
||||
{ return OnDragOver(x, y, def); }
|
||||
|
||||
// called when the mouse moves in the window - shouldn't take long to
|
||||
// execute or otherwise mouse movement would be too slow
|
||||
virtual wxDragResult OnDragOver(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
|
||||
wxDragResult def)
|
||||
{ return def; }
|
||||
|
||||
// called when mouse leaves the window: might be used to remove the
|
||||
// feedback which was given in OnEnter()
|
||||
virtual void OnLeave() { }
|
||||
|
||||
// this function is called when data is dropped at position (x, y) - if it
|
||||
// returns TRUE, OnData() will be called immediately afterwards which will
|
||||
// allow to retrieve the data dropped.
|
||||
virtual bool OnDrop(wxCoord x, wxCoord y) = 0;
|
||||
|
||||
// called after OnDrop() returns TRUE: you will usually just call
|
||||
// GetData() from here and, probably, also refresh something to update the
|
||||
// new data and, finally, return the code indicating how did the operation
|
||||
// complete (returning default value in case of success and wxDragError on
|
||||
// failure is usually ok)
|
||||
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) = 0;
|
||||
|
||||
// may be called *only* from inside OnData() and will fill m_dataObject
|
||||
// with the data from the drop source if it returns TRUE
|
||||
virtual bool GetData() = 0;
|
||||
|
||||
protected:
|
||||
wxDataObject *m_dataObject;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include platform dependent class declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/ole/dropsrc.h"
|
||||
#include "wx/msw/ole/droptgt.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dnd.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dnd.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dnd.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dnd.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dnd.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dnd.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// standard wxDropTarget implementations (implemented in common/dobjcmn.cpp)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// A simple wxDropTarget derived class for text data: you only need to
|
||||
// override OnDropText() to get something working
|
||||
class WXDLLEXPORT wxTextDropTarget : public wxDropTarget
|
||||
{
|
||||
public:
|
||||
wxTextDropTarget();
|
||||
|
||||
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0;
|
||||
|
||||
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
|
||||
};
|
||||
|
||||
// A drop target which accepts files (dragged from File Manager or Explorer)
|
||||
class WXDLLEXPORT wxFileDropTarget : public wxDropTarget
|
||||
{
|
||||
public:
|
||||
wxFileDropTarget();
|
||||
|
||||
// parameters are the number of files and the array of file names
|
||||
virtual bool OnDropFiles(wxCoord x, wxCoord y,
|
||||
const wxArrayString& filenames) = 0;
|
||||
|
||||
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
|
||||
};
|
||||
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
#endif // _WX_DND_H_BASE_
|
50
include/wx/dragimag.h
Normal file
50
include/wx/dragimag.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#ifndef _WX_DRAGIMAG_H_BASE_
|
||||
#define _WX_DRAGIMAG_H_BASE_
|
||||
|
||||
#if wxUSE_DRAGIMAGE
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#ifdef __WIN16__
|
||||
#include "wx/generic/dragimgg.h"
|
||||
#define wxDragImage wxGenericDragImage
|
||||
#define sm_classwxDragImage sm_classwxGenericDragImage
|
||||
|
||||
#else
|
||||
#include "wx/msw/dragimag.h"
|
||||
#endif
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/generic/dragimgg.h"
|
||||
#define wxDragImage wxGenericDragImage
|
||||
#define sm_classwxDragImage sm_classwxGenericDragImage
|
||||
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/dragimgg.h"
|
||||
#define wxDragImage wxGenericDragImage
|
||||
#define sm_classwxDragImage sm_classwxGenericDragImage
|
||||
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/generic/dragimgg.h"
|
||||
#define wxDragImage wxGenericDragImage
|
||||
#define sm_classwxDragImage sm_classwxGenericDragImage
|
||||
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/generic/dragimgg.h"
|
||||
#define wxDragImage wxGenericDragImage
|
||||
#define sm_classwxDragImage sm_classwxGenericDragImage
|
||||
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/generic/dragimgg.h"
|
||||
#define wxDragImage wxGenericDragImage
|
||||
#define sm_classwxDragImage sm_classwxGenericDragImage
|
||||
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/generic/dragimgg.h"
|
||||
#define wxDragImage wxGenericDragImage
|
||||
#define sm_classwxDragImage sm_classwxGenericDragImage
|
||||
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_DRAGIMAGE
|
||||
|
||||
#endif
|
||||
// _WX_DRAGIMAG_H_BASE_
|
40
include/wx/filedlg.h
Normal file
40
include/wx/filedlg.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef _WX_FILEDLG_H_BASE_
|
||||
#define _WX_FILEDLG_H_BASE_
|
||||
|
||||
#if wxUSE_FILEDLG
|
||||
|
||||
enum
|
||||
{
|
||||
wxOPEN = 0x0001,
|
||||
wxSAVE = 0x0002,
|
||||
wxOVERWRITE_PROMPT = 0x0004,
|
||||
wxHIDE_READONLY = 0x0008,
|
||||
wxFILE_MUST_EXIST = 0x0010,
|
||||
wxMULTIPLE = 0x0020,
|
||||
wxCHANGE_DIR = 0x0040
|
||||
};
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/filedlg.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/filedlg.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/filedlgg.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/filedlg.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#ifdef __DARWIN__
|
||||
#include "wx/generic/filedlgg.h"
|
||||
#else
|
||||
#include "wx/mac/filedlg.h"
|
||||
#endif
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/filedlg.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/filedlg.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_FILEDLG
|
||||
|
||||
#endif
|
||||
// _WX_FILEDLG_H_BASE_
|
183
include/wx/font.h
Normal file
183
include/wx/font.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/font.h
|
||||
// Purpose: wxFontBase class: the interface of wxFont
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 20.09.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_FONT_H_BASE_
|
||||
#define _WX_FONT_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "fontbase.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/defs.h" // for wxDEFAULT &c
|
||||
#include "wx/fontenc.h" // the font encoding constants
|
||||
#include "wx/gdiobj.h" // the base class
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFontData;
|
||||
class WXDLLEXPORT wxFontBase;
|
||||
class WXDLLEXPORT wxFont;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// font constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// standard font families
|
||||
enum wxFontFamily
|
||||
{
|
||||
wxFONTFAMILY_DEFAULT = wxDEFAULT,
|
||||
wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
|
||||
wxFONTFAMILY_ROMAN = wxROMAN,
|
||||
wxFONTFAMILY_SCRIPT = wxSCRIPT,
|
||||
wxFONTFAMILY_SWISS = wxSWISS,
|
||||
wxFONTFAMILY_MODERN = wxMODERN,
|
||||
wxFONTFAMILY_TELETYPE = wxTELETYPE,
|
||||
wxFONTFAMILY_MAX
|
||||
};
|
||||
|
||||
// font styles
|
||||
enum wxFontStyle
|
||||
{
|
||||
wxFONTSTYLE_NORMAL = wxNORMAL,
|
||||
wxFONTSTYLE_ITALIC = wxITALIC,
|
||||
wxFONTSTYLE_SLANT = wxSLANT,
|
||||
wxFONTSTYLE_MAX
|
||||
};
|
||||
|
||||
// font weights
|
||||
enum wxFontWeight
|
||||
{
|
||||
wxFONTWEIGHT_NORMAL = wxNORMAL,
|
||||
wxFONTWEIGHT_LIGHT = wxLIGHT,
|
||||
wxFONTWEIGHT_BOLD = wxBOLD,
|
||||
wxFONTWEIGHT_MAX
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFontBase represents a font object
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFontRefData;
|
||||
struct WXDLLEXPORT wxNativeFontInfo;
|
||||
|
||||
class WXDLLEXPORT wxFontBase : public wxGDIObject
|
||||
{
|
||||
public:
|
||||
// creator function
|
||||
#ifdef __DARWIN__
|
||||
virtual ~wxFontBase() { }
|
||||
#endif
|
||||
|
||||
// from the font components
|
||||
static wxFont *New(
|
||||
int pointSize, // size of the font in points
|
||||
int family, // see wxFontFamily enum
|
||||
int style, // see wxFontStyle enum
|
||||
int weight, // see wxFontWeight enum
|
||||
bool underlined = FALSE, // not underlined by default
|
||||
const wxString& face = wxEmptyString, // facename
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ...
|
||||
|
||||
// from the (opaque) native font description object
|
||||
static wxFont *New(const wxNativeFontInfo& nativeFontDesc);
|
||||
|
||||
// from the string representation of wxNativeFontInfo
|
||||
static wxFont *New(const wxString& strNativeFontDesc);
|
||||
|
||||
// was the font successfully created?
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
// comparison
|
||||
bool operator == (const wxFont& font) const;
|
||||
bool operator != (const wxFont& font) const;
|
||||
|
||||
// accessors: get the font characteristics
|
||||
virtual int GetPointSize() const = 0;
|
||||
virtual int GetFamily() const = 0;
|
||||
virtual int GetStyle() const = 0;
|
||||
virtual int GetWeight() const = 0;
|
||||
virtual bool GetUnderlined() const = 0;
|
||||
virtual wxString GetFaceName() const = 0;
|
||||
virtual wxFontEncoding GetEncoding() const = 0;
|
||||
virtual wxNativeFontInfo *GetNativeFontInfo() const;
|
||||
wxString GetNativeFontInfoDesc() const;
|
||||
|
||||
// change the font characteristics
|
||||
virtual void SetPointSize( int pointSize ) = 0;
|
||||
virtual void SetFamily( int family ) = 0;
|
||||
virtual void SetStyle( int style ) = 0;
|
||||
virtual void SetWeight( int weight ) = 0;
|
||||
virtual void SetFaceName( const wxString& faceName ) = 0;
|
||||
virtual void SetUnderlined( bool underlined ) = 0;
|
||||
virtual void SetEncoding(wxFontEncoding encoding) = 0;
|
||||
virtual void SetNativeFontInfo(const wxNativeFontInfo& info);
|
||||
|
||||
// VZ: there is no void SetNativeFontInfo(const wxString& info), needed?
|
||||
|
||||
// translate the fonts into human-readable string (i.e. GetStyleString()
|
||||
// will return "wxITALIC" for an italic font, ...)
|
||||
wxString GetFamilyString() const;
|
||||
wxString GetStyleString() const;
|
||||
wxString GetWeightString() const;
|
||||
|
||||
// the default encoding is used for creating all fonts with default
|
||||
// encoding parameter
|
||||
static wxFontEncoding GetDefaultEncoding()
|
||||
{ return ms_encodingDefault; }
|
||||
static void SetDefaultEncoding(wxFontEncoding encoding)
|
||||
{ ms_encodingDefault = encoding; }
|
||||
|
||||
protected:
|
||||
// get the internal data
|
||||
wxFontRefData *GetFontData() const
|
||||
{ return (wxFontRefData *)m_refData; }
|
||||
|
||||
private:
|
||||
// the currently default encoding: by default, it's the default system
|
||||
// encoding, but may be changed by the application using
|
||||
// SetDefaultEncoding() to make all subsequent fonts created without
|
||||
// specifing encoding parameter using this encoding
|
||||
static wxFontEncoding ms_encodingDefault;
|
||||
};
|
||||
|
||||
// include the real class declaration
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/font.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/font.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/font.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/font.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/font.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/font.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/font.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/font.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define M_FONTDATA GetFontData()
|
||||
|
||||
#endif
|
||||
// _WX_FONT_H_BASE_
|
102
include/wx/gauge.h
Normal file
102
include/wx/gauge.h
Normal file
@@ -0,0 +1,102 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gauge.h
|
||||
// Purpose: wxGauge interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 20.02.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1996-2001 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GAUGE_H_BASE_
|
||||
#define _WX_GAUGE_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "gaugebase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_GAUGE
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGauge: a progress bar
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxGaugeBase : public wxControl
|
||||
{
|
||||
public:
|
||||
#ifdef __DARWIN__
|
||||
virtual ~wxGaugeBase() { }
|
||||
#endif
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
int range,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxGA_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxGaugeNameStr);
|
||||
|
||||
// set/get the control range
|
||||
virtual void SetRange(int range);
|
||||
virtual int GetRange() const;
|
||||
|
||||
// position
|
||||
virtual void SetValue(int pos);
|
||||
virtual int GetValue() const;
|
||||
|
||||
// appearance params (not implemented for most ports)
|
||||
|
||||
virtual void SetShadowWidth(int w);
|
||||
virtual int GetShadowWidth() const;
|
||||
|
||||
virtual void SetBezelFace(int w);
|
||||
virtual int GetBezelFace() const;
|
||||
|
||||
// overriden base class virtuals
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
|
||||
protected:
|
||||
// the max position
|
||||
int m_rangeMax;
|
||||
|
||||
// the current position
|
||||
int m_gaugePos;
|
||||
};
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/gauge.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#ifdef __WIN95__
|
||||
#include "wx/msw/gauge95.h"
|
||||
#define wxGauge wxGauge95
|
||||
#define sm_classwxGauge sm_classwxGauge95
|
||||
#else // !__WIN95__
|
||||
#include "wx/msw/gaugemsw.h"
|
||||
#define wxGauge wxGaugeMSW
|
||||
#define sm_classwxGauge sm_classwxGaugeMSW
|
||||
#endif
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/gauge.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/gauge.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/gauge.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/gauge.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/gauge.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/gauge.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_GAUGE
|
||||
|
||||
#endif
|
||||
// _WX_GAUGE_H_BASE_
|
23
include/wx/gdiobj.h
Normal file
23
include/wx/gdiobj.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_GDIOBJ_H_BASE_
|
||||
#define _WX_GDIOBJ_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/gdiobj.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/gdiobj.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/gdiobj.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/gdiobj.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/gdiobj.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/gdiobj.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/gdiobj.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/gdiobj.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_GDIOBJ_H_BASE_
|
21
include/wx/glcanvas.h
Normal file
21
include/wx/glcanvas.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_GLCANVAS_H_BASE_
|
||||
#define _WX_GLCANVAS_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/glcanvas.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/glcanvas.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/glcanvas.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/glcanvas.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/glcanvas.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/glcanvas.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/glcanvas.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_GLCANVAS_H_BASE_
|
29
include/wx/icon.h
Normal file
29
include/wx/icon.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef _WX_ICON_H_BASE_
|
||||
#define _WX_ICON_H_BASE_
|
||||
|
||||
/* Commenting out since duplicated in gdicmn.h
|
||||
// this is for Unix (i.e. now for anything other than MSW)
|
||||
#undef wxICON
|
||||
#define wxICON(icon_name) wxIcon(icon_name##_xpm)
|
||||
*/
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/icon.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/icon.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/icon.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/icon.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/icon.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/icon.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/icon.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/icon.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_ICON_H_BASE_
|
149
include/wx/listbox.h
Normal file
149
include/wx/listbox.h
Normal file
@@ -0,0 +1,149 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/listbox.h
|
||||
// Purpose: wxListBox class interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 22.10.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_LISTBOX_H_BASE_
|
||||
#define _WX_LISTBOX_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "listboxbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_LISTBOX
|
||||
|
||||
#include "wx/ctrlsub.h" // base class
|
||||
|
||||
// forward declarations are enough here
|
||||
class WXDLLEXPORT wxArrayInt;
|
||||
class WXDLLEXPORT wxArrayString;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxListBoxNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxListBox interface is defined by the class wxListBoxBase
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListBoxBase : public wxControlWithItems
|
||||
{
|
||||
public:
|
||||
// all generic methods are in wxControlWithItems, except for the following
|
||||
// ones which are not yet implemented by wxChoice/wxCombobox
|
||||
#ifdef __DARWIN__
|
||||
virtual ~wxListBoxBase() { }
|
||||
#endif
|
||||
|
||||
void Insert(const wxString& item, int pos)
|
||||
{ DoInsert(item, pos); }
|
||||
void Insert(const wxString& item, int pos, void *clientData)
|
||||
{ DoInsert(item, pos); SetClientData(pos, clientData); }
|
||||
void Insert(const wxString& item, int pos, wxClientData *clientData)
|
||||
{ DoInsert(item, pos); SetClientObject(pos, clientData); }
|
||||
|
||||
void InsertItems(int nItems, const wxString *items, int pos);
|
||||
void InsertItems(const wxArrayString& items, int pos)
|
||||
{ DoInsertItems(items, pos); }
|
||||
|
||||
void Set(int n, const wxString* items, void **clientData = NULL);
|
||||
void Set(const wxArrayString& items, void **clientData = NULL)
|
||||
{ DoSetItems(items, clientData); }
|
||||
|
||||
// multiple selection logic
|
||||
virtual bool IsSelected(int n) const = 0;
|
||||
virtual void SetSelection(int n, bool select = TRUE) = 0;
|
||||
virtual void Select(int n) { SetSelection(n, TRUE); }
|
||||
void Deselect(int n) { SetSelection(n, FALSE); }
|
||||
void DeselectAll(int itemToLeaveSelected = -1);
|
||||
|
||||
virtual bool SetStringSelection(const wxString& s, bool select = TRUE);
|
||||
|
||||
// works for single as well as multiple selection listboxes (unlike
|
||||
// GetSelection which only works for listboxes with single selection)
|
||||
virtual int GetSelections(wxArrayInt& aSelections) const = 0;
|
||||
|
||||
// set the specified item at the first visible item or scroll to max
|
||||
// range.
|
||||
void SetFirstItem(int n) { DoSetFirstItem(n); }
|
||||
void SetFirstItem(const wxString& s);
|
||||
|
||||
// ensures that the given item is visible scrolling the listbox if
|
||||
// necessary
|
||||
virtual void EnsureVisible(int n);
|
||||
|
||||
// a combination of Append() and EnsureVisible(): appends the item to the
|
||||
// listbox and ensures that it is visible i.e. not scrolled out of view
|
||||
void AppendAndEnsureVisible(const wxString& s);
|
||||
|
||||
// return TRUE if the listbox allows multiple selection
|
||||
bool HasMultipleSelection() const
|
||||
{
|
||||
return (m_windowStyle & wxLB_MULTIPLE) ||
|
||||
(m_windowStyle & wxLB_EXTENDED);
|
||||
}
|
||||
|
||||
// return TRUE if this listbox is sorted
|
||||
bool IsSorted() const { return (m_windowStyle & wxLB_SORT) != 0; }
|
||||
|
||||
// emulate selecting or deselecting the item event.GetInt() (depending on
|
||||
// event.GetExtraLong())
|
||||
void Command(wxCommandEvent& event);
|
||||
|
||||
// compatibility - these functions are deprecated, use the new ones
|
||||
// instead
|
||||
bool Selected(int n) const { return IsSelected(n); }
|
||||
|
||||
protected:
|
||||
// NB: due to wxGTK implementation details, DoInsert() is implemented
|
||||
// using DoInsertItems() and not the other way round
|
||||
void DoInsert(const wxString& item, int pos)
|
||||
{ InsertItems(1, &item, pos); }
|
||||
|
||||
// to be implemented in derived classes
|
||||
virtual void DoInsertItems(const wxArrayString& items, int pos) = 0;
|
||||
virtual void DoSetItems(const wxArrayString& items, void **clientData) = 0;
|
||||
|
||||
virtual void DoSetFirstItem(int n) = 0;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the platform-specific class declaration
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/listbox.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/listbox.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/listbox.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/listbox.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/listbox.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/listbox.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/listbox.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/listbox.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_LISTBOX
|
||||
|
||||
#endif
|
||||
// _WX_LISTBOX_H_BASE_
|
21
include/wx/mdi.h
Normal file
21
include/wx/mdi.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_MDI_H_BASE_
|
||||
#define _WX_MDI_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/mdi.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/mdi.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/mdi.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/mdi.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/mdi.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/mdi.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/mdi.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_MDI_H_BASE_
|
468
include/wx/menu.h
Normal file
468
include/wx/menu.h
Normal file
@@ -0,0 +1,468 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/menu.h
|
||||
// Purpose: wxMenu and wxMenuBar classes
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 26.10.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MENU_H_BASE_
|
||||
#define _WX_MENU_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "menubase.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_MENUS
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/list.h" // for "template" list classes
|
||||
#include "wx/window.h" // base class for wxMenuBar
|
||||
|
||||
// also include this one to ensure compatibility with old code which only
|
||||
// included wx/menu.h
|
||||
#include "wx/menuitem.h"
|
||||
|
||||
class WXDLLEXPORT wxMenu;
|
||||
class WXDLLEXPORT wxMenuBarBase;
|
||||
class WXDLLEXPORT wxMenuBar;
|
||||
class WXDLLEXPORT wxMenuItem;
|
||||
|
||||
// pseudo template list classes
|
||||
WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList);
|
||||
WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// conditional compilation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// having callbacks in menus is a wxWin 1.6x feature which should be replaced
|
||||
// with event tables in wxWin 2.xx code - however provide it because many
|
||||
// people like it a lot by default
|
||||
#ifndef wxUSE_MENU_CALLBACK
|
||||
#if WXWIN_COMPATIBILITY_2
|
||||
#define wxUSE_MENU_CALLBACK 1
|
||||
#else
|
||||
#define wxUSE_MENU_CALLBACK 0
|
||||
#endif // WXWIN_COMPATIBILITY_2
|
||||
#endif // !defined(wxUSE_MENU_CALLBACK)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxMenuBase : public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
// create a menu
|
||||
static wxMenu *New(const wxString& title = wxEmptyString, long style = 0);
|
||||
|
||||
// ctors
|
||||
wxMenuBase(const wxString& title, long style = 0) : m_title(title)
|
||||
{ Init(style); }
|
||||
wxMenuBase(long style = 0)
|
||||
{ Init(style); }
|
||||
|
||||
// dtor deletes all the menu items we own
|
||||
virtual ~wxMenuBase();
|
||||
|
||||
// menu construction
|
||||
// -----------------
|
||||
|
||||
// append a normal item to the menu
|
||||
void Append(int id,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString,
|
||||
bool isCheckable = FALSE)
|
||||
{
|
||||
DoAppend(wxMenuItem::New((wxMenu *)this, id, text, help, isCheckable));
|
||||
}
|
||||
|
||||
// append a separator to the menu
|
||||
void AppendSeparator() { Append(wxID_SEPARATOR, wxEmptyString); }
|
||||
|
||||
// append a submenu
|
||||
void Append(int id,
|
||||
const wxString& text,
|
||||
wxMenu *submenu,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
DoAppend(wxMenuItem::New((wxMenu *)this, id, text, help, FALSE, submenu));
|
||||
}
|
||||
|
||||
// the most generic form of Append() - append anything
|
||||
void Append(wxMenuItem *item) { DoAppend(item); }
|
||||
|
||||
// insert a break in the menu (only works when appending the items, not
|
||||
// inserting them)
|
||||
virtual void Break() { }
|
||||
|
||||
// insert an item before given position
|
||||
bool Insert(size_t pos, wxMenuItem *item);
|
||||
void Insert(size_t pos,
|
||||
int id,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString,
|
||||
bool isCheckable = FALSE)
|
||||
{
|
||||
Insert(pos, wxMenuItem::New((wxMenu *)this, id, text, help, isCheckable));
|
||||
}
|
||||
|
||||
// insert a separator
|
||||
void InsertSeparator(size_t pos)
|
||||
{
|
||||
Insert(pos, wxMenuItem::New((wxMenu *)this));
|
||||
}
|
||||
|
||||
// insert a submenu
|
||||
void Insert(size_t pos,
|
||||
int id,
|
||||
const wxString& text,
|
||||
wxMenu *submenu,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
Insert(pos, wxMenuItem::New((wxMenu *)this, id, text, help, FALSE, submenu));
|
||||
}
|
||||
|
||||
// prepend an item to the menu
|
||||
void Prepend(wxMenuItem *item)
|
||||
{
|
||||
Insert(0u, item);
|
||||
}
|
||||
|
||||
void Prepend(int id,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString,
|
||||
bool isCheckable = FALSE)
|
||||
{
|
||||
Insert(0u, id, text, help, isCheckable);
|
||||
}
|
||||
|
||||
// insert a separator
|
||||
void PrependSeparator()
|
||||
{
|
||||
InsertSeparator(0u);
|
||||
}
|
||||
|
||||
// insert a submenu
|
||||
void Prepend(int id,
|
||||
const wxString& text,
|
||||
wxMenu *submenu,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
Insert(0u, id, text, submenu, help);
|
||||
}
|
||||
|
||||
// detach an item from the menu, but don't delete it so that it can be
|
||||
// added back later (but if it's not, the caller is responsible for
|
||||
// deleting it!)
|
||||
wxMenuItem *Remove(int id) { return Remove(FindChildItem(id)); }
|
||||
wxMenuItem *Remove(wxMenuItem *item);
|
||||
|
||||
// delete an item from the menu (submenus are not destroyed by this
|
||||
// function, see Destroy)
|
||||
bool Delete(int id) { return Delete(FindChildItem(id)); }
|
||||
bool Delete(wxMenuItem *item);
|
||||
|
||||
// delete the item from menu and destroy it (if it's a submenu)
|
||||
bool Destroy(int id) { return Destroy(FindChildItem(id)); }
|
||||
bool Destroy(wxMenuItem *item);
|
||||
|
||||
// menu items access
|
||||
// -----------------
|
||||
|
||||
// get the items
|
||||
size_t GetMenuItemCount() const { return m_items.GetCount(); }
|
||||
|
||||
const wxMenuItemList& GetMenuItems() const { return m_items; }
|
||||
wxMenuItemList& GetMenuItems() { return m_items; }
|
||||
|
||||
// search
|
||||
virtual int FindItem(const wxString& item) const;
|
||||
wxMenuItem* FindItem(int id, wxMenu **menu = NULL) const;
|
||||
|
||||
// get/set items attributes
|
||||
void Enable(int id, bool enable);
|
||||
bool IsEnabled(int id) const;
|
||||
|
||||
void Check(int id, bool check);
|
||||
bool IsChecked(int id) const;
|
||||
|
||||
void SetLabel(int id, const wxString& label);
|
||||
wxString GetLabel(int id) const;
|
||||
|
||||
virtual void SetHelpString(int id, const wxString& helpString);
|
||||
virtual wxString GetHelpString(int id) const;
|
||||
|
||||
// misc accessors
|
||||
// --------------
|
||||
|
||||
// the title
|
||||
virtual void SetTitle(const wxString& title) { m_title = title; }
|
||||
const wxString GetTitle() const { return m_title; }
|
||||
|
||||
// client data
|
||||
void SetClientData(void* clientData) { m_clientData = clientData; }
|
||||
void* GetClientData() const { return m_clientData; }
|
||||
|
||||
// event handler
|
||||
void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
|
||||
wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
|
||||
|
||||
// invoking window
|
||||
void SetInvokingWindow(wxWindow *win) { m_invokingWindow = win; }
|
||||
wxWindow *GetInvokingWindow() const { return m_invokingWindow; }
|
||||
|
||||
// style
|
||||
long GetStyle() const { return m_style; }
|
||||
|
||||
// implementation helpers
|
||||
// ----------------------
|
||||
|
||||
// Updates the UI for a menu and all submenus recursively. source is the
|
||||
// object that has the update event handlers defined for it. If NULL, the
|
||||
// menu or associated window will be used.
|
||||
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*)NULL);
|
||||
|
||||
// get the menu bar this menu is attached to (may be NULL, always NULL for
|
||||
// popup menus)
|
||||
wxMenuBar *GetMenuBar() const { return m_menuBar; }
|
||||
|
||||
// called when the menu is attached/detached to/from a menu bar
|
||||
virtual void Attach(wxMenuBarBase *menubar);
|
||||
virtual void Detach();
|
||||
|
||||
// is the menu attached to a menu bar (or is it a popup one)?
|
||||
bool IsAttached() const { return m_menuBar != NULL; }
|
||||
|
||||
// set/get the parent of this menu
|
||||
void SetParent(wxMenu *parent) { m_menuParent = parent; }
|
||||
wxMenu *GetParent() const { return m_menuParent; }
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
// compatibility: these functions are deprecated, use the new ones instead
|
||||
bool Enabled(int id) const { return IsEnabled(id); }
|
||||
bool Checked(int id) const { return IsChecked(id); }
|
||||
|
||||
wxMenuItem* FindItemForId(int itemId, wxMenu **itemMenu) const
|
||||
{ return FindItem(itemId, itemMenu); }
|
||||
|
||||
wxList& GetItems() const { return (wxList &)m_items; }
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
#if wxUSE_MENU_CALLBACK || defined(__WXMOTIF__)
|
||||
// wxWin 1.6x compatible menu event handling
|
||||
wxFunction GetCallback() const { return m_callback; }
|
||||
void Callback(const wxFunction func) { m_callback = func; }
|
||||
|
||||
wxFunction m_callback;
|
||||
#endif // wxUSE_MENU_CALLBACK
|
||||
|
||||
// unlike FindItem(), this function doesn't recurse but only looks through
|
||||
// our direct children and also may return the index of the found child if
|
||||
// pos != NULL
|
||||
wxMenuItem *FindChildItem(int id, size_t *pos = NULL) const;
|
||||
|
||||
// called to generate a wxCommandEvent, return TRUE if it was processed,
|
||||
// FALSE otherwise
|
||||
//
|
||||
// the checked parameter may have boolean value or -1 for uncheckable items
|
||||
bool SendEvent(int id, int checked = -1);
|
||||
|
||||
protected:
|
||||
// virtuals to override in derived classes
|
||||
// ---------------------------------------
|
||||
|
||||
virtual bool DoAppend(wxMenuItem *item);
|
||||
virtual bool DoInsert(size_t pos, wxMenuItem *item);
|
||||
|
||||
virtual wxMenuItem *DoRemove(wxMenuItem *item);
|
||||
virtual bool DoDelete(wxMenuItem *item);
|
||||
virtual bool DoDestroy(wxMenuItem *item);
|
||||
|
||||
// helpers
|
||||
// -------
|
||||
|
||||
// common part of all ctors
|
||||
void Init(long style);
|
||||
|
||||
// associate the submenu with this menu
|
||||
void AddSubMenu(wxMenu *submenu);
|
||||
|
||||
wxMenuBar *m_menuBar; // menubar we belong to or NULL
|
||||
wxMenu *m_menuParent; // parent menu or NULL
|
||||
|
||||
wxString m_title; // the menu title or label
|
||||
wxMenuItemList m_items; // the list of menu items
|
||||
|
||||
wxWindow *m_invokingWindow; // for popup menus
|
||||
void *m_clientData; // associated with the menu
|
||||
|
||||
long m_style; // combination of wxMENU_XXX flags
|
||||
|
||||
wxEvtHandler *m_eventHandler; // a pluggable in event handler
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenuBar
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxMenuBarBase : public wxWindow
|
||||
{
|
||||
public:
|
||||
// default ctor
|
||||
wxMenuBarBase();
|
||||
|
||||
// dtor will delete all menus we own
|
||||
virtual ~wxMenuBarBase();
|
||||
|
||||
// menu bar construction
|
||||
// ---------------------
|
||||
|
||||
// append a menu to the end of menubar, return TRUE if ok
|
||||
virtual bool Append(wxMenu *menu, const wxString& title);
|
||||
|
||||
// insert a menu before the given position into the menubar, return TRUE
|
||||
// if inserted ok
|
||||
virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
|
||||
|
||||
// menu bar items access
|
||||
// ---------------------
|
||||
|
||||
// get the number of menus in the menu bar
|
||||
size_t GetMenuCount() const { return m_menus.GetCount(); }
|
||||
|
||||
// get the menu at given position
|
||||
wxMenu *GetMenu(size_t pos) const;
|
||||
|
||||
// replace the menu at given position with another one, returns the
|
||||
// previous menu (which should be deleted by the caller)
|
||||
virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
|
||||
|
||||
// delete the menu at given position from the menu bar, return the pointer
|
||||
// to the menu (which should be deleted by the caller)
|
||||
virtual wxMenu *Remove(size_t pos);
|
||||
|
||||
// enable or disable a submenu
|
||||
virtual void EnableTop(size_t pos, bool enable) = 0;
|
||||
|
||||
// is the menu enabled?
|
||||
virtual bool IsEnabledTop(size_t WXUNUSED(pos)) const { return TRUE; }
|
||||
|
||||
// get or change the label of the menu at given position
|
||||
virtual void SetLabelTop(size_t pos, const wxString& label) = 0;
|
||||
virtual wxString GetLabelTop(size_t pos) const = 0;
|
||||
|
||||
// item search
|
||||
// -----------
|
||||
|
||||
// by menu and item names, returns wxNOT_FOUND if not found or id of the
|
||||
// found item
|
||||
virtual int FindMenuItem(const wxString& menu, const wxString& item) const;
|
||||
|
||||
// find item by id (in any menu), returns NULL if not found
|
||||
//
|
||||
// if menu is !NULL, it will be filled with wxMenu this item belongs to
|
||||
virtual wxMenuItem* FindItem(int id, wxMenu **menu = NULL) const;
|
||||
|
||||
// find menu by its caption, return wxNOT_FOUND on failure
|
||||
int FindMenu(const wxString& title) const;
|
||||
|
||||
// item access
|
||||
// -----------
|
||||
|
||||
// all these functions just use FindItem() and then call an appropriate
|
||||
// method on it
|
||||
//
|
||||
// NB: under MSW, these methods can only be used after the menubar had
|
||||
// been attached to the frame
|
||||
|
||||
void Enable(int id, bool enable);
|
||||
void Check(int id, bool check);
|
||||
bool IsChecked(int id) const;
|
||||
bool IsEnabled(int id) const;
|
||||
|
||||
void SetLabel(int id, const wxString &label);
|
||||
wxString GetLabel(int id) const;
|
||||
|
||||
void SetHelpString(int id, const wxString& helpString);
|
||||
wxString GetHelpString(int id) const;
|
||||
|
||||
// implementation helpers
|
||||
|
||||
// get the frame we are attached to (may return NULL)
|
||||
wxFrame *GetFrame() const { return m_menuBarFrame; }
|
||||
|
||||
// returns TRUE if we're attached to a frame
|
||||
bool IsAttached() const { return GetFrame() != NULL; }
|
||||
|
||||
// associate the menubar with the frame
|
||||
virtual void Attach(wxFrame *frame);
|
||||
|
||||
// called before deleting the menubar normally
|
||||
virtual void Detach();
|
||||
|
||||
// need to override these ones to avoid virtual function hiding
|
||||
virtual bool Enable(bool enable = TRUE) { return wxWindow::Enable(enable); }
|
||||
virtual void SetLabel(const wxString& s) { wxWindow::SetLabel(s); }
|
||||
virtual wxString GetLabel() const { return wxWindow::GetLabel(); }
|
||||
|
||||
// don't want menu bars to accept the focus by tabbing to them
|
||||
virtual bool AcceptsFocusFromKeyboard() const { return FALSE; }
|
||||
|
||||
// compatibility only: these functions are deprecated, use the new ones
|
||||
// instead
|
||||
#if WXWIN_COMPATIBILITY
|
||||
bool Enabled(int id) const { return IsEnabled(id); }
|
||||
bool Checked(int id) const { return IsChecked(id); }
|
||||
|
||||
wxMenuItem* FindMenuItemById(int id) const
|
||||
{ return FindItem(id); }
|
||||
wxMenuItem* FindItemForId(int id, wxMenu **menu = NULL) const
|
||||
{ return FindItem(id, menu); }
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
protected:
|
||||
// the list of all our menus
|
||||
wxMenuList m_menus;
|
||||
|
||||
// the frame we are attached to (may be NULL)
|
||||
wxFrame *m_menuBarFrame;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the real class declaration
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef wxUSE_BASE_CLASSES_ONLY
|
||||
#define wxMenuItem wxMenuItemBase
|
||||
#else // !wxUSE_BASE_CLASSES_ONLY
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/menu.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/menu.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/menu.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/menu.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/menu.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/menu.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/menu.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/menu.h"
|
||||
#endif
|
||||
#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY
|
||||
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#endif
|
||||
// _WX_MENU_H_BASE_
|
157
include/wx/menuitem.h
Normal file
157
include/wx/menuitem.h
Normal file
@@ -0,0 +1,157 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/menuitem.h
|
||||
// Purpose: wxMenuItem class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 25.10.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MENUITEM_H_BASE_
|
||||
#define _WX_MENUITEM_H_BASE_
|
||||
|
||||
#if wxUSE_MENUS
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/object.h" // base class
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxAcceleratorEntry;
|
||||
class WXDLLEXPORT wxMenuItem;
|
||||
class WXDLLEXPORT wxMenu;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMenuItem is an item in the menu which may be either a normal item, a sub
|
||||
// menu or a separator
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxMenuItemBase : public wxObject
|
||||
{
|
||||
public:
|
||||
// creation
|
||||
static wxMenuItem *New(wxMenu *parentMenu = (wxMenu *)NULL,
|
||||
int id = wxID_SEPARATOR,
|
||||
const wxString& text = wxEmptyString,
|
||||
const wxString& help = wxEmptyString,
|
||||
bool isCheckable = FALSE,
|
||||
wxMenu *subMenu = (wxMenu *)NULL);
|
||||
|
||||
// destruction: wxMenuItem will delete its submenu
|
||||
virtual ~wxMenuItemBase();
|
||||
|
||||
// the menu we're in
|
||||
wxMenu *GetMenu() const { return m_parentMenu; }
|
||||
|
||||
// get/set id
|
||||
void SetId(int id) { m_id = id; }
|
||||
int GetId() const { return m_id; }
|
||||
bool IsSeparator() const { return m_id == wxID_SEPARATOR; }
|
||||
|
||||
// the item's text (or name)
|
||||
//
|
||||
// NB: the item's text includes the accelerators and mnemonics info (if
|
||||
// any), i.e. it may contain '&' or '_' or "\t..." and thus is
|
||||
// different from the item's label which only contains the text shown
|
||||
// in the menu
|
||||
virtual void SetText(const wxString& str) { m_text = str; }
|
||||
wxString GetLabel() const { return GetLabelFromText(m_text); }
|
||||
const wxString& GetText() const { return m_text; }
|
||||
|
||||
// get the label from text (implemented in platform-specific code)
|
||||
static wxString GetLabelFromText(const wxString& text);
|
||||
|
||||
// what kind of menu item we are
|
||||
virtual void SetCheckable(bool checkable) { m_isCheckable = checkable; }
|
||||
bool IsCheckable() const { return m_isCheckable; }
|
||||
|
||||
bool IsSubMenu() const { return m_subMenu != NULL; }
|
||||
void SetSubMenu(wxMenu *menu) { m_subMenu = menu; }
|
||||
wxMenu *GetSubMenu() const { return m_subMenu; }
|
||||
|
||||
// state
|
||||
virtual void Enable(bool enable = TRUE) { m_isEnabled = enable; }
|
||||
virtual bool IsEnabled() const { return m_isEnabled; }
|
||||
|
||||
virtual void Check(bool check = TRUE) { m_isChecked = check; }
|
||||
virtual bool IsChecked() const { return m_isChecked; }
|
||||
void Toggle() { Check(!m_isChecked); }
|
||||
|
||||
// help string (displayed in the status bar by default)
|
||||
void SetHelp(const wxString& str) { m_help = str; }
|
||||
const wxString& GetHelp() const { return m_help; }
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
// extract the accelerator from the given menu string, return NULL if none
|
||||
// found
|
||||
static wxAcceleratorEntry *GetAccelFromString(const wxString& label);
|
||||
|
||||
// get our accelerator or NULL (caller must delete the pointer)
|
||||
virtual wxAcceleratorEntry *GetAccel() const;
|
||||
|
||||
// set the accel for this item - this may also be done indirectly with
|
||||
// SetText()
|
||||
virtual void SetAccel(wxAcceleratorEntry *accel);
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
// compatibility only, use new functions in the new code
|
||||
void SetName(const wxString& str) { SetText(str); }
|
||||
const wxString& GetName() const { return GetText(); }
|
||||
|
||||
protected:
|
||||
int m_id; // numeric id of the item >= 0 or -1
|
||||
wxMenu *m_parentMenu, // the menu we belong to
|
||||
*m_subMenu; // our sub menu or NULL
|
||||
wxString m_text, // label of the item
|
||||
m_help; // the help string for the item
|
||||
bool m_isCheckable; // can be checked?
|
||||
bool m_isChecked; // is checked?
|
||||
bool m_isEnabled; // is enabled?
|
||||
|
||||
// some compilers need a default constructor here, do not remove
|
||||
wxMenuItemBase() { }
|
||||
|
||||
private:
|
||||
// and, if we have one ctor, compiler won't generate a default copy one, so
|
||||
// declare them ourselves - but don't implement as they shouldn't be used
|
||||
wxMenuItemBase(const wxMenuItemBase& item);
|
||||
wxMenuItemBase& operator=(const wxMenuItemBase& item);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the real class declaration
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef wxUSE_BASE_CLASSES_ONLY
|
||||
#define wxMenuItem wxMenuItemBase
|
||||
#else // !wxUSE_BASE_CLASSES_ONLY
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/menuitem.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/menuitem.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/menuitem.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/menuitem.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/menuitem.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/menuitem.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/menuitem.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/menuitem.h"
|
||||
#endif
|
||||
#endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY
|
||||
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
#endif
|
||||
// _WX_MENUITEM_H_BASE_
|
37
include/wx/msgdlg.h
Normal file
37
include/wx/msgdlg.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef _WX_MSGDLG_H_BASE_
|
||||
#define _WX_MSGDLG_H_BASE_
|
||||
|
||||
#if wxUSE_MSGDLG
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/generic/msgdlgg.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/msgdlg.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/msgdlg.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/msgdlgg.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/generic/msgdlgg.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/msgdlg.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/msgdlg.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/generic/msgdlgg.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMessageBox: the simplest way to use wxMessageDialog
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int WXDLLEXPORT wxMessageBox(const wxString& message,
|
||||
const wxString& caption = wxMessageBoxCaptionStr,
|
||||
long style = wxOK | wxCENTRE,
|
||||
wxWindow *parent = NULL,
|
||||
int x = -1, int y = -1);
|
||||
|
||||
#endif // wxUSE_MSGDLG
|
||||
|
||||
#endif
|
||||
// _WX_MSGDLG_H_BASE_
|
289
include/wx/notebook.h
Normal file
289
include/wx/notebook.h
Normal file
@@ -0,0 +1,289 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/notebook.h
|
||||
// Purpose: wxNotebook interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 01.02.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1996-2000 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_NOTEBOOK_H_BASE_
|
||||
#define _WX_NOTEBOOK_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "notebookbase.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_NOTEBOOK
|
||||
|
||||
#include "wx/control.h"
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
class WXDLLEXPORT wxImageList;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// types
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// array of notebook pages
|
||||
typedef wxWindow wxNotebookPage; // so far, any window can be a page
|
||||
|
||||
WX_DEFINE_EXPORTED_ARRAY(wxNotebookPage *, wxArrayPages);
|
||||
|
||||
#define wxNOTEBOOK_NAME _T("notebook")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebookBase: define wxNotebook interface
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxNotebookBase : public wxControl
|
||||
{
|
||||
public:
|
||||
// ctor
|
||||
wxNotebookBase()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
// quasi ctor
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxNOTEBOOK_NAME);
|
||||
|
||||
// dtor
|
||||
virtual ~wxNotebookBase();
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// get number of pages in the dialog
|
||||
int GetPageCount() const { return m_pages.GetCount(); }
|
||||
|
||||
// get the panel which represents the given page
|
||||
wxNotebookPage *GetPage(int nPage) { return m_pages[nPage]; }
|
||||
|
||||
// get the currently selected page
|
||||
virtual int GetSelection() const = 0;
|
||||
|
||||
// set/get the title of a page
|
||||
virtual bool SetPageText(int nPage, const wxString& strText) = 0;
|
||||
virtual wxString GetPageText(int nPage) const = 0;
|
||||
|
||||
// image list stuff: each page may have an image associated with it (all
|
||||
// images belong to the same image list)
|
||||
virtual void SetImageList(wxImageList* imageList);
|
||||
|
||||
// as SetImageList() but we will delete the image list ourselves
|
||||
void AssignImageList(wxImageList* imageList);
|
||||
|
||||
// get pointer (may be NULL) to the associated image list
|
||||
wxImageList* GetImageList() const { return m_imageList; }
|
||||
|
||||
// sets/returns item's image index in the current image list
|
||||
virtual int GetPageImage(int nPage) const = 0;
|
||||
virtual bool SetPageImage(int nPage, int nImage) = 0;
|
||||
|
||||
// get the number of rows for a control with wxNB_MULTILINE style (not all
|
||||
// versions support it - they will always return 1 then)
|
||||
virtual int GetRowCount() const { return 1; }
|
||||
|
||||
// set the size (the same for all pages)
|
||||
virtual void SetPageSize(const wxSize& size) = 0;
|
||||
|
||||
// set the padding between tabs (in pixels)
|
||||
virtual void SetPadding(const wxSize& padding) = 0;
|
||||
|
||||
// set the size of the tabs for wxNB_FIXEDWIDTH controls
|
||||
virtual void SetTabSize(const wxSize& sz) = 0;
|
||||
|
||||
// calculate the size of the notebook from the size of its page
|
||||
virtual wxSize CalcSizeFromPage(const wxSize& sizePage);
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
// remove one page from the notebook and delete it
|
||||
virtual bool DeletePage(int nPage);
|
||||
|
||||
// remove one page from the notebook, without deleting it
|
||||
virtual bool RemovePage(int nPage) { return DoRemovePage(nPage) != NULL; }
|
||||
|
||||
// remove all pages and delete them
|
||||
virtual bool DeleteAllPages() { WX_CLEAR_ARRAY(m_pages); return TRUE; }
|
||||
|
||||
// adds a new page to the notebook (it will be deleted by the notebook,
|
||||
// don't delete it yourself) and make it the current one if bSelect
|
||||
virtual bool AddPage(wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect = FALSE,
|
||||
int imageId = -1)
|
||||
{
|
||||
return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
|
||||
}
|
||||
|
||||
// the same as AddPage(), but adds the page at the specified position
|
||||
virtual bool InsertPage(int nPage,
|
||||
wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect = FALSE,
|
||||
int imageId = -1) = 0;
|
||||
|
||||
// set the currently selected page, return the index of the previously
|
||||
// selected one (or -1 on error)
|
||||
//
|
||||
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
|
||||
virtual int SetSelection(int nPage) = 0;
|
||||
|
||||
// cycle thru the tabs
|
||||
void AdvanceSelection(bool forward = TRUE)
|
||||
{
|
||||
int nPage = GetNextPage(forward);
|
||||
if ( nPage != -1 )
|
||||
SetSelection(nPage);
|
||||
}
|
||||
|
||||
protected:
|
||||
// remove the page and return a pointer to it
|
||||
virtual wxNotebookPage *DoRemovePage(int page);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// get the next page wrapping if we reached the end
|
||||
int GetNextPage(bool forward) const;
|
||||
|
||||
wxArrayPages m_pages; // array of pages
|
||||
wxImageList *m_imageList; // we can have an associated image list
|
||||
bool m_ownsImageList; // true if we must delete m_imageList
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// notebook event class (used by NOTEBOOK_PAGE_CHANGED/ING events)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxNotebookEvent : public wxNotifyEvent
|
||||
{
|
||||
public:
|
||||
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
||||
int nSel = -1, int nOldSel = -1)
|
||||
: wxNotifyEvent(commandType, id)
|
||||
{
|
||||
m_nSel = nSel;
|
||||
m_nOldSel = nOldSel;
|
||||
}
|
||||
|
||||
// accessors
|
||||
// the currently selected page (-1 if none)
|
||||
int GetSelection() const { return m_nSel; }
|
||||
void SetSelection(int nSel) { m_nSel = nSel; }
|
||||
// the page that was selected before the change (-1 if none)
|
||||
int GetOldSelection() const { return m_nOldSel; }
|
||||
void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; }
|
||||
|
||||
private:
|
||||
int m_nSel, // currently selected page
|
||||
m_nOldSel; // previously selected page
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxNotebookEvent)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event types and macros for them
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__BORLANDC__) && defined(__WIN16__)
|
||||
// For 16-bit BC++, these 2 would be identical otherwise (truncated)
|
||||
#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wxEVT_COMMAND_NB_PAGE_CHANGED
|
||||
#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING wxEVT_COMMAND_NB_PAGE_CHANGING
|
||||
#endif
|
||||
|
||||
BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 802)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 803)
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
|
||||
|
||||
// Truncation in 16-bit BC++ means we need to define these differently
|
||||
#if defined(__BORLANDC__) && defined(__WIN16__)
|
||||
#define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
|
||||
DECLARE_EVENT_TABLE_ENTRY( \
|
||||
wxEVT_COMMAND_NB_PAGE_CHANGED, \
|
||||
id, \
|
||||
-1, \
|
||||
(wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
|
||||
NULL \
|
||||
),
|
||||
|
||||
#define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
|
||||
DECLARE_EVENT_TABLE_ENTRY( \
|
||||
wxEVT_COMMAND_NB_PAGE_CHANGING, \
|
||||
id, \
|
||||
-1, \
|
||||
(wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
|
||||
NULL \
|
||||
),
|
||||
|
||||
#else
|
||||
|
||||
#define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
|
||||
DECLARE_EVENT_TABLE_ENTRY( \
|
||||
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \
|
||||
id, \
|
||||
-1, \
|
||||
(wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
|
||||
NULL \
|
||||
),
|
||||
|
||||
#define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
|
||||
DECLARE_EVENT_TABLE_ENTRY( \
|
||||
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, \
|
||||
id, \
|
||||
-1, \
|
||||
(wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
|
||||
NULL \
|
||||
),
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook class itself
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/notebook.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#ifdef __WIN16__
|
||||
#include "wx/generic/notebook.h"
|
||||
#else
|
||||
#include "wx/msw/notebook.h"
|
||||
#endif
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/generic/notebook.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/notebook.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/notebook.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/notebook.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/notebook.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/notebook.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_NOTEBOOK
|
||||
|
||||
#endif
|
||||
// _WX_NOTEBOOK_H_BASE_
|
23
include/wx/palette.h
Normal file
23
include/wx/palette.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_PALETTE_H_BASE_
|
||||
#define _WX_PALETTE_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/palette.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/palette.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/paletteg.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/palette.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/palette.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/palette.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/palette.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/palette.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_PALETTE_H_BASE_
|
23
include/wx/pen.h
Normal file
23
include/wx/pen.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_PEN_H_BASE_
|
||||
#define _WX_PEN_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/pen.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/pen.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/pen.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/pen.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/pen.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/pen.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/pen.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/pen.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_PEN_H_BASE_
|
32
include/wx/printdlg.h
Normal file
32
include/wx/printdlg.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef _WX_PRINTDLG_H_BASE_
|
||||
#define _WX_PRINTDLG_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/printdlg.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/generic/prntdlgg.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/prntdlgg.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/generic/prntdlgg.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/printdlg.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/generic/prntdlgg.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/generic/prntdlgg.h"
|
||||
#endif
|
||||
|
||||
#if !defined(__WXMSW__) && !defined(__WXMAC__)
|
||||
#define wxPrintDialog wxGenericPrintDialog
|
||||
#define sm_classwxPrintDialog sm_classwxGenericPrintDialog
|
||||
|
||||
#define wxPrintSetupDialog wxGenericPrintSetupDialog
|
||||
#define sm_classwxPrintSetupDialog sm_classwxGenericPrintSetupDialog
|
||||
|
||||
#define wxPageSetupDialog wxGenericPageSetupDialog
|
||||
#define sm_classwxPageSetupDialog sm_classwxGenericPageSetupDialog
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_PRINTDLG_H_BASE_
|
118
include/wx/radiobox.h
Normal file
118
include/wx/radiobox.h
Normal file
@@ -0,0 +1,118 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/radiobox.h
|
||||
// Purpose: wxRadioBox declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 10.09.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_RADIOBOX_H_BASE_
|
||||
#define _WX_RADIOBOX_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "radioboxbase.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_RADIOBOX
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxRadioBoxNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRadioBoxBase is not a normal base class, but rather a mix-in because the
|
||||
// real wxRadioBox derives from different classes on different platforms: for
|
||||
// example, it is a wxStaticBox in wxUniv but not in wxMSW
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRadioBoxBase
|
||||
{
|
||||
public:
|
||||
// selection
|
||||
virtual void SetSelection(int n) = 0;
|
||||
virtual int GetSelection() const = 0;
|
||||
|
||||
virtual wxString GetStringSelection() const
|
||||
{
|
||||
wxString s;
|
||||
int sel = GetSelection();
|
||||
if ( sel != wxNOT_FOUND )
|
||||
s = GetString(sel);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
virtual bool SetStringSelection(const wxString& s)
|
||||
{
|
||||
int sel = FindString(s);
|
||||
if ( sel != wxNOT_FOUND )
|
||||
{
|
||||
SetSelection(sel);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// string access
|
||||
virtual int GetCount() const = 0;
|
||||
virtual int FindString(const wxString& s) const
|
||||
{
|
||||
int count = GetCount();
|
||||
for ( int n = 0; n < count; n++ )
|
||||
{
|
||||
if ( GetString(n) == s )
|
||||
return n;
|
||||
}
|
||||
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
virtual wxString GetString(int n) const = 0;
|
||||
virtual void SetString(int n, const wxString& label) = 0;
|
||||
|
||||
// change the individual radio button state
|
||||
virtual void Enable(int n, bool enable = TRUE) = 0;
|
||||
virtual void Show(int n, bool show = TRUE) = 0;
|
||||
|
||||
// layout parameters
|
||||
virtual int GetColumnCount() const = 0;
|
||||
virtual int GetRowCount() const = 0;
|
||||
|
||||
// return the item above/below/to the left/right of the given one
|
||||
int GetNextItem(int item, wxDirection dir, long style) const;
|
||||
|
||||
// for compatibility only, don't use these methods in new code!
|
||||
#if WXWIN_COMPATIBILITY_2_2
|
||||
int Number() const { return GetCount(); }
|
||||
wxString GetLabel(int n) const { return GetString(n); }
|
||||
void SetLabel(int n, const wxString& label) { SetString(n, label); }
|
||||
#endif // WXWIN_COMPATIBILITY_2_2
|
||||
};
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/radiobox.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/radiobox.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/radiobox.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/radiobox.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/radiobox.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/radiobox.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/radiobox.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/radiobox.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_RADIOBOX
|
||||
|
||||
#endif
|
||||
// _WX_RADIOBOX_H_BASE_
|
57
include/wx/radiobut.h
Normal file
57
include/wx/radiobut.h
Normal file
@@ -0,0 +1,57 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/radiobut.h
|
||||
// Purpose: wxRadioButton declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 07.09.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_RADIOBUT_H_BASE_
|
||||
#define _WX_RADIOBUT_H_BASE_
|
||||
|
||||
#if wxUSE_RADIOBTN
|
||||
|
||||
/*
|
||||
There is no wxRadioButtonBase class as wxRadioButton interface is the same
|
||||
as of wxCheckBox(Base), but under some platforms wxRadioButton really
|
||||
derives from wxCheckBox and on the others it doesn't.
|
||||
|
||||
The pseudo-declaration of wxRadioButtonBase would look like this:
|
||||
|
||||
class wxRadioButtonBase : public ...
|
||||
{
|
||||
public:
|
||||
virtual void SetValue(bool value);
|
||||
virtual bool GetValue() const;
|
||||
};
|
||||
*/
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxRadioButtonNameStr;
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/radiobut.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/radiobut.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/radiobut.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/radiobut.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/radiobut.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/radiobut.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/radiobut.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/radiobut.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_RADIOBTN
|
||||
|
||||
#endif
|
||||
// _WX_RADIOBUT_H_BASE_
|
23
include/wx/region.h
Normal file
23
include/wx/region.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_REGION_H_BASE_
|
||||
#define _WX_REGION_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/region.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/region.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/region.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/region.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/region.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/region.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/region.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/region.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_REGION_H_BASE_
|
62
include/wx/scrolbar.h
Normal file
62
include/wx/scrolbar.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef _WX_SCROLBAR_H_BASE_
|
||||
#define _WX_SCROLBAR_H_BASE_
|
||||
|
||||
#if wxUSE_SCROLLBAR
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxScrollBarNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrollBar: a scroll bar control
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrollBarBase : public wxControl
|
||||
{
|
||||
public:
|
||||
// scrollbar construction
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSB_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxScrollBarNameStr);
|
||||
|
||||
// accessors
|
||||
virtual int GetThumbPosition() const = 0;
|
||||
virtual int GetThumbSize() const = 0;
|
||||
virtual int GetPageSize() const = 0;
|
||||
virtual int GetRange() const = 0;
|
||||
|
||||
bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; }
|
||||
|
||||
// operations
|
||||
virtual void SetThumbPosition(int viewStart) = 0;
|
||||
virtual void SetScrollbar(int position, int thumbSize,
|
||||
int range, int pageSize,
|
||||
bool refresh = TRUE) = 0;
|
||||
};
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/scrolbar.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/scrolbar.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/scrolbar.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/scrolbar.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/scrolbar.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/scrolbar.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/scrolbar.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/scrolbar.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_SCROLLBAR
|
||||
|
||||
#endif
|
||||
// _WX_SCROLBAR_H_BASE_
|
129
include/wx/settings.h
Normal file
129
include/wx/settings.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: settings.h
|
||||
// Purpose: wxSystemSettings defines; includes platform settings.h
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SETTINGS_H_BASE_
|
||||
#define _WX_SETTINGS_H_BASE_
|
||||
|
||||
#define wxSYS_WHITE_BRUSH 0
|
||||
#define wxSYS_LTGRAY_BRUSH 1
|
||||
#define wxSYS_GRAY_BRUSH 2
|
||||
#define wxSYS_DKGRAY_BRUSH 3
|
||||
#define wxSYS_BLACK_BRUSH 4
|
||||
#define wxSYS_NULL_BRUSH 5
|
||||
#define wxSYS_HOLLOW_BRUSH wxSYS_NULL_BRUSH
|
||||
#define wxSYS_WHITE_PEN 6
|
||||
#define wxSYS_BLACK_PEN 7
|
||||
#define wxSYS_NULL_PEN 8
|
||||
#define wxSYS_OEM_FIXED_FONT 10
|
||||
#define wxSYS_ANSI_FIXED_FONT 11
|
||||
#define wxSYS_ANSI_VAR_FONT 12
|
||||
#define wxSYS_SYSTEM_FONT 13
|
||||
#define wxSYS_DEVICE_DEFAULT_FONT 14
|
||||
#define wxSYS_DEFAULT_PALETTE 15
|
||||
#define wxSYS_SYSTEM_FIXED_FONT 16
|
||||
#define wxSYS_DEFAULT_GUI_FONT 17
|
||||
|
||||
#define wxSYS_COLOUR_SCROLLBAR 0
|
||||
#define wxSYS_COLOUR_BACKGROUND 1
|
||||
#define wxSYS_COLOUR_ACTIVECAPTION 2
|
||||
#define wxSYS_COLOUR_INACTIVECAPTION 3
|
||||
#define wxSYS_COLOUR_MENU 4
|
||||
#define wxSYS_COLOUR_WINDOW 5
|
||||
#define wxSYS_COLOUR_WINDOWFRAME 6
|
||||
#define wxSYS_COLOUR_MENUTEXT 7
|
||||
#define wxSYS_COLOUR_WINDOWTEXT 8
|
||||
#define wxSYS_COLOUR_CAPTIONTEXT 9
|
||||
#define wxSYS_COLOUR_ACTIVEBORDER 10
|
||||
#define wxSYS_COLOUR_INACTIVEBORDER 11
|
||||
#define wxSYS_COLOUR_APPWORKSPACE 12
|
||||
#define wxSYS_COLOUR_HIGHLIGHT 13
|
||||
#define wxSYS_COLOUR_HIGHLIGHTTEXT 14
|
||||
#define wxSYS_COLOUR_BTNFACE 15
|
||||
#define wxSYS_COLOUR_BTNSHADOW 16
|
||||
#define wxSYS_COLOUR_GRAYTEXT 17
|
||||
#define wxSYS_COLOUR_BTNTEXT 18
|
||||
#define wxSYS_COLOUR_INACTIVECAPTIONTEXT 19
|
||||
#define wxSYS_COLOUR_BTNHIGHLIGHT 20
|
||||
|
||||
#define wxSYS_COLOUR_3DDKSHADOW 21
|
||||
#define wxSYS_COLOUR_3DLIGHT 22
|
||||
#define wxSYS_COLOUR_INFOTEXT 23
|
||||
#define wxSYS_COLOUR_INFOBK 24
|
||||
|
||||
#define wxSYS_COLOUR_LISTBOX 25
|
||||
|
||||
#define wxSYS_COLOUR_DESKTOP wxSYS_COLOUR_BACKGROUND
|
||||
#define wxSYS_COLOUR_3DFACE wxSYS_COLOUR_BTNFACE
|
||||
#define wxSYS_COLOUR_3DSHADOW wxSYS_COLOUR_BTNSHADOW
|
||||
#define wxSYS_COLOUR_3DHIGHLIGHT wxSYS_COLOUR_BTNHIGHLIGHT
|
||||
#define wxSYS_COLOUR_3DHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
|
||||
#define wxSYS_COLOUR_BTNHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
|
||||
|
||||
// Metrics
|
||||
#define wxSYS_MOUSE_BUTTONS 1
|
||||
#define wxSYS_BORDER_X 2
|
||||
#define wxSYS_BORDER_Y 3
|
||||
#define wxSYS_CURSOR_X 4
|
||||
#define wxSYS_CURSOR_Y 5
|
||||
#define wxSYS_DCLICK_X 6
|
||||
#define wxSYS_DCLICK_Y 7
|
||||
#define wxSYS_DRAG_X 8
|
||||
#define wxSYS_DRAG_Y 9
|
||||
#define wxSYS_EDGE_X 10
|
||||
#define wxSYS_EDGE_Y 11
|
||||
#define wxSYS_HSCROLL_ARROW_X 12
|
||||
#define wxSYS_HSCROLL_ARROW_Y 13
|
||||
#define wxSYS_HTHUMB_X 14
|
||||
#define wxSYS_ICON_X 15
|
||||
#define wxSYS_ICON_Y 16
|
||||
#define wxSYS_ICONSPACING_X 17
|
||||
#define wxSYS_ICONSPACING_Y 18
|
||||
#define wxSYS_WINDOWMIN_X 19
|
||||
#define wxSYS_WINDOWMIN_Y 20
|
||||
#define wxSYS_SCREEN_X 21
|
||||
#define wxSYS_SCREEN_Y 22
|
||||
#define wxSYS_FRAMESIZE_X 23
|
||||
#define wxSYS_FRAMESIZE_Y 24
|
||||
#define wxSYS_SMALLICON_X 25
|
||||
#define wxSYS_SMALLICON_Y 26
|
||||
#define wxSYS_HSCROLL_Y 27
|
||||
#define wxSYS_VSCROLL_X 28
|
||||
#define wxSYS_VSCROLL_ARROW_X 29
|
||||
#define wxSYS_VSCROLL_ARROW_Y 30
|
||||
#define wxSYS_VTHUMB_Y 31
|
||||
#define wxSYS_CAPTION_Y 32
|
||||
#define wxSYS_MENU_Y 33
|
||||
#define wxSYS_NETWORK_PRESENT 34
|
||||
#define wxSYS_PENWINDOWS_PRESENT 35
|
||||
#define wxSYS_SHOW_SOUNDS 36
|
||||
#define wxSYS_SWAP_BUTTONS 37
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/settings.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/settings.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/settings.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/settings.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/settings.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/settings.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/settings.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/settings.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_SETTINGS_H_BASE_
|
||||
|
84
include/wx/setup.h
Normal file
84
include/wx/setup.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* The main configuration file for wxWindows.
|
||||
*
|
||||
* NB: this file can be included in .c files, so it must be compileable by a C
|
||||
* compiler - use #ifdef __cplusplus for C++ specific features and avoid
|
||||
* using C++ style comments
|
||||
*/
|
||||
|
||||
#ifndef _WX_SETUP_H_BASE_
|
||||
#define _WX_SETUP_H_BASE_
|
||||
|
||||
/* compatibility code, to be removed asap: */
|
||||
|
||||
#if !defined(__WXBASE__) && !defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXMOTIF__) && !defined(__WXQT__) && !defined(__WXSTUBS__) && !defined(__WXMAC__) && !defined(__WXPM__)
|
||||
#error No __WXxxx__ define set! Please define one of __WXBASE__,__WXGTK__,__WXMSW__,__WXMOTIF__,__WXMAC__,__WXQT__,__WXPM__,__WXSTUBS__
|
||||
#endif
|
||||
|
||||
/*
|
||||
wxUniversal is defined together with one of other ports, so test for it
|
||||
first
|
||||
*/
|
||||
#ifdef __WXUNIVERSAL__
|
||||
#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__)
|
||||
#include "wx/univd/setup.h"
|
||||
#else
|
||||
#include "wx/univ/setup.h"
|
||||
#endif
|
||||
|
||||
#elif defined(__WXBASE__)
|
||||
#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__)
|
||||
#include "wx/based/setup.h"
|
||||
#else
|
||||
#include "wx/base/setup.h"
|
||||
#endif
|
||||
|
||||
#elif defined(__VMS)
|
||||
#include "wx_root:[wxwindows]setup.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/setup.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/setup.h"
|
||||
|
||||
#elif defined(__WXQT__)
|
||||
#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__)
|
||||
#include "wx/qtd/setup.h"
|
||||
#else
|
||||
#include "wx/qt/setup.h"
|
||||
#endif
|
||||
|
||||
#elif defined(__WXMOTIF__)
|
||||
#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__)
|
||||
#include "wx/motifd/setup.h"
|
||||
#else
|
||||
#include "wx/motif/setup.h"
|
||||
#endif
|
||||
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/setup.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/setup.h"
|
||||
|
||||
#elif defined(__WXGTK__)
|
||||
#if defined(__USE_WXCONFIG__) && defined(__WXDEBUG__)
|
||||
#include "wx/gtkd/setup.h"
|
||||
#else
|
||||
#include "wx/gtk/setup.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "wx/chkconf.h"
|
||||
|
||||
/*
|
||||
define some constants identifying wxWindows version in more details than
|
||||
just the version number
|
||||
*/
|
||||
|
||||
// wxLogChain class available
|
||||
#define wxHAS_LOG_CHAIN
|
||||
|
||||
// define this when wxDC::Blit() respects SetDeviceOrigin() in wxGTK
|
||||
#undef wxHAS_WORKING_GTK_DC_BLIT
|
||||
|
||||
#endif /* _WX_SETUP_H_BASE_ */
|
114
include/wx/slider.h
Normal file
114
include/wx/slider.h
Normal file
@@ -0,0 +1,114 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/slider.h
|
||||
// Purpose: wxSlider interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 09.02.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1996-2001 wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SLIDER_H_BASE_
|
||||
#define _WX_SLIDER_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_SLIDER
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxSliderNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxSliderBase: define wxSlider interface
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxSliderBase : public wxControl
|
||||
{
|
||||
public:
|
||||
/* the ctor of the derived class should have the following form:
|
||||
|
||||
wxSlider(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
int value, int minValue, int maxValue,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSL_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxSliderNameStr);
|
||||
*/
|
||||
|
||||
// get/set the current slider value (should be in range)
|
||||
virtual int GetValue() const = 0;
|
||||
virtual void SetValue(int value) = 0;
|
||||
|
||||
// retrieve/change the range
|
||||
virtual void SetRange(int minValue, int maxValue) = 0;
|
||||
virtual int GetMin() const = 0;
|
||||
virtual int GetMax() const = 0;
|
||||
|
||||
// the line/page size is the increment by which the slider moves when
|
||||
// cursor arrow key/page up or down are pressed (clicking the mouse is like
|
||||
// pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
|
||||
virtual void SetLineSize(int lineSize) = 0;
|
||||
virtual void SetPageSize(int pageSize) = 0;
|
||||
virtual int GetLineSize() const = 0;
|
||||
virtual int GetPageSize() const = 0;
|
||||
|
||||
// these methods get/set the length of the slider pointer in pixels
|
||||
virtual void SetThumbLength(int lenPixels) = 0;
|
||||
virtual int GetThumbLength() const = 0;
|
||||
|
||||
// warning: most of subsequent methods are currently only implemented in
|
||||
// wxMSW under Win95 and are silently ignored on other platforms
|
||||
|
||||
virtual void SetTickFreq(int WXUNUSED(n), int WXUNUSED(pos)) { }
|
||||
virtual int GetTickFreq() const { return 0; }
|
||||
virtual void ClearTicks() { }
|
||||
virtual void SetTick(int WXUNUSED(tickPos)) { }
|
||||
|
||||
virtual void ClearSel() { }
|
||||
virtual int GetSelEnd() const { return GetMin(); }
|
||||
virtual int GetSelStart() const { return GetMax(); }
|
||||
virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { }
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the real class declaration
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/slider.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#ifdef __WIN95__
|
||||
#include "wx/msw/slider95.h"
|
||||
#define wxSlider wxSlider95
|
||||
#define sm_classwxSlider sm_classwxSlider95
|
||||
#else // Win16
|
||||
#include "wx/msw/slidrmsw.h"
|
||||
#define wxSlider wxSliderMSW
|
||||
#define sm_classwxSlider sm_classwxSliderMSW
|
||||
#endif // Win32/Win16
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/slider.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/slider.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/slider.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/slider.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/slider.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/slider.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_SLIDER
|
||||
|
||||
#endif
|
||||
// _WX_SLIDER_H_BASE_
|
128
include/wx/spinbutt.h
Normal file
128
include/wx/spinbutt.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/spinbutt.h
|
||||
// Purpose: wxSpinButtonBase class
|
||||
// Author: Julian Smart, Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 23.07.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SPINBUTT_H_BASE_
|
||||
#define _WX_SPINBUTT_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_SPINBTN
|
||||
|
||||
#include "wx/control.h"
|
||||
#include "wx/event.h"
|
||||
|
||||
#define wxSPIN_BUTTON_NAME _T("wxSpinButton")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// The wxSpinButton is like a small scrollbar than is often placed next
|
||||
// to a text control.
|
||||
//
|
||||
// Styles:
|
||||
// wxSP_HORIZONTAL: horizontal spin button
|
||||
// wxSP_VERTICAL: vertical spin button (the default)
|
||||
// wxSP_ARROW_KEYS: arrow keys increment/decrement value
|
||||
// wxSP_WRAP: value wraps at either end
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxSpinButtonBase : public wxControl
|
||||
{
|
||||
public:
|
||||
wxSpinButtonBase() { InitBase(); }
|
||||
|
||||
// accessors
|
||||
virtual int GetValue() const = 0;
|
||||
virtual int GetMin() const { return m_min; }
|
||||
virtual int GetMax() const { return m_max; }
|
||||
|
||||
// operations
|
||||
virtual void SetValue(int val) = 0;
|
||||
virtual void SetRange(int minVal, int maxVal)
|
||||
{
|
||||
m_min = minVal;
|
||||
m_max = maxVal;
|
||||
}
|
||||
|
||||
// is this spin button vertically oriented?
|
||||
bool IsVertical() const { return (m_windowStyle & wxSP_VERTICAL) != 0; }
|
||||
|
||||
protected:
|
||||
// init the base part of the control
|
||||
void InitBase()
|
||||
{
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
}
|
||||
|
||||
// the range value
|
||||
int m_min;
|
||||
int m_max;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the declaration of the real class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/spinbutt.h"
|
||||
#elif defined(__WXMSW__) && defined(__WIN95__)
|
||||
#include "wx/msw/spinbutt.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/spinbutt.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/spinbutt.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/spinbutt.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/spinbutt.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/spinbutt.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/spinbutt.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the wxSpinButton event
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxSpinEvent : public wxNotifyEvent
|
||||
{
|
||||
public:
|
||||
wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
|
||||
: wxNotifyEvent(commandType, id)
|
||||
{
|
||||
}
|
||||
|
||||
// get the current value of the control
|
||||
int GetPosition() const { return m_commandInt; }
|
||||
void SetPosition(int pos) { m_commandInt = pos; }
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxSpinEvent)
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
|
||||
|
||||
// macros for handling spin events
|
||||
#define EVT_SPIN_UP(id, func) \
|
||||
DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func, NULL ),
|
||||
#define EVT_SPIN_DOWN(id, func) \
|
||||
DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func, NULL ),
|
||||
#define EVT_SPIN(id, func) \
|
||||
DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func, NULL ),
|
||||
|
||||
#endif // wxUSE_SPINBTN
|
||||
|
||||
#endif
|
||||
// _WX_SPINBUTT_H_BASE_
|
70
include/wx/statbmp.h
Normal file
70
include/wx/statbmp.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/statbmp.h
|
||||
// Purpose: wxStaticBitmap class interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 25.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_STATBMP_H_BASE_
|
||||
#define _WX_STATBMP_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "statbmpbase.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_STATBMP
|
||||
|
||||
#include "wx/control.h"
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
class WXDLLEXPORT wxIcon;
|
||||
class WXDLLEXPORT wxBitmap;
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
|
||||
|
||||
// a control showing an icon or a bitmap
|
||||
class WXDLLEXPORT wxStaticBitmapBase : public wxControl
|
||||
{
|
||||
public:
|
||||
#ifdef __DARWIN__
|
||||
~wxStaticBitmapBase() { }
|
||||
#endif
|
||||
|
||||
// our interface
|
||||
virtual void SetIcon(const wxIcon& icon) = 0;
|
||||
virtual void SetBitmap(const wxBitmap& bitmap) = 0;
|
||||
virtual wxBitmap GetBitmap() const = 0;
|
||||
|
||||
// overriden base class virtuals
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
};
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/statbmp.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/statbmp.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/statbmp.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/statbmp.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/statbmp.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/statbmp.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/statbmp.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/statbmp.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_STATBMP
|
||||
|
||||
#endif
|
||||
// _WX_STATBMP_H_BASE_
|
42
include/wx/statbox.h
Normal file
42
include/wx/statbox.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef _WX_STATBOX_H_BASE_
|
||||
#define _WX_STATBOX_H_BASE_
|
||||
|
||||
#if wxUSE_STATBOX
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBoxNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStaticBox: a grouping box with a label
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStaticBoxBase : public wxControl
|
||||
{
|
||||
public:
|
||||
// overriden base class virtuals
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
};
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/statbox.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/statbox.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/statbox.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/statbox.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/statbox.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/statbox.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/statbox.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/statbox.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_STATBOX
|
||||
|
||||
#endif
|
||||
// _WX_STATBOX_H_BASE_
|
38
include/wx/stattext.h
Normal file
38
include/wx/stattext.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef _WX_STATTEXT_H_BASE_
|
||||
#define _WX_STATTEXT_H_BASE_
|
||||
|
||||
#if wxUSE_STATTEXT
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxStaticTextNameStr;
|
||||
|
||||
class WXDLLEXPORT wxStaticTextBase : public wxControl
|
||||
{
|
||||
public:
|
||||
// overriden base class virtuals
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
};
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/stattext.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/stattext.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/stattext.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/stattext.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/stattext.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/stattext.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/stattext.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/stattext.h"
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_STATTEXT
|
||||
|
||||
#endif
|
||||
// _WX_STATTEXT_H_BASE_
|
19
include/wx/taskbar.h
Normal file
19
include/wx/taskbar.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef _WX_TASKBAR_H_BASE_
|
||||
#define _WX_TASKBAR_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/taskbar.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/taskbar.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#elif defined(__WXQT__)
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/taskbar.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/taskbar.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/taskbar.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_TASKBAR_H_BASE_
|
345
include/wx/textctrl.h
Normal file
345
include/wx/textctrl.h
Normal file
@@ -0,0 +1,345 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: textctrl.h
|
||||
// Purpose: wxTextCtrlBase class - the interface of wxTextCtrl
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 13.07.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TEXTCTRL_H_BASE_
|
||||
#define _WX_TEXTCTRL_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "textctrlbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_TEXTCTRL
|
||||
|
||||
#include "wx/control.h" // the base class
|
||||
|
||||
// 16-bit Borland 4.0 doesn't seem to allow multiple inheritance with wxWindow
|
||||
// and streambuf: it complains about deriving a huge class from the huge class
|
||||
// streambuf. !! Also, can't use streambuf if making or using a DLL :-(
|
||||
|
||||
#if (defined(__BORLANDC__)) || defined(__MWERKS__) || defined(_WINDLL) || defined(WXUSINGDLL) || defined(WXMAKINGDLL)
|
||||
#define NO_TEXT_WINDOW_STREAM
|
||||
#endif
|
||||
|
||||
// the streambuf which is used in the declaration of wxTextCtrlBase below is not compatible
|
||||
// with the standard-conforming implementation found in newer egcs versions
|
||||
// (that is, the libstdc++ v3 that is shipped with it)
|
||||
#if defined(__GNUC__)&&( (__GNUC__>2) ||( (__GNUC__==2)&&(__GNUC_MINOR__>97) ) )
|
||||
#define NO_TEXT_WINDOW_STREAM
|
||||
#endif
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
#if wxUSE_STD_IOSTREAM
|
||||
#include "wx/ioswrap.h" // for iostream classes if we need them
|
||||
#else // !wxUSE_STD_IOSTREAM
|
||||
// can't compile this feature in if we don't use streams at all
|
||||
#define NO_TEXT_WINDOW_STREAM
|
||||
#endif // wxUSE_STD_IOSTREAM/!wxUSE_STD_IOSTREAM
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxTextCtrl;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl style flags
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// the flag bits 0x0001, 2, 4 and 8 are free but should be used only for the
|
||||
// things which don't make sense for a text control used by wxTextEntryDialog
|
||||
// because they would otherwise conflict with wxOK, wxCANCEL, wxCENTRE
|
||||
#define wxTE_READONLY 0x0010
|
||||
#define wxTE_MULTILINE 0x0020
|
||||
#define wxTE_PROCESS_TAB 0x0040
|
||||
|
||||
// this style means to use RICHEDIT control and does something only under wxMSW
|
||||
// and Win32 and is silently ignored under all other platforms
|
||||
#define wxTE_RICH 0x0080
|
||||
#define wxTE_NO_VSCROLL 0x0100
|
||||
#define wxTE_AUTO_SCROLL 0x0200
|
||||
#define wxTE_PROCESS_ENTER 0x0400
|
||||
#define wxTE_PASSWORD 0x0800
|
||||
|
||||
// automatically detect the URLs and generate the events when mouse is
|
||||
// moved/clicked over an URL
|
||||
//
|
||||
// this is for Win32 richedit controls only so far
|
||||
#define wxTE_AUTO_URL 0x1000
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextAttr: a structure containing the visual attributes of a text
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTextAttr
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxTextAttr() { }
|
||||
wxTextAttr(const wxColour& colText,
|
||||
const wxColour& colBack = wxNullColour,
|
||||
const wxFont& font = wxNullFont)
|
||||
: m_colText(colText), m_colBack(colBack), m_font(font) { }
|
||||
|
||||
// setters
|
||||
void SetTextColour(const wxColour& colText) { m_colText = colText; }
|
||||
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
|
||||
void SetFont(const wxFont& font) { m_font = font; }
|
||||
|
||||
// accessors
|
||||
bool HasTextColour() const { return m_colText.Ok(); }
|
||||
bool HasBackgroundColour() const { return m_colBack.Ok(); }
|
||||
bool HasFont() const { return m_font.Ok(); }
|
||||
|
||||
// setters
|
||||
const wxColour& GetTextColour() const { return m_colText; }
|
||||
const wxColour& GetBackgroundColour() const { return m_colBack; }
|
||||
const wxFont& GetFont() const { return m_font; }
|
||||
|
||||
// returns false if we have any attributes set, true otherwise
|
||||
bool IsDefault() const
|
||||
{
|
||||
return !HasTextColour() && !HasBackgroundColour() && !HasFont();
|
||||
}
|
||||
|
||||
private:
|
||||
wxColour m_colText,
|
||||
m_colBack;
|
||||
wxFont m_font;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl: a single or multiple line text zone where user can enter and
|
||||
// edit text
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTextCtrlBase : public wxControl
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
, public wxSTD streambuf
|
||||
#endif
|
||||
|
||||
{
|
||||
public:
|
||||
// creation
|
||||
// --------
|
||||
|
||||
wxTextCtrlBase();
|
||||
~wxTextCtrlBase();
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
virtual wxString GetValue() const = 0;
|
||||
virtual void SetValue(const wxString& value) = 0;
|
||||
|
||||
virtual int GetLineLength(long lineNo) const = 0;
|
||||
virtual wxString GetLineText(long lineNo) const = 0;
|
||||
virtual int GetNumberOfLines() const = 0;
|
||||
|
||||
virtual bool IsModified() const = 0;
|
||||
virtual bool IsEditable() const = 0;
|
||||
|
||||
// If the return values from and to are the same, there is no selection.
|
||||
virtual void GetSelection(long* from, long* to) const = 0;
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
// editing
|
||||
virtual void Clear() = 0;
|
||||
virtual void Replace(long from, long to, const wxString& value) = 0;
|
||||
virtual void Remove(long from, long to) = 0;
|
||||
|
||||
// load/save the controls contents from/to the file
|
||||
virtual bool LoadFile(const wxString& file);
|
||||
virtual bool SaveFile(const wxString& file = wxEmptyString);
|
||||
|
||||
// clears the dirty flag
|
||||
virtual void DiscardEdits() = 0;
|
||||
|
||||
// set the max number of characters which may be entered in a single line
|
||||
// text control
|
||||
virtual void SetMaxLength(unsigned long WXUNUSED(len)) { }
|
||||
|
||||
// writing text inserts it at the current position, appending always
|
||||
// inserts it at the end
|
||||
virtual void WriteText(const wxString& text) = 0;
|
||||
virtual void AppendText(const wxString& text) = 0;
|
||||
|
||||
// text control under some platforms supports the text styles: these
|
||||
// methods allow to apply the given text style to the given selection or to
|
||||
// set/get the style which will be used for all appended text
|
||||
virtual bool SetStyle(long start, long end, const wxTextAttr& style);
|
||||
virtual bool SetDefaultStyle(const wxTextAttr& style);
|
||||
virtual const wxTextAttr& GetDefaultStyle() const;
|
||||
|
||||
// translate between the position (which is just an index in the text ctrl
|
||||
// considering all its contents as a single strings) and (x, y) coordinates
|
||||
// which represent column and line.
|
||||
virtual long XYToPosition(long x, long y) const = 0;
|
||||
virtual bool PositionToXY(long pos, long *x, long *y) const = 0;
|
||||
|
||||
virtual void ShowPosition(long pos) = 0;
|
||||
|
||||
// Clipboard operations
|
||||
virtual void Copy() = 0;
|
||||
virtual void Cut() = 0;
|
||||
virtual void Paste() = 0;
|
||||
|
||||
virtual bool CanCopy() const;
|
||||
virtual bool CanCut() const;
|
||||
virtual bool CanPaste() const;
|
||||
|
||||
// Undo/redo
|
||||
virtual void Undo() = 0;
|
||||
virtual void Redo() = 0;
|
||||
|
||||
virtual bool CanUndo() const = 0;
|
||||
virtual bool CanRedo() const = 0;
|
||||
|
||||
// Insertion point
|
||||
virtual void SetInsertionPoint(long pos) = 0;
|
||||
virtual void SetInsertionPointEnd() = 0;
|
||||
virtual long GetInsertionPoint() const = 0;
|
||||
virtual long GetLastPosition() const = 0;
|
||||
|
||||
virtual void SetSelection(long from, long to) = 0;
|
||||
virtual void SelectAll();
|
||||
virtual void SetEditable(bool editable) = 0;
|
||||
|
||||
// streambuf methods
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
int overflow(int i);
|
||||
int sync();
|
||||
int underflow();
|
||||
#endif // NO_TEXT_WINDOW_STREAM
|
||||
|
||||
// stream-like insertion operators: these are always available, whether we
|
||||
// were, or not, compiled with streambuf support
|
||||
wxTextCtrl& operator<<(const wxString& s);
|
||||
wxTextCtrl& operator<<(int i);
|
||||
wxTextCtrl& operator<<(long i);
|
||||
wxTextCtrl& operator<<(float f);
|
||||
wxTextCtrl& operator<<(double d);
|
||||
wxTextCtrl& operator<<(const wxChar c);
|
||||
|
||||
// obsolete functions
|
||||
#if WXWIN_COMPATIBILITY
|
||||
bool Modified() const { return IsModified(); }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// the name of the last file loaded with LoadFile() which will be used by
|
||||
// SaveFile() by default
|
||||
wxString m_filename;
|
||||
|
||||
// the text style which will be used for any new text added to the control
|
||||
wxTextAttr m_defaultStyle;
|
||||
|
||||
private:
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
#if !wxUSE_IOSTREAMH
|
||||
char *m_streambuf;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the platform-dependent class definition
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/univ/textctrl.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/textctrl.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/textctrl.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/textctrl.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/textctrl.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/textctrl.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/textctrl.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/textctrl.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextCtrl events
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if !WXWIN_COMPATIBILITY_EVENT_TYPES
|
||||
|
||||
BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13)
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14)
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
#endif // !WXWIN_COMPATIBILITY_EVENT_TYPES
|
||||
|
||||
class WXDLLEXPORT wxTextUrlEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
|
||||
long start, long end)
|
||||
: wxCommandEvent(wxEVT_COMMAND_TEXT_URL, id),
|
||||
m_evtMouse(evtMouse)
|
||||
{ m_start = start; m_end = end; }
|
||||
|
||||
// get the mouse event which happend over the URL
|
||||
const wxMouseEvent& GetMouseEvent() const { return m_evtMouse; }
|
||||
|
||||
// get the start of the URL
|
||||
long GetURLStart() const { return m_start; }
|
||||
|
||||
// get the end of the URL
|
||||
long GetURLEnd() const { return m_end; }
|
||||
|
||||
protected:
|
||||
// the corresponding mouse event
|
||||
wxMouseEvent m_evtMouse;
|
||||
|
||||
// the start and end indices of the URL in the text control
|
||||
long m_start,
|
||||
m_end;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxTextUrlEvent)
|
||||
|
||||
public:
|
||||
// for wxWin RTTI only, don't use
|
||||
wxTextUrlEvent() { }
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*wxTextUrlEventFunction)(wxTextUrlEvent&);
|
||||
|
||||
#define EVT_TEXT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_TEXT_ENTER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_TEXT_URL(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_URL, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxTextUrlEventFunction) & fn, (wxObject *) NULL ),
|
||||
#define EVT_TEXT_MAXLEN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TEXT_MAXLEN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
|
||||
|
||||
#endif // wxUSE_TEXTCTRL
|
||||
|
||||
#endif
|
||||
// _WX_TEXTCTRL_H_BASE_
|
50
include/wx/tglbtn.h
Normal file
50
include/wx/tglbtn.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/tglbtn.h
|
||||
// Purpose: This dummy header includes the proper header file for the
|
||||
// system we're compiling under.
|
||||
// Author: John Norris, minor changes by Axel Schlueter
|
||||
// Modified by:
|
||||
// Created: 08.02.01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Johnny C. Norris II
|
||||
// License: Rocketeer license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TOGGLEBUTTON_H_BASE_
|
||||
#define _WX_TOGGLEBUTTON_H_BASE_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_TOGGLEBTN
|
||||
|
||||
#include "wx/event.h"
|
||||
#include "wx/control.h" // base class
|
||||
|
||||
BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 19)
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
#define EVT_TOGGLEBUTTON(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL ),
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/tglbtn.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/tglbtn.h"
|
||||
/*
|
||||
# elif defined(__WXMOTIF__)
|
||||
# include "wx/motif/tglbtn.h"
|
||||
# elif defined(__WXQT__)
|
||||
# include "wx/qt/tglbtn.h"
|
||||
# elif defined(__WXMAC__)
|
||||
# include "wx/mac/tglbtn.h"
|
||||
# elif defined(__WXPM__)
|
||||
# include "wx/os2/tglbtn.h"
|
||||
# elif defined(__WXSTUBS__)
|
||||
# include "wx/stubs/tglbtn.h"
|
||||
*/
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_TOGGLEBTN
|
||||
|
||||
#endif // _WX_TOGGLEBUTTON_H_BASE_
|
||||
|
244
include/wx/timer.h
Normal file
244
include/wx/timer.h
Normal file
@@ -0,0 +1,244 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/timer.h
|
||||
// Purpose: wxTimer, wxStopWatch and global time-related functions
|
||||
// Author: Julian Smart (wxTimer), Sylvain Bougnoux (wxStopWatch)
|
||||
// Modified by: Vadim Zeitlin (wxTimerBase)
|
||||
// Guillermo Rodriguez (global clean up)
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TIMER_H_BASE_
|
||||
#define _WX_TIMER_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "timerbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/longlong.h"
|
||||
#include "wx/event.h"
|
||||
|
||||
#if wxUSE_GUI && wxUSE_TIMER
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTimer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// the interface of wxTimer class
|
||||
class WXDLLEXPORT wxTimerBase : public wxObject
|
||||
{
|
||||
public:
|
||||
// ctors and initializers
|
||||
// ----------------------
|
||||
|
||||
// default: if you don't call SetOwner(), your only chance to get timer
|
||||
// notifications is to override Notify() in the derived class
|
||||
wxTimerBase() { Init(); SetOwner(NULL); }
|
||||
|
||||
// ctor which allows to avoid having to override Notify() in the derived
|
||||
// class: the owner will get timer notifications which can be handled with
|
||||
// EVT_TIMER
|
||||
wxTimerBase(wxEvtHandler *owner, int id = -1)
|
||||
{ Init(); SetOwner(owner, id); }
|
||||
|
||||
// same as ctor above
|
||||
void SetOwner(wxEvtHandler *owner, int id = -1)
|
||||
{ m_owner = owner; m_idTimer = id; }
|
||||
|
||||
#ifdef __DARWIN__
|
||||
virtual ~wxTimerBase() { }
|
||||
#endif
|
||||
|
||||
// working with the timer
|
||||
// ----------------------
|
||||
|
||||
// start the timer: if milliseconds == -1, use the same value as for the
|
||||
// last Start()
|
||||
//
|
||||
// it is now valid to call Start() multiple times: this just restarts the
|
||||
// timer if it is already running
|
||||
virtual bool Start(int milliseconds = -1, bool oneShot = FALSE);
|
||||
|
||||
// stop the timer
|
||||
virtual void Stop() = 0;
|
||||
|
||||
// override this in your wxTimer-derived class if you want to process timer
|
||||
// messages in it, use non default ctor or SetOwner() otherwise
|
||||
virtual void Notify();
|
||||
|
||||
// getting info
|
||||
// ------------
|
||||
|
||||
// return TRUE if the timer is running
|
||||
virtual bool IsRunning() const = 0;
|
||||
|
||||
// get the (last) timer interval in the milliseconds
|
||||
int GetInterval() const { return m_milli; }
|
||||
|
||||
// return TRUE if the timer is one shot
|
||||
bool IsOneShot() const { return m_oneShot; }
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2
|
||||
// deprecated functions
|
||||
int Interval() const { return GetInterval(); };
|
||||
bool OneShot() const { return IsOneShot(); }
|
||||
#endif // WXWIN_COMPATIBILITY_2
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init() { m_oneShot = FALSE; m_milli = 0; }
|
||||
|
||||
wxEvtHandler *m_owner;
|
||||
int m_idTimer;
|
||||
|
||||
int m_milli; // the timer interval
|
||||
bool m_oneShot; // TRUE if one shot
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTimer itself
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/timer.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/timer.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/timer.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/timer.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/timer.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/timer.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/timer.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/timer.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTimerRunner: starts the timer in its ctor, stops in the dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTimerRunner
|
||||
{
|
||||
public:
|
||||
wxTimerRunner(wxTimer& timer) : m_timer(timer) { }
|
||||
wxTimerRunner(wxTimer& timer, int milli, bool oneShot = FALSE)
|
||||
: m_timer(timer)
|
||||
{
|
||||
m_timer.Start(milli, oneShot);
|
||||
}
|
||||
|
||||
void Start(int milli, bool oneShot = FALSE)
|
||||
{
|
||||
m_timer.Start(milli, oneShot);
|
||||
}
|
||||
|
||||
~wxTimerRunner()
|
||||
{
|
||||
if ( m_timer.IsRunning() )
|
||||
{
|
||||
m_timer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
wxTimer& m_timer;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTimerEvent
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxTimerEvent : public wxEvent
|
||||
{
|
||||
public:
|
||||
wxTimerEvent(int id = 0, int interval = 0) : wxEvent(id)
|
||||
{
|
||||
m_eventType = wxEVT_TIMER;
|
||||
|
||||
m_interval = interval;
|
||||
}
|
||||
|
||||
// accessors
|
||||
int GetInterval() const { return m_interval; }
|
||||
|
||||
private:
|
||||
int m_interval;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxTimerEvent)
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&);
|
||||
|
||||
#define EVT_TIMER(id, func) \
|
||||
DECLARE_EVENT_TABLE_ENTRY( wxEVT_TIMER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTimerEventFunction) & func, NULL),
|
||||
|
||||
#endif // wxUSE_GUI && wxUSE_TIMER
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStopWatch: measure time intervals with up to 1ms resolution
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_STOPWATCH
|
||||
|
||||
class WXDLLEXPORT wxStopWatch
|
||||
{
|
||||
public:
|
||||
// ctor starts the stop watch
|
||||
wxStopWatch() { Start(); }
|
||||
void Start(long t = 0);
|
||||
void Pause() { m_pause = GetElapsedTime(); }
|
||||
void Resume() { Start(m_pause); }
|
||||
|
||||
// get elapsed time since the last Start() or Pause() in milliseconds
|
||||
long Time() const;
|
||||
|
||||
protected:
|
||||
// returns the elapsed time since t0
|
||||
long GetElapsedTime() const;
|
||||
|
||||
private:
|
||||
wxLongLong m_t0; // the time of the last Start()
|
||||
long m_pause; // the time of the last Pause() or 0
|
||||
};
|
||||
|
||||
#endif // wxUSE_STOPWATCH
|
||||
|
||||
#if wxUSE_LONGLONG
|
||||
|
||||
// Starts a global timer
|
||||
// -- DEPRECATED: use wxStopWatch instead
|
||||
void WXDLLEXPORT wxStartTimer();
|
||||
|
||||
// Gets elapsed milliseconds since last wxStartTimer or wxGetElapsedTime
|
||||
// -- DEPRECATED: use wxStopWatch instead
|
||||
long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE);
|
||||
|
||||
#endif // wxUSE_LONGLONG
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global time functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Get number of seconds since local time 00:00:00 Jan 1st 1970.
|
||||
extern long WXDLLEXPORT wxGetLocalTime();
|
||||
|
||||
// Get number of seconds since GMT 00:00:00, Jan 1st 1970.
|
||||
extern long WXDLLEXPORT wxGetUTCTime();
|
||||
|
||||
#if wxUSE_LONGLONG
|
||||
// Get number of milliseconds since local time 00:00:00 Jan 1st 1970
|
||||
extern wxLongLong WXDLLEXPORT wxGetLocalTimeMillis();
|
||||
#endif // wxUSE_LONGLONG
|
||||
|
||||
#define wxGetCurrentTime() wxGetLocalTime()
|
||||
|
||||
#endif
|
||||
// _WX_TIMER_H_BASE_
|
59
include/wx/toolbar.h
Normal file
59
include/wx/toolbar.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/toolbar.h
|
||||
// Purpose: wxToolBar interface declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 20.11.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TOOLBAR_H_BASE_
|
||||
#define _WX_TOOLBAR_H_BASE_
|
||||
|
||||
#include "wx/tbarbase.h" // the base class for all toolbars
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
#if !wxUSE_TOOLBAR_NATIVE || defined(__WXUNIVERSAL__)
|
||||
#include "wx/tbarsmpl.h"
|
||||
|
||||
class WXDLLEXPORT wxToolBar : public wxToolBarSimple
|
||||
{
|
||||
public:
|
||||
wxToolBar() { }
|
||||
|
||||
wxToolBar(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxNO_BORDER | wxTB_HORIZONTAL,
|
||||
const wxString& name = wxToolBarNameStr)
|
||||
: wxToolBarSimple(parent, id, pos, size, style, name) { }
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
||||
};
|
||||
#else // wxUSE_TOOLBAR_NATIVE
|
||||
#if defined(__WXMSW__) && defined(__WIN95__)
|
||||
#include "wx/msw/tbar95.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/tbarmsw.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/toolbar.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/tbargtk.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/tbarqt.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/toolbar.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/toolbar.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/toolbar.h"
|
||||
#endif
|
||||
#endif // !wxUSE_TOOLBAR_NATIVE/wxUSE_TOOLBAR_NATIVE
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
#endif
|
||||
// _WX_TOOLBAR_H_BASE_
|
21
include/wx/tooltip.h
Normal file
21
include/wx/tooltip.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_TOOLTIP_H_BASE_
|
||||
#define _WX_TOOLTIP_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/tooltip.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
// #include "wx/motif/tooltip.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/tooltip.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/tooltip.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/tooltip.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/tooltip.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
// #include "wx/stubs/tooltip.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_TOOLTIP_H_BASE_
|
40
include/wx/treectrl.h
Normal file
40
include/wx/treectrl.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef _WX_TREECTRL_H_BASE_
|
||||
#define _WX_TREECTRL_H_BASE_
|
||||
|
||||
#include "wx/treebase.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the platform-dependent wxTreeCtrl class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXUNIVERSAL__)
|
||||
#include "wx/generic/treectlg.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#ifdef __WIN16__
|
||||
#include "wx/generic/treectlg.h"
|
||||
#else
|
||||
#include "wx/msw/treectrl.h"
|
||||
#endif
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/generic/treectlg.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/treectlg.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/treectrl.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/generic/treectlg.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/generic/treectlg.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/generic/treectlg.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if !defined(__WXMSW__)
|
||||
#define wxTreeCtrl wxGenericTreeCtrl
|
||||
#define sm_classwxTreeCtrl sm_classwxGenericTreeCtrl
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif // _WX_TREECTRL_H_BASE_
|
||||
|
19
include/wx/wave.h
Normal file
19
include/wx/wave.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef _WX_WAVE_H_BASE_
|
||||
#define _WX_WAVE_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/wave.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/wave.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/wave.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/wave.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/wave.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/wave.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_TREECTRL_H_BASE_
|
1080
include/wx/window.h
Normal file
1080
include/wx/window.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +0,0 @@
|
||||
tiffM*Data
|
||||
tiffM5.mcp
|
||||
Debug
|
||||
Release
|
@@ -1,21 +0,0 @@
|
||||
Copyright (c) 1988-1997 Sam Leffler
|
||||
Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and
|
||||
its documentation for any purpose is hereby granted without fee, provided
|
||||
that (i) the above copyright notices and this permission notice appear in
|
||||
all copies of the software and related documentation, and (ii) the names of
|
||||
Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
publicity relating to the software without the specific, prior written
|
||||
permission of Sam Leffler and Silicon Graphics.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
OF THIS SOFTWARE.
|
@@ -1,229 +0,0 @@
|
||||
#
|
||||
# File: makefile.vc
|
||||
# Author: David Webster
|
||||
# Created: 2000
|
||||
# Updated:
|
||||
# Copyright: c) 2000, BHM
|
||||
#
|
||||
# "%W% %G%"
|
||||
#
|
||||
# Makefile : Builds os2tiff.lib library for OS/2 3.0/4.0
|
||||
|
||||
# Suffixes
|
||||
OBJSUFF=obj
|
||||
SRCSUFF=cpp
|
||||
|
||||
OS2FLAGS=/c /W2 /DOS232 /D__VISAGECPP__ /D__VISAGECPP30__ /DOS2_32 /Tdc /Q /N100
|
||||
OS2LINKFLAGS=/BASE:0x00010000 /PMTYPE:PM /NOE /NOD /ALIGN:16
|
||||
OS2LIBFLAGS=/NOL /NOE
|
||||
OS2LIBS=CPPOM30.lib CPPOOC3.LIB OS2386.LIB
|
||||
|
||||
!if "$(WXMAKINGDLL)" != "0"
|
||||
EXTRADLLFLAGS=/DWXMAKINGDLL=1 /Ge- /D__OS2DLL__
|
||||
EXTRALNKFLAGS=/DLL
|
||||
!endif
|
||||
|
||||
# Change WXDIR or WXWIN to wherever wxWindows is found
|
||||
WXDIR = $(WXWIN)
|
||||
|
||||
OS2TIFFDIR=$(WXDIR)\src\tiff
|
||||
OS2TIFFINC=$(WINTIFFDIR)
|
||||
OS2TIFFLIB=$(WXDIR)\lib\os2tiff.lib
|
||||
|
||||
!if "$(WXMAKINGDLL)" != "1"
|
||||
OS2TIFFLIB=$(WXDIR)\lib\os2tiff.lib
|
||||
!else
|
||||
OS2TIFFLIB=$(WXDIR)\lib\os2tiff.dll
|
||||
!endif
|
||||
|
||||
INC=-I$(WXDIR)\src\TIFF -I$(OS2TIFFINC)
|
||||
|
||||
!ifndef FINAL
|
||||
FINAL=0
|
||||
!endif
|
||||
|
||||
!if "$(NOPCH)" == "1"
|
||||
PCH=
|
||||
PRECOMP=
|
||||
MAKEPRECOMP=
|
||||
!else
|
||||
PCH=$(WXLIBNAME).pch
|
||||
PRECOMP=/Si$(PCH)
|
||||
MAKEPRECOMP=/Fi$(PCH)
|
||||
!endif
|
||||
|
||||
!if "$(FINAL)" == "0"
|
||||
!if "$(WXMAKINGDLL)" == "1"
|
||||
D=DebugOS2DLL
|
||||
!else
|
||||
D=DebugOS2
|
||||
!endif
|
||||
OPT =
|
||||
DEBUG_FLAGS= /Ti /D__WXDEBUG__ #/Fb
|
||||
LINK_DEBUG_FLAGS=/DEBUG
|
||||
CRTFLAG=/Gm /Gd
|
||||
!else
|
||||
# /O1 - smallest code
|
||||
# /O2 - fastest code
|
||||
!if "$(WXMAKINGDLL)" == "1"
|
||||
D=RelseOS2DLL
|
||||
!else
|
||||
D=RelseOS2
|
||||
!endif
|
||||
OPT = /O+ /Oc /G5
|
||||
DEBUG_FLAGS=
|
||||
LINK_DEBUG_FLAGS=/RELEASE
|
||||
CRTFLAG=/Gm /Gd
|
||||
!endif
|
||||
|
||||
!if [md $(OS2TIFFDIR)\$D]
|
||||
!endif
|
||||
|
||||
|
||||
CPPFLAGS=$(OS2FLAGS) $(EXTRADLLFLAGS) $(DEBUG_FLAGS) $(PRECOMP) $(INC) $(OPT) $(CRTFLAG)
|
||||
LINKFKAGS=$(OS2LINKFLAGS) $(EXTRALNKFLAGS)
|
||||
|
||||
{..\tiff}.c{..\tiff\$D}.obj:
|
||||
@echo $<
|
||||
icc @<<
|
||||
$(CPPFLAGS) /Fo$@ /Tp $<
|
||||
<<
|
||||
|
||||
OBJECTS = \
|
||||
..\tiff\$D\tif_aux.obj \
|
||||
..\tiff\$D\tif_close.obj \
|
||||
..\tiff\$D\tif_codec.obj \
|
||||
..\tiff\$D\tif_compress.obj \
|
||||
..\tiff\$D\tif_dir.obj \
|
||||
..\tiff\$D\tif_dirinfo.obj \
|
||||
..\tiff\$D\tif_dirread.obj \
|
||||
..\tiff\$D\tif_dirwrite.obj \
|
||||
..\tiff\$D\tif_dumpmode.obj \
|
||||
..\tiff\$D\tif_error.obj \
|
||||
..\tiff\$D\tif_fax3.obj \
|
||||
..\tiff\$D\tif_fax3sm.obj \
|
||||
..\tiff\$D\tif_flush.obj \
|
||||
..\tiff\$D\tif_getimage.obj \
|
||||
..\tiff\$D\tif_jpeg.obj \
|
||||
..\tiff\$D\tif_luv.obj \
|
||||
..\tiff\$D\tif_lzw.obj \
|
||||
..\tiff\$D\tif_next.obj \
|
||||
..\tiff\$D\tif_open.obj \
|
||||
..\tiff\$D\tif_os2.obj \
|
||||
..\tiff\$D\tif_packbits.obj \
|
||||
..\tiff\$D\tif_pixarlog.obj \
|
||||
..\tiff\$D\tif_predict.obj \
|
||||
..\tiff\$D\tif_print.obj \
|
||||
..\tiff\$D\tif_read.obj \
|
||||
..\tiff\$D\tif_strip.obj \
|
||||
..\tiff\$D\tif_swab.obj \
|
||||
..\tiff\$D\tif_thunder.obj \
|
||||
..\tiff\$D\tif_tile.obj \
|
||||
..\tiff\$D\tif_version.obj \
|
||||
..\tiff\$D\tif_warning.obj \
|
||||
..\tiff\$D\tif_write.obj \
|
||||
..\tiff\$D\tif_zip.obj
|
||||
|
||||
LIBOBJECTS = \
|
||||
tif_aux.obj \
|
||||
tif_close.obj \
|
||||
tif_codec.obj \
|
||||
tif_compress.obj \
|
||||
tif_dir.obj \
|
||||
tif_dirinfo.obj \
|
||||
tif_dirread.obj \
|
||||
tif_dirwrite.obj \
|
||||
tif_dumpmode.obj \
|
||||
tif_error.obj \
|
||||
tif_fax3.obj \
|
||||
tif_fax3sm.obj \
|
||||
tif_flush.obj \
|
||||
tif_getimage.obj \
|
||||
tif_jpeg.obj \
|
||||
tif_luv.obj \
|
||||
tif_lzw.obj \
|
||||
tif_next.obj \
|
||||
tif_open.obj \
|
||||
tif_os2.obj \
|
||||
tif_packbits.obj \
|
||||
tif_pixarlog.obj \
|
||||
tif_predict.obj \
|
||||
tif_print.obj \
|
||||
tif_read.obj \
|
||||
tif_strip.obj \
|
||||
tif_swab.obj \
|
||||
tif_thunder.obj \
|
||||
tif_tile.obj \
|
||||
tif_version.obj \
|
||||
tif_warning.obj \
|
||||
tif_write.obj \
|
||||
tif_zip.obj
|
||||
|
||||
all: $(OBJECTS) $(OS2TIFFLIB)
|
||||
|
||||
!if "$(WXMAKINGDLL)" != "1"
|
||||
|
||||
$(WXDIR)\lib\os2tiff.lib: $(LIBOBJECTS)
|
||||
touch $(WXDIR)\lib\os2tiff.lib
|
||||
del $(WXDIR)\lib\os2tiff.lib
|
||||
ilib $(OS2LIBFLAGS) $@ @<<
|
||||
$**;
|
||||
<<
|
||||
del *.obj
|
||||
|
||||
!else
|
||||
|
||||
# Update the dynamic link library
|
||||
$(WXDIR)\lib\os2tiff.dll: $(OBJECTS)
|
||||
icc @<<
|
||||
/B" $(LINKFLAGS)" /Fe$@
|
||||
$(LIBS)
|
||||
$(OBJECTS)
|
||||
$(WXDIR)\src\os2\os2tiff.def
|
||||
<<
|
||||
implib $(WXDIR)\lib\os2tiffd.lib $(WXDIR)\src\os2\os2tiff.def
|
||||
|
||||
!endif
|
||||
|
||||
clean:
|
||||
del $(OS2TIFFLIB)
|
||||
erase /N $(OS2TIFFDIR)\$D
|
||||
rd $(OS2TIFFDIR)\$D
|
||||
|
||||
cleanall: clean
|
||||
|
||||
$(LIBOBJECTS):
|
||||
copy ..\tiff\$D\tif_aux.obj
|
||||
copy ..\tiff\$D\tif_close.obj
|
||||
copy ..\tiff\$D\tif_codec.obj
|
||||
copy ..\tiff\$D\tif_compress.obj
|
||||
copy ..\tiff\$D\tif_dir.obj
|
||||
copy ..\tiff\$D\tif_dirinfo.obj
|
||||
copy ..\tiff\$D\tif_dirread.obj
|
||||
copy ..\tiff\$D\tif_dirwrite.obj
|
||||
copy ..\tiff\$D\tif_dumpmode.obj
|
||||
copy ..\tiff\$D\tif_error.obj
|
||||
copy ..\tiff\$D\tif_fax3.obj
|
||||
copy ..\tiff\$D\tif_fax3sm.obj
|
||||
copy ..\tiff\$D\tif_flush.obj
|
||||
copy ..\tiff\$D\tif_getimage.obj
|
||||
copy ..\tiff\$D\tif_jpeg.obj
|
||||
copy ..\tiff\$D\tif_luv.obj
|
||||
copy ..\tiff\$D\tif_lzw.obj
|
||||
copy ..\tiff\$D\tif_next.obj
|
||||
copy ..\tiff\$D\tif_open.obj
|
||||
copy ..\tiff\$D\tif_os2.obj
|
||||
copy ..\tiff\$D\tif_packbits.obj
|
||||
copy ..\tiff\$D\tif_pixarlog.obj
|
||||
copy ..\tiff\$D\tif_predict.obj
|
||||
copy ..\tiff\$D\tif_print.obj
|
||||
copy ..\tiff\$D\tif_read.obj
|
||||
copy ..\tiff\$D\tif_strip.obj
|
||||
copy ..\tiff\$D\tif_swab.obj
|
||||
copy ..\tiff\$D\tif_thunder.obj
|
||||
copy ..\tiff\$D\tif_tile.obj
|
||||
copy ..\tiff\$D\tif_version.obj
|
||||
copy ..\tiff\$D\tif_warning.obj
|
||||
copy ..\tiff\$D\tif_write.obj
|
||||
copy ..\tiff\$D\tif_zip.obj
|
||||
|
@@ -1,129 +0,0 @@
|
||||
# $Header$
|
||||
#
|
||||
# Tag Image File Format Library
|
||||
#
|
||||
# Copyright (c) 1988-1997 Sam Leffler
|
||||
# Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and
|
||||
# its documentation for any purpose is hereby granted without fee, provided
|
||||
# that (i) the above copyright notices and this permission notice appear in
|
||||
# all copies of the software and related documentation, and (ii) the names of
|
||||
# Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
# publicity relating to the software without the specific, prior written
|
||||
# permission of Stanford and Silicon Graphics.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
# OF THIS SOFTWARE.
|
||||
#
|
||||
DESTDIR=.
|
||||
#
|
||||
INSTALL=install
|
||||
NULL=
|
||||
|
||||
IPATH= -I. -I../jpeg
|
||||
CONF_LIBRARY=\
|
||||
${NULL}
|
||||
COPTS= -Oloop -cwagshf -d1 -b0 -v -DNDEBUG -rr -j135i
|
||||
CFLAGS= ${COPTS} ${IPATH} ${CONF_LIBRARY}
|
||||
#
|
||||
INCS= tiff.h tiffio.h
|
||||
SRCS= tif_fax3.c \
|
||||
tif_fax4.c \
|
||||
tif_aux.c \
|
||||
tif_atari.c \
|
||||
tif_ccittrle.c \
|
||||
tif_close.c \
|
||||
tif_compress.c \
|
||||
tif_dir.c \
|
||||
tif_dirinfo.c \
|
||||
tif_dirread.c \
|
||||
tif_dirwrite.c \
|
||||
tif_dumpmode.c \
|
||||
tif_error.c \
|
||||
tif_getimage.c \
|
||||
tif_jpeg.c \
|
||||
tif_flush.c \
|
||||
tif_lzw.c \
|
||||
tif_next.c \
|
||||
tif_open.c \
|
||||
tif_packbits.c \
|
||||
tif_print.c \
|
||||
tif_read.c \
|
||||
tif_swab.c \
|
||||
tif_strip.c \
|
||||
tif_thunder.c \
|
||||
tif_tile.c \
|
||||
tif_version.c \
|
||||
tif_warning.c \
|
||||
tif_write.c \
|
||||
${NULL}
|
||||
OBJS= tif_fax3.o \
|
||||
tif_fax4.o \
|
||||
tif_aux.o \
|
||||
tif_atari.o \
|
||||
tif_ccittrle.o \
|
||||
tif_close.o \
|
||||
tif_compress.o \
|
||||
tif_dir.o \
|
||||
tif_dirinfo.o \
|
||||
tif_dirread.o \
|
||||
tif_dirwrite.o \
|
||||
tif_dumpmode.o \
|
||||
tif_error.o \
|
||||
tif_getimage.o \
|
||||
tif_jpeg.o \
|
||||
tif_flush.o \
|
||||
tif_lzw.o \
|
||||
tif_next.o \
|
||||
tif_open.o \
|
||||
tif_packbits.o \
|
||||
tif_print.o \
|
||||
tif_read.o \
|
||||
tif_swab.o \
|
||||
tif_strip.o \
|
||||
tif_thunder.o \
|
||||
tif_tile.o \
|
||||
tif_version.o \
|
||||
tif_warning.o \
|
||||
tif_write.o \
|
||||
${NULL}
|
||||
ALL= tiffrnb.lib
|
||||
|
||||
all: ${ALL}
|
||||
|
||||
${ALL}: ${OBJS}
|
||||
${AR} ${ARFLAGS} $@ r $<
|
||||
|
||||
${OBJS}: tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h
|
||||
tif_fax3.o: tif_fax3.c g3states.h t4.h tif_fax3.h
|
||||
|
||||
g3states.h: mkg3states.c t4.h
|
||||
${CC} -o mkg3states.ttp ${CFLAGS} mkg3states.c
|
||||
./mkg3states -c > g3states.h
|
||||
|
||||
install: all installh
|
||||
-for i in ${ALL}; do \
|
||||
${INSTALL} -c -m 644 $$i ${DESTDIR}/lib/$$i; \
|
||||
done
|
||||
|
||||
installh: ${INCS}
|
||||
-for i in ${INCS}; do \
|
||||
h=`basename $$i`; \
|
||||
cmp -s $$i ${DESTDIR}/include/$$h || \
|
||||
${INSTALL} -c -m 444 $$i ${DESTDIR}/include/$$h; \
|
||||
done
|
||||
|
||||
clean:
|
||||
rm -f ${ALL} ${OBJS} mkg3states.ttp mkg3states.o g3states.h
|
||||
|
||||
tags: ${SRCS}
|
||||
${CTAGS} ${SRCS}
|
@@ -1,61 +0,0 @@
|
||||
$Header$
|
||||
|
||||
|
||||
TIFF Software Distribution
|
||||
--------------------------
|
||||
This file is just a placeholder; all the documentation is now in
|
||||
HTML in the html directory. To view the documentation point your
|
||||
favorite WWW viewer at html/index.html; e.g.
|
||||
|
||||
netscape html/index.html
|
||||
|
||||
If you don't have an HTML viewer then you can read the HTML source
|
||||
or fetch a PostScript version of this documentation from the directory
|
||||
|
||||
ftp://ftp.sgi.com/graphics/tiff/doc
|
||||
|
||||
If you can't hack either of these options then basically what you
|
||||
want to do is:
|
||||
|
||||
% ./configure
|
||||
% make
|
||||
% su
|
||||
# make install
|
||||
|
||||
If that doesn't do what you want, or something isn't clear then
|
||||
sorry, but you're SOL.
|
||||
|
||||
Sam Leffler (sam@engr.sgi.com)
|
||||
|
||||
|
||||
Use and Copyright
|
||||
-----------------
|
||||
Silicon Graphics has seen fit to allow me to give this work away. It
|
||||
is free. There is no support or guarantee of any sort as to its
|
||||
operations, correctness, or whatever. If you do anything useful with
|
||||
all or parts of it you need to honor the copyright notices. I would
|
||||
also be interested in knowing about it and, hopefully, be acknowledged.
|
||||
|
||||
The legal way of saying that is:
|
||||
|
||||
Copyright (c) 1988-1997 Sam Leffler
|
||||
Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and
|
||||
its documentation for any purpose is hereby granted without fee, provided
|
||||
that (i) the above copyright notices and this permission notice appear in
|
||||
all copies of the software and related documentation, and (ii) the names of
|
||||
Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
publicity relating to the software without the specific, prior written
|
||||
permission of Sam Leffler and Silicon Graphics.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
OF THIS SOFTWARE.
|
@@ -1,7 +0,0 @@
|
||||
# $Header$
|
||||
|
||||
o tiffcmp read data by strip/tile instead of scanline
|
||||
o YCbCr sampling support
|
||||
o extracate colorspace conversion support
|
||||
o look at isolating all codecs from TIFF library
|
||||
o JPEG colormode order dependency problem
|
@@ -1 +0,0 @@
|
||||
3.6.1-2
|
File diff suppressed because it is too large
Load Diff
@@ -1,102 +0,0 @@
|
||||
LIBRARY libtiff
|
||||
EXPORTS TIFFOpen
|
||||
TIFFGetVersion
|
||||
TIFFClose
|
||||
TIFFFlush
|
||||
TIFFFlushData
|
||||
TIFFGetField
|
||||
TIFFVGetField
|
||||
TIFFGetFieldDefaulted
|
||||
TIFFVGetFieldDefaulted
|
||||
TIFFGetTagListEntry
|
||||
TIFFGetTagListCount
|
||||
TIFFReadDirectory
|
||||
TIFFScanlineSize
|
||||
TIFFStripSize
|
||||
TIFFVStripSize
|
||||
TIFFRawStripSize
|
||||
TIFFTileRowSize
|
||||
TIFFTileSize
|
||||
TIFFVTileSize
|
||||
TIFFFileno
|
||||
TIFFGetMode
|
||||
TIFFIsTiled
|
||||
TIFFIsByteSwapped
|
||||
TIFFCIELabToRGBInit
|
||||
TIFFCIELabToXYZ
|
||||
TIFFXYZToRGB
|
||||
TIFFYCbCrToRGBInit
|
||||
TIFFYCbCrtoRGB
|
||||
TIFFCurrentRow
|
||||
TIFFCurrentDirectory
|
||||
TIFFCurrentStrip
|
||||
TIFFCurrentTile
|
||||
TIFFDataWidth
|
||||
TIFFReadBufferSetup
|
||||
TIFFLastDirectory
|
||||
TIFFSetDirectory
|
||||
TIFFSetSubDirectory
|
||||
TIFFUnlinkDirectory
|
||||
TIFFSetField
|
||||
TIFFVSetField
|
||||
TIFFCheckpointDirectory
|
||||
TIFFWriteDirectory
|
||||
TIFFRewriteDirectory
|
||||
TIFFPrintDirectory
|
||||
TIFFReadScanline
|
||||
TIFFWriteScanline
|
||||
TIFFReadRGBAImage
|
||||
TIFFReadRGBAImageOriented
|
||||
TIFFPrintDirectory
|
||||
TIFFReadScanline
|
||||
TIFFWriteScanline
|
||||
TIFFReadRGBAImage
|
||||
TIFFFdOpen
|
||||
TIFFClientOpen
|
||||
TIFFFileName
|
||||
TIFFError
|
||||
TIFFWarning
|
||||
TIFFSetErrorHandler
|
||||
TIFFSetWarningHandler
|
||||
TIFFComputeTile
|
||||
TIFFCheckTile
|
||||
TIFFNumberOfTiles
|
||||
TIFFReadTile
|
||||
TIFFWriteTile
|
||||
TIFFComputeStrip
|
||||
TIFFNumberOfStrips
|
||||
TIFFRGBAImageBegin
|
||||
TIFFRGBAImageEnd
|
||||
TIFFReadEncodedStrip
|
||||
TIFFReadRawStrip
|
||||
TIFFReadEncodedTile
|
||||
TIFFReadRawTile
|
||||
TIFFReadRGBATile
|
||||
TIFFReadRGBAStrip
|
||||
TIFFWriteEncodedStrip
|
||||
TIFFWriteRawStrip
|
||||
TIFFWriteEncodedTile
|
||||
TIFFWriteRawTile
|
||||
TIFFSetWriteOffset
|
||||
TIFFSwabDouble
|
||||
TIFFSwabShort
|
||||
TIFFSwabLong
|
||||
TIFFSwabArrayOfShort
|
||||
TIFFSwabArrayOfLong
|
||||
TIFFSwabArrayOfDouble
|
||||
TIFFReverseBits
|
||||
TIFFGetBitRevTable
|
||||
TIFFDefaultStripSize
|
||||
TIFFDefaultTileSize
|
||||
TIFFRasterScanlineSize
|
||||
_TIFFmalloc
|
||||
_TIFFrealloc
|
||||
_TIFFfree
|
||||
_TIFFmemset
|
||||
_TIFFmemcpy
|
||||
_TIFFmemcmp
|
||||
TIFFCreateDirectory
|
||||
TIFFDefaultStripSize
|
||||
|
||||
|
||||
|
@@ -1,54 +0,0 @@
|
||||
##############################################################################
|
||||
# Name: src/tiff/makefile.sc
|
||||
# Purpose: build tiff Digital Mars 8.33 compiler
|
||||
# Author: Chris Elliott
|
||||
# Created: 21.01.03
|
||||
# RCS-ID: $Id$
|
||||
# Licence: wxWindows licence
|
||||
##############################################################################
|
||||
|
||||
WXDIR = ..\..
|
||||
|
||||
include $(WXDIR)\src\makesc.env
|
||||
|
||||
LIBTARGET=$(WXDIR)\lib\tiff$(SC_SUFFIX).lib
|
||||
THISDIR=$(WXDIR)\src\tiff
|
||||
|
||||
# variables
|
||||
OBJECTS = \
|
||||
$(THISDIR)\tif_aux.obj \
|
||||
$(THISDIR)\tif_close.obj \
|
||||
$(THISDIR)\tif_codec.obj \
|
||||
$(THISDIR)\tif_compress.obj \
|
||||
$(THISDIR)\tif_dir.obj \
|
||||
$(THISDIR)\tif_dirinfo.obj \
|
||||
$(THISDIR)\tif_dirread.obj \
|
||||
$(THISDIR)\tif_dirwrite.obj \
|
||||
$(THISDIR)\tif_dumpmode.obj \
|
||||
$(THISDIR)\tif_error.obj \
|
||||
$(THISDIR)\tif_fax3.obj \
|
||||
$(THISDIR)\tif_fax3sm.obj \
|
||||
$(THISDIR)\tif_flush.obj \
|
||||
$(THISDIR)\tif_getimage.obj \
|
||||
$(THISDIR)\tif_jpeg.obj \
|
||||
$(THISDIR)\tif_luv.obj \
|
||||
$(THISDIR)\tif_lzw.obj \
|
||||
$(THISDIR)\tif_next.obj \
|
||||
$(THISDIR)\tif_open.obj \
|
||||
$(THISDIR)\tif_packbits.obj \
|
||||
$(THISDIR)\tif_pixarlog.obj \
|
||||
$(THISDIR)\tif_predict.obj \
|
||||
$(THISDIR)\tif_print.obj \
|
||||
$(THISDIR)\tif_read.obj \
|
||||
$(THISDIR)\tif_strip.obj \
|
||||
$(THISDIR)\tif_swab.obj \
|
||||
$(THISDIR)\tif_thunder.obj \
|
||||
$(THISDIR)\tif_tile.obj \
|
||||
$(THISDIR)\tif_version.obj \
|
||||
$(THISDIR)\tif_warning.obj \
|
||||
$(THISDIR)\tif_win32.obj \
|
||||
$(THISDIR)\tif_write.obj \
|
||||
$(THISDIR)\tif_zip.obj \
|
||||
|
||||
include $(WXDIR)\src\makelib.sc
|
||||
|
@@ -1,93 +0,0 @@
|
||||
#
|
||||
# Simple MS VC++ Makefile
|
||||
#
|
||||
# To build:
|
||||
# C:\libtiff\libtiff> nmake /f makefile.vc all
|
||||
#
|
||||
|
||||
#
|
||||
# Select _CONSOLE to build a library which reports errors to stderr, or
|
||||
# _WINDOWED to build such that errors are reported via MessageBox().
|
||||
#
|
||||
WINMODE = -DTIF_PLATFORM_CONSOLE
|
||||
#WINMODE = -DTIF_PLATFORM_WINDOWED
|
||||
|
||||
# Uncomment and edit following lines to enable JPEG support
|
||||
#JPEG_SUPPORT = 1
|
||||
#JPEGDIR = d:/projects/jpeg-6b
|
||||
|
||||
CC = cl
|
||||
INCL = -I.
|
||||
LIBS =
|
||||
EXTRAFLAGS =
|
||||
|
||||
!IFDEF JPEG_SUPPORT
|
||||
INCL = $(INCL) -I$(JPEGDIR)
|
||||
EXTRAFLAGS = $(EXTRAFLAGS) -DJPEG_SUPPORT
|
||||
!ENDIF
|
||||
|
||||
CFLAGS = /nologo /W3 $(INCL) $(WINMODE) $(EXTRAFLAGS)
|
||||
|
||||
OBJ = \
|
||||
tif_aux.obj \
|
||||
tif_close.obj \
|
||||
tif_codec.obj \
|
||||
tif_color.obj \
|
||||
tif_compress.obj \
|
||||
tif_dir.obj \
|
||||
tif_dirinfo.obj \
|
||||
tif_dirread.obj \
|
||||
tif_dirwrite.obj \
|
||||
tif_dumpmode.obj \
|
||||
tif_error.obj \
|
||||
tif_extension.obj \
|
||||
tif_fax3.obj \
|
||||
fax3sm_winnt.obj \
|
||||
tif_getimage.obj \
|
||||
tif_jpeg.obj \
|
||||
tif_ojpeg.obj \
|
||||
tif_flush.obj \
|
||||
tif_luv.obj \
|
||||
tif_lzw.obj \
|
||||
tif_next.obj \
|
||||
tif_open.obj \
|
||||
tif_packbits.obj \
|
||||
tif_pixarlog.obj \
|
||||
tif_predict.obj \
|
||||
tif_print.obj \
|
||||
tif_read.obj \
|
||||
tif_swab.obj \
|
||||
tif_strip.obj \
|
||||
tif_thunder.obj \
|
||||
tif_tile.obj \
|
||||
tif_win32.obj \
|
||||
tif_version.obj \
|
||||
tif_warning.obj \
|
||||
tif_write.obj \
|
||||
tif_zip.obj
|
||||
|
||||
VERSION = ..\VERSION
|
||||
ALPHA = ..\dist\tiff.alpha
|
||||
|
||||
default: libtiff.lib
|
||||
|
||||
all: libtiff.lib libtiff.dll
|
||||
|
||||
libtiff.lib: tiffvers.h $(OBJ)
|
||||
lib /out:libtiff.lib $(OBJ)
|
||||
|
||||
libtiff.dll: $(OBJ)
|
||||
link /dll /def:libtiff.def /out:libtiff.dll /implib:libtiff_i.lib \
|
||||
$(OBJ) $(LIBS)
|
||||
|
||||
tiffvers.h: $(VERSION) mkversion.c
|
||||
$(CC) mkversion.c
|
||||
if exist tiffvers.h del tiffvers.h
|
||||
.\mkversion.exe -v $(VERSION) tiffvers.h
|
||||
|
||||
clean:
|
||||
del *.obj *.lib libtiff.dll
|
||||
|
||||
tif_version.obj: tiffvers.h
|
||||
|
||||
|
@@ -1,165 +0,0 @@
|
||||
#!/binb/wmake.exe
|
||||
#
|
||||
# File: makefile.wat
|
||||
# Author: Julian Smart
|
||||
# Created: 1998
|
||||
# Changelist: 2003-02-25 - Juergen Ulbts - update from wxWindows 2.5.x/HEAD branch
|
||||
#
|
||||
# Makefile : Builds TIFF library for Watcom C++, WIN32
|
||||
# This makefile has to rename files because apparently Watcom C++
|
||||
# can't deal with greater than 8.3 filenames (can't
|
||||
# make tif_close.c, for example)
|
||||
|
||||
WXDIR = ..\..
|
||||
EXTRACPPFLAGS=-i=..\zlib
|
||||
|
||||
!include $(WXDIR)\src\makewat.env
|
||||
|
||||
# set RENAME to 1 to rename the files to the short names -- this is needed
|
||||
# with older Watcom versions
|
||||
# RENAME=1
|
||||
|
||||
!ifeq RENAME 1
|
||||
TIFF=
|
||||
EXTRACPPFLAGS+=-dwxUSE_SHORTNAMES
|
||||
!else
|
||||
TIFF=tif_
|
||||
!endif
|
||||
|
||||
WXLIB = $(WXDIR)\lib
|
||||
|
||||
LIBTARGET = $(WXLIB)\tiff$(WATCOM_SUFFIX).lib
|
||||
|
||||
OBJECTS= &
|
||||
!ifeq RENAME 1
|
||||
$(OUTPUTDIR)\_aux.obj &
|
||||
!else
|
||||
$(OUTPUTDIR)\tif_aux.obj &
|
||||
!endif
|
||||
$(OUTPUTDIR)\$(TIFF)close.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)codec.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)compress.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)dir.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)dirinfo.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)dirread.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)dirwrite.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)dumpmode.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)error.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)fax3.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)fax3sm.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)flush.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)getimage.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)jpeg.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)luv.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)lzw.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)next.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)open.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)packbits.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)pixarlog.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)predict.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)print.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)read.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)strip.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)swab.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)thunder.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)tile.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)version.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)warning.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)win32.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)write.obj &
|
||||
$(OUTPUTDIR)\$(TIFF)zip.obj
|
||||
|
||||
all: $(OUTPUTDIR) $(RENAME) $(LIBTARGET) .SYMBOLIC
|
||||
|
||||
!ifeq RENAME 1
|
||||
rename: .SYMBOLIC
|
||||
copy tif_predict.h tif_pred.h
|
||||
copy tif_aux.c _aux.c
|
||||
copy tif_close.c close.c
|
||||
copy tif_codec.c codec.c
|
||||
copy tif_compress.c compress.c
|
||||
copy tif_dir.c dir.c
|
||||
copy tif_dirinfo.c dirinfo.c
|
||||
copy tif_dirread.c dirread.c
|
||||
copy tif_dirwrite.c dirwrite.c
|
||||
copy tif_dumpmode.c dumpmode.c
|
||||
copy tif_error.c error.c
|
||||
copy tif_fax3.c fax3.c
|
||||
copy tif_fax3sm.c fax3sm.c
|
||||
copy tif_flush.c flush.c
|
||||
copy tif_getimage.c getimage.c
|
||||
copy tif_jpeg.c jpeg.c
|
||||
copy tif_luv.c luv.c
|
||||
copy tif_lzw.c lzw.c
|
||||
copy tif_next.c next.c
|
||||
copy tif_open.c open.c
|
||||
copy tif_packbits.c packbits.c
|
||||
copy tif_pixarlog.c pixarlog.c
|
||||
copy tif_predict.c predict.c
|
||||
copy tif_print.c print.c
|
||||
copy tif_read.c read.c
|
||||
copy tif_strip.c strip.c
|
||||
copy tif_swab.c swab.c
|
||||
copy tif_thunder.c thunder.c
|
||||
copy tif_tile.c tile.c
|
||||
copy tif_version.c version.c
|
||||
copy tif_warning.c warning.c
|
||||
copy tif_win32.c win32.c
|
||||
copy tif_write.c write.c
|
||||
copy tif_zip.c zip.c
|
||||
!endif
|
||||
|
||||
$(OUTPUTDIR):
|
||||
@if not exist $^@ mkdir $^@
|
||||
|
||||
LBCFILE=$(OUTPUTDIR)\tiff.lbc
|
||||
$(LIBTARGET) : $(OBJECTS)
|
||||
%create $(LBCFILE)
|
||||
@for %i in ( $(OBJECTS) ) do @%append $(LBCFILE) +%i
|
||||
wlib /q /b /c /n /p=512 $^@ @$(LBCFILE)
|
||||
|
||||
clean: .SYMBOLIC
|
||||
-erase *.obj
|
||||
-erase $(LIBTARGET)
|
||||
-erase *.pch
|
||||
-erase *.err
|
||||
-erase *.lbc
|
||||
!ifeq RENAME 1
|
||||
-erase tif_pred.h
|
||||
-erase _aux.c
|
||||
-erase close.c
|
||||
-erase codec.c
|
||||
-erase compress.c
|
||||
-erase dir.c
|
||||
-erase dirinfo.c
|
||||
-erase dirread.c
|
||||
-erase dirwrite.c
|
||||
-erase dumpmode.c
|
||||
-erase error.c
|
||||
-erase fax3.c
|
||||
-erase fax3sm.c
|
||||
-erase flush.c
|
||||
-erase getimage.c
|
||||
-erase jpeg.c
|
||||
-erase luv.c
|
||||
-erase lzw.c
|
||||
-erase next.c
|
||||
-erase open.c
|
||||
-erase packbits.c
|
||||
-erase pixarlog.c
|
||||
-erase predict.c
|
||||
-erase print.c
|
||||
-erase read.c
|
||||
-erase strip.c
|
||||
-erase swab.c
|
||||
-erase thunder.c
|
||||
-erase tile.c
|
||||
-erase version.c
|
||||
-erase warning.c
|
||||
-erase win32.c
|
||||
-erase write.c
|
||||
-erase zip.c
|
||||
!endif
|
||||
|
||||
cleanall: clean
|
||||
|
Binary file not shown.
@@ -1,436 +0,0 @@
|
||||
/* "$Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Initialise fax decoder tables
|
||||
* Decoder support is derived, with permission, from the code
|
||||
* in Frank Cringle's viewfax program;
|
||||
* Copyright (C) 1990, 1995 Frank D. Cringle.
|
||||
*/
|
||||
#if defined(unix) || defined(__unix)
|
||||
#include "port.h"
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "tif_fax3.h"
|
||||
|
||||
#define streq(a,b) (strcmp(a,b) == 0)
|
||||
|
||||
/* NB: can't use names in tif_fax3.h 'cuz they are declared const */
|
||||
TIFFFaxTabEnt MainTable[128];
|
||||
TIFFFaxTabEnt WhiteTable[4096];
|
||||
TIFFFaxTabEnt BlackTable[8192];
|
||||
|
||||
struct proto {
|
||||
uint16 code; /* right justified, lsb-first, zero filled */
|
||||
uint16 val; /* (pixel count)<<4 + code width */
|
||||
};
|
||||
|
||||
static struct proto Pass[] = {
|
||||
{ 0x0008, 4 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto Horiz[] = {
|
||||
{ 0x0004, 3 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto V0[] = {
|
||||
{ 0x0001, 1 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto VR[] = {
|
||||
{ 0x0006, (1<<4)+3 },
|
||||
{ 0x0030, (2<<4)+6 },
|
||||
{ 0x0060, (3<<4)+7 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto VL[] = {
|
||||
{ 0x0002, (1<<4)+3 },
|
||||
{ 0x0010, (2<<4)+6 },
|
||||
{ 0x0020, (3<<4)+7 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto Ext[] = {
|
||||
{ 0x0040, 7 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto EOLV[] = {
|
||||
{ 0x0000, 7 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto MakeUpW[] = {
|
||||
{ 0x001b, 1029 },
|
||||
{ 0x0009, 2053 },
|
||||
{ 0x003a, 3078 },
|
||||
{ 0x0076, 4103 },
|
||||
{ 0x006c, 5128 },
|
||||
{ 0x00ec, 6152 },
|
||||
{ 0x0026, 7176 },
|
||||
{ 0x00a6, 8200 },
|
||||
{ 0x0016, 9224 },
|
||||
{ 0x00e6, 10248 },
|
||||
{ 0x0066, 11273 },
|
||||
{ 0x0166, 12297 },
|
||||
{ 0x0096, 13321 },
|
||||
{ 0x0196, 14345 },
|
||||
{ 0x0056, 15369 },
|
||||
{ 0x0156, 16393 },
|
||||
{ 0x00d6, 17417 },
|
||||
{ 0x01d6, 18441 },
|
||||
{ 0x0036, 19465 },
|
||||
{ 0x0136, 20489 },
|
||||
{ 0x00b6, 21513 },
|
||||
{ 0x01b6, 22537 },
|
||||
{ 0x0032, 23561 },
|
||||
{ 0x0132, 24585 },
|
||||
{ 0x00b2, 25609 },
|
||||
{ 0x0006, 26630 },
|
||||
{ 0x01b2, 27657 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto MakeUpB[] = {
|
||||
{ 0x03c0, 1034 },
|
||||
{ 0x0130, 2060 },
|
||||
{ 0x0930, 3084 },
|
||||
{ 0x0da0, 4108 },
|
||||
{ 0x0cc0, 5132 },
|
||||
{ 0x02c0, 6156 },
|
||||
{ 0x0ac0, 7180 },
|
||||
{ 0x06c0, 8205 },
|
||||
{ 0x16c0, 9229 },
|
||||
{ 0x0a40, 10253 },
|
||||
{ 0x1a40, 11277 },
|
||||
{ 0x0640, 12301 },
|
||||
{ 0x1640, 13325 },
|
||||
{ 0x09c0, 14349 },
|
||||
{ 0x19c0, 15373 },
|
||||
{ 0x05c0, 16397 },
|
||||
{ 0x15c0, 17421 },
|
||||
{ 0x0dc0, 18445 },
|
||||
{ 0x1dc0, 19469 },
|
||||
{ 0x0940, 20493 },
|
||||
{ 0x1940, 21517 },
|
||||
{ 0x0540, 22541 },
|
||||
{ 0x1540, 23565 },
|
||||
{ 0x0b40, 24589 },
|
||||
{ 0x1b40, 25613 },
|
||||
{ 0x04c0, 26637 },
|
||||
{ 0x14c0, 27661 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto MakeUp[] = {
|
||||
{ 0x0080, 28683 },
|
||||
{ 0x0180, 29707 },
|
||||
{ 0x0580, 30731 },
|
||||
{ 0x0480, 31756 },
|
||||
{ 0x0c80, 32780 },
|
||||
{ 0x0280, 33804 },
|
||||
{ 0x0a80, 34828 },
|
||||
{ 0x0680, 35852 },
|
||||
{ 0x0e80, 36876 },
|
||||
{ 0x0380, 37900 },
|
||||
{ 0x0b80, 38924 },
|
||||
{ 0x0780, 39948 },
|
||||
{ 0x0f80, 40972 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto TermW[] = {
|
||||
{ 0x00ac, 8 },
|
||||
{ 0x0038, 22 },
|
||||
{ 0x000e, 36 },
|
||||
{ 0x0001, 52 },
|
||||
{ 0x000d, 68 },
|
||||
{ 0x0003, 84 },
|
||||
{ 0x0007, 100 },
|
||||
{ 0x000f, 116 },
|
||||
{ 0x0019, 133 },
|
||||
{ 0x0005, 149 },
|
||||
{ 0x001c, 165 },
|
||||
{ 0x0002, 181 },
|
||||
{ 0x0004, 198 },
|
||||
{ 0x0030, 214 },
|
||||
{ 0x000b, 230 },
|
||||
{ 0x002b, 246 },
|
||||
{ 0x0015, 262 },
|
||||
{ 0x0035, 278 },
|
||||
{ 0x0072, 295 },
|
||||
{ 0x0018, 311 },
|
||||
{ 0x0008, 327 },
|
||||
{ 0x0074, 343 },
|
||||
{ 0x0060, 359 },
|
||||
{ 0x0010, 375 },
|
||||
{ 0x000a, 391 },
|
||||
{ 0x006a, 407 },
|
||||
{ 0x0064, 423 },
|
||||
{ 0x0012, 439 },
|
||||
{ 0x000c, 455 },
|
||||
{ 0x0040, 472 },
|
||||
{ 0x00c0, 488 },
|
||||
{ 0x0058, 504 },
|
||||
{ 0x00d8, 520 },
|
||||
{ 0x0048, 536 },
|
||||
{ 0x00c8, 552 },
|
||||
{ 0x0028, 568 },
|
||||
{ 0x00a8, 584 },
|
||||
{ 0x0068, 600 },
|
||||
{ 0x00e8, 616 },
|
||||
{ 0x0014, 632 },
|
||||
{ 0x0094, 648 },
|
||||
{ 0x0054, 664 },
|
||||
{ 0x00d4, 680 },
|
||||
{ 0x0034, 696 },
|
||||
{ 0x00b4, 712 },
|
||||
{ 0x0020, 728 },
|
||||
{ 0x00a0, 744 },
|
||||
{ 0x0050, 760 },
|
||||
{ 0x00d0, 776 },
|
||||
{ 0x004a, 792 },
|
||||
{ 0x00ca, 808 },
|
||||
{ 0x002a, 824 },
|
||||
{ 0x00aa, 840 },
|
||||
{ 0x0024, 856 },
|
||||
{ 0x00a4, 872 },
|
||||
{ 0x001a, 888 },
|
||||
{ 0x009a, 904 },
|
||||
{ 0x005a, 920 },
|
||||
{ 0x00da, 936 },
|
||||
{ 0x0052, 952 },
|
||||
{ 0x00d2, 968 },
|
||||
{ 0x004c, 984 },
|
||||
{ 0x00cc, 1000 },
|
||||
{ 0x002c, 1016 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto TermB[] = {
|
||||
{ 0x03b0, 10 },
|
||||
{ 0x0002, 19 },
|
||||
{ 0x0003, 34 },
|
||||
{ 0x0001, 50 },
|
||||
{ 0x0006, 67 },
|
||||
{ 0x000c, 84 },
|
||||
{ 0x0004, 100 },
|
||||
{ 0x0018, 117 },
|
||||
{ 0x0028, 134 },
|
||||
{ 0x0008, 150 },
|
||||
{ 0x0010, 167 },
|
||||
{ 0x0050, 183 },
|
||||
{ 0x0070, 199 },
|
||||
{ 0x0020, 216 },
|
||||
{ 0x00e0, 232 },
|
||||
{ 0x0030, 249 },
|
||||
{ 0x03a0, 266 },
|
||||
{ 0x0060, 282 },
|
||||
{ 0x0040, 298 },
|
||||
{ 0x0730, 315 },
|
||||
{ 0x00b0, 331 },
|
||||
{ 0x01b0, 347 },
|
||||
{ 0x0760, 363 },
|
||||
{ 0x00a0, 379 },
|
||||
{ 0x0740, 395 },
|
||||
{ 0x00c0, 411 },
|
||||
{ 0x0530, 428 },
|
||||
{ 0x0d30, 444 },
|
||||
{ 0x0330, 460 },
|
||||
{ 0x0b30, 476 },
|
||||
{ 0x0160, 492 },
|
||||
{ 0x0960, 508 },
|
||||
{ 0x0560, 524 },
|
||||
{ 0x0d60, 540 },
|
||||
{ 0x04b0, 556 },
|
||||
{ 0x0cb0, 572 },
|
||||
{ 0x02b0, 588 },
|
||||
{ 0x0ab0, 604 },
|
||||
{ 0x06b0, 620 },
|
||||
{ 0x0eb0, 636 },
|
||||
{ 0x0360, 652 },
|
||||
{ 0x0b60, 668 },
|
||||
{ 0x05b0, 684 },
|
||||
{ 0x0db0, 700 },
|
||||
{ 0x02a0, 716 },
|
||||
{ 0x0aa0, 732 },
|
||||
{ 0x06a0, 748 },
|
||||
{ 0x0ea0, 764 },
|
||||
{ 0x0260, 780 },
|
||||
{ 0x0a60, 796 },
|
||||
{ 0x04a0, 812 },
|
||||
{ 0x0ca0, 828 },
|
||||
{ 0x0240, 844 },
|
||||
{ 0x0ec0, 860 },
|
||||
{ 0x01c0, 876 },
|
||||
{ 0x0e40, 892 },
|
||||
{ 0x0140, 908 },
|
||||
{ 0x01a0, 924 },
|
||||
{ 0x09a0, 940 },
|
||||
{ 0x0d40, 956 },
|
||||
{ 0x0340, 972 },
|
||||
{ 0x05a0, 988 },
|
||||
{ 0x0660, 1004 },
|
||||
{ 0x0e60, 1020 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static struct proto EOLH[] = {
|
||||
{ 0x0000, 11 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static void
|
||||
FillTable(TIFFFaxTabEnt *T, int Size, struct proto *P, int State)
|
||||
{
|
||||
int limit = 1 << Size;
|
||||
|
||||
while (P->val) {
|
||||
int width = P->val & 15;
|
||||
int param = P->val >> 4;
|
||||
int incr = 1 << width;
|
||||
int code;
|
||||
for (code = P->code; code < limit; code += incr) {
|
||||
TIFFFaxTabEnt *E = T+code;
|
||||
E->State = State;
|
||||
E->Width = width;
|
||||
E->Param = param;
|
||||
}
|
||||
P++;
|
||||
}
|
||||
}
|
||||
|
||||
static char* storage_class = "";
|
||||
static char* const_class = "";
|
||||
static int packoutput = 1;
|
||||
static char* prebrace = "";
|
||||
static char* postbrace = "";
|
||||
|
||||
void
|
||||
WriteTable(FILE* fd, const TIFFFaxTabEnt* T, int Size, const char* name)
|
||||
{
|
||||
int i;
|
||||
char* sep;
|
||||
|
||||
fprintf(fd, "%s %s TIFFFaxTabEnt %s[%d] = {",
|
||||
storage_class, const_class, name, Size);
|
||||
if (packoutput) {
|
||||
sep = "\n";
|
||||
for (i = 0; i < Size; i++) {
|
||||
fprintf(fd, "%s%s%d,%d,%d%s",
|
||||
sep, prebrace, T->State, T->Width, (int) T->Param, postbrace);
|
||||
if (((i+1) % 12) == 0)
|
||||
sep = ",\n";
|
||||
else
|
||||
sep = ",";
|
||||
T++;
|
||||
}
|
||||
} else {
|
||||
sep = "\n ";
|
||||
for (i = 0; i < Size; i++) {
|
||||
fprintf(fd, "%s%s%3d,%3d,%4d%s",
|
||||
sep, prebrace, T->State, T->Width, (int) T->Param, postbrace);
|
||||
if (((i+1) % 6) == 0)
|
||||
sep = ",\n ";
|
||||
else
|
||||
sep = ",";
|
||||
T++;
|
||||
}
|
||||
}
|
||||
fprintf(fd, "\n};\n");
|
||||
}
|
||||
|
||||
/* initialise the huffman code tables */
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
FILE* fd;
|
||||
char* outputfile;
|
||||
int c;
|
||||
extern int optind;
|
||||
extern char* optarg;
|
||||
|
||||
while ((c = getopt(argc, argv, "c:s:bp")) != -1)
|
||||
switch (c) {
|
||||
case 'c':
|
||||
const_class = optarg;
|
||||
break;
|
||||
case 's':
|
||||
storage_class = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
packoutput = 0;
|
||||
break;
|
||||
case 'b':
|
||||
prebrace = "{";
|
||||
postbrace = "}";
|
||||
break;
|
||||
case '?':
|
||||
fprintf(stderr,
|
||||
"usage: %s [-c const] [-s storage] [-p] [-b] file\n",
|
||||
argv[0]);
|
||||
return (-1);
|
||||
}
|
||||
outputfile = optind < argc ? argv[optind] : "g3states.h";
|
||||
fd = fopen(outputfile, "w");
|
||||
if (fd == NULL) {
|
||||
fprintf(stderr, "%s: %s: Cannot create output file.\n",
|
||||
argv[0], outputfile);
|
||||
return (-2);
|
||||
}
|
||||
FillTable(MainTable, 7, Pass, S_Pass);
|
||||
FillTable(MainTable, 7, Horiz, S_Horiz);
|
||||
FillTable(MainTable, 7, V0, S_V0);
|
||||
FillTable(MainTable, 7, VR, S_VR);
|
||||
FillTable(MainTable, 7, VL, S_VL);
|
||||
FillTable(MainTable, 7, Ext, S_Ext);
|
||||
FillTable(MainTable, 7, EOLV, S_EOL);
|
||||
FillTable(WhiteTable, 12, MakeUpW, S_MakeUpW);
|
||||
FillTable(WhiteTable, 12, MakeUp, S_MakeUp);
|
||||
FillTable(WhiteTable, 12, TermW, S_TermW);
|
||||
FillTable(WhiteTable, 12, EOLH, S_EOL);
|
||||
FillTable(BlackTable, 13, MakeUpB, S_MakeUpB);
|
||||
FillTable(BlackTable, 13, MakeUp, S_MakeUp);
|
||||
FillTable(BlackTable, 13, TermB, S_TermB);
|
||||
FillTable(BlackTable, 13, EOLH, S_EOL);
|
||||
|
||||
fprintf(fd, "/* WARNING, this file was automatically generated by the\n");
|
||||
fprintf(fd, " mkg3states program */\n");
|
||||
fprintf(fd, "#include \"tiff.h\"\n");
|
||||
fprintf(fd, "#include \"tif_fax3.h\"\n");
|
||||
WriteTable(fd, MainTable, 128, "TIFFFaxMainTable");
|
||||
WriteTable(fd, WhiteTable, 4096, "TIFFFaxWhiteTable");
|
||||
WriteTable(fd, BlackTable, 8192, "TIFFFaxBlackTable");
|
||||
fclose(fd);
|
||||
return (0);
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "tiffcomp.h"
|
||||
|
||||
/*
|
||||
* Hack program to construct tables used to find
|
||||
* runs of zeros and ones in Group 3 Fax encoding.
|
||||
*/
|
||||
|
||||
dumparray(name, runs)
|
||||
char *name;
|
||||
unsigned char runs[256];
|
||||
{
|
||||
register int i;
|
||||
register char *sep;
|
||||
printf("static u_char %s[256] = {\n", name);
|
||||
sep = " ";
|
||||
for (i = 0; i < 256; i++) {
|
||||
printf("%s%d", sep, runs[i]);
|
||||
if (((i + 1) % 16) == 0) {
|
||||
printf(", /* 0x%02x - 0x%02x */\n", i-15, i);
|
||||
sep = " ";
|
||||
} else
|
||||
sep = ", ";
|
||||
}
|
||||
printf("\n};\n");
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
unsigned char runs[2][256];
|
||||
|
||||
memset(runs[0], 0, 256*sizeof (char));
|
||||
memset(runs[1], 0, 256*sizeof (char));
|
||||
{ register int run, runlen, i;
|
||||
runlen = 1;
|
||||
for (run = 0x80; run != 0xff; run = (run>>1)|0x80) {
|
||||
for (i = run-1; i >= 0; i--) {
|
||||
runs[1][run|i] = runlen;
|
||||
runs[0][(~(run|i)) & 0xff] = runlen;
|
||||
}
|
||||
runlen++;
|
||||
}
|
||||
runs[1][0xff] = runs[0][0] = 8;
|
||||
}
|
||||
dumparray("bruns", runs[0]);
|
||||
dumparray("wruns", runs[1]);
|
||||
}
|
@@ -1,148 +0,0 @@
|
||||
/* "$Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-1997 Sam Leffler
|
||||
* Copyright (c) 1995-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generate a library version string for systems that
|
||||
* do not have a shell (by default this is done with
|
||||
* awk and echo from the Makefile).
|
||||
*
|
||||
* This was written by Peter Greenham for Acorn systems.
|
||||
*
|
||||
* Syntax: mkversion [-v version-file] [<outfile>]
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: mkversion [-v version-file]\n"
|
||||
" [-r releasedate-file] [outfile]\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
static FILE*
|
||||
openFile(char* filename)
|
||||
{
|
||||
FILE* fd = fopen(filename, "r");
|
||||
if (fd == NULL) {
|
||||
fprintf(stderr, "mkversion: %s: Could not open for reading.\n",
|
||||
filename);
|
||||
exit(-1);
|
||||
}
|
||||
return (fd);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
char* versionFile = "../VERSION";
|
||||
char* releaseDateFile = "../RELEASE-DATE";
|
||||
char version[128];
|
||||
char rawReleaseDate[128];
|
||||
char tiffLibVersion[128];
|
||||
FILE* fd;
|
||||
char* cp;
|
||||
|
||||
argc--, argv++;
|
||||
while (argc > 0 && argv[0][0] == '-') {
|
||||
if (strcmp(argv[0], "-v") == 0) {
|
||||
if (argc < 1)
|
||||
usage();
|
||||
argc--, argv++;
|
||||
versionFile = argv[0];
|
||||
} else if (strcmp(argv[0], "-r") == 0) {
|
||||
if (argc < 1)
|
||||
usage();
|
||||
argc--, argv++;
|
||||
releaseDateFile = argv[0];
|
||||
} else
|
||||
usage();
|
||||
argc--, argv++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the VERSION file.
|
||||
*/
|
||||
fd = openFile(versionFile);
|
||||
if (fgets(version, sizeof (version)-1, fd) == NULL) {
|
||||
fprintf(stderr, "mkversion: No version information in %s.\n",
|
||||
versionFile);
|
||||
exit(-1);
|
||||
}
|
||||
cp = strchr(version, '\n');
|
||||
if (cp)
|
||||
*cp = '\0';
|
||||
fclose(fd);
|
||||
|
||||
/*
|
||||
* Read the RELEASE-DATE, and translate format to emit TIFFLIB_VERSION.
|
||||
*/
|
||||
fd = openFile(releaseDateFile);
|
||||
if (fgets(rawReleaseDate, sizeof (rawReleaseDate)-1, fd) == NULL) {
|
||||
fprintf(stderr, "mkversion: No release date information in %s.\n",
|
||||
releaseDateFile);
|
||||
exit(-1);
|
||||
}
|
||||
fclose(fd);
|
||||
|
||||
sprintf( tiffLibVersion, "#define TIFFLIB_VERSION %4.4s%2.2s%2.2s",
|
||||
rawReleaseDate+6,
|
||||
rawReleaseDate+0,
|
||||
rawReleaseDate+3 );
|
||||
|
||||
/*
|
||||
* Emit the tiffvers.h file.
|
||||
*/
|
||||
if (argc > 0) {
|
||||
fd = fopen(argv[0], "w");
|
||||
if (fd == NULL) {
|
||||
fprintf(stderr, "mkversion: %s: Could not open for writing.\n",
|
||||
argv[0]);
|
||||
exit(-1);
|
||||
}
|
||||
} else
|
||||
fd = stdout;
|
||||
fprintf(fd, "#define TIFFLIB_VERSION_STR \"LIBTIFF, Version %s\\n", version);
|
||||
fprintf(fd, "Copyright (c) 1988-1996 Sam Leffler\\n");
|
||||
fprintf(fd, "Copyright (c) 1991-1996 Silicon Graphics, Inc.\"\n");
|
||||
|
||||
fprintf( fd,
|
||||
"/*\n"
|
||||
" * This define can be used in code that requires\n"
|
||||
" * compilation-related definitions specific to a\n"
|
||||
" * version or versions of the library. Runtime\n"
|
||||
" * version checking should be done based on the\n"
|
||||
" * string returned by TIFFGetVersion.\n"
|
||||
" */\n" );
|
||||
fprintf(fd, "%s\n", tiffLibVersion );
|
||||
|
||||
if (fd != stdout)
|
||||
fclose(fd);
|
||||
return (0);
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Warning, this file was automatically created by the TIFF configure script
|
||||
* Actually, it has been modified to use wxWidgets' values.
|
||||
* VERSION: v3.5.2
|
||||
* DATE: Son Nov 28 15:15:07 GMT 1999
|
||||
* TARGET:
|
||||
* CCOMPILER:
|
||||
*/
|
||||
#ifndef _PORT_
|
||||
#define _PORT_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#define HOST_FILLORDER FILLORDER_LSB2MSB
|
||||
|
||||
/* wxWidgets defines WORDS_BIGENDIAN */
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define HOST_BIGENDIAN 1
|
||||
#else
|
||||
#define HOST_BIGENDIAN 0
|
||||
#endif
|
||||
|
||||
/* wxWidgets defines its own reading and writing routines */
|
||||
/* #define HAVE_MMAP 1 */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
typedef double dblparam_t;
|
||||
|
||||
#ifdef __STRICT_ANSI__
|
||||
#define INLINE __inline__
|
||||
#else
|
||||
#define INLINE inline
|
||||
#endif
|
||||
|
||||
#define GLOBALDATA(TYPE,NAME) extern TYPE NAME
|
||||
|
||||
/* wxWidgets defines wxUSE_LIBJPEG */
|
||||
#if wxUSE_LIBJPEG
|
||||
#define JPEG_SUPPORT
|
||||
#endif
|
||||
|
||||
/* wxWidgets defines wxUSE_ZLIB */
|
||||
#if wxUSE_ZLIB
|
||||
#define ZIP_SUPPORT
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
285
src/tiff/t4.h
285
src/tiff/t4.h
@@ -1,285 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _T4_
|
||||
#define _T4_
|
||||
/*
|
||||
* CCITT T.4 1D Huffman runlength codes and
|
||||
* related definitions. Given the small sizes
|
||||
* of these tables it does not seem
|
||||
* worthwhile to make code & length 8 bits.
|
||||
*/
|
||||
typedef struct tableentry {
|
||||
unsigned short length; /* bit length of g3 code */
|
||||
unsigned short code; /* g3 code */
|
||||
short runlen; /* run length in bits */
|
||||
} tableentry;
|
||||
|
||||
#define EOL 0x001 /* EOL code value - 0000 0000 0000 1 */
|
||||
|
||||
/* status values returned instead of a run length */
|
||||
#define G3CODE_EOL -1 /* NB: ACT_EOL - ACT_WRUNT */
|
||||
#define G3CODE_INVALID -2 /* NB: ACT_INVALID - ACT_WRUNT */
|
||||
#define G3CODE_EOF -3 /* end of input data */
|
||||
#define G3CODE_INCOMP -4 /* incomplete run code */
|
||||
|
||||
/*
|
||||
* Note that these tables are ordered such that the
|
||||
* index into the table is known to be either the
|
||||
* run length, or (run length / 64) + a fixed offset.
|
||||
*
|
||||
* NB: The G3CODE_INVALID entries are only used
|
||||
* during state generation (see mkg3states.c).
|
||||
*/
|
||||
#ifdef G3CODES
|
||||
const tableentry TIFFFaxWhiteCodes[] = {
|
||||
{ 8, 0x35, 0 }, /* 0011 0101 */
|
||||
{ 6, 0x7, 1 }, /* 0001 11 */
|
||||
{ 4, 0x7, 2 }, /* 0111 */
|
||||
{ 4, 0x8, 3 }, /* 1000 */
|
||||
{ 4, 0xB, 4 }, /* 1011 */
|
||||
{ 4, 0xC, 5 }, /* 1100 */
|
||||
{ 4, 0xE, 6 }, /* 1110 */
|
||||
{ 4, 0xF, 7 }, /* 1111 */
|
||||
{ 5, 0x13, 8 }, /* 1001 1 */
|
||||
{ 5, 0x14, 9 }, /* 1010 0 */
|
||||
{ 5, 0x7, 10 }, /* 0011 1 */
|
||||
{ 5, 0x8, 11 }, /* 0100 0 */
|
||||
{ 6, 0x8, 12 }, /* 0010 00 */
|
||||
{ 6, 0x3, 13 }, /* 0000 11 */
|
||||
{ 6, 0x34, 14 }, /* 1101 00 */
|
||||
{ 6, 0x35, 15 }, /* 1101 01 */
|
||||
{ 6, 0x2A, 16 }, /* 1010 10 */
|
||||
{ 6, 0x2B, 17 }, /* 1010 11 */
|
||||
{ 7, 0x27, 18 }, /* 0100 111 */
|
||||
{ 7, 0xC, 19 }, /* 0001 100 */
|
||||
{ 7, 0x8, 20 }, /* 0001 000 */
|
||||
{ 7, 0x17, 21 }, /* 0010 111 */
|
||||
{ 7, 0x3, 22 }, /* 0000 011 */
|
||||
{ 7, 0x4, 23 }, /* 0000 100 */
|
||||
{ 7, 0x28, 24 }, /* 0101 000 */
|
||||
{ 7, 0x2B, 25 }, /* 0101 011 */
|
||||
{ 7, 0x13, 26 }, /* 0010 011 */
|
||||
{ 7, 0x24, 27 }, /* 0100 100 */
|
||||
{ 7, 0x18, 28 }, /* 0011 000 */
|
||||
{ 8, 0x2, 29 }, /* 0000 0010 */
|
||||
{ 8, 0x3, 30 }, /* 0000 0011 */
|
||||
{ 8, 0x1A, 31 }, /* 0001 1010 */
|
||||
{ 8, 0x1B, 32 }, /* 0001 1011 */
|
||||
{ 8, 0x12, 33 }, /* 0001 0010 */
|
||||
{ 8, 0x13, 34 }, /* 0001 0011 */
|
||||
{ 8, 0x14, 35 }, /* 0001 0100 */
|
||||
{ 8, 0x15, 36 }, /* 0001 0101 */
|
||||
{ 8, 0x16, 37 }, /* 0001 0110 */
|
||||
{ 8, 0x17, 38 }, /* 0001 0111 */
|
||||
{ 8, 0x28, 39 }, /* 0010 1000 */
|
||||
{ 8, 0x29, 40 }, /* 0010 1001 */
|
||||
{ 8, 0x2A, 41 }, /* 0010 1010 */
|
||||
{ 8, 0x2B, 42 }, /* 0010 1011 */
|
||||
{ 8, 0x2C, 43 }, /* 0010 1100 */
|
||||
{ 8, 0x2D, 44 }, /* 0010 1101 */
|
||||
{ 8, 0x4, 45 }, /* 0000 0100 */
|
||||
{ 8, 0x5, 46 }, /* 0000 0101 */
|
||||
{ 8, 0xA, 47 }, /* 0000 1010 */
|
||||
{ 8, 0xB, 48 }, /* 0000 1011 */
|
||||
{ 8, 0x52, 49 }, /* 0101 0010 */
|
||||
{ 8, 0x53, 50 }, /* 0101 0011 */
|
||||
{ 8, 0x54, 51 }, /* 0101 0100 */
|
||||
{ 8, 0x55, 52 }, /* 0101 0101 */
|
||||
{ 8, 0x24, 53 }, /* 0010 0100 */
|
||||
{ 8, 0x25, 54 }, /* 0010 0101 */
|
||||
{ 8, 0x58, 55 }, /* 0101 1000 */
|
||||
{ 8, 0x59, 56 }, /* 0101 1001 */
|
||||
{ 8, 0x5A, 57 }, /* 0101 1010 */
|
||||
{ 8, 0x5B, 58 }, /* 0101 1011 */
|
||||
{ 8, 0x4A, 59 }, /* 0100 1010 */
|
||||
{ 8, 0x4B, 60 }, /* 0100 1011 */
|
||||
{ 8, 0x32, 61 }, /* 0011 0010 */
|
||||
{ 8, 0x33, 62 }, /* 0011 0011 */
|
||||
{ 8, 0x34, 63 }, /* 0011 0100 */
|
||||
{ 5, 0x1B, 64 }, /* 1101 1 */
|
||||
{ 5, 0x12, 128 }, /* 1001 0 */
|
||||
{ 6, 0x17, 192 }, /* 0101 11 */
|
||||
{ 7, 0x37, 256 }, /* 0110 111 */
|
||||
{ 8, 0x36, 320 }, /* 0011 0110 */
|
||||
{ 8, 0x37, 384 }, /* 0011 0111 */
|
||||
{ 8, 0x64, 448 }, /* 0110 0100 */
|
||||
{ 8, 0x65, 512 }, /* 0110 0101 */
|
||||
{ 8, 0x68, 576 }, /* 0110 1000 */
|
||||
{ 8, 0x67, 640 }, /* 0110 0111 */
|
||||
{ 9, 0xCC, 704 }, /* 0110 0110 0 */
|
||||
{ 9, 0xCD, 768 }, /* 0110 0110 1 */
|
||||
{ 9, 0xD2, 832 }, /* 0110 1001 0 */
|
||||
{ 9, 0xD3, 896 }, /* 0110 1001 1 */
|
||||
{ 9, 0xD4, 960 }, /* 0110 1010 0 */
|
||||
{ 9, 0xD5, 1024 }, /* 0110 1010 1 */
|
||||
{ 9, 0xD6, 1088 }, /* 0110 1011 0 */
|
||||
{ 9, 0xD7, 1152 }, /* 0110 1011 1 */
|
||||
{ 9, 0xD8, 1216 }, /* 0110 1100 0 */
|
||||
{ 9, 0xD9, 1280 }, /* 0110 1100 1 */
|
||||
{ 9, 0xDA, 1344 }, /* 0110 1101 0 */
|
||||
{ 9, 0xDB, 1408 }, /* 0110 1101 1 */
|
||||
{ 9, 0x98, 1472 }, /* 0100 1100 0 */
|
||||
{ 9, 0x99, 1536 }, /* 0100 1100 1 */
|
||||
{ 9, 0x9A, 1600 }, /* 0100 1101 0 */
|
||||
{ 6, 0x18, 1664 }, /* 0110 00 */
|
||||
{ 9, 0x9B, 1728 }, /* 0100 1101 1 */
|
||||
{ 11, 0x8, 1792 }, /* 0000 0001 000 */
|
||||
{ 11, 0xC, 1856 }, /* 0000 0001 100 */
|
||||
{ 11, 0xD, 1920 }, /* 0000 0001 101 */
|
||||
{ 12, 0x12, 1984 }, /* 0000 0001 0010 */
|
||||
{ 12, 0x13, 2048 }, /* 0000 0001 0011 */
|
||||
{ 12, 0x14, 2112 }, /* 0000 0001 0100 */
|
||||
{ 12, 0x15, 2176 }, /* 0000 0001 0101 */
|
||||
{ 12, 0x16, 2240 }, /* 0000 0001 0110 */
|
||||
{ 12, 0x17, 2304 }, /* 0000 0001 0111 */
|
||||
{ 12, 0x1C, 2368 }, /* 0000 0001 1100 */
|
||||
{ 12, 0x1D, 2432 }, /* 0000 0001 1101 */
|
||||
{ 12, 0x1E, 2496 }, /* 0000 0001 1110 */
|
||||
{ 12, 0x1F, 2560 }, /* 0000 0001 1111 */
|
||||
{ 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */
|
||||
{ 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */
|
||||
{ 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */
|
||||
{ 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */
|
||||
{ 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */
|
||||
};
|
||||
|
||||
const tableentry TIFFFaxBlackCodes[] = {
|
||||
{ 10, 0x37, 0 }, /* 0000 1101 11 */
|
||||
{ 3, 0x2, 1 }, /* 010 */
|
||||
{ 2, 0x3, 2 }, /* 11 */
|
||||
{ 2, 0x2, 3 }, /* 10 */
|
||||
{ 3, 0x3, 4 }, /* 011 */
|
||||
{ 4, 0x3, 5 }, /* 0011 */
|
||||
{ 4, 0x2, 6 }, /* 0010 */
|
||||
{ 5, 0x3, 7 }, /* 0001 1 */
|
||||
{ 6, 0x5, 8 }, /* 0001 01 */
|
||||
{ 6, 0x4, 9 }, /* 0001 00 */
|
||||
{ 7, 0x4, 10 }, /* 0000 100 */
|
||||
{ 7, 0x5, 11 }, /* 0000 101 */
|
||||
{ 7, 0x7, 12 }, /* 0000 111 */
|
||||
{ 8, 0x4, 13 }, /* 0000 0100 */
|
||||
{ 8, 0x7, 14 }, /* 0000 0111 */
|
||||
{ 9, 0x18, 15 }, /* 0000 1100 0 */
|
||||
{ 10, 0x17, 16 }, /* 0000 0101 11 */
|
||||
{ 10, 0x18, 17 }, /* 0000 0110 00 */
|
||||
{ 10, 0x8, 18 }, /* 0000 0010 00 */
|
||||
{ 11, 0x67, 19 }, /* 0000 1100 111 */
|
||||
{ 11, 0x68, 20 }, /* 0000 1101 000 */
|
||||
{ 11, 0x6C, 21 }, /* 0000 1101 100 */
|
||||
{ 11, 0x37, 22 }, /* 0000 0110 111 */
|
||||
{ 11, 0x28, 23 }, /* 0000 0101 000 */
|
||||
{ 11, 0x17, 24 }, /* 0000 0010 111 */
|
||||
{ 11, 0x18, 25 }, /* 0000 0011 000 */
|
||||
{ 12, 0xCA, 26 }, /* 0000 1100 1010 */
|
||||
{ 12, 0xCB, 27 }, /* 0000 1100 1011 */
|
||||
{ 12, 0xCC, 28 }, /* 0000 1100 1100 */
|
||||
{ 12, 0xCD, 29 }, /* 0000 1100 1101 */
|
||||
{ 12, 0x68, 30 }, /* 0000 0110 1000 */
|
||||
{ 12, 0x69, 31 }, /* 0000 0110 1001 */
|
||||
{ 12, 0x6A, 32 }, /* 0000 0110 1010 */
|
||||
{ 12, 0x6B, 33 }, /* 0000 0110 1011 */
|
||||
{ 12, 0xD2, 34 }, /* 0000 1101 0010 */
|
||||
{ 12, 0xD3, 35 }, /* 0000 1101 0011 */
|
||||
{ 12, 0xD4, 36 }, /* 0000 1101 0100 */
|
||||
{ 12, 0xD5, 37 }, /* 0000 1101 0101 */
|
||||
{ 12, 0xD6, 38 }, /* 0000 1101 0110 */
|
||||
{ 12, 0xD7, 39 }, /* 0000 1101 0111 */
|
||||
{ 12, 0x6C, 40 }, /* 0000 0110 1100 */
|
||||
{ 12, 0x6D, 41 }, /* 0000 0110 1101 */
|
||||
{ 12, 0xDA, 42 }, /* 0000 1101 1010 */
|
||||
{ 12, 0xDB, 43 }, /* 0000 1101 1011 */
|
||||
{ 12, 0x54, 44 }, /* 0000 0101 0100 */
|
||||
{ 12, 0x55, 45 }, /* 0000 0101 0101 */
|
||||
{ 12, 0x56, 46 }, /* 0000 0101 0110 */
|
||||
{ 12, 0x57, 47 }, /* 0000 0101 0111 */
|
||||
{ 12, 0x64, 48 }, /* 0000 0110 0100 */
|
||||
{ 12, 0x65, 49 }, /* 0000 0110 0101 */
|
||||
{ 12, 0x52, 50 }, /* 0000 0101 0010 */
|
||||
{ 12, 0x53, 51 }, /* 0000 0101 0011 */
|
||||
{ 12, 0x24, 52 }, /* 0000 0010 0100 */
|
||||
{ 12, 0x37, 53 }, /* 0000 0011 0111 */
|
||||
{ 12, 0x38, 54 }, /* 0000 0011 1000 */
|
||||
{ 12, 0x27, 55 }, /* 0000 0010 0111 */
|
||||
{ 12, 0x28, 56 }, /* 0000 0010 1000 */
|
||||
{ 12, 0x58, 57 }, /* 0000 0101 1000 */
|
||||
{ 12, 0x59, 58 }, /* 0000 0101 1001 */
|
||||
{ 12, 0x2B, 59 }, /* 0000 0010 1011 */
|
||||
{ 12, 0x2C, 60 }, /* 0000 0010 1100 */
|
||||
{ 12, 0x5A, 61 }, /* 0000 0101 1010 */
|
||||
{ 12, 0x66, 62 }, /* 0000 0110 0110 */
|
||||
{ 12, 0x67, 63 }, /* 0000 0110 0111 */
|
||||
{ 10, 0xF, 64 }, /* 0000 0011 11 */
|
||||
{ 12, 0xC8, 128 }, /* 0000 1100 1000 */
|
||||
{ 12, 0xC9, 192 }, /* 0000 1100 1001 */
|
||||
{ 12, 0x5B, 256 }, /* 0000 0101 1011 */
|
||||
{ 12, 0x33, 320 }, /* 0000 0011 0011 */
|
||||
{ 12, 0x34, 384 }, /* 0000 0011 0100 */
|
||||
{ 12, 0x35, 448 }, /* 0000 0011 0101 */
|
||||
{ 13, 0x6C, 512 }, /* 0000 0011 0110 0 */
|
||||
{ 13, 0x6D, 576 }, /* 0000 0011 0110 1 */
|
||||
{ 13, 0x4A, 640 }, /* 0000 0010 0101 0 */
|
||||
{ 13, 0x4B, 704 }, /* 0000 0010 0101 1 */
|
||||
{ 13, 0x4C, 768 }, /* 0000 0010 0110 0 */
|
||||
{ 13, 0x4D, 832 }, /* 0000 0010 0110 1 */
|
||||
{ 13, 0x72, 896 }, /* 0000 0011 1001 0 */
|
||||
{ 13, 0x73, 960 }, /* 0000 0011 1001 1 */
|
||||
{ 13, 0x74, 1024 }, /* 0000 0011 1010 0 */
|
||||
{ 13, 0x75, 1088 }, /* 0000 0011 1010 1 */
|
||||
{ 13, 0x76, 1152 }, /* 0000 0011 1011 0 */
|
||||
{ 13, 0x77, 1216 }, /* 0000 0011 1011 1 */
|
||||
{ 13, 0x52, 1280 }, /* 0000 0010 1001 0 */
|
||||
{ 13, 0x53, 1344 }, /* 0000 0010 1001 1 */
|
||||
{ 13, 0x54, 1408 }, /* 0000 0010 1010 0 */
|
||||
{ 13, 0x55, 1472 }, /* 0000 0010 1010 1 */
|
||||
{ 13, 0x5A, 1536 }, /* 0000 0010 1101 0 */
|
||||
{ 13, 0x5B, 1600 }, /* 0000 0010 1101 1 */
|
||||
{ 13, 0x64, 1664 }, /* 0000 0011 0010 0 */
|
||||
{ 13, 0x65, 1728 }, /* 0000 0011 0010 1 */
|
||||
{ 11, 0x8, 1792 }, /* 0000 0001 000 */
|
||||
{ 11, 0xC, 1856 }, /* 0000 0001 100 */
|
||||
{ 11, 0xD, 1920 }, /* 0000 0001 101 */
|
||||
{ 12, 0x12, 1984 }, /* 0000 0001 0010 */
|
||||
{ 12, 0x13, 2048 }, /* 0000 0001 0011 */
|
||||
{ 12, 0x14, 2112 }, /* 0000 0001 0100 */
|
||||
{ 12, 0x15, 2176 }, /* 0000 0001 0101 */
|
||||
{ 12, 0x16, 2240 }, /* 0000 0001 0110 */
|
||||
{ 12, 0x17, 2304 }, /* 0000 0001 0111 */
|
||||
{ 12, 0x1C, 2368 }, /* 0000 0001 1100 */
|
||||
{ 12, 0x1D, 2432 }, /* 0000 0001 1101 */
|
||||
{ 12, 0x1E, 2496 }, /* 0000 0001 1110 */
|
||||
{ 12, 0x1F, 2560 }, /* 0000 0001 1111 */
|
||||
{ 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */
|
||||
{ 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */
|
||||
{ 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */
|
||||
{ 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */
|
||||
{ 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */
|
||||
};
|
||||
#else
|
||||
extern const tableentry TIFFFaxWhiteCodes[];
|
||||
extern const tableentry TIFFFaxBlackCodes[];
|
||||
#endif
|
||||
#endif /* _T4_ */
|
@@ -1,519 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library RISC OS specific Routines.
|
||||
* Developed out of the Unix version.
|
||||
* Peter Greenham, May 1995
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
Low-level file handling
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
The functions in osfcn.h are unavailable when compiling under C, as it's a
|
||||
C++ header. Therefore they have been implemented here.
|
||||
|
||||
Now, why have I done it this way?
|
||||
|
||||
The definitive API library for RISC OS is Jonathan Coxhead's OSLib, which
|
||||
uses heavily optimised ARM assembler or even plain inline SWI calls for
|
||||
maximum performance and minimum runtime size. However, I don't want to make
|
||||
LIBTIFF need that to survive. Therefore I have also emulated the functions
|
||||
using macros to _swi() and _swix() defined in the swis.h header, and
|
||||
borrowing types from kernel.h, which is less efficient but doesn't need any
|
||||
third-party libraries.
|
||||
*/
|
||||
|
||||
#ifdef INCLUDE_OSLIB
|
||||
|
||||
#include "osfile.h"
|
||||
#include "osgbpb.h"
|
||||
#include "osargs.h"
|
||||
#include "osfind.h"
|
||||
|
||||
#else
|
||||
|
||||
/* OSLIB EMULATION STARTS */
|
||||
|
||||
#include "kernel.h"
|
||||
#include "swis.h"
|
||||
|
||||
/* From oslib:types.h */
|
||||
typedef unsigned int bits;
|
||||
typedef unsigned char byte;
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
#ifndef SKIP
|
||||
#define SKIP 0
|
||||
#endif
|
||||
|
||||
/* From oslib:os.h */
|
||||
typedef _kernel_oserror os_error;
|
||||
typedef byte os_f;
|
||||
|
||||
/* From oslib:osfile.h */
|
||||
#undef OS_File
|
||||
#define OS_File 0x8
|
||||
|
||||
/* From oslib:osgbpb.h */
|
||||
#undef OS_GBPB
|
||||
#define OS_GBPB 0xC
|
||||
#undef OSGBPB_Write
|
||||
#define OSGBPB_Write 0x2
|
||||
#undef OSGBPB_Read
|
||||
#define OSGBPB_Read 0x4
|
||||
|
||||
extern os_error *xosgbpb_write (os_f file,
|
||||
byte *data,
|
||||
int size,
|
||||
int *unwritten);
|
||||
extern int osgbpb_write (os_f file,
|
||||
byte *data,
|
||||
int size);
|
||||
|
||||
#define xosgbpb_write(file, data, size, unwritten) \
|
||||
(os_error*) _swix(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_IN(4)|_OUT(3), \
|
||||
OSGBPB_WriteAt, \
|
||||
file, \
|
||||
data, \
|
||||
size, \
|
||||
unwritten)
|
||||
|
||||
#define osgbpb_write(file, data, size) \
|
||||
_swi(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_RETURN(3), \
|
||||
OSGBPB_Write, \
|
||||
file, \
|
||||
data, \
|
||||
size)
|
||||
|
||||
extern os_error *xosgbpb_read (os_f file,
|
||||
byte *buffer,
|
||||
int size,
|
||||
int *unread);
|
||||
extern int osgbpb_read (os_f file,
|
||||
byte *buffer,
|
||||
int size);
|
||||
|
||||
#define xosgbpb_read(file, buffer, size, unread) \
|
||||
(os_error*) _swix(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_OUT(3), \
|
||||
OSGBPB_Read, \
|
||||
file, \
|
||||
buffer, \
|
||||
size, \
|
||||
unread)
|
||||
|
||||
#define osgbpb_read(file, buffer, size) \
|
||||
_swi(OS_GBPB, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_RETURN(3), \
|
||||
OSGBPB_Read, \
|
||||
file, \
|
||||
buffer, \
|
||||
size)
|
||||
|
||||
/* From oslib:osfind.h */
|
||||
#undef OS_Find
|
||||
#define OS_Find 0xD
|
||||
#undef OSFind_Openin
|
||||
#define OSFind_Openin 0x40
|
||||
#undef OSFind_Openout
|
||||
#define OSFind_Openout 0x80
|
||||
#undef OSFind_Openup
|
||||
#define OSFind_Openup 0xC0
|
||||
#undef OSFind_Close
|
||||
#define OSFind_Close 0x0
|
||||
|
||||
#define xosfind_open(reason, file_name, path, file) \
|
||||
(os_error*) _swix(OS_Find, _IN(0)|_IN(1)|_IN(2)|_OUT(0), \
|
||||
reason, file_name, path, file)
|
||||
|
||||
#define osfind_open(reason, file_name, path) \
|
||||
(os_f) _swi(OS_Find, _IN(0)|_IN(1)|_IN(2)|_RETURN(0), \
|
||||
reason, file_name, path)
|
||||
|
||||
extern os_error *xosfind_openin (bits flags,
|
||||
char *file_name,
|
||||
char *path,
|
||||
os_f *file);
|
||||
extern os_f osfind_openin (bits flags,
|
||||
char *file_name,
|
||||
char *path);
|
||||
|
||||
#define xosfind_openin(flags, file_name, path, file) \
|
||||
xosfind_open(flags | OSFind_Openin, file_name, path, file)
|
||||
|
||||
#define osfind_openin(flags, file_name, path) \
|
||||
osfind_open(flags | OSFind_Openin, file_name, path)
|
||||
|
||||
extern os_error *xosfind_openout (bits flags,
|
||||
char *file_name,
|
||||
char *path,
|
||||
os_f *file);
|
||||
extern os_f osfind_openout (bits flags,
|
||||
char *file_name,
|
||||
char *path);
|
||||
|
||||
#define xosfind_openout(flags, file_name, path, file) \
|
||||
xosfind_open(flags | OSFind_Openout, file_name, path, file)
|
||||
|
||||
#define osfind_openout(flags, file_name, path) \
|
||||
osfind_open(flags | OSFind_Openout, file_name, path)
|
||||
|
||||
extern os_error *xosfind_openup (bits flags,
|
||||
char *file_name,
|
||||
char *path,
|
||||
os_f *file);
|
||||
extern os_f osfind_openup (bits flags,
|
||||
char *file_name,
|
||||
char *path);
|
||||
|
||||
#define xosfind_openup(flags, file_name, path, file) \
|
||||
xosfind_open(flags | OSFind_Openup, file_name, path, file)
|
||||
|
||||
#define osfind_openup(flags, file_name, path) \
|
||||
osfind_open(flags | OSFind_Openup, file_name, path)
|
||||
|
||||
extern os_error *xosfind_close (os_f file);
|
||||
extern void osfind_close (os_f file);
|
||||
|
||||
#define xosfind_close(file) \
|
||||
(os_error*) _swix(OS_Find, _IN(0)|_IN(1), \
|
||||
OSFind_Close, \
|
||||
file)
|
||||
|
||||
#define osfind_close(file) \
|
||||
(void) _swi(OS_Find, _IN(0)|_IN(1), \
|
||||
OSFind_Close, \
|
||||
file)
|
||||
|
||||
/* From oslib:osargs.h */
|
||||
#undef OS_Args
|
||||
#define OS_Args 0x9
|
||||
#undef OSArgs_ReadPtr
|
||||
#define OSArgs_ReadPtr 0x0
|
||||
#undef OSArgs_SetPtr
|
||||
#define OSArgs_SetPtr 0x1
|
||||
#undef OSArgs_ReadExt
|
||||
#define OSArgs_ReadExt 0x2
|
||||
|
||||
extern os_error *xosargs_read_ptr (os_f file,
|
||||
int *ptr);
|
||||
extern int osargs_read_ptr (os_f file);
|
||||
|
||||
#define xosargs_read_ptr(file, ptr) \
|
||||
(os_error*) _swix(OS_Args, _IN(0)|_IN(1)|_OUT(2), \
|
||||
OSArgs_ReadPtr, \
|
||||
file, \
|
||||
ptr)
|
||||
|
||||
#define osargs_read_ptr(file) \
|
||||
_swi(OS_Args, _IN(0)|_IN(1)|_RETURN(2), \
|
||||
OSArgs_ReadPtr, \
|
||||
file)
|
||||
|
||||
extern os_error *xosargs_set_ptr (os_f file,
|
||||
int ptr);
|
||||
extern void osargs_set_ptr (os_f file,
|
||||
int ptr);
|
||||
|
||||
#define xosargs_set_ptr(file, ptr) \
|
||||
(os_error*) _swix(OS_Args, _IN(0)|_IN(1)|_IN(2), \
|
||||
OSArgs_SetPtr, \
|
||||
file, \
|
||||
ptr)
|
||||
|
||||
#define osargs_set_ptr(file, ptr) \
|
||||
(void) _swi(OS_Args, _IN(0)|_IN(1)|_IN(2), \
|
||||
OSArgs_SetPtr, \
|
||||
file, \
|
||||
ptr)
|
||||
|
||||
extern os_error *xosargs_read_ext (os_f file,
|
||||
int *ext);
|
||||
extern int osargs_read_ext (os_f file);
|
||||
|
||||
#define xosargs_read_ext(file, ext) \
|
||||
(os_error*) _swix(OS_Args, _IN(0)|_IN(1)|_OUT(2), \
|
||||
OSArgs_ReadExt, \
|
||||
file, \
|
||||
ext)
|
||||
|
||||
#define osargs_read_ext(file) \
|
||||
_swi(OS_Args, _IN(0)|_IN(1)|_RETURN(2), \
|
||||
OSArgs_ReadExt, \
|
||||
file)
|
||||
|
||||
/* OSLIB EMULATION ENDS */
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __osfcn_h
|
||||
/* Will be set or not during tiffcomp.h */
|
||||
/* You get this to compile under C++? Please say how! */
|
||||
|
||||
extern int open(const char* name, int flags, int mode)
|
||||
{
|
||||
/* From what I can tell, should return <0 for failure */
|
||||
os_error* e = (os_error*) 1; /* Cheeky way to use a pointer eh? :-) */
|
||||
os_f file = (os_f) -1;
|
||||
|
||||
flags = flags;
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case O_RDONLY:
|
||||
{
|
||||
e = xosfind_openin(SKIP, name, SKIP, &file);
|
||||
break;
|
||||
}
|
||||
case O_WRONLY:
|
||||
case O_RDWR|O_CREAT:
|
||||
case O_RDWR|O_CREAT|O_TRUNC:
|
||||
{
|
||||
e = xosfind_openout(SKIP, name, SKIP, &file);
|
||||
break;
|
||||
}
|
||||
case O_RDWR:
|
||||
{
|
||||
e = xosfind_openup(SKIP, name, SKIP, &file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (e)
|
||||
{
|
||||
file = (os_f) -1;
|
||||
}
|
||||
return (file);
|
||||
}
|
||||
|
||||
extern int close(int fd)
|
||||
{
|
||||
return ((int) xosfind_close((os_f) fd));
|
||||
}
|
||||
|
||||
extern int write(int fd, const char *buf, int nbytes)
|
||||
{
|
||||
/* Returns number of bytes written */
|
||||
return (nbytes - osgbpb_write((os_f) fd, (const byte*) buf, nbytes));
|
||||
}
|
||||
|
||||
extern int read(int fd, char *buf, int nbytes)
|
||||
{
|
||||
/* Returns number of bytes read */
|
||||
return (nbytes - osgbpb_read((os_f) fd, (byte*) buf, nbytes));
|
||||
}
|
||||
|
||||
extern off_t lseek(int fd, off_t offset, int whence)
|
||||
{
|
||||
int absolute = 0;
|
||||
|
||||
switch (whence)
|
||||
{
|
||||
case SEEK_SET:
|
||||
{
|
||||
absolute = (int) offset;
|
||||
break;
|
||||
}
|
||||
case SEEK_CUR:
|
||||
{
|
||||
absolute = osargs_read_ptr((os_f) fd) + (int) offset;
|
||||
break;
|
||||
}
|
||||
case SEEK_END:
|
||||
{
|
||||
absolute = osargs_read_ext((os_f) fd) + (int) offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
osargs_set_ptr((os_f) fd, absolute);
|
||||
|
||||
return ((off_t) osargs_read_ptr((os_f) fd));
|
||||
}
|
||||
#endif
|
||||
|
||||
static tsize_t
|
||||
_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
{
|
||||
return ((tsize_t) read((int) fd, buf, (size_t) size));
|
||||
}
|
||||
|
||||
static tsize_t
|
||||
_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
{
|
||||
return ((tsize_t) write((int) fd, buf, (size_t) size));
|
||||
}
|
||||
|
||||
static toff_t
|
||||
_tiffSeekProc(thandle_t fd, toff_t off, int whence)
|
||||
{
|
||||
return ((toff_t) lseek((int) fd, (off_t) off, whence));
|
||||
}
|
||||
|
||||
static int
|
||||
_tiffCloseProc(thandle_t fd)
|
||||
{
|
||||
return (close((int) fd));
|
||||
}
|
||||
|
||||
static toff_t
|
||||
_tiffSizeProc(thandle_t fd)
|
||||
{
|
||||
return (lseek((int) fd, SEEK_END, SEEK_SET));
|
||||
}
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#error "I didn't know Acorn had that!"
|
||||
#endif
|
||||
|
||||
/* !HAVE_MMAP */
|
||||
static int
|
||||
_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
|
||||
{
|
||||
(void) fd; (void) pbase; (void) psize;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
|
||||
{
|
||||
(void) fd; (void) base; (void) size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a TIFF file descriptor for read/writing.
|
||||
*/
|
||||
TIFF*
|
||||
TIFFFdOpen(int fd, const char* name, const char* mode)
|
||||
{
|
||||
TIFF* tif;
|
||||
|
||||
tif = TIFFClientOpen(name, mode,
|
||||
(thandle_t) fd,
|
||||
_tiffReadProc, _tiffWriteProc,
|
||||
_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
|
||||
_tiffMapProc, _tiffUnmapProc);
|
||||
if (tif)
|
||||
{
|
||||
tif->tif_fd = fd;
|
||||
}
|
||||
return (tif);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a TIFF file for read/writing.
|
||||
*/
|
||||
TIFF*
|
||||
TIFFOpen(const char* name, const char* mode)
|
||||
{
|
||||
static const char module[] = "TIFFOpen";
|
||||
int m, fd;
|
||||
|
||||
m = _TIFFgetMode(mode, module);
|
||||
|
||||
if (m == -1)
|
||||
{
|
||||
return ((TIFF*) 0);
|
||||
}
|
||||
|
||||
fd = open(name, 0, m);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
TIFFError(module, "%s: Cannot open", name);
|
||||
return ((TIFF *)0);
|
||||
}
|
||||
return (TIFFFdOpen(fd, name, mode));
|
||||
}
|
||||
|
||||
void*
|
||||
_TIFFmalloc(tsize_t s)
|
||||
{
|
||||
return (malloc((size_t) s));
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFfree(tdata_t p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
|
||||
void*
|
||||
_TIFFrealloc(tdata_t p, tsize_t s)
|
||||
{
|
||||
return (realloc(p, (size_t) s));
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFmemset(tdata_t p, int v, tsize_t c)
|
||||
{
|
||||
memset(p, v, (size_t) c);
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)
|
||||
{
|
||||
memcpy(d, s, (size_t) c);
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
|
||||
{
|
||||
return (memcmp(p1, p2, (size_t) c));
|
||||
}
|
||||
|
||||
static void
|
||||
acornWarningHandler(const char* module, const char* fmt, va_list ap)
|
||||
{
|
||||
if (module != NULL)
|
||||
{
|
||||
fprintf(stderr, "%s: ", module);
|
||||
}
|
||||
fprintf(stderr, "Warning, ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, ".\n");
|
||||
}
|
||||
TIFFErrorHandler _TIFFwarningHandler = acornWarningHandler;
|
||||
|
||||
static void
|
||||
acornErrorHandler(const char* module, const char* fmt, va_list ap)
|
||||
{
|
||||
if (module != NULL)
|
||||
{
|
||||
fprintf(stderr, "%s: ", module);
|
||||
}
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, ".\n");
|
||||
}
|
||||
TIFFErrorHandler _TIFFerrorHandler = acornErrorHandler;
|
@@ -1,274 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library Macintosh-specific routines.
|
||||
*
|
||||
* These routines use only Toolbox and high-level File Manager traps.
|
||||
* They make no calls to the THINK C "unix" compatibility library. Also,
|
||||
* malloc is not used directly but it is still referenced internally by
|
||||
* the ANSI library in rare cases. Heap fragmentation by the malloc ring
|
||||
* buffer is therefore minimized.
|
||||
*
|
||||
* O_RDONLY and O_RDWR are treated identically here. The tif_mode flag is
|
||||
* checked in TIFFWriteCheck().
|
||||
*
|
||||
* Create below fills in a blank creator signature and sets the file type
|
||||
* to 'TIFF'. It is much better for the application to do this by Create'ing
|
||||
* the file first and TIFFOpen'ing it later.
|
||||
* ---------
|
||||
* This code has been "Carbonized", and may not work with older MacOS versions.
|
||||
* If so, grab the tif_apple.c out of an older libtiff distribution, like
|
||||
* 3.5.5 from www.libtiff.org.
|
||||
*/
|
||||
|
||||
#include "tiffiop.h"
|
||||
#include <Errors.h>
|
||||
#include <Files.h>
|
||||
#include <Memory.h>
|
||||
#include <Script.h>
|
||||
|
||||
#if defined(__PPCC__) || defined(__SC__) || defined(__MRC__) || defined(applec)
|
||||
#define CtoPstr c2pstr
|
||||
#endif
|
||||
|
||||
static tsize_t
|
||||
_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
{
|
||||
return (FSRead((short) fd, (long*) &size, (char*) buf) == noErr ?
|
||||
size : (tsize_t) -1);
|
||||
}
|
||||
|
||||
static tsize_t
|
||||
_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
{
|
||||
return (FSWrite((short) fd, (long*) &size, (char*) buf) == noErr ?
|
||||
size : (tsize_t) -1);
|
||||
}
|
||||
|
||||
static toff_t
|
||||
_tiffSeekProc(thandle_t fd, toff_t off, int whence)
|
||||
{
|
||||
long fpos, size;
|
||||
|
||||
if (GetEOF((short) fd, &size) != noErr)
|
||||
return EOF;
|
||||
(void) GetFPos((short) fd, &fpos);
|
||||
|
||||
switch (whence) {
|
||||
case SEEK_CUR:
|
||||
if (off + fpos > size)
|
||||
SetEOF((short) fd, off + fpos);
|
||||
if (SetFPos((short) fd, fsFromMark, off) != noErr)
|
||||
return EOF;
|
||||
break;
|
||||
case SEEK_END:
|
||||
if (off > 0)
|
||||
SetEOF((short) fd, off + size);
|
||||
if (SetFPos((short) fd, fsFromStart, off + size) != noErr)
|
||||
return EOF;
|
||||
break;
|
||||
case SEEK_SET:
|
||||
if (off > size)
|
||||
SetEOF((short) fd, off);
|
||||
if (SetFPos((short) fd, fsFromStart, off) != noErr)
|
||||
return EOF;
|
||||
break;
|
||||
}
|
||||
|
||||
return (toff_t)(GetFPos((short) fd, &fpos) == noErr ? fpos : EOF);
|
||||
}
|
||||
|
||||
static int
|
||||
_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
_tiffCloseProc(thandle_t fd)
|
||||
{
|
||||
return (FSClose((short) fd));
|
||||
}
|
||||
|
||||
static toff_t
|
||||
_tiffSizeProc(thandle_t fd)
|
||||
{
|
||||
long size;
|
||||
|
||||
if (GetEOF((short) fd, &size) != noErr) {
|
||||
TIFFError("_tiffSizeProc", "%s: Cannot get file size");
|
||||
return (-1L);
|
||||
}
|
||||
return ((toff_t) size);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a TIFF file descriptor for read/writing.
|
||||
*/
|
||||
TIFF*
|
||||
TIFFFdOpen(int fd, const char* name, const char* mode)
|
||||
{
|
||||
TIFF* tif;
|
||||
|
||||
tif = TIFFClientOpen(name, mode, (thandle_t) fd,
|
||||
_tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
|
||||
_tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
|
||||
if (tif)
|
||||
tif->tif_fd = fd;
|
||||
return (tif);
|
||||
}
|
||||
|
||||
static void ourc2pstr( char* inString )
|
||||
{
|
||||
int sLen = strlen( inString );
|
||||
BlockMoveData( inString, &inString[1], sLen );
|
||||
inString[0] = sLen;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a TIFF file for read/writing.
|
||||
*/
|
||||
TIFF*
|
||||
TIFFOpen(const char* name, const char* mode)
|
||||
{
|
||||
static const char module[] = "TIFFOpen";
|
||||
Str255 pname;
|
||||
FInfo finfo;
|
||||
short fref;
|
||||
OSErr err;
|
||||
FSSpec fSpec;
|
||||
|
||||
strcpy((char*) pname, name);
|
||||
ourc2pstr((char*) pname);
|
||||
|
||||
err = FSMakeFSSpec( 0, 0, pname, &fSpec );
|
||||
|
||||
switch (_TIFFgetMode(mode, module)) {
|
||||
default:
|
||||
return ((TIFF*) 0);
|
||||
case O_RDWR | O_CREAT | O_TRUNC:
|
||||
if (FSpGetFInfo(&fSpec, &finfo) == noErr)
|
||||
FSpDelete(&fSpec);
|
||||
/* fall through */
|
||||
case O_RDWR | O_CREAT:
|
||||
if ((err = FSpGetFInfo(&fSpec, &finfo)) == fnfErr) {
|
||||
if (FSpCreate(&fSpec, ' ', 'TIFF', smSystemScript) != noErr)
|
||||
goto badCreate;
|
||||
if (FSpOpenDF(&fSpec, fsRdWrPerm, &fref) != noErr)
|
||||
goto badOpen;
|
||||
} else if (err == noErr) {
|
||||
if (FSpOpenDF(&fSpec, fsRdWrPerm, &fref) != noErr)
|
||||
goto badOpen;
|
||||
} else
|
||||
goto badOpen;
|
||||
break;
|
||||
case O_RDONLY:
|
||||
if (FSpOpenDF(&fSpec, fsRdPerm, &fref) != noErr)
|
||||
goto badOpen;
|
||||
break;
|
||||
case O_RDWR:
|
||||
if (FSpOpenDF(&fSpec, fsRdWrPerm, &fref) != noErr)
|
||||
goto badOpen;
|
||||
break;
|
||||
}
|
||||
return (TIFFFdOpen((int) fref, name, mode));
|
||||
badCreate:
|
||||
TIFFError(module, "%s: Cannot create", name);
|
||||
return ((TIFF*) 0);
|
||||
badOpen:
|
||||
TIFFError(module, "%s: Cannot open", name);
|
||||
return ((TIFF*) 0);
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFmemset(tdata_t p, int v, tsize_t c)
|
||||
{
|
||||
memset(p, v, (size_t) c);
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)
|
||||
{
|
||||
memcpy(d, s, (size_t) c);
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
|
||||
{
|
||||
return (memcmp(p1, p2, (size_t) c));
|
||||
}
|
||||
|
||||
tdata_t
|
||||
_TIFFmalloc(tsize_t s)
|
||||
{
|
||||
return (NewPtr((size_t) s));
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFfree(tdata_t p)
|
||||
{
|
||||
DisposePtr(p);
|
||||
}
|
||||
|
||||
tdata_t
|
||||
_TIFFrealloc(tdata_t p, tsize_t s)
|
||||
{
|
||||
Ptr n = p;
|
||||
|
||||
SetPtrSize(p, (size_t) s);
|
||||
if (MemError() && (n = NewPtr((size_t) s)) != NULL) {
|
||||
BlockMove(p, n, GetPtrSize(p));
|
||||
DisposePtr(p);
|
||||
}
|
||||
return ((tdata_t) n);
|
||||
}
|
||||
|
||||
static void
|
||||
appleWarningHandler(const char* module, const char* fmt, va_list ap)
|
||||
{
|
||||
if (module != NULL)
|
||||
fprintf(stderr, "%s: ", module);
|
||||
fprintf(stderr, "Warning, ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, ".\n");
|
||||
}
|
||||
TIFFErrorHandler _TIFFwarningHandler = appleWarningHandler;
|
||||
|
||||
static void
|
||||
appleErrorHandler(const char* module, const char* fmt, va_list ap)
|
||||
{
|
||||
if (module != NULL)
|
||||
fprintf(stderr, "%s: ", module);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, ".\n");
|
||||
}
|
||||
TIFFErrorHandler _TIFFerrorHandler = appleErrorHandler;
|
@@ -1,243 +0,0 @@
|
||||
/* "$Header$" */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library ATARI-specific Routines.
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
#if defined(__TURBOC__)
|
||||
#include <tos.h>
|
||||
#include <stdio.h>
|
||||
#else
|
||||
#include <osbind.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifndef O_ACCMODE
|
||||
#define O_ACCMODE 3
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#define AEFILNF -33
|
||||
|
||||
static tsize_t
|
||||
_tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
{
|
||||
long r;
|
||||
|
||||
r = Fread((int) fd, size, buf);
|
||||
if (r < 0) {
|
||||
errno = (int)-r;
|
||||
r = -1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
static tsize_t
|
||||
_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
|
||||
{
|
||||
long r;
|
||||
|
||||
r = Fwrite((int) fd, size, buf);
|
||||
if (r < 0) {
|
||||
errno = (int)-r;
|
||||
r = -1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
static toff_t
|
||||
_tiffSeekProc(thandle_t fd, off_t off, int whence)
|
||||
{
|
||||
char buf[256];
|
||||
long current_off, expected_off, new_off;
|
||||
|
||||
if (whence == SEEK_END || off <= 0)
|
||||
return Fseek(off, (int) fd, whence);
|
||||
current_off = Fseek(0, (int) fd, SEEK_CUR); /* find out where we are */
|
||||
if (whence == SEEK_SET)
|
||||
expected_off = off;
|
||||
else
|
||||
expected_off = off + current_off;
|
||||
new_off = Fseek(off, (int) fd, whence);
|
||||
if (new_off == expected_off)
|
||||
return new_off;
|
||||
/* otherwise extend file -- zero filling the hole */
|
||||
if (new_off < 0) /* error? */
|
||||
new_off = Fseek(0, (int) fd, SEEK_END); /* go to eof */
|
||||
_TIFFmemset(buf, 0, sizeof(buf));
|
||||
while (expected_off > new_off) {
|
||||
off = expected_off - new_off;
|
||||
if (off > sizeof(buf))
|
||||
off = sizeof(buf);
|
||||
if ((current_off = Fwrite((int) fd, off, buf)) != off)
|
||||
return (current_off > 0) ?
|
||||
new_off + current_off : new_off;
|
||||
new_off += off;
|
||||
}
|
||||
return new_off;
|
||||
}
|
||||
|
||||
static int
|
||||
_tiffCloseProc(thandle_t fd)
|
||||
{
|
||||
long r;
|
||||
|
||||
r = Fclose((int) fd);
|
||||
if (r < 0) {
|
||||
errno = (int)-r;
|
||||
r = -1;
|
||||
}
|
||||
return (int)r;
|
||||
}
|
||||
|
||||
static toff_t
|
||||
_tiffSizeProc(thandle_t fd)
|
||||
{
|
||||
long pos, eof;
|
||||
|
||||
pos = Fseek(0, (int) fd, SEEK_CUR);
|
||||
eof = Fseek(0, (int) fd, SEEK_END);
|
||||
Fseek(pos, (int) fd, SEEK_SET);
|
||||
return eof;
|
||||
}
|
||||
|
||||
static int
|
||||
_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a TIFF file descriptor for read/writing.
|
||||
*/
|
||||
TIFF*
|
||||
TIFFFdOpen(int fd, const char* name, const char* mode)
|
||||
{
|
||||
TIFF* tif;
|
||||
|
||||
tif = TIFFClientOpen(name, mode,
|
||||
(thandle_t) fd,
|
||||
_tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
|
||||
_tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
|
||||
if (tif)
|
||||
tif->tif_fd = fd;
|
||||
return (tif);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a TIFF file for read/writing.
|
||||
*/
|
||||
TIFF*
|
||||
TIFFOpen(const char* name, const char* mode)
|
||||
{
|
||||
static const char module[] = "TIFFOpen";
|
||||
int m;
|
||||
long fd;
|
||||
|
||||
m = _TIFFgetMode(mode, module);
|
||||
if (m == -1)
|
||||
return ((TIFF*)0);
|
||||
if (m & O_TRUNC) {
|
||||
fd = Fcreate(name, 0);
|
||||
} else {
|
||||
fd = Fopen(name, m & O_ACCMODE);
|
||||
if (fd == AEFILNF && m & O_CREAT)
|
||||
fd = Fcreate(name, 0);
|
||||
}
|
||||
if (fd < 0)
|
||||
errno = (int)fd;
|
||||
if (fd < 0) {
|
||||
TIFFError(module, "%s: Cannot open", name);
|
||||
return ((TIFF*)0);
|
||||
}
|
||||
return (TIFFFdOpen(fd, name, mode));
|
||||
}
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
tdata_t
|
||||
_TIFFmalloc(tsize_t s)
|
||||
{
|
||||
return (malloc((size_t) s));
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFfree(tdata_t p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
|
||||
tdata_t
|
||||
_TIFFrealloc(tdata_t p, tsize_t s)
|
||||
{
|
||||
return (realloc(p, (size_t) s));
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFmemset(tdata_t p, int v, size_t c)
|
||||
{
|
||||
memset(p, v, (size_t) c);
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFmemcpy(tdata_t d, const tdata_t s, size_t c)
|
||||
{
|
||||
memcpy(d, s, (size_t) c);
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
|
||||
{
|
||||
return (memcmp(p1, p2, (size_t) c));
|
||||
}
|
||||
|
||||
static void
|
||||
atariWarningHandler(const char* module, const char* fmt, va_list ap)
|
||||
{
|
||||
if (module != NULL)
|
||||
fprintf(stderr, "%s: ", module);
|
||||
fprintf(stderr, "Warning, ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, ".\n");
|
||||
}
|
||||
TIFFErrorHandler _TIFFwarningHandler = atariWarningHandler;
|
||||
|
||||
static void
|
||||
atariErrorHandler(const char* module, const char* fmt, va_list ap)
|
||||
{
|
||||
if (module != NULL)
|
||||
fprintf(stderr, "%s: ", module);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, ".\n");
|
||||
}
|
||||
TIFFErrorHandler _TIFFerrorHandler = atariErrorHandler;
|
@@ -1,248 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library.
|
||||
*
|
||||
* Auxiliary Support Routines.
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
#include "tif_predict.h"
|
||||
#include <math.h>
|
||||
|
||||
static int
|
||||
TIFFDefaultTransferFunction(TIFFDirectory* td)
|
||||
{
|
||||
uint16 **tf = td->td_transferfunction;
|
||||
tsize_t i, n, nbytes;
|
||||
|
||||
tf[0] = tf[1] = tf[2] = 0;
|
||||
if (td->td_bitspersample >= sizeof(tsize_t) * 8 - 2)
|
||||
return 0;
|
||||
|
||||
n = 1<<td->td_bitspersample;
|
||||
nbytes = n * sizeof (uint16);
|
||||
if (!(tf[0] = (uint16 *)_TIFFmalloc(nbytes)))
|
||||
return 0;
|
||||
tf[0][0] = 0;
|
||||
for (i = 1; i < n; i++) {
|
||||
double t = (double)i/((double) n-1.);
|
||||
tf[0][i] = (uint16)floor(65535.*pow(t, 2.2) + .5);
|
||||
}
|
||||
|
||||
if (td->td_samplesperpixel - td->td_extrasamples > 1) {
|
||||
if (!(tf[1] = (uint16 *)_TIFFmalloc(nbytes)))
|
||||
goto bad;
|
||||
_TIFFmemcpy(tf[1], tf[0], nbytes);
|
||||
if (!(tf[2] = (uint16 *)_TIFFmalloc(nbytes)))
|
||||
goto bad;
|
||||
_TIFFmemcpy(tf[2], tf[0], nbytes);
|
||||
}
|
||||
return 1;
|
||||
|
||||
bad:
|
||||
if (tf[0])
|
||||
_TIFFfree(tf[0]);
|
||||
if (tf[1])
|
||||
_TIFFfree(tf[1]);
|
||||
if (tf[2])
|
||||
_TIFFfree(tf[2]);
|
||||
tf[0] = tf[1] = tf[2] = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
TIFFDefaultRefBlackWhite(TIFFDirectory* td)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!(td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float))))
|
||||
return 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
td->td_refblackwhite[2*i+0] = 0;
|
||||
td->td_refblackwhite[2*i+1] = (float)((1L<<td->td_bitspersample)-1L);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Like TIFFGetField, but return any default
|
||||
* value if the tag is not present in the directory.
|
||||
*
|
||||
* NB: We use the value in the directory, rather than
|
||||
* explcit values so that defaults exist only one
|
||||
* place in the library -- in TIFFDefaultDirectory.
|
||||
*/
|
||||
int
|
||||
TIFFVGetFieldDefaulted(TIFF* tif, ttag_t tag, va_list ap)
|
||||
{
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
|
||||
if (TIFFVGetField(tif, tag, ap))
|
||||
return (1);
|
||||
switch (tag) {
|
||||
case TIFFTAG_SUBFILETYPE:
|
||||
*va_arg(ap, uint32 *) = td->td_subfiletype;
|
||||
return (1);
|
||||
case TIFFTAG_BITSPERSAMPLE:
|
||||
*va_arg(ap, uint16 *) = td->td_bitspersample;
|
||||
return (1);
|
||||
case TIFFTAG_THRESHHOLDING:
|
||||
*va_arg(ap, uint16 *) = td->td_threshholding;
|
||||
return (1);
|
||||
case TIFFTAG_FILLORDER:
|
||||
*va_arg(ap, uint16 *) = td->td_fillorder;
|
||||
return (1);
|
||||
case TIFFTAG_ORIENTATION:
|
||||
*va_arg(ap, uint16 *) = td->td_orientation;
|
||||
return (1);
|
||||
case TIFFTAG_SAMPLESPERPIXEL:
|
||||
*va_arg(ap, uint16 *) = td->td_samplesperpixel;
|
||||
return (1);
|
||||
case TIFFTAG_ROWSPERSTRIP:
|
||||
*va_arg(ap, uint32 *) = td->td_rowsperstrip;
|
||||
return (1);
|
||||
case TIFFTAG_MINSAMPLEVALUE:
|
||||
*va_arg(ap, uint16 *) = td->td_minsamplevalue;
|
||||
return (1);
|
||||
case TIFFTAG_MAXSAMPLEVALUE:
|
||||
*va_arg(ap, uint16 *) = td->td_maxsamplevalue;
|
||||
return (1);
|
||||
case TIFFTAG_PLANARCONFIG:
|
||||
*va_arg(ap, uint16 *) = td->td_planarconfig;
|
||||
return (1);
|
||||
case TIFFTAG_RESOLUTIONUNIT:
|
||||
*va_arg(ap, uint16 *) = td->td_resolutionunit;
|
||||
return (1);
|
||||
case TIFFTAG_PREDICTOR:
|
||||
{
|
||||
TIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data;
|
||||
*va_arg(ap, uint16*) = (uint16) sp->predictor;
|
||||
return (1);
|
||||
}
|
||||
case TIFFTAG_DOTRANGE:
|
||||
*va_arg(ap, uint16 *) = 0;
|
||||
*va_arg(ap, uint16 *) = (1<<td->td_bitspersample)-1;
|
||||
return (1);
|
||||
case TIFFTAG_INKSET:
|
||||
*va_arg(ap, uint16 *) = td->td_inkset;
|
||||
return (1);
|
||||
case TIFFTAG_NUMBEROFINKS:
|
||||
*va_arg(ap, uint16 *) = td->td_ninks;
|
||||
return (1);
|
||||
case TIFFTAG_EXTRASAMPLES:
|
||||
*va_arg(ap, uint16 *) = td->td_extrasamples;
|
||||
*va_arg(ap, uint16 **) = td->td_sampleinfo;
|
||||
return (1);
|
||||
case TIFFTAG_MATTEING:
|
||||
*va_arg(ap, uint16 *) =
|
||||
(td->td_extrasamples == 1 &&
|
||||
td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
|
||||
return (1);
|
||||
case TIFFTAG_TILEDEPTH:
|
||||
*va_arg(ap, uint32 *) = td->td_tiledepth;
|
||||
return (1);
|
||||
case TIFFTAG_DATATYPE:
|
||||
*va_arg(ap, uint16 *) = td->td_sampleformat-1;
|
||||
return (1);
|
||||
case TIFFTAG_SAMPLEFORMAT:
|
||||
*va_arg(ap, uint16 *) = td->td_sampleformat;
|
||||
return(1);
|
||||
case TIFFTAG_IMAGEDEPTH:
|
||||
*va_arg(ap, uint32 *) = td->td_imagedepth;
|
||||
return (1);
|
||||
case TIFFTAG_YCBCRCOEFFICIENTS:
|
||||
if (!td->td_ycbcrcoeffs) {
|
||||
td->td_ycbcrcoeffs = (float *)
|
||||
_TIFFmalloc(3*sizeof (float));
|
||||
if (!td->td_ycbcrcoeffs)
|
||||
return (0);
|
||||
/* defaults are from CCIR Recommendation 601-1 */
|
||||
td->td_ycbcrcoeffs[0] = 0.299f;
|
||||
td->td_ycbcrcoeffs[1] = 0.587f;
|
||||
td->td_ycbcrcoeffs[2] = 0.114f;
|
||||
}
|
||||
*va_arg(ap, float **) = td->td_ycbcrcoeffs;
|
||||
return (1);
|
||||
case TIFFTAG_YCBCRSUBSAMPLING:
|
||||
*va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[0];
|
||||
*va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[1];
|
||||
return (1);
|
||||
case TIFFTAG_YCBCRPOSITIONING:
|
||||
*va_arg(ap, uint16 *) = td->td_ycbcrpositioning;
|
||||
return (1);
|
||||
case TIFFTAG_WHITEPOINT:
|
||||
if (!td->td_whitepoint) {
|
||||
td->td_whitepoint = (float *)
|
||||
_TIFFmalloc(2 * sizeof (float));
|
||||
if (!td->td_whitepoint)
|
||||
return (0);
|
||||
/* TIFF 6.0 specification says that it is no default
|
||||
value for the WhitePoint, but AdobePhotoshop TIFF
|
||||
Technical Note tells that it should be CIE D50. */
|
||||
td->td_whitepoint[0] =
|
||||
D50_X0 / (D50_X0 + D50_Y0 + D50_Z0);
|
||||
td->td_whitepoint[1] =
|
||||
D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0);
|
||||
}
|
||||
*va_arg(ap, float **) = td->td_whitepoint;
|
||||
return (1);
|
||||
case TIFFTAG_TRANSFERFUNCTION:
|
||||
if (!td->td_transferfunction[0] &&
|
||||
!TIFFDefaultTransferFunction(td)) {
|
||||
TIFFError(tif->tif_name, "No space for \"TransferFunction\" tag");
|
||||
return (0);
|
||||
}
|
||||
*va_arg(ap, uint16 **) = td->td_transferfunction[0];
|
||||
if (td->td_samplesperpixel - td->td_extrasamples > 1) {
|
||||
*va_arg(ap, uint16 **) = td->td_transferfunction[1];
|
||||
*va_arg(ap, uint16 **) = td->td_transferfunction[2];
|
||||
}
|
||||
return (1);
|
||||
case TIFFTAG_REFERENCEBLACKWHITE:
|
||||
if (!td->td_refblackwhite && !TIFFDefaultRefBlackWhite(td))
|
||||
return (0);
|
||||
*va_arg(ap, float **) = td->td_refblackwhite;
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Like TIFFGetField, but return any default
|
||||
* value if the tag is not present in the directory.
|
||||
*/
|
||||
int
|
||||
TIFFGetFieldDefaulted(TIFF* tif, ttag_t tag, ...)
|
||||
{
|
||||
int ok;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, tag);
|
||||
ok = TIFFVGetFieldDefaulted(tif, tag, ap);
|
||||
va_end(ap);
|
||||
return (ok);
|
||||
}
|
@@ -1,80 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library.
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
|
||||
void
|
||||
TIFFClose(TIFF* tif)
|
||||
{
|
||||
if (tif->tif_mode != O_RDONLY)
|
||||
/*
|
||||
* Flush buffered data and directory (if dirty).
|
||||
*/
|
||||
TIFFFlush(tif);
|
||||
(*tif->tif_cleanup)(tif);
|
||||
TIFFFreeDirectory(tif);
|
||||
|
||||
if (tif->tif_dirlist)
|
||||
_TIFFfree(tif->tif_dirlist);
|
||||
|
||||
/* Clean up client info links */
|
||||
while( tif->tif_clientinfo )
|
||||
{
|
||||
TIFFClientInfoLink *link = tif->tif_clientinfo;
|
||||
|
||||
tif->tif_clientinfo = link->next;
|
||||
_TIFFfree( link->name );
|
||||
_TIFFfree( link );
|
||||
}
|
||||
|
||||
if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER))
|
||||
_TIFFfree(tif->tif_rawdata);
|
||||
if (isMapped(tif))
|
||||
TIFFUnmapFileContents(tif, tif->tif_base, tif->tif_size);
|
||||
(void) TIFFCloseFile(tif);
|
||||
if (tif->tif_nfields > 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < tif->tif_nfields; i++)
|
||||
{
|
||||
TIFFFieldInfo *fld = tif->tif_fieldinfo[i];
|
||||
if (fld->field_bit == FIELD_CUSTOM &&
|
||||
strncmp("Tag ", fld->field_name, 4) == 0)
|
||||
{
|
||||
_TIFFfree(fld->field_name);
|
||||
_TIFFfree(fld);
|
||||
}
|
||||
}
|
||||
|
||||
_TIFFfree(tif->tif_fieldinfo);
|
||||
}
|
||||
|
||||
_TIFFfree(tif);
|
||||
}
|
@@ -1,150 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library
|
||||
*
|
||||
* Builtin Compression Scheme Configuration Support.
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
|
||||
static int NotConfigured(TIFF*, int);
|
||||
|
||||
#ifndef LZW_SUPPORT
|
||||
#define TIFFInitLZW NotConfigured
|
||||
#endif
|
||||
#ifndef PACKBITS_SUPPORT
|
||||
#define TIFFInitPackbits NotConfigured
|
||||
#endif
|
||||
#ifndef THUNDER_SUPPORT
|
||||
#define TIFFInitThunderScan NotConfigured
|
||||
#endif
|
||||
#ifndef NEXT_SUPPORT
|
||||
#define TIFFInitNeXT NotConfigured
|
||||
#endif
|
||||
#ifndef JPEG_SUPPORT
|
||||
#define TIFFInitJPEG NotConfigured
|
||||
#endif
|
||||
#ifndef OJPEG_SUPPORT
|
||||
#define TIFFInitOJPEG NotConfigured
|
||||
#endif
|
||||
#ifndef CCITT_SUPPORT
|
||||
#define TIFFInitCCITTRLE NotConfigured
|
||||
#define TIFFInitCCITTRLEW NotConfigured
|
||||
#define TIFFInitCCITTFax3 NotConfigured
|
||||
#define TIFFInitCCITTFax4 NotConfigured
|
||||
#endif
|
||||
#ifndef JBIG_SUPPORT
|
||||
#define TIFFInitJBIG NotConfigured
|
||||
#endif
|
||||
#ifndef ZIP_SUPPORT
|
||||
#define TIFFInitZIP NotConfigured
|
||||
#endif
|
||||
#ifndef PIXARLOG_SUPPORT
|
||||
#define TIFFInitPixarLog NotConfigured
|
||||
#endif
|
||||
#ifndef LOGLUV_SUPPORT
|
||||
#define TIFFInitSGILog NotConfigured
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compression schemes statically built into the library.
|
||||
*/
|
||||
#ifdef VMS
|
||||
const TIFFCodec _TIFFBuiltinCODECS[] = {
|
||||
#else
|
||||
TIFFCodec _TIFFBuiltinCODECS[] = {
|
||||
#endif
|
||||
{ "None", COMPRESSION_NONE, TIFFInitDumpMode },
|
||||
{ "LZW", COMPRESSION_LZW, TIFFInitLZW },
|
||||
{ "PackBits", COMPRESSION_PACKBITS, TIFFInitPackBits },
|
||||
{ "ThunderScan", COMPRESSION_THUNDERSCAN,TIFFInitThunderScan },
|
||||
{ "NeXT", COMPRESSION_NEXT, TIFFInitNeXT },
|
||||
{ "JPEG", COMPRESSION_JPEG, TIFFInitJPEG },
|
||||
{ "Old-style JPEG", COMPRESSION_OJPEG, TIFFInitOJPEG },
|
||||
{ "CCITT RLE", COMPRESSION_CCITTRLE, TIFFInitCCITTRLE },
|
||||
{ "CCITT RLE/W", COMPRESSION_CCITTRLEW, TIFFInitCCITTRLEW },
|
||||
{ "CCITT Group 3", COMPRESSION_CCITTFAX3, TIFFInitCCITTFax3 },
|
||||
{ "CCITT Group 4", COMPRESSION_CCITTFAX4, TIFFInitCCITTFax4 },
|
||||
{ "ISO JBIG", COMPRESSION_JBIG, TIFFInitJBIG },
|
||||
{ "Deflate", COMPRESSION_DEFLATE, TIFFInitZIP },
|
||||
{ "AdobeDeflate", COMPRESSION_ADOBE_DEFLATE , TIFFInitZIP },
|
||||
{ "PixarLog", COMPRESSION_PIXARLOG, TIFFInitPixarLog },
|
||||
{ "SGILog", COMPRESSION_SGILOG, TIFFInitSGILog },
|
||||
{ "SGILog24", COMPRESSION_SGILOG24, TIFFInitSGILog },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static int
|
||||
_notConfigured(TIFF* tif)
|
||||
{
|
||||
const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
|
||||
|
||||
TIFFError(tif->tif_name,
|
||||
"%s compression support is not configured", c->name);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
NotConfigured(TIFF* tif, int scheme)
|
||||
{
|
||||
(void) scheme;
|
||||
|
||||
tif->tif_decodestatus = FALSE;
|
||||
tif->tif_setupdecode = _notConfigured;
|
||||
tif->tif_encodestatus = FALSE;
|
||||
tif->tif_setupencode = _notConfigured;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* TIFFIsCODECConfigured() */
|
||||
/************************************************************************/
|
||||
|
||||
/**
|
||||
* Check whether we have working codec for the specific coding scheme.
|
||||
*
|
||||
* @return returns 1 if the codec is configured and working. Otherwise
|
||||
* 0 will be returned.
|
||||
*/
|
||||
|
||||
int
|
||||
TIFFIsCODECConfigured(uint16 scheme)
|
||||
{
|
||||
const TIFFCodec* codec = TIFFFindCODEC(scheme);
|
||||
|
||||
if(codec == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if(codec->init == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if(codec->init != NotConfigured){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1,268 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* CIE L*a*b* to CIE XYZ and CIE XYZ to RGB conversion routines are taken
|
||||
* from the VIPS library (http://www.vips.ecs.soton.ac.uk) with
|
||||
* the permission of John Cupitt, the VIPS author.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library.
|
||||
*
|
||||
* Color space conversion routines.
|
||||
*/
|
||||
|
||||
#include "tiffiop.h"
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* Convert color value from the CIE L*a*b* 1976 space to CIE XYZ.
|
||||
*/
|
||||
void
|
||||
TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b,
|
||||
float *X, float *Y, float *Z)
|
||||
{
|
||||
float L = (float)l * 100.0F / 255.0F;
|
||||
float cby, tmp;
|
||||
|
||||
if( L < 8.856F ) {
|
||||
*Y = (L * cielab->Y0) / 903.292F;
|
||||
cby = 7.787F * (*Y / cielab->Y0) + 16.0F / 116.0F;
|
||||
} else {
|
||||
cby = (L + 16.0F) / 116.0F;
|
||||
*Y = cielab->Y0 * cby * cby * cby;
|
||||
}
|
||||
|
||||
tmp = (float)a / 500.0F + cby;
|
||||
if( tmp < 0.2069F )
|
||||
*X = cielab->X0 * (tmp - 0.13793F) / 7.787F;
|
||||
else
|
||||
*X = cielab->X0 * tmp * tmp * tmp;
|
||||
|
||||
tmp = cby - (float)b / 200.0F;
|
||||
if( tmp < 0.2069F )
|
||||
*Z = cielab->Z0 * (tmp - 0.13793F) / 7.787F;
|
||||
else
|
||||
*Z = cielab->Z0 * tmp * tmp * tmp;
|
||||
}
|
||||
|
||||
#define RINT(R) ((uint32)((R)>0?((R)+0.5):((R)-0.5)))
|
||||
/*
|
||||
* Convert color value from the XYZ space to RGB.
|
||||
*/
|
||||
void
|
||||
TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,
|
||||
uint32 *r, uint32 *g, uint32 *b)
|
||||
{
|
||||
int i;
|
||||
float Yr, Yg, Yb;
|
||||
float *matrix = &cielab->display.d_mat[0][0];
|
||||
|
||||
/* Multiply through the matrix to get luminosity values. */
|
||||
Yr = matrix[0] * X + matrix[1] * Y + matrix[2] * Z;
|
||||
Yg = matrix[3] * X + matrix[4] * Y + matrix[5] * Z;
|
||||
Yb = matrix[6] * X + matrix[7] * Y + matrix[8] * Z;
|
||||
|
||||
/* Clip input */
|
||||
Yr = TIFFmax( Yr, cielab->display.d_Y0R );
|
||||
Yg = TIFFmax( Yg, cielab->display.d_Y0G );
|
||||
Yb = TIFFmax( Yb, cielab->display.d_Y0B );
|
||||
|
||||
/* Turn luminosity to colour value. */
|
||||
i = TIFFmin(cielab->range,
|
||||
(int)((Yr - cielab->display.d_Y0R) / cielab->rstep));
|
||||
*r = RINT(cielab->Yr2r[i]);
|
||||
|
||||
i = TIFFmin(cielab->range,
|
||||
(int)((Yg - cielab->display.d_Y0G) / cielab->gstep));
|
||||
*g = RINT(cielab->Yg2g[i]);
|
||||
|
||||
i = TIFFmin(cielab->range,
|
||||
(int)((Yb - cielab->display.d_Y0B) / cielab->bstep));
|
||||
*b = RINT(cielab->Yb2b[i]);
|
||||
|
||||
/* Clip output. */
|
||||
*r = TIFFmin( *r, cielab->display.d_Vrwr );
|
||||
*g = TIFFmin( *g, cielab->display.d_Vrwg );
|
||||
*b = TIFFmin( *b, cielab->display.d_Vrwb );
|
||||
}
|
||||
#undef RINT
|
||||
|
||||
/*
|
||||
* Allocate conversion state structures and make look_up tables for
|
||||
* the Yr,Yb,Yg <=> r,g,b conversions.
|
||||
*/
|
||||
int
|
||||
TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
|
||||
TIFFDisplay *display, float *refWhite)
|
||||
{
|
||||
int i;
|
||||
float gamma;
|
||||
|
||||
cielab->range = CIELABTORGB_TABLE_RANGE;
|
||||
|
||||
_TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));
|
||||
|
||||
/* Red */
|
||||
gamma = 1.0F / cielab->display.d_gammaR ;
|
||||
cielab->rstep =
|
||||
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
|
||||
for(i = 0; i <= cielab->range; i++) {
|
||||
cielab->Yr2r[i] = cielab->display.d_Vrwr
|
||||
* ((float)pow((double)i / cielab->range, gamma));
|
||||
}
|
||||
|
||||
/* Green */
|
||||
gamma = 1.0F / cielab->display.d_gammaG ;
|
||||
cielab->gstep =
|
||||
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
|
||||
for(i = 0; i <= cielab->range; i++) {
|
||||
cielab->Yg2g[i] = cielab->display.d_Vrwg
|
||||
* ((float)pow((double)i / cielab->range, gamma));
|
||||
}
|
||||
|
||||
/* Blue */
|
||||
gamma = 1.0F / cielab->display.d_gammaB ;
|
||||
cielab->bstep =
|
||||
(cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
|
||||
for(i = 0; i <= cielab->range; i++) {
|
||||
cielab->Yb2b[i] = cielab->display.d_Vrwb
|
||||
* ((float)pow((double)i / cielab->range, gamma));
|
||||
}
|
||||
|
||||
/* Init reference white point */
|
||||
cielab->X0 = refWhite[0];
|
||||
cielab->Y0 = refWhite[1];
|
||||
cielab->Z0 = refWhite[2];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert color value from the YCbCr space to CIE XYZ.
|
||||
* The colorspace conversion algorithm comes from the IJG v5a code;
|
||||
* see below for more information on how it works.
|
||||
*/
|
||||
#define SHIFT 16
|
||||
#define FIX(x) ((int32)((x) * (1L<<SHIFT) + 0.5))
|
||||
#define ONE_HALF ((int32)(1<<(SHIFT-1)))
|
||||
#define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)((RW)-(RB)))
|
||||
#define CLAMP(f,min,max) ((f)<(min)?(min):(f)>(max)?(max):(f))
|
||||
|
||||
void
|
||||
TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr,
|
||||
uint32 *r, uint32 *g, uint32 *b)
|
||||
{
|
||||
/* XXX: Only 8-bit YCbCr input supported for now */
|
||||
Y = CLAMP(Y, 0, 255), Cb = CLAMP(Cb, 0, 255), Cr = CLAMP(Cr, 0, 255);
|
||||
|
||||
*r = ycbcr->clamptab[ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr]];
|
||||
*g = ycbcr->clamptab[ycbcr->Y_tab[Y]
|
||||
+ (int)((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT)];
|
||||
*b = ycbcr->clamptab[ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb]];
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the YCbCr->RGB conversion tables. The conversion
|
||||
* is done according to the 6.0 spec:
|
||||
*
|
||||
* R = Y + Cr*(2 - 2*LumaRed)
|
||||
* B = Y + Cb*(2 - 2*LumaBlue)
|
||||
* G = Y
|
||||
* - LumaBlue*Cb*(2-2*LumaBlue)/LumaGreen
|
||||
* - LumaRed*Cr*(2-2*LumaRed)/LumaGreen
|
||||
*
|
||||
* To avoid floating point arithmetic the fractional constants that
|
||||
* come out of the equations are represented as fixed point values
|
||||
* in the range 0...2^16. We also eliminate multiplications by
|
||||
* pre-calculating possible values indexed by Cb and Cr (this code
|
||||
* assumes conversion is being done for 8-bit samples).
|
||||
*/
|
||||
int
|
||||
TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
|
||||
{
|
||||
TIFFRGBValue* clamptab;
|
||||
int i;
|
||||
|
||||
#define LumaRed luma[0]
|
||||
#define LumaGreen luma[1]
|
||||
#define LumaBlue luma[2]
|
||||
|
||||
clamptab = (TIFFRGBValue*)(
|
||||
(tidata_t) ycbcr+TIFFroundup(sizeof (TIFFYCbCrToRGB), sizeof (long)));
|
||||
_TIFFmemset(clamptab, 0, 256); /* v < 0 => 0 */
|
||||
ycbcr->clamptab = (clamptab += 256);
|
||||
for (i = 0; i < 256; i++)
|
||||
clamptab[i] = (TIFFRGBValue) i;
|
||||
_TIFFmemset(clamptab+256, 255, 2*256); /* v > 255 => 255 */
|
||||
ycbcr->Cr_r_tab = (int*) (clamptab + 3*256);
|
||||
ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;
|
||||
ycbcr->Cr_g_tab = (int32*) (ycbcr->Cb_b_tab + 256);
|
||||
ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;
|
||||
ycbcr->Y_tab = ycbcr->Cb_g_tab + 256;
|
||||
|
||||
{ float f1 = 2-2*LumaRed; int32 D1 = FIX(f1);
|
||||
float f2 = LumaRed*f1/LumaGreen; int32 D2 = -FIX(f2);
|
||||
float f3 = 2-2*LumaBlue; int32 D3 = FIX(f3);
|
||||
float f4 = LumaBlue*f3/LumaGreen; int32 D4 = -FIX(f4);
|
||||
int x;
|
||||
|
||||
#undef LumaBlue
|
||||
#undef LumaGreen
|
||||
#undef LumaRed
|
||||
|
||||
/*
|
||||
* i is the actual input pixel value in the range 0..255
|
||||
* Cb and Cr values are in the range -128..127 (actually
|
||||
* they are in a range defined by the ReferenceBlackWhite
|
||||
* tag) so there is some range shifting to do here when
|
||||
* constructing tables indexed by the raw pixel data.
|
||||
*/
|
||||
for (i = 0, x = -128; i < 256; i++, x++) {
|
||||
int32 Cr = (int32)Code2V(x, refBlackWhite[4] - 128.0F,
|
||||
refBlackWhite[5] - 128.0F, 127);
|
||||
int32 Cb = (int32)Code2V(x, refBlackWhite[2] - 128.0F,
|
||||
refBlackWhite[3] - 128.0F, 127);
|
||||
|
||||
ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT);
|
||||
ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT);
|
||||
ycbcr->Cr_g_tab[i] = D2*Cr;
|
||||
ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF;
|
||||
ycbcr->Y_tab[i] =
|
||||
(int32)Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#undef CLAMP
|
||||
#undef Code2V
|
||||
#undef SHIFT
|
||||
#undef ONE_HALF
|
||||
#undef FIX
|
||||
|
||||
|
@@ -1,235 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library
|
||||
*
|
||||
* Compression Scheme Configuration Support.
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
|
||||
static int
|
||||
TIFFNoEncode(TIFF* tif, char* method)
|
||||
{
|
||||
const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
|
||||
|
||||
if (c) {
|
||||
if (! strncmp(c->name, "LZW", 3) ){
|
||||
TIFFError(tif->tif_name,
|
||||
"%s %s encoding is no longer implemented due to Unisys patent enforcement",
|
||||
c->name, method);
|
||||
} else {
|
||||
TIFFError(tif->tif_name, "%s %s encoding is not implemented",
|
||||
c->name, method);
|
||||
}
|
||||
}
|
||||
else {
|
||||
TIFFError(tif->tif_name,
|
||||
"Compression scheme %u %s encoding is not implemented",
|
||||
tif->tif_dir.td_compression, method);
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFNoRowEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
|
||||
{
|
||||
(void) pp; (void) cc; (void) s;
|
||||
return (TIFFNoEncode(tif, "scanline"));
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFNoStripEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
|
||||
{
|
||||
(void) pp; (void) cc; (void) s;
|
||||
return (TIFFNoEncode(tif, "strip"));
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFNoTileEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
|
||||
{
|
||||
(void) pp; (void) cc; (void) s;
|
||||
return (TIFFNoEncode(tif, "tile"));
|
||||
}
|
||||
|
||||
static int
|
||||
TIFFNoDecode(TIFF* tif, char* method)
|
||||
{
|
||||
const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
|
||||
|
||||
if (c)
|
||||
TIFFError(tif->tif_name, "%s %s decoding is not implemented",
|
||||
c->name, method);
|
||||
else
|
||||
TIFFError(tif->tif_name,
|
||||
"Compression scheme %u %s decoding is not implemented",
|
||||
tif->tif_dir.td_compression, method);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFNoRowDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
|
||||
{
|
||||
(void) pp; (void) cc; (void) s;
|
||||
return (TIFFNoDecode(tif, "scanline"));
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFNoStripDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
|
||||
{
|
||||
(void) pp; (void) cc; (void) s;
|
||||
return (TIFFNoDecode(tif, "strip"));
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFNoTileDecode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
|
||||
{
|
||||
(void) pp; (void) cc; (void) s;
|
||||
return (TIFFNoDecode(tif, "tile"));
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFNoSeek(TIFF* tif, uint32 off)
|
||||
{
|
||||
(void) off;
|
||||
TIFFError(tif->tif_name,
|
||||
"Compression algorithm does not support random access");
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
_TIFFNoPreCode(TIFF* tif, tsample_t s)
|
||||
{
|
||||
(void) tif; (void) s;
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int _TIFFtrue(TIFF* tif) { (void) tif; return (1); }
|
||||
static void _TIFFvoid(TIFF* tif) { (void) tif; }
|
||||
|
||||
void
|
||||
_TIFFSetDefaultCompressionState(TIFF* tif)
|
||||
{
|
||||
tif->tif_decodestatus = TRUE;
|
||||
tif->tif_setupdecode = _TIFFtrue;
|
||||
tif->tif_predecode = _TIFFNoPreCode;
|
||||
tif->tif_decoderow = _TIFFNoRowDecode;
|
||||
tif->tif_decodestrip = _TIFFNoStripDecode;
|
||||
tif->tif_decodetile = _TIFFNoTileDecode;
|
||||
tif->tif_encodestatus = TRUE;
|
||||
tif->tif_setupencode = _TIFFtrue;
|
||||
tif->tif_preencode = _TIFFNoPreCode;
|
||||
tif->tif_postencode = _TIFFtrue;
|
||||
tif->tif_encoderow = _TIFFNoRowEncode;
|
||||
tif->tif_encodestrip = _TIFFNoStripEncode;
|
||||
tif->tif_encodetile = _TIFFNoTileEncode;
|
||||
tif->tif_close = _TIFFvoid;
|
||||
tif->tif_seek = _TIFFNoSeek;
|
||||
tif->tif_cleanup = _TIFFvoid;
|
||||
tif->tif_defstripsize = _TIFFDefaultStripSize;
|
||||
tif->tif_deftilesize = _TIFFDefaultTileSize;
|
||||
tif->tif_flags &= ~TIFF_NOBITREV;
|
||||
}
|
||||
|
||||
int
|
||||
TIFFSetCompressionScheme(TIFF* tif, int scheme)
|
||||
{
|
||||
const TIFFCodec *c = TIFFFindCODEC((uint16) scheme);
|
||||
|
||||
_TIFFSetDefaultCompressionState(tif);
|
||||
/*
|
||||
* Don't treat an unknown compression scheme as an error.
|
||||
* This permits applications to open files with data that
|
||||
* the library does not have builtin support for, but which
|
||||
* may still be meaningful.
|
||||
*/
|
||||
return (c ? (*c->init)(tif, scheme) : 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Other compression schemes may be registered. Registered
|
||||
* schemes can also override the builtin versions provided
|
||||
* by this library.
|
||||
*/
|
||||
typedef struct _codec {
|
||||
struct _codec* next;
|
||||
TIFFCodec* info;
|
||||
} codec_t;
|
||||
static codec_t* registeredCODECS = NULL;
|
||||
|
||||
const TIFFCodec*
|
||||
TIFFFindCODEC(uint16 scheme)
|
||||
{
|
||||
const TIFFCodec* c;
|
||||
codec_t* cd;
|
||||
|
||||
for (cd = registeredCODECS; cd; cd = cd->next)
|
||||
if (cd->info->scheme == scheme)
|
||||
return ((const TIFFCodec*) cd->info);
|
||||
for (c = _TIFFBuiltinCODECS; c->name; c++)
|
||||
if (c->scheme == scheme)
|
||||
return (c);
|
||||
return ((const TIFFCodec*) 0);
|
||||
}
|
||||
|
||||
TIFFCodec*
|
||||
TIFFRegisterCODEC(uint16 scheme, const char* name, TIFFInitMethod init)
|
||||
{
|
||||
codec_t* cd = (codec_t*)
|
||||
_TIFFmalloc(sizeof (codec_t) + sizeof (TIFFCodec) + strlen(name)+1);
|
||||
|
||||
if (cd != NULL) {
|
||||
cd->info = (TIFFCodec*) ((tidata_t) cd + sizeof (codec_t));
|
||||
cd->info->name = (char*)
|
||||
((tidata_t) cd->info + sizeof (TIFFCodec));
|
||||
strcpy(cd->info->name, name);
|
||||
cd->info->scheme = scheme;
|
||||
cd->info->init = init;
|
||||
cd->next = registeredCODECS;
|
||||
registeredCODECS = cd;
|
||||
} else {
|
||||
TIFFError("TIFFRegisterCODEC",
|
||||
"No space to register compression scheme %s", name);
|
||||
return NULL;
|
||||
}
|
||||
return (cd->info);
|
||||
}
|
||||
|
||||
void
|
||||
TIFFUnRegisterCODEC(TIFFCodec* c)
|
||||
{
|
||||
codec_t* cd;
|
||||
codec_t** pcd;
|
||||
|
||||
for (pcd = ®isteredCODECS; (cd = *pcd); pcd = &cd->next)
|
||||
if (cd->info == c) {
|
||||
*pcd = cd->next;
|
||||
_TIFFfree(cd);
|
||||
return;
|
||||
}
|
||||
TIFFError("TIFFUnRegisterCODEC",
|
||||
"Cannot remove compression scheme %s; not registered", c->name);
|
||||
}
|
1435
src/tiff/tif_dir.c
1435
src/tiff/tif_dir.c
File diff suppressed because it is too large
Load Diff
@@ -1,267 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _TIFFDIR_
|
||||
#define _TIFFDIR_
|
||||
/*
|
||||
* ``Library-private'' Directory-related Definitions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Internal format of a TIFF directory entry.
|
||||
*/
|
||||
typedef struct {
|
||||
#define FIELD_SETLONGS 4
|
||||
/* bit vector of fields that are set */
|
||||
u_long td_fieldsset[FIELD_SETLONGS];
|
||||
|
||||
uint32 td_imagewidth, td_imagelength, td_imagedepth;
|
||||
uint32 td_tilewidth, td_tilelength, td_tiledepth;
|
||||
uint32 td_subfiletype;
|
||||
uint16 td_bitspersample;
|
||||
uint16 td_sampleformat;
|
||||
uint16 td_compression;
|
||||
uint16 td_photometric;
|
||||
uint16 td_threshholding;
|
||||
uint16 td_fillorder;
|
||||
uint16 td_orientation;
|
||||
uint16 td_samplesperpixel;
|
||||
uint32 td_rowsperstrip;
|
||||
uint16 td_minsamplevalue, td_maxsamplevalue;
|
||||
double td_sminsamplevalue, td_smaxsamplevalue;
|
||||
float td_xresolution, td_yresolution;
|
||||
uint16 td_resolutionunit;
|
||||
uint16 td_planarconfig;
|
||||
float td_xposition, td_yposition;
|
||||
uint16 td_pagenumber[2];
|
||||
uint16* td_colormap[3];
|
||||
uint16 td_halftonehints[2];
|
||||
uint16 td_extrasamples;
|
||||
uint16* td_sampleinfo;
|
||||
double td_stonits;
|
||||
char* td_documentname;
|
||||
char* td_artist;
|
||||
char* td_datetime;
|
||||
char* td_hostcomputer;
|
||||
char* td_imagedescription;
|
||||
char* td_make;
|
||||
char* td_model;
|
||||
char* td_copyright;
|
||||
char* td_pagename;
|
||||
tstrip_t td_stripsperimage;
|
||||
tstrip_t td_nstrips; /* size of offset & bytecount arrays */
|
||||
uint32* td_stripoffset;
|
||||
uint32* td_stripbytecount;
|
||||
#if SUBIFD_SUPPORT
|
||||
uint16 td_nsubifd;
|
||||
uint32* td_subifd;
|
||||
#endif
|
||||
#ifdef YCBCR_SUPPORT
|
||||
float* td_ycbcrcoeffs;
|
||||
uint16 td_ycbcrsubsampling[2];
|
||||
uint16 td_ycbcrpositioning;
|
||||
#endif
|
||||
#ifdef COLORIMETRY_SUPPORT
|
||||
float* td_whitepoint;
|
||||
float* td_primarychromas;
|
||||
float* td_refblackwhite;
|
||||
uint16* td_transferfunction[3];
|
||||
#endif
|
||||
#ifdef CMYK_SUPPORT
|
||||
uint16 td_inkset;
|
||||
uint16 td_ninks;
|
||||
uint16 td_dotrange[2];
|
||||
int td_inknameslen;
|
||||
char* td_inknames;
|
||||
char* td_targetprinter;
|
||||
#endif
|
||||
#ifdef ICC_SUPPORT
|
||||
uint32 td_profileLength;
|
||||
void *td_profileData;
|
||||
#endif
|
||||
#ifdef PHOTOSHOP_SUPPORT
|
||||
uint32 td_photoshopLength;
|
||||
void *td_photoshopData;
|
||||
#endif
|
||||
#ifdef IPTC_SUPPORT
|
||||
uint32 td_richtiffiptcLength;
|
||||
void *td_richtiffiptcData;
|
||||
#endif
|
||||
/* Begin Pixar Tag values. */
|
||||
uint32 td_imagefullwidth, td_imagefulllength;
|
||||
char* td_textureformat;
|
||||
char* td_wrapmodes;
|
||||
float td_fovcot;
|
||||
float* td_matrixWorldToScreen;
|
||||
float* td_matrixWorldToCamera;
|
||||
/* End Pixar Tag Values. */
|
||||
uint32 td_xmlpacketLength;
|
||||
void *td_xmlpacketData;
|
||||
int td_customValueCount;
|
||||
TIFFTagValue *td_customValues;
|
||||
} TIFFDirectory;
|
||||
|
||||
/*
|
||||
* Field flags used to indicate fields that have
|
||||
* been set in a directory, and to reference fields
|
||||
* when manipulating a directory.
|
||||
*/
|
||||
|
||||
/*
|
||||
* FIELD_IGNORE is used to signify tags that are to
|
||||
* be processed but otherwise ignored. This permits
|
||||
* antiquated tags to be quietly read and discarded.
|
||||
* Note that a bit *is* allocated for ignored tags;
|
||||
* this is understood by the directory reading logic
|
||||
* which uses this fact to avoid special-case handling
|
||||
*/
|
||||
#define FIELD_IGNORE 0
|
||||
|
||||
/* multi-item fields */
|
||||
#define FIELD_IMAGEDIMENSIONS 1
|
||||
#define FIELD_TILEDIMENSIONS 2
|
||||
#define FIELD_RESOLUTION 3
|
||||
#define FIELD_POSITION 4
|
||||
|
||||
/* single-item fields */
|
||||
#define FIELD_SUBFILETYPE 5
|
||||
#define FIELD_BITSPERSAMPLE 6
|
||||
#define FIELD_COMPRESSION 7
|
||||
#define FIELD_PHOTOMETRIC 8
|
||||
#define FIELD_THRESHHOLDING 9
|
||||
#define FIELD_FILLORDER 10
|
||||
#define FIELD_DOCUMENTNAME 11
|
||||
#define FIELD_IMAGEDESCRIPTION 12
|
||||
#define FIELD_MAKE 13
|
||||
#define FIELD_MODEL 14
|
||||
#define FIELD_ORIENTATION 15
|
||||
#define FIELD_SAMPLESPERPIXEL 16
|
||||
#define FIELD_ROWSPERSTRIP 17
|
||||
#define FIELD_MINSAMPLEVALUE 18
|
||||
#define FIELD_MAXSAMPLEVALUE 19
|
||||
#define FIELD_PLANARCONFIG 20
|
||||
#define FIELD_PAGENAME 21
|
||||
#define FIELD_RESOLUTIONUNIT 22
|
||||
#define FIELD_PAGENUMBER 23
|
||||
#define FIELD_STRIPBYTECOUNTS 24
|
||||
#define FIELD_STRIPOFFSETS 25
|
||||
#define FIELD_COLORMAP 26
|
||||
#define FIELD_ARTIST 27
|
||||
#define FIELD_DATETIME 28
|
||||
#define FIELD_HOSTCOMPUTER 29
|
||||
/* unused - was FIELD_SOFTWARE 30 */
|
||||
#define FIELD_EXTRASAMPLES 31
|
||||
#define FIELD_SAMPLEFORMAT 32
|
||||
#define FIELD_SMINSAMPLEVALUE 33
|
||||
#define FIELD_SMAXSAMPLEVALUE 34
|
||||
#define FIELD_IMAGEDEPTH 35
|
||||
#define FIELD_TILEDEPTH 36
|
||||
#define FIELD_HALFTONEHINTS 37
|
||||
#define FIELD_YCBCRCOEFFICIENTS 38
|
||||
#define FIELD_YCBCRSUBSAMPLING 39
|
||||
#define FIELD_YCBCRPOSITIONING 40
|
||||
#define FIELD_REFBLACKWHITE 41
|
||||
#define FIELD_WHITEPOINT 42
|
||||
#define FIELD_PRIMARYCHROMAS 43
|
||||
#define FIELD_TRANSFERFUNCTION 44
|
||||
#define FIELD_INKSET 45
|
||||
#define FIELD_INKNAMES 46
|
||||
#define FIELD_DOTRANGE 47
|
||||
#define FIELD_TARGETPRINTER 48
|
||||
#define FIELD_SUBIFD 49
|
||||
#define FIELD_NUMBEROFINKS 50
|
||||
#define FIELD_ICCPROFILE 51
|
||||
#define FIELD_PHOTOSHOP 52
|
||||
#define FIELD_RICHTIFFIPTC 53
|
||||
#define FIELD_STONITS 54
|
||||
/* Begin PIXAR */
|
||||
#define FIELD_IMAGEFULLWIDTH 55
|
||||
#define FIELD_IMAGEFULLLENGTH 56
|
||||
#define FIELD_TEXTUREFORMAT 57
|
||||
#define FIELD_WRAPMODES 58
|
||||
#define FIELD_FOVCOT 59
|
||||
#define FIELD_MATRIX_WORLDTOSCREEN 60
|
||||
#define FIELD_MATRIX_WORLDTOCAMERA 61
|
||||
#define FIELD_COPYRIGHT 62
|
||||
#define FIELD_XMLPACKET 63
|
||||
/* FIELD_CUSTOM (see tiffio.h) 65 */
|
||||
/* end of support for well-known tags; codec-private tags follow */
|
||||
#define FIELD_CODEC 66 /* base of codec-private tags */
|
||||
|
||||
|
||||
/*
|
||||
* Pseudo-tags don't normally need field bits since they
|
||||
* are not written to an output file (by definition).
|
||||
* The library also has express logic to always query a
|
||||
* codec for a pseudo-tag so allocating a field bit for
|
||||
* one is a waste. If codec wants to promote the notion
|
||||
* of a pseudo-tag being ``set'' or ``unset'' then it can
|
||||
* do using internal state flags without polluting the
|
||||
* field bit space defined for real tags.
|
||||
*/
|
||||
#define FIELD_PSEUDO 0
|
||||
|
||||
#define FIELD_LAST (32*FIELD_SETLONGS-1)
|
||||
|
||||
#define TIFFExtractData(tif, type, v) \
|
||||
((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
|
||||
((v) >> (tif)->tif_typeshift[type]) & (tif)->tif_typemask[type] : \
|
||||
(v) & (tif)->tif_typemask[type]))
|
||||
#define TIFFInsertData(tif, type, v) \
|
||||
((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
|
||||
((v) & (tif)->tif_typemask[type]) << (tif)->tif_typeshift[type] : \
|
||||
(v) & (tif)->tif_typemask[type]))
|
||||
|
||||
|
||||
#define BITn(n) (((u_long)1L)<<((n)&0x1f))
|
||||
#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n)/32])
|
||||
#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
|
||||
#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
|
||||
#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
|
||||
|
||||
#define FieldSet(fields, f) (fields[(f)/32] & BITn(f))
|
||||
#define ResetFieldBit(fields, f) (fields[(f)/32] &= ~BITn(f))
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void _TIFFSetupFieldInfo(TIFF*);
|
||||
extern void _TIFFPrintFieldInfo(TIFF*, FILE*);
|
||||
extern TIFFDataType _TIFFSampleToTagType(TIFF*);
|
||||
extern const TIFFFieldInfo* _TIFFFindOrRegisterFieldInfo( TIFF *tif,
|
||||
ttag_t tag,
|
||||
TIFFDataType dt );
|
||||
extern TIFFFieldInfo* _TIFFCreateAnonFieldInfo( TIFF *tif, ttag_t tag,
|
||||
TIFFDataType dt );
|
||||
|
||||
#define _TIFFMergeFieldInfo TIFFMergeFieldInfo
|
||||
#define _TIFFFindFieldInfo TIFFFindFieldInfo
|
||||
#define _TIFFFieldWithTag TIFFFieldWithTag
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif /* _TIFFDIR_ */
|
@@ -1,486 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library.
|
||||
*
|
||||
* Core Directory Tag Support.
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* NB: NB: THIS ARRAY IS ASSUMED TO BE SORTED BY TAG.
|
||||
* If a tag can have both LONG and SHORT types
|
||||
* then the LONG must be placed before the SHORT for
|
||||
* writing to work properly.
|
||||
*
|
||||
* NOTE: The second field (field_readcount) and third field (field_writecount)
|
||||
* sometimes use the values TIFF_VARIABLE (-1), TIFF_VARIABLE2 (-3)
|
||||
* and TIFFTAG_SPP (-2). The macros should be used but would throw off
|
||||
* the formatting of the code, so please interprete the -1, -2 and -3
|
||||
* values accordingly.
|
||||
*/
|
||||
#ifndef VMS
|
||||
static
|
||||
#endif
|
||||
const TIFFFieldInfo tiffFieldInfo[] = {
|
||||
{ TIFFTAG_SUBFILETYPE, 1, 1, TIFF_LONG, FIELD_SUBFILETYPE,
|
||||
TRUE, FALSE, "SubfileType" },
|
||||
/* XXX SHORT for compatibility w/ old versions of the library */
|
||||
{ TIFFTAG_SUBFILETYPE, 1, 1, TIFF_SHORT, FIELD_SUBFILETYPE,
|
||||
TRUE, FALSE, "SubfileType" },
|
||||
{ TIFFTAG_OSUBFILETYPE, 1, 1, TIFF_SHORT, FIELD_SUBFILETYPE,
|
||||
TRUE, FALSE, "OldSubfileType" },
|
||||
{ TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_LONG, FIELD_IMAGEDIMENSIONS,
|
||||
FALSE, FALSE, "ImageWidth" },
|
||||
{ TIFFTAG_IMAGEWIDTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDIMENSIONS,
|
||||
FALSE, FALSE, "ImageWidth" },
|
||||
{ TIFFTAG_IMAGELENGTH, 1, 1, TIFF_LONG, FIELD_IMAGEDIMENSIONS,
|
||||
TRUE, FALSE, "ImageLength" },
|
||||
{ TIFFTAG_IMAGELENGTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDIMENSIONS,
|
||||
TRUE, FALSE, "ImageLength" },
|
||||
/* XXX LONG for compatibility with some broken TIFF writers */
|
||||
{ TIFFTAG_BITSPERSAMPLE, -1,-1, TIFF_LONG, FIELD_BITSPERSAMPLE,
|
||||
FALSE, FALSE, "BitsPerSample" },
|
||||
{ TIFFTAG_BITSPERSAMPLE, -1,-1, TIFF_SHORT, FIELD_BITSPERSAMPLE,
|
||||
FALSE, FALSE, "BitsPerSample" },
|
||||
/* XXX LONG for compatibility with some broken TIFF writers */
|
||||
{ TIFFTAG_COMPRESSION, -1, 1, TIFF_LONG, FIELD_COMPRESSION,
|
||||
FALSE, FALSE, "Compression" },
|
||||
{ TIFFTAG_COMPRESSION, -1, 1, TIFF_SHORT, FIELD_COMPRESSION,
|
||||
FALSE, FALSE, "Compression" },
|
||||
/* XXX LONG for compatibility with some broken TIFF writers */
|
||||
{ TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_LONG, FIELD_PHOTOMETRIC,
|
||||
FALSE, FALSE, "PhotometricInterpretation" },
|
||||
{ TIFFTAG_PHOTOMETRIC, 1, 1, TIFF_SHORT, FIELD_PHOTOMETRIC,
|
||||
FALSE, FALSE, "PhotometricInterpretation" },
|
||||
{ TIFFTAG_THRESHHOLDING, 1, 1, TIFF_SHORT, FIELD_THRESHHOLDING,
|
||||
TRUE, FALSE, "Threshholding" },
|
||||
{ TIFFTAG_CELLWIDTH, 1, 1, TIFF_SHORT, FIELD_IGNORE,
|
||||
TRUE, FALSE, "CellWidth" },
|
||||
{ TIFFTAG_CELLLENGTH, 1, 1, TIFF_SHORT, FIELD_IGNORE,
|
||||
TRUE, FALSE, "CellLength" },
|
||||
{ TIFFTAG_FILLORDER, 1, 1, TIFF_SHORT, FIELD_FILLORDER,
|
||||
FALSE, FALSE, "FillOrder" },
|
||||
{ TIFFTAG_DOCUMENTNAME, -1,-1, TIFF_ASCII, FIELD_DOCUMENTNAME,
|
||||
TRUE, FALSE, "DocumentName" },
|
||||
{ TIFFTAG_IMAGEDESCRIPTION, -1,-1, TIFF_ASCII, FIELD_IMAGEDESCRIPTION,
|
||||
TRUE, FALSE, "ImageDescription" },
|
||||
{ TIFFTAG_MAKE, -1,-1, TIFF_ASCII, FIELD_MAKE,
|
||||
TRUE, FALSE, "Make" },
|
||||
{ TIFFTAG_MODEL, -1,-1, TIFF_ASCII, FIELD_MODEL,
|
||||
TRUE, FALSE, "Model" },
|
||||
{ TIFFTAG_STRIPOFFSETS, -1,-1, TIFF_LONG, FIELD_STRIPOFFSETS,
|
||||
FALSE, FALSE, "StripOffsets" },
|
||||
{ TIFFTAG_STRIPOFFSETS, -1,-1, TIFF_SHORT, FIELD_STRIPOFFSETS,
|
||||
FALSE, FALSE, "StripOffsets" },
|
||||
{ TIFFTAG_ORIENTATION, 1, 1, TIFF_SHORT, FIELD_ORIENTATION,
|
||||
FALSE, FALSE, "Orientation" },
|
||||
{ TIFFTAG_SAMPLESPERPIXEL, 1, 1, TIFF_SHORT, FIELD_SAMPLESPERPIXEL,
|
||||
FALSE, FALSE, "SamplesPerPixel" },
|
||||
{ TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_LONG, FIELD_ROWSPERSTRIP,
|
||||
FALSE, FALSE, "RowsPerStrip" },
|
||||
{ TIFFTAG_ROWSPERSTRIP, 1, 1, TIFF_SHORT, FIELD_ROWSPERSTRIP,
|
||||
FALSE, FALSE, "RowsPerStrip" },
|
||||
{ TIFFTAG_STRIPBYTECOUNTS, -1,-1, TIFF_LONG, FIELD_STRIPBYTECOUNTS,
|
||||
FALSE, FALSE, "StripByteCounts" },
|
||||
{ TIFFTAG_STRIPBYTECOUNTS, -1,-1, TIFF_SHORT, FIELD_STRIPBYTECOUNTS,
|
||||
FALSE, FALSE, "StripByteCounts" },
|
||||
{ TIFFTAG_MINSAMPLEVALUE, -2,-1, TIFF_SHORT, FIELD_MINSAMPLEVALUE,
|
||||
TRUE, FALSE, "MinSampleValue" },
|
||||
{ TIFFTAG_MAXSAMPLEVALUE, -2,-1, TIFF_SHORT, FIELD_MAXSAMPLEVALUE,
|
||||
TRUE, FALSE, "MaxSampleValue" },
|
||||
{ TIFFTAG_XRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_RESOLUTION,
|
||||
FALSE, FALSE, "XResolution" },
|
||||
{ TIFFTAG_YRESOLUTION, 1, 1, TIFF_RATIONAL, FIELD_RESOLUTION,
|
||||
FALSE, FALSE, "YResolution" },
|
||||
{ TIFFTAG_PLANARCONFIG, 1, 1, TIFF_SHORT, FIELD_PLANARCONFIG,
|
||||
FALSE, FALSE, "PlanarConfiguration" },
|
||||
{ TIFFTAG_PAGENAME, -1,-1, TIFF_ASCII, FIELD_PAGENAME,
|
||||
TRUE, FALSE, "PageName" },
|
||||
{ TIFFTAG_XPOSITION, 1, 1, TIFF_RATIONAL, FIELD_POSITION,
|
||||
TRUE, FALSE, "XPosition" },
|
||||
{ TIFFTAG_YPOSITION, 1, 1, TIFF_RATIONAL, FIELD_POSITION,
|
||||
TRUE, FALSE, "YPosition" },
|
||||
{ TIFFTAG_FREEOFFSETS, -1,-1, TIFF_LONG, FIELD_IGNORE,
|
||||
FALSE, FALSE, "FreeOffsets" },
|
||||
{ TIFFTAG_FREEBYTECOUNTS, -1,-1, TIFF_LONG, FIELD_IGNORE,
|
||||
FALSE, FALSE, "FreeByteCounts" },
|
||||
{ TIFFTAG_GRAYRESPONSEUNIT, 1, 1, TIFF_SHORT, FIELD_IGNORE,
|
||||
TRUE, FALSE, "GrayResponseUnit" },
|
||||
{ TIFFTAG_GRAYRESPONSECURVE,-1,-1, TIFF_SHORT, FIELD_IGNORE,
|
||||
TRUE, FALSE, "GrayResponseCurve" },
|
||||
{ TIFFTAG_RESOLUTIONUNIT, 1, 1, TIFF_SHORT, FIELD_RESOLUTIONUNIT,
|
||||
FALSE, FALSE, "ResolutionUnit" },
|
||||
{ TIFFTAG_PAGENUMBER, 2, 2, TIFF_SHORT, FIELD_PAGENUMBER,
|
||||
TRUE, FALSE, "PageNumber" },
|
||||
{ TIFFTAG_COLORRESPONSEUNIT, 1, 1, TIFF_SHORT, FIELD_IGNORE,
|
||||
TRUE, FALSE, "ColorResponseUnit" },
|
||||
{ TIFFTAG_TRANSFERFUNCTION, -1,-1, TIFF_SHORT, FIELD_TRANSFERFUNCTION,
|
||||
TRUE, FALSE, "TransferFunction" },
|
||||
{ TIFFTAG_SOFTWARE, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
|
||||
TRUE, FALSE, "Software" },
|
||||
{ TIFFTAG_DATETIME, 20,20, TIFF_ASCII, FIELD_DATETIME,
|
||||
TRUE, FALSE, "DateTime" },
|
||||
{ TIFFTAG_ARTIST, -1,-1, TIFF_ASCII, FIELD_ARTIST,
|
||||
TRUE, FALSE, "Artist" },
|
||||
{ TIFFTAG_HOSTCOMPUTER, -1,-1, TIFF_ASCII, FIELD_HOSTCOMPUTER,
|
||||
TRUE, FALSE, "HostComputer" },
|
||||
{ TIFFTAG_WHITEPOINT, 2, 2, TIFF_RATIONAL,FIELD_WHITEPOINT,
|
||||
TRUE, FALSE, "WhitePoint" },
|
||||
{ TIFFTAG_PRIMARYCHROMATICITIES,6,6,TIFF_RATIONAL,FIELD_PRIMARYCHROMAS,
|
||||
TRUE, FALSE, "PrimaryChromaticities" },
|
||||
{ TIFFTAG_COLORMAP, -1,-1, TIFF_SHORT, FIELD_COLORMAP,
|
||||
TRUE, FALSE, "ColorMap" },
|
||||
{ TIFFTAG_HALFTONEHINTS, 2, 2, TIFF_SHORT, FIELD_HALFTONEHINTS,
|
||||
TRUE, FALSE, "HalftoneHints" },
|
||||
{ TIFFTAG_TILEWIDTH, 1, 1, TIFF_LONG, FIELD_TILEDIMENSIONS,
|
||||
FALSE, FALSE, "TileWidth" },
|
||||
{ TIFFTAG_TILEWIDTH, 1, 1, TIFF_SHORT, FIELD_TILEDIMENSIONS,
|
||||
FALSE, FALSE, "TileWidth" },
|
||||
{ TIFFTAG_TILELENGTH, 1, 1, TIFF_LONG, FIELD_TILEDIMENSIONS,
|
||||
FALSE, FALSE, "TileLength" },
|
||||
{ TIFFTAG_TILELENGTH, 1, 1, TIFF_SHORT, FIELD_TILEDIMENSIONS,
|
||||
FALSE, FALSE, "TileLength" },
|
||||
{ TIFFTAG_TILEOFFSETS, -1, 1, TIFF_LONG, FIELD_STRIPOFFSETS,
|
||||
FALSE, FALSE, "TileOffsets" },
|
||||
{ TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_LONG, FIELD_STRIPBYTECOUNTS,
|
||||
FALSE, FALSE, "TileByteCounts" },
|
||||
{ TIFFTAG_TILEBYTECOUNTS, -1, 1, TIFF_SHORT, FIELD_STRIPBYTECOUNTS,
|
||||
FALSE, FALSE, "TileByteCounts" },
|
||||
{ TIFFTAG_SUBIFD, -1,-1, TIFF_LONG, FIELD_SUBIFD,
|
||||
TRUE, TRUE, "SubIFD" },
|
||||
{ TIFFTAG_INKSET, 1, 1, TIFF_SHORT, FIELD_INKSET,
|
||||
FALSE, FALSE, "InkSet" },
|
||||
{ TIFFTAG_INKNAMES, -1,-1, TIFF_ASCII, FIELD_INKNAMES,
|
||||
TRUE, TRUE, "InkNames" },
|
||||
{ TIFFTAG_NUMBEROFINKS, 1, 1, TIFF_SHORT, FIELD_NUMBEROFINKS,
|
||||
TRUE, FALSE, "NumberOfInks" },
|
||||
{ TIFFTAG_DOTRANGE, 2, 2, TIFF_SHORT, FIELD_DOTRANGE,
|
||||
FALSE, FALSE, "DotRange" },
|
||||
{ TIFFTAG_DOTRANGE, 2, 2, TIFF_BYTE, FIELD_DOTRANGE,
|
||||
FALSE, FALSE, "DotRange" },
|
||||
{ TIFFTAG_TARGETPRINTER, -1,-1, TIFF_ASCII, FIELD_TARGETPRINTER,
|
||||
TRUE, FALSE, "TargetPrinter" },
|
||||
{ TIFFTAG_EXTRASAMPLES, -1,-1, TIFF_SHORT, FIELD_EXTRASAMPLES,
|
||||
FALSE, FALSE, "ExtraSamples" },
|
||||
/* XXX for bogus Adobe Photoshop v2.5 files */
|
||||
{ TIFFTAG_EXTRASAMPLES, -1,-1, TIFF_BYTE, FIELD_EXTRASAMPLES,
|
||||
FALSE, FALSE, "ExtraSamples" },
|
||||
{ TIFFTAG_SAMPLEFORMAT, -1,-1, TIFF_SHORT, FIELD_SAMPLEFORMAT,
|
||||
FALSE, FALSE, "SampleFormat" },
|
||||
{ TIFFTAG_SMINSAMPLEVALUE, -2,-1, TIFF_ANY, FIELD_SMINSAMPLEVALUE,
|
||||
TRUE, FALSE, "SMinSampleValue" },
|
||||
{ TIFFTAG_SMAXSAMPLEVALUE, -2,-1, TIFF_ANY, FIELD_SMAXSAMPLEVALUE,
|
||||
TRUE, FALSE, "SMaxSampleValue" },
|
||||
{ TIFFTAG_YCBCRCOEFFICIENTS, 3, 3, TIFF_RATIONAL, FIELD_YCBCRCOEFFICIENTS,
|
||||
FALSE, FALSE, "YCbCrCoefficients" },
|
||||
{ TIFFTAG_YCBCRSUBSAMPLING, 2, 2, TIFF_SHORT, FIELD_YCBCRSUBSAMPLING,
|
||||
FALSE, FALSE, "YCbCrSubsampling" },
|
||||
{ TIFFTAG_YCBCRPOSITIONING, 1, 1, TIFF_SHORT, FIELD_YCBCRPOSITIONING,
|
||||
FALSE, FALSE, "YCbCrPositioning" },
|
||||
{ TIFFTAG_REFERENCEBLACKWHITE,6,6,TIFF_RATIONAL, FIELD_REFBLACKWHITE,
|
||||
TRUE, FALSE, "ReferenceBlackWhite" },
|
||||
/* XXX temporarily accept LONG for backwards compatibility */
|
||||
{ TIFFTAG_REFERENCEBLACKWHITE,6,6,TIFF_LONG, FIELD_REFBLACKWHITE,
|
||||
TRUE, FALSE, "ReferenceBlackWhite" },
|
||||
{ TIFFTAG_XMLPACKET, -1,-3, TIFF_UNDEFINED, FIELD_XMLPACKET,
|
||||
FALSE, TRUE, "XMLPacket" },
|
||||
/* begin SGI tags */
|
||||
{ TIFFTAG_MATTEING, 1, 1, TIFF_SHORT, FIELD_EXTRASAMPLES,
|
||||
FALSE, FALSE, "Matteing" },
|
||||
{ TIFFTAG_DATATYPE, -2,-1, TIFF_SHORT, FIELD_SAMPLEFORMAT,
|
||||
FALSE, FALSE, "DataType" },
|
||||
{ TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_LONG, FIELD_IMAGEDEPTH,
|
||||
FALSE, FALSE, "ImageDepth" },
|
||||
{ TIFFTAG_IMAGEDEPTH, 1, 1, TIFF_SHORT, FIELD_IMAGEDEPTH,
|
||||
FALSE, FALSE, "ImageDepth" },
|
||||
{ TIFFTAG_TILEDEPTH, 1, 1, TIFF_LONG, FIELD_TILEDEPTH,
|
||||
FALSE, FALSE, "TileDepth" },
|
||||
{ TIFFTAG_TILEDEPTH, 1, 1, TIFF_SHORT, FIELD_TILEDEPTH,
|
||||
FALSE, FALSE, "TileDepth" },
|
||||
/* end SGI tags */
|
||||
/* begin Pixar tags */
|
||||
{ TIFFTAG_PIXAR_IMAGEFULLWIDTH, 1, 1, TIFF_LONG, FIELD_IMAGEFULLWIDTH,
|
||||
TRUE, FALSE, "ImageFullWidth" },
|
||||
{ TIFFTAG_PIXAR_IMAGEFULLLENGTH, 1, 1, TIFF_LONG, FIELD_IMAGEFULLLENGTH,
|
||||
TRUE, FALSE, "ImageFullLength" },
|
||||
{ TIFFTAG_PIXAR_TEXTUREFORMAT, -1,-1, TIFF_ASCII, FIELD_TEXTUREFORMAT,
|
||||
TRUE, FALSE, "TextureFormat" },
|
||||
{ TIFFTAG_PIXAR_WRAPMODES, -1,-1, TIFF_ASCII, FIELD_WRAPMODES,
|
||||
TRUE, FALSE, "TextureWrapModes" },
|
||||
{ TIFFTAG_PIXAR_FOVCOT, 1, 1, TIFF_FLOAT, FIELD_FOVCOT,
|
||||
TRUE, FALSE, "FieldOfViewCotan" },
|
||||
{ TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN, 16,16, TIFF_FLOAT,
|
||||
FIELD_MATRIX_WORLDTOSCREEN, TRUE, FALSE, "MatrixWorldToScreen" },
|
||||
{ TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA, 16,16, TIFF_FLOAT,
|
||||
FIELD_MATRIX_WORLDTOCAMERA, TRUE, FALSE, "MatrixWorldToCamera" },
|
||||
{ TIFFTAG_COPYRIGHT, -1,-1, TIFF_ASCII, FIELD_COPYRIGHT,
|
||||
TRUE, FALSE, "Copyright" },
|
||||
/* end Pixar tags */
|
||||
#ifdef IPTC_SUPPORT
|
||||
#ifdef PHOTOSHOP_SUPPORT
|
||||
{ TIFFTAG_RICHTIFFIPTC, -1,-1, TIFF_LONG, FIELD_RICHTIFFIPTC,
|
||||
FALSE, TRUE, "RichTIFFIPTC" },
|
||||
#else
|
||||
{ TIFFTAG_RICHTIFFIPTC, -1,-3, TIFF_UNDEFINED, FIELD_RICHTIFFIPTC,
|
||||
FALSE, TRUE, "RichTIFFIPTC" },
|
||||
#endif
|
||||
#endif
|
||||
{ TIFFTAG_PHOTOSHOP, -1,-3, TIFF_BYTE, FIELD_PHOTOSHOP,
|
||||
FALSE, TRUE, "Photoshop" },
|
||||
{ TIFFTAG_ICCPROFILE, -1,-3, TIFF_UNDEFINED, FIELD_ICCPROFILE,
|
||||
FALSE, TRUE, "ICC Profile" },
|
||||
{ TIFFTAG_STONITS, 1, 1, TIFF_DOUBLE, FIELD_STONITS,
|
||||
FALSE, FALSE, "StoNits" },
|
||||
};
|
||||
#define N(a) (sizeof (a) / sizeof (a[0]))
|
||||
|
||||
void
|
||||
_TIFFSetupFieldInfo(TIFF* tif)
|
||||
{
|
||||
if (tif->tif_fieldinfo) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < tif->tif_nfields; i++)
|
||||
{
|
||||
TIFFFieldInfo *fld = tif->tif_fieldinfo[i];
|
||||
if (fld->field_bit == FIELD_CUSTOM &&
|
||||
strncmp("Tag ", fld->field_name, 4) == 0)
|
||||
{
|
||||
_TIFFfree(fld->field_name);
|
||||
_TIFFfree(fld);
|
||||
}
|
||||
}
|
||||
|
||||
_TIFFfree(tif->tif_fieldinfo);
|
||||
tif->tif_nfields = 0;
|
||||
}
|
||||
_TIFFMergeFieldInfo(tif, tiffFieldInfo, N(tiffFieldInfo));
|
||||
}
|
||||
|
||||
static int
|
||||
tagCompare(const void* a, const void* b)
|
||||
{
|
||||
const TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a;
|
||||
const TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b;
|
||||
/* NB: be careful of return values for 16-bit platforms */
|
||||
if (ta->field_tag != tb->field_tag)
|
||||
return (ta->field_tag < tb->field_tag ? -1 : 1);
|
||||
else
|
||||
return ((int)tb->field_type - (int)ta->field_type);
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], int n)
|
||||
{
|
||||
TIFFFieldInfo** tp;
|
||||
int i;
|
||||
|
||||
if (tif->tif_nfields > 0) {
|
||||
tif->tif_fieldinfo = (TIFFFieldInfo**)
|
||||
_TIFFrealloc(tif->tif_fieldinfo,
|
||||
(tif->tif_nfields+n) * sizeof (TIFFFieldInfo*));
|
||||
} else {
|
||||
tif->tif_fieldinfo = (TIFFFieldInfo**)
|
||||
_TIFFmalloc(n * sizeof (TIFFFieldInfo*));
|
||||
}
|
||||
assert(tif->tif_fieldinfo != NULL);
|
||||
tp = &tif->tif_fieldinfo[tif->tif_nfields];
|
||||
for (i = 0; i < n; i++)
|
||||
tp[i] = (TIFFFieldInfo*) &info[i]; /* XXX */
|
||||
|
||||
/* Sort the field info by tag number */
|
||||
qsort(tif->tif_fieldinfo, (size_t) (tif->tif_nfields += n),
|
||||
sizeof (TIFFFieldInfo*), tagCompare);
|
||||
}
|
||||
|
||||
void
|
||||
_TIFFPrintFieldInfo(TIFF* tif, FILE* fd)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf(fd, "%s: \n", tif->tif_name);
|
||||
for (i = 0; i < tif->tif_nfields; i++) {
|
||||
const TIFFFieldInfo* fip = tif->tif_fieldinfo[i];
|
||||
fprintf(fd, "field[%2d] %5lu, %2d, %2d, %d, %2d, %5s, %5s, %s\n"
|
||||
, i
|
||||
, (unsigned long) fip->field_tag
|
||||
, fip->field_readcount, fip->field_writecount
|
||||
, fip->field_type
|
||||
, fip->field_bit
|
||||
, fip->field_oktochange ? "TRUE" : "FALSE"
|
||||
, fip->field_passcount ? "TRUE" : "FALSE"
|
||||
, fip->field_name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return size of TIFFDataType in bytes
|
||||
*/
|
||||
int
|
||||
TIFFDataWidth(TIFFDataType type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case 0: /* nothing */
|
||||
case 1: /* TIFF_BYTE */
|
||||
case 2: /* TIFF_ASCII */
|
||||
case 6: /* TIFF_SBYTE */
|
||||
case 7: /* TIFF_UNDEFINED */
|
||||
return 1;
|
||||
case 3: /* TIFF_SHORT */
|
||||
case 8: /* TIFF_SSHORT */
|
||||
return 2;
|
||||
case 4: /* TIFF_LONG */
|
||||
case 9: /* TIFF_SLONG */
|
||||
case 11: /* TIFF_FLOAT */
|
||||
case 13: /* TIFF_IFD */
|
||||
return 4;
|
||||
case 5: /* TIFF_RATIONAL */
|
||||
case 10: /* TIFF_SRATIONAL */
|
||||
case 12: /* TIFF_DOUBLE */
|
||||
return 8;
|
||||
default:
|
||||
return 0; /* will return 0 for unknown types */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return nearest TIFFDataType to the sample type of an image.
|
||||
*/
|
||||
TIFFDataType
|
||||
_TIFFSampleToTagType(TIFF* tif)
|
||||
{
|
||||
uint32 bps = TIFFhowmany8(tif->tif_dir.td_bitspersample);
|
||||
|
||||
switch (tif->tif_dir.td_sampleformat) {
|
||||
case SAMPLEFORMAT_IEEEFP:
|
||||
return (bps == 4 ? TIFF_FLOAT : TIFF_DOUBLE);
|
||||
case SAMPLEFORMAT_INT:
|
||||
return (bps <= 1 ? TIFF_SBYTE :
|
||||
bps <= 2 ? TIFF_SSHORT : TIFF_SLONG);
|
||||
case SAMPLEFORMAT_UINT:
|
||||
return (bps <= 1 ? TIFF_BYTE :
|
||||
bps <= 2 ? TIFF_SHORT : TIFF_LONG);
|
||||
case SAMPLEFORMAT_VOID:
|
||||
return (TIFF_UNDEFINED);
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
return (TIFF_UNDEFINED);
|
||||
}
|
||||
|
||||
const TIFFFieldInfo*
|
||||
_TIFFFindFieldInfo(TIFF* tif, ttag_t tag, TIFFDataType dt)
|
||||
{
|
||||
static const TIFFFieldInfo *last = NULL;
|
||||
int i, n;
|
||||
|
||||
if (last && last->field_tag == tag &&
|
||||
(dt == TIFF_ANY || dt == last->field_type))
|
||||
return (last);
|
||||
/* NB: if table gets big, use sorted search (e.g. binary search) */
|
||||
if(dt != TIFF_ANY) {
|
||||
TIFFFieldInfo key = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
key.field_tag = tag;
|
||||
key.field_type = dt;
|
||||
return((const TIFFFieldInfo *) bsearch(&key,
|
||||
tif->tif_fieldinfo,
|
||||
tif->tif_nfields,
|
||||
sizeof(TIFFFieldInfo),
|
||||
tagCompare));
|
||||
} else for (i = 0, n = tif->tif_nfields; i < n; i++) {
|
||||
const TIFFFieldInfo* fip = tif->tif_fieldinfo[i];
|
||||
if (fip->field_tag == tag &&
|
||||
(dt == TIFF_ANY || fip->field_type == dt))
|
||||
return (last = fip);
|
||||
}
|
||||
return ((const TIFFFieldInfo *)0);
|
||||
}
|
||||
|
||||
const TIFFFieldInfo*
|
||||
_TIFFFieldWithTag(TIFF* tif, ttag_t tag)
|
||||
{
|
||||
const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
|
||||
if (!fip) {
|
||||
TIFFError("TIFFFieldWithTag",
|
||||
"Internal error, unknown tag 0x%x", (u_int) tag);
|
||||
assert(fip != NULL);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
return (fip);
|
||||
}
|
||||
|
||||
const TIFFFieldInfo*
|
||||
_TIFFFindOrRegisterFieldInfo( TIFF *tif, ttag_t tag, TIFFDataType dt )
|
||||
|
||||
{
|
||||
const TIFFFieldInfo *fld;
|
||||
|
||||
fld = _TIFFFindFieldInfo( tif, tag, dt );
|
||||
if( fld == NULL )
|
||||
{
|
||||
fld = _TIFFCreateAnonFieldInfo( tif, tag, dt );
|
||||
_TIFFMergeFieldInfo( tif, fld, 1 );
|
||||
}
|
||||
|
||||
return fld;
|
||||
}
|
||||
|
||||
TIFFFieldInfo*
|
||||
_TIFFCreateAnonFieldInfo(TIFF *tif, ttag_t tag, TIFFDataType field_type)
|
||||
{
|
||||
TIFFFieldInfo *fld;
|
||||
|
||||
fld = (TIFFFieldInfo *) _TIFFmalloc(sizeof (TIFFFieldInfo));
|
||||
if (fld == NULL)
|
||||
return NULL;
|
||||
_TIFFmemset( fld, 0, sizeof(TIFFFieldInfo) );
|
||||
|
||||
fld->field_tag = tag;
|
||||
fld->field_readcount = TIFF_VARIABLE;
|
||||
fld->field_writecount = TIFF_VARIABLE;
|
||||
fld->field_type = field_type;
|
||||
fld->field_bit = FIELD_CUSTOM;
|
||||
fld->field_oktochange = TRUE;
|
||||
fld->field_passcount = TRUE;
|
||||
fld->field_name = (char *) _TIFFmalloc(32);
|
||||
if (fld->field_name == NULL) {
|
||||
_TIFFfree(fld);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* note that this name is a special sign to TIFFClose() and
|
||||
* _TIFFSetupFieldInfo() to free the field
|
||||
*/
|
||||
sprintf(fld->field_name, "Tag %d", (int) tag);
|
||||
|
||||
return fld;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,118 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library.
|
||||
*
|
||||
* "Null" Compression Algorithm Support.
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
#include <assert.h>
|
||||
|
||||
/*
|
||||
* Encode a hunk of pixels.
|
||||
*/
|
||||
static int
|
||||
DumpModeEncode(TIFF* tif, tidata_t pp, tsize_t cc, tsample_t s)
|
||||
{
|
||||
(void) s;
|
||||
while (cc > 0) {
|
||||
tsize_t n;
|
||||
|
||||
n = cc;
|
||||
if (tif->tif_rawcc + n > tif->tif_rawdatasize)
|
||||
n = tif->tif_rawdatasize - tif->tif_rawcc;
|
||||
|
||||
assert( n > 0 );
|
||||
|
||||
/*
|
||||
* Avoid copy if client has setup raw
|
||||
* data buffer to avoid extra copy.
|
||||
*/
|
||||
if (tif->tif_rawcp != pp)
|
||||
_TIFFmemcpy(tif->tif_rawcp, pp, n);
|
||||
tif->tif_rawcp += n;
|
||||
tif->tif_rawcc += n;
|
||||
pp += n;
|
||||
cc -= n;
|
||||
if (tif->tif_rawcc >= tif->tif_rawdatasize &&
|
||||
!TIFFFlushData1(tif))
|
||||
return (-1);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode a hunk of pixels.
|
||||
*/
|
||||
static int
|
||||
DumpModeDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
|
||||
{
|
||||
(void) s;
|
||||
if (tif->tif_rawcc < cc) {
|
||||
TIFFError(tif->tif_name,
|
||||
"DumpModeDecode: Not enough data for scanline %d",
|
||||
tif->tif_row);
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Avoid copy if client has setup raw
|
||||
* data buffer to avoid extra copy.
|
||||
*/
|
||||
if (tif->tif_rawcp != buf)
|
||||
_TIFFmemcpy(buf, tif->tif_rawcp, cc);
|
||||
tif->tif_rawcp += cc;
|
||||
tif->tif_rawcc -= cc;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Seek forwards nrows in the current strip.
|
||||
*/
|
||||
static int
|
||||
DumpModeSeek(TIFF* tif, uint32 nrows)
|
||||
{
|
||||
tif->tif_rawcp += nrows * tif->tif_scanlinesize;
|
||||
tif->tif_rawcc -= nrows * tif->tif_scanlinesize;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize dump mode.
|
||||
*/
|
||||
int
|
||||
TIFFInitDumpMode(TIFF* tif, int scheme)
|
||||
{
|
||||
(void) scheme;
|
||||
tif->tif_decoderow = DumpModeDecode;
|
||||
tif->tif_decodestrip = DumpModeDecode;
|
||||
tif->tif_decodetile = DumpModeDecode;
|
||||
tif->tif_encoderow = DumpModeEncode;
|
||||
tif->tif_encodestrip = DumpModeEncode;
|
||||
tif->tif_encodetile = DumpModeEncode;
|
||||
tif->tif_seek = DumpModeSeek;
|
||||
return (1);
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library.
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
|
||||
TIFFErrorHandler
|
||||
TIFFSetErrorHandler(TIFFErrorHandler handler)
|
||||
{
|
||||
TIFFErrorHandler prev = _TIFFerrorHandler;
|
||||
_TIFFerrorHandler = handler;
|
||||
return (prev);
|
||||
}
|
||||
|
||||
void
|
||||
TIFFError(const char* module, const char* fmt, ...)
|
||||
{
|
||||
if (_TIFFerrorHandler) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
(*_TIFFerrorHandler)(module, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
@@ -1,112 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library.
|
||||
*
|
||||
* Various routines support external extension of the tag set, and other
|
||||
* application extension capabilities.
|
||||
*/
|
||||
|
||||
#include "tiffiop.h"
|
||||
#include <assert.h>
|
||||
|
||||
int TIFFGetTagListCount( TIFF *tif )
|
||||
|
||||
{
|
||||
TIFFDirectory* td = &tif->tif_dir;
|
||||
|
||||
return td->td_customValueCount;
|
||||
}
|
||||
|
||||
ttag_t TIFFGetTagListEntry( TIFF *tif, int tag_index )
|
||||
|
||||
{
|
||||
TIFFDirectory* td = &tif->tif_dir;
|
||||
|
||||
if( tag_index < 0 || tag_index >= td->td_customValueCount )
|
||||
return (ttag_t) -1;
|
||||
else
|
||||
return td->td_customValues[tag_index].info->field_tag;
|
||||
}
|
||||
|
||||
/*
|
||||
** This provides read/write access to the TIFFTagMethods within the TIFF
|
||||
** structure to application code without giving access to the private
|
||||
** TIFF structure.
|
||||
*/
|
||||
TIFFTagMethods *TIFFAccessTagMethods( TIFF *tif )
|
||||
|
||||
{
|
||||
return &(tif->tif_tagmethods);
|
||||
}
|
||||
|
||||
void *TIFFGetClientInfo( TIFF *tif, const char *name )
|
||||
|
||||
{
|
||||
TIFFClientInfoLink *link = tif->tif_clientinfo;
|
||||
|
||||
while( link != NULL && strcmp(link->name,name) != 0 )
|
||||
link = link->next;
|
||||
|
||||
if( link != NULL )
|
||||
return link->data;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void TIFFSetClientInfo( TIFF *tif, void *data, const char *name )
|
||||
|
||||
{
|
||||
TIFFClientInfoLink *link = tif->tif_clientinfo;
|
||||
|
||||
/*
|
||||
** Do we have an existing link with this name? If so, just
|
||||
** set it.
|
||||
*/
|
||||
while( link != NULL && strcmp(link->name,name) != 0 )
|
||||
link = link->next;
|
||||
|
||||
if( link != NULL )
|
||||
{
|
||||
link->data = data;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Create a new link.
|
||||
*/
|
||||
|
||||
link = (TIFFClientInfoLink *) _TIFFmalloc(sizeof(TIFFClientInfoLink));
|
||||
assert (link != NULL);
|
||||
link->next = tif->tif_clientinfo;
|
||||
link->name = (char *) _TIFFmalloc(strlen(name)+1);
|
||||
assert (link->name != NULL);
|
||||
strcpy(link->name, name);
|
||||
link->data = data;
|
||||
|
||||
tif->tif_clientinfo = link;
|
||||
}
|
1527
src/tiff/tif_fax3.c
1527
src/tiff/tif_fax3.c
File diff suppressed because it is too large
Load Diff
@@ -1,525 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _FAX3_
|
||||
#define _FAX3_
|
||||
/*
|
||||
* TIFF Library.
|
||||
*
|
||||
* CCITT Group 3 (T.4) and Group 4 (T.6) Decompression Support.
|
||||
*
|
||||
* Decoder support is derived, with permission, from the code
|
||||
* in Frank Cringle's viewfax program;
|
||||
* Copyright (C) 1990, 1995 Frank D. Cringle.
|
||||
*/
|
||||
#include "tiff.h"
|
||||
|
||||
/*
|
||||
* To override the default routine used to image decoded
|
||||
* spans one can use the pseduo tag TIFFTAG_FAXFILLFUNC.
|
||||
* The routine must have the type signature given below;
|
||||
* for example:
|
||||
*
|
||||
* fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
|
||||
*
|
||||
* where buf is place to set the bits, runs is the array of b&w run
|
||||
* lengths (white then black), erun is the last run in the array, and
|
||||
* lastx is the width of the row in pixels. Fill routines can assume
|
||||
* the run array has room for at least lastx runs and can overwrite
|
||||
* data in the run array as needed (e.g. to append zero runs to bring
|
||||
* the count up to a nice multiple).
|
||||
*/
|
||||
typedef void (*TIFFFaxFillFunc)(unsigned char*, uint32*, uint32*, uint32);
|
||||
|
||||
/*
|
||||
* The default run filler; made external for other decoders.
|
||||
*/
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32);
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* finite state machine codes */
|
||||
#define S_Null 0
|
||||
#define S_Pass 1
|
||||
#define S_Horiz 2
|
||||
#define S_V0 3
|
||||
#define S_VR 4
|
||||
#define S_VL 5
|
||||
#define S_Ext 6
|
||||
#define S_TermW 7
|
||||
#define S_TermB 8
|
||||
#define S_MakeUpW 9
|
||||
#define S_MakeUpB 10
|
||||
#define S_MakeUp 11
|
||||
#define S_EOL 12
|
||||
|
||||
typedef struct { /* state table entry */
|
||||
unsigned char State; /* see above */
|
||||
unsigned char Width; /* width of code in bits */
|
||||
uint32 Param; /* unsigned 32-bit run length in bits */
|
||||
} TIFFFaxTabEnt;
|
||||
|
||||
extern const TIFFFaxTabEnt TIFFFaxMainTable[];
|
||||
extern const TIFFFaxTabEnt TIFFFaxWhiteTable[];
|
||||
extern const TIFFFaxTabEnt TIFFFaxBlackTable[];
|
||||
|
||||
/*
|
||||
* The following macros define the majority of the G3/G4 decoder
|
||||
* algorithm using the state tables defined elsewhere. To build
|
||||
* a decoder you need some setup code and some glue code. Note
|
||||
* that you may also need/want to change the way the NeedBits*
|
||||
* macros get input data if, for example, you know the data to be
|
||||
* decoded is properly aligned and oriented (doing so before running
|
||||
* the decoder can be a big performance win).
|
||||
*
|
||||
* Consult the decoder in the TIFF library for an idea of what you
|
||||
* need to define and setup to make use of these definitions.
|
||||
*
|
||||
* NB: to enable a debugging version of these macros define FAX3_DEBUG
|
||||
* before including this file. Trace output goes to stdout.
|
||||
*/
|
||||
|
||||
#ifndef EndOfData
|
||||
#define EndOfData() (cp >= ep)
|
||||
#endif
|
||||
/*
|
||||
* Need <=8 or <=16 bits of input data. Unlike viewfax we
|
||||
* cannot use/assume a word-aligned, properly bit swizzled
|
||||
* input data set because data may come from an arbitrarily
|
||||
* aligned, read-only source such as a memory-mapped file.
|
||||
* Note also that the viewfax decoder does not check for
|
||||
* running off the end of the input data buffer. This is
|
||||
* possible for G3-encoded data because it prescans the input
|
||||
* data to count EOL markers, but can cause problems for G4
|
||||
* data. In any event, we don't prescan and must watch for
|
||||
* running out of data since we can't permit the library to
|
||||
* scan past the end of the input data buffer.
|
||||
*
|
||||
* Finally, note that we must handle remaindered data at the end
|
||||
* of a strip specially. The coder asks for a fixed number of
|
||||
* bits when scanning for the next code. This may be more bits
|
||||
* than are actually present in the data stream. If we appear
|
||||
* to run out of data but still have some number of valid bits
|
||||
* remaining then we makeup the requested amount with zeros and
|
||||
* return successfully. If the returned data is incorrect then
|
||||
* we should be called again and get a premature EOF error;
|
||||
* otherwise we should get the right answer.
|
||||
*/
|
||||
#ifndef NeedBits8
|
||||
#define NeedBits8(n,eoflab) do { \
|
||||
if (BitsAvail < (n)) { \
|
||||
if (EndOfData()) { \
|
||||
if (BitsAvail == 0) /* no valid bits */ \
|
||||
goto eoflab; \
|
||||
BitsAvail = (n); /* pad with zeros */ \
|
||||
} else { \
|
||||
BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail; \
|
||||
BitsAvail += 8; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
#ifndef NeedBits16
|
||||
#define NeedBits16(n,eoflab) do { \
|
||||
if (BitsAvail < (n)) { \
|
||||
if (EndOfData()) { \
|
||||
if (BitsAvail == 0) /* no valid bits */ \
|
||||
goto eoflab; \
|
||||
BitsAvail = (n); /* pad with zeros */ \
|
||||
} else { \
|
||||
BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail; \
|
||||
if ((BitsAvail += 8) < (n)) { \
|
||||
if (EndOfData()) { \
|
||||
/* NB: we know BitsAvail is non-zero here */ \
|
||||
BitsAvail = (n); /* pad with zeros */ \
|
||||
} else { \
|
||||
BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail; \
|
||||
BitsAvail += 8; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
#define GetBits(n) (BitAcc & ((1<<(n))-1))
|
||||
#define ClrBits(n) do { \
|
||||
BitsAvail -= (n); \
|
||||
BitAcc >>= (n); \
|
||||
} while (0)
|
||||
|
||||
#ifdef FAX3_DEBUG
|
||||
static const char* StateNames[] = {
|
||||
"Null ",
|
||||
"Pass ",
|
||||
"Horiz ",
|
||||
"V0 ",
|
||||
"VR ",
|
||||
"VL ",
|
||||
"Ext ",
|
||||
"TermW ",
|
||||
"TermB ",
|
||||
"MakeUpW",
|
||||
"MakeUpB",
|
||||
"MakeUp ",
|
||||
"EOL ",
|
||||
};
|
||||
#define DEBUG_SHOW putchar(BitAcc & (1 << t) ? '1' : '0')
|
||||
#define LOOKUP8(wid,tab,eoflab) do { \
|
||||
int t; \
|
||||
NeedBits8(wid,eoflab); \
|
||||
TabEnt = tab + GetBits(wid); \
|
||||
printf("%08lX/%d: %s%5d\t", (long) BitAcc, BitsAvail, \
|
||||
StateNames[TabEnt->State], TabEnt->Param); \
|
||||
for (t = 0; t < TabEnt->Width; t++) \
|
||||
DEBUG_SHOW; \
|
||||
putchar('\n'); \
|
||||
fflush(stdout); \
|
||||
ClrBits(TabEnt->Width); \
|
||||
} while (0)
|
||||
#define LOOKUP16(wid,tab,eoflab) do { \
|
||||
int t; \
|
||||
NeedBits16(wid,eoflab); \
|
||||
TabEnt = tab + GetBits(wid); \
|
||||
printf("%08lX/%d: %s%5d\t", (long) BitAcc, BitsAvail, \
|
||||
StateNames[TabEnt->State], TabEnt->Param); \
|
||||
for (t = 0; t < TabEnt->Width; t++) \
|
||||
DEBUG_SHOW; \
|
||||
putchar('\n'); \
|
||||
fflush(stdout); \
|
||||
ClrBits(TabEnt->Width); \
|
||||
} while (0)
|
||||
|
||||
#define SETVAL(x) do { \
|
||||
*pa++ = RunLength + (x); \
|
||||
printf("SETVAL: %d\t%d\n", RunLength + (x), a0); \
|
||||
a0 += x; \
|
||||
RunLength = 0; \
|
||||
} while (0)
|
||||
#else
|
||||
#define LOOKUP8(wid,tab,eoflab) do { \
|
||||
NeedBits8(wid,eoflab); \
|
||||
TabEnt = tab + GetBits(wid); \
|
||||
ClrBits(TabEnt->Width); \
|
||||
} while (0)
|
||||
#define LOOKUP16(wid,tab,eoflab) do { \
|
||||
NeedBits16(wid,eoflab); \
|
||||
TabEnt = tab + GetBits(wid); \
|
||||
ClrBits(TabEnt->Width); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Append a run to the run length array for the
|
||||
* current row and reset decoding state.
|
||||
*/
|
||||
#define SETVAL(x) do { \
|
||||
*pa++ = RunLength + (x); \
|
||||
a0 += (x); \
|
||||
RunLength = 0; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Synchronize input decoding at the start of each
|
||||
* row by scanning for an EOL (if appropriate) and
|
||||
* skipping any trash data that might be present
|
||||
* after a decoding error. Note that the decoding
|
||||
* done elsewhere that recognizes an EOL only consumes
|
||||
* 11 consecutive zero bits. This means that if EOLcnt
|
||||
* is non-zero then we still need to scan for the final flag
|
||||
* bit that is part of the EOL code.
|
||||
*/
|
||||
#define SYNC_EOL(eoflab) do { \
|
||||
if (EOLcnt == 0) { \
|
||||
for (;;) { \
|
||||
NeedBits16(11,eoflab); \
|
||||
if (GetBits(11) == 0) \
|
||||
break; \
|
||||
ClrBits(1); \
|
||||
} \
|
||||
} \
|
||||
for (;;) { \
|
||||
NeedBits8(8,eoflab); \
|
||||
if (GetBits(8)) \
|
||||
break; \
|
||||
ClrBits(8); \
|
||||
} \
|
||||
while (GetBits(1) == 0) \
|
||||
ClrBits(1); \
|
||||
ClrBits(1); /* EOL bit */ \
|
||||
EOLcnt = 0; /* reset EOL counter/flag */ \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Cleanup the array of runs after decoding a row.
|
||||
* We adjust final runs to insure the user buffer is not
|
||||
* overwritten and/or undecoded area is white filled.
|
||||
*/
|
||||
#define CLEANUP_RUNS() do { \
|
||||
if (RunLength) \
|
||||
SETVAL(0); \
|
||||
if (a0 != lastx) { \
|
||||
badlength(a0, lastx); \
|
||||
while (a0 > lastx && pa > thisrun) \
|
||||
a0 -= *--pa; \
|
||||
if (a0 < lastx) { \
|
||||
if (a0 < 0) \
|
||||
a0 = 0; \
|
||||
if ((pa-thisrun)&1) \
|
||||
SETVAL(0); \
|
||||
SETVAL(lastx - a0); \
|
||||
} else if (a0 > lastx) { \
|
||||
SETVAL(lastx); \
|
||||
SETVAL(0); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Decode a line of 1D-encoded data.
|
||||
*
|
||||
* The line expanders are written as macros so that they can be reused
|
||||
* but still have direct access to the local variables of the "calling"
|
||||
* function.
|
||||
*
|
||||
* Note that unlike the original version we have to explicitly test for
|
||||
* a0 >= lastx after each black/white run is decoded. This is because
|
||||
* the original code depended on the input data being zero-padded to
|
||||
* insure the decoder recognized an EOL before running out of data.
|
||||
*/
|
||||
#define EXPAND1D(eoflab) do { \
|
||||
for (;;) { \
|
||||
for (;;) { \
|
||||
LOOKUP16(12, TIFFFaxWhiteTable, eof1d); \
|
||||
switch (TabEnt->State) { \
|
||||
case S_EOL: \
|
||||
EOLcnt = 1; \
|
||||
goto done1d; \
|
||||
case S_TermW: \
|
||||
SETVAL(TabEnt->Param); \
|
||||
goto doneWhite1d; \
|
||||
case S_MakeUpW: \
|
||||
case S_MakeUp: \
|
||||
a0 += TabEnt->Param; \
|
||||
RunLength += TabEnt->Param; \
|
||||
break; \
|
||||
default: \
|
||||
unexpected("WhiteTable", a0); \
|
||||
goto done1d; \
|
||||
} \
|
||||
} \
|
||||
doneWhite1d: \
|
||||
if (a0 >= lastx) \
|
||||
goto done1d; \
|
||||
for (;;) { \
|
||||
LOOKUP16(13, TIFFFaxBlackTable, eof1d); \
|
||||
switch (TabEnt->State) { \
|
||||
case S_EOL: \
|
||||
EOLcnt = 1; \
|
||||
goto done1d; \
|
||||
case S_TermB: \
|
||||
SETVAL(TabEnt->Param); \
|
||||
goto doneBlack1d; \
|
||||
case S_MakeUpB: \
|
||||
case S_MakeUp: \
|
||||
a0 += TabEnt->Param; \
|
||||
RunLength += TabEnt->Param; \
|
||||
break; \
|
||||
default: \
|
||||
unexpected("BlackTable", a0); \
|
||||
goto done1d; \
|
||||
} \
|
||||
} \
|
||||
doneBlack1d: \
|
||||
if (a0 >= lastx) \
|
||||
goto done1d; \
|
||||
if( *(pa-1) == 0 && *(pa-2) == 0 ) \
|
||||
pa -= 2; \
|
||||
} \
|
||||
eof1d: \
|
||||
prematureEOF(a0); \
|
||||
CLEANUP_RUNS(); \
|
||||
goto eoflab; \
|
||||
done1d: \
|
||||
CLEANUP_RUNS(); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Update the value of b1 using the array
|
||||
* of runs for the reference line.
|
||||
*/
|
||||
#define CHECK_b1 do { \
|
||||
if (pa != thisrun) while (b1 <= a0 && b1 < lastx) { \
|
||||
b1 += pb[0] + pb[1]; \
|
||||
pb += 2; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Expand a row of 2D-encoded data.
|
||||
*/
|
||||
#define EXPAND2D(eoflab) do { \
|
||||
while (a0 < lastx) { \
|
||||
LOOKUP8(7, TIFFFaxMainTable, eof2d); \
|
||||
switch (TabEnt->State) { \
|
||||
case S_Pass: \
|
||||
CHECK_b1; \
|
||||
b1 += *pb++; \
|
||||
RunLength += b1 - a0; \
|
||||
a0 = b1; \
|
||||
b1 += *pb++; \
|
||||
break; \
|
||||
case S_Horiz: \
|
||||
if ((pa-thisrun)&1) { \
|
||||
for (;;) { /* black first */ \
|
||||
LOOKUP16(13, TIFFFaxBlackTable, eof2d); \
|
||||
switch (TabEnt->State) { \
|
||||
case S_TermB: \
|
||||
SETVAL(TabEnt->Param); \
|
||||
goto doneWhite2da; \
|
||||
case S_MakeUpB: \
|
||||
case S_MakeUp: \
|
||||
a0 += TabEnt->Param; \
|
||||
RunLength += TabEnt->Param; \
|
||||
break; \
|
||||
default: \
|
||||
goto badBlack2d; \
|
||||
} \
|
||||
} \
|
||||
doneWhite2da:; \
|
||||
for (;;) { /* then white */ \
|
||||
LOOKUP16(12, TIFFFaxWhiteTable, eof2d); \
|
||||
switch (TabEnt->State) { \
|
||||
case S_TermW: \
|
||||
SETVAL(TabEnt->Param); \
|
||||
goto doneBlack2da; \
|
||||
case S_MakeUpW: \
|
||||
case S_MakeUp: \
|
||||
a0 += TabEnt->Param; \
|
||||
RunLength += TabEnt->Param; \
|
||||
break; \
|
||||
default: \
|
||||
goto badWhite2d; \
|
||||
} \
|
||||
} \
|
||||
doneBlack2da:; \
|
||||
} else { \
|
||||
for (;;) { /* white first */ \
|
||||
LOOKUP16(12, TIFFFaxWhiteTable, eof2d); \
|
||||
switch (TabEnt->State) { \
|
||||
case S_TermW: \
|
||||
SETVAL(TabEnt->Param); \
|
||||
goto doneWhite2db; \
|
||||
case S_MakeUpW: \
|
||||
case S_MakeUp: \
|
||||
a0 += TabEnt->Param; \
|
||||
RunLength += TabEnt->Param; \
|
||||
break; \
|
||||
default: \
|
||||
goto badWhite2d; \
|
||||
} \
|
||||
} \
|
||||
doneWhite2db:; \
|
||||
for (;;) { /* then black */ \
|
||||
LOOKUP16(13, TIFFFaxBlackTable, eof2d); \
|
||||
switch (TabEnt->State) { \
|
||||
case S_TermB: \
|
||||
SETVAL(TabEnt->Param); \
|
||||
goto doneBlack2db; \
|
||||
case S_MakeUpB: \
|
||||
case S_MakeUp: \
|
||||
a0 += TabEnt->Param; \
|
||||
RunLength += TabEnt->Param; \
|
||||
break; \
|
||||
default: \
|
||||
goto badBlack2d; \
|
||||
} \
|
||||
} \
|
||||
doneBlack2db:; \
|
||||
} \
|
||||
CHECK_b1; \
|
||||
break; \
|
||||
case S_V0: \
|
||||
CHECK_b1; \
|
||||
SETVAL(b1 - a0); \
|
||||
b1 += *pb++; \
|
||||
break; \
|
||||
case S_VR: \
|
||||
CHECK_b1; \
|
||||
SETVAL(b1 - a0 + TabEnt->Param); \
|
||||
b1 += *pb++; \
|
||||
break; \
|
||||
case S_VL: \
|
||||
CHECK_b1; \
|
||||
SETVAL(b1 - a0 - TabEnt->Param); \
|
||||
b1 -= *--pb; \
|
||||
break; \
|
||||
case S_Ext: \
|
||||
*pa++ = lastx - a0; \
|
||||
extension(a0); \
|
||||
goto eol2d; \
|
||||
case S_EOL: \
|
||||
*pa++ = lastx - a0; \
|
||||
NeedBits8(4,eof2d); \
|
||||
if (GetBits(4)) \
|
||||
unexpected("EOL", a0); \
|
||||
ClrBits(4); \
|
||||
EOLcnt = 1; \
|
||||
goto eol2d; \
|
||||
default: \
|
||||
badMain2d: \
|
||||
unexpected("MainTable", a0); \
|
||||
goto eol2d; \
|
||||
badBlack2d: \
|
||||
unexpected("BlackTable", a0); \
|
||||
goto eol2d; \
|
||||
badWhite2d: \
|
||||
unexpected("WhiteTable", a0); \
|
||||
goto eol2d; \
|
||||
eof2d: \
|
||||
prematureEOF(a0); \
|
||||
CLEANUP_RUNS(); \
|
||||
goto eoflab; \
|
||||
} \
|
||||
} \
|
||||
if (RunLength) { \
|
||||
if (RunLength + a0 < lastx) { \
|
||||
/* expect a final V0 */ \
|
||||
NeedBits8(1,eof2d); \
|
||||
if (!GetBits(1)) \
|
||||
goto badMain2d; \
|
||||
ClrBits(1); \
|
||||
} \
|
||||
SETVAL(0); \
|
||||
} \
|
||||
eol2d: \
|
||||
CLEANUP_RUNS(); \
|
||||
} while (0)
|
||||
#endif /* _FAX3_ */
|
File diff suppressed because it is too large
Load Diff
@@ -1,67 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TIFF Library.
|
||||
*/
|
||||
#include "tiffiop.h"
|
||||
|
||||
int
|
||||
TIFFFlush(TIFF* tif)
|
||||
{
|
||||
|
||||
if (tif->tif_mode != O_RDONLY) {
|
||||
if (!TIFFFlushData(tif))
|
||||
return (0);
|
||||
if ((tif->tif_flags & TIFF_DIRTYDIRECT) &&
|
||||
!TIFFWriteDirectory(tif))
|
||||
return (0);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Flush buffered data to the file.
|
||||
*
|
||||
* Frank Warmerdam'2000: I modified this to return 1 if TIFF_BEENWRITING
|
||||
* is not set, so that TIFFFlush() will proceed to write out the directory.
|
||||
* The documentation says returning 1 is an error indicator, but not having
|
||||
* been writing isn't exactly a an error. Hopefully this doesn't cause
|
||||
* problems for other people.
|
||||
*/
|
||||
int
|
||||
TIFFFlushData(TIFF* tif)
|
||||
{
|
||||
if ((tif->tif_flags & TIFF_BEENWRITING) == 0)
|
||||
return (0);
|
||||
if (tif->tif_flags & TIFF_POSTENCODE) {
|
||||
tif->tif_flags &= ~TIFF_POSTENCODE;
|
||||
if (!(*tif->tif_postencode)(tif))
|
||||
return (0);
|
||||
}
|
||||
return (TIFFFlushData1(tif));
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
1667
src/tiff/tif_jpeg.c
1667
src/tiff/tif_jpeg.c
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user