Skip to content
Snippets Groups Projects
Commit 3afa156d authored by gnachman's avatar gnachman
Browse files

Merge pull request #7 from shabble/project-reorganisation

Integrate recent changes in master branch.
parents 260f10b6 feb93eaf
No related branches found
No related tags found
No related merge requests found
Showing
with 79 additions and 735 deletions
Loading
Loading
@@ -226,6 +226,7 @@ typedef enum { IsDefault = 1, IsNotDefault = 2 } BookmarkRowIsDefault;
for (BookmarkRow* theRow in bookmarks) {
[underlyingModel moveGuid:[theRow guid] toRow:i++];
}
[underlyingModel rebuildMenus];
}
 
- (NSArray*)sortDescriptors
Loading
Loading
@@ -342,7 +343,9 @@ typedef enum { IsDefault = 1, IsNotDefault = 2 } BookmarkRowIsDefault;
 
// The underlying model doesn't post a change notification for each bookmark
// move because it would be overwhelming so we must do it ourselves. This
// makes all other table views sync with the new order.
// makes all other table views sync with the new order. First, add commands
// to rebuild the menus.
[[dataSource_ underlyingModel] rebuildMenus];
[[dataSource_ underlyingModel] postChangeNotification];
 
NSMutableIndexSet* newIndexes = [[[NSMutableIndexSet alloc] init] autorelease];
Loading
Loading
@@ -525,6 +528,8 @@ typedef enum { IsDefault = 1, IsNotDefault = 2 } BookmarkRowIsDefault;
{
[dataSource_ setSortDescriptors:[aTableView sortDescriptors]];
[dataSource_ sort];
[dataSource_ pushOrderToUnderlyingModel];
[[dataSource_ underlyingModel] postChangeNotification];
 
// Update the sort indicator image for all columns.
NSArray* sortDescriptors = [dataSource_ sortDescriptors];
Loading
Loading
Loading
Loading
@@ -75,12 +75,13 @@ typedef struct {
- (Bookmark*)setObject:(id)object forKey:(NSString*)key inBookmark:(Bookmark*)bookmark;
- (void)setDefaultByGuid:(NSString*)guid;
- (void)moveGuid:(NSString*)guid toRow:(int)row;
- (void)rebuildMenus;
// Return the absolute index of a bookmark given its index with the filter applied.
- (int)convertFilteredIndex:(int)theIndex withFilter:(NSString*)filter;
- (void)dump;
- (NSArray*)bookmarks;
- (NSArray*)guids;
- (void)addBookmark:(Bookmark*)b toMenu:(NSMenu*)menu startingAtItem:(int)skip withTags:(NSArray*)tags params:(JournalParams*)params;
- (void)addBookmark:(Bookmark*)b toMenu:(NSMenu*)menu startingAtItem:(int)skip withTags:(NSArray*)tags params:(JournalParams*)params atPos:(int)pos;
 
// Tell all listeners that the model has changed.
- (void)postChangeNotification;
Loading
Loading
@@ -110,6 +111,7 @@ typedef enum {
BookmarkModel* model;
// Tags before the action was applied.
NSArray* tags;
int index; // Index of bookmark
}
 
+ (BookmarkJournalEntry*)journalWithAction:(JournalAction)action
Loading
Loading
Loading
Loading
@@ -211,6 +211,7 @@ id gAltOpenAllRepresentedObject;
 
bookmark = [[newBookmark copy] autorelease];
 
int theIndex;
if (sort) {
// Insert alphabetically. Sort so that objects with the "bonjour" tag come after objects without.
int insertionPoint = -1;
Loading
Loading
@@ -236,17 +237,22 @@ id gAltOpenAllRepresentedObject;
}
}
if (insertionPoint == -1) {
theIndex = [bookmarks_ count];
[bookmarks_ addObject:[NSDictionary dictionaryWithDictionary:bookmark]];
} else {
theIndex = insertionPoint;
[bookmarks_ insertObject:[NSDictionary dictionaryWithDictionary:bookmark] atIndex:insertionPoint];
}
} else {
theIndex = [bookmarks_ count];
[bookmarks_ addObject:[NSDictionary dictionaryWithDictionary:bookmark]];
}
NSString* isDeprecatedDefaultBookmark = [bookmark objectForKey:KEY_DEFAULT_BOOKMARK];
 
// The call to setDefaultByGuid may add a journal entry so make sure this one comes first.
[journal_ addObject:[BookmarkJournalEntry journalWithAction:JOURNAL_ADD bookmark:bookmark model:self]];
BookmarkJournalEntry* e = [BookmarkJournalEntry journalWithAction:JOURNAL_ADD bookmark:bookmark model:self];
e->index = theIndex;
[journal_ addObject:e];
 
if (![self defaultBookmark] || (isDeprecatedDefaultBookmark && [isDeprecatedDefaultBookmark isEqualToString:@"Yes"])) {
[self setDefaultByGuid:[bookmark objectForKey:KEY_GUID]];
Loading
Loading
@@ -319,10 +325,14 @@ id gAltOpenAllRepresentedObject;
// A change in bookmarks is journal-worthy only if the name, shortcut, tags, or guid changes.
- (BOOL)bookmark:(Bookmark*)a differsJournalablyFrom:(Bookmark*)b
{
// Any field that is shown in a view (profiles window, menus, bookmark list views, etc.) must
// be a criteria for journalability for it to be updated immediately.
if (![[a objectForKey:KEY_NAME] isEqualToString:[b objectForKey:KEY_NAME]] ||
![[a objectForKey:KEY_SHORTCUT] isEqualToString:[b objectForKey:KEY_SHORTCUT]] ||
![[a objectForKey:KEY_TAGS] isEqualToArray:[b objectForKey:KEY_TAGS]] ||
![[a objectForKey:KEY_GUID] isEqualToString:[b objectForKey:KEY_GUID]]) {
![[a objectForKey:KEY_GUID] isEqualToString:[b objectForKey:KEY_GUID]] ||
![[a objectForKey:KEY_COMMAND] isEqualToString:[b objectForKey:KEY_COMMAND]] ||
![[a objectForKey:KEY_CUSTOM_COMMAND] isEqualToString:[b objectForKey:KEY_CUSTOM_COMMAND]]) {
return YES;
} else {
return NO;
Loading
Loading
@@ -344,12 +354,16 @@ id gAltOpenAllRepresentedObject;
}
[bookmarks_ replaceObjectAtIndex:i withObject:bookmark];
if (needJournal) {
[journal_ addObject:[BookmarkJournalEntry journalWithAction:JOURNAL_ADD bookmark:bookmark model:self]];
BookmarkJournalEntry* e = [BookmarkJournalEntry journalWithAction:JOURNAL_ADD bookmark:bookmark model:self];
e->index = i;
[journal_ addObject:e];
}
if (isDefault) {
[self setDefaultByGuid:[bookmark objectForKey:KEY_GUID]];
}
[self postChangeNotification];
if (needJournal) {
[self postChangeNotification];
}
}
 
- (void)setBookmark:(Bookmark*)bookmark withGuid:(NSString*)guid
Loading
Loading
@@ -514,6 +528,18 @@ id gAltOpenAllRepresentedObject;
[bookmark release];
}
 
- (void)rebuildMenus
{
[journal_ addObject:[BookmarkJournalEntry journalWithAction:JOURNAL_REMOVE_ALL bookmark:nil model:self]];
int i = 0;
for (Bookmark* b in bookmarks_) {
BookmarkJournalEntry* e = [BookmarkJournalEntry journalWithAction:JOURNAL_ADD bookmark:b model:self];
e->index = i++;
[journal_ addObject:e];
}
[self postChangeNotification];
}
- (void)postChangeNotification
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"iTermReloadAddressBook"
Loading
Loading
@@ -628,11 +654,38 @@ id gAltOpenAllRepresentedObject;
return pos;
}
 
- (int)positionOfBookmarkWithIndex:(int)theIndex startingAtItem:(int)skip inMenu:(NSMenu*)menu
{
// Find position of bookmark in menu
int N = [menu numberOfItems];
if ([BookmarkModel menuHasOpenAll:menu]) {
N -= 3;
}
NSArray* items = [menu itemArray];
int pos = N;
for (int i = skip; i < N; i++) {
NSMenuItem* cur = [items objectAtIndex:i];
if ([cur isSeparatorItem]) {
break;
}
if ([cur isHidden] || [cur submenu]) {
continue;
}
if ([cur tag] > theIndex) {
pos = i;
break;
}
}
return pos;
}
- (void)addBookmark:(Bookmark*)b
toMenu:(NSMenu*)menu
atPosition:(int)pos
withParams:(JournalParams*)params
isAlternate:(BOOL)isAlternate
withTag:(int)tag
{
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:[b objectForKey:KEY_NAME]
action:isAlternate ? params->alternateSelector : params->selector
Loading
Loading
@@ -647,17 +700,24 @@ id gAltOpenAllRepresentedObject;
[item setAlternate:isAlternate];
[item setTarget:params->target];
[item setRepresentedObject:[[[b objectForKey:KEY_GUID] copy] autorelease]];
[item setTag:tag];
[menu insertItem:item atIndex:pos];
}
 
- (void)addBookmark:(Bookmark*)b toMenu:(NSMenu*)menu startingAtItem:(int)skip withTags:(NSArray*)tags params:(JournalParams*)params
- (void)addBookmark:(Bookmark*)b toMenu:(NSMenu*)menu startingAtItem:(int)skip withTags:(NSArray*)tags params:(JournalParams*)params atPos:(int)theIndex
{
int pos = [self positionOfBookmark:b startingAtItem:skip inMenu:menu];
int pos;
if (theIndex == -1) {
// Add in sorted order
pos = [self positionOfBookmark:b startingAtItem:skip inMenu:menu];
} else {
pos = [self positionOfBookmarkWithIndex:theIndex startingAtItem:skip inMenu:menu];
}
 
if (![tags count]) {
// Add item & alternate if no tags
[self addBookmark:b toMenu:menu atPosition:pos withParams:params isAlternate:NO];
[self addBookmark:b toMenu:menu atPosition:pos+1 withParams:params isAlternate:YES];
[self addBookmark:b toMenu:menu atPosition:pos withParams:params isAlternate:NO withTag:theIndex];
[self addBookmark:b toMenu:menu atPosition:pos+1 withParams:params isAlternate:YES withTag:theIndex];
}
 
// Add to tag submenus
Loading
Loading
@@ -666,7 +726,7 @@ id gAltOpenAllRepresentedObject;
startingAtItem:skip
withName:tag
params:params];
[self addBookmark:b toMenu:tagSubMenu startingAtItem:0 withTags:nil params:params];
[self addBookmark:b toMenu:tagSubMenu startingAtItem:0 withTags:nil params:params atPos:-1];
}
 
if ([menu numberOfItems] > skip + 2 && ![BookmarkModel menuHasOpenAll:menu]) {
Loading
Loading
@@ -681,7 +741,7 @@ id gAltOpenAllRepresentedObject;
if (!b) {
return;
}
[model addBookmark:b toMenu:menu startingAtItem:skip withTags:[b objectForKey:KEY_TAGS] params:params];
[model addBookmark:b toMenu:menu startingAtItem:skip withTags:[b objectForKey:KEY_TAGS] params:params atPos:e->index];
}
 
+ (void)applyRemoveJournalEntry:(BookmarkJournalEntry*)e toMenu:(NSMenu*)menu startingAtItem:(int)skip params:(JournalParams*)params
Loading
Loading
//
// BookmarksController.h
// iTerm
//
// Created by George Nachman on 8/23/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BookmarksController : NSObject {
}
+ (BookmarksController*)sharedInstance;
- (int)numberOfBookmarks;
@end
//
// BookmarksController.m
// iTerm
//
// Created by George Nachman on 8/23/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "BookmarksController.h"
@implementation BookmarksController
@end
/*
** iTermTerminalProfileMgr.m
**
** Copyright (c) 2002, 2003, 2004
**
** Author: Tianming Yang
**
** Project: iTerm
**
** Description: terminal profile manager.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#import "Profiles/ITAddressBookMgr.h"
#import "iTermTerminalProfileMgr.h"
static iTermTerminalProfileMgr *singleInstance = nil;
@implementation iTermTerminalProfileMgr
// Class methods
+ (id) singleInstance
{
if(singleInstance == nil)
{
singleInstance = [[iTermTerminalProfileMgr alloc] init];
}
return (singleInstance);
}
// Instance methods
- (id) init
{
self = [super init];
if(!self)
return (nil);
profiles = [[NSMutableDictionary alloc] init];
return (self);
}
- (void) dealloc
{
[profiles release];
[super dealloc];
}
- (NSDictionary *) profiles
{
return (profiles);
}
- (void) setProfiles: (NSMutableDictionary *) aDict
{
NSEnumerator *keyEnumerator;
NSMutableDictionary *mappingDict;
NSString *profileName;
NSDictionary *sourceDict;
// recursively copy the dictionary to ensure mutability
if(aDict != nil)
{
keyEnumerator = [aDict keyEnumerator];
while((profileName = [keyEnumerator nextObject]) != nil)
{
sourceDict = [aDict objectForKey: profileName];
mappingDict = [[NSMutableDictionary alloc] initWithDictionary: sourceDict];
[profiles setObject: mappingDict forKey: profileName];
[mappingDict release];
}
}
else // if we don't have any profile, create a default profile
{
NSMutableDictionary *aProfile;
NSString *defaultName;
defaultName = NSLocalizedStringFromTableInBundle(@"Default",@"iTerm", [NSBundle bundleForClass: [self class]],
@"Terminal Profiles");
aProfile = [[NSMutableDictionary alloc] init];
[profiles setObject: aProfile forKey: defaultName];
[aProfile release];
[aProfile setObject: @"Yes" forKey: @"Default Profile"];
[self setType: @"xterm" forProfile: defaultName];
[self setEncoding: NSUTF8StringEncoding forProfile: defaultName];
[self setScrollbackLines: 1000 forProfile: defaultName];
[self setSilenceBell: NO forProfile: defaultName];
[self setBlinkCursor: NO forProfile: defaultName];
[self setCloseOnSessionEnd: YES forProfile: defaultName];
[self setDoubleWidth: YES forProfile: defaultName];
[self setSendIdleChar: NO forProfile: defaultName];
[self setIdleChar: 0 forProfile: defaultName];
}
}
- (NSString *) defaultProfileName
{
NSDictionary *aProfile;
NSEnumerator *keyEnumerator;
NSString *aKey, *aProfileName;
keyEnumerator = [profiles keyEnumerator];
aProfileName = nil;
while ((aKey = [keyEnumerator nextObject]))
{
aProfile = [profiles objectForKey: aKey];
if([self isDefaultProfile: aKey])
{
aProfileName = aKey;
break;
}
}
return (aProfileName);
}
- (void) addProfileWithName: (NSString *) newProfile copyProfile: (NSString *) sourceProfile
{
NSMutableDictionary *aMutableDict, *aProfile;
if([sourceProfile length] > 0 && [newProfile length] > 0)
{
aProfile = [profiles objectForKey: sourceProfile];
aMutableDict = [[NSMutableDictionary alloc] initWithDictionary: aProfile];
[aMutableDict removeObjectForKey: @"Default Profile"];
[profiles setObject: aMutableDict forKey: newProfile];
[aMutableDict release];
}
}
- (void) deleteProfileWithName: (NSString *) profileName
{
if([profileName length] <= 0)
return;
[self updateBookmarkProfile: profileName with:@"Default"];
[profiles removeObjectForKey: profileName];
}
- (BOOL) isDefaultProfile: (NSString *) profileName
{
NSDictionary *aProfile;
if([profileName length] <= 0)
return (NO);
aProfile = [profiles objectForKey: profileName];
return ([[aProfile objectForKey: @"Default Profile"] isEqualToString: @"Yes"]);
}
- (NSString *) typeForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
if([profileName length] <= 0)
return (nil);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (nil);
return ([aProfile objectForKey: @"Term Type"]);
}
- (void) setType: (NSString *) type forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0 || [type length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: type forKey: @"Term Type"];
}
- (NSStringEncoding) encodingForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *encoding;
if([profileName length] <= 0)
return (NSUTF8StringEncoding);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (NSUTF8StringEncoding);
encoding = [aProfile objectForKey: @"Encoding"];
if(encoding == nil)
return (NSUTF8StringEncoding);
return ([encoding unsignedIntValue]);
}
- (void) setEncoding: (NSStringEncoding) encoding forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithUnsignedInt: (unsigned int) encoding] forKey: @"Encoding"];
}
- (int) scrollbackLinesForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *lines;
if([profileName length] <= 0)
return (0);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (0);
lines = [aProfile objectForKey: @"Scrollback"];
if(lines == nil)
return (0);
return ([lines unsignedIntValue]);
}
- (void) setScrollbackLines: (int) lines forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithInt: (lines < 0 ? -1 : lines)] forKey: @"Scrollback"];
}
- (BOOL) silenceBellForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *silent;
if([profileName length] <= 0)
return (NO);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (NO);
silent = [aProfile objectForKey: @"Silence Bell"];
if(silent == nil)
return (NO);
return ([silent boolValue]);
}
- (void) setSilenceBell: (BOOL) silent forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithBool: silent] forKey: @"Silence Bell"];
}
- (BOOL) showBellForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *showBell;
if([profileName length] <= 0)
return (NO);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (NO);
showBell = [aProfile objectForKey: @"Show Bell"];
if(showBell == nil)
return (YES);
return ([showBell boolValue]);
}
- (void) setShowBell: (BOOL) showBell forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithBool: showBell] forKey: @"Show Bell"];
}
- (BOOL) growlForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *growl;
if([profileName length] <= 0)
return (NO);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (NO);
growl = [aProfile objectForKey: @"Growl"];
if(growl == nil)
return (YES);
return ([growl boolValue]);
}
- (void) setGrowl: (BOOL) growl forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithBool: growl] forKey: @"Growl"];
}
- (BOOL) blinkCursorForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *blink;
if([profileName length] <= 0)
return (YES);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (YES);
blink = [aProfile objectForKey: @"Blink"];
if(blink == nil)
return (YES);
return ([blink boolValue]);
}
- (void) setBlinkCursor: (BOOL) blink forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithBool: blink] forKey: @"Blink"];
}
- (BOOL) closeOnSessionEndForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *shouldClose;
if ([profileName length] <= 0) {
return (YES);
}
aProfile = [profiles objectForKey: profileName];
if (aProfile == nil) {
return (YES);
}
shouldClose = [aProfile objectForKey: @"Auto shouldClose"];
if (shouldClose == nil) {
return (YES);
}
return ([shouldClose boolValue]);
}
- (void) setCloseOnSessionEnd: (BOOL) shouldClose forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if ([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithBool: shouldClose] forKey: @"Auto Close"];
}
- (BOOL) doubleWidthForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *doubleWidth;
if([profileName length] <= 0)
return (YES);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (YES);
doubleWidth = [aProfile objectForKey: @"Double Width"];
if(doubleWidth == nil)
return (YES);
return ([doubleWidth boolValue]);
}
- (void) setDoubleWidth: (BOOL) doubleWidth forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithBool: doubleWidth] forKey: @"Double Width"];
}
- (BOOL) sendIdleCharForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *send;
if([profileName length] <= 0)
return (YES);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (YES);
send = [aProfile objectForKey: @"Send Idle Char"];
if(send == nil)
return (YES);
return ([send boolValue]);
}
- (void) setSendIdleChar: (BOOL) send forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithBool: send] forKey: @"Send Idle Char"];
}
- (char) idleCharForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *idleChar;
if([profileName length] <= 0)
return (0);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (0);
idleChar = [aProfile objectForKey: @"Idle Char"];
if(idleChar == nil)
return (0);
return ([idleChar unsignedIntValue]);
}
- (void) setIdleChar: (char) idle forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithChar: idle] forKey: @"Idle Char"];
}
- (BOOL) xtermMouseReportingForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *xtermMouseReporting;
if([profileName length] <= 0)
return (YES);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (YES);
xtermMouseReporting = [aProfile objectForKey: @"Xterm Mouse Reporting"];
if(xtermMouseReporting == nil)
return (YES);
return ([xtermMouseReporting boolValue]);
}
- (void) setXtermMouseReporting: (BOOL) xtermMouseReporting forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithBool: xtermMouseReporting] forKey: @"Xterm Mouse Reporting"];
}
- (BOOL) appendTitleForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *appendTitle;
if([profileName length] <= 0)
return (YES);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (NO);
appendTitle = [aProfile objectForKey: @"Append Title"];
if(appendTitle == nil)
return (NO);
return ([appendTitle boolValue]);
}
- (void) setAppendTitle: (BOOL) appendTitle forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithBool: appendTitle] forKey: @"Append Title"];
}
- (BOOL) noResizingForProfile: (NSString *) profileName
{
NSDictionary *aProfile;
NSNumber *noResizing;
if([profileName length] <= 0)
return (NO);
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return (NO);
noResizing = [aProfile objectForKey: @"No Resizing"];
if(noResizing == nil)
return (NO);
return ([noResizing boolValue]);
}
- (void) setNoResizing: (BOOL) noResizing forProfile: (NSString *) profileName
{
NSMutableDictionary *aProfile;
if([profileName length] <= 0)
return;
aProfile = [profiles objectForKey: profileName];
if(aProfile == nil)
return;
[aProfile setObject: [NSNumber numberWithBool: noResizing] forKey: @"No Resizing"];
}
- (void) updateBookmarkNode: (TreeNode *)node forProfile: (NSString*) oldProfile with:(NSString*)newProfile
{
int i;
TreeNode *child;
NSDictionary *aDict;
int n = [node numberOfChildren];
for (i=0;i<n;i++) {
child = [node childAtIndex:i];
if ([child isLeaf]) {
aDict = [child nodeData];
if ([[aDict objectForKey:KEY_TERMINAL_PROFILE] isEqualToString: oldProfile]) {
NSMutableDictionary *newBookmark= [[NSMutableDictionary alloc] initWithDictionary: aDict];
[newBookmark setObject: newProfile forKey: KEY_TERMINAL_PROFILE];
[child setNodeData: newBookmark];
[newBookmark release];
}
}
else {
[self updateBookmarkNode: child forProfile: oldProfile with:newProfile];
}
}
}
- (void) updateBookmarkProfile: (NSString*) oldProfile with:(NSString*)newProfile
{
[self updateBookmarkNode: [[ITAddressBookMgr sharedInstance] rootNode] forProfile: oldProfile with:newProfile];
// Post a notification for all listeners that bookmarks have changed
[[NSNotificationCenter defaultCenter] postNotificationName: @"iTermReloadAddressBook" object: nil userInfo: nil];
}
@end
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment