Skip to content

Commit

Permalink
• improved three-finger trackpad swiping for toggling the history dra…
Browse files Browse the repository at this point in the history
…wer of the RConsole

• added three-finger trackpad swiping to go back and forward in web help pages
• added two-finger trackpad zooming support in web help pages to in/decrease text size

git-svn-id: https://svn.r-project.org/R-packages/trunk/Mac-GUI@6097 694ef91d-65df-0310-b7bb-92e67a308ead
  • Loading branch information
Hans-Jörg Bibiko committed Feb 20, 2012
1 parent 00bf538 commit 8861239
Show file tree
Hide file tree
Showing 17 changed files with 490 additions and 105 deletions.
40 changes: 29 additions & 11 deletions English.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="24"/>
<integer value="2"/>
<integer value="687"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -52,7 +51,7 @@
<string key="NSWindowRect">{{89, 302}, {550, 458}}</string>
<int key="NSWTFlags">1350041600</int>
<string key="NSWindowTitle">R Console</string>
<string key="NSWindowClass">NSWindow</string>
<string key="NSWindowClass">RWindow</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
Expand Down Expand Up @@ -101,6 +100,7 @@
</object>
<string key="NSFrameSize">{550, 14}</string>
<reference key="NSSuperview" ref="469120998"/>
<reference key="NSWindow"/>
<object class="NSTextContainer" key="NSTextContainer" id="338871382">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
Expand Down Expand Up @@ -189,6 +189,7 @@
</object>
<string key="NSFrame">{{1, 1}, {550, 412}}</string>
<reference key="NSSuperview" ref="343940978"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="781119707"/>
<reference key="NSDocView" ref="781119707"/>
<reference key="NSBGColor" ref="266515385"/>
Expand All @@ -203,6 +204,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-30, 1}, {15, 432}}</string>
<reference key="NSSuperview" ref="343940978"/>
<reference key="NSWindow"/>
<reference key="NSTarget" ref="343940978"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">1</double>
Expand All @@ -212,6 +214,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
<reference key="NSSuperview" ref="343940978"/>
<reference key="NSWindow"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="343940978"/>
<string key="NSAction">_doScroller:</string>
Expand All @@ -221,6 +224,7 @@
</object>
<string key="NSFrame">{{-1, 20}, {552, 414}}</string>
<reference key="NSSuperview" ref="186451207"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="469120998"/>
<int key="NSsFlags">530</int>
<reference key="NSVScroller" ref="204246707"/>
Expand All @@ -232,6 +236,7 @@
<int key="NSvFlags">270</int>
<string key="NSFrame">{{15, 438}, {263, 15}}</string>
<reference key="NSSuperview" ref="186451207"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="58452196">
<int key="NSCellFlags">71433728</int>
Expand Down Expand Up @@ -263,6 +268,7 @@
<int key="NSvFlags">267</int>
<string key="NSFrame">{{326, 436}, {188, 19}}</string>
<reference key="NSSuperview" ref="186451207"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSearchFieldCell" key="NSCell" id="89866838">
<int key="NSCellFlags">343014976</int>
Expand Down Expand Up @@ -336,6 +342,7 @@
<object class="NSPSMatrix" key="NSDrawMatrix"/>
<string key="NSFrame">{{523, 438}, {16, 16}}</string>
<reference key="NSSuperview" ref="186451207"/>
<reference key="NSWindow"/>
<bool key="NSViewCanDrawConcurrently">YES</bool>
<int key="NSpiFlags">28938</int>
<double key="NSMaxValue">100</double>
Expand All @@ -345,6 +352,7 @@
<int key="NSvFlags">290</int>
<string key="NSFrameSize">{550, 20}</string>
<reference key="NSSuperview" ref="186451207"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="854076123">
<int key="NSCellFlags">67239424</int>
Expand All @@ -365,6 +373,7 @@
<int key="NSvFlags">290</int>
<string key="NSFrame">{{12, 0}, {530, 17}}</string>
<reference key="NSSuperview" ref="186451207"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="410931072">
<int key="NSCellFlags">67239424</int>
Expand All @@ -382,6 +391,7 @@
</object>
<string key="NSFrameSize">{550, 458}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMinSize">{213, 129}</string>
Expand Down Expand Up @@ -4100,14 +4110,14 @@
<string key="NSWindowRect">{{66, 171}, {508, 579}}</string>
<int key="NSWTFlags">1886912512</int>
<string key="NSWindowTitle">Help Search Topics</string>
<string key="NSWindowClass">NSWindow</string>
<string key="NSWindowClass">RWindow</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{213, 107}</string>
<object class="NSView" key="NSWindowView" id="302646734">
<nil key="NSNextResponder"/>
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -4378,6 +4388,7 @@
</object>
</object>
<string key="NSFrameSize">{508, 579}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMinSize">{213, 129}</string>
Expand All @@ -4393,7 +4404,7 @@
<string key="NSWindowRect">{{76, 306}, {344, 464}}</string>
<int key="NSWTFlags">1886912512</int>
<string key="NSWindowTitle">R Help</string>
<string key="NSWindowClass">NSWindow</string>
<string key="NSWindowClass">RWindow</string>
<object class="NSMutableString" key="NSViewClass">
<characters key="NS.bytes">View</characters>
</object>
Expand Down Expand Up @@ -4494,7 +4505,6 @@
</object>
<string key="NSFrameSize">{344, 426}</string>
<reference key="NSSuperview" ref="899669578"/>
<reference key="NSNextKeyView"/>
<string key="FrameName"/>
<string key="GroupName"/>
<object class="WebPreferences" key="Preferences">
Expand Down Expand Up @@ -12104,9 +12114,9 @@
</object>
<boolean value="YES"/>
<boolean value="YES"/>
<string>{{35, 280}, {550, 458}}</string>
<string>{{175, 198}, {550, 458}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{35, 280}, {550, 458}}</string>
<string>{{175, 198}, {550, 458}}</string>
<boolean value="YES"/>
<boolean value="YES"/>
<boolean value="YES"/>
Expand Down Expand Up @@ -12433,9 +12443,9 @@
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{721, 90}, {508, 579}}</string>
<string>{{83, 163}, {508, 579}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{721, 90}, {508, 579}}</string>
<string>{{83, 163}, {508, 579}}</string>
<boolean value="YES"/>
<boolean value="YES"/>
<string>{213, 107}</string>
Expand Down Expand Up @@ -15577,6 +15587,14 @@
<string key="minorKey">../RProgressIndicator.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">RWindow</string>
<string key="superclassName">NSWindow</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBDocumentRelativeSource</string>
<string key="minorKey">../RWindow.h</string>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down
9 changes: 6 additions & 3 deletions HelpManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,21 @@
- (IBAction)whatsNew:(id)sender;
- (IBAction)changeSearchType:(id)sender;
- (IBAction)executeSelection:(id)sender;
- (IBAction)printDocument:(id)sender;

- (void)showHelpUsingFile: (NSString *)file topic: (NSString*) topic; // displays results only, used by help() in 2.1 and later
- (void)showHelpFor:(NSString *)topic; // runs a search

+ (id) sharedController;
- (IBAction)printDocument:(id)sender;
- (NSWindow*) window;
+ (id)sharedController;
- (NSWindow*)window;
- (WebView*)webView;

- (void)setSearchType:(int)type;
- (int)searchType;

- (void)showHelpFileForURL:(NSURL*)url;
- (void)supportsWebViewSwipingInHistory;
- (void)supportsWebViewMagnifying;

- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame;

Expand Down
15 changes: 15 additions & 0 deletions HelpManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ - (NSWindow*) window
return helpWindow;
}

- (WebView*)webView
{
return HelpView;
}

- (IBAction)showMainHelp:(id)sender
{
REngine *re = [REngine mainEngine];
Expand Down Expand Up @@ -370,6 +375,16 @@ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem
return YES;
}

- (void)supportsWebViewSwipingInHistory
{
return;
}

- (void)supportsWebViewMagnifying
{
return;
}

- (void)sheetDidEnd:(id)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
{

Expand Down
9 changes: 6 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
NEWS for R.app GUI for Mac OS X

Last-update: 2012-02-14 [HJBB]
* Added trackpad three-finger swiping to toggle history drawer
visibility in RConsole
Last-update: 2012-02-18 [HJBB]
* Added trackpad three-finger swiping for toggling history drawer
visibility in RConsole and for going back and forward in help
web pages
* Added two-finger zoom gesture support to help web pages to
increase and decrease resp. the text size

Last-update: 2012-02-09 [HJBB]
* Added Rd file support:
Expand Down
9 changes: 9 additions & 0 deletions R.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@
BC81712F13321873004B52A0 /* SelectEncodingsPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC81712D13321873004B52A0 /* SelectEncodingsPanel.xib */; };
BC884B6B14BAD86C00DEFFE0 /* RdEditorToolbar.h in Headers */ = {isa = PBXBuildFile; fileRef = BC884B6914BAD86C00DEFFE0 /* RdEditorToolbar.h */; };
BC884B6C14BAD86C00DEFFE0 /* RdEditorToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = BC884B6A14BAD86C00DEFFE0 /* RdEditorToolbar.m */; };
BCB4FEAB14F24B0E00281019 /* RWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB4FEA914F24B0E00281019 /* RWindow.h */; };
BCB4FEAC14F24B0E00281019 /* RWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB4FEAA14F24B0E00281019 /* RWindow.m */; };
BCBA744713B089D8001B440B /* RDataEditorTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = BCBA744513B089D8001B440B /* RDataEditorTableView.h */; };
BCBA744813B089D8001B440B /* RDataEditorTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCBA744613B089D8001B440B /* RDataEditorTableView.m */; };
BCCE4A38130AB3C6003325EB /* RScriptEditorTokens.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCE4A37130AB3C6003325EB /* RScriptEditorTokens.h */; };
Expand Down Expand Up @@ -484,6 +486,8 @@
BCB297AD133B7EDD007899E0 /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = de.lproj/Vignettes.xib; sourceTree = "<group>"; };
BCB297AE133B7EE2007899E0 /* it */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = it; path = it.lproj/Vignettes.xib; sourceTree = "<group>"; };
BCB297AF133B7EF3007899E0 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/Vignettes.xib; sourceTree = "<group>"; };
BCB4FEA914F24B0E00281019 /* RWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RWindow.h; sourceTree = "<group>"; };
BCB4FEAA14F24B0E00281019 /* RWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RWindow.m; sourceTree = "<group>"; };
BCBA744513B089D8001B440B /* RDataEditorTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RDataEditorTableView.h; sourceTree = "<group>"; };
BCBA744613B089D8001B440B /* RDataEditorTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RDataEditorTableView.m; sourceTree = "<group>"; };
BCCE4A37130AB3C6003325EB /* RScriptEditorTokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RScriptEditorTokens.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -563,6 +567,8 @@
68DEAEE7083271CA00C5D76C /* RTextView.m */,
6880A0F10DBE886200FC684F /* QuartzCocoaDocument.h */,
6880A0F20DBE886200FC684F /* QuartzCocoaDocument.m */,
BCB4FEA914F24B0E00281019 /* RWindow.h */,
BCB4FEAA14F24B0E00281019 /* RWindow.m */,
);
name = Classes;
sourceTree = "<group>";
Expand Down Expand Up @@ -1012,6 +1018,7 @@
BCFAE71C14C58372008762EE /* RSymbolTokens.h in Headers */,
BCF4B2C114D9815400F14715 /* NSString_RAdditions.h in Headers */,
BC13F8AB14DC6DA10083305F /* RProgressIndicator.h in Headers */,
BCB4FEAB14F24B0E00281019 /* RWindow.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1063,6 +1070,7 @@
isa = PBXProject;
buildConfigurationList = 680F0B3A0997CE66009CDBE8 /* Build configuration list for PBXProject "R" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Expand Down Expand Up @@ -1268,6 +1276,7 @@
BCFAE71A14C5835B008762EE /* RSymbolTokens.l in Sources */,
BCF4B2C214D9815400F14715 /* NSString_RAdditions.m in Sources */,
BC13F8AC14DC6DA10083305F /* RProgressIndicator.m in Sources */,
BCB4FEAC14F24B0E00281019 /* RWindow.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 2 additions & 0 deletions RController.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
BOOL processingEvents;
BOOL breakPending;
BOOL isREditMode;
BOOL ignoreMagnifyingEvent;

char *writeBuffer;
char *writeBufferPos;
Expand Down Expand Up @@ -309,6 +310,7 @@
- (NSString*)getAppSupportPath;
- (int) helpServerPort;
- (BOOL)isREditMode;
- (void)ignoreMagnifyingEventTimer;


- (IBAction)performFindPanelAction:(id)sender;
Expand Down
23 changes: 17 additions & 6 deletions RController.m
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ - (id) init {
processingEvents = NO;
breakPending = NO;
isREditMode = NO;
ignoreMagnifyingEvent = NO;
outputPosition = promptPosition = committedLength = lastCommittedLength = 0;
consoleInputQueue = [[NSMutableArray alloc] initWithCapacity:8];
currentConsoleInput = nil;
Expand Down Expand Up @@ -888,6 +889,11 @@ - (void) rmChildProcess: (pid_t) pid
[self flushStdConsole];
}

- (void)ignoreMagnifyingEventTimer
{
ignoreMagnifyingEvent = NO;
}

- (void) fontSizeChangedBy:(float)delta withSender:(id)sender
{

Expand All @@ -904,10 +910,17 @@ - (void) fontSizeChangedBy:(float)delta withSender:(id)sender
if(aWebFrameView && [aWebFrameView respondsToSelector:@selector(webFrame)]) {
WebView *aWebView = [[(WebFrameView*)aWebFrameView webFrame] webView];
if(aWebView) {
if(delta > 0)
[aWebView makeTextLarger:sender];
else if(delta < 0)
[aWebView makeTextSmaller:sender];
if(!ignoreMagnifyingEvent) {

// delay font size changing for 200msecs
ignoreMagnifyingEvent = YES;
[self performSelector:@selector(ignoreMagnifyingEventTimer) withObject:nil afterDelay:0.2f];

if(delta > 0)
[aWebView makeTextLarger:sender];
else if(delta < 0)
[aWebView makeTextSmaller:sender];
}
}
}
}
Expand Down Expand Up @@ -958,8 +971,6 @@ - (void) fontSizeChangedBy:(float)delta withSender:(id)sender
}
}
}
else
[[NSFontManager sharedFontManager] modifyFont:sender];

}

Expand Down
Loading

0 comments on commit 8861239

Please sign in to comment.