~ubuntu-branches/ubuntu/trusty/xscreensaver/trusty

« back to all changes in this revision

Viewing changes to OSX/XScreenSaverConfigSheet.m

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2009-11-30 13:33:13 UTC
  • mfrom: (1.1.8 upstream) (2.1.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091130133313-3b5nz2e7hvbb8h3l
Tags: 5.10-3ubuntu1
* Merge with Debian unstable, remaining changes: (LP: #489062)
  - debian/control: add Build-Depends on ubuntu-artwork
  - debian/rules: use /usr/share/backgrounds
  - debian/control: Move xli | xloadimage recommends to suggests
  - debian/split-hacks.config: Use different set of default hacks to Debian
  - debian/source_xscreensaver.py: Add apport hook
  - debian/patches/53_XScreenSaver.ad.in.patch: Use Ubuntu branding

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* xscreensaver, Copyright (c) 2006-2008 Jamie Zawinski <jwz@jwz.org>
 
1
/* xscreensaver, Copyright (c) 2006-2009 Jamie Zawinski <jwz@jwz.org>
2
2
 *
3
3
 * Permission to use, copy, modify, distribute, and sell this software and its
4
4
 * documentation for any purpose is hereby granted without fee, provided that
483
483
                                     types:nil];
484
484
  if (result == NSOKButton) {
485
485
    NSArray *files = [panel filenames];
486
 
    NSString *file = ([files count] > 0 ? [files objectAtIndex:0] : @"");
 
486
    file = ([files count] > 0 ? [files objectAtIndex:0] : @"");
487
487
    file = [file stringByAbbreviatingWithTildeInPath];
488
488
    [txt setStringValue:file];
489
489
 
1047
1047
anchorize (const char *url)
1048
1048
{
1049
1049
  const char *wiki = "http://en.wikipedia.org/wiki/";
 
1050
  const char *math = "http://mathworld.wolfram.com/";
1050
1051
  if (!strncmp (wiki, url, strlen(wiki))) {
1051
1052
    char *anchor = (char *) malloc (strlen(url) * 3 + 10);
1052
1053
    strcpy (anchor, "Wikipedia: \"");
1076
1077
    *out = 0;
1077
1078
    return anchor;
1078
1079
 
 
1080
  } else if (!strncmp (math, url, strlen(math))) {
 
1081
    char *anchor = (char *) malloc (strlen(url) * 3 + 10);
 
1082
    strcpy (anchor, "MathWorld: \"");
 
1083
    const char *start = url + strlen(wiki);
 
1084
    const char *in = start;
 
1085
    char *out = anchor + strlen(anchor);
 
1086
    while (*in) {
 
1087
      if (*in == '_') {
 
1088
        *out++ = ' ';
 
1089
      } else if (in != start && *in >= 'A' && *in <= 'Z') {
 
1090
        *out++ = ' ';
 
1091
        *out++ = *in;
 
1092
      } else if (!strncmp (in, ".htm", 4)) {
 
1093
        break;
 
1094
      } else {
 
1095
        *out++ = *in;
 
1096
      }
 
1097
      in++;
 
1098
    }
 
1099
    *out++ = '"';
 
1100
    *out = 0;
 
1101
    return anchor;
 
1102
 
1079
1103
  } else {
1080
1104
    return strdup (url);
1081
1105
  }
1606
1630
  f = [text frame];
1607
1631
  float dh = f.size.height - oh;
1608
1632
  f.origin.y += dh;
 
1633
 
 
1634
  // #### This is needed in OSX 10.5, but is wrong in OSX 10.6.  WTF??
 
1635
  //      If we do this in 10.6, the text field moves down, off the window.
 
1636
  //      So instead we repair it at the end, at the "WTF2" comment.
1609
1637
  [text setFrame:f];
1610
1638
 
1611
1639
  // Also adjust the parent height by the change in height of the text field.
1643
1671
//          f.origin.y + f.size.height, [kid class]);
1644
1672
  }
1645
1673
  
 
1674
/*
 
1675
Bad:
 
1676
 parent: 420 x 541 @   0   0
 
1677
 text:   380 x 100 @  20  22  miny=-501
 
1678
 
 
1679
Good:
 
1680
 parent: 420 x 541 @   0   0
 
1681
 text:   380 x 100 @  20  50  miny=-501
 
1682
*/
 
1683
 
 
1684
  // #### WTF2: See "WTF" above.  If the text field is off the screen,
 
1685
  //      move it up.  We need this on 10.6 but not on 10.5.  Auugh.
 
1686
  //
 
1687
  f = [text frame];
 
1688
  if (f.origin.y < 50) {    // magic numbers, yay
 
1689
    f.origin.y = 50;
 
1690
    [text setFrame:f];
 
1691
  }
 
1692
 
1646
1693
  /* Set the kids to track the top left corner of the window when resized.
1647
1694
     Set the NSText to track the bottom right corner as well.
1648
1695
   */