From 6bb536c3e2f509be4ea5d1f743785be3cfd60704 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 28 Jun 2016 22:54:53 +0100 Subject: [PATCH] Added OutputText function --- source/common/textprocessing.cpp | 40 ++++++++++++++++++++++++++++++++ source/common/textprocessing.h | 2 ++ 2 files changed, 42 insertions(+) diff --git a/source/common/textprocessing.cpp b/source/common/textprocessing.cpp index 9d6c8ff..b73252d 100644 --- a/source/common/textprocessing.cpp +++ b/source/common/textprocessing.cpp @@ -177,4 +177,44 @@ bool MapDataExists(int *ItemIndex, std::map *MapPtr){ } +} + +wxString OutputText(wxString *TextInput){ + + wxString OutputTextData; + wxString OutputLine; + int CharSeek = 0; + int LineSeek = 0; + int MaxLineSeek = 77; + + for (CharSeek = 0; CharSeek < TextInput->size(); CharSeek++){ + + LineSeek++; + + if (LineSeek == MaxLineSeek){ + + if (TextInput->substr(CharSeek, 1) != "\n"){ + OutputLine += TextInput->substr(CharSeek, 1); + } + OutputLine += "\n"; + OutputTextData += OutputLine; + OutputLine = " "; + LineSeek = 0; + MaxLineSeek = 76; + continue; + + } + + OutputLine += TextInput->substr(CharSeek, 1); + + } + + if (OutputLine != " "){ + + OutputTextData += OutputLine; + + } + + return OutputTextData; + } \ No newline at end of file diff --git a/source/common/textprocessing.h b/source/common/textprocessing.h index 7a63ea0..97ea9a1 100644 --- a/source/common/textprocessing.h +++ b/source/common/textprocessing.h @@ -39,6 +39,8 @@ void DeleteMapDataProcess(int IndexNum, std::map* MapData); bool MapDataExists(int *ItemIndex, std::map *MapPtr); bool MapDataExists(int *ItemIndex, std::map *MapPtr); +wxString OutputText(wxString *TextInput); + //void DeleteMapDataB() {}; //void DeleteMapData() {}; -- 2.39.5