1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:07:45 +00:00

LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize

This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
This commit is contained in:
Andreas Kling 2020-06-10 10:57:59 +02:00
parent 656b01eb0f
commit 116cf92156
212 changed files with 1144 additions and 1144 deletions

View file

@ -153,7 +153,7 @@ void CursorTool::on_keydown(GUI::KeyEvent& event)
}
}
void CursorTool::set_rubber_band_position(const Gfx::Point& position)
void CursorTool::set_rubber_band_position(const Gfx::IntPoint& position)
{
if (m_rubber_band_position == position)
return;
@ -171,11 +171,11 @@ void CursorTool::set_rubber_band_position(const Gfx::Point& position)
m_editor.form_widget().update();
}
Gfx::Rect CursorTool::rubber_band_rect() const
Gfx::IntRect CursorTool::rubber_band_rect() const
{
if (!m_rubber_banding)
return {};
return Gfx::Rect::from_two_points(m_rubber_band_origin, m_rubber_band_position);
return Gfx::IntRect::from_two_points(m_rubber_band_origin, m_rubber_band_position);
}
void CursorTool::on_second_paint(GUI::Painter& painter, GUI::PaintEvent&)

View file

@ -47,14 +47,14 @@ private:
virtual void on_keydown(GUI::KeyEvent&) override;
virtual void on_second_paint(GUI::Painter&, GUI::PaintEvent&) override;
void set_rubber_band_position(const Gfx::Point&);
Gfx::Rect rubber_band_rect() const;
void set_rubber_band_position(const Gfx::IntPoint&);
Gfx::IntRect rubber_band_rect() const;
Gfx::Point m_drag_origin;
HashMap<GUI::Widget*, Gfx::Point> m_positions_before_drag;
Gfx::IntPoint m_drag_origin;
HashMap<GUI::Widget*, Gfx::IntPoint> m_positions_before_drag;
bool m_dragging { false };
bool m_rubber_banding { false };
Gfx::Point m_rubber_band_origin;
Gfx::Point m_rubber_band_position;
Gfx::IntPoint m_rubber_band_origin;
Gfx::IntPoint m_rubber_band_position;
};

View file

@ -80,7 +80,7 @@ void Editor::focusout_event(Core::Event& event)
GUI::TextEditor::focusout_event(event);
}
Gfx::Rect Editor::breakpoint_icon_rect(size_t line_number) const
Gfx::IntRect Editor::breakpoint_icon_rect(size_t line_number) const
{
auto ruler_line_rect = ruler_content_rect(line_number);
@ -140,7 +140,7 @@ static HashMap<String, String>& man_paths()
return paths;
}
void Editor::show_documentation_tooltip_if_available(const String& hovered_token, const Gfx::Point& screen_location)
void Editor::show_documentation_tooltip_if_available(const String& hovered_token, const Gfx::IntPoint& screen_location)
{
auto it = man_paths().find(hovered_token);
if (it == man_paths().end()) {

View file

@ -61,10 +61,10 @@ private:
virtual void enter_event(Core::Event&) override;
virtual void leave_event(Core::Event&) override;
void show_documentation_tooltip_if_available(const String&, const Gfx::Point& screen_location);
void show_documentation_tooltip_if_available(const String&, const Gfx::IntPoint& screen_location);
void navigate_to_include_if_available(String);
Gfx::Rect breakpoint_icon_rect(size_t line_number) const;
Gfx::IntRect breakpoint_icon_rect(size_t line_number) const;
static const Gfx::Bitmap& breakpoint_icon_bitmap();
static const Gfx::Bitmap& current_position_icon_bitmap();

View file

@ -88,7 +88,7 @@ void VBForm::insert_widget(VBWidgetType type)
{
auto* insertion_parent = single_selected_widget();
auto widget = VBWidget::create(type, *this, insertion_parent);
Gfx::Point insertion_position = m_next_insertion_position;
Gfx::IntPoint insertion_position = m_next_insertion_position;
if (insertion_parent)
insertion_position.move_by(insertion_parent->gwidget()->window_relative_rect().location());
widget->set_rect({ insertion_position, { m_grid_size * 10 + 1, m_grid_size * 5 + 1 } });
@ -136,7 +136,7 @@ bool VBForm::is_selected(const VBWidget& widget) const
return m_selected_widgets.contains(const_cast<VBWidget*>(&widget));
}
VBWidget* VBForm::widget_at(const Gfx::Point& position)
VBWidget* VBForm::widget_at(const Gfx::IntPoint& position)
{
auto result = hit_test(position, GUI::Widget::ShouldRespectGreediness::No);
if (!result.widget)
@ -354,7 +354,7 @@ void VBForm::mousemove_event(GUI::MouseEvent& event)
if (widget.is_in_layout())
return;
auto new_rect = widget.transform_origin_rect();
Gfx::Size minimum_size { 5, 5 };
Gfx::IntSize minimum_size { 5, 5 };
new_rect.set_x(new_rect.x() + change_x);
new_rect.set_y(new_rect.y() + change_y);
new_rect.set_width(max(minimum_size.width(), new_rect.width() + change_w));

View file

@ -43,7 +43,7 @@ public:
void set_name(const String& name) { m_name = name; }
bool is_selected(const VBWidget&) const;
VBWidget* widget_at(const Gfx::Point&);
VBWidget* widget_at(const Gfx::IntPoint&);
void set_should_snap_to_grip(bool snap) { m_should_snap_to_grid = snap; }
bool should_snap_to_grid() const { return m_should_snap_to_grid; }
@ -85,8 +85,8 @@ private:
NonnullRefPtrVector<VBWidget> m_widgets;
HashMap<GUI::Widget*, VBWidget*> m_gwidget_map;
HashTable<VBWidget*> m_selected_widgets;
Gfx::Point m_transform_event_origin;
Gfx::Point m_next_insertion_position;
Gfx::IntPoint m_transform_event_origin;
Gfx::IntPoint m_next_insertion_position;
Direction m_resize_direction { Direction::None };
Direction m_mouse_direction_type { Direction::None };
RefPtr<GUI::Menu> m_context_menu;

View file

@ -59,12 +59,12 @@ VBWidget::~VBWidget()
m_gwidget->parent()->remove_child(*m_gwidget);
}
Gfx::Rect VBWidget::rect() const
Gfx::IntRect VBWidget::rect() const
{
return m_gwidget->window_relative_rect();
}
void VBWidget::set_rect(const Gfx::Rect& rect)
void VBWidget::set_rect(const Gfx::IntRect& rect)
{
if (rect == m_gwidget->window_relative_rect())
return;
@ -80,7 +80,7 @@ bool VBWidget::is_selected() const
return m_form.is_selected(*this);
}
Gfx::Rect VBWidget::grabber_rect(Direction direction) const
Gfx::IntRect VBWidget::grabber_rect(Direction direction) const
{
int grabber_size = 5;
int half_grabber_size = grabber_size / 2;
@ -106,7 +106,7 @@ Gfx::Rect VBWidget::grabber_rect(Direction direction) const
}
}
Direction VBWidget::grabber_at(const Gfx::Point& position) const
Direction VBWidget::grabber_at(const Gfx::IntPoint& position) const
{
Direction found_grabber = Direction::None;
for_each_direction([&](Direction direction) {

View file

@ -74,11 +74,11 @@ public:
bool is_selected() const;
Gfx::Rect rect() const;
void set_rect(const Gfx::Rect&);
Gfx::IntRect rect() const;
void set_rect(const Gfx::IntRect&);
Gfx::Rect grabber_rect(Direction) const;
Direction grabber_at(const Gfx::Point&) const;
Gfx::IntRect grabber_rect(Direction) const;
Direction grabber_at(const Gfx::IntPoint&) const;
GUI::Widget* gwidget() { return m_gwidget; }
@ -93,7 +93,7 @@ public:
void property_did_change();
Gfx::Rect transform_origin_rect() const { return m_transform_origin_rect; }
Gfx::IntRect transform_origin_rect() const { return m_transform_origin_rect; }
void capture_transform_origin_rect();
bool is_in_layout() const;
@ -108,5 +108,5 @@ private:
RefPtr<GUI::Widget> m_gwidget;
NonnullOwnPtrVector<VBProperty> m_properties;
NonnullRefPtr<VBWidgetPropertyModel> m_property_model;
Gfx::Rect m_transform_origin_rect;
Gfx::IntRect m_transform_origin_rect;
};