Skip to content

Commit

Permalink
merge up to r153
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R-packages/trunk/Mac-GUI@5737 694ef91d-65df-0310-b7bb-92e67a308ead
  • Loading branch information
s-u committed Apr 5, 2011
1 parent 7251c71 commit f2e8bd1
Show file tree
Hide file tree
Showing 19 changed files with 2,254 additions and 309 deletions.
1 change: 1 addition & 0 deletions DataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
- (IBAction)showHelp:(id)sender;
- (IBAction)reloadDatasets:(id)sender;
- (IBAction)filterTable:(id)sender;
- (IBAction)executeSelection:(id)sender;

- (void)show;
- (NSWindow*)window;
Expand Down
25 changes: 25 additions & 0 deletions DataManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#import "DataManager.h"
#import "RController.h"
#import "REngine/REngine.h"
#import "RegexKitLite.h"

#import <WebKit/WebKit.h>
#import <WebKit/WebFrame.h>
Expand Down Expand Up @@ -254,6 +255,21 @@ - (IBAction)printDocument:(id)sender
contextInfo:@""];
}

- (IBAction)executeSelection:(id)sender
{
DOMRange *dr = [dataInfoView selectedDOMRange];
if (dr) { /* we don't do line-exec since we don't get the text outside the selection */
NSString *stx = [dr markupString];
// Ok, some simple processing here - it may not work in all cases
stx = [stx stringByReplacingOccurrencesOfRegex:@"(?i)<br[^>]*?>" withString:@"\n"];
stx = [stx stringByReplacingOccurrencesOfRegex:@"<[^>]*?>" withString:@""];
stx = [stx stringByReplacingOccurrencesOfString:@"&lt;" withString:@"<"];
stx = [stx stringByReplacingOccurrencesOfString:@"&gt;" withString:@">"];
stx = [stx stringByReplacingOccurrencesOfString:@"&amp;" withString:@"&"];
[[RController sharedController] sendInput:stx];
}
}

#pragma mark -
#pragma mark tableView delegates

Expand Down Expand Up @@ -367,4 +383,13 @@ - (void)sheetDidEnd:(id)sheet returnCode:(int)returnCode contextInfo:(NSString *

}

- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
if ([menuItem action] == @selector(executeSelection:)) {
return ([dataInfoView selectedDOMRange] == nil) ? NO : YES;
}

return YES;
}

@end
Loading

0 comments on commit f2e8bd1

Please sign in to comment.