Skip to content

Commit 0cdb456

Browse files
committed
Xcode 5 fixes for issues #14 and #4 plus a strange crash on retina devices
1 parent 1b8fad5 commit 0cdb456

File tree

3 files changed

+15
-30
lines changed

3 files changed

+15
-30
lines changed

SCXcodeMinimap.xcodeproj/project.pbxproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
18FE09AA1707639E00118FEB /* Project object */ = {
133133
isa = PBXProject;
134134
attributes = {
135-
LastUpgradeCheck = 0460;
135+
LastUpgradeCheck = 0500;
136136
ORGANIZATIONNAME = "Stefan Ceriu";
137137
};
138138
buildConfigurationList = 18FE09AD1707639E00118FEB /* Build configuration list for PBXProject "SCXcodeMinimap" */;
@@ -180,7 +180,6 @@
180180
isa = XCBuildConfiguration;
181181
buildSettings = {
182182
ALWAYS_SEARCH_USER_PATHS = NO;
183-
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
184183
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
185184
CLANG_CXX_LIBRARY = "libc++";
186185
CLANG_WARN_CONSTANT_CONVERSION = YES;
@@ -212,7 +211,6 @@
212211
isa = XCBuildConfiguration;
213212
buildSettings = {
214213
ALWAYS_SEARCH_USER_PATHS = NO;
215-
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
216214
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
217215
CLANG_CXX_LIBRARY = "libc++";
218216
CLANG_WARN_CONSTANT_CONVERSION = YES;

SCXcodeMinimap/SCMiniMapView.m

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ - (id)initWithFrame:(NSRect)frame
2727
{
2828
/* Configure ScrollView */
2929
[self setWantsLayer:YES];
30-
[self setAutoresizingMask: NSViewMinXMargin | NSViewWidthSizable | NSViewHeightSizable];
30+
[self setAutoresizingMask: NSViewMinXMargin | NSViewHeightSizable];
3131
[self setDrawsBackground:NO];
3232
[self setHorizontalScrollElasticity:NSScrollElasticityNone];
3333
[self setVerticalScrollElasticity:NSScrollElasticityNone];
@@ -62,14 +62,11 @@ - (NSTextView *)textView
6262
{
6363
if (_textView == nil) {
6464
_textView = [[NSTextView alloc] initWithFrame:self.bounds];
65-
[_textView setAutoresizingMask: NSViewMinXMargin | NSViewMaxXMargin | NSViewWidthSizable | NSViewHeightSizable];
6665
[_textView setBackgroundColor:[NSColor clearColor]];
6766

6867
[_textView.textContainer setLineFragmentPadding:0.0f];
6968

7069
[_textView.layoutManager setDelegate:self];
71-
// [_textView.layoutManager setAllowsNonContiguousLayout:YES];
72-
// [_textView.layoutManager setBackgroundLayoutEnabled:YES];
7370

7471
[_textView setAllowsUndo:NO];
7572
[_textView setAllowsImageEditing:NO];
@@ -147,10 +144,10 @@ - (NSColor *)backgroundColor
147144
- (void)show
148145
{
149146
self.hidden = NO;
150-
151-
NSRect editorTextViewFrame = self.editorTextView.frame;
152-
editorTextViewFrame.size.width = self.editorTextView.superview.frame.size.width - self.bounds.size.width - kRightSidePadding;
153-
self.editorTextView.frame = editorTextViewFrame;
147+
148+
NSRect editorTextViewFrame = self.editorScrollView.frame;
149+
editorTextViewFrame.size.width = self.editorScrollView.superview.frame.size.width - self.bounds.size.width;
150+
self.editorScrollView.frame = editorTextViewFrame;
154151

155152
[self updateTextView];
156153
[self updateSelectionView];
@@ -160,20 +157,20 @@ - (void)hide
160157
{
161158
self.hidden = YES;
162159

163-
NSRect editorTextViewFrame = self.editorTextView.frame;
164-
editorTextViewFrame.size.width = self.editorTextView.superview.frame.size.width;
165-
self.editorTextView.frame = editorTextViewFrame;
160+
NSRect editorTextViewFrame = self.editorScrollView.frame;
161+
editorTextViewFrame.size.width = self.editorScrollView.superview.frame.size.width;
162+
self.editorScrollView.frame = editorTextViewFrame;
166163
}
167164

168165
#pragma mark - Updating
169166

170167
- (void)updateTheme
171168
{
172169
[self setFont:nil];
173-
[self updateTextView];
174170

175171
[self setBackgroundColor:nil];
176172
[self.selectionView setSelectionColor:nil];
173+
[self.textView setBackgroundColor:self.backgroundColor];
177174
}
178175

179176
- (void)updateTextView
@@ -188,23 +185,17 @@ - (void)updateTextView
188185
return;
189186
}
190187

191-
[mutableAttributedString setAttributes:@{NSFontAttributeName: self.font, NSBackgroundColorAttributeName : self.backgroundColor} range:NSMakeRange(0, mutableAttributedString.length)];
192-
188+
[mutableAttributedString setAttributes:@{NSFontAttributeName: self.font} range:NSMakeRange(0, mutableAttributedString.length)];
193189
[self.textView.textStorage setAttributedString:mutableAttributedString];
194190
}
195191

196192
- (void)resizeWithOldSuperviewSize:(NSSize)oldSize
197193
{
198194
[super resizeWithOldSuperviewSize:oldSize];
199-
[self updateSelectionViewAnimated:YES];
195+
[self updateSelectionView];
200196
}
201197

202198
- (void)updateSelectionView
203-
{
204-
[self updateSelectionViewAnimated:NO];
205-
}
206-
207-
- (void)updateSelectionViewAnimated:(BOOL)animated
208199
{
209200
if ([self isHidden]) {
210201
return;
@@ -229,12 +220,8 @@ - (void)updateSelectionViewAnimated:(BOOL)animated
229220
ratio = (textHeight - self.selectionView.bounds.size.height) / editorContentHeight;
230221
selectionViewFrame.origin.y = self.editorScrollView.contentView.bounds.origin.y * ratio;
231222
}
232-
233-
if(animated) {
234-
[self.selectionView.animator setFrame:selectionViewFrame];
235-
} else {
236-
[self.selectionView setFrame:selectionViewFrame];
237-
}
223+
224+
[self.selectionView setFrame:selectionViewFrame];
238225
}
239226

240227
#pragma mark - NSLayoutManagerDelegate

SCXcodeMinimap/SCXcodeMinimap.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ - (void)onDidFinishSetup:(NSNotification*)sender
139139
/* Create Mini Map */
140140
CGFloat width = editorTextView.bounds.size.width * kDefaultZoomLevel;
141141

142-
NSRect miniMapScrollViewFrame = NSMakeRect(editorContainerView.bounds.size.width - width - kRightSidePadding,
142+
NSRect miniMapScrollViewFrame = NSMakeRect(editorContainerView.bounds.size.width - width,
143143
0,
144144
width,
145145
editorScrollView.bounds.size.height);

0 commit comments

Comments
 (0)