From ea1d574caf3c9e454489ca68e3b3bd33df144087 Mon Sep 17 00:00:00 2001 From: mniip Date: Tue, 8 May 2018 03:58:30 +0300 Subject: [PATCH] Add copy-paste to the font editor --- src/gui/font/FontEditor.cpp | 10 +++++++++- src/gui/font/FontEditor.h | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gui/font/FontEditor.cpp b/src/gui/font/FontEditor.cpp index 79d84517f..571c62c78 100644 --- a/src/gui/font/FontEditor.cpp +++ b/src/gui/font/FontEditor.cpp @@ -293,7 +293,7 @@ FontEditor::FontEditor(ByteString _header): CharNumberAction(FontEditor *_v): v(_v) {} void TextChangedCallback(ui::Textbox *) { - unsigned int number = v->currentCharTextbox->GetText().ToNumber(true); + unsigned int number = v->currentCharTextbox->GetText().ToNumber(Format::Hex(), true); if(number <= 0x10FFFF) v->currentChar = number; } @@ -600,6 +600,14 @@ void FontEditor::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bo else ui::Engine::Ref().ConfirmExit(); break; + case 'c': + clipboardWidth = fontWidths[currentChar]; + clipboardPixels = fontPixels[currentChar]; + break; + case 'v': + fontWidths[currentChar] = clipboardWidth; + fontPixels[currentChar] = clipboardPixels; + break; } } } diff --git a/src/gui/font/FontEditor.h b/src/gui/font/FontEditor.h index 833966ae6..84ac69b1a 100644 --- a/src/gui/font/FontEditor.h +++ b/src/gui/font/FontEditor.h @@ -53,6 +53,9 @@ private: int grid; int rulers; + unsigned char clipboardWidth; + std::array, FONT_H> clipboardPixels; + void UpdateCharNumber(); void PrevChar(); void NextChar();