merge of wxMac into main repository

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7988 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2000-08-09 10:36:50 +00:00
parent f71c3b49e2
commit 7d610b90ff
8 changed files with 201 additions and 111 deletions

View File

@@ -172,7 +172,26 @@ wxPrintData::wxPrintData()
m_devMode = (void*) NULL;
m_devNames = (void*) NULL;
#elif defined( __WXMAC__ )
m_macPrintInfo = NULL ;
m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
(**m_macPrintInfo).iPrVersion = 0; // something invalid
(**m_macPrintInfo).prInfo.iHRes = 72;
(**m_macPrintInfo).prInfo.iVRes = 72;
Rect r1 = { 0, 0, 8*72 - 2 * 18, 11*72 - 2 * 36 } ;
(**m_macPrintInfo).prInfo.rPage = r1;// must have its top left & (0,0)
Rect r2 = { -18, -36, 8*72 - 18, 11*72 - 36 } ;
(**m_macPrintInfo).rPaper = r2;
(**m_macPrintInfo).prStl.iPageV = 11 * 120 ; // 11 inches in 120th of an inch
(**m_macPrintInfo).prStl.iPageH = 8 * 120 ; // 8 inches in 120th of an inch
/*
UMAPrOpen() ;
m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
::PrintDefault( m_macPrintInfo ) ;
OSErr err = PrError() ;
UMAPrClose() ;
wxASSERT( err == noErr ) ;
*/
#endif
m_printOrientation = wxPORTRAIT;
m_printNoCopies = 1;
@@ -205,7 +224,16 @@ wxPrintData::wxPrintData(const wxPrintData& printData)
m_devMode = (void*) NULL;
m_devNames = (void*) NULL;
#elif defined( __WXMAC__ )
m_macPrintInfo = NULL ;
m_macPrintInfo = NULL ;
/*
(THPrint) NewHandleClear( sizeof( TPrint ) ) ;
UMAPrOpen() ;
m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
::PrintDefault( m_macPrintInfo ) ;
OSErr err = PrError() ;
UMAPrClose() ;
wxASSERT( err == noErr ) ;
*/
#endif
(*this) = printData;
}
@@ -220,8 +248,8 @@ wxPrintData::~wxPrintData()
if ( hDevNames )
GlobalFree(hDevNames);
#elif defined(__WXMAC__)
if ( m_macPrintInfo )
::DisposeHandle( (Handle) m_macPrintInfo ) ;
wxASSERT( m_macPrintInfo ) ;
// ::DisposeHandle( (Handle) m_macPrintInfo ) ;
#endif
}
@@ -681,34 +709,21 @@ void wxPrintData::ConvertFromNative()
#ifdef __WXMAC__
void wxPrintData::ConvertToNative()
{
if ( !m_macPrintInfo )
{
m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
if ( m_macPrintInfo )
{
::PrintDefault( m_macPrintInfo ) ;
// todo setup the global pagesetup ?
}
}
if ( m_macPrintInfo )
{
(**m_macPrintInfo).prJob.iCopies = m_printNoCopies ;
(**m_macPrintInfo).prJob.iFstPage = 0 ;
(**m_macPrintInfo).prJob.iLstPage = 0 ;
}
(**m_macPrintInfo).prJob.iCopies = m_printNoCopies ;
}
void wxPrintData::ConvertFromNative()
{
if ( m_macPrintInfo )
{
m_printNoCopies = (**m_macPrintInfo).prJob.iCopies ;
}
m_printNoCopies = (**m_macPrintInfo).prJob.iCopies ;
}
#endif
void wxPrintData::operator=(const wxPrintData& data)
{
#ifdef __WXMAC__
m_macPrintInfo = data.m_macPrintInfo ;
HandToHand( (Handle*) &m_macPrintInfo ) ;
#endif
m_printNoCopies = data.m_printNoCopies;
m_printCollate = data.m_printCollate;
m_printOrientation = data.m_printOrientation;
@@ -767,8 +782,6 @@ wxPrintDialogData::wxPrintDialogData()
{
#ifdef __WXMSW__
m_printDlgData = NULL;
#elif defined( __WXMAC__ )
m_macPrintInfo = NULL ;
#endif
m_printFromPage = 0;
m_printToPage = 0;
@@ -790,8 +803,6 @@ wxPrintDialogData::wxPrintDialogData(const wxPrintDialogData& dialogData)
{
#ifdef __WXMSW__
m_printDlgData = NULL;
#elif defined( __WXMAC__ )
m_macPrintInfo = NULL ;
#endif
(*this) = dialogData;
}
@@ -800,8 +811,6 @@ wxPrintDialogData::wxPrintDialogData(const wxPrintData& printData)
{
#ifdef __WXMSW__
m_printDlgData = NULL;
#elif defined( __WXMAC__ )
m_macPrintInfo = NULL ;
#endif
m_printFromPage = 0;
m_printToPage = 0;
@@ -829,9 +838,6 @@ wxPrintDialogData::~wxPrintDialogData()
GlobalFree(pd->hDevMode);
if ( pd )
delete pd;
#elif defined(__WXMAC__)
if ( m_macPrintInfo )
::DisposeHandle( (Handle) m_macPrintInfo ) ;
#endif
}
@@ -1013,31 +1019,16 @@ void wxPrintDialogData::SetOwnerWindow(wxWindow* win)
#ifdef __WXMAC__
void wxPrintDialogData::ConvertToNative()
{
if ( !m_macPrintInfo )
{
m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
if ( m_macPrintInfo )
{
::PrintDefault( m_macPrintInfo ) ;
// todo setup the global pagesetup ?
}
}
if ( m_macPrintInfo )
{
(**m_macPrintInfo).prJob.iCopies = m_printNoCopies ;
(**m_macPrintInfo).prJob.iFstPage = m_printFromPage ;
(**m_macPrintInfo).prJob.iLstPage = m_printToPage ;
}
(**m_printData.m_macPrintInfo).prJob.iFstPage = m_printFromPage ;
(**m_printData.m_macPrintInfo).prJob.iLstPage = m_printToPage ;
m_printData.ConvertToNative() ;
}
void wxPrintDialogData::ConvertFromNative()
{
if ( m_macPrintInfo )
{
m_printNoCopies = (**m_macPrintInfo).prJob.iCopies ;
m_printFromPage = (**m_macPrintInfo).prJob.iFstPage ;
m_printToPage = (**m_macPrintInfo).prJob.iLstPage ;
}
m_printData.ConvertFromNative() ;
m_printFromPage = (**m_printData.m_macPrintInfo).prJob.iFstPage ;
m_printToPage = (**m_printData.m_macPrintInfo).prJob.iLstPage ;
}
#endif
@@ -1075,8 +1066,6 @@ wxPageSetupDialogData::wxPageSetupDialogData()
{
#if defined(__WIN95__)
m_pageSetupData = NULL;
#elif defined( __WXMAC__ )
m_macPageSetupInfo = NULL ;
#endif
m_paperSize = wxSize(0, 0);
@@ -1101,8 +1090,6 @@ wxPageSetupDialogData::wxPageSetupDialogData(const wxPageSetupDialogData& dialog
{
#if defined(__WIN95__)
m_pageSetupData = NULL;
#elif defined( __WXMAC__ )
m_macPageSetupInfo = NULL ;
#endif
(*this) = dialogData;
}
@@ -1111,8 +1098,6 @@ wxPageSetupDialogData::wxPageSetupDialogData(const wxPrintData& printData)
{
#if defined(__WIN95__)
m_pageSetupData = NULL;
#elif defined( __WXMAC__ )
m_macPageSetupInfo = NULL ;
#endif
m_paperSize = wxSize(0, 0);
m_minMarginTopLeft = wxPoint(0, 0);
@@ -1146,9 +1131,6 @@ wxPageSetupDialogData::~wxPageSetupDialogData()
GlobalFree(pd->hDevNames);
if ( pd )
delete pd;
#elif defined( __WXMAC__ )
if( m_macPageSetupInfo )
::DisposeHandle( (Handle) m_macPageSetupInfo ) ;
#endif
}
@@ -1353,62 +1335,47 @@ void wxPageSetupDialogData::SetOwnerWindow(wxWindow* win)
#ifdef __WXMAC__
void wxPageSetupDialogData::ConvertToNative()
{
if ( !m_macPageSetupInfo )
{
m_macPageSetupInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
if ( m_macPageSetupInfo )
{
::PrintDefault( m_macPageSetupInfo ) ;
}
}
if ( m_macPageSetupInfo )
{
// on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0
(**m_macPageSetupInfo).rPaper.left = int( ((double) m_minMarginTopLeft.x)*mm2pt ) ;
(**m_macPageSetupInfo).rPaper.top = int( ((double) m_minMarginTopLeft.y)*mm2pt ) ;
m_printData.ConvertToNative() ;
// on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0
(**m_printData.m_macPrintInfo).rPaper.left = int( ((double) m_minMarginTopLeft.x)*mm2pt ) ;
(**m_printData.m_macPrintInfo).rPaper.top = int( ((double) m_minMarginTopLeft.y)*mm2pt ) ;
(**m_macPageSetupInfo).rPaper.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x)*mm2pt ) ;
(**m_macPageSetupInfo).rPaper.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y)*mm2pt ) ;
(**m_macPageSetupInfo).prInfo.rPage.left = 0 ;
(**m_macPageSetupInfo).prInfo.rPage.top = 0 ;
(**m_macPageSetupInfo).prInfo.rPage.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x - m_minMarginBottomRight.x)*mm2pt ) ;
(**m_macPageSetupInfo).prInfo.rPage.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y - m_minMarginBottomRight.y)*mm2pt ) ;
//TODO add custom fields in dialog for margins
}
(**m_printData.m_macPrintInfo).rPaper.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x)*mm2pt ) ;
(**m_printData.m_macPrintInfo).rPaper.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y)*mm2pt ) ;
(**m_printData.m_macPrintInfo).prInfo.rPage.left = 0 ;
(**m_printData.m_macPrintInfo).prInfo.rPage.top = 0 ;
(**m_printData.m_macPrintInfo).prInfo.rPage.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x - m_minMarginBottomRight.x)*mm2pt ) ;
(**m_printData.m_macPrintInfo).prInfo.rPage.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y - m_minMarginBottomRight.y)*mm2pt ) ;
}
void wxPageSetupDialogData::ConvertFromNative()
{
if ( m_macPageSetupInfo )
{
m_paperSize.x = ((double) (**m_macPageSetupInfo).rPaper.right - (**m_macPageSetupInfo).rPaper.left ) * pt2mm ;
m_paperSize.y = ((double) (**m_macPageSetupInfo).rPaper.bottom - (**m_macPageSetupInfo).rPaper.top ) * pt2mm ;
m_printData.ConvertFromNative () ;
m_minMarginTopLeft.x = ((double) -(**m_macPageSetupInfo).rPaper.left ) * pt2mm ;
m_minMarginTopLeft.y = ((double) -(**m_macPageSetupInfo).rPaper.top ) * pt2mm ;
m_paperSize.x = ((double) (**m_printData.m_macPrintInfo).rPaper.right - (**m_printData.m_macPrintInfo).rPaper.left ) * pt2mm ;
m_paperSize.y = ((double) (**m_printData.m_macPrintInfo).rPaper.bottom - (**m_printData.m_macPrintInfo).rPaper.top ) * pt2mm ;
m_minMarginTopLeft.x = ((double) -(**m_printData.m_macPrintInfo).rPaper.left ) * pt2mm ;
m_minMarginTopLeft.y = ((double) -(**m_printData.m_macPrintInfo).rPaper.top ) * pt2mm ;
m_minMarginBottomRight.x = ((double) (**m_macPageSetupInfo).rPaper.right - (**m_macPageSetupInfo).prInfo.rPage.right ) * pt2mm ;
m_minMarginBottomRight.y = ((double)(**m_macPageSetupInfo).rPaper.bottom - (**m_macPageSetupInfo).prInfo.rPage.bottom ) * pt2mm ;
m_minMarginBottomRight.x = ((double) (**m_printData.m_macPrintInfo).rPaper.right - (**m_printData.m_macPrintInfo).prInfo.rPage.right ) * pt2mm ;
m_minMarginBottomRight.y = ((double)(**m_printData.m_macPrintInfo).rPaper.bottom - (**m_printData.m_macPrintInfo).prInfo.rPage.bottom ) * pt2mm ;
// adjust minimal values
//TODO add custom fields in dialog for margins
// adjust minimal values
//TODO add custom fields in dialog for margins
if ( m_marginTopLeft.x < m_minMarginTopLeft.x )
m_marginTopLeft.x = m_minMarginTopLeft.x ;
if ( m_marginTopLeft.x < m_minMarginTopLeft.x )
m_marginTopLeft.x = m_minMarginTopLeft.x ;
if ( m_marginBottomRight.x < m_minMarginBottomRight.x )
m_marginBottomRight.x = m_minMarginBottomRight.x ;
if ( m_marginBottomRight.x < m_minMarginBottomRight.x )
m_marginBottomRight.x = m_minMarginBottomRight.x ;
if ( m_marginTopLeft.y < m_minMarginTopLeft.y )
m_marginTopLeft.y = m_minMarginTopLeft.y ;
if ( m_marginBottomRight.y < m_minMarginBottomRight.y )
m_marginBottomRight.y = m_minMarginBottomRight.y ;
}
if ( m_marginTopLeft.y < m_minMarginTopLeft.y )
m_marginTopLeft.y = m_minMarginTopLeft.y ;
if ( m_marginBottomRight.y < m_minMarginBottomRight.y )
m_marginBottomRight.y = m_minMarginBottomRight.y ;
}
#endif

View File

@@ -22,6 +22,10 @@ int yylex(void);
int yylook(void);
int yywrap(void);
int yyback(int *, int);
#ifdef __WXMAC__
int read( int , char * , int ) ;
int fileno( void* ) ;
#endif
/* You may need to put /DLEX_SCANNER in your makefile
* if you're using LEX!

View File

@@ -333,10 +333,15 @@ int wxGIFDecoder::getcode(int bits, int ab_fin)
//
int wxGIFDecoder::dgif(GIFImage *img, int interl, int bits)
{
#ifdef __WXMAC__
int *ab_prefix = new int[4096]; /* alphabet (prefixes) */
int *ab_tail = new int[4096]; /* alphabet (tails) */
int *stack = new int[4096]; /* decompression stack */
#else
int ab_prefix[4096]; /* alphabet (prefixes) */
int ab_tail[4096]; /* alphabet (tails) */
int stack[4096]; /* decompression stack */
#endif
int ab_clr; /* clear code */
int ab_fin; /* end of info code */
int ab_bits; /* actual symbol width, in bits */
@@ -460,6 +465,11 @@ int wxGIFDecoder::dgif(GIFImage *img, int interl, int bits)
}
while (code != ab_fin);
#ifdef __WXMAC__
delete [] ab_prefix ;
delete [] ab_tail ;
delete [] stack ;
#endif
return 0;
}

View File

@@ -402,6 +402,86 @@ wxLogStderr::wxLogStderr(FILE *fp)
m_fp = fp;
}
#if defined(__WXMAC__)
#define kDebuggerSignature 'MWDB'
static Boolean FindProcessBySignature(OSType signature, ProcessInfoRec* info)
{
OSErr err;
ProcessSerialNumber psn;
Boolean found = false;
psn.highLongOfPSN = 0;
psn.lowLongOfPSN = kNoProcess;
if (!info) return false;
info->processInfoLength = sizeof(ProcessInfoRec);
info->processName = NULL;
info->processAppSpec = NULL;
err = noErr;
while (!found && err == noErr)
{
err = GetNextProcess(&psn);
if (err == noErr)
{
err = GetProcessInformation(&psn, info);
found = err == noErr && info->processSignature == signature;
}
}
return found;
}
pascal Boolean MWDebuggerIsRunning(void)
{
ProcessInfoRec info;
return FindProcessBySignature(kDebuggerSignature, &info);
}
pascal OSErr AmIBeingMWDebugged(Boolean* result)
{
OSErr err;
ProcessSerialNumber psn;
OSType sig = kDebuggerSignature;
AppleEvent theAE = {typeNull, NULL};
AppleEvent theReply = {typeNull, NULL};
AEAddressDesc addr = {typeNull, NULL};
DescType actualType;
Size actualSize;
if (!result) return paramErr;
err = AECreateDesc(typeApplSignature, &sig, sizeof(sig), &addr);
if (err != noErr) goto exit;
err = AECreateAppleEvent('MWDB', 'Dbg?', &addr,
kAutoGenerateReturnID, kAnyTransactionID, &theAE);
if (err != noErr) goto exit;
GetCurrentProcess(&psn);
err = AEPutParamPtr(&theAE, keyDirectObject, typeProcessSerialNumber,
&psn, sizeof(psn));
if (err != noErr) goto exit;
err = AESend(&theAE, &theReply, kAEWaitReply, kAENormalPriority,
kAEDefaultTimeout, NULL, NULL);
if (err != noErr) goto exit;
err = AEGetParamPtr(&theReply, keyAEResult, typeBoolean, &actualType, result,
sizeof(Boolean), &actualSize);
exit:
if (addr.dataHandle)
AEDisposeDesc(&addr);
if (theAE.dataHandle)
AEDisposeDesc(&theAE);
if (theReply.dataHandle)
AEDisposeDesc(&theReply);
return err;
}
#endif
void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
{
wxString str;
@@ -419,7 +499,36 @@ void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
OutputDebugString(str.c_str());
#endif // MSW
#if defined(__WXMAC__) && wxUSE_GUI
debugstr(str + wxT("\r\n"));
Str255 pstr ;
strcpy( (char*) pstr , str.c_str() ) ;
strcat( (char*) pstr , ";g" ) ;
c2pstr( (char*) pstr ) ;
#if __WXDEBUG__
Boolean running = false ;
/*
if ( MWDebuggerIsRunning() )
{
AmIBeingMWDebugged( &running ) ;
}
*/
if (running)
{
#ifdef __powerc
DebugStr(pstr);
#else
SysBreakStr(pstr);
#endif
}
else
#endif
{
#ifdef __powerc
DebugStr(pstr);
#else
DebugStr(pstr);
#endif
}
#endif // MSW
}

View File

@@ -192,7 +192,7 @@ void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event)
void wxGenericColourDialog::OnPaint(wxPaintEvent& event)
{
#ifndef __WXMOTIF__
#if !defined(__WXMOTIF__) && !defined(__WXMAC__)
wxDialog::OnPaint(event);
#endif

BIN
src/jpeg/makemac.mcp Normal file

Binary file not shown.

Binary file not shown.

BIN
src/makemac.mcp Normal file

Binary file not shown.