Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Crash caused by wavelength controls #118

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions programs/us_edit/us_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10561,17 +10561,49 @@ DbgLv(1) << "ldelta_value value" << value;
// Lambda Start has changed
void US_Edit::lambda_start_value( int value )
{
slambda = cb_lstart->itemText( value ).toInt();
DbgLv(1) << "lambda_start_value value" << value << slambda;
int new_slambda = cb_lstart->itemText( value ).toInt();
if ( new_slambda == slambda ) // check if new start is same as current start -> skip every update
{
return;
}
else if ( new_slambda > elambda ) // check if new start is greater than end
{
// if so, set start to end
slambda = elambda;
elambda = new_slambda;
cb_lstart->setCurrentIndex( cb_lstart->findText( QString::number( slambda ) ) );
cb_lend ->setCurrentIndex( cb_lend ->findText( QString::number( elambda ) ) );
}
else
{
slambda = cb_lstart->itemText( value ).toInt();
}
DbgLv(1) << "lambda_start_value value" << value << slambda;

reset_plot_lambdas();
}

// Lambda End has changed
void US_Edit::lambda_end_value( int value )
{
elambda = cb_lend ->itemText( value ).toInt();
DbgLv(1) << "lambda_end_value value" << value << elambda;
int new_elambda = cb_lend->itemText( value ).toInt();
if ( new_elambda == elambda ) // check if new end is same as current end -> skip every update
{
return;
}
else if ( new_elambda < slambda ) // check if new end is less than start
{
// if so, set end to start
elambda = slambda;
slambda = new_elambda;
cb_lstart->setCurrentIndex( cb_lstart->findText( QString::number( slambda ) ) );
cb_lend ->setCurrentIndex( cb_lend ->findText( QString::number( elambda ) ) );
}
else
{
elambda = cb_lend ->itemText( value ).toInt();
}
DbgLv(1) << "lambda_end_value value" << value << elambda;

reset_plot_lambdas();
}
Expand Down
Loading