📄 carbonuienhancer.java
字号:
Debug.out("OSX: Could not find Callback 'quitApp'");
quitAppCallback.dispose();
} else
{
result = OS.AEInstallEventHandler(0x61657674, 0x71756974, quitAppProc, 0, false);
if (result != 0)
Debug.out((new StringBuilder()).append("OSX: Could not install QuitApplication Event Handler. Error: ").append(result).toString());
}
int appTarget = OS.GetApplicationEventTarget();
Callback appleEventCallback = new Callback(this, "appleEventProc", 3);
int appleEventProc = appleEventCallback.getAddress();
int mask3[] = {
0x65707063, 1, 0x4755524c, 0x72617070, 0x6f636f6e
};
result = OS.InstallEventHandler(appTarget, appleEventProc, mask3.length / 2, mask3, 0, null);
if (result != 0)
{
Debug.out((new StringBuilder()).append("OSX: Could Install Event Handler. Error: ").append(result).toString());
return;
} else
{
return;
}
}
public void earlyStartup()
{
final Display display = Display.getDefault();
display.syncExec(new AERunnable() {
final Display val$display;
final CarbonUIEnhancer this$0;
public void runSupport()
{
hookApplicationMenu(display);
}
{
this$0 = CarbonUIEnhancer.this;
display = display1;
super();
}
});
}
public void hookApplicationMenu(final Display display)
{
Object target = new Object() {
final Display val$display;
final CarbonUIEnhancer this$0;
int commandProc(int nextHandler, int theEvent, int userData)
{
if (OS.GetEventKind(theEvent) == 1)
{
HICommand command = new HICommand();
OS.GetEventParameter(theEvent, 0x2d2d2d2d, 0x68636d64, null, 14, null, command);
switch (command.commandID)
{
case 1886545254:
{
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null)
uiFunctions.openView(4, null);
return 0;
}
case 1633841013:
{
AboutWindow.show(display);
return 0;
}
case 1635414643:
{
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null)
uiFunctions.dispose(true, false);
return 0;
}
case 1635410798:
{
new ConfigureWizard(AzureusCoreFactory.getSingleton(), false);
return 0;
}
case 1635413620:
{
new NatTestWindow();
return 0;
}
case 1635414900:
{
new SpeedTestWizard(AzureusCoreFactory.getSingleton(), display);
return 0;
}
case 1903520116:
{
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null)
{
uiFunctions.dispose(false, false);
return 0;
}
UIExitUtilsSWT.setSkipCloseCheck(true);
break;
}
}
}
return -9874;
}
{
this$0 = CarbonUIEnhancer.this;
display = display1;
super();
}
};
final Callback commandCallback = new Callback(target, "commandProc", 3);
int commandProc = commandCallback.getAddress();
if (commandProc == 0)
{
commandCallback.dispose();
return;
}
int mask[] = {
0x636d6473, 1
};
OS.InstallEventHandler(OS.GetApplicationEventTarget(), commandProc, mask.length / 2, mask, 0, null);
int outMenu[] = new int[1];
short outIndex[] = new short[1];
if (OS.GetIndMenuItemWithCommandID(0, 0x70726566, 1, outMenu, outIndex) == 0 && outMenu[0] != 0)
{
int menu = outMenu[0];
int l = fgAboutActionName.length();
char buffer[] = new char[l];
fgAboutActionName.getChars(0, l, buffer, 0);
int str = OS.CFStringCreateWithCharacters(0, buffer, l);
OS.InsertMenuItemTextWithCFString(menu, str, (short)0, 0, 0x61626f75);
OS.CFRelease(str);
OS.InsertMenuItemTextWithCFString(menu, 0, (short)1, 64, 0);
OS.EnableMenuCommand(menu, 0x70726566);
OS.DisableMenuCommand(menu, 0x73657276);
if (!isAZ3)
{
l = fgWizardActionName.length();
buffer = new char[l];
fgWizardActionName.getChars(0, l, buffer, 0);
str = OS.CFStringCreateWithCharacters(0, buffer, l);
OS.InsertMenuItemTextWithCFString(menu, str, (short)3, 0, 0x617a636e);
OS.CFRelease(str);
l = fgNatTestActionName.length();
buffer = new char[l];
fgNatTestActionName.getChars(0, l, buffer, 0);
str = OS.CFStringCreateWithCharacters(0, buffer, l);
OS.InsertMenuItemTextWithCFString(menu, str, (short)4, 0, 0x617a6e74);
OS.CFRelease(str);
l = fgSpeedTestActionName.length();
buffer = new char[l];
fgSpeedTestActionName.getChars(0, l, buffer, 0);
str = OS.CFStringCreateWithCharacters(0, buffer, l);
OS.InsertMenuItemTextWithCFString(menu, str, (short)5, 0, 0x617a7374);
OS.CFRelease(str);
}
OS.InsertMenuItemTextWithCFString(menu, 0, (short)6, 64, 0);
l = fgRestartActionName.length();
buffer = new char[l];
fgRestartActionName.getChars(0, l, buffer, 0);
str = OS.CFStringCreateWithCharacters(0, buffer, l);
OS.InsertMenuItemTextWithCFString(menu, str, (short)7, 0, 0x617a7273);
OS.CFRelease(str);
OS.InsertMenuItemTextWithCFString(menu, 0, (short)8, 64, 0);
}
display.disposeExec(new AERunnable() {
final Callback val$commandCallback;
final CarbonUIEnhancer this$0;
public void runSupport()
{
commandCallback.dispose();
}
{
this$0 = CarbonUIEnhancer.this;
commandCallback = callback;
super();
}
});
}
private static void stopSidekick()
{
try
{
Runtime.getRuntime().exec(new String[] {
"osascript", "-e", "tell application \"Azureus\" to quit"
});
}
catch (IOException e)
{
Debug.printStackTrace(e);
}
}
int appleEventProc(int nextHandler, int theEvent, int userData)
{
int eventClass = OS.GetEventClass(theEvent);
if (eventClass == 0x65707063)
{
int aeEventID[] = new int[1];
if (OS.GetEventParameter(theEvent, 0x65767469, 0x74797065, null, 4, null, aeEventID) != 0)
return -9874;
if (aeEventID[0] != 0x6f646f63 && aeEventID[0] != 0x4755524c && aeEventID[0] != 0x72617070 && aeEventID[0] != 0x6f636f6e && aeEventID[0] != 0x71756974)
{
return -9874;
} else
{
EventRecord eventRecord = new EventRecord();
OS.ConvertEventRefToEventRecord(theEvent, eventRecord);
OS.AEProcessAppleEvent(eventRecord);
return 0;
}
} else
{
return -9874;
}
}
private static String OSXtoString(int i)
{
char c[] = new char[4];
c[0] = (char)(i >> 24 & 0xff);
c[1] = (char)(i >> 16 & 0xff);
c[2] = (char)(i >> 8 & 0xff);
c[3] = (char)(i & 0xff);
return new String(c);
}
private static void memmove(byte dest[], int src, int size)
{
switch (memmove_type)
{
case 0: // '\0'
try
{
OSXAccess.memmove(dest, src, size);
memmove_type = 0;
return;
}
catch (Throwable e) { }
// fall through
case 1: // '\001'
try
{
Class cMemMove = Class.forName("org.eclipse.swt.internal.carbon.OS");
Method method = cMemMove.getMethod("memmove", new Class[] {
[B, Integer.TYPE, Integer.TYPE
});
method.invoke(null, new Object[] {
dest, new Integer(src), new Integer(size)
});
memmove_type = 1;
return;
}
catch (Throwable e) { }
// fall through
case 2: // '\002'
try
{
Class cMemMove = Class.forName("org.eclipse.swt.internal.carbon.OS");
Method method = cMemMove.getMethod("memcpy", new Class[] {
[B, Integer.TYPE, Integer.TYPE
});
method.invoke(null, new Object[] {
dest, new Integer(src), new Integer(size)
});
memmove_type = 2;
return;
}
catch (Throwable e) { }
// fall through
default:
memmove_type = 3;
return;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -