|
Benguin
|
|
Post:
Jul 28th 2008 at 11:35 AM |
|
|
|
Whenever I try to open a file from Finder (by double clicking the pt/gp/tg file from a folder), TuxGuitar launches but instead of the tab I wanted to open it creates a new blank one. If I go to File > Open I can select a file just fine, but that's somewhat of a hassle and not a very ideal solution.
|
|
| Back to Top |
| |
|
Flo
|
|
Post:
Jul 29th 2008 at 8:38 PM |
|
|
|
The same problem appears on Linux when trying to open a file. It'd be nice if tuxguitar could open a file given as a command line parameter, e.g. "tuxguitar /path/to/file".
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 29th 2008 at 8:53 PM |
|
|
Hi,
TuxGuitar itself can open a file by arguments
the problem is on the launcher script (who call java command)
I don't know enough about "mac" scripting, and also is very hard to test if i don't have one.
so that's the reason why maybe mac release have that kind of problems.
under GNU/Linux, it's a different thing.
there are a lot of GNU/Linux distribution what distribute tuxguitar with their launcher script.
so, if it don't work under linux, we need to know what launcher script do you have.
* do you have any official release ?
_ if yes, what package of all available on download section.
_ if answer is no.. are you complety sure the launcher script is adding arguments to java command ?
Can you show us the script test ?
|
|
| Back to Top |
| |
|
Flo
|
|
Post:
Jul 29th 2008 at 9:06 PM |
|
|
I'm running Arch Linux (package from http://aur.archlinux.org/packages.php?ID=9437), and the launcher script is just
#!/bin/sh
exec /usr/share/tuxguitar/tuxguitar
So, no command line parameters are passed.
I tried the script of the tuxguitar binary release, but then it says "Exception in thread "main" java.lang.NoClassDefFoundError: org/herac/tuxguitar/gui/TGMain"
The following line seems to be wrong:
##MAINCLASS
MAINCLASS=org.herac.tuxguitar.gui.TGMain
|
|
| Back to Top |
| |
|
Flo
|
|
Post:
Jul 29th 2008 at 9:13 PM |
|
|
Okay, I don't know what's causing this error. The file executed by the "exec" line of the Arch Linux package is the same as the one distributed with the tuxguitar binary download. So, how to pass the command line arguments to the tuxguitar script? I tried
#!/bin/sh
exec /usr/share/tuxguitar/tuxguitar $@
but it doesn't seem to work.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 29th 2008 at 11:10 PM |
|
|
Hi,
> exec /usr/share/tuxguitar/tuxguitar
As i remember, there was a post on this forum with this exactly thing. but i don't remember the topic name :)
As i remember, they have tuxguitar very similar as the official release installed on /usr/share/tuxguitar
and their launcher just call the script (without args as you say)
> I tried the script of the tuxguitar binary release
You mean a downloaded release from this web site?
What package ?
> exec /usr/share/tuxguitar/tuxguitar $@
that may don't work with file names with "spaces".
a file called: "My File.tg" after use $@ is taked as 2 arguments: 1 "My", 2 "File.tg"
What we do to fix that problems on the tuxguitar script is pass them splitted:
java [java args] "$1" "$2"
yes, it's limited to 2 args, but tuxguitar don't expect more.
Try do this on a terminal:
/usr/share/tuxguitar/tuxguitar full_path_to_a_file
the generic GNU/Linux official script, was maded thinking on allow the user move the folder on any path without need to configure nothing.
todo that, the script do a "cd" to the tuxguitar script location. so if you don't specify the "full" path to the file, it'll not work:
WRONG: /usr/share/tuxguitar/tuxguitar file.tg
RIGHT: /usr/share/tuxguitar/tuxguitar /where_is/file.tg
If it work, you maybe can "move" /usr/share/tuxguitar/tuxguitar to /usr/bin
and change the paths of that script.
with a static path installation is more easy to make run arguments, mime tipes, etc.
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Jul 30th 2008 at 1:08 AM |
|
|
|
On mac, files to open are passed through events and not through command-line parameters. We'd need to see how(if) SWT catches and handles these events. i could take care of the rest
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Jul 30th 2008 at 1:11 AM |
|
|
http://www.kallisti.net.nz/blog/2007/04/getting-opendoc-events-on-mac-os-x-with-swt/
ok, seems like SWT makes it very difficult... :/
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 30th 2008 at 1:18 AM |
|
|
it work with events ?
something like, firt application open and then it receibe event when user click on a file ?
what about if you run under a terminal:
ls /folder
"/folder" arg is algo running as event to "ls" command ?
|
|
| Back to Top |
| |
|
Flo
|
|
Post:
Jul 30th 2008 at 1:40 PM |
|
|
Okay, I solved it as following:
I copied the /usr/share/tuxguitar/tuxguitar script to /usr/bin/tuxguitar to replace the Arch Linux exec-script. I changed the line "DIR_NAME=`dirname "$0"`" to "DIR_NAME='/usr/share/tuxguitar'". Now passing a file as a parameter works fine.
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Aug 1st 2008 at 12:23 AM |
|
|
>>
it work with events ?
something like, firt application open and then it receibe event when user click on a file ?
>>
Yes, and IMO it's more logical, users can open documents at any time and not only when initially opening the app (apps like GIMP fake that behaviour using gimp-remote or more recently dbus)
>>
what about if you run under a terminal:
ls /folder
"/folder" arg is algo running as event to "ls" command ?
>>
no idea what you mean
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Aug 1st 2008 at 12:24 AM |
|
|
|
Ah i got what you mean with "ls /folder". No, the event thing is only for apps with GUI, to view documents, not for terminal apps.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 1st 2008 at 8:11 PM |
|
|
Ok, so todo that, do what azureus did can be a good option.
but we'll need to review the code anytime SWT releases a new version :(..
Maybe a new plugin can be more easy
but The question is..
if we write a JNI plugin with a C library what is listening to that event.
How hard can be make that listener ?
What expect carbon of that listener to "know" it's from tuxguitar application ? or do we need to get some SWT vars to tell carbon who we are?
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Aug 1st 2008 at 11:07 PM |
|
|
An easier method may be to use a "launcher" (i.e. when you launch TG, you actually launch a C application that loads TG.) Not sure how nice it would be though, we might end up with 2 icons in the dock (yuck) or maybe something like gimp-remote used to be (ugly, and i'm not sure how it could communicate with the java app anyway)
I'm not sure if it's possible to listen to events in a plug-in but we could try. I'm just not sure how to get the event back in the Java side but then i know nothing about JNI.
Though, the link i posted above suggests that the way SWT runs prevents this
In short, this should be done in SWT, not in TG :(
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 2nd 2008 at 2:38 PM |
|
|
To invoke a java method from JNI is easy.
I can make the java method, and call it from JNI.
the problem of that, is tell carbon this plugin is part of tuxguitar.
i mean.. a plugin, will run as a subapplication inside tuxguitar. so i don't have idea if "carbon" will take this plugin as "tuxguitar" when user make 2 clicks to a file.
> An easier method may be to use a "launcher"
it will be the best thing. replace the shell script to a binary launcher.
But the same question here, is what carbon needs ?
on launcher time, SWT isn't loaded yet. so if it needs anythuing of SWT, it'll not be possible with a launcher.
I'm not sure about
it depends on "how" it works..
i mean.. if it works registering the "application name", it'll be easy. but if it needs any carbon pointer reference, so we need SWT
How is this technology name?
i'd like to found info, because i'm not really sure what i'm talking about :d
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Aug 3rd 2008 at 12:54 AM |
|
|
the technology name is "Apple Events"
When i mentionned a launcher, i actually meant one that remains open and listens to events. But i agree this is not cool at all.
I re-read the website link i pointed above - i think it mentions that it would work with a plugin ("It is possible, with some JNI hooks into the Carbon layer of OS X, to catch the events there and have them passed through to the application. Basically, you include this JNI code, create some callbacks using SWT, sacrifice a chicken and bleed a goat, and all of a sudden your code gets called when someone opens one of your files.")
I'm not sure i know enough Carbon and/or Cocoa to make this but if you wish too i'm ready to try, i'd just need help with the JNI bits
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Aug 3rd 2008 at 12:56 AM |
|
|
For more info see :
* http://developer.apple.com/documentation/AppleScript/Conceptual/AppleEvents/intro_aepg/chapter_1_section_1.html
* http://en.wikipedia.org/wiki/AppleEvents
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 3rd 2008 at 3:58 PM |
|
|
Hi,
Don't worry about JNI steps. i can do that, and all Java clases.
I can invoke a native function like:
init( jni_struct* );
And then i can invoke a "java" method on a funcion like:
open_file( jni_struct*, filename );
The only needed, is keep that "jni_struct" where some vars like "JNIEnv*" and "jobject" are needed to make the callback function to java.
If you take a look, on the coreaudio plugin
the commented function "[prefix]_findDevices" was calling a java method.
By other hand, Watching to the azureus code, it seems be more easy than what i thougth.
It seems, SWT already have methods to register the events ( so we don't need to change nothing on SWT itself)
The native code what it have, seems be used later, when event was allready fired.
I'll try to make a little test plugin based on that code, with any "alert dialog" show when event is fired.
If it work, so the only needed will be get the "filename" from the event.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 3rd 2008 at 5:50 PM |
|
|
Can you test what happend with it ?
Try install "tuxguitar-carbon-integration.jar" on "/MacOS/share/plugins"
http://tuxguitar.svn.sourceforge.net/viewvc/tuxguitar/trunk/TuxGuitar/tmp/tuxguitar-carbon-integration.jar
And "libOSXAccess.jnilib" on "/MacOS/lib"
http://tuxguitar.svn.sourceforge.net/viewvc/tuxguitar/trunk/TuxGuitar/tmp/libOSXAccess.jnilib
If all is ok, it must show a dialog message when you attempt to open a file.
|
|
| Back to Top |
| |
|
Grandmasta Bu
|
|
Post:
Sep 3rd 2008 at 7:12 AM |
|
|
Hey Guys,
I downloaded the files you mentioned but I don't really know, where to install them.
When I open my HD I see the folders "Users", "Developer", "Library", "Applications" and "System". I thougt maybe with /MacOS you ment the System-folder, but in there is only the folder "Library".
BTW I use MacOS 10.5.4...
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Sep 3rd 2008 at 11:49 AM |
|
|
When i say /MacOS/xxx i talk about the ".dmg" file contents.
I don't know how to explore it because i don't have a Mac.
but i think if you make click on the .dmg file you have an option to show it contents.
By the way, you'll need to rebuild tuxguitar, or manually edit info.plist (also in .dmg file) to tell carbon, that tuxguitar will open .tg,.gp3,.gp4,.gp5,etc... files
|
|
| Back to Top |
| |
|
Grandmasta Bu
|
|
Post:
Sep 5th 2008 at 7:01 AM |
|
|
Ah...ok: that one I got. I opened the installed application, which is a "package" (I'm translating from german) by right-clicking on it and then clicking on "show package contents". A folder opened containing a folder called "Content" and inside that folder there where everything you mentioned.
But I don't know how to "rebuild" the application. I found the info.plist but i don't know where to put filenames in
|
|
| Back to Top |
| |
|
cheap watch
|
|