Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add copy-paste to the font editor
  • Loading branch information
mniip committed May 8, 2018
1 parent 954086f commit ea1d574
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gui/font/FontEditor.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/gui/font/FontEditor.h
Expand Up @@ -53,6 +53,9 @@ class FontEditor: public ui::Window
int grid;
int rulers;

unsigned char clipboardWidth;
std::array<std::array<char, MAX_WIDTH>, FONT_H> clipboardPixels;

void UpdateCharNumber();
void PrevChar();
void NextChar();
Expand Down

0 comments on commit ea1d574

Please sign in to comment.