Is there any way to create and display music notation inside of a codenameone app? - cross-platform

Is there any way to create and display music notation inside of a codenameone app?
For Java generally there are some libraries like for example JFugue that let you write music inside a program. Maybe also display it, i didn't try that out.
There is lilypond, which would work in a desktop environment if you were able to run it to make the pdf after generating the file itself.
I wrote a small app in Android Studio and had to write my own music notation logic and drew it with the help of png files on a Canvas. That worked okay for small musical examples of a clef and around 2-7 notes.
Now i want to do something similar in Codenameone and display at least a clef and some notes inside the app (maybe as an image) - they have to be generated with some random element while the program runs.
It would also be great to be able to write and show more than a few notes, displaying it somehow and maybe also with the ability to have it as a pdf file later.
Is it possible to use something that already exists?
Thanks a lot!

Related

How to show document preview in iCloud conflicts sheet in Mac App using NSDocument

I am creating a Mac App, using NSDocument, that stores a custom class of documents to iCloud.
I was able to get the program to store documents to iCloud quite easily by just Code Signing it, Sandboxing it, and adding iCloud entitlements; however, I'm still encountering a problem where when I trigger an iCloud conflict and the program drops down the sheet allowing the user to resolve the conflict the rows in the sheet do not show the small image of the document (like Preview and TextEdit do).
Additionally, when I click on the area where the image should be (it's blank) it opens up a Quick Look window that just displays an image of the Document Icon together with some other information as opposed to a snap shot of the actual file like Preview and TextEdit do.
I have not found any information in Apple's documentation that explains what I need to do to implement the same behaviour as Preview and TextEdit.
So far I've been surprised by how easily I've been able to get all of the functionability of not only the Auto Saves and the Versions browser, but also saving to the Cloud. NSDocument seems to do all of this for the developer (resolving iCloud Conflicts, etc.), as Apple's documents says it does, but again I'm not getting this other behaviour and I don't want to reinvent the wheel by writing code that is not needed.
I'm thinking that the answer might lie somewhere with implementing a Quick Look thumbnail (for the small image in the table in the sheet) and a Quick Look preview for the larger preview of the document when that in the sheet is clicked on, but this seems like a lot of work and I'm afraid of losing some of the other build-in functions of NSDocument if I start "trapping" NSDocument routines up the food chain so to speak.
Has anyone else encountered this problem and found the easiest solution?
Update: Dec. 25/12
I've finally figured out that the problem is I need a QuickLook generator to display both a QL Thumbnail (which shows up in the table in the conflicts sheet) and a QL Preview (which is displayed when a user clicks on the Thumbnail)
I ended up creating the QL generator project, and afterwards creating a workspace which I added my main project and the QL generator project to. After that I added a Copy Files Build Phase to the main project to copy the QL generator into the main Application bundle.

Changing OS file icons using AIR app

I am building an AIR app which will be kind of like Dropbox. It will allow users to sync their files between various OSs. What I would like to know is that how can i change the default file system's file icons (add an overlay for eg) for states like - Synced and Syncing, the way Dropbox does it ??
On Windows i found out that Dropbox edits the registry files to insert the overlay icons..not yet sure how they do it in MAC OS X though.
I saw some threads here asking similar questions about AIR, but none referencing how to change file's icons. Hoping to get a solution for this from the various experts .. Please suggest any ideas if you know how it can be accomplished. Much thanks.
A simple yet effective solution would be to use icons that are only internal to your application : just embed in your application files some transparent pictures representing the various states of your files (with only the small part telling in which state it is, with the rest totally transparent), that you will add at runtime above the displayed icons.
Since you can get the actual icon of your files, just draw them into a BitmapData (if needed) & add an overlay with theses custom images, using the one related to your file's state in your application.
And one step further could be to store in your AIR application folder any resulting icons for future use (check what types of files you already have, and if your new file type isn't in thoses, export the various icons with your custom overlays to PNG files directly on the user device, for re-loading them the next time the application is opened).

how do i add background music to auto play in the background of my vb project

I have a project in vb 2010 that im working on. I want to know if i publish this and make it downloadable when it is done will my background music be heard by others?
Im pretty sure it's only playing on mine because the song is on my computer right?
Is there a code to make it so it stays even if i make this program downloadable?
You need to have the background music distributed with the program. It should be possible to include the music file as a resource in your project, and then to pass that resource to what you use to play the audio.
Alternatively, you could simply package the music file with your executable (whether you're using a zip or an installer), and then find the file in the same directory as your application, and play it that way.

Possible to get _all_ rendered text on OS X?

I'm looking to log all the text that gets displayed on my OS X 10.6 machine. e.g. all webpage text (no matter the browser), PDF text (not necessarily the entire PDF, but at very least all the text that was actually viewed), anything I type into emacs, any email I write.
I've looked at the Accessibility API, but it seems to be more about describing function than content - and in any case relies on application developers to have implemented accessibility objects. Is there something lower-level? perhaps I can watch everything that goes through the OS font renderer?
After searching for a while my impression is that Apple doesn't explicitly make this possible, I'm open to any hackish suggestions you might have.
You'd have to get deep inside the Window Server to have any hope of getting all the text that was written to the screen. I suppose you could patch it yourself, but it's hard to see how without source. What you want has obvious nefarious uses so there's hardly going to be a public API for it.
Just a shot in the dark, but what about turning on Screen Sharing on the 'target' Mac and pointing a modified VNC client at it? I don't know whether text is sent as text over VNC or not, but if it was that might be one place to start. It's effectively giving you a Window Server equivalent that you control.

Open a PDF file in an external app on iPad

I'd like to make my app to open a specified PDF by an external app of the user's choice on the iPad. How can I do that? Or, is there any open-source PDF reader framework available so that I can put it into my app?
My situation in more detail:
I'm thinking of porting to the iPad from OS X / rewriting from scratch for the iPad an app which manages lots of PDFs (journal articles, etc.), but I don't want to write the PDF reader part, because there are many good ones already out there; I don't want to reinvent the wheels.
(You might say you shouldn't reinvent pdf management apps, but I'd like to make one as a front end to SPIRES, and there isn't one so far.)
As the app would be a front end to a serious reading activity, UIWebView's pdf capability is not enough.
Also, users of my app would have various preferences which app to use.
That's the background behind my question. Thanks in advance!
Here's my self-answer:
Use UIDocumentInteractionController. See this Apple doc.
The problem now is to find a way to choose programmatically exactly with which app you open a document, when multiple apps are available to a same file type.
Its not that hard to view PDFs without a UIWebView. You use some Quarts 2D drawing but a large majority of the work is done for you. You mainly have to choose how you will flip pages, and do pinch to zoom.
Quarts 2D PDF reference
You aren't able to search inside of PDF files. You can't access the text. You could do annotation, but it would be a hack at best.