📄 messageslideshell.java
字号:
lblCloseIn.setForeground(colorFG);
lblCloseIn.setText("\n");
gridData = new GridData(4, 128, true, false);
gridData.horizontalSpan = 3;
lblCloseIn.setLayoutData(gridData);
final Composite cButtons = new Composite(cShell, 0);
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
gridLayout.verticalSpacing = 0;
if (Constants.isOSX)
gridLayout.horizontalSpacing = 0;
gridLayout.numColumns = idxHistory <= 0 ? 2 : 3;
cButtons.setLayout(gridLayout);
gridData = new GridData(132);
gridData.horizontalSpan = 3;
cButtons.setLayoutData(gridData);
btnHideAll = new Button(cButtons, 8);
Messages.setLanguageText(btnHideAll, "popup.error.hideall");
btnHideAll.setVisible(false);
btnHideAll.setForeground(display.getSystemColor(2));
btnHideAll.addListener(4, new Listener() {
final Composite val$cButtons;
final MessageSlideShell this$0;
public void handleEvent(Event arg0)
{
cButtons.setEnabled(false);
shell.dispose();
}
{
this$0 = MessageSlideShell.this;
cButtons = composite;
super();
}
});
if (idxHistory > 0)
{
Button btnPrev = new Button(cButtons, 8);
btnPrev.setForeground(display.getSystemColor(2));
btnPrev.setText(MessageText.getString("popup.previous", new String[] {
(new StringBuilder()).append("").append(idxHistory).toString()
}));
btnPrev.addListener(4, new Listener() {
final PopupParams val$popupParams;
final Display val$display;
final MessageSlideShell this$0;
public void handleEvent(Event arg0)
{
disposeShell(shell);
int idx = MessageSlideShell.historyList.indexOf(popupParams) - 1;
if (idx >= 0)
{
PopupParams item = (PopupParams)MessageSlideShell.historyList.get(idx);
showPopup(display, item, false);
disposeShell(shell);
}
}
{
this$0 = MessageSlideShell.this;
popupParams = popupparams;
display = display1;
super();
}
});
}
btnNext = new Button(cButtons, 8);
btnNext.setForeground(display.getSystemColor(2));
int numAfter = historyList.size() - idxHistory - 1;
setButtonNextText(numAfter);
btnNext.addListener(4, new Listener() {
final Display val$display;
final MessageSlideShell this$0;
public void handleEvent(Event arg0)
{
if (idxHistory + 1 < MessageSlideShell.historyList.size())
showPopup(display, (PopupParams)MessageSlideShell.historyList.get(idxHistory + 1), false);
disposeShell(shell);
}
{
this$0 = MessageSlideShell.this;
display = display1;
super();
}
});
Point bestSize = cShell.computeSize(shellWidth, -1);
if (bestSize.y < 150)
bestSize.y = 150;
else
if (bestSize.y > 330)
{
bestSize.y = 330;
if (sDetails == null)
sDetails = popupParams.text;
else
sDetails = (new StringBuilder()).append(popupParams.text).append("\n===============\n").append(sDetails).toString();
}
if (imgPopup != null)
{
int bottomHeight = cButtons.computeSize(-1, -1).y + lblCloseIn.computeSize(-1, -1).y;
if (bottomHeight < 50)
bestSize.y += 50 - bottomHeight;
final Image imgBackground = new Image(display, bestSize.x, bestSize.y);
disposeList.add(imgBackground);
GC gc = new GC(imgBackground);
int dstY = imgPopupBounds.height - bestSize.y;
if (dstY < 0)
dstY = 0;
gc.drawImage(imgPopup, 0, dstY, imgPopupBounds.width, imgPopupBounds.height - dstY, 0, 0, bestSize.x, bestSize.y);
gc.dispose();
boolean bAlternateDrawing = true;
if (USE_SWT32_BG_SET)
try
{
this.shell.setBackgroundImage(imgBackground);
bAlternateDrawing = false;
}
catch (NoSuchMethodError e) { }
if (bAlternateDrawing)
{
cShell.addPaintListener(new PaintListener() {
final Image val$imgBackground;
final MessageSlideShell this$0;
public void paintControl(PaintEvent e)
{
e.gc.drawImage(imgBackground, e.x, e.y, e.width, e.height, e.x, e.y, e.width, e.height);
}
{
this$0 = MessageSlideShell.this;
imgBackground = image;
super();
}
});
Color colorBG = display.getSystemColor(22);
final RGB bgRGB = colorBG.getRGB();
PaintListener paintListener = new PaintListener() {
boolean alreadyPainting;
final Display val$display;
final Image val$imgBackground;
final RGB val$bgRGB;
final MessageSlideShell this$0;
public void paintControl(PaintEvent e)
{
if (alreadyPainting || e.width <= 0 || e.height <= 0)
return;
alreadyPainting = true;
Rectangle bounds = ((Control)e.widget).getBounds();
Image img = new Image(display, e.width, e.height);
e.gc.copyArea(img, e.x, e.y);
e.gc.drawImage(imgBackground, -bounds.x, -bounds.y);
ImageData data = img.getImageData();
data.transparentPixel = data.palette.getPixel(bgRGB);
Image imgTransparent = new Image(display, data);
e.gc.drawImage(imgTransparent, 0, 0, e.width, e.height, e.x, e.y, e.width, e.height);
img.dispose();
imgTransparent.dispose();
alreadyPainting = false;
break MISSING_BLOCK_LABEL_195;
Exception exception1;
exception1;
alreadyPainting = false;
throw exception1;
}
{
this$0 = MessageSlideShell.this;
display = display1;
imgBackground = image;
bgRGB = rgb;
super();
alreadyPainting = false;
}
};
this.shell.setBackground(colorBG);
cShell.setBackground(colorBG);
addPaintListener(cShell, paintListener, colorBG, true);
}
}
Rectangle bounds = null;
try
{
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null)
{
Shell mainShell = uiFunctions.getMainShell();
if (mainShell != null)
bounds = mainShell.getMonitor().getClientArea();
} else
{
Shell shell = display.getActiveShell();
if (shell != null)
bounds = shell.getMonitor().getClientArea();
}
if (bounds == null)
bounds = this.shell.getMonitor().getClientArea();
}
catch (Exception e) { }
if (bounds == null)
bounds = display.getClientArea();
Rectangle endBounds;
if (bDisableSliding)
{
endBounds = new Rectangle((bounds.x + bounds.width) / 2 - bestSize.x / 2, (bounds.y + bounds.height) / 2 - bestSize.y / 2, bestSize.x, bestSize.y);
} else
{
int boundsX2 = bounds.x + bounds.width;
int boundsY2 = bounds.y + bounds.height;
endBounds = this.shell.computeTrim(boundsX2 - bestSize.x, boundsY2 - bestSize.y, bestSize.x, bestSize.y);
int diff = (endBounds.x + endBounds.width) - boundsX2;
if (diff >= 0)
endBounds.x -= diff + 0;
diff = (endBounds.y + endBounds.height) - boundsY2;
if (diff >= 0)
endBounds.y -= diff + 0;
}
FormData data = new FormData(bestSize.x, bestSize.y);
cShell.setLayoutData(data);
btnDetails.setVisible(sDetails != null);
if (sDetails == null)
{
gridData = new GridData();
gridData.widthHint = 0;
btnDetails.setLayoutData(gridData);
}
this.shell.layout();
btnNext.setFocus();
this.shell.addDisposeListener(new DisposeListener() {
final MessageSlideShell this$0;
public void widgetDisposed(DisposeEvent e)
{
Utils.disposeSWTObjects(disposeList);
if (MessageSlideShell.currentPopupIndex != idxHistory)
break MISSING_BLOCK_LABEL_52;
MessageSlideShell.monitor.enter();
MessageSlideShell.currentPopupIndex = -1;
MessageSlideShell.monitor.exit();
break MISSING_BLOCK_LABEL_52;
Exception exception1;
exception1;
MessageSlideShell.monitor.exit();
throw exception1;
}
{
this$0 = MessageSlideShell.this;
super();
}
});
this.shell.addListener(31, new Listener() {
final MessageSlideShell this$0;
public void handleEvent(Event event)
{
if (event.detail == 2)
{
disposeShell(shell);
event.doit = false;
}
}
{
this$0 = MessageSlideShell.this;
super();
}
});
if (mouseAdapter != null)
addMouseTrackListener(this.shell, mouseAdapter);
for (int i = 0; i < listeners.length; i++)
try
{
listeners[i].skinAfterComponents(this.shell, this, popupParams.relatedTo);
}
catch (Exception e)
{
Debug.out(e);
}
int timeoutSecs;
if (popupParams.timeoutSecs < 0)
timeoutSecs = COConfigurationManager.getIntParameter("Message Popup Autoclose in Seconds");
else
timeoutSecs = popupParams.timeoutSecs;
runPopup(endBounds, idxHistory, bSlide, timeoutSecs);
return;
}
private void createLinkLabel(final Composite shell, final PopupParams popupParams)
{
final Canvas canvas = new Canvas(0, popupParams) {
final PopupParams val$popupParams;
final MessageSlideShell this$0;
public Point computeSize(int wHint, int hHint, boolean changed)
{
Rectangle area = new Rectangle(0, 0, shellWidth, 5000);
GC gc = new GC(this);
GCStringPrinter sp = new GCStringPrinter(gc, popupParams.text, area, true, false, 192);
sp.calculateMetrics();
gc.dispose();
Point size = sp.getCalculatedSize();
return size;
}
{
this$0 = MessageSlideShell.this;
popupParams = popupparams;
super(x0, x1);
}
};
Listener l = new Listener() {
GCStringPrinter sp;
final Canvas val$canvas;
final PopupParams val$popupParams;
final MessageSlideShell this$0;
public void handleEvent(Event e)
{
if (e.type == 9)
{
Rectangle area = canvas.getClientArea();
sp = new GCStringPrinter(e.gc, popupParams.text, area, true, false, 192);
sp.setUrlColor(ColorCache.getColor(e.gc.getDevice(), "#0000ff"));
if (colorURL != null)
sp.setUrlColor(colorURL);
if (colorFG != null)
e.gc.setForeground(colorFG);
sp.printString();
} else
if (e.type == 5)
{
if (sp != null)
{
GCStringPrinter.URLInfo hitUrl = sp.getHitUrl(e.x, e.y);
if (hitUrl != null)
{
canvas.setCursor(canvas.getDisplay().getSystemCursor(21));
canvas.setToolTipText(hitUrl.url);
} else
{
canvas.setCursor(canvas.getDisplay().getSystemCursor(0));
canvas.setToolTipText(null);
}
}
} else
if (e.type == 4 && sp != null)
{
GCStringPrinter.URLInfo hitUrl = sp.getHitUrl(e.x, e.y);
if (hitUrl != null && !hitUrl.url.startsWith(":"))
Utils.launch(hitUrl.url);
}
}
{
this$0 = MessageSlideShell.this;
canvas = canvas1;
popupParams = popupparams;
super();
}
};
canvas.addListener(9, l);
canvas.addListener(5, l);
canvas.addListener(4, l);
ClipboardCopy.addCopyToClipMenu(canvas, new org.gudy.azureus2.ui.swt.mainwindow.ClipboardCopy.copyToClipProvider() {
final PopupParams val$popupParams;
final MessageSlideShell this$0;
public String getText()
{
return (new StringBuilder()).append(popupParams.title).append("\n\n").append(popupParams.text).toString();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -