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