Author: manolo
Date: 2012-11-13 05:03:20 -0800 (Tue, 13 Nov 2012)
New Revision: 9718
Log:
Documented how to make a Mac OS FLTK application launchable by dropping files
on its icon.
Modified:
branches/branch-1.3/README.OSX.txt
branches/branch-1.3/ide/Xcode3/plists/editor-Info.plist
branches/branch-1.3/ide/Xcode4/plists/editor-Info.plist
branches/branch-1.3/test/editor.cxx
Modified: branches/branch-1.3/README.OSX.txt
===================================================================
--- branches/branch-1.3/README.OSX.txt 2012-11-13 09:42:22 UTC (rev 9717)
+++ branches/branch-1.3/README.OSX.txt 2012-11-13 13:03:20 UTC (rev 9718)
@@ -33,7 +33,8 @@
4.5 Testing FLTK
4.6 Uninstalling previous versions of FLTK
4.7 Installing FLTK
- 5 DOCUMENT HISTORY
+ 5 MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON
+ 6 DOCUMENT HISTORY
1 INTRODUCTION
@@ -411,7 +412,28 @@
(TODO: 4.8 Installing Little Helpers)
(TODO: 4.9 Creating new Projects)
- 5 DOCUMENT HISTORY
+
+
+ 5 MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON
+=================================================================
+- Prepare an Info.plist file for your application derived from file
+ide/Xcode4/plists/editor-Info.plist which allows any file to be dropped
+on the application icon.
+You can edit this file in Xcode and change
+Document types/Item 0/CFBundleTypeExtensions/Item 0
+from the current "*" to the desired file extension. Use several items to
declare
+several extensions.
+
+- Call fl_open_callback() at the beginning of your main() function that
+sets what function will be called when a file is dropped on the application
icon.
+
+- In Xcode, set the "Info.plist File" build setting of your target application
+to the Info.plist file you have prepared.
+
+- Rebuild your application.
+
+
+ 6 DOCUMENT HISTORY
=====================
Oct 29 2010 - matt: removed warnings
@@ -420,3 +442,4 @@
Dec 29 2010 - Manolo: removed reference to AudioToolbox.framework that's no
longer needed
Feb 24 2011 - Manolo: architecture flags are not propagated to the fltk-config
script.
Apr 17 2012 - matt: added Xcode4 documentation
+Nov 13 2012 - Manolo: added "MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES
ON ITS ICON"
Modified: branches/branch-1.3/ide/Xcode3/plists/editor-Info.plist
===================================================================
--- branches/branch-1.3/ide/Xcode3/plists/editor-Info.plist 2012-11-13
09:42:22 UTC (rev 9717)
+++ branches/branch-1.3/ide/Xcode3/plists/editor-Info.plist 2012-11-13
13:03:20 UTC (rev 9718)
@@ -4,8 +4,27 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>*</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>AllFiles</string>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>XML</string>
+ </dict>
+ </array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Part of the FLTK library. Please visit www.fltk.org.</string>
<key>CFBundleIdentifier</key>
<string>org.fltk.editor</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -18,7 +37,5 @@
<string>1.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 1998-2010 by Bill Spitzak and others.</string>
- <key>CFBundleGetInfoString</key>
- <string>Part of the FLTK library. Please visit www.fltk.org.</string>
</dict>
- </plist>
+</plist>
Modified: branches/branch-1.3/ide/Xcode4/plists/editor-Info.plist
===================================================================
--- branches/branch-1.3/ide/Xcode4/plists/editor-Info.plist 2012-11-13
09:42:22 UTC (rev 9717)
+++ branches/branch-1.3/ide/Xcode4/plists/editor-Info.plist 2012-11-13
13:03:20 UTC (rev 9718)
@@ -4,8 +4,27 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>*</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>AllFiles</string>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>XML</string>
+ </dict>
+ </array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Part of the FLTK library. Please visit www.fltk.org.</string>
<key>CFBundleIdentifier</key>
<string>org.fltk.editor</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -18,7 +37,5 @@
<string>1.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 1998-2010 by Bill Spitzak and others.</string>
- <key>CFBundleGetInfoString</key>
- <string>Part of the FLTK library. Please visit www.fltk.org.</string>
</dict>
- </plist>
+</plist>
Modified: branches/branch-1.3/test/editor.cxx
===================================================================
--- branches/branch-1.3/test/editor.cxx 2012-11-13 09:42:22 UTC (rev 9717)
+++ branches/branch-1.3/test/editor.cxx 2012-11-13 13:03:20 UTC (rev 9718)
@@ -789,16 +789,22 @@
return w;
}
+void cb(const char *fname) {
+ load_file(fname, -1);
+}
+
int main(int argc, char **argv) {
textbuf = new Fl_Text_Buffer;
//textbuf->transcoding_warning_action = NULL;
style_init();
+ fl_open_callback(cb);
Fl_Window* window = new_view();
window->show(1, argv);
-
+#ifndef __APPLE__
if (argc > 1) load_file(argv[1], -1);
+#endif
return Fl::run();
}
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit