tweaks to the value tracking slider (doesn't draw outside the superview bounds) and assign proper copyright notice to it
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController-iPad.xib Sun Feb 12 18:08:34 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController-iPad.xib Sun Feb 12 18:50:22 2012 +0100
@@ -12,7 +12,6 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -47,6 +46,7 @@
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{1024, 768}</string>
<reference key="NSSuperview" ref="766721923"/>
+ <reference key="NSWindow"/>
<bool key="IBUIAutoresizesSubviews">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
@@ -61,6 +61,7 @@
<int key="NSvFlags">301</int>
<string key="NSFrame">{{357, 17}, {309, 165}}</string>
<reference key="NSSuperview" ref="766721923"/>
+ <reference key="NSWindow"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
@@ -74,6 +75,7 @@
<int key="NSvFlags">301</int>
<string key="NSFrame">{{441, 702}, {142, 64}}</string>
<reference key="NSSuperview" ref="766721923"/>
+ <reference key="NSWindow"/>
<bool key="IBUIOpaque">NO</bool>
<int key="IBUITag">1</int>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
@@ -106,6 +108,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{20, 693}, {64, 64}}</string>
<reference key="NSSuperview" ref="766721923"/>
+ <reference key="NSWindow"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
@@ -127,6 +130,7 @@
<int key="NSvFlags">265</int>
<string key="NSFrame">{{940, 693}, {64, 64}}</string>
<reference key="NSSuperview" ref="766721923"/>
+ <reference key="NSWindow"/>
<bool key="IBUIOpaque">NO</bool>
<int key="IBUITag">2</int>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
@@ -149,6 +153,7 @@
<int key="NSvFlags">301</int>
<string key="NSFrame">{{0, 60}, {320, 620}}</string>
<reference key="NSSuperview" ref="766721923"/>
+ <reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor" id="720784738">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwAA</bytes>
@@ -162,6 +167,7 @@
<int key="NSvFlags">301</int>
<string key="NSFrame">{{337, 187}, {350, 505}}</string>
<reference key="NSSuperview" ref="766721923"/>
+ <reference key="NSWindow"/>
<reference key="IBUIBackgroundColor" ref="720784738"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@@ -172,6 +178,7 @@
<int key="NSvFlags">292</int>
<string key="NSFrame">{{269, 724}, {150, 23}}</string>
<reference key="NSSuperview" ref="766721923"/>
+ <reference key="NSWindow"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
@@ -182,6 +189,7 @@
</object>
<string key="NSFrameSize">{1024, 768}</string>
<reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
<reference key="IBUIBackgroundColor" ref="473179629"/>
<bool key="IBUIClipsSubviews">YES</bool>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
@@ -509,7 +517,7 @@
<string>MapConfigViewController</string>
<string>{{126, 377}, {1024, 768}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>ValueTrackingSliderView</string>
+ <string>MNEValueTrackingSlider</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">AUNRAABEMoAAA</bytes>
@@ -781,7 +789,7 @@
<string key="superclassName">UISlider</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ValueTrackingSliderView.h</string>
+ <string key="minorKey">Classes/MNEValueTrackingSlider.h</string>
</object>
</object>
</object>
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController-iPhone.xib Sun Feb 12 18:08:34 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController-iPhone.xib Sun Feb 12 18:50:22 2012 +0100
@@ -514,12 +514,14 @@
<string>mapConfigViewController</string>
<string>schemeWeaponConfigViewController</string>
<string>teamConfigViewController</string>
+ <string>titleImage</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>MapConfigViewController</string>
<string>SchemeWeaponConfigViewController</string>
<string>TeamConfigViewController</string>
+ <string>UIImageView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
@@ -529,6 +531,7 @@
<string>mapConfigViewController</string>
<string>schemeWeaponConfigViewController</string>
<string>teamConfigViewController</string>
+ <string>titleImage</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -544,6 +547,10 @@
<string key="name">teamConfigViewController</string>
<string key="candidateClassName">TeamConfigViewController</string>
</object>
+ <object class="IBToOneOutletInfo">
+ <string key="name">titleImage</string>
+ <string key="candidateClassName">UIImageView</string>
+ </object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -607,7 +614,6 @@
<string>maxLabel</string>
<string>previewButton</string>
<string>segmentedControl</string>
- <string>sizeLabel</string>
<string>slider</string>
<string>tableView</string>
</object>
@@ -616,8 +622,7 @@
<string>UILabel</string>
<string>MapPreviewButtonView</string>
<string>UISegmentedControl</string>
- <string>UILabel</string>
- <string>UISlider</string>
+ <string>ValueTrackingSliderView</string>
<string>UITableView</string>
</object>
</object>
@@ -628,7 +633,6 @@
<string>maxLabel</string>
<string>previewButton</string>
<string>segmentedControl</string>
- <string>sizeLabel</string>
<string>slider</string>
<string>tableView</string>
</object>
@@ -647,12 +651,8 @@
<string key="candidateClassName">UISegmentedControl</string>
</object>
<object class="IBToOneOutletInfo">
- <string key="name">sizeLabel</string>
- <string key="candidateClassName">UILabel</string>
- </object>
- <object class="IBToOneOutletInfo">
<string key="name">slider</string>
- <string key="candidateClassName">UISlider</string>
+ <string key="candidateClassName">ValueTrackingSliderView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">tableView</string>
@@ -702,14 +702,22 @@
</object>
<object class="IBPartialClassDescription">
<string key="className">UILabel</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="270765233">
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="910572871">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">ExtraCategories.h</string>
+ <string key="minorKey">Classes/ExtraCategories.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UITableView</string>
- <reference key="sourceIdentifier" ref="270765233"/>
+ <reference key="sourceIdentifier" ref="910572871"/>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">ValueTrackingSliderView</string>
+ <string key="superclassName">UISlider</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/MNEValueTrackingSlider.h</string>
+ </object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
@@ -852,6 +860,14 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">UIImageView</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIImageView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">UILabel</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/MNEValueTrackingSlider.h Sun Feb 12 18:50:22 2012 +0100
@@ -0,0 +1,22 @@
+//
+// MNEValueTrackingSlider
+//
+// Copyright 2011 Michael Neuwert
+// "You can use the code in your own project and modify it as you like."
+// http://blog.neuwert-media.com/2011/04/customized-uislider-with-visual-value-tracking/
+//
+
+
+#import <Foundation/Foundation.h>
+
+@class SliderValuePopupView;
+
+@interface MNEValueTrackingSlider : UISlider {
+ SliderValuePopupView *valuePopupView;
+ NSString *textValue;
+}
+
+@property (nonatomic, readonly) CGRect thumbRect;
+@property (nonatomic, retain) NSString *textValue;
+
+@end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/MNEValueTrackingSlider.m Sun Feb 12 18:50:22 2012 +0100
@@ -0,0 +1,200 @@
+//
+// MNEValueTrackingSlider
+//
+// Copyright 2011 Michael Neuwert
+// "You can use the code in your own project and modify it as you like."
+// http://blog.neuwert-media.com/2011/04/customized-uislider-with-visual-value-tracking/
+//
+
+
+#import "MNEValueTrackingSlider.h"
+
+#pragma mark -
+#pragma mark Private UIView subclass rendering the popup showing slider value
+@interface SliderValuePopupView : UIView
+@property (nonatomic, retain) UIFont *font;
+@property (nonatomic, copy) NSString *text;
+@property (nonatomic) float arrowOffset;
+@end
+
+@implementation SliderValuePopupView
+
+@synthesize font = _font;
+@synthesize text = _text;
+@synthesize arrowOffset = _arrowOffset;
+
+-(id) initWithFrame:(CGRect) frame {
+ self = [super initWithFrame:frame];
+ if (self) {
+ self.font = [UIFont boldSystemFontOfSize:18];
+ }
+ return self;
+}
+
+-(void) dealloc {
+ self.text = nil;
+ self.font = nil;
+ [super dealloc];
+}
+
+-(void) drawRect:(CGRect) rect {
+ // Create the path for the rounded rectangle
+ CGRect roundedRect = CGRectMake(self.bounds.origin.x, self.bounds.origin.y, self.bounds.size.width, floorf(self.bounds.size.height * 0.8));
+ UIBezierPath *roundedRectPath = [UIBezierPath bezierPathWithRoundedRect:roundedRect cornerRadius:6.0];
+ roundedRectPath.lineWidth = 2.0f;
+
+ // Create the arrow path
+ UIBezierPath *arrowPath = [UIBezierPath bezierPath];
+ /*
+ // Make sure the arrow offset is nice
+ if (-self.arrowOffset + 1 > CGRectGetMidX(self.bounds) / 2)
+ self.arrowOffset = -CGRectGetMidX(self.bounds) / 2 + 1;
+ if (self.arrowOffset > CGRectGetMidX(self.bounds) / 2)
+ self.arrowOffset = CGRectGetMidX(self.bounds) / 2 -1;
+ */
+
+ CGFloat midX = CGRectGetMidX(self.bounds) + self.arrowOffset;
+ CGPoint p0 = CGPointMake(midX, CGRectGetMaxY(self.bounds));
+ [arrowPath moveToPoint:p0];
+ [arrowPath addLineToPoint:CGPointMake((midX - 10.0), CGRectGetMaxY(roundedRect))];
+ [arrowPath addLineToPoint:CGPointMake((midX + 10.0), CGRectGetMaxY(roundedRect))];
+ [arrowPath closePath];
+
+ // Attach the arrow path to the rounded rect
+ [roundedRectPath appendPath:arrowPath];
+
+ // Color various sections
+ [[UIColor blackColor] setFill];
+ [roundedRectPath fill];
+ [[UIColor whiteColor] setStroke];
+ [roundedRectPath stroke];
+ [[UIColor whiteColor] setFill];
+ [arrowPath fill];
+
+ // Draw the text
+ if (self.text) {
+ [[UIColor lightYellowColor] set];
+ CGSize s = [_text sizeWithFont:self.font];
+ CGFloat yOffset = (roundedRect.size.height - s.height) / 2;
+ CGRect textRect = CGRectMake(roundedRect.origin.x, yOffset, roundedRect.size.width, s.height);
+
+ [_text drawInRect:textRect
+ withFont:self.font
+ lineBreakMode:UILineBreakModeWordWrap
+ alignment:UITextAlignmentCenter];
+ }
+}
+
+@end
+
+#pragma mark -
+#pragma mark MNEValueTrackingSlider implementations
+@implementation MNEValueTrackingSlider
+
+@synthesize thumbRect, textValue;
+
+#pragma Private methods
+
+-(void) _constructSlider {
+ valuePopupView = [[SliderValuePopupView alloc] initWithFrame:CGRectZero];
+ valuePopupView.backgroundColor = [UIColor clearColor];
+ valuePopupView.alpha = 0.0;
+ [self addSubview:valuePopupView];
+}
+
+-(void) _fadePopupViewInAndOut:(BOOL)aFadeIn {
+ [UIView beginAnimations:nil context:NULL];
+ [UIView setAnimationDuration:0.25];
+ if (aFadeIn) {
+ valuePopupView.alpha = 1.0;
+ } else {
+ valuePopupView.alpha = 0.0;
+ }
+ [UIView commitAnimations];
+}
+
+-(void) _positionAndUpdatePopupView {
+ CGRect _thumbRect = self.thumbRect;
+ CGRect popupRect = CGRectOffset(_thumbRect, 0, -floorf(_thumbRect.size.height * 1.5));
+ // (-100, -15) determines the size of the the rect
+ popupRect = CGRectInset(popupRect, -100, -15);
+
+ // this prevents drawing the popup outside the slider view
+ if (popupRect.origin.x < -self.frame.origin.x+5)
+ popupRect.origin.x = -self.frame.origin.x+5;
+ else if (popupRect.origin.x > self.superview.frame.size.width - popupRect.size.width - self.frame.origin.x - 5)
+ popupRect.origin.x = self.superview.frame.size.width - popupRect.size.width - self.frame.origin.x - 5;
+ //else if (CGRectGetMaxX(popupRect) > CGRectGetMaxX(self.superview.bounds))
+ // popupRect.origin.x = CGRectGetMaxX(self.superview.bounds) - CGRectGetWidth(popupRect) - 1.0;
+
+ valuePopupView.arrowOffset = CGRectGetMidX(_thumbRect) - CGRectGetMidX(popupRect);
+
+ valuePopupView.frame = popupRect;
+ valuePopupView.text = self.textValue;
+ [valuePopupView setNeedsDisplay];
+}
+
+#pragma mark Memory management
+
+-(id) initWithFrame:(CGRect) frame {
+ self = [super initWithFrame:frame];
+ if (self) {
+ [self _constructSlider];
+ }
+ return self;
+}
+
+-(id) initWithCoder:(NSCoder *)aDecoder {
+ self = [super initWithCoder:aDecoder];
+ if (self) {
+ [self _constructSlider];
+ }
+ return self;
+}
+
+-(void) dealloc {
+ [valuePopupView release];
+ [textValue release];
+ [super dealloc];
+}
+
+#pragma mark -
+#pragma mark UIControl touch event tracking
+-(BOOL) beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
+ // Fade in and update the popup view
+ CGPoint touchPoint = [touch locationInView:self];
+ // Check if the knob is touched. Only in this case show the popup-view
+ if(CGRectContainsPoint(CGRectInset(self.thumbRect, -14.0, -12.0), touchPoint)) {
+ [self _positionAndUpdatePopupView];
+ [self _fadePopupViewInAndOut:YES];
+ }
+ return [super beginTrackingWithTouch:touch withEvent:event];
+}
+
+-(BOOL) continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
+ // Update the popup view as slider knob is being moved
+ [self _positionAndUpdatePopupView];
+ return [super continueTrackingWithTouch:touch withEvent:event];
+}
+
+-(void) cancelTrackingWithEvent:(UIEvent *)event {
+ [super cancelTrackingWithEvent:event];
+}
+
+-(void) endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
+ // Fade out the popoup view
+ [self _fadePopupViewInAndOut:NO];
+ [super endTrackingWithTouch:touch withEvent:event];
+}
+
+#pragma mark -
+#pragma mark Custom property accessors
+-(CGRect) thumbRect {
+ CGRect trackRect = [self trackRectForBounds:self.bounds];
+ CGRect thumbR = [self thumbRectForBounds:self.bounds
+ trackRect:trackRect
+ value:self.value];
+ return thumbR;
+}
+
+@end
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPad.xib Sun Feb 12 18:08:34 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPad.xib Sun Feb 12 18:50:22 2012 +0100
@@ -392,7 +392,6 @@
<string>maxLabel</string>
<string>previewButton</string>
<string>segmentedControl</string>
- <string>sizeLabel</string>
<string>slider</string>
<string>tableView</string>
</object>
@@ -401,8 +400,7 @@
<string>UILabel</string>
<string>MapPreviewButtonView</string>
<string>UISegmentedControl</string>
- <string>UILabel</string>
- <string>UISlider</string>
+ <string>ValueTrackingSliderView</string>
<string>UITableView</string>
</object>
</object>
@@ -413,7 +411,6 @@
<string>maxLabel</string>
<string>previewButton</string>
<string>segmentedControl</string>
- <string>sizeLabel</string>
<string>slider</string>
<string>tableView</string>
</object>
@@ -432,12 +429,8 @@
<string key="candidateClassName">UISegmentedControl</string>
</object>
<object class="IBToOneOutletInfo">
- <string key="name">sizeLabel</string>
- <string key="candidateClassName">UILabel</string>
- </object>
- <object class="IBToOneOutletInfo">
<string key="name">slider</string>
- <string key="candidateClassName">UISlider</string>
+ <string key="candidateClassName">ValueTrackingSliderView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">tableView</string>
@@ -480,6 +473,14 @@
<string key="className">UITableView</string>
<reference key="sourceIdentifier" ref="823133985"/>
</object>
+ <object class="IBPartialClassDescription">
+ <string key="className">ValueTrackingSliderView</string>
+ <string key="superclassName">UISlider</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/MNEValueTrackingSlider.h</string>
+ </object>
+ </object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPhone.xib Sun Feb 12 18:08:34 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController-iPhone.xib Sun Feb 12 18:50:22 2012 +0100
@@ -12,7 +12,6 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -38,7 +37,7 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -192,7 +191,6 @@
</object>
</object>
<string key="NSFrameSize">{480, 276}</string>
- <reference key="NSSuperview"/>
<reference key="IBUIBackgroundColor" ref="437070330"/>
<object class="IBUISimulatedToolbarMetrics" key="IBUISimulatedBottomBarMetrics"/>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
@@ -428,7 +426,7 @@
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABBUAAAwigAAA</bytes>
</object>
- <string>ValueTrackingSliderView</string>
+ <string>MNEValueTrackingSlider</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABCWAAAw4IAAA</bytes>
@@ -603,7 +601,7 @@
<string key="superclassName">UISlider</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Classes/ValueTrackingSliderView.h</string>
+ <string key="minorKey">Classes/MNEValueTrackingSlider.h</string>
</object>
</object>
</object>
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Sun Feb 12 18:08:34 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Sun Feb 12 18:50:22 2012 +0100
@@ -21,7 +21,7 @@
#import <UIKit/UIKit.h>
#import "MapPreviewButtonView.h"
-#import "ValueTrackingSliderView.h"
+#import "MNEValueTrackingSlider.h"
@interface MapConfigViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, MapPreviewViewDelegate> {
NSInteger oldValue; // for the slider
@@ -43,7 +43,7 @@
UITableView *tableView;
UILabel *maxLabel;
UISegmentedControl *segmentedControl;
- ValueTrackingSliderView *slider;
+ MNEValueTrackingSlider *slider;
// internal objects
NSIndexPath *lastIndexPath;
@@ -67,7 +67,7 @@
@property (nonatomic,retain) IBOutlet UITableView *tableView;
@property (nonatomic,retain) IBOutlet UILabel *maxLabel;
@property (nonatomic,retain) IBOutlet UISegmentedControl *segmentedControl;
-@property (nonatomic,retain) IBOutlet ValueTrackingSliderView *slider;
+@property (nonatomic,retain) IBOutlet MNEValueTrackingSlider *slider;
@property (nonatomic,retain) NSIndexPath *lastIndexPath;
@property (nonatomic,retain) NSArray *dataSourceArray;
--- a/project_files/HedgewarsMobile/Classes/ValueTrackingSliderView.h Sun Feb 12 18:08:34 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Hedgewars-iOS, a Hedgewars port for iOS devices
- * Copyright (c) 2009-2011 Vittorio Giovara <vittorio.giovara@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * File created on 06/02/2012.
- */
-
-// class heavily based on: http://blog.neuwert-media.com/2011/04/customized-uislider-with-visual-value-tracking/
-
-
-#import <Foundation/Foundation.h>
-
-@class SliderValuePopupView;
-
-@interface ValueTrackingSliderView : UISlider {
- SliderValuePopupView *valuePopupView;
- NSString *textValue;
-}
-
-@property (nonatomic, readonly) CGRect thumbRect;
-@property (nonatomic, retain) NSString *textValue;
-
-@end
--- a/project_files/HedgewarsMobile/Classes/ValueTrackingSliderView.m Sun Feb 12 18:08:34 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*
- * Hedgewars-iOS, a Hedgewars port for iOS devices
- * Copyright (c) 2009-2011 Vittorio Giovara <vittorio.giovara@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * File created on 06/02/2012.
- */
-
-// class heavily based on: http://blog.neuwert-media.com/2011/04/customized-uislider-with-visual-value-tracking/
-
-
-#import "ValueTrackingSliderView.h"
-
-#pragma mark -
-#pragma mark Private UIView subclass rendering the popup showing slider value
-@interface SliderValuePopupView : UIView
-@property (nonatomic) float value;
-@property (nonatomic, retain) UIFont *font;
-@property (nonatomic, retain) NSString *text;
-@end
-
-@implementation SliderValuePopupView
-
-@synthesize value = _value;
-@synthesize font = _font;
-@synthesize text = _text;
-
--(id) initWithFrame:(CGRect) frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.font = [UIFont boldSystemFontOfSize:18];
- }
- return self;
-}
-
--(void) dealloc {
- self.text = nil;
- self.font = nil;
- [super dealloc];
-}
-
--(void) drawRect:(CGRect) rect {
- // Create the path for the rounded rectangle
- CGRect roundedRect = CGRectMake(self.bounds.origin.x, self.bounds.origin.y, self.bounds.size.width, floorf(self.bounds.size.height * 0.8));
- UIBezierPath *roundedRectPath = [UIBezierPath bezierPathWithRoundedRect:roundedRect cornerRadius:6.0];
- roundedRectPath.lineWidth = 2.0f;
-
- // Create the arrow path
- UIBezierPath *arrowPath = [UIBezierPath bezierPath];
- CGFloat midX = CGRectGetMidX(self.bounds);
- CGPoint p0 = CGPointMake(midX, CGRectGetMaxY(self.bounds));
- [arrowPath moveToPoint:p0];
- [arrowPath addLineToPoint:CGPointMake((midX - 10.0), CGRectGetMaxY(roundedRect))];
- [arrowPath addLineToPoint:CGPointMake((midX + 10.0), CGRectGetMaxY(roundedRect))];
- [arrowPath closePath];
-
- // Attach the arrow path to the rounded rect
- [roundedRectPath appendPath:arrowPath];
-
- // Color various sections
- [[UIColor blackColor] setFill];
- [roundedRectPath fill];
- [[UIColor whiteColor] setStroke];
- [roundedRectPath stroke];
- [[UIColor whiteColor] setFill];
- [arrowPath fill];
-
- // Draw the text
- if (self.text) {
- [[UIColor lightYellowColor] set];
- CGSize s = [_text sizeWithFont:self.font];
- CGFloat yOffset = (roundedRect.size.height - s.height) / 2;
- CGRect textRect = CGRectMake(roundedRect.origin.x, yOffset, roundedRect.size.width, s.height);
-
- [_text drawInRect:textRect
- withFont:self.font
- lineBreakMode:UILineBreakModeWordWrap
- alignment:UITextAlignmentCenter];
- }
-}
-
-@end
-
-#pragma mark -
-#pragma mark MNEValueTrackingSlider implementations
-@implementation ValueTrackingSliderView
-
-@synthesize thumbRect, textValue;
-
-#pragma Private methods
-
--(void) _constructSlider {
- valuePopupView = [[SliderValuePopupView alloc] initWithFrame:CGRectZero];
- valuePopupView.backgroundColor = [UIColor clearColor];
- valuePopupView.alpha = 0.0;
- [self addSubview:valuePopupView];
-}
-
--(void) _fadePopupViewInAndOut:(BOOL)aFadeIn {
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:0.25];
- if (aFadeIn) {
- valuePopupView.alpha = 1.0;
- } else {
- valuePopupView.alpha = 0.0;
- }
- [UIView commitAnimations];
-}
-
--(void) _positionAndUpdatePopupView {
- CGRect _thumbRect = self.thumbRect;
- CGRect popupRect = CGRectOffset(_thumbRect, 0, -floorf(_thumbRect.size.height * 1.5));
- valuePopupView.frame = CGRectInset(popupRect, -100, -15);
- valuePopupView.text = self.textValue;
- [valuePopupView setNeedsDisplay];
-}
-
-#pragma mark Memory management
-
--(id) initWithFrame:(CGRect) frame {
- self = [super initWithFrame:frame];
- if (self) {
- [self _constructSlider];
- }
- return self;
-}
-
--(id) initWithCoder:(NSCoder *)aDecoder {
- self = [super initWithCoder:aDecoder];
- if (self) {
- [self _constructSlider];
- }
- return self;
-}
-
--(void) dealloc {
- [valuePopupView release];
- [textValue release];
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark UIControl touch event tracking
--(BOOL) beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
- // Fade in and update the popup view
- CGPoint touchPoint = [touch locationInView:self];
- // Check if the knob is touched. Only in this case show the popup-view
- if(CGRectContainsPoint(CGRectInset(self.thumbRect, -12.0, -12.0), touchPoint)) {
- [self _positionAndUpdatePopupView];
- [self _fadePopupViewInAndOut:YES];
- }
- return [super beginTrackingWithTouch:touch withEvent:event];
-}
-
--(BOOL) continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
- // Update the popup view as slider knob is being moved
- [self _positionAndUpdatePopupView];
- return [super continueTrackingWithTouch:touch withEvent:event];
-}
-
--(void) cancelTrackingWithEvent:(UIEvent *)event {
- [super cancelTrackingWithEvent:event];
-}
-
--(void) endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
- // Fade out the popoup view
- [self _fadePopupViewInAndOut:NO];
- [super endTrackingWithTouch:touch withEvent:event];
-}
-
-#pragma mark -
-#pragma mark Custom property accessors
--(CGRect) thumbRect {
- CGRect trackRect = [self trackRectForBounds:self.bounds];
- CGRect thumbR = [self thumbRectForBounds:self.bounds
- trackRect:trackRect
- value:self.value];
- return thumbR;
-}
-
-@end
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sun Feb 12 18:08:34 2012 +0100
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sun Feb 12 18:50:22 2012 +0100
@@ -31,7 +31,7 @@
610782961440EE5C00645B29 /* basicFlags.plist in Resources */ = {isa = PBXBuildFile; fileRef = 610782931440EE5C00645B29 /* basicFlags.plist */; };
610782971440EE5C00645B29 /* credits.plist in Resources */ = {isa = PBXBuildFile; fileRef = 610782941440EE5C00645B29 /* credits.plist */; };
610782981440EE5C00645B29 /* gameMods.plist in Resources */ = {isa = PBXBuildFile; fileRef = 610782951440EE5C00645B29 /* gameMods.plist */; };
- 610C8E3714E018D200CF5C4C /* ValueTrackingSliderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 610C8E3614E018D200CF5C4C /* ValueTrackingSliderView.m */; };
+ 610C8E3714E018D200CF5C4C /* MNEValueTrackingSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 610C8E3614E018D200CF5C4C /* MNEValueTrackingSlider.m */; };
610D5FB21270E2660033333A /* Icon-Small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43411E290650040BA66 /* Icon-Small@2x.png */; };
610D5FB31270E26C0033333A /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61F7A43611E290650040BA66 /* Icon@2x.png */; };
61156521147F48B6006729A9 /* About.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61156520147F48B6006729A9 /* About.strings */; };
@@ -383,8 +383,8 @@
610782931440EE5C00645B29 /* basicFlags.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = basicFlags.plist; path = Resources/basicFlags.plist; sourceTree = "<group>"; };
610782941440EE5C00645B29 /* credits.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = credits.plist; path = Resources/credits.plist; sourceTree = "<group>"; };
610782951440EE5C00645B29 /* gameMods.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = gameMods.plist; path = Resources/gameMods.plist; sourceTree = "<group>"; };
- 610C8E3514E018D200CF5C4C /* ValueTrackingSliderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ValueTrackingSliderView.h; path = Classes/ValueTrackingSliderView.h; sourceTree = "<group>"; };
- 610C8E3614E018D200CF5C4C /* ValueTrackingSliderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ValueTrackingSliderView.m; path = Classes/ValueTrackingSliderView.m; sourceTree = "<group>"; };
+ 610C8E3514E018D200CF5C4C /* MNEValueTrackingSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MNEValueTrackingSlider.h; path = Classes/MNEValueTrackingSlider.h; sourceTree = "<group>"; };
+ 610C8E3614E018D200CF5C4C /* MNEValueTrackingSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MNEValueTrackingSlider.m; path = Classes/MNEValueTrackingSlider.m; sourceTree = "<group>"; };
6115651A147F48AE006729A9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = Locale/English.lproj/About.strings; sourceTree = "<group>"; };
6115651B147F48AE006729A9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = Locale/English.lproj/Localizable.strings; sourceTree = "<group>"; };
6115651C147F48AE006729A9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = Locale/English.lproj/Scheme.strings; sourceTree = "<group>"; };
@@ -1126,8 +1126,8 @@
isa = PBXGroup;
children = (
615E75C014E42C9000FBA131 /* MGSplitViewController */,
- 610C8E3514E018D200CF5C4C /* ValueTrackingSliderView.h */,
- 610C8E3614E018D200CF5C4C /* ValueTrackingSliderView.m */,
+ 610C8E3514E018D200CF5C4C /* MNEValueTrackingSlider.h */,
+ 610C8E3614E018D200CF5C4C /* MNEValueTrackingSlider.m */,
619C5BA0124FA59000D041AE /* MapPreviewButtonView.h */,
619C5BA1124FA59000D041AE /* MapPreviewButtonView.m */,
61F544C512AF1748007FD913 /* HoldTableViewCell.h */,
@@ -1763,7 +1763,7 @@
61D08D7414AEA7FE0007C078 /* uGearsHedgehog.pas in Sources */,
61D08D7514AEA7FE0007C078 /* uGearsList.pas in Sources */,
61D08D7614AEA7FE0007C078 /* uGearsUtils.pas in Sources */,
- 610C8E3714E018D200CF5C4C /* ValueTrackingSliderView.m in Sources */,
+ 610C8E3714E018D200CF5C4C /* MNEValueTrackingSlider.m in Sources */,
615E755A14E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m in Sources */,
615E76BC14E4421200FBA131 /* MGSplitCornersView.m in Sources */,
615E76BD14E4421200FBA131 /* MGSplitDividerView.m in Sources */,