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

Everywhere: Rename left/right-click to primary/secondary

This resolves #10641.
This commit is contained in:
Filiph Sandström 2021-10-27 13:20:27 +02:00 committed by Idan Horowitz
parent a6ccf6659a
commit d6a0726302
79 changed files with 183 additions and 183 deletions

View file

@ -132,7 +132,7 @@ void GLContextWidget::resize_event(GUI::ResizeEvent& event)
void GLContextWidget::mousemove_event(GUI::MouseEvent& event)
{
if (event.buttons() == GUI::MouseButton::Left) {
if (event.buttons() == GUI::MouseButton::Primary) {
int delta_x = m_last_mouse.x() - event.x();
int delta_y = m_last_mouse.y() - event.y();

View file

@ -195,7 +195,7 @@ void GlyphEditorWidget::mousemove_event(GUI::MouseEvent& event)
{
if (!m_is_clicking_valid_cell)
return;
if (!(event.buttons() & (GUI::MouseButton::Left | GUI::MouseButton::Right)))
if (!(event.buttons() & (GUI::MouseButton::Primary | GUI::MouseButton::Secondary)))
return;
if (mode() == Paint)
draw_at_mouse(event);
@ -213,8 +213,8 @@ void GlyphEditorWidget::enter_event(Core::Event&)
void GlyphEditorWidget::draw_at_mouse(const GUI::MouseEvent& event)
{
bool set = event.buttons() & GUI::MouseButton::Left;
bool unset = event.buttons() & GUI::MouseButton::Right;
bool set = event.buttons() & GUI::MouseButton::Primary;
bool unset = event.buttons() & GUI::MouseButton::Secondary;
if (!(set ^ unset))
return;
int x = (event.x() - 1) / m_scale;

View file

@ -93,13 +93,13 @@ private:
}
virtual void mousemove_event(MouseEvent& event) override
{
if (event.buttons() & (GUI::MouseButton::Left | GUI::MouseButton::Right))
if (event.buttons() & (GUI::MouseButton::Primary | GUI::MouseButton::Secondary))
draw_at_mouse(event);
}
void draw_at_mouse(const MouseEvent& event)
{
bool set = event.buttons() & MouseButton::Left;
bool unset = event.buttons() & MouseButton::Right;
bool set = event.buttons() & MouseButton::Primary;
bool unset = event.buttons() & MouseButton::Secondary;
if (!(set ^ unset))
return;
int x = (event.x() - 1) / m_scale;

View file

@ -195,7 +195,7 @@ void HexEditor::set_content_length(int length)
void HexEditor::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left) {
if (event.button() != GUI::MouseButton::Primary) {
return;
}
@ -308,7 +308,7 @@ void HexEditor::mousemove_event(GUI::MouseEvent& event)
void HexEditor::mouseup_event(GUI::MouseEvent& event)
{
if (event.button() == GUI::MouseButton::Left) {
if (event.button() == GUI::MouseButton::Primary) {
if (m_in_drag_select) {
if (m_selection_end < m_selection_start) {
// lets flip these around

View file

@ -184,7 +184,7 @@ void ViewWidget::paint_event(GUI::PaintEvent& event)
void ViewWidget::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
m_click_position = event.position();
m_saved_pan_origin = m_pan_origin;
@ -194,7 +194,7 @@ void ViewWidget::mouseup_event([[maybe_unused]] GUI::MouseEvent& event) { }
void ViewWidget::mousemove_event(GUI::MouseEvent& event)
{
if (!(event.buttons() & GUI::MouseButton::Left))
if (!(event.buttons() & GUI::MouseButton::Primary))
return;
auto delta = event.position() - m_click_position;

View file

@ -270,7 +270,7 @@ int KeysWidget::note_for_event_position(const Gfx::IntPoint& a_point) const
void KeysWidget::mousedown_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
m_mouse_down = true;
@ -283,7 +283,7 @@ void KeysWidget::mousedown_event(GUI::MouseEvent& event)
void KeysWidget::mouseup_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
m_mouse_down = false;

View file

@ -501,18 +501,18 @@ void ImageEditor::layers_did_change()
Color ImageEditor::color_for(GUI::MouseButton button) const
{
if (button == GUI::MouseButton::Left)
if (button == GUI::MouseButton::Primary)
return m_primary_color;
if (button == GUI::MouseButton::Right)
if (button == GUI::MouseButton::Secondary)
return m_secondary_color;
VERIFY_NOT_REACHED();
}
Color ImageEditor::color_for(GUI::MouseEvent const& event) const
{
if (event.buttons() & GUI::MouseButton::Left)
if (event.buttons() & GUI::MouseButton::Primary)
return m_primary_color;
if (event.buttons() & GUI::MouseButton::Right)
if (event.buttons() & GUI::MouseButton::Secondary)
return m_secondary_color;
VERIFY_NOT_REACHED();
}

View file

@ -146,7 +146,7 @@ void LayerListWidget::mousedown_event(GUI::MouseEvent& event)
{
if (!m_image)
return;
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
Gfx::IntPoint translated_event_point = { 0, vertical_scrollbar().value() + event.y() };
@ -201,7 +201,7 @@ void LayerListWidget::mouseup_event(GUI::MouseEvent& event)
{
if (!m_image)
return;
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
if (!m_moving_gadget_index.has_value())
return;

View file

@ -50,9 +50,9 @@ public:
}
}
if (event.button() == GUI::MouseButton::Left)
if (event.button() == GUI::MouseButton::Primary)
m_palette_widget.set_primary_color(m_color);
else if (event.button() == GUI::MouseButton::Right)
else if (event.button() == GUI::MouseButton::Secondary)
m_palette_widget.set_secondary_color(m_color);
}
@ -69,7 +69,7 @@ public:
virtual void mousedown_event(GUI::MouseEvent& event) override
{
if (event.button() != GUI::MouseButton::Left || !on_color_change)
if (event.button() != GUI::MouseButton::Primary || !on_color_change)
return;
auto dialog = GUI::ColorPicker::construct(m_color, window());

View file

@ -32,7 +32,7 @@ void BrushTool::on_mousedown(Layer* layer, MouseEvent& event)
return;
auto& layer_event = event.layer_event();
if (layer_event.button() != GUI::MouseButton::Left && layer_event.button() != GUI::MouseButton::Right)
if (layer_event.button() != GUI::MouseButton::Primary && layer_event.button() != GUI::MouseButton::Secondary)
return;
// Shift+Click draws a line from the last position to current one.
@ -60,7 +60,7 @@ void BrushTool::on_mousemove(Layer* layer, MouseEvent& event)
return;
auto& layer_event = event.layer_event();
if (!(layer_event.buttons() & GUI::MouseButton::Left || layer_event.buttons() & GUI::MouseButton::Right))
if (!(layer_event.buttons() & GUI::MouseButton::Primary || layer_event.buttons() & GUI::MouseButton::Secondary))
return;
draw_line(layer->bitmap(), color_for(layer_event), m_last_position, layer_event.position());

View file

@ -56,7 +56,7 @@ void EllipseTool::on_mousedown(Layer* layer, MouseEvent& event)
return;
auto& layer_event = event.layer_event();
if (layer_event.button() != GUI::MouseButton::Left && layer_event.button() != GUI::MouseButton::Right)
if (layer_event.button() != GUI::MouseButton::Primary && layer_event.button() != GUI::MouseButton::Secondary)
return;
if (m_drawing_button != GUI::MouseButton::None)

View file

@ -56,7 +56,7 @@ void GuideTool::on_mousedown(Layer*, MouseEvent& event)
auto& image_event = event.image_event();
if (image_event.button() != GUI::MouseButton::Left)
if (image_event.button() != GUI::MouseButton::Primary)
return;
m_editor->set_guide_visibility(true);

View file

@ -45,7 +45,7 @@ void LineTool::on_mousedown(Layer* layer, MouseEvent& event)
return;
auto& layer_event = event.layer_event();
if (layer_event.button() != GUI::MouseButton::Left && layer_event.button() != GUI::MouseButton::Right)
if (layer_event.button() != GUI::MouseButton::Primary && layer_event.button() != GUI::MouseButton::Secondary)
return;
if (m_drawing_button != GUI::MouseButton::None)

View file

@ -24,7 +24,7 @@ MoveTool::~MoveTool()
void MoveTool::on_mousedown(Layer* layer, MouseEvent& event)
{
if (event.image_event().button() == GUI::MouseButton::Right && !m_is_panning) {
if (event.image_event().button() == GUI::MouseButton::Secondary && !m_is_panning) {
m_is_panning = true;
m_event_origin = event.raw_event().position();
m_saved_pan_origin = m_editor->pan_origin();
@ -37,7 +37,7 @@ void MoveTool::on_mousedown(Layer* layer, MouseEvent& event)
auto& layer_event = event.layer_event();
auto& image_event = event.image_event();
if (layer_event.button() != GUI::MouseButton::Left)
if (layer_event.button() != GUI::MouseButton::Primary)
return;
if (!layer->rect().contains(layer_event.position()))
return;
@ -70,7 +70,7 @@ void MoveTool::on_mousemove(Layer* layer, MouseEvent& event)
void MoveTool::on_mouseup(Layer* layer, MouseEvent& event)
{
if (event.image_event().button() == GUI::MouseButton::Right && m_is_panning) {
if (event.image_event().button() == GUI::MouseButton::Secondary && m_is_panning) {
m_is_panning = false;
m_editor->set_override_cursor(cursor());
return;
@ -80,7 +80,7 @@ void MoveTool::on_mouseup(Layer* layer, MouseEvent& event)
return;
auto& layer_event = event.layer_event();
if (layer_event.button() != GUI::MouseButton::Left)
if (layer_event.button() != GUI::MouseButton::Primary)
return;
m_layer_being_moved = nullptr;
m_editor->did_complete_action();

View file

@ -38,9 +38,9 @@ void PickerTool::on_mousedown(Layer* layer, MouseEvent& event)
if (!color.alpha())
return;
if (event.layer_event().button() == GUI::MouseButton::Left)
if (event.layer_event().button() == GUI::MouseButton::Primary)
m_editor->set_primary_color(color);
else if (event.layer_event().button() == GUI::MouseButton::Right)
else if (event.layer_event().button() == GUI::MouseButton::Secondary)
m_editor->set_secondary_color(color);
}

View file

@ -29,7 +29,7 @@ RectangleSelectTool::~RectangleSelectTool()
void RectangleSelectTool::on_mousedown(Layer*, MouseEvent& event)
{
auto& image_event = event.image_event();
if (image_event.button() != GUI::MouseButton::Left)
if (image_event.button() != GUI::MouseButton::Primary)
return;
m_selecting = true;
@ -61,7 +61,7 @@ void RectangleSelectTool::on_mousemove(Layer*, MouseEvent& event)
void RectangleSelectTool::on_mouseup(Layer*, MouseEvent& event)
{
auto& image_event = event.image_event();
if (!m_selecting || image_event.button() != GUI::MouseButton::Left)
if (!m_selecting || image_event.button() != GUI::MouseButton::Primary)
return;
m_selecting = false;

View file

@ -59,7 +59,7 @@ void RectangleTool::on_mousedown(Layer* layer, MouseEvent& event)
return;
auto& layer_event = event.layer_event();
if (layer_event.button() != GUI::MouseButton::Left && layer_event.button() != GUI::MouseButton::Right)
if (layer_event.button() != GUI::MouseButton::Primary && layer_event.button() != GUI::MouseButton::Secondary)
return;
if (m_drawing_button != GUI::MouseButton::None)

View file

@ -23,10 +23,10 @@ ZoomTool::~ZoomTool()
void ZoomTool::on_mousedown(Layer*, MouseEvent& event)
{
auto& raw_event = event.raw_event();
if (raw_event.button() != GUI::MouseButton::Left && raw_event.button() != GUI::MouseButton::Right)
if (raw_event.button() != GUI::MouseButton::Primary && raw_event.button() != GUI::MouseButton::Secondary)
return;
auto scale_factor = (raw_event.button() == GUI::MouseButton::Left) ? m_sensitivity : -m_sensitivity;
auto scale_factor = (raw_event.button() == GUI::MouseButton::Primary) ? m_sensitivity : -m_sensitivity;
m_editor->scale_centered_on_position(raw_event.position(), scale_factor);
}

View file

@ -95,7 +95,7 @@ String PlaylistModel::column_name(int column) const
void PlaylistTableView::doubleclick_event(GUI::MouseEvent& event)
{
AbstractView::doubleclick_event(event);
if (event.button() == GUI::Left) {
if (event.button() == GUI::Primary) {
if (on_doubleclick)
on_doubleclick(event.position());
}

View file

@ -299,7 +299,7 @@ void TreeMapWidget::mousedown_event(GUI::MouseEvent& event)
void TreeMapWidget::doubleclick_event(GUI::MouseEvent& event)
{
if (event.button() != GUI::MouseButton::Left)
if (event.button() != GUI::MouseButton::Primary)
return;
const TreeMapNode* node = path_node(m_viewpoint);
if (node && !node_is_leaf(*node)) {

View file

@ -81,7 +81,7 @@ void InfinitelyScrollableTableView::mousemove_event(GUI::MouseEvent& event)
sheet.disable_updates();
ScopeGuard sheet_update_enabler { [&] { sheet.enable_updates(); } };
auto holding_left_button = !!(event.buttons() & GUI::MouseButton::Left);
auto holding_left_button = !!(event.buttons() & GUI::MouseButton::Primary);
if (m_is_dragging_for_copy) {
set_override_cursor(Gfx::StandardCursor::Crosshair);
m_should_intercept_drag = false;