mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 01:26:22 +00:00
HexEditor: Add get_byte() method to HexEditor class
This commit is contained in:
parent
1b70c5f605
commit
604557c71b
Notes:
sideshowbarker
2024-07-18 05:01:22 +09:00
Author: https://github.com/tslater2006
Commit: 604557c71b
Pull-request: https://github.com/SerenityOS/serenity/pull/12861
Reviewed-by: https://github.com/MacDue
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
2 changed files with 9 additions and 0 deletions
|
@ -229,6 +229,14 @@ void HexEditor::set_content_length(size_t length)
|
||||||
set_content_size({ static_cast<int>(newWidth), static_cast<int>(newHeight) });
|
set_content_size({ static_cast<int>(newWidth), static_cast<int>(newHeight) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Optional<u8> HexEditor::get_byte(size_t position)
|
||||||
|
{
|
||||||
|
if (position < m_document->size())
|
||||||
|
return m_document->get(position).value;
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
void HexEditor::mousedown_event(GUI::MouseEvent& event)
|
void HexEditor::mousedown_event(GUI::MouseEvent& event)
|
||||||
{
|
{
|
||||||
if (event.button() != GUI::MouseButton::Primary) {
|
if (event.button() != GUI::MouseButton::Primary) {
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
bool open_new_file(size_t size);
|
bool open_new_file(size_t size);
|
||||||
void open_file(NonnullRefPtr<Core::File> file);
|
void open_file(NonnullRefPtr<Core::File> file);
|
||||||
void fill_selection(u8 fill_byte);
|
void fill_selection(u8 fill_byte);
|
||||||
|
Optional<u8> get_byte(size_t position);
|
||||||
bool save_as(NonnullRefPtr<Core::File>);
|
bool save_as(NonnullRefPtr<Core::File>);
|
||||||
bool save();
|
bool save();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue