| 1 |
footashida |
1.1 |
#import "MainController.h" |
| 2 |
|
|
#import "DummyOutlineDataSource.h" |
| 3 |
footashida |
1.2 |
#import "MainToolbarSource.h" |
| 4 |
footashida |
1.1 |
#import "IconedCell.h" |
| 5 |
footashida |
1.2 |
#import "ComposeToolbarSource.h" |
| 6 |
footashida |
1.3 |
#import "PreferenceToolbarSource.h" |
| 7 |
footashida |
1.5 |
#import "POPServerTableDataSource.h" |
| 8 |
|
|
#import "SMTPServerTableDataSource.h" |
| 9 |
|
|
#import "MailCheckTableDataSource.h" |
| 10 |
footashida |
1.1 |
|
| 11 |
|
|
@implementation MainController |
| 12 |
|
|
-(void)awakeFromNib{ |
| 13 |
|
|
DummyOutlineDataSource *ds; |
| 14 |
|
|
NSToolbar *toolbar; |
| 15 |
footashida |
1.2 |
MainToolbarSource *mainToolbarSource; |
| 16 |
|
|
ComposeToolbarSource *composeToolbarSource; |
| 17 |
footashida |
1.3 |
PreferenceToolbarSource *preferenceToolbarSource; |
| 18 |
footashida |
1.5 |
NSButtonCell *mailCheckButtonCell; |
| 19 |
|
|
NSButtonCell *mailDeleteButtonCell; |
| 20 |
footashida |
1.3 |
|
| 21 |
|
|
[preferenceWindow setContentSize:[generalPref bounds].size]; |
| 22 |
|
|
[[preferenceWindow contentView] addSubview:generalPref]; |
| 23 |
footashida |
1.1 |
|
| 24 |
|
|
ds = [[DummyOutlineDataSource alloc] init]; |
| 25 |
|
|
[folderTree setDataSource:ds]; |
| 26 |
|
|
|
| 27 |
footashida |
1.5 |
toolbar = [[NSToolbar alloc] initWithIdentifier:@"MainToolBar"]; |
| 28 |
footashida |
1.2 |
mainToolbarSource = [[MainToolbarSource alloc] initWithController:self]; |
| 29 |
|
|
[toolbar setDelegate:mainToolbarSource]; |
| 30 |
footashida |
1.1 |
[window setToolbar:toolbar]; |
| 31 |
|
|
[toolbar release]; |
| 32 |
|
|
|
| 33 |
footashida |
1.5 |
toolbar = [[NSToolbar alloc] initWithIdentifier:@"ComposeToolBar"]; |
| 34 |
footashida |
1.2 |
composeToolbarSource = [[ComposeToolbarSource alloc] initWithController:self]; |
| 35 |
|
|
[toolbar setDelegate:composeToolbarSource]; |
| 36 |
footashida |
1.1 |
[composeWindow setToolbar:toolbar]; |
| 37 |
|
|
[toolbar release]; |
| 38 |
|
|
|
| 39 |
footashida |
1.5 |
toolbar = [[NSToolbar alloc] initWithIdentifier:@"PreferenceToolBar"]; |
| 40 |
footashida |
1.3 |
preferenceToolbarSource = [[PreferenceToolbarSource alloc] initWithController:self]; |
| 41 |
|
|
[toolbar setDelegate:preferenceToolbarSource]; |
| 42 |
|
|
[preferenceWindow setToolbar:toolbar]; |
| 43 |
|
|
[toolbar release]; |
| 44 |
|
|
|
| 45 |
footashida |
1.5 |
mailCheckButtonCell = [[NSButtonCell alloc] init]; |
| 46 |
|
|
mailDeleteButtonCell = [[NSButtonCell alloc] init]; |
| 47 |
|
|
[mailCheckButtonCell setButtonType:NSSwitchButton]; |
| 48 |
|
|
[mailDeleteButtonCell setButtonType:NSSwitchButton]; |
| 49 |
|
|
|
| 50 |
|
|
[mailCheckButtonCell setTitle:@""]; |
| 51 |
|
|
[mailDeleteButtonCell setTitle:@""]; |
| 52 |
|
|
|
| 53 |
|
|
[[mailCheckTable tableColumnWithIdentifier:@"MailCheckFlag"] setDataCell:mailCheckButtonCell]; |
| 54 |
|
|
[[mailCheckTable tableColumnWithIdentifier:@"MailDeleteFlag"] setDataCell:mailDeleteButtonCell]; |
| 55 |
|
|
|
| 56 |
|
|
|
| 57 |
footashida |
1.1 |
} |
| 58 |
|
|
- (void)applicationDidFinishLaunching:(NSNotification*)notif |
| 59 |
|
|
{ |
| 60 |
|
|
NSTableColumn* tableColumn; |
| 61 |
|
|
IconedCell* iconedCell; |
| 62 |
|
|
// �t�H���_�c���[���A�A�C�R��+�������\���������������ACell�����X���s���B |
| 63 |
|
|
tableColumn = [folderTree tableColumnWithIdentifier:@"folderview"]; |
| 64 |
|
|
iconedCell = [[[IconedCell alloc] init] autorelease]; |
| 65 |
|
|
[tableColumn setDataCell:iconedCell]; |
| 66 |
|
|
} |
| 67 |
|
|
-(IBAction)createNewMessage:(id)sender{ |
| 68 |
|
|
[composeWindow makeKeyAndOrderFront:nil]; |
| 69 |
|
|
} |
| 70 |
|
|
-(IBAction)findMessage:(id)sender{ |
| 71 |
|
|
[searchWindow makeKeyAndOrderFront:nil]; |
| 72 |
footashida |
1.2 |
} |
| 73 |
|
|
-(IBAction)showPreference:(id)sender{ |
| 74 |
|
|
[preferenceWindow makeKeyAndOrderFront:nil]; |
| 75 |
footashida |
1.3 |
} |
| 76 |
|
|
-(IBAction)selectPreferenceTab:(id)sender{ |
| 77 |
|
|
NSString *identifier = [sender itemIdentifier]; |
| 78 |
|
|
if([identifier isEqual:@"general_tab"]){ |
| 79 |
footashida |
1.4 |
[self changePreferenceView:generalPref]; |
| 80 |
footashida |
1.6 |
}else if([identifier isEqual:@"view_tab"]){ |
| 81 |
|
|
[self changePreferenceView:viewPref]; |
| 82 |
footashida |
1.7 |
}else if([identifier isEqual:@"account_tab"]){ |
| 83 |
|
|
[self changePreferenceView:accountPref]; |
| 84 |
|
|
}else if([identifier isEqual:@"template_tab"]){ |
| 85 |
|
|
[self changePreferenceView:templatePref]; |
| 86 |
footashida |
1.8 |
}else if([identifier isEqual:@"rule_tab"]){ |
| 87 |
|
|
[self changePreferenceView:rulePref]; |
| 88 |
footashida |
1.3 |
}else{ |
| 89 |
footashida |
1.7 |
// ���������������E�E�E |
| 90 |
footashida |
1.3 |
} |
| 91 |
footashida |
1.4 |
|
| 92 |
|
|
} |
| 93 |
|
|
-(IBAction)changePreferenceView:(NSView *)newView{ |
| 94 |
|
|
|
| 95 |
|
|
NSRect oldContentRect; // �����O���R���e���c�r���[��Rect |
| 96 |
|
|
NSRect oldWindowRect; // �����O��Window��Rect |
| 97 |
|
|
NSRect newContentRect; // ���������R���e���c�r���[��Rect |
| 98 |
|
|
NSRect newWindowRect; // ��������Window�[��Rect |
| 99 |
|
|
float toolbarHeight; // �c�[���o�[������ |
| 100 |
|
|
|
| 101 |
|
|
NSView *contentsView; // Window���R���e���c�r���[ |
| 102 |
footashida |
1.7 |
NSView *oldView; |
| 103 |
|
|
NSView *dumView; |
| 104 |
footashida |
1.4 |
|
| 105 |
|
|
oldWindowRect = [preferenceWindow frame]; |
| 106 |
|
|
oldContentRect = [[preferenceWindow contentView] bounds]; |
| 107 |
|
|
|
| 108 |
|
|
toolbarHeight = NSHeight(oldWindowRect) - NSHeight(oldContentRect); |
| 109 |
|
|
|
| 110 |
|
|
newContentRect = [newView bounds]; |
| 111 |
|
|
|
| 112 |
|
|
// ���T�C�Y����Window��Rect���v�Z |
| 113 |
|
|
newWindowRect.origin.x |
| 114 |
|
|
= oldWindowRect.origin.x; |
| 115 |
|
|
newWindowRect.origin.y |
| 116 |
|
|
= oldWindowRect.origin.y + (NSHeight(oldContentRect) - NSHeight(newContentRect)); |
| 117 |
|
|
newWindowRect.size.width |
| 118 |
|
|
= newContentRect.size.width; |
| 119 |
|
|
newWindowRect.size.height |
| 120 |
|
|
= toolbarHeight + newContentRect.size.height; |
| 121 |
|
|
|
| 122 |
|
|
contentsView = [preferenceWindow contentView]; |
| 123 |
footashida |
1.7 |
oldView = [[contentsView subviews] objectAtIndex:0]; |
| 124 |
|
|
dumView = [[NSView alloc] init]; |
| 125 |
|
|
[contentsView replaceSubview:oldView with:dumView]; |
| 126 |
footashida |
1.4 |
[preferenceWindow setFrame:newWindowRect display:YES animate:YES]; |
| 127 |
footashida |
1.7 |
[contentsView replaceSubview:dumView with:newView]; |
| 128 |
|
|
[dumView release]; |
| 129 |
footashida |
1.5 |
|
| 130 |
|
|
[popServerTable setDataSource:[[POPServerTableDataSource alloc] init]]; |
| 131 |
|
|
[smtpServerTable setDataSource:[[SMTPServerTableDataSource alloc] init]]; |
| 132 |
|
|
[mailCheckTable setDataSource:[[MailCheckTableDataSource alloc] init]]; |
| 133 |
footashida |
1.3 |
|
| 134 |
footashida |
1.1 |
} |
| 135 |
footashida |
1.9 |
-(IBAction)createRule:(id)sender{ |
| 136 |
|
|
[self showPreference:self]; |
| 137 |
|
|
[self changePreferenceView:rulePref]; |
| 138 |
|
|
} |
| 139 |
footashida |
1.1 |
@end |