Skip to content
This repository
tree: 153db0cd07
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 101 lines (88 sloc) 2.304 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
//
// TimeController.m
// TimeConv
//
// Created by Corsair Sun on 3/9/12.
// Copyright (c) 2012 Home. All rights reserved.
//

#import "TimeConverter.h"
#import "TimeController.h"

@implementation TimeController
{
    TimeConverter* TimeConv;
    
    id SrcTimeView;
    id SrcZoneView;
    id DestTimeView;
    id DestZoneView;
    
    NSTimer* UpdateTimer;
}
- (id)init
{
    self = [super init];
    if (self)
    {
        // Initialize self.
        NSLog(@"Time controller initialized.");
    }
    return self;
}

- (void) setSrcView: (id) src_view srcZoneView: (id) src_zone_view
{
    SrcTimeView = src_view;
    SrcZoneView = src_zone_view;
}

- (void) setDestView: (id) dest_view destZoneView: (id) dest_zone_view
{
    DestTimeView = dest_view;
    DestZoneView = dest_zone_view;
}

- (void) setConverter: (id) converter
{
    TimeConv = converter;
}

- (void) shortSrcZone: (bool) shortp
{
    [TimeConv genSrcZoneViewList: shortp];
}

- (void) shortDestZone: (bool) shortp
{
    [TimeConv genDestZoneViewList: shortp];
}

//-(void) controlTextDidChange: (NSNotification*) notice
//{
// id WhoChanged = [notice object];
// bool Success;
// if([[WhoChanged identifier] compare: @"ZoneSrc"] == NSOrderedSame)
// {
// NSLog(@"Changing zone while typing...");
// Success = [TimeConv setSrcZoneWithStr:
// [WhoChanged objectValueOfSelectedItem]];
// }
// else if([[WhoChanged identifier] compare: @"ZoneDest"] == NSOrderedSame)
// {
// NSLog(@"Changing zone while typing...");
// Success = [TimeConv setDestZoneWithStr:
// [WhoChanged objectValueOfSelectedItem]];
// }
//}
//
//- (BOOL) control: control textShouldBeginEditing:(NSNotification*) notice
//{
// return YES;
//}
//
//- (BOOL) control: control textShouldEndEditing: (NSNotification*) notice
//{
// return FALSE;
//}

- (void) startUpdating
{
    UpdateTimer =
    [NSTimer scheduledTimerWithTimeInterval: 0.2
                                     target: TimeConv
                                   selector: @selector(updateViews)
                                   userInfo: [NSDictionary dictionaryWithObject:[NSDate date] forKey:@"StartDate"]
                                    repeats: YES];
    NSLog(@"Timer fired.");
}

@end
Something went wrong with that request. Please try again.