Add copy-paste to the font editor

This commit is contained in:
mniip
2018-05-08 03:58:30 +03:00
parent 954086fb86
commit ea1d574caf
2 changed files with 12 additions and 1 deletions

View File

@@ -293,7 +293,7 @@ FontEditor::FontEditor(ByteString _header):
CharNumberAction(FontEditor *_v): v(_v) {}
void TextChangedCallback(ui::Textbox *)
{
unsigned int number = v->currentCharTextbox->GetText().ToNumber<unsigned int>(true);
unsigned int number = v->currentCharTextbox->GetText().ToNumber<unsigned int>(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;
}
}
}

View File

@@ -53,6 +53,9 @@ private:
int grid;
int rulers;
unsigned char clipboardWidth;
std::array<std::array<char, MAX_WIDTH>, FONT_H> clipboardPixels;
void UpdateCharNumber();
void PrevChar();
void NextChar();