1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:18:12 +00:00

Everywhere: Stop using NonnullRefPtrVector

This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.

This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
This commit is contained in:
Andreas Kling 2023-03-06 14:17:01 +01:00
parent 104be6c8ac
commit 8a48246ed1
168 changed files with 1280 additions and 1280 deletions

View file

@ -187,11 +187,11 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
if (m_show_guides) {
for (auto& guide : m_guides) {
if (guide.orientation() == Guide::Orientation::Horizontal) {
int y_coordinate = (int)content_to_frame_position({ 0.0f, guide.offset() }).y();
if (guide->orientation() == Guide::Orientation::Horizontal) {
int y_coordinate = (int)content_to_frame_position({ 0.0f, guide->offset() }).y();
painter.draw_line({ 0, y_coordinate }, { rect().width(), y_coordinate }, Color::Cyan, 1, Gfx::Painter::LineStyle::Dashed, Color::LightGray);
} else if (guide.orientation() == Guide::Orientation::Vertical) {
int x_coordinate = (int)content_to_frame_position({ guide.offset(), 0.0f }).x();
} else if (guide->orientation() == Guide::Orientation::Vertical) {
int x_coordinate = (int)content_to_frame_position({ guide->offset(), 0.0f }).x();
painter.draw_line({ x_coordinate, 0 }, { x_coordinate, rect().height() }, Color::Cyan, 1, Gfx::Painter::LineStyle::Dashed, Color::LightGray);
}
}
@ -768,10 +768,10 @@ ErrorOr<void> ImageEditor::save_project_to_file(NonnullOwnPtr<Core::File> file)
auto json_guides = TRY(json.add_array("guides"sv));
for (auto const& guide : m_guides) {
auto json_guide = TRY(json_guides.add_object());
TRY(json_guide.add("offset"sv, (double)guide.offset()));
if (guide.orientation() == Guide::Orientation::Vertical)
TRY(json_guide.add("offset"sv, (double)guide->offset()));
if (guide->orientation() == Guide::Orientation::Vertical)
TRY(json_guide.add("orientation"sv, "vertical"));
else if (guide.orientation() == Guide::Orientation::Horizontal)
else if (guide->orientation() == Guide::Orientation::Horizontal)
TRY(json_guide.add("orientation"sv, "horizontal"));
TRY(json_guide.finish());
}