Browse Source

Fixing UI glitches.

v1.2.3
Abhishek Banthia 9 years ago
parent
commit
b77a2ca3f8
  1. BIN
      Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate
  2. 1
      Clocker/MenubarController.h
  3. 33
      Clocker/MenubarController.m
  4. 12
      Clocker/Panel.xib
  5. 30
      Clocker/PanelController.m

BIN
Clocker.xcodeproj/project.xcworkspace/xcuserdata/abhishekbanthia.xcuserdatad/UserInterfaceState.xcuserstate generated

Binary file not shown.

1
Clocker/MenubarController.h

@ -40,6 +40,7 @@
@property (nonatomic) BOOL hasActiveIcon;
@property (nonatomic, strong, readonly) NSStatusItem *statusItem;
@property (nonatomic, strong, readonly) StatusItemView *statusItemView;
@property (nonatomic, strong) NSTimer *iconUpdateTimer;
- (void)setInitialTimezoneData;

33
Clocker/MenubarController.m

@ -23,7 +23,8 @@
NSStatusItem *statusItem;
NSTextField *textField;
if (dataObject) {
if (dataObject)
{
CLTimezoneData *timezoneObject = [CLTimezoneData getCustomObject:dataObject];
menuTitle = [timezoneObject getMenuTitle];
@ -36,10 +37,15 @@
[textField sizeToFit];
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:textField.frame.size.width+3];
[self shouldIconBeUpdated:YES];
}
else
{
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:STATUS_ITEM_VIEW_WIDTH];
[self shouldIconBeUpdated:NO];
}
@ -47,12 +53,7 @@
_statusItemView.image = dataObject ? [self imageWithSubviewsWithTextField:textField] : [NSImage imageNamed:@"MenuIcon"];
_statusItemView.alternateImage = [NSImage imageNamed:@"StatusHighlighted"];
_statusItemView.action = @selector(togglePanel:);
[NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(updateIconDisplay)
userInfo:nil
repeats:YES];
}
}
return self;
}
@ -66,6 +67,24 @@
[self.statusItemView setNeedsDisplay:YES];
}
- (void)shouldIconBeUpdated:(BOOL)value
{
if (value)
{
self.iconUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(updateIconDisplay)
userInfo:nil
repeats:YES];
}
else
{
[self.iconUpdateTimer invalidate];
self.iconUpdateTimer = nil;
}
}
- (NSImage *)imageWithSubviewsWithTextField:(NSTextField *)textField
{
NSSize mySize = textField.bounds.size;

12
Clocker/Panel.xib

@ -225,7 +225,7 @@
</connections>
</slider>
<button toolTip="Open Preferences" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OFy-u1-TnH">
<rect key="frame" x="246" y="11" width="29" height="19"/>
<rect key="frame" x="246" y="4" width="29" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="29" id="MIQ-4K-E5A"/>
<constraint firstAttribute="height" constant="18" id="X7D-ep-wB4"/>
@ -239,12 +239,12 @@
</connections>
</button>
<button toolTip="Close Clocker" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nTt-pf-Hw2">
<rect key="frame" x="0.0" y="11" width="29" height="19"/>
<rect key="frame" x="0.0" y="4" width="29" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="29" id="8kZ-Pj-VK6"/>
<constraint firstAttribute="height" constant="18" id="sVG-VE-3q4"/>
</constraints>
<buttonCell key="cell" type="recessed" bezelStyle="recessed" image="PowerIcon" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="sUh-16-Fhk">
<buttonCell key="cell" type="recessed" bezelStyle="recessed" image="PowerIcon" imagePosition="only" alignment="center" alternateImage="PowerIcon" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="sUh-16-Fhk">
<behavior key="behavior" lightByContents="YES"/>
<font key="font" metaFont="systemBold" size="12"/>
</buttonCell>
@ -255,16 +255,16 @@
</subviews>
<constraints>
<constraint firstItem="4Gd-Nv-fXr" firstAttribute="top" secondItem="6" secondAttribute="top" constant="8" id="1g0-Hm-7Gh"/>
<constraint firstItem="dFw-ts-8OZ" firstAttribute="leading" secondItem="nTt-pf-Hw2" secondAttribute="trailing" constant="-30" id="4aK-71-fsY"/>
<constraint firstItem="rGL-w7-iSa" firstAttribute="centerX" secondItem="T7e-RS-eTE" secondAttribute="centerX" constant="1" id="5NW-NQ-wPO"/>
<constraint firstItem="T7e-RS-eTE" firstAttribute="top" secondItem="dFw-ts-8OZ" secondAttribute="bottom" constant="-30" id="96B-lf-iFV"/>
<constraint firstAttribute="bottom" secondItem="nTt-pf-Hw2" secondAttribute="bottom" constant="5" id="Alf-Sy-CEF"/>
<constraint firstItem="T7e-RS-eTE" firstAttribute="leading" secondItem="nTt-pf-Hw2" secondAttribute="trailing" constant="2" id="GgQ-58-tbc"/>
<constraint firstItem="nTt-pf-Hw2" firstAttribute="top" secondItem="dFw-ts-8OZ" secondAttribute="bottom" constant="-30" id="LV3-1D-GqQ"/>
<constraint firstAttribute="trailing" secondItem="4Gd-Nv-fXr" secondAttribute="trailing" constant="-1" id="XP6-W0-2XT"/>
<constraint firstAttribute="bottom" secondItem="OFy-u1-TnH" secondAttribute="bottom" constant="5" id="an1-GW-fs9"/>
<constraint firstItem="T7e-RS-eTE" firstAttribute="top" secondItem="rGL-w7-iSa" secondAttribute="bottom" constant="1" id="cuU-JZ-uRn"/>
<constraint firstItem="4Gd-Nv-fXr" firstAttribute="leading" secondItem="6" secondAttribute="leading" constant="-1" id="fHc-VQ-mJ3"/>
<constraint firstAttribute="trailing" secondItem="OFy-u1-TnH" secondAttribute="trailing" constant="5" id="p2a-qj-LHE"/>
<constraint firstItem="OFy-u1-TnH" firstAttribute="top" secondItem="dFw-ts-8OZ" secondAttribute="bottom" constant="-30" id="snA-N5-mgY"/>
<constraint firstItem="nTt-pf-Hw2" firstAttribute="leading" secondItem="6" secondAttribute="leading" id="uxy-ac-DRN"/>
<constraint firstItem="OFy-u1-TnH" firstAttribute="leading" secondItem="T7e-RS-eTE" secondAttribute="trailing" constant="2" id="vVD-Or-EZX"/>
</constraints>
</view>

30
Clocker/PanelController.m

@ -502,50 +502,30 @@ static PanelController *sharedPanel = nil;
{
if (self.showReviewCell) {
self.sliderLabel.hidden = YES;
self.panelWindow.sliderLabel.hidden = YES;
return;
}
if (!self.futureSlider.isHidden) {
self.sliderLabel.hidden = !value;
self.panelWindow.sliderLabel.hidden = !value;
}
if (self.defaultPreferences.count == 0)
{
value = YES;
if (!self.futureSlider.isHidden)
{
self.sliderLabel.hidden = YES;
}
}
if (self.panelWindow.defaultPreferences.count == 0)
{
value = YES;
dispatch_async(dispatch_get_main_queue(), ^{
self.shutdownButton.hidden = !value;
self.preferencesButton.hidden = !value;
if (!self.panelWindow.futureSlider.isHidden)
{
self.panelWindow.sliderLabel.hidden = YES;
}
}
self.panelWindow.shutdownButton.hidden = !value;
self.panelWindow.preferencesButton.hidden = !value;
if (value)
{
self.panelWindow.window.styleMask = NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask;
}
else
{
self.panelWindow.window.styleMask = NSBorderlessWindowMask;
}
self.shutdownButton.hidden = !value;
self.preferencesButton.hidden = !value;
});
}

Loading…
Cancel
Save