mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
Merge branch hotfix/v6.1.1 into release/v6.2.0
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097"/>
|
||||
<plugIn identifier="com.apple.WebKitIBPlugin" version="16097"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
|
||||
<plugIn identifier="com.apple.WebKitIBPlugin" version="17701"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@ -707,9 +706,9 @@
|
||||
<window key="window" title="ONLYOFFICE" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA" customClass="ASCTitleWindow">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
|
||||
<rect key="contentRect" x="0.0" y="0.0" width="1200" height="640"/>
|
||||
<rect key="contentRect" x="0.0" y="0.0" width="1024" height="540"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
|
||||
<value key="minSize" type="size" width="1200" height="640"/>
|
||||
<value key="minSize" type="size" width="1024" height="540"/>
|
||||
<toolbar key="toolbar" implicitIdentifier="5B77B499-B428-4B61-B444-4B21C8952CC3" autosavesConfiguration="NO" allowsUserCustomization="NO" showsBaselineSeparator="NO" displayMode="labelOnly" sizeMode="regular" id="K5R-RO-aDh">
|
||||
<allowedToolbarItems/>
|
||||
<defaultToolbarItems/>
|
||||
@ -752,7 +751,7 @@
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="50" id="JHj-Lo-Sh5"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Portal:" id="zwS-9G-S0N">
|
||||
<font key="font" metaFont="label" size="12"/>
|
||||
<font key="font" metaFont="cellTitle"/>
|
||||
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
@ -763,7 +762,7 @@
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="170" id="Or6-Gu-L5B"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" title="none" usesSingleLineMode="YES" id="9i7-kj-42B">
|
||||
<font key="font" metaFont="label" size="12"/>
|
||||
<font key="font" metaFont="cellTitle"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
@ -775,7 +774,7 @@
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="50" id="mfK-Go-vrc"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Email:" id="Zsi-3o-ASl">
|
||||
<font key="font" metaFont="label" size="12"/>
|
||||
<font key="font" metaFont="cellTitle"/>
|
||||
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
@ -787,7 +786,7 @@
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="170" id="Iew-ae-tXr"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" title="none" usesSingleLineMode="YES" id="Rkd-xb-FRJ">
|
||||
<font key="font" metaFont="label" size="12"/>
|
||||
<font key="font" metaFont="cellTitle"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
@ -847,18 +846,18 @@
|
||||
<scene sceneID="FSG-kQ-eIr">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="ASCDownloadListControllerId" id="e6o-1y-Hxy" customClass="ASCDownloadViewController" sceneMemberID="viewController">
|
||||
<view key="view" id="dEW-yf-Hlp">
|
||||
<rect key="frame" x="0.0" y="0.0" width="270" height="208"/>
|
||||
<view key="view" misplaced="YES" id="dEW-yf-Hlp">
|
||||
<rect key="frame" x="0.0" y="0.0" width="246" height="208"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="70" horizontalPageScroll="10" verticalLineScroll="70" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="THf-tA-SkY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="270" height="209"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="258" height="209"/>
|
||||
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="mlF-13-wpo">
|
||||
<rect key="frame" x="0.0" y="0.0" width="270" height="209"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="258" height="209"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="70" viewBased="YES" floatsGroupRows="NO" id="jbW-uy-rCk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="270" height="209"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="302" height="209"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="0.0" colorSpace="deviceWhite"/>
|
||||
<tableViewGridLines key="gridStyleMask" vertical="YES" horizontal="YES"/>
|
||||
@ -876,11 +875,11 @@
|
||||
</textFieldCell>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="ASCDownloadTableViewCellId" id="s9V-B9-Wgx" customClass="ASCDownloadCellView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="270" height="70"/>
|
||||
<rect key="frame" x="10" y="0.0" width="282" height="70"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="koZ-Kw-Xop">
|
||||
<rect key="frame" x="18" y="38" width="234" height="17"/>
|
||||
<rect key="frame" x="18" y="38" width="246" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="QE6-qb-Pl8"/>
|
||||
</constraints>
|
||||
@ -891,13 +890,13 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<progressIndicator wantsLayer="YES" maxValue="100" doubleValue="45" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="Ye0-dv-VyU">
|
||||
<rect key="frame" x="20" y="13" width="158" height="20"/>
|
||||
<rect key="frame" x="20" y="13" width="170" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="18" id="2ik-42-C9t"/>
|
||||
</constraints>
|
||||
</progressIndicator>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="23V-xr-uT3">
|
||||
<rect key="frame" x="188" y="16" width="75" height="16"/>
|
||||
<rect key="frame" x="200" y="16" width="75" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="75" id="3w1-7a-QHz"/>
|
||||
<constraint firstAttribute="height" constant="16" id="ABZ-aU-h1I"/>
|
||||
@ -1004,7 +1003,7 @@
|
||||
<rect key="frame" x="10" y="51" width="350" height="106"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="may-f5-Bdx">
|
||||
<rect key="frame" x="137" y="82" width="76" height="24"/>
|
||||
<rect key="frame" x="138" y="82" width="75" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="24" id="Ewd-qx-XMR"/>
|
||||
</constraints>
|
||||
@ -1108,7 +1107,7 @@
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<webView translatesAutoresizingMaskIntoConstraints="NO" id="rxD-dJ-5nd">
|
||||
<rect key="frame" x="10" y="61" width="780" height="420"/>
|
||||
<rect key="frame" x="10" y="60" width="780" height="421"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="780" id="5L3-pz-emb"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="420" id="CFF-ti-tZ6"/>
|
||||
@ -1118,7 +1117,7 @@
|
||||
</webPreferences>
|
||||
</webView>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UVj-pl-yO9">
|
||||
<rect key="frame" x="363" y="13" width="75" height="32"/>
|
||||
<rect key="frame" x="366" y="13" width="69" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Close" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Riu-oE-8dj">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
@ -1425,7 +1424,7 @@ DQ
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="M3X-hR-EHh">
|
||||
<rect key="frame" x="1065" y="0.0" width="30" height="38"/>
|
||||
<subviews>
|
||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rvn-zR-QDB">
|
||||
<imageView wantsLayer="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rvn-zR-QDB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="30" height="38"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<imageCell key="cell" enabled="NO" refusesFirstResponder="YES" alignment="left" animates="YES" image="progress_download_icon" id="yAE-gi-Nvm"/>
|
||||
|
||||
@ -83,6 +83,7 @@
|
||||
@property (strong) IBOutlet NSView *headerView;
|
||||
@property (nonatomic, assign) id <ASCExternalDelegate> externalDelegate;
|
||||
@property (nonatomic) ASCTouchBarController *touchBarController;
|
||||
@property (nonatomic) NSMutableArray<ASCTabView *> * tabsWithChanges;
|
||||
@end
|
||||
|
||||
@implementation ASCCommonViewController
|
||||
@ -90,6 +91,8 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.tabsWithChanges = @[].mutableCopy;
|
||||
|
||||
_externalDelegate = [[ASCExternalController shared] delegate];
|
||||
|
||||
void (^addObserverFor)(_Nullable NSNotificationName, SEL) = ^(_Nullable NSNotificationName name, SEL selector) {
|
||||
@ -455,13 +458,13 @@
|
||||
NSArray * tabs = [NSArray arrayWithArray:self.tabsControl.tabs];
|
||||
for (ASCTabView * tab in tabs) {
|
||||
if (tab.changed) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self tabs:self.tabsControl willRemovedTab:tab];
|
||||
});
|
||||
[self.tabsWithChanges addObject:tab];
|
||||
} else {
|
||||
[self.tabsControl removeTab:tab selected:NO];
|
||||
}
|
||||
}
|
||||
|
||||
[self safeCloseTabsWithChanges];
|
||||
} else if (result == NSAlertSecondButtonReturn) {
|
||||
// "Cancel" clicked
|
||||
return NO;
|
||||
@ -643,7 +646,7 @@
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"OK", nil)];
|
||||
[alert setMessageText:NSLocalizedString(@"File can not be open.", nil)];
|
||||
[alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"File \"%@\" can not be open or not exist.", nil), path]];
|
||||
[alert setAlertStyle:NSCriticalAlertStyle];
|
||||
[alert setAlertStyle:NSAlertStyleCritical];
|
||||
[alert beginSheetModalForWindow:[NSApp mainWindow] completionHandler:^(NSModalResponse returnCode) {
|
||||
if (tab) {
|
||||
[self.tabsControl removeTab:tab];
|
||||
@ -759,7 +762,7 @@
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
|
||||
[alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Do you want to save the changes made to the document \"%@\"?", nil), tab.title]];
|
||||
[alert setInformativeText:NSLocalizedString(@"Your changes will be lost if you don’t save them.", nil)];
|
||||
[alert setAlertStyle:NSWarningAlertStyle];
|
||||
[alert setAlertStyle:NSAlertStyleWarning];
|
||||
|
||||
[self.tabsControl selectTab:tab];
|
||||
|
||||
@ -783,6 +786,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)safeCloseTabsWithChanges {
|
||||
if ([[self tabsWithChanges] count] > 0) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self tabs:self.tabsControl willRemovedTab:[self.tabsWithChanges firstObject]];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark CEF events handlers
|
||||
|
||||
@ -1280,7 +1291,7 @@
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"Delete and Quit", nil)];
|
||||
[alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"You have %ld %@ documents with unconfirmed changes. Do you want to review these changes before quitting?", nil), (long)unsaved, productName]];
|
||||
[alert setInformativeText:NSLocalizedString(@"If you don't review your documents, all your changeses will be lost.", nil)];
|
||||
[alert setAlertStyle:NSInformationalAlertStyle];
|
||||
[alert setAlertStyle:NSAlertStyleInformational];
|
||||
|
||||
NSInteger result = [alert runModal];
|
||||
|
||||
@ -1289,11 +1300,13 @@
|
||||
|
||||
for (ASCTabView * tab in portalTabs) {
|
||||
if (tab.changed) {
|
||||
[self tabs:self.tabsControl willRemovedTab:tab];
|
||||
[self.tabsWithChanges addObject:tab];
|
||||
} else {
|
||||
[self.tabsControl removeTab:tab selected:NO];
|
||||
}
|
||||
}
|
||||
|
||||
[self safeCloseTabsWithChanges];
|
||||
} else if (result == NSAlertSecondButtonReturn) {
|
||||
return;
|
||||
} else {
|
||||
@ -1777,6 +1790,13 @@
|
||||
|
||||
[self.tabView removeTabViewItem:[self.tabView tabViewItemAtIndex:[self.tabView indexOfTabViewItemWithIdentifier:tab.uuid]]];
|
||||
|
||||
if ([self.tabsWithChanges containsObject:tab]) {
|
||||
[self.tabsWithChanges removeObject:tab];
|
||||
}
|
||||
if (self.tabsWithChanges.count > 0) {
|
||||
[self safeCloseTabsWithChanges];
|
||||
}
|
||||
|
||||
if (self.shouldTerminateApp && self.tabsControl.tabs.count < 1) {
|
||||
[NSApp terminate:nil];
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ static float kASCWindowMinTitleWidth = 0;
|
||||
[self.tabsControl.multicastDelegate addDelegate:self];
|
||||
|
||||
[self.userProfileButton setHidden:YES];
|
||||
[self.portalButton setState:NSOnState];
|
||||
[self.portalButton setState:NSControlStateValueOn];
|
||||
|
||||
[self.tabsControl removeAllConstraints];
|
||||
|
||||
@ -279,7 +279,7 @@ static float kASCWindowMinTitleWidth = 0;
|
||||
[tab setToolTip:name];
|
||||
|
||||
[self.tabsControl updateTab:tab];
|
||||
// if ([tab state] == NSOnState) {
|
||||
// if ([tab state] == NSControlStateValueOn) {
|
||||
// [self.tabsControl reloadTab:tab];
|
||||
// }
|
||||
}
|
||||
@ -298,7 +298,7 @@ static float kASCWindowMinTitleWidth = 0;
|
||||
tab.changed = changed;
|
||||
|
||||
[self.tabsControl updateTab:tab];
|
||||
// if ([tab state] == NSOnState) {
|
||||
// if ([tab state] == NSControlStateValueOn) {
|
||||
// [self.tabsControl reloadTab:tab];
|
||||
// }
|
||||
}
|
||||
@ -392,13 +392,13 @@ static float kASCWindowMinTitleWidth = 0;
|
||||
|
||||
- (void)tabs:(ASCTabsControl *)control didSelectTab:(ASCTabView *)tab {
|
||||
if (tab) {
|
||||
[self.portalButton setState:NSOffState];
|
||||
[self.portalButton setState:NSControlStateValueOff];
|
||||
} else {
|
||||
[self.portalButton setState:NSOnState];
|
||||
[self.portalButton setState:NSControlStateValueOn];
|
||||
}
|
||||
|
||||
if ([NSApplication isDarkMode]) {
|
||||
[self.portalButton setImage:(self.portalButton.state == NSOnState)
|
||||
[self.portalButton setImage:(self.portalButton.state == NSControlStateValueOn)
|
||||
? [NSImage imageNamed:@"logo-tab-dark"]
|
||||
: [NSImage imageNamed:@"logo-tab-light"]
|
||||
];
|
||||
|
||||
@ -101,6 +101,10 @@
|
||||
|
||||
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self.type == %@", @(filterType)];
|
||||
|
||||
if ([_filters count] < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSUInteger index = [_filters indexOfObjectPassingTest:^BOOL(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
return [predicate evaluateWithObject:obj];
|
||||
}];
|
||||
|
||||
@ -167,12 +167,12 @@ static NSString * const kASCTabsMulticastDelegateKey = @"asctabsmulticastDelegat
|
||||
[self addSubview:self.scrollView];
|
||||
|
||||
void (^initScrollButton)(NSButton *) = ^ (NSButton *button) {
|
||||
[button setBezelStyle:NSThickSquareBezelStyle];
|
||||
[button setBezelStyle:NSBezelStyleRegularSquare];
|
||||
[button setTitle:@""];
|
||||
[button setBordered:YES];
|
||||
[button setTarget:self];
|
||||
[button setBordered:NO];
|
||||
[button.cell sendActionOn:NSLeftMouseDownMask | NSPeriodicMask];
|
||||
[button.cell sendActionOn:NSEventMaskLeftMouseDown | NSEventMaskPeriodic];
|
||||
[button setAutoresizingMask:NSViewMinXMargin];
|
||||
|
||||
[self addSubview:button];
|
||||
@ -228,7 +228,7 @@ static NSString * const kASCTabsMulticastDelegateKey = @"asctabsmulticastDelegat
|
||||
tab.target = self;
|
||||
tab.action = @selector(handleSelectTab:);
|
||||
|
||||
[tab sendActionOn:NSLeftMouseDownMask];
|
||||
[tab sendActionOn:NSEventMaskLeftMouseDown];
|
||||
|
||||
[self.tabsView addSubview:tab];
|
||||
}
|
||||
@ -247,7 +247,7 @@ static NSString * const kASCTabsMulticastDelegateKey = @"asctabsmulticastDelegat
|
||||
|
||||
- (ASCTabView *)selectedTab {
|
||||
for (ASCTabView * tab in self.tabs) {
|
||||
if (tab.state == NSOnState) {
|
||||
if (tab.state == NSControlStateValueOn) {
|
||||
return tab;
|
||||
}
|
||||
}
|
||||
@ -444,8 +444,10 @@ static NSString * const kASCTabsMulticastDelegateKey = @"asctabsmulticastDelegat
|
||||
}
|
||||
|
||||
- (void)handleSelectTab:(ASCTabView *)selectedTab {
|
||||
BOOL needForceSelect = selectedTab.state != NSControlStateValueOn;
|
||||
|
||||
for (ASCTabView * tab in self.tabs) {
|
||||
[tab setState:(tab == selectedTab) ? NSOnState : NSOffState];
|
||||
[tab setState:(tab == selectedTab) ? NSControlStateValueOn : NSControlStateValueOff];
|
||||
}
|
||||
|
||||
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
|
||||
@ -453,7 +455,7 @@ static NSString * const kASCTabsMulticastDelegateKey = @"asctabsmulticastDelegat
|
||||
// [selectedTab.superview scrollRectToVisible:[selectedTab bounds]];
|
||||
} completionHandler:nil];
|
||||
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(tabs:didSelectTab:)]) {
|
||||
if (!needForceSelect && _delegate && [_delegate respondsToSelector:@selector(tabs:didSelectTab:)]) {
|
||||
[_delegate tabs:self didSelectTab:selectedTab];
|
||||
}
|
||||
|
||||
@ -463,9 +465,8 @@ static NSString * const kASCTabsMulticastDelegateKey = @"asctabsmulticastDelegat
|
||||
// On double click...
|
||||
} else {
|
||||
// watch for a drag event and initiate dragging if a drag is found...
|
||||
if ([self.window nextEventMatchingMask:NSLeftMouseUpMask | NSLeftMouseDraggedMask
|
||||
untilDate:[NSDate distantFuture]
|
||||
inMode:NSEventTrackingRunLoopMode dequeue:NO].type == NSLeftMouseDragged) {
|
||||
if ([self.window nextEventMatchingMask:NSEventMaskLeftMouseUp | NSEventMaskLeftMouseDragged
|
||||
untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:NO].type == NSEventTypeLeftMouseDragged) {
|
||||
[self reorderTab:selectedTab withEvent:currentEvent];
|
||||
return; // no autoscroll
|
||||
}
|
||||
@ -475,6 +476,7 @@ static NSString * const kASCTabsMulticastDelegateKey = @"asctabsmulticastDelegat
|
||||
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
|
||||
[context setAllowsImplicitAnimation:YES];
|
||||
[selectedTab.superview scrollRectToVisible:selectedTab.frame];
|
||||
[self layoutSubtreeIfNeeded];
|
||||
} completionHandler:nil];
|
||||
|
||||
[self invalidateRestorableState];
|
||||
@ -482,7 +484,7 @@ static NSString * const kASCTabsMulticastDelegateKey = @"asctabsmulticastDelegat
|
||||
|
||||
- (void)selectTab:(ASCTabView *)selectedTab {
|
||||
for (ASCTabView * tab in self.tabs) {
|
||||
[tab setState:(tab == selectedTab) ? NSOnState : NSOffState];
|
||||
[tab setState:(tab == selectedTab) ? NSControlStateValueOn : NSControlStateValueOff];
|
||||
}
|
||||
|
||||
if (selectedTab) {
|
||||
@ -529,14 +531,15 @@ static NSString * const kASCTabsMulticastDelegateKey = @"asctabsmulticastDelegat
|
||||
CGPoint prevPoint = dragPoint;
|
||||
|
||||
while (1) {
|
||||
event = [self.window nextEventMatchingMask:NSLeftMouseDraggedMask | NSLeftMouseUpMask];
|
||||
event = [self.window nextEventMatchingMask:NSEventMaskLeftMouseDragged | NSEventMaskLeftMouseUp];
|
||||
|
||||
CGFloat scrollPosition = [[self.scrollView contentView] documentVisibleRect].origin.x;
|
||||
|
||||
if (event.type == NSLeftMouseUp) {
|
||||
if (event.type == NSEventTypeLeftMouseUp) {
|
||||
[[NSAnimationContext currentContext] setCompletionHandler:^{
|
||||
[draggingTab removeFromSuperview];
|
||||
[tab setHidden:NO];
|
||||
[tab setState:NSControlStateValueOn];
|
||||
|
||||
// Calculate indexes
|
||||
NSString * uuidTab = tab.uuid;
|
||||
@ -622,7 +625,7 @@ static NSString * const kASCTabsMulticastDelegateKey = @"asctabsmulticastDelegat
|
||||
tab.delegate = self;
|
||||
tab.target = self;
|
||||
tab.action = @selector(handleSelectTab:);
|
||||
[tab sendActionOn:NSLeftMouseDownMask];
|
||||
[tab sendActionOn:NSEventMaskLeftMouseDown];
|
||||
|
||||
[self.tabsView addSubview:tab];
|
||||
|
||||
|
||||
@ -389,8 +389,6 @@
|
||||
<string>DjVu File</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
@ -443,10 +441,6 @@
|
||||
<string>Microsoft Word MHTML document (.mht)</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.microsoft.word.mhtml</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
@ -459,8 +453,6 @@
|
||||
<string>FictionBook File</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
@ -491,7 +483,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>455</string>
|
||||
<string>460</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.productivity</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@ -389,8 +389,6 @@
|
||||
<string>DjVu File</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
@ -443,10 +441,6 @@
|
||||
<string>Microsoft Word MHTML document (.mht)</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.microsoft.word.mhtml</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
@ -459,8 +453,6 @@
|
||||
<string>FictionBook File</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
@ -491,7 +483,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>455</string>
|
||||
<string>460</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.productivity</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
Reference in New Issue
Block a user