implement clipboard on iOS

This commit is contained in:
2019-06-25 16:04:16 +02:00
parent 5f72f9901f
commit da6da775a0
7 changed files with 43 additions and 24 deletions

View File

@@ -1,8 +1,10 @@
#include "pch.h"
#include "log.h"
#include "util.h"
#include "app.h"
#include "canvas.h"
#include "node_dialog_picker.h"
#include <stdlib.h>
Node* NodeColorPicker::clone_instantiate() const
{
@@ -90,7 +92,7 @@ void NodeColorPicker::init_controls()
m_btn_paste->on_click = [this](Node*)
{
std::string s = clipboard_get_text();
std::string s = App::I.clipboard_get_text();
std::regex r("#([\\dabcdefABCDEF]{6})");
std::smatch m;
if (std::regex_search(s, m, r))
@@ -106,7 +108,7 @@ void NodeColorPicker::init_controls()
m_btn_copy->on_click = [this](Node*)
{
clipboard_set_text(m_txt_hex->m_text);
App::I.clipboard_set_text(m_txt_hex->m_text);
};
m_wheel->on_value_changed = [this](Node*, glm::vec3 hsv)
@@ -164,7 +166,7 @@ void NodeColorPicker::init_controls()
void NodeColorPicker::update_hex(glm::vec3 rgb)
{
char tmp[32];
ultoa(convert_rgb_long(rgb), tmp, 16);
snprintf(tmp, sizeof(tmp), "%xul", convert_rgb_long(rgb));
m_txt_hex->set_text_format("#%s", tmp);
}