1 /* 2 Gui.java - Turtle's User Interface 3 */ 4 5 import java.io.*; 6 import java.awt.*; 7 import java.awt.Color; 8 import java.awt.SystemColor; 9 import java.awt.event.*; 10 import javax.swing.*; 11 12 import se.datadosen.util.Item; 13 import se.datadosen.util.IO; 14 import se.datadosen.component.*; 15 import se.datadosen.jalbum.JCustomPanel; 16 import se.datadosen.jalbum.JAlbumContext; 17 import se.datadosen.jalbum.PluginContext; 18 import se.datadosen.jalbum.EditPanel; 19 import se.datadosen.jalbum.JAlbumWindow; 20 import se.datadosen.jalbum.SkinProperties; 21 import se.datadosen.jalbum.event.*; 22 import se.datadosen.jalbum.AccountManager; 23 import se.datadosen.jalbum.SignInManager; 24 import se.datadosen.jalbum.JAlbumSite; 25 26 import edu.stanford.ejalbert.BrowserLauncher; 27 28 public class Gui extends se.datadosen.jalbum.CompiledScript { 29 getPosition()30 private Object[] getPosition() { 31 return new Object[] { 32 new Item("left top", texts.getString("ui.bg_left_top")), 33 new Item("center top", texts.getString("ui.bg_center_top")), 34 new Item("right top", texts.getString("ui.bg_right_top")), 35 new Item("left middle", texts.getString("ui.bg_left_middle")), 36 new Item("center middle", texts.getString("ui.bg_center_middle")), 37 new Item("right middle", texts.getString("ui.bg_right_middle")), 38 new Item("left bottom", texts.getString("ui.bg_left_bottom")), 39 new Item("center bottom", texts.getString("ui.bg_center_bottom")), 40 new Item("right bottom", texts.getString("ui.bg_right_bottom")) 41 }; 42 } 43 getHighlightedColor(String s)44 private Color getHighlightedColor(String s) { 45 long[] rgb = {Integer.parseInt(s.substring(1, 3), 16), Integer.parseInt(s.substring(3, 5), 16), Integer.parseInt(s.substring(5, 7), 16)}; 46 int i; 47 if (((double) (3 * rgb[0] + 4 * rgb[1] + rgb[2]) / 2040) < 0.85D) { 48 for (i = 0; i < 3; i++) { 49 if (rgb[i] < 128) { 50 rgb[i] = Math.round(127 * Math.pow(((double) rgb[i]) / 127.0D, 2.0D)); 51 } else { 52 rgb[i] = Math.round(255 - 127 * Math.pow(((double) (255 - rgb[i])) / 127.0D, 2.0D)); 53 } 54 rgb[i] = Math.round(Math.floor(127 + rgb[i] * 0.5D)); 55 } 56 } else { 57 for (i = 0; i < 3; i++) { 58 rgb[i] = Math.round((double) rgb[i] * 0.8D); 59 } 60 } 61 return new Color((int) rgb[0], (int) rgb[1], (int) rgb[2]); 62 } 63 /* 64 private String getThemeImageSize() { 65 String[] size = engine.getImageSize().split("x"); 66 int h = (int)Math.round(Integer.parseInt(size[1]) * 0.4D); 67 return size[0] + "x" + h; 68 } 69 */ createImageIcon(String path)70 private ImageIcon createImageIcon(String path) { 71 java.net.URL imgURL = getClass().getResource(path); 72 if (imgURL != null) { 73 return new ImageIcon(imgURL, path); 74 } else { 75 System.out.println("Couldn't find file: " + path); 76 return null; 77 } 78 } 79 attemptSignIn()80 private String attemptSignIn() { 81 SignInManager mgr = SignInManager.getInstance(); 82 if ( mgr != null && mgr.isSignedIn() ) { 83 return "&cid=" + AccountManager.getCid(mgr.getUserName(), mgr.getPassword()); 84 } 85 return ""; 86 } 87 getLicense()88 private String getLicense() { 89 return licenseManager.isLicenseValid() ? licenseManager.getUserName() : ""; 90 } 91 92 private String license = getLicense(); 93 getFileContents(String name)94 private String getFileContents(String name) { 95 StringBuilder cont = new StringBuilder(); 96 String line; 97 String nl = System.getProperty("line.separator"); 98 File f = new File(skinDirectory, name); 99 try { 100 java.io.BufferedReader in = new java.io.BufferedReader(new java.io.FileReader(f)); 101 try { 102 while ((line = in.readLine()) != null) { 103 cont.append(line); 104 cont.append(nl); 105 } 106 } 107 finally { 108 in.close(); 109 } 110 } catch (FileNotFoundException e) { 111 return null; 112 } catch (IOException e) { 113 return null; 114 } 115 return cont.toString(); 116 } 117 118 JTextArea readme = new JSmartTextArea( getFileContents("readme.txt"), 20, 30 ); 119 120 { 121 readme.setLineWrap(true); 122 readme.setWrapStyleWord(true); 123 readme.setEditable(false); 124 } 125 126 JScrollPane aboutPanel = new JScrollPane(readme, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 127 128 private JFileChooser fc = new JFileChooser(); 129 private JFileFilter imgFilter = new JFileFilter(new String[] {"jpg", "png", "gif"}, "Images"); 130 getFileToRes(String[] ext, JTextField name)131 private void getFileToRes(String[] ext, JTextField name) { 132 getFileToRes(new JFileFilter(ext, "allowed files"), name); 133 } 134 getFileToRes(JFileFilter filter, JTextField name)135 private void getFileToRes(JFileFilter filter, JTextField name) { 136 fc.setFileFilter(filter); 137 int returnVal = fc.showOpenDialog(window); 138 if (returnVal == JFileChooser.APPROVE_OPTION) { 139 String fn = fc.getSelectedFile().toString(); 140 if ( !fn.trim().equals("") ) { 141 File src = new File(fn); 142 File dst = new File(engine.getDirectory(), "res"); 143 if (!dst.exists()) { 144 dst.mkdir(); 145 } 146 if (src.exists() && dst.exists()) { 147 try { 148 IO.copyFile(src, dst); 149 name.setText( src.getName() ); 150 } catch (IOException e) { 151 System.out.println(e); 152 } 153 } 154 } 155 } 156 } 157 158 StateMonitor commercialMonitor = new StateMonitor() { 159 public void onChange() { 160 if ( ((JCheckBox)source).isSelected() && license.length() == 0 ) { 161 Object[] options = { 162 texts.getString("ui.signUp"), 163 texts.getString("ui.noThanks") 164 }; 165 int n = JOptionPane.showOptionDialog(window, 166 texts.getString("ui.licenseWarning"), 167 texts.getString("ui.licenseWarningTitle"), 168 JOptionPane.YES_NO_OPTION, 169 JOptionPane.INFORMATION_MESSAGE, 170 null, 171 options, 172 options[1] 173 ); 174 if (n == 0) { 175 try { 176 BrowserLauncher.openURL(JAlbumSite.getTrueInstance().getMyJAlbumUpgradeUrl() + "/?referrer=" + skin + attemptSignIn()); 177 } catch (se.datadosen.tags.ElementException x) { 178 } catch (IOException x) { 179 } 180 } 181 ((JCheckBox)source).setSelected(false); 182 } 183 } 184 }; 185 186 ControlPanel ui = new ControlPanel() { 187 188 JTextField skinVersion = new JTextField( new SkinProperties(skinDirectory).getProperty(SkinProperties.VERSION) ); 189 JCheckBox guiExists = new JCheckBox("", true); 190 191 JLabel formattingHint1h = new JLabel(texts.getString("ui.formattingHint1")); 192 JLabel formattingHint2h = new JLabel(texts.getString("ui.formattingHint2")); 193 JLabel formattingHint1f = new JLabel(texts.getString("ui.formattingHint1")); 194 JLabel formattingHint2f = new JLabel(texts.getString("ui.formattingHint2")); 195 196 ControlPanel site = new ControlPanel() { 197 198 JCheckBox showBreadcrumbPath = new JCheckBox(texts.getString("ui.useBreadcrumbPath"), false); 199 JCheckBox useSearch = new JCheckBox(texts.getString("ui.useSearchBox")); 200 JCheckBox skipThumbnailPage = new JCheckBox(texts.getString("ui.skipThumbnailPage")); 201 JComboBox zipImages = new JComboBox(new Object[] { 202 new Item("none", texts.getString("ui.nothing")), 203 new Item("slides", texts.getString("ui.scaledDown")), 204 new Item("originals", texts.getString("ui.originals")), 205 new Item("album", texts.getString("ui.wholeAlbum")) 206 }); 207 JLabel zipInfo = new JLabel(createImageIcon("info.png")); 208 209 ControlPanel topNavigation = new ControlPanel(texts.getString("ui.topNavigation")) { 210 JCheckBox showTopNavigation = new JCheckBox(texts.getString("ui.showTopNavigation"), false); 211 JCheckBox topNavigationExcludeFolders = new JCheckBox(texts.getString("ui.excludeFolders"), false); 212 JTextField logoName = new JSmartTextField(30); 213 JButton selectLogo = new JButton(texts.getString("ui.select")); 214 215 { 216 showTopNavigation.setToolTipText(texts.getString("ui.showTopNavigationInfo")); 217 topNavigationExcludeFolders.setToolTipText(texts.getString("ui.excludeFoldersInfo")); 218 selectLogo.addActionListener(new ActionListener() { 219 public void actionPerformed(ActionEvent e) { 220 getFileToRes(imgFilter, logoName); 221 }}); 222 ComponentUtilities.whenSelectedEnable(showTopNavigation, new JComponent[]{topNavigationExcludeFolders, logoName, selectLogo}); 223 224 add(showTopNavigation); 225 add("tab", topNavigationExcludeFolders); 226 add("br", new JLabelFor(texts.getString("ui.logo"), logoName)); 227 add("hfill", logoName); 228 add("", selectLogo); 229 } 230 }; 231 232 { 233 skipThumbnailPage.setToolTipText(texts.getString("ui.skipThumbnailPageInfo")); 234 showBreadcrumbPath.setToolTipText(texts.getString("ui.useBreadcrumbPathInfo")); 235 useSearch.setToolTipText(texts.getString("ui.useSearchBoxInfo")); 236 237 zipInfo.addMouseListener(new MouseAdapter() { 238 public void mouseReleased(MouseEvent e) { 239 JOptionPane.showMessageDialog(window, texts.getString("ui.nonAsciiWarning"), "Warning", JOptionPane.WARNING_MESSAGE); 240 }}); 241 242 add("hfill", topNavigation); 243 add("br", showBreadcrumbPath); 244 add("br", useSearch); 245 add("br", skipThumbnailPage); 246 add("br", new JLabelFor(texts.getString("ui.offerDownload"), zipImages)); 247 add("", zipImages); 248 add("", zipInfo); 249 } 250 }; 251 252 ControlPanel design = new ControlPanel() { 253 254 JComboBox fontFamily = new JComboBox(new Object[] { 255 new Item("Arial, \"Helvetica Neue\", Helvetica, sans-serif", "Arial"), 256 new Item("Baskerville, \"Baskerville Old Face\", \"Hoefler Text\", Garamond, \"Times New Roman\", serif", "Baskerville"), 257 new Item("Calibri, Candara, Segoe, \"Segoe UI\", Optima, Arial, sans-serif", "Calibri"), 258 new Item("Cambria, Georgia, Times, \"Times New Roman\", serif", "Cambria"), 259 new Item("\"Century Gothic\", \"Apple Gothic\", \"Goudy Old Style\", sans-serif", "Century Gothic"), 260 new Item("\"Comic Sans MS\", cursive", "Comic Sans"), 261 new Item("Consolas, \"Lucida Console\", Monaco, monospace", "Consolas"), 262 new Item("Constantia, Palatino, \"Palatino Linotype\", \"Palatino LT STD\", Georgia, serif", "Constantia"), 263 new Item("\"Copperplate Light\", \"Copperplate Gothic Light\", serif", "Copperplate Light"), 264 new Item("\"Courier New\", Courier, monospace", "Courier New"), 265 new Item("\"Franklin Gothic Medium\", \"Arial Narrow Bold\", Arial, sans-serif", "Franklin Gothic"), 266 new Item("Futura, \"Century Gothic\", AppleGothic, sans-serif", "Futura"), 267 new Item("Garamond, \"Hoefler Text\", Times New Roman, Times, serif", "Garamond"), 268 new Item("Geneva, \"Lucida Sans\", \"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, sans-serif", "Geneva"), 269 new Item("Georgia, Palatino, \"Palatino Linotype\", Times, \"Times New Roman\", serif", "Georgia"), 270 new Item("\"Gill Sans\", \"Gill Sans MT\", Calibri, \"Trebuchet MS\", sans-serif", "Gill Sans"), 271 new Item("\"Goudy Old Style\", Garamond, \"Big Caslon\", \"Times New Roman\", serif", "Goudy Old Style"), 272 new Item("\"Helvetica Neue\", Helvetica, Arial, sans-serif", "Helvetica Neue"), 273 new Item("\"Hoefler Text\", Constantia, Palatino, \"Palatino Linotype\", \"Book Antiqua\", Georgia, serif", "Hoefler Text"), 274 new Item("Impact, Haettenschweiler, \"Arial Narrow Bold\", sans-serif", "Impact"), 275 new Item("\"Lucida Sans\", \"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, sans-serif", "Lucida Sans"), 276 new Item("\"Lucida Bright\", Georgia, serif", "Lucida Bright"), 277 new Item("Palatino, \"Palatino Linotype\", \"Book Antiqua\", Georgia, serif", "Palatino"), 278 new Item("Segoe, \"Segoe UI\", Tahoma, Geneva, \"Nimbus Sans L\", sans-serif", "Segoe"), 279 new Item("Tahoma, Geneva, Verdana, sans-serif", "Tahoma"), 280 new Item("Times, \"Times New Roman\", Georgia, serif", "Times"), 281 new Item("\"Trebuchet MS\", \"Lucida Sans Unicode\", \"Lucida Grande\", \"Lucida Sans\", Tahoma, sans-serif", "Trebuchet MS"), 282 new Item("Verdana, Geneva, Tahoma, sans-serif", "Verdana") 283 }); 284 JComboBox fontSize = new JComboBox(new Object[] { 285 new Item("10px", "77%"), 286 new Item("11px", "85%"), 287 new Item("12px", "92%"), 288 new Item("13px", "100%"), 289 new Item("14px", "108%"), 290 new Item("15px", "115%"), 291 new Item("16px", "123%"), 292 new Item("17px", "131%"), 293 new Item("18px", "138%") 294 }); 295 JComboBox headlineFamily = new JComboBox(new Object[] { 296 new Item("", "[ " + texts.getString("ui.sameAsBaseFont") + " ]"), 297 new Item("Arial, \"Helvetica Neue\", Helvetica, sans-serif", "Arial"), 298 new Item("Baskerville, \"Baskerville Old Face\", \"Hoefler Text\", Garamond, \"Times New Roman\", serif", "Baskerville"), 299 new Item("Calibri, Candara, Segoe, \"Segoe UI\", Optima, Arial, sans-serif", "Calibri"), 300 new Item("Cambria, Georgia, Times, \"Times New Roman\", serif", "Cambria"), 301 new Item("\"Century Gothic\", \"Apple Gothic\", \"Goudy Old Style\", sans-serif", "Century Gothic"), 302 new Item("\"Comic Sans MS\", cursive", "Comic Sans"), 303 new Item("Consolas, \"Lucida Console\", Monaco, monospace", "Consolas"), 304 new Item("Constantia, Palatino, \"Palatino Linotype\", \"Palatino LT STD\", Georgia, serif", "Constantia"), 305 new Item("Copperplate, \"Copperplate Gothic\", serif", "Copperplate"), 306 new Item("\"Courier New\", Courier, monospace", "Courier New"), 307 new Item("\"Franklin Gothic\", \"Franklin Gothic Medium\", \"Arial Narrow Bold\", Arial, sans-serif", "Franklin Gothic"), 308 new Item("Futura, \"Futura Bk BT\", \"Century Gothic\", AppleGothic, sans-serif", "Futura"), 309 new Item("Garamond, \"Hoefler Text\", Times New Roman, Times, serif", "Garamond"), 310 new Item("Geneva, \"Lucida Sans\", \"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, sans-serif", "Geneva"), 311 new Item("Georgia, Palatino, \"Palatino Linotype\", Times, \"Times New Roman\", serif", "Georgia"), 312 new Item("\"Gill Sans\", \"Gill Sans MT\", Calibri, \"Trebuchet MS\", sans-serif", "Gill Sans"), 313 new Item("\"Goudy Old Style\", Garamond, \"Big Caslon\", \"Times New Roman\", serif", "Goudy Old Style"), 314 new Item("\"Helvetica Neue\", Helvetica, Arial, sans-serif", "Helvetica Neue"), 315 new Item("\"Hoefler Text\", Constantia, Palatino, \"Palatino Linotype\", \"Book Antiqua\", Georgia, serif", "Hoefler Text"), 316 new Item("Impact, Haettenschweiler, \"Arial Narrow Bold\", sans-serif", "Impact"), 317 new Item("\"Lucida Sans\", \"Lucida Grande\", \"Lucida Sans Unicode\", Verdana, sans-serif", "Lucida Sans"), 318 new Item("\"Lucida Bright\", Georgia, serif", "Lucida Bright"), 319 new Item("Palatino, \"Palatino Linotype\", \"Book Antiqua\", Georgia, serif", "Palatino"), 320 new Item("Segoe, \"Segoe UI\", Tahoma, Geneva, \"Nimbus Sans L\", sans-serif", "Segoe"), 321 new Item("Tahoma, Geneva, Verdana, sans-serif", "Tahoma"), 322 new Item("Times, \"Times New Roman\", Georgia, serif", "Times"), 323 new Item("\"Trebuchet MS\", \"Lucida Sans Unicode\", \"Lucida Grande\", \"Lucida Sans\", Tahoma, sans-serif", "Trebuchet MS"), 324 new Item("Verdana, Geneva, Tahoma, sans-serif", "Verdana"), 325 new Item("", "--- " + texts.getString("ui.webFonts") + " ---"), 326 new Item("Abril Fatface::abrilfatface/v5/X1g_KwGeBV3ajZIXQ9VnDuhS-En80r5m6Wj7KydCWb8.woff", "Abril Fatface"), 327 new Item("Alex Brush::alexbrush/v3/0JFIM7b_LgqHWlCbkgAO2fesZW2xOQ-xsNqO47m55DA.woff", "Alex Brush"), 328 new Item("Amaranth::amaranth/v3/BHyuYFj9nqLFNvOvGh0xT4SoAJ3FdnHwSRdilZRLja4.woff", "Amaranth"), 329 new Item("Amatic SC::amaticsc/v3/IDnkRTPGcrSVo50UyYNK7xsxEYwM7FgeyaSgU71cLG0.woff", "Amatic SC"), 330 new Item("Cantata One::cantataone/v1/-a5FDvnBqaBMDaGgZYnEfj8E0i7KZn-EPnyo3HZu7kw.woff", "Cantata One"), 331 new Item("Cookie::cookie/v4/FRKZFc5cUzT1rhNTWK08-w.woff", "Cookie"), 332 new Item("Dancing Script::dancingscript/v3/KGBfwabt0ZRLA5W1ywjowQcy1_X8izNRf-j_WdFlHLs.woff", "Dancing Script"), 333 new Item("Dosis::dosis/v1/4u2QrYwRDIT2YdFfRbG7og.woff", "Dosis"), 334 new Item("Dynalight::dynalight/v2/fFTIQo5srxFzkXPDHWokhw.woff", "Dynalight"), 335 new Item("Emilys Candy::emilyscandy/v1/PofLVm6v1SwZGOzC8s-I3RsxEYwM7FgeyaSgU71cLG0.woff", "Emilys Candy"), 336 new Item("Euphoria Script::euphoriascript/v1/c4XB4Iijj_NvSsCF4I0O2HVXOZy8HQCyPSdnDJOr3a8.woff", "Euphoria Script"), 337 new Item("Fredericka the Great::frederickathegreat/v2/7Es8Lxoku-e5eOZWpxw18t2QR9E88_XBMnxeisbi_2k.woff", "Fredericka the Great"), 338 new Item("Germania One::germaniaone/v1/3_6AyUql_-FbDi1e68jHdBsxEYwM7FgeyaSgU71cLG0.woff", "Germania One"), 339 new Item("Geo::geo/v4/ehOHD8ipeE9ZZlLcSuyETw.woff", "Geo"), 340 new Item("Great Vibes::greatvibes/v1/4Mi5RG_9LjQYrTU55GN_Lz8E0i7KZn-EPnyo3HZu7kw.woff", "Great Vibes"), 341 new Item("Gruppo::gruppo/v4/5HbckBWnUDolflDIG6jXoQ.woff", "Gruppo"), 342 new Item("IM Fell English::imfellenglish/v3/xwIisCqGFi8pff-oa9uSVMyhYfqH3mbn79-t0w0Xep4.woff", "IM Fell English"), 343 new Item("Indie Flower::indieflower/v4/10JVD_humAd5zP2yrFqw6hsxEYwM7FgeyaSgU71cLG0.woff", "Indie Flower"), 344 new Item("La Belle Aurore::labelleaurore/v3/Irdbc4ASuUoWDjd_Wc3mdw8tuJzfDdJzet9TevnX4dY.woff", "La Belle Aurore"), 345 new Item("Lobster::lobster/v5/9eID_a1kLfzp_BP9s4L15g.woff", "Lobster"), 346 new Item("Loved by the King::lovedbytheking/v3/wg03xD4cWigj4YDufLBSrwvs-PHmBmba6eqIx5ccdqU.woff", "Loved by the King"), 347 new Item("Mountains of Christmas::mountainsofchristmas/v5/PymufKtHszoLrY0uiAYKNFojKXOXw05l2_H_A7IX6_4.woff", "Mountains of Christmas"), 348 new Item("Maiden Orange::maidenorange/v3/ZhKIA2SPisEwdhW7g0RUWuhS-En80r5m6Wj7KydCWb8.woff", "Maiden Orange"), 349 new Item("Oswald::oswald/v2/-g5pDUSRgvxvOl5u-a_WHw.woff", "Oswald"), 350 new Item("Poiret One::poiretone/v1/BTpJg8_B_DLGSuk_1Pf0tvesZW2xOQ-xsNqO47m55DA.woff", "Poiret One"), 351 new Item("Princess Sofia::princesssofia/v1/8g5l8r9BM0t1QsXLTajDe2y1RO09RDKWlu_EElX0vQo.woff", "Princess Sofia"), 352 new Item("PT Mono::ptmono/v1/q-8MB3u-6uRcCyTjD42CkA.woff", "PT Mono"), 353 new Item("Shadows Into Light::shadowsintolight/v3/clhLqOv7MXn459PTh0gXYJxCHKeeY4rq5IoKkeW6lEs.woff", "Shadows Into Light"), 354 new Item("Special Elite::specialelite/v3/9-wW4zu3WNoD5Fjka35Jm-hS-En80r5m6Wj7KydCWb8.woff", "Special Elite"), 355 new Item("Raleway::raleway/v5/b1OWH1QXUjVxHio22EJrRQ.woff", "Raleway"), 356 new Item("Rochester::rochester/v3/f_NvJxIwJC1g7a4yzlmghQ.woff", "Rochester"), 357 new Item("Squada One::squadaone/v2/f-OUPQPez9RsgdltZVHvEvesZW2xOQ-xsNqO47m55DA.woff", "Squada One"), 358 new Item("Ubuntu Condensed::ubuntucondensed/v3/DBCt-NXN57MTAFjitYxdrO3ikv6SQm_yYbVf3nddkGw.woff", "Ubuntu Condensed"), 359 new Item("Yanone Kaffeesatz::yanonekaffeesatz/v4/We_iSDqttE3etzfdfhuPRRI4n1MudG51cocQgCMY5FY.woff", "Yanone Kaffeesatz") 360 }); 361 JComboBox headlineSize = new JComboBox(new Object[] { 362 "200%", "240%", "300%", "360%", "420%", "500%" 363 }); 364 JTextField backgroundImageName = new JSmartTextField(20); 365 JButton selectImage = new JButton(); 366 JComboBox backgroundPos = new JComboBox( getPosition() ); 367 JComboBox backgroundRepeat = new JComboBox(new Object[] { 368 new Item("no-repeat", texts.getString("ui.bg_no_repeat")), 369 new Item("repeat-x", texts.getString("ui.bg_repeat_x")), 370 new Item("repeat-y", texts.getString("ui.bg_repeat_y")), 371 new Item("repeat", texts.getString("ui.bg_repeat_both")), 372 new Item("stretch", texts.getString("ui.bg_stretch")), 373 }); 374 JCheckBox use3dEffects = new JCheckBox(texts.getString("ui.use3dEffects"), true); 375 JCheckBox stickControlsToTop = new JCheckBox(texts.getString("ui.stickControlsToTop"), true); 376 377 ControlPanel colors = new ControlPanel(texts.getString("ui.colors")) { 378 379 JColorSelector backgroundColor = new JColorSelector(texts.getString("ui.backgroundColor"), new JSmartTextField("#111111", 6)); 380 JColorSelector textColor = new JColorSelector(texts.getString("ui.textColor"), new JSmartTextField("#bbbbbb", 6)); 381 JColorSelector highlightColor = new JColorSelector(); // Hidden, automatically assigned 382 JColorSelector linkColor = new JColorSelector(texts.getString("ui.linkColor"), new JSmartTextField("#dddddd", 6)); 383 JColorSelector hoverColor = new JColorSelector(texts.getString("ui.hoverColor"), new JSmartTextField("#ffffff", 6)); 384 JColorSelector borderColor = new JColorSelector(texts.getString("ui.borderColor"), new JSmartTextField("#eeeeee", 6)); 385 JSpinner borderWidth = new JSpinner(new SpinnerNumberModel(10, 0, 100, 1)); 386 387 { 388 backgroundColor.setToolTipText(texts.getString("ui.backgroundColorInfo")); 389 textColor.setToolTipText(texts.getString("ui.textColorInfo")); 390 linkColor.setToolTipText(texts.getString("ui.linkColorInfo")); 391 hoverColor.setToolTipText(texts.getString("ui.hoverColorInfo")); 392 borderColor.setToolTipText(texts.getString("ui.borderColorInfo")); 393 textColor.addActionListener(new ActionListener() { 394 public void actionPerformed(ActionEvent e) { 395 highlightColor.setColor(getHighlightedColor(textColor.getHTMLColor())); 396 } 397 }); 398 linkColor.addActionListener(new ActionListener() { 399 public void actionPerformed(ActionEvent e) { 400 hoverColor.setColor(getHighlightedColor(linkColor.getHTMLColor())); 401 } 402 }); 403 404 add("", new JLabelFor(texts.getString("ui.backgroundColor"), backgroundColor)); 405 add("tab", backgroundColor); 406 add("tab", backgroundColor.getTextComponent()); 407 add("tab", new JLabelFor(texts.getString("ui.textColor"), textColor)); 408 add("tab", textColor); 409 add("tab", textColor.getTextComponent()); 410 add("br", new JLabelFor(texts.getString("ui.linkColor"), linkColor)); 411 add("tab", linkColor); 412 add("tab", linkColor.getTextComponent()); 413 add("tab", new JLabelFor(texts.getString("ui.hoverColor"), hoverColor)); 414 add("tab", hoverColor); 415 add("tab", hoverColor.getTextComponent()); 416 add("br", new JLabelFor(texts.getString("ui.borderColor"), borderColor)); 417 add("tab", borderColor); 418 add("tab", borderColor.getTextComponent()); 419 add("tab", new JLabelFor(texts.getString("ui.borderWidth"), borderWidth)); 420 add("", borderWidth); 421 add("", new JLabel("px")); 422 } 423 }; 424 425 { 426 fontSize.setSelectedIndex(3); 427 headlineSize.setSelectedIndex(2); 428 backgroundImageName.setToolTipText(texts.getString("ui.backgroundImageInfo")); 429 selectImage.setText(texts.getString("ui.select")); 430 selectImage.addActionListener(new ActionListener() { 431 public void actionPerformed(ActionEvent e) { 432 getFileToRes(imgFilter, backgroundImageName); 433 }}); 434 backgroundPos.setSelectedIndex(4); 435 backgroundRepeat.setSelectedIndex(4); 436 use3dEffects.setToolTipText(texts.getString("ui.use3dEffectsInfo")); 437 stickControlsToTop.setToolTipText(texts.getString("ui.stickControlsToTopInfo")); 438 439 add(new JLabel(texts.getString("ui.fontFamily"))); 440 add("tab", fontFamily); 441 add(" ", new JLabel(texts.getString("ui.fontSize"))); 442 add("tab", fontSize); 443 add("br", new JLabel(texts.getString("ui.headlineFamily"))); 444 add("tab", headlineFamily); 445 add("tab", headlineSize); 446 add("br tab", new JLinkLabel("http://lazaworx.com/font-selection-in-turtle-skin/", texts.getString("ui.fontSamples"), texts.getString("ui.seeFontSamples"))); 447 add("br", new JLabelFor(texts.getString("ui.backgroundImage"), backgroundImageName)); 448 add("tab", backgroundImageName); 449 add("", selectImage); 450 add("br tab", backgroundPos); 451 add("", backgroundRepeat); 452 add("br", use3dEffects); 453 add(" ", stickControlsToTop); 454 add("br hfill", colors); 455 } 456 }; 457 458 ControlPanel header = new ControlPanel() { 459 460 ControlPanel themeImage = new ControlPanel(texts.getString("ui.themeImage")) { 461 462 JTextField folderImageSize = new JSmartTextField("900x240", 10); 463 JTextField folderImageHeightPages = new JSmartTextField("80", 5); 464 JTextField folderImageHeightSubAlbums = new JSmartTextField("240", 5); 465 JCheckBox themeImageSame = new JCheckBox(texts.getString("ui.themeImageSame")); 466 467 { 468 folderImageSize.setToolTipText(texts.getString("ui.folderImageSizeInfo")); 469 folderImageHeightPages.setToolTipText(texts.getString("ui.heightOnPagesInfo")); 470 folderImageHeightSubAlbums.setToolTipText(texts.getString("ui.heightOnSubFoldersInfo")); 471 themeImageSame.setToolTipText(texts.getString("ui.themeImageSameInfo")); 472 473 add("", new JLabel(texts.getString("ui.folderImageSize"))); 474 add("tab", folderImageSize); 475 add(" ", themeImageSame); 476 add("br", new JLabel(texts.getString("ui.heightOnPages"))); 477 add("tab", folderImageHeightPages); 478 add("br", new JLabel(texts.getString("ui.heightOnSubFolders"))); 479 add("tab", folderImageHeightSubAlbums); 480 } 481 482 }; 483 484 JCheckBox descriptionVisible = new JCheckBox(texts.getString("ui.descriptionVisible"), true); 485 JCheckBox showStartSlideshow = new JCheckBox(texts.getString("ui.showStartSlideshow"), true); 486 487 ControlPanel headerPanel = new ControlPanel(texts.getString("ui.albumInfo")) { 488 489 JCheckBox headerTopLevelOnly = new JCheckBox(texts.getString("ui.topLevelOnly"), true); 490 JTextArea header = new JSmartTextArea(6, 30); 491 JScrollPane headerPane = new JScrollPane(header); 492 493 { 494 header.setEditable(true); 495 header.setLineWrap(true); 496 header.setWrapStyleWord(true); 497 header.setToolTipText(texts.getString("ui.customContentInfo")); 498 499 add(headerTopLevelOnly); 500 add("br hfill", headerPane); 501 add("br", formattingHint1h); 502 add("br", formattingHint2h); 503 } 504 }; 505 506 { 507 //folderImageSize.setText(getThemeImageSize()); 508 descriptionVisible.setToolTipText(texts.getString("ui.descriptionVisibleInfo")); 509 showStartSlideshow.setToolTipText(texts.getString("ui.showStartSlideshowInfo")); 510 511 add("hfill", themeImage); 512 add("br", descriptionVisible); 513 add("br", showStartSlideshow); 514 add("br hfill", headerPanel); 515 } 516 }; 517 518 ControlPanel thumbnails = new ControlPanel() { 519 520 String s = " > ", f = texts.getString("ui.folders"), p = texts.getString("ui.pages"), i = texts.getString("ui.images"); 521 JTextField newDaysCount = new JSmartTextField("0", 3); 522 JComboBox newDaysRef = new JComboBox(new Object[] { 523 new Item("dateTaken", texts.getString("ui.dateTaken")), 524 new Item("fileModified", texts.getString("ui.fileModified")) 525 }); 526 JCheckBox fixedShapeThumbs = new JCheckBox(texts.getString("ui.fixedShapeThumbs"), true); 527 JTextField preZoomThumbs = new JSmartTextField("0", 3); 528 JComboBox itemsOrder = new JComboBox(new Object[] { 529 new Item("fpi", f + s + p + s + i), 530 new Item("fip", f + s + i + s + p), 531 new Item("pfi", p + s + f + s + i), 532 new Item("pif", p + s + i + s + f), 533 new Item("ifp", i + s + f + s + p), 534 new Item("ipf", i + s + p + s + f), 535 new Item("fi", f + s + i), 536 new Item("if", i + s + f), 537 new Item("i", i) 538 }); 539 540 ControlPanel folders = new ControlPanel(texts.getString("ui.folders")) { 541 542 JCheckBox showFolderDescription = new JCheckBox(texts.getString("ui.showFolderDescription"), true); 543 JCheckBox showFolderImageCount = new JCheckBox(texts.getString("ui.showFolderImageCount"), true); 544 545 { 546 add(showFolderDescription); 547 add("br", showFolderImageCount); 548 } 549 }; 550 551 ControlPanel pages = new ControlPanel(texts.getString("ui.pages")) { 552 553 JCheckBox showPagesAsThumbs = new JCheckBox(texts.getString("ui.showPagesAsThumbnails"), false); 554 JCheckBox showPageExcerpt = new JCheckBox(texts.getString("ui.showPageExcerpt"), false); 555 556 { 557 showPageExcerpt.setToolTipText(texts.getString("ui.showPageExcerptInfo")); 558 559 add(showPageExcerpt); 560 } 561 }; 562 563 ControlPanel thumbs = new ControlPanel(texts.getString("ui.images")) { 564 565 JTextArea thumbCaptionTemplate = new JSmartTextArea(4, 30); 566 JScrollPane tCaptionPane = new JScrollPane(thumbCaptionTemplate); 567 JComboBox captionPlacement = new JComboBox(new Object[] { 568 new Item("tooltip", texts.getString("ui.tooltip")), 569 new Item("below", texts.getString("ui.below")) 570 }); 571 572 { 573 thumbCaptionTemplate.setText("<span class=\"nr\">${imageNum}</span> <strong>${fileTitle}</strong> <small>${comment}</small>"); 574 thumbCaptionTemplate.setEditable(true); 575 thumbCaptionTemplate.setLineWrap(true); 576 thumbCaptionTemplate.setWrapStyleWord(true); 577 578 add(new JLabel(texts.getString("ui.placeThumbCaptions"))); 579 add(captionPlacement); 580 add("br", new JLabel(texts.getString("ui.captionTemplate"))); 581 add("br hfill", tCaptionPane); 582 } 583 }; 584 585 { 586 newDaysCount.setToolTipText(texts.getString("ui.newDaysCountInfo")); 587 fixedShapeThumbs.setToolTipText(texts.getString("ui.fixedShapeThumbsInfo")); 588 ComponentUtilities.whenSelectedEnable(fixedShapeThumbs, new JComponent[]{preZoomThumbs}); 589 preZoomThumbs.setToolTipText(texts.getString("ui.preZoomThumbsInfo")); 590 itemsOrder.setSelectedIndex(1); 591 592 add(new JLabel(texts.getString("ui.markFilesNew"))); 593 add("", newDaysCount); 594 add(new JLabel(texts.getString("ui.daysOld"))); 595 add(" ", new JLabel(texts.getString("ui.reference"))); 596 add(newDaysRef); 597 add("br", fixedShapeThumbs); 598 add("tab", new JLabel(texts.getString("ui.preZoomThumbs") + " 100+")); 599 add("", preZoomThumbs); 600 add("", new JLabel("%")); 601 add("br", new JLabel(texts.getString("ui.itemsOrder"))); 602 add("", itemsOrder); 603 add("br", folders); 604 add("hfill", pages); 605 add("br hfill", thumbs); 606 607 } 608 }; 609 610 611 ControlPanel footer = new ControlPanel() { 612 613 JCheckBox showImageCount = new JCheckBox(texts.getString("ui.showFolderImageCount"), true); 614 JCheckBox showBottomNavigation = new JCheckBox(texts.getString("ui.showBottomNavigation"), false); 615 JCheckBox showHelp = new JCheckBox(texts.getString("ui.showHelpLink"), true); 616 617 ControlPanel customLinkPanel = new ControlPanel(texts.getString("ui.customLink")) { 618 619 JTextField customLink = new JSmartTextField(); 620 JTextField customLinkText = new JSmartTextField(); 621 622 { 623 customLink.setToolTipText(texts.getString("ui.customLinkInfo")); 624 customLinkText.setToolTipText(texts.getString("ui.customLinkTextInfo")); 625 626 add(new JLabel("URL")); 627 add("tab hfill", customLink); 628 add("br", new JLabel(texts.getString("ui.customLinkText"))); 629 add("tab hfill", customLinkText); 630 } 631 632 }; 633 634 ControlPanel footerPanel = new ControlPanel(texts.getString("ui.customContent")) { 635 636 JCheckBox footerTopLevelOnly = new JCheckBox(texts.getString("ui.topLevelOnly"), false); 637 JTextArea footer = new JSmartTextArea(6, 30); 638 JScrollPane footerPane = new JScrollPane(footer); 639 640 { 641 footer.setEditable(true); 642 footer.setLineWrap(true); 643 footer.setWrapStyleWord(true); 644 footer.setToolTipText(texts.getString("ui.customContentInfo")); 645 646 add(footerTopLevelOnly); 647 add("br hfill", footerPane); 648 add("br", formattingHint1f); 649 add("br", formattingHint2f); 650 } 651 }; 652 653 { 654 showImageCount.setToolTipText(texts.getString("ui.showFolderImageCountInfo")); 655 showBottomNavigation.setToolTipText(texts.getString("ui.showBottomNavigationInfo")); 656 showHelp.setToolTipText(texts.getString("ui.displayHelpButtonInfo")); 657 658 add("", showImageCount); 659 add("br", showBottomNavigation); 660 add("br hfill", customLinkPanel); 661 add("br", showHelp); 662 add("br hfill", footerPanel); 663 } 664 }; 665 666 667 ControlPanel images = new ControlPanel() { 668 669 JComboBox transitionType = new JComboBox(new Object[] { 670 new Item("crossFade", texts.getString("ui.crossFade")), 671 new Item("crossFadeAndZoom", texts.getString("ui.crossFadeAndZoom")), 672 new Item("none", texts.getString("ui.none")) 673 }); 674 JTextField transitionSpeed = new JSmartTextField("600", 8); 675 JTextField slideshowDelay = new JSmartTextField("4", 3); 676 JCheckBox slideshowLoop = new JCheckBox(texts.getString("ui.loop")); 677 JCheckBox slideshowAuto = new JCheckBox(texts.getString("ui.autoStart")); 678 JComboBox afterLast = new JComboBox(new Object[] { 679 new Item("donothing", texts.getString("ui.doNothing")), 680 new Item("startover", texts.getString("startOver")), 681 new Item("onelevelup", texts.getString("upOneLevel")), 682 new Item("backtoindex", texts.getString("backToIndex")), 683 new Item("ask", texts.getString("ui.ask")) 684 }); 685 JCheckBox slideshowFullScreen = new JCheckBox(texts.getString("ui.slideshowFullScreen")); 686 687 ControlPanel visibility = new ControlPanel(texts.getString("ui.visibility")) { 688 689 JCheckBox thumbnailsVisible = new JCheckBox(texts.getString("ui.thumbnailsVisible")); 690 JComboBox reduceThumbs = new JComboBox(new Object[] { 691 new Item("1.0", "1 / 1"), 692 new Item("0.75", "3 / 4"), 693 new Item("0.66666667", "2 / 3"), 694 new Item("0.5", "1 / 2"), 695 new Item("0.33333333", "1 / 3"), 696 new Item("0.25", "1 / 4") 697 }); 698 JCheckBox infoPanelVisible = new JCheckBox(texts.getString("ui.infoPanelVisible")); 699 JCheckBox photoDataVisible = new JCheckBox(texts.getString("ui.photoData")); 700 JCheckBox regionsVisible = new JCheckBox(texts.getString("ui.regions")); 701 JCheckBox mapVisible = new JCheckBox(texts.getString("ui.map")); 702 JCheckBox shopVisible = new JCheckBox(texts.getString("ui.sellingPhotos")); 703 JCheckBox showImageNumbers = new JCheckBox(texts.getString("ui.showImageNumbers"), true); 704 705 { 706 showImageNumbers.setToolTipText(texts.getString("ui.showImageNumbersInfo")); 707 thumbnailsVisible.setToolTipText(texts.getString("ui.thumbnailsVisibleInfo")); 708 reduceThumbs.setSelectedIndex(2); 709 infoPanelVisible.setToolTipText(texts.getString("ui.infoPanelVisibleInfo")); 710 ComponentUtilities.whenSelectedEnable(infoPanelVisible, new JComponent[]{photoDataVisible, regionsVisible, mapVisible, shopVisible}); 711 712 add(thumbnailsVisible); 713 add(" ", new JLabel(texts.getString("ui.shrink"))); 714 add("", reduceThumbs); 715 add("br", infoPanelVisible); 716 add("br", new JLabel(texts.getString("ui.openByDefault"))); 717 add(" ", photoDataVisible); 718 add(" ", regionsVisible); 719 add(" ", mapVisible); 720 add(" ", shopVisible); 721 add("br", showImageNumbers); 722 } 723 }; 724 725 JCheckBox fitImages = new JCheckBox(texts.getString("ui.fitImages")); 726 JCheckBox fitShrinkonly = new JCheckBox(texts.getString("ui.fitShrinkonly")); 727 JCheckBox autoCorrect = new JCheckBox(texts.getString("ui.autoCorrect"), false); 728 JTextField watermark = new JSmartTextField(30); 729 JComboBox watermarkPosition = new JComboBox( getPosition() ); 730 JTextField watermarkStrength = new JSmartTextField("15", 3); 731 JTextField watermarkSize = new JSmartTextField("20", 3); 732 733 JTextArea imgCaptionTemplate = new JSmartTextArea(3, 30); 734 JScrollPane iCaptionPane = new JScrollPane(imgCaptionTemplate); 735 736 { 737 transitionType.setSelectedIndex(1); 738 transitionSpeed.setToolTipText(texts.getString("ui.transitionSpeedInfo")); 739 slideshowDelay.setToolTipText(texts.getString("ui.slideshowDelayInfo")); 740 slideshowFullScreen.setToolTipText(texts.getString("ui.slideshowFullScreenInfo")); 741 afterLast.setToolTipText(texts.getString("ui.afterLastInfo")); 742 afterLast.setSelectedIndex(4); 743 fitImages.setToolTipText(texts.getString("ui.fitImagesInfo")); 744 fitShrinkonly.setToolTipText(texts.getString("ui.fitShrinkonlyInfo")); 745 autoCorrect.setToolTipText(texts.getString("ui.autoCorrectInfo")); 746 watermark.setToolTipText(texts.getString("ui.watermarkInfo")); 747 watermarkPosition.setSelectedIndex(8); 748 watermarkStrength.setToolTipText(texts.getString("ui.strengthInfo")); 749 watermarkSize.setToolTipText(texts.getString("ui.sizeInfo")); 750 ComponentUtilities.whenSelectedEnable(fitImages, new JComponent[]{fitShrinkonly}); 751 imgCaptionTemplate.setText("<h2>${fileLabel}</h2><div class=\"comment\">${comment}</div>"); 752 imgCaptionTemplate.setEditable(true); 753 imgCaptionTemplate.setLineWrap(true); 754 imgCaptionTemplate.setWrapStyleWord(true); 755 756 add(new JLabelFor(texts.getString("ui.transition"), transitionType)); 757 add("tab", transitionType); 758 add(" ", new JLabelFor(texts.getString("ui.transitionSpeed"), transitionSpeed)); 759 add(transitionSpeed); 760 add(new JLabel("ms")); 761 add("br", new JLabel(texts.getString("ui.slideshowDelay"))); 762 add("tab", slideshowDelay); 763 add(" ", slideshowLoop); 764 add(" ", slideshowAuto); 765 add(" ", slideshowFullScreen); 766 add("br", new JLabelFor(texts.getString("ui.afterLast"), afterLast)); 767 add("tab", afterLast); 768 add("br", fitImages); 769 add(" ", fitShrinkonly); 770 add("br", autoCorrect); 771 add("br", new JLabelFor(texts.getString("ui.watermark"), watermark)); 772 add("tab", watermark); 773 add("br tab", watermarkPosition); 774 add(" ", new JLabelFor(texts.getString("ui.strength"), watermarkStrength)); 775 add(watermarkStrength); 776 add(new JLabelFor(texts.getString("ui.size"), watermarkSize)); 777 add(watermarkSize); 778 add("br hfill", visibility); 779 add("br", new JLabelFor(texts.getString("ui.captionTemplate"), iCaptionPane)); 780 add("br hfill", iCaptionPane); 781 } 782 }; 783 784 785 ControlPanel social = new ControlPanel() { 786 787 ControlPanel buttons = new ControlPanel(texts.getString("ui.buttons")) { 788 789 JCheckBox facebookLike = new JCheckBox(texts.getString("ui.facebookLikeButton")); 790 JCheckBox twitterTweet = new JCheckBox(texts.getString("ui.tweetButton")); 791 JCheckBox googlePlus = new JCheckBox(texts.getString("ui.googlePlus")); 792 JCheckBox tumblrButton = new JCheckBox(texts.getString("ui.tumblrButton")); 793 JCheckBox pinItButton = new JCheckBox(texts.getString("ui.pinItButton")); 794 795 { 796 facebookLike.setToolTipText(texts.getString("ui.facebookLikeButtonInfo")); 797 twitterTweet.setToolTipText(texts.getString("ui.tweetButtonInfo")); 798 googlePlus.setToolTipText(texts.getString("ui.googlePlusInfo")); 799 tumblrButton.setToolTipText(texts.getString("ui.tumblrButtonInfo")); 800 pinItButton.setToolTipText(texts.getString("ui.pinItButtonInfo")); 801 802 add(facebookLike); 803 add("tab", twitterTweet); 804 add("br", googlePlus); 805 add("tab", tumblrButton); 806 add("br", pinItButton); 807 } 808 }; 809 810 ControlPanel shares = new ControlPanel(texts.getString("shareOn")) { 811 812 JCheckBox shareFacebook = new JCheckBox("Facebook"); 813 JCheckBox shareTwitter = new JCheckBox("Twitter"); 814 JCheckBox shareGplus = new JCheckBox("Google+"); 815 JCheckBox shareDigg = new JCheckBox("Digg"); 816 JCheckBox shareDelicious = new JCheckBox("Delicious"); 817 JCheckBox shareMyspace = new JCheckBox("MySpace"); 818 JCheckBox shareStumbleupon = new JCheckBox("StumbleUpon"); 819 JCheckBox shareReddit = new JCheckBox("Reddit"); 820 JCheckBox shareEmail = new JCheckBox("Email"); 821 822 { 823 add(shareFacebook); 824 add("tab", shareTwitter); 825 add("tab", shareGplus); 826 add("tab", shareDigg); 827 add("tab", shareDelicious); 828 add("br", shareMyspace); 829 add("tab", shareStumbleupon); 830 add("tab", shareReddit); 831 add("tab", shareEmail); 832 } 833 }; 834 835 ControlPanel commenting = new ControlPanel(texts.getString("ui.commenting")) { 836 837 JCheckBox facebookCommenting = new JCheckBox(texts.getString("ui.facebookCommenting")); 838 JTextField facebookAppId = new JSmartTextField(""); 839 JTextField facebookCommentingPosts = new JSmartTextField("3", 2); 840 841 { 842 facebookAppId.setToolTipText(texts.getString("ui.facebookAppIdInfo")); 843 facebookCommentingPosts.setToolTipText(texts.getString("ui.facebookCommentingPostsInfo")); 844 ComponentUtilities.whenSelectedEnable(facebookCommenting, new JComponent[]{facebookAppId, facebookCommentingPosts}); 845 846 add(facebookCommenting); 847 add(" ", new JLinkLabel("https://developers.facebook.com/", texts.getString("ui.signUp"))); 848 add("br", new JLabel(texts.getString("ui.facebookAppId"))); 849 add("tab hfill", facebookAppId); 850 add("br", new JLabel(texts.getString("ui.facebookCommentingPosts"))); 851 add("tab", facebookCommentingPosts); 852 } 853 854 }; 855 856 { 857 add("hfill", buttons); 858 add("br hfill", shares); 859 add("br hfill", commenting); 860 } 861 }; 862 863 ControlPanel photoData = new ControlPanel() { 864 865 JCheckBox showRegions = new JCheckBox(texts.getString("ui.showRegions"), true); 866 JCheckBox showPhotoData = new JCheckBox(texts.getString("ui.showPhotoData")); 867 JCheckBox showPhotoDataLabel = new JCheckBox(texts.getString("ui.showLabel"), true); 868 JTextArea photoDataTemplate = new JSmartTextArea(12, 30); 869 JScrollPane photoDataPane = new JScrollPane(photoDataTemplate); 870 871 { 872 showRegions.setToolTipText(texts.getString("ui.showRegionsInfo")); 873 showPhotoData.setToolTipText(texts.getString("ui.showPhotoDataInfo")); 874 showPhotoDataLabel.setToolTipText(texts.getString("ui.showLabelInfo")); 875 photoDataTemplate.setText("photographer|artist|Artist|Owner|Copyright|Iptc.By-line|Iptc.Copyright Notice, Xmp.Creator, Xmp.Title, objectName, Xmp.Subject, Xmp.Description, Iptc.keywords, Xmp.Format, Xmp.Rights, Xmp.Identifier, Xmp.Label, Country/Primary Location, Province/State, City, Sub-location, originalDate|Date/Time Original|Date/Time|CreateDate|ModifyDate, camera|Model, lens|Lens|Xmp.Lens-Information|Canon Makernote.Unknown tag (0x0095), focalLength35mm|focusDistance|Focal Length|Focallength, SubjectDistance, meteringMode|Metering Mode, isoEquivalent|ISO Speed Ratings, exposureTime|Exposure Time|Shutter Speed Value|ShutterSpeedValue, Aperture Value|aperture|F-Number|FNumber|Aperturevalue, Exposure Bias Value, Exposure Program|Exposureprogram|Exposure Mode, Xmp.SceneType, White Balance|WhiteBalance, Xmp.ColorSpace, Xmp.LightSource, flash|Flash, resolution"); 876 photoDataTemplate.setEditable(true); 877 photoDataTemplate.setLineWrap(true); 878 photoDataTemplate.setWrapStyleWord(true); 879 880 ComponentUtilities.whenSelectedEnable(showPhotoData, new JComponent[]{showPhotoDataLabel, photoDataTemplate}); 881 add(showRegions); 882 add("br", showPhotoData); 883 add("tab", showPhotoDataLabel); 884 add("br hfill vfill", photoDataPane); 885 } 886 }; 887 888 ControlPanel map = new ControlPanel() { 889 890 JCheckBox showMap = new JCheckBox(texts.getString("ui.showMap")); 891 JComboBox mapType = new JComboBox(new Object[]{ 892 new Item("roadmap", texts.getString("ui.roadmap")), 893 new Item("satellite", texts.getString("ui.satellite")), 894 new Item("hybrid", texts.getString("ui.hybrid")), 895 new Item("terrain", texts.getString("ui.terrain")) 896 }); 897 JSlider mapZoom = new JSlider(JSlider.HORIZONTAL, 1, 20, 18); 898 JCheckBox mapAll = new JCheckBox(texts.getString("ui.allMarkers")); 899 900 { 901 showMap.setToolTipText(texts.getString("ui.showMapInfo")); 902 mapAll.setToolTipText(texts.getString("ui.allMarkersInfo")); 903 mapZoom.setOrientation(JSlider.HORIZONTAL); 904 mapZoom.setMinimum(0); 905 mapZoom.setMaximum(20); 906 mapZoom.setValue(18); 907 mapZoom.setMajorTickSpacing(10); 908 mapZoom.setMinorTickSpacing(1); 909 mapZoom.setPaintTicks(true); 910 mapZoom.setPaintLabels(true); 911 mapZoom.setSnapToTicks(true); 912 913 ComponentUtilities.whenSelectedEnable(showMap, new JComponent[]{ mapAll, mapType, mapZoom }); 914 add(showMap); 915 add("", mapAll); 916 add("br", new JLabelFor(texts.getString("ui.initialView"), mapType)); 917 add("tab", mapType); 918 add("br", new JLabelFor(texts.getString("ui.initialZoom"), mapZoom)); 919 add("tab", mapZoom); 920 } 921 }; 922 923 ControlPanel shop = new ControlPanel() { 924 925 ControlPanel shoppingCart = new ControlPanel(texts.getString("ui.shoppingCart")) { 926 927 JCheckBox showShop = new JCheckBox(texts.getString("ui.sellPhotos")); 928 JComboBox shopGateway = new JComboBox(new Object[]{ 929 new Item("paypal", "PayPal Website Standards Payment"), 930 new Item("google", "Google Checkout") /*, 931 new Item("amazon", "Checkout by Amazon")*/ 932 }); 933 JTextField shopId = new JTextField(10); 934 JComboBox shopCurrency = new JComboBox(new Object[]{ 935 new Item("USD", "United States Dollars"), 936 new Item("EUR", "Euro"), 937 new Item("GBP", "United Kingdom Pounds"), 938 new Item("CAD", "Canada Dollars"), 939 new Item("AUD", "Australia Dollars"), 940 //new Item("RUB", "Russia Rubles"), 941 new Item("JPY", "Japan Yen"), 942 //new Item("INR", "India Rupees"), 943 new Item("NZD", "New Zealand Dollars"), 944 new Item("CHF", "Switzerland Francs"), 945 //new Item("ARS", "Argentina Pesos"), 946 //new Item("BHD", "Bahrain Dinars"), 947 //new Item("BYR", "Belarus Rubles"), 948 //new Item("BAM", "Bosnia & Herzegovina C.Marka"), 949 //new Item("BRL", "Brazil Reais"), 950 //new Item("BGN", "Bulgaria Leva"), 951 //new Item("CLP", "Chile Pesos"), 952 //new Item("CNY", "China Yuan Renminbi"), 953 //new Item("COP", "Colombia Pesos"), 954 //new Item("CRC", "Costa Rica Colones"), 955 //new Item("HRK", "Croatia Kuna"), 956 new Item("CZK", "Czech Republic Koruny"), 957 new Item("DKK", "Denmark Kroner"), 958 //new Item("EGP", "Egypt Pounds"), 959 //new Item("EEK", "Estonia Krooni"), 960 //new Item("GTQ", "Guatemala Quetzales"), 961 new Item("HKD", "Hong Kong Dollars"), 962 new Item("HUF", "Hungary Forint"), 963 //new Item("ISK", "Iceland Kronur"), 964 //new Item("IDR", "Indonesia Rupiahs"), 965 //new Item("IQD", "Iraq Dinars"), 966 new Item("ILS", "Israel New Shekels"), 967 //new Item("JMD", "Jamaica Dollars"), 968 //new Item("JOD", "Jordan Dinars"), 969 //new Item("KWD", "Kuwait Dinars"), 970 //new Item("LVL", "Latvia Lati"), 971 //new Item("LBP", "Lebanon Pounds"), 972 //new Item("LTL", "Lithuania Litai"), 973 //new Item("MKD", "Macedonia Denars"), 974 new Item("MXN", "Mexico Pesos"), 975 //new Item("MDL", "Moldova Lei"), 976 //new Item("MAD", "Morocco Dirhams"), 977 new Item("NOK", "Norway Kroner"), 978 //new Item("PEN", "Peru Nuevos Soles"), 979 //new Item("PHP", "Philippines Pesos"), 980 new Item("PLN", "Poland Zlotych"), 981 //new Item("RON", "Romania New Lei"), 982 //new Item("SAR", "Saudi Arabia Riyals"), 983 //new Item("RSD", "Serbia Dinars"), 984 new Item("SGD", "Singapore Dollars"), 985 //new Item("ZAR", "South Africa Rand"), 986 //new Item("KRW", "South Korea Won"), 987 new Item("SEK", "Sweden Kronor"), 988 //new Item("TWD", "Taiwan New Dollars"), 989 new Item("THB", "Thailand Baht")//, 990 //new Item("TRY", "Turkey Lira"), 991 //new Item("UAH", "Ukraine Hryvnia"), 992 //new Item("AED", "United Arab Emirates Dirhams"), 993 //new Item("UYU", "Uruguay Pesos"), 994 //new Item("VND", "Vietnam Dong") 995 }); 996 JTextField shopHandling = new JSmartTextField(4); 997 JTextField shopQuantityCap = new JSmartTextField(4); 998 JTextArea shopOptions = new JSmartTextArea(7, 30); 999 ActionListener checkCurrency = new ActionListener() { 1000 public void actionPerformed(ActionEvent e) { 1001 int i = shopGateway.getSelectedIndex(); 1002 if ( i == 1 && (i = shopCurrency.getSelectedIndex()) != 0 && i != 2) { 1003 JOptionPane.showMessageDialog(window, texts.getString("ui.gcCurrencyWarning"), "Warning", JOptionPane.WARNING_MESSAGE); 1004 shopCurrency.setSelectedIndex(0); 1005 } 1006 }}; 1007 1008 { 1009 if ( license.length() == 0 ) { 1010 showShop.setSelected(false); 1011 commercialMonitor.add(showShop); 1012 } 1013 showShop.setToolTipText(texts.getString("ui.sellPhotosInfo")); 1014 shopGateway.setToolTipText(texts.getString("ui.paymentGatewayInfo")); 1015 shopGateway.addActionListener(checkCurrency); 1016 shopId.setToolTipText(texts.getString("ui.sellerIdInfo")); 1017 shopCurrency.setEditable(false); 1018 //shopCurrency.setToolTipText(texts.getString("ui.currencyInfo")); 1019 shopCurrency.addActionListener(checkCurrency); 1020 shopHandling.setToolTipText(texts.getString("ui.handlingInfo")); 1021 shopQuantityCap.setToolTipText(texts.getString("ui.shopQuantityCapInfo")); 1022 shopOptions.setToolTipText(texts.getString("ui.shopOptionsInfo")); 1023 shopOptions.setText("5x3.75\" Print=0.07\n6x4\" Print=0.1\n6x4.5\" Print=0.15\n7.5x5\" Print=0.3\n9x6\" Print=0.4\n12x8\" Print=1.0\n15x10\" Print=2.0"); 1024 shopOptions.setEditable(true); 1025 shopOptions.setLineWrap(true); 1026 shopOptions.setWrapStyleWord(true); 1027 1028 JScrollPane shopPane = new JScrollPane(shopOptions); 1029 ComponentUtilities.whenSelectedEnable(showShop, new JComponent[]{shopGateway, shopId, shopCurrency, shopHandling, shopQuantityCap, shopOptions}); 1030 1031 add(showShop); 1032 add(" ", new JLinkLabel("https://www.paypal.com/cgi-bin/webscr?cmd=_registration-run", "Paypal")); 1033 add(" ", new JLinkLabel("https://checkout.google.com/customer/gadget/businessSignup.html", "Google Checkout")); 1034 add("br", new JLabelFor(texts.getString("ui.paymentGateway"), shopGateway)); 1035 add("tab", shopGateway); 1036 add("br", new JLabelFor(texts.getString("ui.sellerId"), shopId)); 1037 add("tab hfill", shopId); 1038 add("br", new JLabelFor(texts.getString("ui.currency"), shopCurrency)); 1039 add("tab", shopCurrency); 1040 add("br", new JLabelFor(texts.getString("ui.handling"), shopHandling)); 1041 add("tab", shopHandling); 1042 add("tab", new JLabelFor(texts.getString("ui.shopQuantityCap"), shopQuantityCap)); 1043 add("tab", shopQuantityCap); 1044 add("br", new JLabelFor(texts.getString("ui.shopOptions"), shopOptions)); 1045 add("br hfill", shopPane); 1046 } 1047 }; 1048 1049 ControlPanel fotomoto = new ControlPanel("Fotomoto") { 1050 1051 JCheckBox useFotomoto = new JCheckBox(texts.getString("ui.useFotomoto")); 1052 JTextField fotomotoID = new JSmartTextField(); 1053 1054 { 1055 fotomotoID.setToolTipText(texts.getString("ui.fotomotoIDInfo")); 1056 ComponentUtilities.whenSelectedEnable(useFotomoto, new JComponent[]{fotomotoID}); 1057 1058 add(useFotomoto); 1059 add(new JLinkLabel("http://my.fotomoto.com/signup", texts.getString("ui.signUp"))); 1060 add("br", new JLabelFor(texts.getString("ui.sellerId"), fotomotoID)); 1061 add("tab hfill", fotomotoID); 1062 } 1063 1064 }; 1065 1066 { 1067 add("hfill", shoppingCart); 1068 add("br hfill", fotomoto); 1069 } 1070 }; 1071 1072 ControlPanel av = new ControlPanel() { 1073 1074 JCheckBox videoAutoPlay = new JCheckBox(texts.getString("ui.startVideo")); 1075 JTextField videoSize = new JSmartTextField("640x480", 10); 1076 JCheckBox audioAutoPlay = new JCheckBox(texts.getString("ui.startMusic")); 1077 1078 ControlPanel backgroundAudio = new ControlPanel(texts.getString("ui.backgroundMusic")) { 1079 1080 JCheckBox useAlbumAudioAsBackground = new JCheckBox(texts.getString("ui.useAlbumAudioAsBackground")); 1081 JPlaylist playlist = new JPlaylist(); 1082 JCheckBox backgroundAudioAutoPlay = new JCheckBox(texts.getString("ui.autoStart")); 1083 JCheckBox backgroundAudioLoop = new JCheckBox(texts.getString("ui.loop")); 1084 1085 { 1086 ComponentUtilities.whenSelectedDisable(useAlbumAudioAsBackground, new JComponent[]{playlist}); 1087 add(useAlbumAudioAsBackground); 1088 add("br hfill", playlist); 1089 add("br", backgroundAudioAutoPlay); 1090 add("tab", backgroundAudioLoop); 1091 } 1092 }; 1093 1094 { 1095 add("", videoAutoPlay); 1096 add("tab", new JLabel(texts.getString("ui.videoSize"))); 1097 add("", videoSize); 1098 add("br", audioAutoPlay); 1099 add("br hfill", backgroundAudio); 1100 } 1101 }; 1102 1103 ControlPanel advanced = new ControlPanel() { 1104 1105 ControlPanel general = new ControlPanel() { 1106 1107 JCheckBox enableMouseWheel = new JCheckBox(texts.getString("ui.enableMouseWheel"), true); 1108 JCheckBox enableKeyboard = new JCheckBox(texts.getString("ui.enableKeyboard"), true); 1109 JCheckBox autohideControls = new JCheckBox(texts.getString("ui.autohideControls"), true); 1110 JCheckBox rightClickProtect = new JCheckBox(texts.getString("ui.rightClickProtect")); 1111 JCheckBox preFormat = new JCheckBox(texts.getString("ui.preFormatPages"), true); 1112 JCheckBox copyFolderThumbs = new JCheckBox(texts.getString("ui.copyFolderThumbs"), false); 1113 JCheckBox addAltTags = new JCheckBox(texts.getString("ui.addAltTags"), true); 1114 JTextField googleSiteID = new JSmartTextField(); 1115 JTextField uploadPath = new JSmartTextField(); 1116 JCheckBox debugMode = new JCheckBox(texts.getString("ui.debugMode")); 1117 JTextField debugVars = new JSmartTextField(); 1118 1119 { 1120 enableMouseWheel.setToolTipText(texts.getString("ui.enableMouseWheelInfo")); 1121 enableKeyboard.setToolTipText(texts.getString("ui.enableKeyboardInfo")); 1122 autohideControls.setToolTipText(texts.getString("ui.autohideControlsInfo")); 1123 rightClickProtect.setToolTipText(texts.getString("ui.rightClickProtectInfo")); 1124 preFormat.setToolTipText(texts.getString("ui.preFormatPagesInfo")); 1125 copyFolderThumbs.setToolTipText(texts.getString("ui.copyFolderThumbsInfo")); 1126 addAltTags.setToolTipText(texts.getString("ui.addAltTagsInfo")); 1127 ComponentUtilities.whenSelectedEnable(preFormat, new JComponent[]{ 1128 formattingHint1h, formattingHint2h, 1129 formattingHint1f, formattingHint2f 1130 }); 1131 googleSiteID.setToolTipText(texts.getString("ui.googleSiteIDInfo")); 1132 uploadPath.setToolTipText(texts.getString("ui.uploadPathInfo")); 1133 ComponentUtilities.whenSelectedEnable(debugMode, new JComponent[]{debugVars}); 1134 1135 add("", enableMouseWheel); 1136 add("br", enableKeyboard); 1137 add("br", autohideControls); 1138 add("br", rightClickProtect); 1139 add("br", preFormat); 1140 add("br", copyFolderThumbs); 1141 add("br", addAltTags); 1142 add("br", new JLabelFor(texts.getString("ui.googleSiteID"), googleSiteID)); 1143 add("tab hfill", googleSiteID); 1144 add(" ", new JLinkLabel("http://www.google.com/analytics/", texts.getString("ui.signUp"))); 1145 add("br", new JLabelFor(texts.getString("ui.uploadPath"), uploadPath)); 1146 add("tab hfill", uploadPath); 1147 add("br", debugMode); 1148 add(" ", new JLabelFor(texts.getString("ui.variables"), debugVars)); 1149 add("hfill", debugVars); 1150 } 1151 }; 1152 1153 ControlPanel codeHooks = new ControlPanel() { 1154 1155 JTextArea headHook = new JSmartTextArea(5, 30); 1156 JScrollPane headHookPane = new JScrollPane(headHook); 1157 JTextArea bodyHook = new JSmartTextArea(5, 30); 1158 JScrollPane bodyHookPane = new JScrollPane(bodyHook); 1159 JTextArea cssHook = new JSmartTextArea(5, 30); 1160 JScrollPane cssHookPane = new JScrollPane(cssHook); 1161 1162 { 1163 headHook.setEditable(true); 1164 headHook.setLineWrap(false); 1165 bodyHook.setEditable(true); 1166 bodyHook.setLineWrap(false); 1167 cssHook.setEditable(true); 1168 cssHook.setLineWrap(false); 1169 1170 add(new JLabel("HEAD")); 1171 add("tab hfill", headHookPane); 1172 add("br", new JLabel("BODY")); 1173 add("tab hfill", bodyHookPane); 1174 add("br", new JLabel("CSS")); 1175 add("tab hfill", cssHookPane); 1176 } 1177 }; 1178 1179 JTabbedPane advancedTabs = new JTabbedPane() { 1180 1181 { 1182 addTab(texts.getString("ui.general"), general); 1183 addTab(texts.getString("ui.codeToAdd"), codeHooks); 1184 } 1185 }; 1186 1187 { 1188 add("hfill", advancedTabs); 1189 } 1190 1191 }; 1192 1193 ControlPanel about = new ControlPanel() { 1194 1195 { 1196 add("hfill vfill", aboutPanel ); 1197 } 1198 }; 1199 1200 JTabbedPane tabs = new JTabbedPane() { 1201 1202 { 1203 addTab(texts.getString("ui.site"), createImageIcon("site.png"), site); 1204 addTab(texts.getString("ui.design"), createImageIcon("design.png"), design); 1205 addTab(texts.getString("ui.header"), createImageIcon("header.png"), header); 1206 addTab(texts.getString("ui.thumbnails"), createImageIcon("index.png"), thumbnails); 1207 addTab(texts.getString("ui.footer"), createImageIcon("footer.png"), footer); 1208 addTab(texts.getString("ui.images"), createImageIcon("slide.png"), images); 1209 addTab(texts.getString("ui.social"), createImageIcon("share.png"), social); 1210 addTab(texts.getString("ui.photoData"), createImageIcon("photodata.png"), photoData); 1211 addTab(texts.getString("ui.map"), createImageIcon("map.png"), map); 1212 addTab(texts.getString("ui.sellingPhotos"), createImageIcon("shop.png"), shop); 1213 addTab(texts.getString("ui.audioVideo"), createImageIcon("av.png"), av); 1214 addTab(texts.getString("ui.advanced"), createImageIcon("advanced.png"), advanced); 1215 addTab(texts.getString("ui.about"), about); 1216 1217 } 1218 }; 1219 1220 { 1221 add("hfill vfill", tabs); 1222 add("br center", new JLabel("Jalbum " + internalVersion)); 1223 add(new JLinkLabel("http://jalbum.net/software/download/current", texts.getString("ui.upgrade"), texts.getString("ui.downloadJalbum"))); 1224 add(new JLabel("| " + skin + " skin " + (new SkinProperties(skinDirectory).getProperty(SkinProperties.VERSION)))); 1225 add(new JLinkLabel("http://jalbum.net/skins/skin/" + skin, texts.getString("ui.upgrade"), texts.getString("ui.downloadSkin"))); 1226 add(new JLabel("|")); 1227 add(new JLinkLabel("http://lazaworx.com/turtle-skin-settings-explained/", texts.getString("help"))); 1228 add(new JLabel("|")); 1229 add(new JLinkLabel("http://jalbum.net/forum/index.jspa?categoryID=1", texts.getString("ui.support"))); 1230 } 1231 1232 }; 1233 1234 class ImageDataUI extends JCustomPanel { 1235 1236 JTextField location = new JSmartTextField(10); 1237 JTextField videoSize = new JSmartTextField(10); 1238 JTextArea shopOptions = new JSmartTextArea(4, 10); 1239 JScrollPane shopPane = new JScrollPane(shopOptions); 1240 ImageDataUI(JAlbumContext context)1241 public ImageDataUI(JAlbumContext context) { 1242 super(context); 1243 setBackground(SystemColor.text); 1244 setOpaque(true); 1245 location.setToolTipText(texts.getString("ui.gpsLocationInfo")); 1246 videoSize.setToolTipText(texts.getString("ui.videoSizeInfo")); 1247 shopOptions.setToolTipText(texts.getString("ui.shopOptionsInfo")); 1248 shopOptions.setText(""); 1249 shopOptions.setEditable(true); 1250 shopOptions.setLineWrap(true); 1251 shopOptions.setWrapStyleWord(true); 1252 1253 add(new JLabel(texts.getString("ui.gpsLocation"))); 1254 add("tab hfill", location); 1255 add("br", new JLabel(texts.getString("ui.videoSize"))); 1256 add("tab hfill", videoSize); 1257 add("br", new JLabel(texts.getString("ui.shopOptions"))); 1258 add("br hfill vfill", shopPane); 1259 1260 init(); 1261 } 1262 } 1263 1264 class ExternalContentUI extends JCustomPanel { 1265 1266 JTextArea externalContent = new JSmartTextArea(3, 10); 1267 JScrollPane externalContentPane = new JScrollPane(externalContent); 1268 JTextField externalContentSize = new JSmartTextField(10); 1269 ExternalContentUI(JAlbumContext context)1270 public ExternalContentUI(JAlbumContext context) { 1271 super(context); 1272 setBackground(SystemColor.text); 1273 setOpaque(true); 1274 externalContent.setToolTipText(texts.getString("ui.externalContentInfo")); 1275 externalContent.setText(""); 1276 externalContent.setEditable(true); 1277 externalContent.setLineWrap(true); 1278 externalContent.setWrapStyleWord(true); 1279 externalContentSize.setToolTipText(texts.getString("ui.externalContentSizeInfo")); 1280 1281 add(new JLabel(texts.getString("ui.externalContent"))); 1282 add("br hfill vfill", externalContentPane); 1283 add("br", new JLabel(texts.getString("ui.externalContentSize"))); 1284 add("tab hfill", externalContentSize); 1285 1286 init(); 1287 1288 } 1289 } 1290 Gui(JAlbumWindow window, JAlbumContext context)1291 public Gui(JAlbumWindow window, JAlbumContext context) { 1292 1293 super(context.getEngine()); 1294 PluginContext pc = context.getPluginContext(); 1295 EditPanel editPanel = pc.getEditPanel(); 1296 1297 ImageDataUI imageDataUI = new ImageDataUI(context); 1298 ExternalContentUI externalContentUI = new ExternalContentUI(context); 1299 1300 editPanel.addCustomTab(texts.getString("ui.imageData"), imageDataUI); 1301 editPanel.addCustomTab(texts.getString("ui.external"), externalContentUI); 1302 1303 ui.setBorder(BorderFactory.createEmptyBorder()); 1304 window.setSkinUI(ui); 1305 window.pack(); 1306 1307 // Check for variables need to change in albums made with an older skin version 1308 if ( !engine.getSkinVariables().containsKey("skinVersion") ) { 1309 window.ui2Engine(); 1310 engine.setSlides(false); 1311 context.getFrame().engine2UI(); 1312 } 1313 1314 } 1315 1316 } 1317