Revision: 7563
http://skim-app.svn.sourceforge.net/skim-app/?rev=7563&view=rev
Author: hofman
Date: 2011-12-05 12:49:47 +0000 (Mon, 05 Dec 2011)
Log Message:
-----------
use function to draw text field bezel using a shared cell
Modified Paths:
--------------
trunk/NSGraphics_SKExtensions.h
trunk/NSGraphics_SKExtensions.m
trunk/SKFontWell.h
trunk/SKFontWell.m
trunk/SKLineWell.h
trunk/SKLineWell.m
Modified: trunk/NSGraphics_SKExtensions.h
===================================================================
--- trunk/NSGraphics_SKExtensions.h 2011-12-05 10:49:26 UTC (rev 7562)
+++ trunk/NSGraphics_SKExtensions.h 2011-12-05 12:49:47 UTC (rev 7563)
@@ -44,6 +44,10 @@
#pragma mark -
+void SKDrawTextFieldBezel(NSRect rect, NSView *controlView);
+
+#pragma mark -
+
extern void SKShiftAndResizeViews(NSArray *views, CGFloat dx, CGFloat dw);
extern void SKAutoSizeButtons(NSArray *buttons, BOOL rightAlign);
extern CGFloat SKAutoSizeLabelFields(NSArray *labelFields, NSArray *controls,
BOOL resizeControls);
Modified: trunk/NSGraphics_SKExtensions.m
===================================================================
--- trunk/NSGraphics_SKExtensions.m 2011-12-05 10:49:26 UTC (rev 7562)
+++ trunk/NSGraphics_SKExtensions.m 2011-12-05 12:49:47 UTC (rev 7563)
@@ -64,6 +64,18 @@
#pragma mark -
+void SKDrawTextFieldBezel(NSRect rect, NSView *controlView) {
+ static NSTextFieldCell *cell = nil;
+ if (cell == nil) {
+ cell = [[NSTextFieldCell alloc] initTextCell:@""];
+ [cell setBezeled:YES];
+ }
+ [cell drawWithFrame:rect inView:controlView];
+ [cell setControlView:nil];
+}
+
+#pragma mark -
+
#define MIN_BUTTON_WIDTH 82.0
#define MAX_BUTTON_WIDTH 100.0
#define EXTRA_BUTTON_WIDTH 12.0
Modified: trunk/SKFontWell.h
===================================================================
--- trunk/SKFontWell.h 2011-12-05 10:49:26 UTC (rev 7562)
+++ trunk/SKFontWell.h 2011-12-05 12:49:47 UTC (rev 7563)
@@ -63,7 +63,6 @@
@interface SKFontWellCell : NSButtonCell {
- NSTextFieldCell *bgCell;
NSColor *textColor;
BOOL hasTextColor;
}
Modified: trunk/SKFontWell.m
===================================================================
--- trunk/SKFontWell.m 2011-12-05 10:49:26 UTC (rev 7562)
+++ trunk/SKFontWell.m 2011-12-05 12:49:47 UTC (rev 7563)
@@ -37,6 +37,7 @@
*/
#import "SKFontWell.h"
+#import "NSGraphics_SKExtensions.h"
#define SKNSFontPanelDescriptorsPboardType @"NSFontPanelDescriptorsPboardType"
#define SKNSFontPanelFamiliesPboardType @"NSFontPanelFamiliesPboardType"
@@ -441,8 +442,6 @@
@synthesize textColor, hasTextColor;
- (void)commonInit {
- bgCell = [[NSTextFieldCell alloc] initTextCell:@""];
- [bgCell setBezeled:YES];
if (textColor == nil)
[self setTextColor:[NSColor blackColor]];
[self setBezelStyle:NSShadowlessSquareBezelStyle]; // this is mainly to
make it selectable
@@ -476,20 +475,18 @@
- (id)copyWithZone:(NSZone *)zone {
SKFontWellCell *copy = [super copyWithZone:zone];
- copy->bgCell = [bgCell copyWithZone:zone];
copy->textColor = [textColor copyWithZone:zone];
copy->hasTextColor = hasTextColor;
return copy;
}
- (void)dealloc {
- SKDESTROY(bgCell);
SKDESTROY(textColor);
[super dealloc];
}
- (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView {
- [bgCell drawWithFrame:frame inView:controlView];
+ SKDrawTextFieldBezel(frame, controlView);
[NSGraphicsContext saveGraphicsState];
if ([self state] == NSOnState) {
Modified: trunk/SKLineWell.h
===================================================================
--- trunk/SKLineWell.h 2011-12-05 10:49:26 UTC (rev 7562)
+++ trunk/SKLineWell.h 2011-12-05 12:49:47 UTC (rev 7563)
@@ -61,7 +61,6 @@
NSArray *dashPattern;
PDFLineStyle startLineStyle;
PDFLineStyle endLineStyle;
- NSTextFieldCell *bgCell;
struct _lwFlags {
unsigned int displayStyle:2;
Modified: trunk/SKLineWell.m
===================================================================
--- trunk/SKLineWell.m 2011-12-05 10:49:26 UTC (rev 7562)
+++ trunk/SKLineWell.m 2011-12-05 12:49:47 UTC (rev 7563)
@@ -78,9 +78,6 @@
}
- (void)commonInit {
- bgCell = [[NSTextFieldCell alloc] initTextCell:@""];
- [bgCell setBezeled:YES];
-
lwFlags.canActivate = 1;
lwFlags.highlighted = 0;
lwFlags.existsActiveLineWell = 0;
@@ -145,7 +142,6 @@
[self unbind:SKLineWellEndLineStyleKey];
if (lwFlags.active)
[self deactivate];
- SKDESTROY(bgCell);
SKDESTROY(dashPattern);
[super dealloc];
}
@@ -260,7 +256,7 @@
- (void)drawRect:(NSRect)rect {
NSRect bounds = [self bounds];
- [bgCell drawWithFrame:bounds inView:self];
+ SKDrawTextFieldBezel(bounds, self);
[NSGraphicsContext saveGraphicsState];
if ([self isActive]) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit