clean up old mac os classic stuff. b=281889 r=smfr sr=bryner a=bsmedberg

git-svn-id: svn://10.0.0.236/trunk@175668 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
joshmoz%gmail.com
2005-07-06 01:23:20 +00:00
parent 594378b436
commit bcca8a2301
7 changed files with 4 additions and 405 deletions

View File

@@ -39,25 +39,11 @@
#define CarbonHelpers_h__
#include <ConditionalMacros.h>
#if (UNIVERSAL_INTERFACES_VERSION >= 0x0330)
#include <ControlDefinitions.h>
#else
#include <Controls.h>
#endif
#include <Menus.h>
#include <MacWindows.h>
#include <LowMem.h>
#if UNIVERSAL_INTERFACES_VERSION < 0x0341
enum {
inToolbarButton = 13 /* Mac OS X forward*/
};
enum {
kWindowToolbarButtonAttribute = (1L << 6) /* this window has a toolbar button widget in the titlebar (Mac OS X only)*/
};
#endif
//
// for non-carbon builds, provide various accessors to keep the code below free of ifdefs.
//

View File

@@ -57,10 +57,6 @@
#include <Appearance.h>
#include <Resources.h>
#if (UNIVERSAL_INTERFACES_VERSION >= 0x0330)
#include <ControlDefinitions.h>
#endif
extern MRJConsole* theConsole;
extern short thePluginRefnum;

View File

@@ -51,17 +51,6 @@
class nsWindow;
class nsMacWindow;
#if UNIVERSAL_INTERFACES_VERSION < 0x0337
enum {
kEventMouseWheelAxisX = 0,
kEventMouseWheelAxisY = 1
};
typedef UInt16 EventMouseWheelAxis;
#endif
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------

View File

@@ -130,7 +130,6 @@ int nsToolkitBase::QuartzChangedCallback(const char* pref, void* data)
void nsToolkitBase::SetupQuartzRendering()
{
// from Apple's technote at http://developer.apple.com/qa/qa2001/qa1193.html
#if UNIVERSAL_INTERFACES_VERSION <= 0x0400
enum {
kQDDontChangeFlags = 0xFFFFFFFF, // don't change anything
kQDUseDefaultTextRendering = 0, // bit 0
@@ -138,7 +137,6 @@ void nsToolkitBase::SetupQuartzRendering()
kQDUseCGTextRendering = (1 << 1), // bit 2
kQDUseCGTextMetrics = (1 << 2)
};
#endif
const int kFlagsWeUse = kQDUseCGTextRendering | kQDUseCGTextMetrics;

View File

@@ -43,30 +43,7 @@
#include "nsString.h"
#include "nsDependentString.h"
#ifdef XP_MAC
#include <Folders.h>
#include <Files.h>
#include <Memory.h>
#include <Processes.h>
#include <Gestalt.h>
#include "nsIInternetConfigService.h"
#if UNIVERSAL_INTERFACES_VERSION < 0x0340
enum {
kSystemDomain = -32766, /* Read-only system hierarchy.*/
kLocalDomain = -32765, /* All users of a single machine have access to these resources.*/
kNetworkDomain = -32764, /* All users configured to use a common network server has access to these resources.*/
kUserDomain = -32763, /* Read/write. Resources that are private to the user.*/
kClassicDomain = -32762, /* Domain referring to the currently configured Classic System Folder*/
kDomainLibraryFolderType = FOUR_CHAR_CODE('dlib')
};
#endif
#elif defined(XP_WIN)
#if defined(XP_WIN)
#include <windows.h>
#include <shlobj.h>
@@ -292,12 +269,6 @@ GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory,
{
char path[MAXPATHLEN];
#ifdef XP_MAC
OSErr err;
short vRefNum;
long dirID;
#endif
switch (aSystemSystemDirectory)
{
case OS_CurrentWorkingDirectory:
@@ -341,10 +312,6 @@ GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory,
PR_TRUE,
aFile);
}
#elif defined(XP_MAC)
{
return nsIFileFromOSType(kVolumeRootFolderType, aFile);
}
#else
return NS_NewNativeLocalFile(nsDependentCString("/"),
PR_TRUE,
@@ -381,9 +348,6 @@ GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory,
PR_TRUE,
aFile);
}
#elif defined(XP_MAC)
return nsIFileFromOSType(kTemporaryFolderType, aFile);
#elif defined(XP_MACOSX)
{
return GetOSXFolderType(kUserDomain, kTemporaryFolderType, aFile);
@@ -410,82 +374,7 @@ GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory,
}
#else
break;
#endif
#if defined(XP_MAC)
case Mac_SystemDirectory:
return nsIFileFromOSType(kSystemFolderType, aFile);
case Mac_DesktopDirectory:
return nsIFileFromOSType(kDesktopFolderType, aFile);
case Mac_TrashDirectory:
return nsIFileFromOSType(kTrashFolderType, aFile);
case Mac_StartupDirectory:
return nsIFileFromOSType(kStartupFolderType, aFile);
case Mac_ShutdownDirectory:
return nsIFileFromOSType(kShutdownFolderType, aFile);
case Mac_AppleMenuDirectory:
return nsIFileFromOSType(kAppleMenuFolderType, aFile);
case Mac_ControlPanelDirectory:
return nsIFileFromOSType(kControlPanelFolderType, aFile);
case Mac_ExtensionDirectory:
return nsIFileFromOSType(kExtensionFolderType, aFile);
case Mac_FontsDirectory:
return nsIFileFromOSType(kFontsFolderType, aFile);
case Mac_ClassicPreferencesDirectory:
{
// whether Mac OS X or pre-Mac OS X, return Classic's Prefs folder
short domain;
long response;
err = ::Gestalt(gestaltSystemVersion, &response);
domain = (!err && response >= 0x00001000) ? kClassicDomain : kOnSystemDisk;
err = ::FindFolder(domain, kPreferencesFolderType, true, &vRefNum, &dirID);
if (!err) {
err = ::FSMakeFSSpec(vRefNum, dirID, "\p", &mSpec);
}
return NS_FILE_RESULT(err);
}
case Mac_PreferencesDirectory:
{
// if Mac OS X, return Mac OS X's Prefs folder
// if pre-Mac OS X, return Mac OS's Prefs folder
err = ::FindFolder(kOnSystemDisk, kPreferencesFolderType, true, &vRefNum, &dirID);
if (!err) {
err = ::FSMakeFSSpec(vRefNum, dirID, "\p", &mSpec);
}
return NS_FILE_RESULT(err);
}
case Mac_DocumentsDirectory:
return nsIFileFromOSType(kDocumentsFolderType, aFile);
case Mac_InternetSearchDirectory:
return nsIFileFromOSType(kInternetSearchSitesFolderType, aFile);
case Mac_DefaultDownloadDirectory:
return nsIFileFromOSType(kDefaultDownloadFolderType, aFile);
case Mac_UserLibDirectory:
{
FSSpec spec;
err = ::FindFolder(kUserDomain, kDomainLibraryFolderType, true, &vRefNum, &dirID);
if (!err) {
err = ::FSMakeFSSpec(vRefNum, dirID, "\p", &spec);
}
return NS_NewLocalFileWithFSSpec(&spec, PR_FALUE, aFile);
}
#endif
#endif
#if defined (XP_WIN)
case Win_SystemDirectory:
{

View File

@@ -256,11 +256,8 @@ static OSErr PreflightDirectoryCopySpace(short srcVRefNum,
if ( error == noErr )
{
/* Convert freeBytes to free disk blocks (512-byte blocks) */
#if (UNIVERSAL_INTERFACES_VERSION >= 0x0330)
dstFreeBlocks = (pb.ioVFreeBytes >> 9);
#else
dstFreeBlocks = (pb.ioVFreeBytes.hi << 23) + (pb.ioVFreeBytes.lo >> 9);
#endif
/* get allocation block size (always multiple of 512) and divide by 512
to get number of 512-byte blocks per allocation block */
theGlobals.dstBlksPerAllocBlk = ((unsigned long)pb.ioVAlBlkSiz >> 9);

View File

@@ -90,19 +90,6 @@
#include "nsHashtable.h"
#include "prlog.h"
#if defined (XP_MAC) && UNIVERSAL_INTERFACES_VERSION < 0x0340
enum {
kSystemDomain = -32766, /* Read-only system hierarchy.*/
kLocalDomain = -32765, /* All users of a single machine have access to these resources.*/
kNetworkDomain = -32764, /* All users configured to use a common network server has access to these resources.*/
kUserDomain = -32763, /* Read/write. Resources that are private to the user.*/
kClassicDomain = -32762, /* Domain referring to the currently configured Classic System Folder*/
kDomainLibraryFolderType = FOUR_CHAR_CODE('dlib')
};
#endif
class SystemDirectoriesKey : public nsHashKey {
public:
@@ -273,69 +260,6 @@ static void GetCurrentProcessDirectory(nsFileSpec& aFileSpec)
aFileSpec = buffer;
return;
#elif defined(XP_MAC)
// get info for the the current process to determine the directory
// its located in
OSErr err;
ProcessSerialNumber psn = {kNoProcess, kCurrentProcess};
ProcessInfoRec pInfo;
FSSpec tempSpec;
// initialize ProcessInfoRec before calling
// GetProcessInformation() or die horribly.
pInfo.processName = nil;
pInfo.processAppSpec = &tempSpec;
pInfo.processInfoLength = sizeof(ProcessInfoRec);
if (!(err = GetProcessInformation(&psn, &pInfo)))
{
FSSpec appFSSpec = *(pInfo.processAppSpec);
long theDirID = appFSSpec.parID;
Str255 name;
CInfoPBRec catInfo;
catInfo.dirInfo.ioCompletion = NULL;
catInfo.dirInfo.ioNamePtr = (StringPtr)&name;
catInfo.dirInfo.ioVRefNum = appFSSpec.vRefNum;
catInfo.dirInfo.ioDrDirID = theDirID;
catInfo.dirInfo.ioFDirIndex = -1; // -1 = query dir in ioDrDirID
if (!(err = PBGetCatInfoSync(&catInfo)))
{
aFileSpec = nsFileSpec(appFSSpec.vRefNum,
catInfo.dirInfo.ioDrParID,
name,
PR_TRUE);
return;
}
}
#if defined(DEBUG)
else
{
// In the absence of a good way to get the executable directory let
// us try this for unix:
// - if MOZILLA_FIVE_HOME is defined, that is it
char *moz5 = PR_GetEnv("MOZILLA_FIVE_HOME");
if (moz5)
{
printf( "nsSpecialSystemDirectory::MOZILLA_FIVE_HOME is set to %s\n", moz5 );
aFileSpec = moz5;
return;
}
else
{
static PRBool firstWarning = PR_TRUE;
if(firstWarning) {
// Warn that MOZILLA_FIVE_HOME not set, once.
printf("***Warning: MOZILLA_FIVE_HOME not set.\n");
firstWarning = PR_FALSE;
}
}
}
#endif /* DEBUG */
#elif defined(XP_UNIX)
// In the absence of a good way to get the executable directory let
@@ -432,12 +356,6 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
// IT's VERY IMPORTANT that needToAppend is initialized to PR_TRUE.
PRBool needToAppend = PR_TRUE;
#ifdef XP_MAC
OSErr err;
short vRefNum;
long dirID;
#endif
*this = (const char*)nsnull;
switch (aSystemSystemDirectory)
{
@@ -468,10 +386,6 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
printf( "Got OS_DriveDirectory: %s\n", buffer);
#endif
}
#elif defined(XP_MAC)
{
*this = kVolumeRootFolderType;
}
#else
*this = "/";
#endif
@@ -502,10 +416,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
if( c) *this = buffer;
// use exe's directory if not set
else GetCurrentProcessDirectory(*this);
}
#elif defined(XP_MAC)
*this = kTemporaryFolderType;
}
#elif defined(XP_UNIX) || defined(XP_BEOS)
{
static const char *tPath = nsnull;
@@ -565,11 +476,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
if (needToAppend) {
// XXX We need to unify these names across all platforms
#if defined(XP_MAC)
*this += "Component Registry";
#else
*this += "component.reg";
#endif /* XP_MAC */
}
}
break;
@@ -603,11 +510,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
if (needToAppend) {
// XXX We need to unify these names across all platforms
#if defined(XP_MAC)
*this += "Components";
#else
*this += "components";
#endif /* XP_MAC */
}
}
break;
@@ -629,93 +532,6 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect
}
}
break;
#if defined(XP_MAC)
case Mac_SystemDirectory:
*this = kSystemFolderType;
break;
case Mac_DesktopDirectory:
*this = kDesktopFolderType;
break;
case Mac_TrashDirectory:
*this = kTrashFolderType;
break;
case Mac_StartupDirectory:
*this = kStartupFolderType;
break;
case Mac_ShutdownDirectory:
*this = kShutdownFolderType;
break;
case Mac_AppleMenuDirectory:
*this = kAppleMenuFolderType;
break;
case Mac_ControlPanelDirectory:
*this = kControlPanelFolderType;
break;
case Mac_ExtensionDirectory:
*this = kExtensionFolderType;
break;
case Mac_FontsDirectory:
*this = kFontsFolderType;
break;
case Mac_ClassicPreferencesDirectory:
{
// whether Mac OS X or pre-Mac OS X, return Classic's Prefs folder
short domain;
long response;
err = ::Gestalt(gestaltSystemVersion, &response);
domain = (!err && response >= 0x00001000) ? kClassicDomain : kOnSystemDisk;
err = ::FindFolder(domain, kPreferencesFolderType, true, &vRefNum, &dirID);
if (!err) {
err = ::FSMakeFSSpec(vRefNum, dirID, "\p", &mSpec);
}
mError = NS_FILE_RESULT(err);
break;
}
case Mac_PreferencesDirectory:
{
// if Mac OS X, return Mac OS X's Prefs folder
// if pre-Mac OS X, return Mac OS's Prefs folder
err = ::FindFolder(kOnSystemDisk, kPreferencesFolderType, true, &vRefNum, &dirID);
if (!err) {
err = ::FSMakeFSSpec(vRefNum, dirID, "\p", &mSpec);
}
mError = NS_FILE_RESULT(err);
break;
}
case Mac_DocumentsDirectory:
*this = kDocumentsFolderType;
break;
case Mac_InternetSearchDirectory:
*this = kInternetSearchSitesFolderType;
break;
case Mac_DefaultDownloadDirectory:
*this = kDefaultDownloadFolderType;
break;
case Mac_UserLibDirectory:
{
err = ::FindFolder(kUserDomain, kDomainLibraryFolderType, true, &vRefNum, &dirID);
if (!err) {
err = ::FSMakeFSSpec(vRefNum, dirID, "\p", &mSpec);
}
mError = NS_FILE_RESULT(err);
break;
}
#endif
#if defined (XP_WIN)
case Win_SystemDirectory:
@@ -1081,75 +897,3 @@ nsSpecialSystemDirectory::Set(SystemDirectories dirToSet, nsFileSpec *dirSpec)
return;
}
#if defined(XP_MAC)
//----------------------------------------------------------------------------------------
nsSpecialSystemDirectory::nsSpecialSystemDirectory(OSType folderType)
//----------------------------------------------------------------------------------------
{
*this = folderType;
}
//----------------------------------------------------------------------------------------
void nsSpecialSystemDirectory::operator = (OSType folderType)
//----------------------------------------------------------------------------------------
{
CInfoPBRec cinfo;
DirInfo *dipb=(DirInfo *)&cinfo;
// hack: first check for kDefaultDownloadFolderType
// if it is, get Internet Config Download folder, if that's
// not availble use desktop folder
if (folderType == kDefaultDownloadFolderType)
{
nsCOMPtr<nsIInternetConfigService> icService (do_GetService(NS_INTERNETCONFIGSERVICE_CONTRACTID));
if (icService)
{
if (NS_SUCCEEDED(icService->GetDownloadFolder(&mSpec)))
return;
else
folderType = kDesktopFolderType;
}
else
{
folderType = kDesktopFolderType;
}
}
// Call FindFolder to fill in the vrefnum and dirid
for (int attempts = 0; attempts < 2; attempts++)
{
mError = NS_FILE_RESULT(
FindFolder(
kOnSystemDisk,
folderType,
true,
&dipb->ioVRefNum,
&dipb->ioDrDirID));
if (NS_SUCCEEDED(mError))
break;
if (attempts > 0)
return;
switch (folderType)
{
case kDocumentsFolderType:
// Find folder will find this, as long as it exists.
// The "create" parameter, however, is sadly ignored.
// How do we internationalize this?
*this = kVolumeRootFolderType;
*this += "Documents";
CreateDirectory();
break;
} // switch
} // for
StrFileName filename;
filename[0] = '\0';
dipb->ioNamePtr = (StringPtr)&filename;
dipb->ioFDirIndex = -1;
mError = NS_FILE_RESULT(PBGetCatInfoSync(&cinfo));
if (NS_SUCCEEDED(mError))
{
mError = NS_FILE_RESULT(FSMakeFSSpec(dipb->ioVRefNum, dipb->ioDrParID, filename, &mSpec));
}
}
#endif // XP_MAC