Skip to content

Commit

Permalink
Merge pull request #118 from doluk/us_edit_issue306
Browse files Browse the repository at this point in the history
Fix: Crash caused by wavelength controls
  • Loading branch information
ehb54 authored Jun 20, 2024
2 parents f58ba4c + 96620af commit 7b2d4c4
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions programs/us_edit/us_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10576,17 +10576,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

0 comments on commit 7b2d4c4

Please sign in to comment.