add changelog dialog and display_file api (implemented in osx and ios)
This commit is contained in:
@@ -109,6 +109,8 @@
|
||||
AD4CEF142156B2C60097F4BD /* node_about.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4CEF122156B2C50097F4BD /* node_about.cpp */; };
|
||||
AD4CEF152156B2DA0097F4BD /* node_about.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4CEF122156B2C50097F4BD /* node_about.cpp */; };
|
||||
AD5016591EBFC7F00079A826 /* data in Resources */ = {isa = PBXBuildFile; fileRef = AD58E0611E17F23D006ACC15 /* data */; };
|
||||
AD60AC17215799D000A380E9 /* node_changelog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD60AC15215799CF00A380E9 /* node_changelog.cpp */; };
|
||||
AD60AC18215799D000A380E9 /* node_changelog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD60AC15215799CF00A380E9 /* node_changelog.cpp */; };
|
||||
AD74030F1FB9D0D3004ACFCC /* node_combobox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD74030D1FB9D0C0004ACFCC /* node_combobox.cpp */; };
|
||||
AD7403101FB9D0D4004ACFCC /* node_combobox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD74030D1FB9D0C0004ACFCC /* node_combobox.cpp */; };
|
||||
AD759B681F2796EA00211963 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD759B671F2796EA00211963 /* OpenGLES.framework */; };
|
||||
@@ -348,6 +350,8 @@
|
||||
AD58E0741E3421F2006ACC15 /* YGNodeList.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = YGNodeList.c; path = libs/yoga/yoga/YGNodeList.c; sourceTree = "<group>"; };
|
||||
AD58E0751E3421F2006ACC15 /* Yoga.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Yoga.c; path = libs/yoga/yoga/Yoga.c; sourceTree = "<group>"; };
|
||||
AD58E0781E342205006ACC15 /* tinyxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tinyxml2.cpp; path = libs/tinyxml2/tinyxml2.cpp; sourceTree = "<group>"; };
|
||||
AD60AC15215799CF00A380E9 /* node_changelog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_changelog.cpp; sourceTree = "<group>"; };
|
||||
AD60AC16215799D000A380E9 /* node_changelog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_changelog.h; sourceTree = "<group>"; };
|
||||
AD74030C1FB9D0BF004ACFCC /* node_combobox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_combobox.h; sourceTree = "<group>"; };
|
||||
AD74030D1FB9D0C0004ACFCC /* node_combobox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_combobox.cpp; sourceTree = "<group>"; };
|
||||
AD744B6C1EBC9EF700B66E30 /* canvas_modes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = canvas_modes.cpp; sourceTree = "<group>"; };
|
||||
@@ -536,6 +540,8 @@
|
||||
AD1063541EC7ADFA002A525F /* node_button_custom.h */,
|
||||
AD1063551EC7ADFA002A525F /* node_button.cpp */,
|
||||
AD1063561EC7ADFA002A525F /* node_button.h */,
|
||||
AD60AC15215799CF00A380E9 /* node_changelog.cpp */,
|
||||
AD60AC16215799D000A380E9 /* node_changelog.h */,
|
||||
AD1063571EC7ADFA002A525F /* node_canvas.cpp */,
|
||||
AD1063581EC7ADFA002A525F /* node_canvas.h */,
|
||||
AD1063591EC7ADFA002A525F /* node_checkbox.cpp */,
|
||||
@@ -1110,6 +1116,7 @@
|
||||
AD0E5CCE1ECC72AD00C35669 /* node_text.cpp in Sources */,
|
||||
AD0E5CDC1ECC72AD00C35669 /* image.cpp in Sources */,
|
||||
AD2286C2214E9A0F0074567E /* version.cpp in Sources */,
|
||||
AD60AC18215799D000A380E9 /* node_changelog.cpp in Sources */,
|
||||
AD0E5CE01ECC72AD00C35669 /* shader.cpp in Sources */,
|
||||
ADC0EB3F1FBDC748004079BB /* node_colorwheel.cpp in Sources */,
|
||||
AD0E5CDD1ECC72AD00C35669 /* log.cpp in Sources */,
|
||||
@@ -1188,6 +1195,7 @@
|
||||
AD10639A1EC7AE92002A525F /* node_canvas.cpp in Sources */,
|
||||
ADD7D2A31EBFA06F00D5A897 /* tinyxml2.cpp in Sources */,
|
||||
AD10639B1EC7AE92002A525F /* node_checkbox.cpp in Sources */,
|
||||
AD60AC17215799D000A380E9 /* node_changelog.cpp in Sources */,
|
||||
AD1063A61EC7AE92002A525F /* node_popup_menu.cpp in Sources */,
|
||||
ADD7D29C1EBF9E1C00D5A897 /* shader.cpp in Sources */,
|
||||
ADD7D2A51EBFA06F00D5A897 /* Yoga.c in Sources */,
|
||||
|
||||
@@ -10,10 +10,16 @@
|
||||
#import <GLKit/GLKit.h>
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@interface GameViewController : GLKViewController <UIKeyInput,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
|
||||
@interface GameViewController : GLKViewController<
|
||||
UIKeyInput,
|
||||
UIImagePickerControllerDelegate,
|
||||
UINavigationControllerDelegate,
|
||||
UIDocumentInteractionControllerDelegate
|
||||
>
|
||||
{
|
||||
@public GLKView* glview;
|
||||
}
|
||||
- (void)display_file:(std::string)filename;
|
||||
- (void)reset_touch;
|
||||
- (void)async_lock;
|
||||
- (void)async_unlock;
|
||||
|
||||
@@ -62,6 +62,21 @@ NSThread* lock_thread;
|
||||
[self.context presentRenderbuffer:GL_RENDERBUFFER];
|
||||
}
|
||||
|
||||
-(void)display_file:(std::string)filename
|
||||
{
|
||||
NSString* filePath = [NSString stringWithUTF8String:filename.c_str()];
|
||||
NSURL *url = [NSURL fileURLWithPath:filePath];
|
||||
UIDocumentInteractionController *popup = [UIDocumentInteractionController interactionControllerWithURL:url];
|
||||
[popup setDelegate:self];
|
||||
[popup presentPreviewAnimated:YES];
|
||||
}
|
||||
|
||||
-(UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)pick_photo:(std::function<void(std::string)>) callback
|
||||
{
|
||||
GameImagePicker *picker = [[GameImagePicker alloc] init];
|
||||
|
||||
@@ -583,7 +583,7 @@
|
||||
</border>
|
||||
</layout>
|
||||
|
||||
<!--About window-->
|
||||
<!--About window-->
|
||||
<layout id="about">
|
||||
<border positioning="absolute" position="0 0" color=".4 .4 .4 .8" width="100%" height="100%" align="center" justify="center">
|
||||
<border thickness="1" border-color=".2" pad="3" max-width="650">
|
||||
@@ -644,6 +644,46 @@ Roboto Font License:
|
||||
</border>
|
||||
</layout>
|
||||
|
||||
<!--Changelog window-->
|
||||
<layout id="changelog">
|
||||
<border positioning="absolute" position="0 0" color=".4 .4 .4 .8" width="100%" height="100%" align="center" justify="center">
|
||||
<border thickness="1" border-color=".2" pad="3" max-width="650">
|
||||
<border width="100%" height="30" color=".2 .2 .2 .9" dir="row" align="center" justify="center">
|
||||
<text text="What's new in PanoPainter" font-face="arial" font-size="11"></text>
|
||||
</border>
|
||||
<border width="100%" color="0 0 0 .9" pad="10" dir="col">
|
||||
<!--window content-->
|
||||
<border color=".2" width="100%" height="300">
|
||||
<scroll pad="10" margin="5" color=".3 .3 .3 .4" dir="row" wrap="1" shrink="1">
|
||||
<text margin="0 0 0 5" font-face="arial" font-size="30" text="0.1.1"/>
|
||||
<text margin="10 0 0 5" font-face="arial" font-size="11" text=
|
||||
"This is the first public release of PanoPainter. It's important to note this is an early
|
||||
access to the software, so be aware it may crash or behave in unexpected ways.
|
||||
Always save your work. It comes with a lot of features that will be improved over time.
|
||||
Here's a list of what's available in this release.
|
||||
- Immersive 360° panoramic canvas
|
||||
- High-Performance GPU Accelerated Paint Engine
|
||||
- Intuitive gestures to navigate
|
||||
- Dynamic cross-platform User Interface
|
||||
- Native Apple Pencil support
|
||||
- Native Sonar Pen support
|
||||
- Massive resolution up to 8K panorama
|
||||
- Highly customizable brushes
|
||||
- Cloud Storage for device interoperability
|
||||
- Timelapse
|
||||
- Layers
|
||||
"/>
|
||||
</scroll>
|
||||
</border>
|
||||
<!--footer buttons-->
|
||||
<node height="40" grow="1" dir="row" align="flex-end" justify="flex-end">
|
||||
<button id="btn-ok" text="Ok" width="100" height="30" margin="0 10 0 0"/>
|
||||
</node>
|
||||
</border>
|
||||
</border>
|
||||
</border>
|
||||
</layout>
|
||||
|
||||
<!--popup menu-->
|
||||
<layout id="popup-menu">
|
||||
<popup-menu positioning="absolute" position="100 100" width="150" thickness="1" border-color=".1" color=".4 .4 .4 .8" dir="col">
|
||||
|
||||
@@ -94,6 +94,7 @@ public:
|
||||
struct engine* and_engine;
|
||||
#endif
|
||||
void pick_image(std::function<void(std::string path)> callback);
|
||||
void display_file(std::string path);
|
||||
void showKeyboard();
|
||||
void hideKeyboard();
|
||||
void initLog();
|
||||
@@ -139,6 +140,7 @@ public:
|
||||
void init_menu_layer();
|
||||
void init_menu_timelapse();
|
||||
void init_menu_about();
|
||||
void dialog_changelog();
|
||||
void dialog_about();
|
||||
void dialog_newdoc();
|
||||
void dialog_save();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "node_dialog_browse.h"
|
||||
#include "node_dialog_cloud.h"
|
||||
#include "node_about.h"
|
||||
#include "node_changelog.h"
|
||||
|
||||
std::shared_ptr<NodeProgressBar> App::show_progress(const std::string& title)
|
||||
{
|
||||
@@ -18,6 +19,18 @@ std::shared_ptr<NodeProgressBar> App::show_progress(const std::string& title)
|
||||
return pb;
|
||||
}
|
||||
|
||||
void App::dialog_changelog()
|
||||
{
|
||||
auto dialog = std::make_shared<NodeChangelog>();
|
||||
dialog->m_manager = &layout;
|
||||
dialog->init();
|
||||
dialog->create();
|
||||
dialog->loaded();
|
||||
|
||||
layout[main_id]->add_child(dialog);
|
||||
layout[main_id]->update();
|
||||
}
|
||||
|
||||
void App::dialog_about()
|
||||
{
|
||||
auto dialog = std::make_shared<NodeAbout>();
|
||||
@@ -29,6 +42,7 @@ void App::dialog_about()
|
||||
layout[main_id]->add_child(dialog);
|
||||
layout[main_id]->update();
|
||||
}
|
||||
|
||||
void App::dialog_newdoc()
|
||||
{
|
||||
auto show_dialog = [this] {
|
||||
|
||||
@@ -63,6 +63,26 @@ void App::pick_image(std::function<void(std::string path)> callback)
|
||||
#endif
|
||||
}
|
||||
|
||||
void App::display_file(std::string path)
|
||||
{
|
||||
#ifdef __IOS__
|
||||
[ios_view display_file:path];
|
||||
#elif __OSX__
|
||||
[[NSWorkspace sharedWorkspace] openFile:[NSString stringWithUTF8String:path.c_str()]];
|
||||
// dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// std::string path = [osx_view pick_file];
|
||||
// if (!path.empty())
|
||||
// callback(path);
|
||||
// });
|
||||
#elif __ANDROID__
|
||||
//displayKeyboard(and_app, false);
|
||||
#elif _WIN32
|
||||
// std::string path = win32_open_file();
|
||||
// if (!path.empty())
|
||||
// callback(path);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool App::mouse_down(int button, float x, float y, float pressure, kEventSource source)
|
||||
{
|
||||
redraw = true;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "node_text.h"
|
||||
#include "node_progress_bar.h"
|
||||
#include "node_dialog_picker.h"
|
||||
#include "node_about.h"
|
||||
|
||||
using namespace ui;
|
||||
|
||||
@@ -547,6 +546,8 @@ void App::init_menu_about()
|
||||
};
|
||||
|
||||
popup->find<NodeButtonCustom>("about-doc")->on_click = [this](Node*) {
|
||||
auto path = Asset::absolute("data/doc/test.pdf");
|
||||
display_file(path);
|
||||
popup->mouse_release();
|
||||
popup->destroy();
|
||||
};
|
||||
@@ -560,6 +561,7 @@ void App::init_menu_about()
|
||||
text->set_text(label);
|
||||
}
|
||||
item->on_click = [this](Node*) {
|
||||
dialog_changelog();
|
||||
popup->mouse_release();
|
||||
popup->destroy();
|
||||
};
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "node_dialog_picker.h"
|
||||
#include "node_panel_grid.h"
|
||||
#include "node_about.h"
|
||||
#include "node_changelog.h"
|
||||
|
||||
void Node::async_start()
|
||||
{
|
||||
@@ -901,6 +902,7 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node)
|
||||
CASE(kWidget::ColorWheel, NodeColorWheel);
|
||||
CASE(kWidget::ColorPicker, NodeColorPicker);
|
||||
CASE(kWidget::About, NodeAbout);
|
||||
CASE(kWidget::Changelog, NodeChangelog);
|
||||
#undef CASE
|
||||
case kWidget::Ref:
|
||||
{
|
||||
|
||||
@@ -82,6 +82,7 @@ enum class kWidget : uint16_t
|
||||
ColorWheel = const_hash("colorwheel"),
|
||||
ColorPicker = const_hash("color-picker"),
|
||||
About = const_hash("about"),
|
||||
Changelog = const_hash("changelog"),
|
||||
};
|
||||
|
||||
class Node
|
||||
|
||||
26
src/node_changelog.cpp
Normal file
26
src/node_changelog.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "pch.h"
|
||||
#include "log.h"
|
||||
#include "node_changelog.h"
|
||||
#include "layout.h"
|
||||
|
||||
Node* NodeChangelog::clone_instantiate() const
|
||||
{
|
||||
return new NodeChangelog();
|
||||
}
|
||||
|
||||
void NodeChangelog::init()
|
||||
{
|
||||
SetPosition(0, 0);
|
||||
SetWidthP(100);
|
||||
SetHeightP(100);
|
||||
SetPositioning(YGPositionTypeAbsolute);
|
||||
m_template = (*m_manager)[const_hash("changelog")]->m_children[0]->clone();
|
||||
add_child(m_template);
|
||||
btn_ok = m_template->find<NodeButton>("btn-ok");
|
||||
btn_ok->on_click = [&](Node*) { destroy(); };
|
||||
}
|
||||
|
||||
kEventResult NodeChangelog::handle_event(Event* e)
|
||||
{
|
||||
return kEventResult::Consumed;
|
||||
}
|
||||
13
src/node_changelog.h
Normal file
13
src/node_changelog.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "node.h"
|
||||
#include "node_button.h"
|
||||
|
||||
class NodeChangelog : public Node
|
||||
{
|
||||
Node* m_template;
|
||||
NodeButton* btn_ok;
|
||||
public:
|
||||
virtual Node* clone_instantiate() const override;
|
||||
virtual void init() override;
|
||||
virtual kEventResult handle_event(Event* e) override;
|
||||
};
|
||||
Reference in New Issue
Block a user