Changeset 12097


Ignore:
Timestamp:
May 20, 2009, 2:55:12 AM (10 years ago)
Author:
rme
Message:

Add "Clear Display" button to altconsole. Throw in some other
minor visual tweaks too.

Location:
trunk/source/cocoa-ide/altconsole
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/altconsole/AltConsoleDocument.h

    r11540 r12097  
    3131  unsigned outpos;
    3232  NSDictionary *local_typing_attributes, *system_output_attributes;
    33   NSBox *indicator;
     33  NSTextField *indicator;
    3434  NSTimer *watchdog;
    3535  Boolean peerDied;
  • trunk/source/cocoa-ide/altconsole/AltConsoleDocument.m

    r11826 r12097  
    4141      [dict setObject: [NSColor redColor] forKey: @"NSColor"];
    4242      [dict setObject: [NSParagraphStyle defaultParagraphStyle] forKey: @"NSParagraphStyle"];
    43       system_output_attributes = [dict retain];
     43      system_output_attributes = dict;
    4444      dict = [NSMutableDictionary dictionaryWithDictionary: dict];
    4545      [dict setObject: [NSColor blackColor] forKey: @"NSColor"];
     
    5656- (void) peerDied:(NSNotification *)notification {
    5757  peerDied = YES;
    58   [indicator setTitle: @"Disconnected"];
     58  [indicator setStringValue:@"Disconnected"];
    5959  [textView setEditable: NO];
    6060  if (watchdog) {
     
    9898- (void)windowControllerDidLoadNib:(NSWindowController *) aController {
    9999    [super windowControllerDidLoadNib:aController];
     100
     101    NSWindow *w = [aController window];
     102    NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier:@"altconsole"];
     103
     104    [toolbar setDelegate:self];
     105    [w setToolbar:toolbar];
     106    [toolbar release];
     107
    100108    [[NSNotificationCenter defaultCenter]
    101109     addObserver: self
     
    109117     object: nil];
    110118    [in readInBackgroundAndNotify];
    111     [textView setUsesFontPanel: NO];
    112     [textView setRichText: NO];
    113     [textView setSmartInsertDeleteEnabled: NO];
    114     [textView setUsesRuler: NO];
    115119    [textView setDelegate: self];
    116120    [textView setContinuousSpellCheckingEnabled: NO];
     
    199203 
    200204
     205- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
     206{
     207  [NSArray arrayWithObject:@"clear display"];
     208}
     209
     210- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
     211{
     212  [NSArray arrayWithObject:@"clear display"];
     213}
     214
     215- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
     216{
     217  NSToolbarItem *item = [[[NSToolbarItem alloc]
     218                           initWithItemIdentifier:itemIdentifier] autorelease];
     219
     220  if ([itemIdentifier isEqualToString:@"clear display"]) {
     221    [item setLabel:@"Clear Display"];
     222    [item setImage:[NSImage imageNamed:@"Clear"]];
     223    [item setTarget:self];
     224    [item setAction:@selector(clearDisplay:)];
     225  } else {
     226    item = nil;
     227  }
     228  return item;
     229}
     230
     231- (void)clearDisplay:(id)sender
     232{
     233  NSTextStorage *storage = [textView textStorage];
     234
     235  [storage deleteCharactersInRange:NSMakeRange(0, [storage length])];
     236  outpos = 0;
     237}
    201238
    202239@end
  • trunk/source/cocoa-ide/altconsole/Makefile

    r11540 r12097  
    99APPBASE=.
    1010OBJECTS=main.o AltConsoleDocument.o AltConsoleDocumentController.o
    11 RESOURCES=resource/MainMenu.nib resource/AltConsole.nib resource/Credits.rtf resource/InfoPlist.strings
     11RESOURCES=resource/MainMenu.nib resource/AltConsole.nib resource/Credits.rtf resource/InfoPlist.strings resource/Clear.tiff
    1212
    1313CFLAGS=-g -O
  • trunk/source/cocoa-ide/altconsole/resource/AltConsole.nib/classes.nib

    r11540 r12097  
    1 {
    2     IBClasses = (
    3         {
    4             CLASS = AltConsoleDocument;
    5             LANGUAGE = ObjC;
    6             OUTLETS = {indicator = id; textView = id; };
    7             SUPERCLASS = NSDocument;
    8         },
    9         {
    10             CLASS = AltConsoleDocumentController;
    11             LANGUAGE = ObjC;
    12             SUPERCLASS = NSDocumentController;
    13         },
    14         {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
    15     );
    16     IBVersion = 1;
    17 }
     1<?xml version="1.0" encoding="UTF-8"?>
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     3<plist version="1.0">
     4<dict>
     5        <key>IBClasses</key>
     6        <array>
     7                <dict>
     8                        <key>CLASS</key>
     9                        <string>AltConsoleDocument</string>
     10                        <key>LANGUAGE</key>
     11                        <string>ObjC</string>
     12                        <key>OUTLETS</key>
     13                        <dict>
     14                                <key>indicator</key>
     15                                <string>id</string>
     16                                <key>textView</key>
     17                                <string>id</string>
     18                        </dict>
     19                        <key>SUPERCLASS</key>
     20                        <string>NSDocument</string>
     21                </dict>
     22                <dict>
     23                        <key>CLASS</key>
     24                        <string>FirstResponder</string>
     25                        <key>LANGUAGE</key>
     26                        <string>ObjC</string>
     27                        <key>SUPERCLASS</key>
     28                        <string>NSObject</string>
     29                </dict>
     30        </array>
     31        <key>IBVersion</key>
     32        <string>1</string>
     33</dict>
     34</plist>
  • trunk/source/cocoa-ide/altconsole/resource/AltConsole.nib/info.nib

    r11540 r12097  
    11<?xml version="1.0" encoding="UTF-8"?>
    2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     2<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    33<plist version="1.0">
    44<dict>
    5         <key>IBDocumentLocation</key>
    6         <string>200 29 356 240 0 0 1152 746 </string>
    75        <key>IBFramework Version</key>
    8         <string>313.0</string>
     6        <string>677</string>
     7        <key>IBOldestOS</key>
     8        <integer>5</integer>
    99        <key>IBOpenObjects</key>
    1010        <array>
    11                 <integer>5</integer>
     11                <integer>43</integer>
    1212        </array>
    1313        <key>IBSystem Version</key>
    14         <string>6L60</string>
    15         <key>IBUserGuides</key>
    16         <dict>
    17                 <key>5</key>
    18                 <dict>
    19                         <key>guideLocations</key>
    20                         <array>
    21                                 <string>Vertical:344.000000</string>
    22                         </array>
    23                         <key>guidesLocked</key>
    24                         <false/>
    25                 </dict>
    26         </dict>
     14        <string>9J61</string>
     15        <key>targetFramework</key>
     16        <string>IBCocoaFramework</string>
    2717</dict>
    2818</plist>
Note: See TracChangeset for help on using the changeset viewer.