]>
Commit | Line | Data |
---|---|---|
dacd667c MW |
1 | /* |
2 | * Copyright (C) 2013 Martin Willi | |
19ef2aec TB |
3 | * |
4 | * Copyright (C) secunet Security Networks AG | |
dacd667c MW |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2 of the License, or (at your | |
9 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | * for more details. | |
15 | */ | |
16 | ||
17 | #import "LogController.h" | |
18 | ||
19 | @interface LogController () | |
20 | ||
21 | @end | |
22 | ||
23 | @implementation LogController | |
24 | ||
25 | - (void)appendLine:(NSString*)line | |
26 | { | |
27 | NSAttributedString* attr; | |
28 | ||
29 | attr = [[NSAttributedString alloc] initWithString:line]; | |
30 | [[textView textStorage] appendAttributedString:attr]; | |
31 | [attr release]; | |
32 | ||
33 | attr = [[NSAttributedString alloc] initWithString:@"\n"]; | |
34 | [[textView textStorage] appendAttributedString:attr]; | |
35 | [attr release]; | |
36 | ||
37 | [textView scrollRangeToVisible:NSMakeRange([[textView string] length], 0)]; | |
38 | } | |
39 | ||
40 | - (void)clear | |
41 | { | |
42 | [textView setString:@""]; | |
43 | } | |
44 | ||
45 | - (void)show | |
46 | { | |
47 | [self showWindow:self]; | |
48 | [[self window] makeKeyAndOrderFront:self]; | |
49 | [[self window] orderFrontRegardless]; | |
50 | } | |
51 | ||
52 | @end |