mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-06 14:57:50 -07:00
60 lines
1.6 KiB
Text
60 lines
1.6 KiB
Text
#include <unistd.h>
|
|
#include <sys/sysctl.h>
|
|
#import <wx/osx/cocoa/dataview.h>
|
|
#import "GUI_Utils.hpp"
|
|
|
|
namespace Slic3r {
|
|
namespace GUI {
|
|
|
|
void dataview_remove_insets(wxDataViewCtrl* dv) {
|
|
NSScrollView* scrollview = (NSScrollView*) ((wxCocoaDataViewControl*)dv->GetDataViewPeer())->GetWXWidget();
|
|
NSOutlineView* outlineview = scrollview.documentView;
|
|
[outlineview setIntercellSpacing: NSMakeSize(0.0, 1.0)];
|
|
if (@available(macOS 11, *)) {
|
|
[outlineview setStyle:NSTableViewStylePlain];
|
|
}
|
|
}
|
|
|
|
void staticbox_remove_margin(wxStaticBox* sb) {
|
|
NSBox* nativeBox = (NSBox*)sb->GetHandle();
|
|
[nativeBox setBoxType:NSBoxCustom];
|
|
[nativeBox setBorderWidth:0];
|
|
}
|
|
|
|
bool is_debugger_present()
|
|
// Returns true if the current process is being debugged (either
|
|
// running under the debugger or has a debugger attached post facto).
|
|
// https://stackoverflow.com/a/2200786/3289421
|
|
{
|
|
int junk;
|
|
int mib[4];
|
|
struct kinfo_proc info;
|
|
size_t size;
|
|
|
|
// Initialize the flags so that, if sysctl fails for some bizarre
|
|
// reason, we get a predictable result.
|
|
|
|
info.kp_proc.p_flag = 0;
|
|
|
|
// Initialize mib, which tells sysctl the info we want, in this case
|
|
// we're looking for information about a specific process ID.
|
|
|
|
mib[0] = CTL_KERN;
|
|
mib[1] = KERN_PROC;
|
|
mib[2] = KERN_PROC_PID;
|
|
mib[3] = getpid();
|
|
|
|
// Call sysctl.
|
|
|
|
size = sizeof(info);
|
|
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
|
|
assert(junk == 0);
|
|
|
|
// We're being debugged if the P_TRACED flag is set.
|
|
|
|
return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
|
|
}
|
|
|
|
}
|
|
}
|
|
|