OSX: associate abr file, fix shell open file when process is running, fix shutdown
This commit is contained in:
@@ -25,7 +25,31 @@
|
||||
<true/>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>public.panorama-image</string>
|
||||
<string>com.panopainter.image</string>
|
||||
</array>
|
||||
<key>LSTypeIsPackage</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>abr</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>CFBundleTypeMIMETypes</key>
|
||||
<array/>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>PanoPainter Brushes</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSIsAppleDefaultForType</key>
|
||||
<false/>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.panopainter.abr</string>
|
||||
</array>
|
||||
<key>LSTypeIsPackage</key>
|
||||
<integer>0</integer>
|
||||
@@ -71,7 +95,7 @@
|
||||
<key>UTTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>public.panorama-image</string>
|
||||
<string>com.panopainter.image</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>com.apple.ostype</key>
|
||||
@@ -88,6 +112,35 @@
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>PanoPainter Brushes</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>pp-icon-square</string>
|
||||
<key>UTTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.panopainter.abr</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>com.apple.ostype</key>
|
||||
<array>
|
||||
<string>****</string>
|
||||
</array>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>abr</string>
|
||||
</array>
|
||||
<key>public.mime-type</key>
|
||||
<array>
|
||||
<string>preset/abr</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>UTImportedTypeDeclarations</key>
|
||||
<array>
|
||||
@@ -118,6 +171,33 @@
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>PanoPainter Brushes</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>pp-icon-square</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.panopainter.abr</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>com.apple.ostype</key>
|
||||
<array>
|
||||
<string>****</string>
|
||||
</array>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>abr</string>
|
||||
</array>
|
||||
<key>public.mime-type</key>
|
||||
<array>
|
||||
<string>preset/abr</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -169,8 +169,9 @@ std::mutex task_mutex;
|
||||
- (void)terminateGL
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
CVDisplayLinkRelease(dl);
|
||||
App::I.terminate();
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
CVDisplayLinkRelease(dl);
|
||||
}
|
||||
|
||||
// This is the renderer output callback function
|
||||
@@ -445,7 +446,6 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
|
||||
@implementation Controller
|
||||
- (void)windowWillClose:(NSNotification *)notification
|
||||
{
|
||||
App::I.terminate();
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
}
|
||||
-(BOOL)windowShouldClose:(NSWindow *)sender
|
||||
@@ -472,7 +472,8 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
|
||||
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename
|
||||
{
|
||||
LOG("open file %s", [filename UTF8String]);
|
||||
//App::I.open_document([filename UTF8String]);
|
||||
if (view && view->gl_ready)
|
||||
App::I.open_document([filename UTF8String]);
|
||||
file2open = filename;
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ void App::crash_test()
|
||||
|
||||
void App::tick(float dt)
|
||||
{
|
||||
layout[main_id]->tick(dt);
|
||||
if (auto* main = layout[main_id])
|
||||
main->tick(dt);
|
||||
}
|
||||
|
||||
void App::resize(float w, float h)
|
||||
@@ -204,8 +205,12 @@ bool App::mouse_down(int button, float x, float y, float pressure, kEventSource
|
||||
e.m_pressure = pressure;
|
||||
e.m_source = source;
|
||||
e.m_eraser = eraser;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
{
|
||||
ret = main->on_event(&e);
|
||||
main->update();
|
||||
}
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::mouse_move(float x, float y, float pressure, kEventSource source, bool eraser)
|
||||
@@ -231,8 +236,12 @@ bool App::mouse_up(int button, float x, float y, kEventSource source, bool erase
|
||||
e.m_pos = { x / zoom, y / zoom };
|
||||
e.m_source = source;
|
||||
e.m_eraser = eraser;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
{
|
||||
ret = main->on_event(&e);
|
||||
main->update();
|
||||
}
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::mouse_scroll(float x, float y, float delta)
|
||||
@@ -242,8 +251,12 @@ bool App::mouse_scroll(float x, float y, float delta)
|
||||
e.m_type = kEventType::MouseScroll;
|
||||
e.m_pos = { x / zoom, y / zoom };
|
||||
e.m_scroll_delta = delta;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
{
|
||||
ret = main->on_event(&e);
|
||||
main->update();
|
||||
}
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::mouse_cancel(int button)
|
||||
@@ -251,8 +264,12 @@ bool App::mouse_cancel(int button)
|
||||
redraw = true;
|
||||
MouseEvent e;
|
||||
e.m_type = kEventType::MouseCancel;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
{
|
||||
ret = main->on_event(&e);
|
||||
main->update();
|
||||
}
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::gesture_start(const glm::vec2& p0, const glm::vec2& p1)
|
||||
@@ -265,8 +282,12 @@ bool App::gesture_start(const glm::vec2& p0, const glm::vec2& p1)
|
||||
e.m_distance = glm::distance(p0, p1);
|
||||
gesture_p0 = p0;
|
||||
gesture_p1 = p1;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
{
|
||||
ret = main->on_event(&e);
|
||||
main->update();
|
||||
}
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::gesture_move(const glm::vec2& p0, const glm::vec2& p1)
|
||||
@@ -279,8 +300,12 @@ bool App::gesture_move(const glm::vec2& p0, const glm::vec2& p1)
|
||||
e.m_distance = glm::distance(p0, p1);
|
||||
e.m_distance_delta = e.m_distance - glm::distance(gesture_p0, gesture_p1);
|
||||
e.m_pos_delta = p - glm::lerp(gesture_p0, gesture_p1, 0.5f);
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
{
|
||||
ret = main->on_event(&e);
|
||||
main->update();
|
||||
}
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::gesture_end()
|
||||
@@ -288,8 +313,12 @@ bool App::gesture_end()
|
||||
redraw = true;
|
||||
GestureEvent e;
|
||||
e.m_type = kEventType::GestureEnd;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
{
|
||||
ret = main->on_event(&e);
|
||||
main->update();
|
||||
}
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::key_down(kKey key)
|
||||
@@ -301,8 +330,12 @@ bool App::key_down(kKey key)
|
||||
KeyEvent e;
|
||||
e.m_type = kEventType::KeyDown;
|
||||
e.m_key = key;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
{
|
||||
ret = main->on_event(&e);
|
||||
main->update();
|
||||
}
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::key_up(kKey key)
|
||||
@@ -312,8 +345,12 @@ bool App::key_up(kKey key)
|
||||
KeyEvent e;
|
||||
e.m_type = kEventType::KeyUp;
|
||||
e.m_key = key;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
{
|
||||
ret = main->on_event(&e);
|
||||
main->update();
|
||||
}
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::key_char(char key)
|
||||
@@ -322,8 +359,12 @@ bool App::key_char(char key)
|
||||
KeyEvent e;
|
||||
e.m_type = kEventType::KeyChar;
|
||||
e.m_char = key;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
{
|
||||
ret = main->on_event(&e);
|
||||
main->update();
|
||||
}
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user