Revision: 7490
http://skim-app.svn.sourceforge.net/skim-app/?rev=7490&view=rev
Author: hofman
Date: 2011-09-14 15:26:31 +0000 (Wed, 14 Sep 2011)
Log Message:
-----------
separate method for creating color panel accessory view
Modified Paths:
--------------
trunk/SKMainWindowController_UI.m
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2011-09-14 15:17:05 UTC (rev 7489)
+++ trunk/SKMainWindowController_UI.m 2011-09-14 15:26:31 UTC (rev 7490)
@@ -106,8 +106,7 @@
@end
@interface SKMainWindowController (UIPrivate)
-- (void)changeColorFill:(id)sender;
-- (void)changeColorText:(id)sender;
+- (void)changeColorProperty:(id)sender;
@end
#pragma mark -
@@ -116,6 +115,17 @@
#pragma mark UI updating
+- (NSButton *)newColorAccessoryButtonWithTitle:(NSString *)title {
+ NSButton *button = [[NSButton alloc] init];
+ [button setButtonType:NSSwitchButton];
+ [button setTitle:title];
+ [[button cell] setControlSize:NSSmallControlSize];
+ [button setTarget:self];
+ [button setAction:@selector(changeColorProperty:)];
+ [button sizeToFit];
+ return button;
+}
+
- (void)updateColorPanel {
PDFAnnotation *annotation = [pdfView activeAnnotation];
NSColor *color = nil;
@@ -124,26 +134,12 @@
if ([[self window] isMainWindow]) {
if ([annotation isSkimNote]) {
if ([annotation respondsToSelector:@selector(setInteriorColor:)]) {
- if (colorAccessoryView == nil) {
- colorAccessoryView = [[NSButton alloc] init];
- [colorAccessoryView setButtonType:NSSwitchButton];
- [colorAccessoryView setTitle:NSLocalizedString(@"Fill
color", @"Check button title")];
- [[colorAccessoryView cell]
setControlSize:NSSmallControlSize];
- [colorAccessoryView setTarget:self];
- [colorAccessoryView setAction:@selector(changeColorFill:)];
- [colorAccessoryView sizeToFit];
- }
+ if (colorAccessoryView == nil)
+ colorAccessoryView = [self
newColorAccessoryButtonWithTitle:NSLocalizedString(@"Fill color", @"Check
button title")];
accessoryView = colorAccessoryView;
} else if ([annotation
respondsToSelector:@selector(setFontColor:)]) {
- if (textColorAccessoryView == nil) {
- textColorAccessoryView = [[NSButton alloc] init];
- [textColorAccessoryView setButtonType:NSSwitchButton];
- [textColorAccessoryView setTitle:NSLocalizedString(@"Text
color", @"Check button title")];
- [[textColorAccessoryView cell]
setControlSize:NSSmallControlSize];
- [textColorAccessoryView setTarget:self];
- [textColorAccessoryView
setAction:@selector(changeColorText:)];
- [textColorAccessoryView sizeToFit];
- }
+ if (textColorAccessoryView == nil)
+ textColorAccessoryView = [self
newColorAccessoryButtonWithTitle:NSLocalizedString(@"Text color", @"Check
button title")];
accessoryView = textColorAccessoryView;
}
if ([annotation respondsToSelector:@selector(setInteriorColor:)]
&& [colorAccessoryView state] == NSOnState) {
@@ -167,14 +163,10 @@
}
}
-- (void)changeColorFill:(id)sender{
+- (void)changeColorProperty:(id)sender{
[self updateColorPanel];
}
-- (void)changeColorText:(id)sender{
- [self updateColorPanel];
-}
-
- (void)updateLineInspector {
PDFAnnotation *annotation = [pdfView activeAnnotation];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the
BlackBerry® mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry® DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit