Skip to content

Commit

Permalink
changes to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalis95 committed Dec 13, 2024
1 parent f9405df commit 309931d
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions instat/dlgName.vb
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,8 @@ Public Class dlgName
RemoveParameters()
DialogueSize()
RemovePattern()
AddTypeParm()
AddRegexPar()
ConfigureTypeParameter()
ConfigurePatternParameter()
SetRegexControlVisibility()
End Sub

Expand Down Expand Up @@ -687,10 +687,6 @@ Public Class dlgName
End If
End Sub

Private Function IsRegexApplicable() As Boolean
Return (ucrInputEdit.GetText = "Matches All" OrElse ucrInputEdit.GetText = "Matches")
End Function

Private Sub RemovePattern()
If rdoWholeDataFrame.Checked Then
If (rdoRenameWith.Checked OrElse rdoLabels.Checked) AndAlso rdoReplace.Checked Then
Expand Down Expand Up @@ -726,10 +722,11 @@ Public Class dlgName
End If
End Sub

Private Sub AddRegexPar()
Private Sub ConfigurePatternParameter()
If rdoWholeDataFrame.Checked AndAlso (rdoRenameWith.Checked OrElse rdoLabels.Checked) AndAlso rdoReplace.Checked Then
Dim patternValue As String = Chr(34) & ucrInputReplace.GetText & Chr(34)
If ucrChkIncludeRegularExpressions.Checked AndAlso IsRegexApplicable() Then
If ucrChkIncludeRegularExpressions.Checked AndAlso (ucrInputEdit.GetText = "Matches All" OrElse ucrInputEdit.GetText = "Matches") Then

clsRegexFunction.AddParameter("pattern", patternValue, bIncludeArgumentName:=False, iPosition:=1)
clsDefaultRFunction.AddParameter("pattern", clsRFunctionParameter:=clsRegexFunction, bIncludeArgumentName:=False, iPosition:=4)
Else
Expand All @@ -746,7 +743,7 @@ Public Class dlgName
End If
End Sub

Private Sub AddTypeParm()
Private Sub ConfigureTypeParameter()
If rdoLabels.Checked Then
clsDefaultRFunction.AddParameter("type", Chr(34) & "rename_labels" & Chr(34), iPosition:=1)

Expand All @@ -764,8 +761,8 @@ Public Class dlgName

Private Sub ucrInputEdit_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputEdit.ControlValueChanged, ucrInputBy.ControlValueChanged, ucrInputReplace.ControlValueChanged
RemovePattern()
AddTypeParm()
AddRegexPar()
ConfigureTypeParameter()
ConfigurePatternParameter()
SetRegexControlVisibility()
End Sub

Expand All @@ -776,23 +773,21 @@ Public Class dlgName

Private Sub ucrChkIncludeRegularExpressions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkIncludeRegularExpressions.ControlValueChanged
RemovePattern()
AddRegexPar()
ConfigurePatternParameter()
SetRegexControlVisibility()
End Sub

Private Sub SetRegexControlVisibility()
ucrChkIncludeRegularExpressions.Visible = False
cmdAddkeyboard.Visible = False

If rdoWholeDataFrame.Checked Then
If (rdoRenameWith.Checked OrElse rdoLabels.Checked) AndAlso rdoReplace.Checked Then
Select Case ucrInputEdit.GetText
Case "Matches All", "Matches"
cmdAddkeyboard.Visible = If(ucrChkIncludeRegularExpressions.Checked, True, False)
ucrChkIncludeRegularExpressions.Visible = True
End Select
End If
If rdoWholeDataFrame.Checked AndAlso
(rdoRenameWith.Checked OrElse rdoLabels.Checked) AndAlso
rdoReplace.Checked AndAlso
(ucrInputEdit.GetText = "Matches All" OrElse ucrInputEdit.GetText = "Matches") Then

ucrChkIncludeRegularExpressions.Visible = True
cmdAddkeyboard.Visible = ucrChkIncludeRegularExpressions.Checked
End If
End Sub

End Class

0 comments on commit 309931d

Please sign in to comment.