Skip to content

Commit

Permalink
merge up to r122
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R-packages/trunk/Mac-GUI@5726 694ef91d-65df-0310-b7bb-92e67a308ead
  • Loading branch information
s-u committed Mar 24, 2011
1 parent ad20c4d commit 0ed0702
Show file tree
Hide file tree
Showing 13 changed files with 1,719 additions and 5,661 deletions.
753 changes: 315 additions & 438 deletions English.lproj/EditorPrefPane.xib

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
NEWS for R.app GUI for Mac OS X

Last-update: 2011-03-24
* auto-save is now enabled in the editor by default
(period is set to 3 minutes) and can be enabled
or disabled in the preferences

Last-update: 2011-03-23 [HJBB]
* improved History
- added possibility to search in History via
Expand Down
4 changes: 2 additions & 2 deletions PrefPanes/EditorPrefPane.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
IBOutlet NSButton *enableIndentNewLines;
IBOutlet NSButton *hiliteCurrentLine;
IBOutlet NSStepper *braceHiliteStepper;
IBOutlet NSButton *autosaveDocuments;
}

- (id)initWithIdentifier:(NSString *)identifier label:(NSString *)label category:(NSString *)category;
Expand All @@ -91,8 +92,7 @@
- (IBAction) changeShowSyntaxColoring:(id)sender;
- (IBAction) changeShowBraceHighlighting:(id)sender;
// - (IBAction) changeHighlightInterval:(id)sender;
- (IBAction) changeShowLineNumbers:(id)sender;
- (IBAction) changeMatchingPairs:(id)sender;
- (IBAction) changeFlag:(id)sender; // general for boolean button senders
- (IBAction) changeAppOrCommand:(id)sender;
- (IBAction) changeEnableLineWrapping:(id)sender;
- (IBAction) changeLineNumberGutterWidth:(id)sender;
Expand Down
21 changes: 17 additions & 4 deletions PrefPanes/EditorPrefPane.m
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ - (void) updatePreferences
else
[internalOrExternal selectCellAtRow:0 column:1];

[editorFont setFont:[NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] dataForKey:RScriptEditorDefaultFont]]];
NSData *encodedFont = [[NSUserDefaults standardUserDefaults] dataForKey:RScriptEditorDefaultFont];
if (encodedFont)
[editorFont setFont:[NSUnarchiver unarchiveObjectWithData:encodedFont]];
[showSyntaxColoring setEnabled:flag?NSOnState:NSOffState];
[showBraceHighlighting setEnabled:flag?NSOnState:NSOffState];
[showLineNumbers setEnabled:flag?NSOnState:NSOffState];
Expand All @@ -201,6 +203,7 @@ - (void) updatePreferences
[showBraceHighlighting setEnabled:flag?NSOnState:NSOffState];
[matchingPairs setEnabled:flag?NSOnState:NSOffState];
[hiliteCurrentLine setEnabled:flag?NSOnState:NSOffState];
[autosaveDocuments setEnabled:flag?NSOnState:NSOffState];
if (flag) {
[highlightIntervalText setTextColor:[NSColor blackColor]];
[highlightInterval setTextColor:[NSColor blackColor]];
Expand Down Expand Up @@ -244,6 +247,8 @@ - (void) updatePreferences

[showBraceHighlighting setState:[Preferences flagForKey:showBraceHighlightingKey withDefault: YES]?NSOnState:NSOffState];

[autosaveDocuments setState:[Preferences flagForKey:kEditorAutosaveKey withDefault: YES] ? NSOnState : NSOffState];

// since 1.40 highlightIntervalKey is obsolete since it contains space in its name
// which isn't allowed for key-value-bindings; instead using HighlightIntervalKey
if([[NSUserDefaults standardUserDefaults] objectForKey:highlightIntervalKey]) {
Expand Down Expand Up @@ -324,10 +329,18 @@ - (IBAction) changeShowArgsHints:(id)sender {
// [Preferences setKey:highlightIntervalKey withObject:interval];
// }

- (IBAction) changeShowLineNumbers:(id)sender {
- (IBAction) changeFlag:(id)sender {
int tmp = (int)[sender state];
BOOL flag = tmp?YES:NO;
[Preferences setKey:showLineNumbersKey withFlag:flag];
BOOL flag = tmp ? YES : NO;
NSString *key = nil;
if (sender == autosaveDocuments) key = kEditorAutosaveKey;
if (sender == showLineNumbers) key = showLineNumbersKey;
if (sender == matchingPairs) key = kAutoCloseBrackets;
if (key)
[Preferences setKey:key withFlag:flag];
else {
SLog(@"WARNING: changeFlag called by %@ which corresponds to no key!", sender);
}
}

- (IBAction) changeMatchingPairs:(id)sender {
Expand Down
2 changes: 2 additions & 0 deletions PreferenceKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
#define quartzPrefPaneFontKey @"QuartzPrefPane font"
#define quartzPrefPaneFontSizeKey @"QuartzPrefPane fontsize"

#define kEditorAutosaveKey @"autosave.scripts"

#define prefShowArgsHints @"Show function args hints"

#define saveOnExitKey @"save.on.exit"
Expand Down
2 changes: 1 addition & 1 deletion RController.m
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ - (void) awakeFromNib {
[origTS release];

RTextView_autoCloseBrackets = [Preferences flagForKey:kAutoCloseBrackets withDefault:YES];

[RConsoleWindow setBackgroundColor:[defaultConsoleColors objectAtIndex:iBackgroundColor]]; // we need this, because "update" doesn't touch the color if it's equal - and by default the window has *no* background - not even the default one, so we bring it in sync
[RConsoleWindow setOpaque:NO]; // Needed so we can see through it when we have clear stuff on top
[consoleTextView setDrawsBackground:NO];
Expand Down
2 changes: 1 addition & 1 deletion RDocumentController.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}
@end

@interface RDocumentController : NSDocumentController
@interface RDocumentController : NSDocumentController <PreferencesDependent>

- (NSWindow*)findLastWindowForDocType:(NSString*)aType;
- (NSWindow*)findNextWindowForDocType:(NSString*)aType;
Expand Down
21 changes: 15 additions & 6 deletions RDocumentController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* R.app : a Cocoa front end to: "R A Computer Language for Statistical Data Analysis"
*
* R.app Copyright notes:
* Copyright (C) 2004-5 The R Foundation
* Copyright (C) 2004-11 The R Foundation
* written by Stefano M. Iacus and Simon Urbanek
* RDocumentController written by Rob Goedman
*
Expand Down Expand Up @@ -36,6 +36,8 @@
#import "QuartzCocoaDocument.h"
#import "RChooseEncodingPopupAccessory.h"

// default autosave is 3 minutes
#define defaultAutosavingDelay (3 * 60.0)

// R defines "error" which is deadly as we use open ... with ... error: where error then gets replaced by Rf_error
#ifdef error
Expand All @@ -55,12 +57,12 @@ - (id)init {
SLog(@"RDocumentController%@.init", self);

if(self) {

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowWillCloseNotifications:)
name:NSWindowWillCloseNotification
object:nil];

selector:@selector(windowWillCloseNotifications:)
name:NSWindowWillCloseNotification
object:nil];
[self updatePreferences];
[[Preferences sharedPreferences] addDependent:self];
}

return self;
Expand All @@ -75,6 +77,13 @@ - (void) dealloc {

}

- (void) updatePreferences
{
BOOL autosaveEnabled = [Preferences flagForKey:kEditorAutosaveKey withDefault:YES];
[self setAutosavingDelay: autosaveEnabled ? defaultAutosavingDelay : 0.0];
SLog(@"%@ autosave %@", self, autosaveEnabled ? @"ENABLED" : @"DISABLED");
}

- (void)windowWillCloseNotifications:(NSNotification*) aNotification
{

Expand Down
Loading

0 comments on commit 0ed0702

Please sign in to comment.