associate abr files to panopainter on iOS and fix import menu
This commit is contained in:
@@ -18,6 +18,16 @@
|
|||||||
<string>com.panopainter.image</string>
|
<string>com.panopainter.image</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeIconFiles</key>
|
||||||
|
<array/>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>ABR</string>
|
||||||
|
<key>LSItemContentTypes</key>
|
||||||
|
<array>
|
||||||
|
<string>com.panopainter.abr</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
@@ -70,6 +80,30 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>UTExportedTypeDeclarations</key>
|
<key>UTExportedTypeDeclarations</key>
|
||||||
<array>
|
<array>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>UTTypeConformsTo</key>
|
||||||
|
<array>
|
||||||
|
<string>public.data</string>
|
||||||
|
<string>public.content</string>
|
||||||
|
</array>
|
||||||
|
<key>UTTypeDescription</key>
|
||||||
|
<string>PanoPainter Image</string>
|
||||||
|
<key>UTTypeIconFiles</key>
|
||||||
|
<array/>
|
||||||
|
<key>UTTypeIdentifier</key>
|
||||||
|
<string>com.panopainter.image</string>
|
||||||
|
<key>UTTypeTagSpecification</key>
|
||||||
|
<dict>
|
||||||
|
<key>public.filename-extension</key>
|
||||||
|
<array>
|
||||||
|
<string>ppi</string>
|
||||||
|
</array>
|
||||||
|
<key>public.mime-type</key>
|
||||||
|
<string>image/ppi</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>UTTypeConformsTo</key>
|
<key>UTTypeConformsTo</key>
|
||||||
<array>
|
<array>
|
||||||
@@ -77,19 +111,19 @@
|
|||||||
<string>public.content</string>
|
<string>public.content</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UTTypeDescription</key>
|
<key>UTTypeDescription</key>
|
||||||
<string>PanoPainter Image</string>
|
<string>ABR</string>
|
||||||
<key>UTTypeIconFiles</key>
|
<key>UTTypeIconFiles</key>
|
||||||
<array/>
|
<array/>
|
||||||
<key>UTTypeIdentifier</key>
|
<key>UTTypeIdentifier</key>
|
||||||
<string>com.panopainter.image</string>
|
<string>com.panopainter.abr</string>
|
||||||
<key>UTTypeTagSpecification</key>
|
<key>UTTypeTagSpecification</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>public.filename-extension</key>
|
<key>public.filename-extension</key>
|
||||||
<array>
|
<array>
|
||||||
<string>ppi</string>
|
<string>abr</string>
|
||||||
</array>
|
</array>
|
||||||
<key>public.mime-type</key>
|
<key>public.mime-type</key>
|
||||||
<string>image/ppi</string>
|
<string>preset/abr</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
|
|||||||
62
src/app.cpp
62
src/app.cpp
@@ -31,33 +31,45 @@ void App::create()
|
|||||||
|
|
||||||
void App::open_document(std::string path)
|
void App::open_document(std::string path)
|
||||||
{
|
{
|
||||||
auto start = path.rfind('/') + 1;
|
std::regex r(R"((.*)[\\/]([^\\/]+)\.(\w+)$)");
|
||||||
doc_name = path.substr(start, path.length() - start - strlen(".ppi"));
|
std::smatch m;
|
||||||
doc_dir = path.substr(0, start - 1);
|
if (!std::regex_search(path, m, r))
|
||||||
doc_path = path;
|
return;
|
||||||
canvas->reset_camera();
|
std::string ext = m[3].str();
|
||||||
layers->clear();
|
|
||||||
canvas->m_canvas->project_open(path, [this](bool success){
|
if (str_iequals(m[3].str(), "abr"))
|
||||||
// on complete
|
{
|
||||||
if (success)
|
std::thread(&NodePanelStroke::import_abr, stroke, path).detach();
|
||||||
{
|
}
|
||||||
async_start();
|
else
|
||||||
title_update();
|
{
|
||||||
for (auto& i : canvas->m_canvas->m_order)
|
doc_name = m[2].str();
|
||||||
|
doc_dir = m[1].str();
|
||||||
|
doc_path = path;
|
||||||
|
canvas->reset_camera();
|
||||||
|
layers->clear();
|
||||||
|
canvas->m_canvas->project_open(path, [this](bool success){
|
||||||
|
// on complete
|
||||||
|
if (success)
|
||||||
{
|
{
|
||||||
auto l = layers->add_layer(canvas->m_canvas->m_layers[i]->m_name.c_str());
|
async_start();
|
||||||
l->m_visibility->set_value(canvas->m_canvas->m_layers[i]->m_visible);
|
title_update();
|
||||||
|
for (auto& i : canvas->m_canvas->m_order)
|
||||||
|
{
|
||||||
|
auto l = layers->add_layer(canvas->m_canvas->m_layers[i]->m_name.c_str());
|
||||||
|
l->m_visibility->set_value(canvas->m_canvas->m_layers[i]->m_visible);
|
||||||
|
}
|
||||||
|
async_end();
|
||||||
}
|
}
|
||||||
async_end();
|
else
|
||||||
}
|
{
|
||||||
else
|
message_box("Open Document Error",
|
||||||
{
|
"There was an error opening the document.\n"
|
||||||
message_box("Open Document Error",
|
"It may be inaccessible or corrupted.");
|
||||||
"There was an error opening the document.\n"
|
}
|
||||||
"It may be inaccessible or corrupted.");
|
});
|
||||||
}
|
ActionManager::clear();
|
||||||
});
|
}
|
||||||
ActionManager::clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool App::request_close()
|
bool App::request_close()
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ void App::pick_file(std::vector<std::string> types, std::function<void (std::str
|
|||||||
redraw = true;
|
redraw = true;
|
||||||
#ifdef __IOS__
|
#ifdef __IOS__
|
||||||
// not implemented on ios
|
// not implemented on ios
|
||||||
//[ios_view pick_photo:callback];
|
// fallback to pick_image
|
||||||
|
[ios_view pick_photo:callback];
|
||||||
#elif __OSX__
|
#elif __OSX__
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
//NSArray* fileTypes = [NSArray arrayWithObjects:@"ppi", @"PPI", nil];
|
//NSArray* fileTypes = [NSArray arrayWithObjects:@"ppi", @"PPI", nil];
|
||||||
|
|||||||
Reference in New Issue
Block a user