Skip to content

Commit 686667b

Browse files
committed
[ADD] add caution symbol to be used in tab bar and temporary activation code for it.
1 parent 3d5e9fa commit 686667b

6 files changed

Lines changed: 59 additions & 7 deletions

File tree

Artwork-Sources/Symbols.afdesign

8.85 KB
Binary file not shown.

SubEthaEdit-Mac/Source/PlainTextDocument.m

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,23 @@ - (void)presentAlert:(NSAlert *)alert completionHandler:(void (^)(NSModalRespons
793793
}];
794794

795795
NSWindow *window = orderedWindows[index];
796-
796+
797+
NSArray *windowControllers = self.windowControllers;
798+
799+
// Temporary code to test style of alert icon
800+
for (PlainTextWindowController *controller in windowControllers) {
801+
controller.showsCautionSymbolInTab = YES;
802+
}
803+
804+
completionHandler = ^(NSModalResponse returnCode) {
805+
for (PlainTextWindowController *controller in windowControllers) {
806+
controller.showsCautionSymbolInTab = NO;
807+
}
808+
if (completionHandler) {
809+
completionHandler(returnCode);
810+
}
811+
};
812+
797813
[window makeKeyAndOrderFront:self];
798814
[alert beginSheetModalForWindow:window completionHandler:completionHandler];
799815
}

SubEthaEdit-Mac/Source/PlainTextWindowController.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@
4343
- (void)setSizeByColumns:(NSInteger)aColumns rows:(NSInteger)aRows;
4444
- (void)setShowsBottomStatusBar:(BOOL)aFlag;
4545

46-
- (BOOL)showsGutter;
47-
- (void)setShowsGutter:(BOOL)aFlag;
46+
@property (nonatomic) BOOL showsGutter;
47+
@property (nonatomic) BOOL showsCautionSymbolInTab;
48+
4849
- (IBAction)toggleLineNumbers:(id)aSender;
4950

5051
- (void)setDocumentDialog:(NSViewController<SEEDocumentDialogViewController>*)aDocumentDialog;

SubEthaEdit-Mac/Source/PlainTextWindowController.m

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ - (PlainTextWindowControllerTabContext *)windowControllerTabContextForDocument:(
127127
}
128128

129129
- (PlainTextWindowControllerTabContext *)selectedTabContext {
130-
//
131130
return I_tabContext;
132131
}
133132

134133
- (void)document:(PlainTextDocument *)document isReceivingContent:(BOOL)flag;
135134
{
136-
if (![[self documents] containsObject:document])
135+
if (![[self documents] containsObject:document]) {
137136
return;
138-
137+
}
138+
139139
PlainTextWindowControllerTabContext *tabContext = [self windowControllerTabContextForDocument:document];
140140
if (tabContext) {
141141

@@ -337,6 +337,21 @@ - (void)selectRangeInBackground:(NSRange)aRange {
337337

338338
#pragma mark -
339339

340+
- (BOOL)showsCautionSymbolInTab {
341+
return !!(self.window.tab.accessoryView);
342+
}
343+
344+
- (void)setShowsCautionSymbolInTab:(BOOL)showsCautionSymbolInTab {
345+
NSWindowTab *tab = self.window.tab;
346+
347+
tab.accessoryView = showsCautionSymbolInTab ? ({
348+
NSImage *image = [NSImage imageNamed:@"CautionSymbol"];
349+
image.size = NSMakeSize(18,18);
350+
NSImageView *view = [NSImageView imageViewWithImage:image];
351+
view;
352+
}) : nil;
353+
}
354+
340355
- (BOOL)showsBottomStatusBar {
341356
PlainTextWindowControllerTabContext *tabContext = self.selectedTabContext;
342357
return [[tabContext.plainTextEditors lastObject] showsBottomStatusBar];
@@ -378,7 +393,6 @@ - (IBAction)jumpToPreviousSymbol:(id)aSender {
378393
[[self activePlainTextEditor] jumpToPreviousSymbol:aSender];
379394
}
380395

381-
382396
- (IBAction)jumpToNextChange:(id)aSender {
383397
[[self activePlainTextEditor] jumpToNextChange:aSender];
384398
}
Binary file not shown.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "mac",
5+
"filename" : "CautionSymbol.pdf",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "mac",
10+
"scale" : "2x"
11+
}
12+
],
13+
"info" : {
14+
"version" : 1,
15+
"author" : "xcode"
16+
},
17+
"properties" : {
18+
"template-rendering-intent" : "template",
19+
"preserves-vector-representation" : true
20+
}
21+
}

0 commit comments

Comments
 (0)