mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-20 10:50:33 -07:00
Delete lockfile at shutdown on linux and mac.
Passing lockfile on mac by sending message .
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
//NSString *nsver = @"OtherPrusaSlicerInstanceMessage" + version_hash;
|
||||
NSString *nsver = [NSString stringWithFormat: @"%@%@", @"OtherPrusaSlicerInstanceMessage", version_hash];
|
||||
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(message_update:) name:nsver object:nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
|
||||
NSString *nsver2 = [NSString stringWithFormat: @"%@%@", @"OtherPrusaSlicerInstanceClosing", version_hash];
|
||||
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(closing_update:) name:nsver2 object:nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
|
||||
}
|
||||
|
||||
-(void)message_update:(NSNotification *)msg
|
||||
@@ -24,6 +26,13 @@
|
||||
Slic3r::GUI::wxGetApp().other_instance_message_handler()->handle_message(std::string([msg.userInfo[@"data"] UTF8String]));
|
||||
}
|
||||
|
||||
-(void)closing_update:(NSNotification *)msg
|
||||
{
|
||||
//[self bring_forward];
|
||||
//pass message
|
||||
Slic3r::GUI::wxGetApp().other_instance_message_handler()->handle_message_other_closed();
|
||||
}
|
||||
|
||||
-(void) bring_forward
|
||||
{
|
||||
//demiaturize all windows
|
||||
@@ -51,6 +60,15 @@ void send_message_mac(const std::string &msg, const std::string &version)
|
||||
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:notifname object:nil userInfo:[NSDictionary dictionaryWithObject:nsmsg forKey:@"data"] deliverImmediately:YES];
|
||||
}
|
||||
|
||||
void send_message_mac_closing(const std::string &msg, const std::string &version)
|
||||
{
|
||||
NSString *nsmsg = [NSString stringWithCString:msg.c_str() encoding:[NSString defaultCStringEncoding]];
|
||||
//NSString *nsver = @"OtherPrusaSlicerInstanceMessage" + [NSString stringWithCString:version.c_str() encoding:[NSString defaultCStringEncoding]];
|
||||
NSString *nsver = [NSString stringWithCString:version.c_str() encoding:[NSString defaultCStringEncoding]];
|
||||
NSString *notifname = [NSString stringWithFormat: @"%@%@", @"OtherPrusaSlicerInstanceClosing", nsver];
|
||||
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:notifname object:nil userInfo:[NSDictionary dictionaryWithObject:nsmsg forKey:@"data"] deliverImmediately:YES];
|
||||
}
|
||||
|
||||
namespace GUI {
|
||||
void OtherInstanceMessageHandler::register_for_messages(const std::string &version_hash)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user