Skip to content

Commit

Permalink
Default axis translation parameters are not filled #459
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Laurendeau committed Jun 27, 2017
1 parent 5c5cc9a commit c341ba4
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 52 deletions.
114 changes: 64 additions & 50 deletions config/gimx-config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,7 @@ configFrame::configFrame(wxString file,wxWindow* parent, wxWindowID id __attribu
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&configFrame::OnButtonModifyButton);
Connect(ID_CHOICE7,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&configFrame::OnEventTypeSelectPanelAxis);
Connect(ID_BUTTON9,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&configFrame::OnAxisTabAutoDetectClick);
Connect(ID_CHOICE8,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&configFrame::OnAxisTabAxisIdSelect);
Connect(ID_TEXTCTRL8,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&configFrame::OnTextCtrl);
Connect(ID_TEXTCTRL9,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&configFrame::OnTextCtrl);
Connect(ID_TEXTCTRL10,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&configFrame::OnTextCtrl);
Expand Down Expand Up @@ -2181,56 +2182,8 @@ void configFrame::OnAxisTabAutoDetectClick(wxCommandEvent& event __attribute__((

auto_detect(AxisTabDeviceType, &axisTabDeviceName, AxisTabDeviceName, AxisTabDeviceId, eventType, AxisTabEventId);

if(eventType == _("button"))
{
AxisTabDeadZone->Disable();
AxisTabDeadZone->SetValue(wxEmptyString);
AxisTabSensitivity->Disable();
AxisTabSensitivity->SetValue(wxEmptyString);
AxisTabAcceleration->Disable();
AxisTabAcceleration->SetValue(wxEmptyString);
AxisTabShape->Disable();
AxisTabShape->SetSelection(0);
fillButtonAxisChoice();
}
else
{
AxisTabDeadZone->Enable();
AxisTabSensitivity->Enable();
AxisTabAcceleration->Enable();
if(AxisTabDeviceType->GetLabel() == _("mouse"))
{
AxisTabShape->Enable();
AxisTabShape->SetSelection(1);
AxisTabDeadZone->SetValue(wxT("20"));
if(AxisTabEventId->GetLabel() == wxT("x"))
{
AxisTabSensitivity->SetValue(wxT("8.00"));
}
else
{
AxisTabSensitivity->SetValue(wxT("12.00"));
}
AxisTabAcceleration->SetValue(wxT("0.50"));
MyUrlMessage(this, _("Use the calibration tool to adjust the parameters."), wxT("https://gimx.fr/wiki/index.php?title=Mouse_Calibration"));
}
else if(AxisTabDeviceType->GetLabel() == _("joystick"))
{
AxisTabShape->Disable();
AxisTabShape->SetSelection(0);
AxisTabDeadZone->SetValue(wxT("0"));
AxisTabAcceleration->SetValue(wxT("1.00"));
if(!AxisTabAxisId->GetStringSelection().Contains(wxT("stick")))
{
AxisTabSensitivity->SetValue(wxT("0.008"));
}
else
{
AxisTabSensitivity->SetValue(wxT("0.0039"));
}
}
fillAxisAxisChoice();
}
wxCommandEvent nullEvent;
OnAxisTabAxisIdSelect(nullEvent);

refresh_gui();

Expand Down Expand Up @@ -4550,3 +4503,64 @@ void configFrame::OnButtonFFBTweaksDelete(wxCommandEvent& event __attribute__((u
refresh_gui();
}


void configFrame::OnAxisTabAxisIdSelect(wxCommandEvent& event __attribute__((unused)))
{
if (AxisTabAxisId->GetStringSelection().IsEmpty())
{
return;
}

if(AxisTabEventType->GetStringSelection() == _("button"))
{
AxisTabDeadZone->Disable();
AxisTabDeadZone->SetValue(wxEmptyString);
AxisTabSensitivity->Disable();
AxisTabSensitivity->SetValue(wxEmptyString);
AxisTabAcceleration->Disable();
AxisTabAcceleration->SetValue(wxEmptyString);
AxisTabShape->Disable();
AxisTabShape->SetSelection(0);
}
else
{
if(AxisTabDeviceType->GetLabel() == _("mouse"))
{
AxisTabDeadZone->Enable();
AxisTabDeadZone->SetValue(wxT("20"));
AxisTabSensitivity->Enable();
if(AxisTabEventId->GetLabel() == wxT("x"))
{
AxisTabSensitivity->SetValue(wxT("8.00"));
}
else
{
AxisTabSensitivity->SetValue(wxT("12.00"));
}
AxisTabAcceleration->Enable();
AxisTabAcceleration->SetValue(wxT("0.50"));
AxisTabShape->Enable();
AxisTabShape->SetSelection(1);
MyUrlMessage(this, _("Use the calibration tool to adjust the parameters."), wxT("https://gimx.fr/wiki/index.php?title=Mouse_Calibration"));
}
else if(AxisTabDeviceType->GetLabel() == _("joystick"))
{
AxisTabDeadZone->Enable();
AxisTabDeadZone->SetValue(wxT("0"));
AxisTabSensitivity->Enable();
if(AxisTabAxisId->GetStringSelection().Contains(wxT("stick"))
|| AxisTabAxisId->GetStringSelection() == wxT("wheel"))
{
AxisTabSensitivity->SetValue(wxT("0.0039"));
}
else
{
AxisTabSensitivity->SetValue(wxT("0.008"));
}
AxisTabAcceleration->Enable();
AxisTabAcceleration->SetValue(wxT("1.00"));
AxisTabShape->Disable();
AxisTabShape->SetSelection(0);
}
}
}
3 changes: 1 addition & 2 deletions config/gimx-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class configFrame: public wxFrame
void OnButtonAddPanelButton(wxCommandEvent& event);
void OnEventTypeSelectPanelAxis(wxCommandEvent& event);
void OnAxisTabBufferSizeText(wxCommandEvent& event);
void OnAxisTabAxisIdSelect(wxCommandEvent& event);
void OnButtonAddPanelAxis(wxCommandEvent& event);
void OnButtonRemovePanelButton(wxCommandEvent& event);
void OnButtonRemovePanelAxis(wxCommandEvent& event);
Expand All @@ -73,7 +72,6 @@ class configFrame: public wxFrame
void OnButtonModifyButton(wxCommandEvent& event);
void OnButtonModifyAxis(wxCommandEvent& event);
void OnAxisTabShapeSelect(wxCommandEvent& event);
void OnAxisTabAxisIdSelect1(wxCommandEvent& event);
void OnMenuItemCopyConfiguration(wxCommandEvent& event);
void OnMenuItemPasteConfiguration(wxCommandEvent& event);
void OnMenuItemCopyController(wxCommandEvent& event);
Expand Down Expand Up @@ -111,6 +109,7 @@ class configFrame: public wxFrame
void OnJoystickCorrectionsAutoDetectClick(wxCommandEvent& event);
void OnButtonForceFeedbackAutoDetect(wxCommandEvent& event);
void OnButtonFFBTweaksDelete(wxCommandEvent& event);
void OnAxisTabAxisIdSelect(wxCommandEvent& event);
//*)
void DeleteSelectedRows(wxGrid* grid);
void DeleteLinkedRows(wxGrid* grid, int row);
Expand Down
1 change: 1 addition & 0 deletions config/wxsmith/configframe.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,7 @@
<object class="sizeritem">
<object class="wxChoice" name="ID_CHOICE8" variable="AxisTabAxisId" member="yes">
<selection>0</selection>
<handler function="OnAxisTabAxisIdSelect" entry="EVT_CHOICE" />
</object>
<flag>wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
<border>5</border>
Expand Down

0 comments on commit c341ba4

Please sign in to comment.