mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibDraw: Put all classes in the Gfx namespace
I started adding things to a Draw namespace, but it somehow felt really wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename the library to LibGfx. :^)
This commit is contained in:
parent
939a605334
commit
11580babbf
269 changed files with 1513 additions and 1315 deletions
|
@ -44,8 +44,8 @@
|
|||
HexEditor::HexEditor(GUI::Widget* parent)
|
||||
: ScrollableWidget(parent)
|
||||
{
|
||||
set_frame_shape(FrameShape::Container);
|
||||
set_frame_shadow(FrameShadow::Sunken);
|
||||
set_frame_shape(Gfx::FrameShape::Container);
|
||||
set_frame_shadow(Gfx::FrameShadow::Sunken);
|
||||
set_frame_thickness(2);
|
||||
set_scrollbars_enabled(true);
|
||||
set_font(GFontDatabase::the().get_by_name("Csilla Thin"));
|
||||
|
@ -544,7 +544,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event)
|
|||
}
|
||||
|
||||
auto line = String::format("%02X", m_buffer[byte_position]);
|
||||
painter.draw_text(hex_display_rect, line, TextAlignment::TopLeft, text_color);
|
||||
painter.draw_text(hex_display_rect, line, Gfx::TextAlignment::TopLeft, text_color);
|
||||
|
||||
Rect text_display_rect {
|
||||
frame_thickness() + offset_margin_width() + (bytes_per_row() * (character_width() * 3)) + (j * character_width()) + 20,
|
||||
|
@ -559,7 +559,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event)
|
|||
painter.fill_rect(text_display_rect, Color::from_rgb(0xCCCCCC));
|
||||
}
|
||||
|
||||
painter.draw_text(text_display_rect, String::format("%c", isprint(m_buffer[byte_position]) ? m_buffer[byte_position] : '.'), TextAlignment::TopLeft, text_color);
|
||||
painter.draw_text(text_display_rect, String::format("%c", isprint(m_buffer[byte_position]) ? m_buffer[byte_position] : '.'), Gfx::TextAlignment::TopLeft, text_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ HexEditorWidget::HexEditorWidget()
|
|||
|
||||
m_statusbar = GUI::StatusBar::construct(5, this);
|
||||
|
||||
m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) {
|
||||
m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) {
|
||||
if (m_document_dirty) {
|
||||
auto save_document_first_box = GUI::MessageBox::construct("Save Document First?", "Warning", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel, window());
|
||||
auto save_document_first_result = save_document_first_box->exec();
|
||||
|
@ -102,7 +102,7 @@ HexEditorWidget::HexEditorWidget()
|
|||
open_file(open_path.value());
|
||||
});
|
||||
|
||||
m_save_action = GUI::Action::create("Save", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&](const GUI::Action&) {
|
||||
m_save_action = GUI::Action::create("Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [&](const GUI::Action&) {
|
||||
if (!m_path.is_empty()) {
|
||||
if (!m_editor->write_to_file(m_path)) {
|
||||
GUI::MessageBox::show("Unable to save file.\n", "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window());
|
||||
|
@ -116,7 +116,7 @@ HexEditorWidget::HexEditorWidget()
|
|||
m_save_as_action->activate();
|
||||
});
|
||||
|
||||
m_save_as_action = GUI::Action::create("Save as...", { Mod_Ctrl | Mod_Shift, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [this](const GUI::Action&) {
|
||||
m_save_as_action = GUI::Action::create("Save as...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [this](const GUI::Action&) {
|
||||
Optional<String> save_path = GUI::FilePicker::get_save_filepath(m_name.is_null() ? "Untitled" : m_name, m_extension.is_null() ? "bin" : m_extension);
|
||||
if (!save_path.has_value())
|
||||
return;
|
||||
|
@ -153,7 +153,7 @@ HexEditorWidget::HexEditorWidget()
|
|||
}));
|
||||
}
|
||||
|
||||
m_goto_decimal_offset_action = GUI::Action::create("Go To Offset (Decimal)...", { Mod_Ctrl | Mod_Shift, Key_G }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](const GUI::Action&) {
|
||||
m_goto_decimal_offset_action = GUI::Action::create("Go To Offset (Decimal)...", { Mod_Ctrl | Mod_Shift, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](const GUI::Action&) {
|
||||
auto input_box = GUI::InputBox::construct("Enter Decimal offset:", "Go To", this);
|
||||
if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) {
|
||||
auto valid = false;
|
||||
|
@ -164,7 +164,7 @@ HexEditorWidget::HexEditorWidget()
|
|||
}
|
||||
});
|
||||
|
||||
m_goto_hex_offset_action = GUI::Action::create("Go To Offset (Hex)...", { Mod_Ctrl, Key_G }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](const GUI::Action&) {
|
||||
m_goto_hex_offset_action = GUI::Action::create("Go To Offset (Hex)...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](const GUI::Action&) {
|
||||
auto input_box = GUI::InputBox::construct("Enter Hex offset:", "Go To", this);
|
||||
if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) {
|
||||
auto new_offset = strtol(input_box->text_value().characters(), nullptr, 16);
|
||||
|
@ -202,7 +202,7 @@ HexEditorWidget::HexEditorWidget()
|
|||
|
||||
auto help_menu = GUI::Menu::construct("Help");
|
||||
help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) {
|
||||
GUI::AboutDialog::show("Hex Editor", load_png("/res/icons/32x32/app-hexeditor.png"), window());
|
||||
GUI::AboutDialog::show("Hex Editor", Gfx::load_png("/res/icons/32x32/app-hexeditor.png"), window());
|
||||
}));
|
||||
menubar->add_menu(move(help_menu));
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ int main(int argc, char** argv)
|
|||
};
|
||||
|
||||
window->show();
|
||||
window->set_icon(load_png("/res/icons/16x16/app-hexeditor.png"));
|
||||
window->set_icon(Gfx::load_png("/res/icons/16x16/app-hexeditor.png"));
|
||||
|
||||
if (argc >= 2)
|
||||
hex_editor_widget->open_file(argv[1]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue