#include <config.h>
#include "support/os.h"
+#include "support/docstring.h"
#ifdef __APPLE__
-#include "debug.h"
#include <Carbon/Carbon.h>
-#include <ApplicationServices/ApplicationServices.h>
-using std::endl;
#endif
-using std::string;
-
+using namespace std;
namespace lyx {
namespace support {
}
-bool is_absolute_path(string const & p)
-{
- return !p.empty() && p[0] == '/';
-}
-
-
char const * popen_read_mode()
{
return "r";
(void)mode;
LSRolesMask role = kLSRolesAll;
FSRef outAppRef;
- OSStatus status =
+ OSStatus status =
LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator,
cfs_ext, role, &outAppRef, NULL);
CFRelease(cfs_ext);
#ifdef __APPLE__
// Reference: http://developer.apple.com/documentation/Carbon/Reference/LaunchServicesReference/
FSRef fileref;
- OSStatus status =
+ OSStatus status =
FSPathMakeRef((UInt8 *) filename.c_str(), &fileref, NULL);
if (status != 0)
return false;
-
+
// this is what we would like to do but it seems that the
// viewer for PDF is often quicktime...
//LSRolesMask role = (mode == VIEW) ? kLSRolesViewer : kLSRolesEditor;
inLaunchSpec.asyncRefCon = NULL;
status = LSOpenFromRefSpec(&inLaunchSpec, NULL);
- return status != kLSApplicationNotFoundErr;
+ return status != kLSApplicationNotFoundErr;
#else
// silence compiler warnings
(void)filename;
#endif
}
-
-void addFontResources()
-{
-#ifdef __APPLE__
- CFBundleRef myAppBundle = CFBundleGetMainBundle();
- CFURLRef myAppResourcesURL, FontsURL;
- FSRef fontDirRef;
- FSSpec fontDirSpec;
- CFStringRef filePath = CFStringCreateWithBytes(kCFAllocatorDefault,
- (UInt8 *) "fonts", strlen("fonts"),
- kCFStringEncodingISOLatin1, false);
-
- myAppResourcesURL = CFBundleCopyResourcesDirectoryURL(myAppBundle);
- FontsURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault,
- myAppResourcesURL, filePath, true);
- if (lyxerr.debugging(Debug::FONT)) {
- UInt8 buf[255];
- if (CFURLGetFileSystemRepresentation(FontsURL, true, buf, 255))
- lyxerr << "Adding Fonts directory: " << buf << endl;
- }
- CFURLGetFSRef (FontsURL, &fontDirRef);
- OSStatus err = FSGetCatalogInfo (&fontDirRef, kFSCatInfoNone,
- NULL, NULL, &fontDirSpec, NULL);
- if (err)
- lyxerr << "FSGetCatalogInfo err = " << err << endl;
- err = FMActivateFonts (&fontDirSpec, NULL, NULL,
- kFMLocalActivationContext);
- if (err)
- lyxerr << "FMActivateFonts err = " << err << endl;
-#endif
-}
-
-
-void restoreFontResources()
-{}
-
} // namespace os
} // namespace support
} // namespace lyx