Skip to content

Commit

Permalink
updated structure LineInfo for more effective CSV hanling
Browse files Browse the repository at this point in the history
daddel80 committed Jan 26, 2025
1 parent 48ed323 commit 580b629
Showing 4 changed files with 211 additions and 160 deletions.
342 changes: 196 additions & 146 deletions src/MultiReplacePanel.cpp

Large diffs are not rendered by default.

27 changes: 13 additions & 14 deletions src/MultiReplacePanel.h
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
#include "PluginInterface.h"
#include "DropTarget.h"
#include "DPIManager.h"
#include "FenwickTree.h"

#include <string>
#include <vector>
@@ -142,23 +143,25 @@ struct ColumnDelimiterData {
}
};

struct DelimiterPosition {
LRESULT position;
};

struct ColumnValue {
bool isNumeric;
double numericValue;
std::string text;
bool isNumeric = false;
double numericValue = 0;
std::string text = "";
};

struct CombinedColumns {
std::vector<ColumnValue> columns;
};

struct DelimiterPosition {
LRESULT offsetInLine = 0; // where the delimiter is within this line
};

struct LineInfo {
std::vector<DelimiterPosition> positions;
LRESULT startPosition = 0;
LRESULT endPosition = 0;
LRESULT lineLength = 0; // how many chars total in this line
size_t lineIndex = 0; // which line it is (for Fenwicksum queries)
};

struct ColumnInfo {
@@ -592,11 +595,7 @@ class MultiReplace : public StaticDialog
void removeItemsFromReplaceList(const std::vector<size_t>& indicesToRemove);
void modifyItemInReplaceList(size_t index, const ReplaceItemData& newData);
bool moveItemsInReplaceList(std::vector<size_t>& indices, Direction direction);
void sortItemsInReplaceList(const std::vector<size_t>& originalOrder,
const std::vector<size_t>& newOrder,
const std::map<int, SortDirection>& previousColumnSortOrder,
int columnID,
SortDirection direction);
void sortItemsInReplaceList(const std::vector<size_t>& originalOrder, const std::vector<size_t>& newOrder, const std::map<int, SortDirection>& previousColumnSortOrder, int columnID, SortDirection direction);
void scrollToIndices(size_t firstIndex, size_t lastIndex);

//ListView
@@ -716,7 +715,7 @@ class MultiReplace : public StaticDialog
ColumnInfo getColumnInfo(LRESULT startPosition);
void initializeColumnStyles();
void handleHighlightColumnsInDocument();
void highlightColumnsInLine(LRESULT line);
void highlightColumnsInLine(LRESULT line, LRESULT totalLines);
void handleClearColumnMarks();
std::wstring addLineAndColumnMessage(LRESULT pos);
void updateDelimitersInDocument(SIZE_T lineNumber, ChangeType changeType);
1 change: 1 addition & 0 deletions vs.proj/MultiReplace.vcxproj
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@
<ItemGroup>
<ClCompile Include="..\src\DPIManager.cpp" />
<ClCompile Include="..\src\DropTarget.cpp" />
<ClCompile Include="..\src\FenwickTree.cpp" />
<ClCompile Include="..\src\language_mapping.cpp" />
<ClCompile Include="..\src\lua\lapi.c">
<AdditionalOptions>/w %(AdditionalOptions)</AdditionalOptions>
1 change: 1 addition & 0 deletions vs.proj/MultiReplace.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -111,6 +111,7 @@
<ClCompile Include="..\src\language_mapping.cpp" />
<ClCompile Include="..\src\DropTarget.cpp" />
<ClCompile Include="..\src\DPIManager.cpp" />
<ClCompile Include="..\src\FenwickTree.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\AboutDialog.h" />

0 comments on commit 580b629

Please sign in to comment.