 |
 |
 |
 |
|
 |
 |
Problems
| Author |
Message |
|
Herak Sen
|
|
Post:
Jul 4th 2008 at 12:24 AM |
|
|
Hi,
Its strange that the menu says "SWT"(guess coz its developed using SWT), it should say TuxGuitar, also the "setting" under "Tool" should be called Prefernces... as per Mac OS UI guidelines
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Jul 4th 2008 at 10:35 PM |
|
|
The "SWT" menu, is added by "SWT"
the first tuxguitar menu is called "File" (ofcourse on english translation)
|
|
| Back to Top |
| |
|
Herak Sen
|
|
Post:
Aug 14th 2008 at 1:45 AM |
|
|
Add the following line in TuxGuitar::displayGUI
Display.setAppName("TuxGuitar");
before
this.display = new Display();
This way "SWT" would not be displayed
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 15th 2008 at 12:22 AM |
|
|
So, that change the item name. thanks i'll add it.
By the way, the most problem with that item, is when you close the application.
For any reason SWT don't send the CloseListener event to tuxguitar, so there is no question dialog for unsaved files.
|
|
| Back to Top |
| |
|
Herak Sen
|
|
Post:
Aug 15th 2008 at 2:29 AM |
|
|
yeah i noticed that problem.
I think its because of the key bindings.
I was wondering if you can give me the access to CVS so that I can directly contribute?
thx
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 15th 2008 at 9:25 AM |
|
|
> think its because of the key bindings.
i don't think so.
KeyBidings may have sence only with "Key" events.
but they are definitly not used with a Shell event if fired.
There is an event called:
ShellListener.shellClosed(ShellEvent event)
This event is must be called by SWT when the window attempt to close.
So you, as Developer can do:
// If user canceled operation
event.doit = false;
But if tuxguitar don't receibe the event
it's imposible to know when a shell will be closed and try to cancel the operation
> I was wondering if you can give me the access to CVS..
Please, understand that i can't do that now.
Don't take it as bad, but i don't know you
people who have access (for this or other project), is because they worked first some time without it.
and then we can know who is he, and trust or not.
Just think what can happen if i give access to every people who ask me.
By other way, this bug must be fixed on SWT, so is SWT who receive events from native library (Carbon on Mac) and send it to Java applications.
|
|
| Back to Top |
| |
|
Herak Sen
|
|
Post:
Aug 15th 2008 at 7:54 PM |
|
|
yeah i understand that you may not want people to commit code, may be you can set up something issue tracker where we can submit patches etc.
Also for window closing event i wonder how eclipse does it? It always shows the save dialog before quitting. Anyways let me try few things , I'll let you know if I come up with something
btw the app is really cool (especially for mac owners)
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 15th 2008 at 8:11 PM |
|
|
> Also for window closing event i wonder how eclipse does it?
Not under windows only
it's the SWT Api itself
just it seems don't work if you close from first menu item of Mac, but it work on other places.
Take a look to: "File -> Exit"
That "Exit" calls only to "Shell.close()", and SWT call fire the event.
Another way under Windows, and GNU/Linux is with the close button "x".
it also fire the event.
The main problem, is you need that event to cancel operation.
ShellEvent have a flag called "doit"
If you receibe that event, and do : "event.doit = false" shell keep alive (otherwise application finish).
|
|
| Back to Top |
| |
|
Herak Sen
|
|
Post:
Aug 17th 2008 at 12:53 AM |
|
|
Hi Julian,
I searched for the problem on google and and came with a code snippet . I have added few lines to that and guess it should work.
Used the following code to test it
TuxGuitar::displayGUI
MacMenu.hookApplicationMenu(display, shell);
after this.shell = new Shell(getDisplay());
----------------------------------------------------------
package org.herac.tuxguitar.gui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.internal.Callback;
import org.eclipse.swt.internal.carbon.HICommand;
import org.eclipse.swt.internal.carbon.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
public class MacMenu {
private static final int kHICommandPreferences=
('p' << 24) + ('r' << 16) + ('e' << 8) + 'f';
private static final int kHICommandAbout=
('a' << 24) + ('b' << 16) + ('o' << 8) + 'u';
private static final int kHICommandServices=
('s' << 24) + ('e' << 16) + ('r' << 8) + 'v';
private static final int kHIQuitServices=
('q' << 24) + ('u' << 16) + ('i' << 8) + 't';
public static void hookApplicationMenu(Display display,final Shell shell)
{
final String aboutName = "About";
final String preference = "Preferences";
// Callback target
Object target= new Object() {
int commandProc(int nextHandler, int theEvent, int userData) {
if (OS.GetEventKind(theEvent) == OS.kEventProcessCommand) {
HICommand command= new HICommand();
OS.GetEventParameter(theEvent,
OS.kEventParamDirectObject, OS.typeHICommand, null,
HICommand.sizeof, null, command);
switch (command.commandID) {
case kHICommandPreferences:
return handleCommand(preference); //$NON-NLS-1$
case kHICommandAbout:
return handleCommand(aboutName);
case kHIQuitServices:
return handleQuitCommand();
default:
System.out.println(OS.GetEventKind(theEvent));
break;
}
}
return OS.eventNotHandledErr;
}
int handleCommand(String command) {
MessageBox preferences= new MessageBox(shell,
SWT.ICON_WARNING);
preferences.setText(command);
preferences.open();
return OS.noErr;
}
int handleQuitCommand() {
MessageBox messageBox = new MessageBox(shell, SWT.APPLICATION_MODAL | SWT.YES | SWT.NO);
messageBox.setText("Warning");
messageBox.setMessage("You have unsaved data. Save changes?");
return messageBox.open() == SWT.YES?OS.eventNotHandledErr:OS.noErr;
}
};
final Callback commandCallback= new Callback(target,
"commandProc", 3); //$NON-NLS-1$
int commandProc= commandCallback.getAddress();
if (commandProc == 0) {
commandCallback.dispose();
return; // give up
}
// Install event handler for commands
int[] mask= new int[] { OS.kEventClassCommand,
OS.kEventProcessCommand};
OS.InstallEventHandler(OS.GetApplicationEventTarget(), commandProc,
mask.length / 2, mask, 0, null);
// create About ... menu command
int[] outMenu= new int[1];
short[] outIndex= new short[1];
if (OS.GetIndMenuItemWithCommandID(0, kHICommandPreferences, 1,
outMenu, outIndex) == OS.noErr && outMenu[0] != 0) {
int menu= outMenu[0];
int l= aboutName.length();
char buffer[]= new char[l];
aboutName.getChars(0, l, buffer, 0);
int str= OS.CFStringCreateWithCharacters(OS.kCFAllocatorDefault,
buffer, l);
OS.InsertMenuItemTextWithCFString(menu, str, (short) 0, 0,
kHICommandAbout);
OS.CFRelease(str);
// add separator between About & Preferences
OS.InsertMenuItemTextWithCFString(menu, 0, (short) 1,
OS.kMenuItemAttrSeparator, 0);
// enable pref menu
OS.EnableMenuCommand(menu, kHICommandPreferences);
// disable services menu
OS.DisableMenuCommand(menu, kHICommandServices);
}
// schedule disposal of callback object
display.disposeExec(new Runnable() {
public void run() {
commandCallback.dispose();
}
});
}
}
|
|
| Back to Top |
| |
|
Herak Sen
|
|
Post:
Aug 17th 2008 at 12:55 AM |
|
|
|
since it uses low level API and would only work for Mac , guess you have change the build file to conditionally include this code
|
|
| Back to Top |
| |
|
Auria
|
|
Post:
Aug 18th 2008 at 2:08 AM |
|
|
|
Looks good, though i think it would be better to fix SWT than to fill TuxGuitar with workarounds. Maybe this could go in the carbon-intergration plugin though.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 18th 2008 at 11:58 PM |
|
|
Herak Sen, as Auria told, it should be integrated on TuxGuitar-carbon-integration plugin ( It's a new plugin, see it on SVN), because tuxguitar is multiplatform, and low level SWT classes may don't work under other OS.
So, does this code make SWT to fire the "shellClosed" event ?
|
|
| Back to Top |
| |
|
Herak Sen
|
|
Post:
Aug 19th 2008 at 1:00 AM |
|
|
Hi Julian
Yeah it fires the handlers on Quit,About and Preference event
You can test it
I tested by adding MacMenu.hookApplicationMenu(display, shell to TuxGuitar::displayGUI.
Herak
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 19th 2008 at 11:46 AM |
|
|
Hi Herak,
I can't test it myself because i don't have a macOS.
So i only can look the code, and add it to the plugin.
Can you test plugin ?
* Copy "tuxguitar-carbon-integration.jar" to share/plugins
http://tuxguitar.svn.sourceforge.net/viewvc/tuxguitar/trunk/TuxGuitar-carbon-integration/tuxguitar-carbon-integration.jar
* Copy "libtuxguitar-carbon-integration.jnilib" to lib/ folder
http://tuxguitar.svn.sourceforge.net/viewvc/tuxguitar/trunk/TuxGuitar-carbon-integration/jni/libtuxguitar-carbon-integration.jnilib
Let me know what happened.
Cheers
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 19th 2008 at 11:52 AM |
|
|
I forgot to say,
ofcourse you should try it with original tuxguitar.jar (or comment your changes to it) to be sure "tuxguitar-carbon-integration" plugin is who is listening the events now.
|
|
| Back to Top |
| |
|
Herak Sen
|
|
Post:
Aug 20th 2008 at 1:54 AM |
|
|
Hi Julian
Just update the following lines
return of handleQuit to return OS.noErr; // line 111
and
private static final String ABOUT_NAME = "About";
to
private static final String ABOUT_NAME = "About TuxGuitar";
as per Mac UI
I just tested it with these changes and it works :)
cheers
Herak
|
|
| Back to Top |
| |
|
Herak Sen
|
|
Post:
Aug 20th 2008 at 2:02 AM |
|
|
I guess there is not need to pass the display and the shell object to hookApplicationMenu as it can be obtained from TuxGuitar.instance() method.
Also there is a need to now associate file types with teh app such that the files open on double clicking them.
Herak
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Aug 20th 2008 at 11:32 AM |
|
|
Hi,
> return of handleQuit to return OS.noErr; // line 111
Ok, i didn't sure about it.. added now
> Also there is a need to now associate file types with teh app such that the files open on double clicking them.
It was done on SVN version. You need to use ant to "rebuild" it. and the new "info.plist" will be generated with mimetype assosiations.
Please, send me a mail from Contact section of the web, let me know some of your personal info to add you as author.
Thanks
|
|
| Back to Top |
| |
|
Anonymous
|
|
Post:
Feb 22nd 2012 at 3:23 AM |
|
|
|
LF-The coast clothing is well-known brands, and also the world's most famous genuine ugg boots brand. Sold in the UK market is the United States, coast dresses uk, and are made in China. All sheep wool of fine workmanship, even in summer wear coast dresses will not feel hot. Sand and chestnut color is the most popular color, mid-counter sale of stock. There is also a concept; "Ugg boots uk" Australia produced it? coast dress most of the models are made ??in China, a small number of Coast Halter Dresses manufactured in New Zealand. But one thing to note: the United States ugg boots Useful.
|
|
| Back to Top |
| |
|
weining
|
|
| Back to Top |
| |
|
New Jordan
|
|
Post:
Apr 2nd 2012 at 6:57 AM |
|
|
|
Nowadays this high-end technology has been applied to the Cool Jordan Shoes Turbo which has gained an increasing popularity among the enthusiastic sneaker collectors all over the world.The well-received Fashion Jordan 1 Turbo is a shoe with a small amount of construction of cushion that gives it the idea support and light weight feel to it. It also features New Jordan Shoes technology for optimum cushioning and comfort.
|
|
| Back to Top |
| |
Post Reply
|
 |
 |
 |
 |
|