mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 15:21:21 -06:00
Add the full source of BambuStudio
using version 1.0.10
This commit is contained in:
parent
30bcadab3e
commit
1555904bef
3771 changed files with 1251328 additions and 0 deletions
99
src/slic3r/Utils/MacDarkMode.mm
Normal file
99
src/slic3r/Utils/MacDarkMode.mm
Normal file
|
@ -0,0 +1,99 @@
|
|||
#import "MacDarkMode.hpp"
|
||||
|
||||
#import <algorithm>
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/NSScreen.h>
|
||||
|
||||
@interface MacDarkMode : NSObject {}
|
||||
@end
|
||||
|
||||
@implementation MacDarkMode
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
bool mac_dark_mode()
|
||||
{
|
||||
NSString *style = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
|
||||
return style && [style isEqualToString:@"Dark"];
|
||||
|
||||
}
|
||||
|
||||
double mac_max_scaling_factor()
|
||||
{
|
||||
double scaling = 1.;
|
||||
// if ([NSScreen screens] == nil) {
|
||||
// scaling = [[NSScreen mainScreen] backingScaleFactor];
|
||||
// } else {
|
||||
// for (int i = 0; i < [[NSScreen screens] count]; ++ i)
|
||||
// scaling = std::max<double>(scaling, [[[NSScreen screens] objectAtIndex:0] backingScaleFactor]);
|
||||
// }
|
||||
return scaling;
|
||||
}
|
||||
|
||||
void set_miniaturizable(void * window)
|
||||
{
|
||||
[(NSView*) window window].styleMask |= NSMiniaturizableWindowMask;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
/* textColor for NSButton */
|
||||
|
||||
@implementation NSButton (NSButton_Extended)
|
||||
|
||||
- (NSColor *)textColor
|
||||
{
|
||||
NSAttributedString *attrTitle = [self attributedTitle];
|
||||
int len = [attrTitle length];
|
||||
NSRange range = NSMakeRange(0, MIN(len, 1)); // get the font attributes from the first character
|
||||
NSDictionary *attrs = [attrTitle fontAttributesInRange:range];
|
||||
NSColor *textColor = [NSColor controlTextColor];
|
||||
if (attrs)
|
||||
{
|
||||
textColor = [attrs objectForKey:NSForegroundColorAttributeName];
|
||||
}
|
||||
|
||||
return textColor;
|
||||
}
|
||||
|
||||
- (void)setTextColor:(NSColor *)textColor
|
||||
{
|
||||
NSMutableAttributedString *attrTitle =
|
||||
[[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTitle]];
|
||||
int len = [attrTitle length];
|
||||
NSRange range = NSMakeRange(0, len);
|
||||
[attrTitle addAttribute:NSForegroundColorAttributeName value:textColor range:range];
|
||||
[attrTitle fixAttributesInRange:range];
|
||||
[self setAttributedTitle:attrTitle];
|
||||
[attrTitle release];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/osx/cocoa/dataview.h>
|
||||
#include <wx/osx/dataview.h>
|
||||
|
||||
@implementation wxCocoaOutlineView (Edit)
|
||||
|
||||
- (BOOL)outlineView: (NSOutlineView*) view shouldEditTableColumn:(nullable NSTableColumn *)tableColumn item:(nonnull id)item
|
||||
{
|
||||
wxDataViewColumn* const col((wxDataViewColumn *)[tableColumn getColumnPointer]);
|
||||
wxDataViewItem item2([static_cast<wxPointerObject *>(item) pointer]);
|
||||
|
||||
wxDataViewCtrl* const dvc = implementation->GetDataViewCtrl();
|
||||
// Before doing anything we send an event asking if editing of this item is really wanted.
|
||||
wxDataViewEvent event(wxEVT_DATAVIEW_ITEM_EDITING_STARTED, dvc, col, item2);
|
||||
dvc->GetEventHandler()->ProcessEvent( event );
|
||||
if( !event.IsAllowed() )
|
||||
return NO;
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue