1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-06 21:37:37 +00:00
serenity/Userland/Applications/HexEditor/EditAnnotationWidget.gml
Sam Atkins cbd28c9110 HexEditor: Add annotations system
Allow the user to highlight sections of the edited document, giving them
arbitrary background colors. These annotations can be created from a
selection, or by manually specifying the start and end offsets.
Annotations can be edited or deleted by right-clicking them.

Any color can be used for the background. Dark colors automatically make
the text white for easier readability. When creating a new annotation,
we use whatever color the user last picked as this is slightly more
likely to be the one they want.

Icons contributed by Cubic Love.

Co-authored-by: Cubic Love <7754483+cubiclove@users.noreply.github.com>
2024-01-14 13:45:02 +00:00

75 lines
1.5 KiB
Text

@HexEditor::EditAnnotationWidget {
layout: @GUI::VerticalBoxLayout {
margins: [4]
}
fill_with_background_color: true
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
margins: [4]
}
preferred_height: "fit"
@GUI::Label {
text: "Start offset:"
text_alignment: "CenterLeft"
}
@GUI::NumericInput {
name: "start_offset"
min: 0
}
}
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
margins: [4]
}
preferred_height: "fit"
@GUI::Label {
text: "End offset:"
text_alignment: "CenterLeft"
}
@GUI::NumericInput {
name: "end_offset"
min: 0
}
}
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
margins: [4]
}
preferred_height: "fit"
@GUI::Label {
text: "Color:"
text_alignment: "CenterLeft"
}
@GUI::ColorInput {
name: "background_color"
}
}
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
margins: [4]
}
preferred_height: "fit"
@GUI::Layout::Spacer {}
@GUI::DialogButton {
name: "save_button"
text: "Save"
}
@GUI::DialogButton {
name: "cancel_button"
text: "Cancel"
}
}
}