~smaioli/azureus/ubuntu-experimental

« back to all changes in this revision

Viewing changes to org/gudy/azureus2/ui/swt/help/AboutWindow.java

MergedĀ VuzeĀ 4.2.0.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
package org.gudy.azureus2.ui.swt.help;
22
22
 
23
 
import com.aelitis.azureus.core.versioncheck.VersionCheckClient;
 
23
import java.util.Properties;
 
24
 
24
25
import org.eclipse.swt.SWT;
25
26
import org.eclipse.swt.custom.CLabel;
26
 
import org.eclipse.swt.events.MouseAdapter;
27
 
import org.eclipse.swt.events.MouseEvent;
28
 
import org.eclipse.swt.events.DisposeListener;
29
 
import org.eclipse.swt.events.DisposeEvent;
 
27
import org.eclipse.swt.events.*;
30
28
import org.eclipse.swt.graphics.GC;
31
29
import org.eclipse.swt.graphics.Image;
32
30
import org.eclipse.swt.graphics.Point;
33
31
import org.eclipse.swt.layout.GridData;
34
32
import org.eclipse.swt.layout.GridLayout;
35
33
import org.eclipse.swt.widgets.*;
 
34
 
36
35
import org.gudy.azureus2.core3.config.COConfigurationManager;
37
36
import org.gudy.azureus2.core3.internat.MessageText;
38
37
import org.gudy.azureus2.core3.util.*;
39
 
import org.gudy.azureus2.ui.swt.ImageRepository;
40
38
import org.gudy.azureus2.ui.swt.Messages;
41
39
import org.gudy.azureus2.ui.swt.Utils;
42
40
import org.gudy.azureus2.ui.swt.components.shell.ShellFactory;
43
 
import org.gudy.azureus2.ui.swt.mainwindow.Colors;
44
 
import org.gudy.azureus2.ui.swt.mainwindow.Cursors;
 
41
import org.gudy.azureus2.ui.swt.mainwindow.*;
45
42
 
46
 
import java.util.Properties;
 
43
import com.aelitis.azureus.core.versioncheck.VersionCheckClient;
 
44
import com.aelitis.azureus.ui.swt.imageloader.ImageLoader;
47
45
 
48
46
/**
49
47
 * @author Olivier
50
48
 *
51
49
 */
52
50
public class AboutWindow {
 
51
        private final static String IMG_SPLASH = "azureus_splash";
53
52
 
54
53
  static Image image;
55
54
  static AEMonitor      class_mon       = new AEMonitor( "AboutWindow" );
80
79
    GridData gridData;
81
80
    window.setLayout(new GridLayout(3, false));
82
81
 
83
 
    image = ImageRepository.getImage("azureus_splash");
84
 
    int w = image.getBounds().width;
85
 
    int ow = w;
86
 
    if (w > 350) {
87
 
        w = 350;
88
 
    }
89
 
    int h = image.getBounds().height;
90
 
    h = 220;
91
 
    imgSrc = new Image(display, w, h);
92
 
    GC gc = new GC(imgSrc);
93
 
    gc.drawImage(image, (w - ow) / 2, 0);
94
 
    gc.dispose();
95
 
    
96
 
    Image imgGray = new Image(display,
97
 
                                ImageRepository.getImage("azureus_splash"), SWT.IMAGE_GRAY);
98
 
    gc = new GC(imgGray);
99
 
    if (Constants.isOSX) {
100
 
        gc.drawImage(imgGray, (w - ow) / 2, 0);
101
 
    } else {
102
 
        gc.copyArea(0, 0, ow, h, (w - ow) / 2, 0);
103
 
    }
104
 
    gc.dispose();
105
 
    
106
 
    Image image2 = new Image(display, w, h);
107
 
    gc = new GC(image2);
108
 
    gc.setBackground(Colors.black);
109
 
    gc.fillRectangle(image2.getBounds());
110
 
    gc.dispose();
111
 
    image = Utils.renderTransparency(display, image2, imgGray, new Point(0, 0), 180);
112
 
    image2.dispose();
113
 
    imgGray.dispose();
 
82
    ImageLoader imageLoader = ImageLoader.getInstance();
 
83
    image = imageLoader.getImage(IMG_SPLASH);
 
84
    if (image != null) {
 
85
      int w = image.getBounds().width;
 
86
      int ow = w;
 
87
      if (w > 350) {
 
88
        w = 350;
 
89
      }
 
90
      int h = image.getBounds().height;
 
91
      h = 220;
 
92
      imgSrc = new Image(display, w, h);
 
93
      GC gc = new GC(imgSrc);
 
94
      gc.drawImage(image, (w - ow) / 2, 0);
 
95
      gc.dispose();
 
96
      
 
97
      Image imgGray = new Image(display, imageLoader.getImage(IMG_SPLASH),
 
98
                                        SWT.IMAGE_GRAY);
 
99
      imageLoader.releaseImage(IMG_SPLASH);
 
100
      gc = new GC(imgGray);
 
101
      if (Constants.isOSX) {
 
102
        gc.drawImage(imgGray, (w - ow) / 2, 0);
 
103
      } else {
 
104
        gc.copyArea(0, 0, ow, h, (w - ow) / 2, 0);
 
105
      }
 
106
      gc.dispose();
 
107
      
 
108
      Image image2 = new Image(display, w, h);
 
109
      gc = new GC(image2);
 
110
      gc.setBackground(Colors.black);
 
111
      gc.fillRectangle(image2.getBounds());
 
112
      gc.dispose();
 
113
      image = Utils.renderTransparency(display, image2, imgGray, new Point(0, 0), 180);
 
114
      image2.dispose();
 
115
      imgGray.dispose();
 
116
    }
 
117
    imageLoader.releaseImage(IMG_SPLASH);
114
118
    
115
119
    Group gDevelopers = new Group(window, SWT.NULL);
116
120
    gDevelopers.setLayout(new GridLayout());
168
172
                                + System.getProperty("os.name") + " v"
169
173
                                + System.getProperty("os.version") + ", "
170
174
                                + System.getProperty("os.arch") + "\n"
171
 
                                + Constants.APP_NAME.charAt(0) + Constants.AZUREUS_VERSION + " " + VersionCheckClient.azconst_avail + " " + COConfigurationManager.getStringParameter("ui"));
 
175
                                + Constants.APP_NAME.charAt(0) + Constants.AZUREUS_VERSION + " " + COConfigurationManager.getStringParameter("ui"));
172
176
    txtSysInfo.setLayoutData(gridData = new GridData(GridData.FILL_BOTH));
173
177
    if (window.getCaret() != null)
174
178
        window.getCaret().setVisible(false);
273
277
  {
274
278
        try{
275
279
                class_mon.enter();
276
 
      ImageRepository.unloadImage("azureus_splash");
277
280
            if(image != null && ! image.isDisposed())
278
281
              image.dispose();
279
282
            image = null;
286
289
        }
287
290
  }
288
291
 
 
292
  public static void main(String[] args) {
 
293
        try {
 
294
                new Display();
 
295
                Colors.getInstance();
 
296
                        SWTThread.createInstance(null);
 
297
                        show(Display.getCurrent());
 
298
                } catch (SWTThreadAlreadyInstanciatedException e) {
 
299
                        // TODO Auto-generated catch block
 
300
                        e.printStackTrace();
 
301
                }
 
302
        }
289
303
}