When using exact time codes, use those for all msec<>frames conversions to prevent rounding errors before snapping to exact time codes (namely for variable framerates)
Also added custom array functions that should be much faster than LINQ (used where possible) (+ tests)
The method used for width calculation in FixShortLinesPixelWidth form is simplified. The method _calcPixelWidth returns int directly, eliminating redundant conversion from int to int. This simplifies the code, and eliminates unnecessary operations improving the processing speed.
The pixel width calculation for FixShortLinesPixelWidth has been directly incorporated into the constructor for FixShortLinesPixelWidth, replacing the previously used GetCustomCallbackData method. This change simplifies the process significantly by making the pixel width calculation a direct responsibility of the FixShortLinesPixelWidth class, and removing the associated logic from FixCommonErrors class and its interface reducing potential side effects. In addition, the test FixCommonErrorsTest has been updated to reflect these changes.
This commit refactors the process of removing extra spaces in Utilities.cs for improved code efficiency and readability. Instead of using a loop to remove consecutive spaces, a new method `FixExtraSpaces()` is now used. This method is more clear and efficient. Additionally, the process of replacing tags with a single whitespace has been simplified by using a constant `singleWhiteSpace`. This not only improves readability but also ensures a uniform definition of single whitespace replacement throughout the code.
Existing mouse event handling was simplified by removing unnecessary nested if clause in NikseComboBox.cs. The change streamlines the code and improves readability without changing functionality.
The condition of null-checking before removing the existing list view and invalidating the form has been updated. This has been done in order to avoid potential null reference exceptions. This change adds an extra layer of null-safety by storing the result of `FindForm()` in a variable and then checking if the form is not null before making the subsequent operations on the form.
The update restructures the mouse click event handler in the NikseComboBox control. Prior to this change, the logic was unnecessarily nested within an 'if' statement checking if the event arguments were of 'MouseEventArgs'. In this commit, we handle any null mouseArgs upfront and exit if the argument is null. This reduces the code complexity, improves readability and prevents potential null reference exceptions.
The loop in the NikseComboBox.cs file was restructured to cache the '_listView.Items.Count' before entering the loop. This change was made to reduce unnecessary '_listView.Items.Count' calls in each iteration, thereby optimizing the performance. Running the count operation only once will improve efficiency when dealing with large lists.
This change extracts the logic for initializing the listView control in NikseComboBox into a separate method called EnsureListViewInitialized(). This helps improve code readability, and maintainability by providing a clear separation of concerns. The ListView control initialization is now concentrated in one place, thus making future changes easier to implement and concerns easier to identify.
The number of items in the ListView (_listView.Items.Count) was being recalculated in every iteration of the loop. This could potentially slow down the application if the ListView had a large number of items. Moved the calculation outside the loop to improve performance.