Skip to content

Commit

Permalink
2018093001
Browse files Browse the repository at this point in the history
  • Loading branch information
oormicreations committed Sep 29, 2018
1 parent 12029ef commit ebf07af
Show file tree
Hide file tree
Showing 40 changed files with 58 additions and 98 deletions.
2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/Arabic.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,Arabic
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\Arabic
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\ArabicDict.txt

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/Biology.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,Biology
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\Biology
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\Default\DefaultDict.txt

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/Business.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,Business
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\Business
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\Default\DefaultDict.txt

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/Chinese.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,Chinese
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\Chinese
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\ChineseDict.txt

This file was deleted.

This file was deleted.

This file was deleted.

29 changes: 0 additions & 29 deletions PredictEd User Folder/Contexts/Default/PredictEd_STM_Backup.txt

This file was deleted.

2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/French.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,French
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\French
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\Default\DefaultDict.txt

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/German.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,German
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\German
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\GermanDict.txt

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/Marathi.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,Marathi
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\Marathi
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\MarathiDict.txt

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/Philosophy.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,Philosophy
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\Philosophy
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\Default\DefaultDict.txt

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/Physics.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,Physics
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\Physics
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\Default\DefaultDict.txt

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/Psychology.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,Psychology
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\Psychology
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\Default\DefaultDict.txt

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion PredictEd User Folder/Contexts/Russian.context
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PredictEd Context File Version,11
Context Name,Russian
Knowledge Dir,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Contexts\Russian
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\HI-IN\hi-in2.txt
Dictionary File,C:\Users\Sanjeev\Documents\Oormi Creations\PredictEd 1.1.0\Dictionary\RussianDict.txt

This file was deleted.

This file was deleted.

38 changes: 19 additions & 19 deletions PredictEd/PredictEdContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ BOOL CPredictEdContext::LoadContext()

//ver check
CString sValue = GetValue(sLine[0], PREDICTED_CONTEXT_KEY1);
if (sValue != _T("11"))
if (!((sValue == _T("11")) || (sValue == _T("1"))))
{
AfxMessageBox(_T("Error: This context file belongs to a different version."), MB_ICONERROR);
return FALSE;
Expand All @@ -71,7 +71,7 @@ BOOL CPredictEdContext::LoadContext()
if (sValue.IsEmpty())
{
AfxMessageBox(_T("Error: This context has no name, assuming a temp name."), MB_ICONERROR);
m_sContextName = _T("Untitled Context");
m_sContextName = _T("UntitledContext");
}
else m_sContextName = sValue;

Expand All @@ -83,16 +83,16 @@ BOOL CPredictEdContext::LoadContext()
return FALSE;
}

if (sValue == _T("Default"))
{
//if (sValue == _T("Default"))
//{
m_sLTMFile = m_sContextRootDir + _T("\\") + sValue + _T("\\") + PREDICTED_LTM_FILE_NAME;
m_sSTMFile = m_sContextRootDir + _T("\\") + sValue + _T("\\") + PREDICTED_STM_FILE_NAME;
}
else
{
m_sLTMFile = sValue + _T("\\") + PREDICTED_LTM_FILE_NAME;
m_sSTMFile = sValue + _T("\\") + PREDICTED_STM_FILE_NAME;
}
//}
//else
//{
// m_sLTMFile = sValue + _T("\\") + PREDICTED_LTM_FILE_NAME;
// m_sSTMFile = sValue + _T("\\") + PREDICTED_STM_FILE_NAME;
//}

//dictionary file
sValue = GetValue(sLine[3], PREDICTED_CONTEXT_KEY4);
Expand All @@ -102,11 +102,11 @@ BOOL CPredictEdContext::LoadContext()
return FALSE;
}

if (sValue == _T("DefaultDict.txt"))
{
m_sDictionary = m_SysHelper.GetUserDocumentPath(PREDICTED_USER_FOLDER) + _T("\\") + PREDICTED_DIC_DIR_NAME + _T("\\Default\\")+ sValue;
}
else m_sDictionary = sValue;
//if (sValue == _T("DefaultDict.txt"))
//{
m_sDictionary = m_SysHelper.GetUserDocumentPath(PREDICTED_USER_FOLDER) + _T("\\") + PREDICTED_DIC_DIR_NAME + _T("\\")+ sValue;
//}
//else m_sDictionary = sValue;

m_sContextDir = m_sContextRootDir + _T("\\") + m_sContextName;

Expand Down Expand Up @@ -144,8 +144,8 @@ BOOL CPredictEdContext::CreateContext()
CString sContextInfo
= PREDICTED_CONTEXT_KEY1 + m_sVersion + _T("\r\n")
+ PREDICTED_CONTEXT_KEY2 + m_sContextName + _T("\r\n")
+ PREDICTED_CONTEXT_KEY3 + m_sContextDir + _T("\r\n")
+ PREDICTED_CONTEXT_KEY4 + m_sDictionary
+ PREDICTED_CONTEXT_KEY3 + m_sContextName + _T("\r\n")
+ PREDICTED_CONTEXT_KEY4 + m_SysHelper.GetFileNameFromPath(m_sDictionary)
;

if (!m_SysHelper.SaveString(m_sContextFile, sContextInfo))
Expand Down Expand Up @@ -241,8 +241,8 @@ BOOL CPredictEdContext::UpdateContext()
CString sContextInfo
= PREDICTED_CONTEXT_KEY1 + m_sVersion + _T("\r\n")
+ PREDICTED_CONTEXT_KEY2 + m_sContextName + _T("\r\n")
+ PREDICTED_CONTEXT_KEY3 + m_sContextDir + _T("\r\n")
+ PREDICTED_CONTEXT_KEY4 + m_sDictionary
+ PREDICTED_CONTEXT_KEY3 + m_sContextName + _T("\r\n")
+ PREDICTED_CONTEXT_KEY4 + m_SysHelper.GetFileNameFromPath(m_sDictionary)
;

if (!m_SysHelper.SaveString(m_sContextFile, sContextInfo))
Expand Down
10 changes: 8 additions & 2 deletions PredictEd/PredictEdDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ void CPredictEdDlg::OnFileOpen32771()
m_Ed.SetScrollPos(SB_VERT, 0);
m_Ed.SetCaretPos(CPoint(0, 0));
m_Ed.SetSel(0, 0);

m_ShellOpenFileName.Empty();
}


Expand Down Expand Up @@ -1151,8 +1153,9 @@ void CPredictEdDlg::OnEditSpellingcheck()

if (!spelldlg.LoadDictionary())
{
AfxMessageBox(_T("Error reading the Dictionary file."), MB_ICONERROR);
return;
AfxMessageBox(_T("Error reading the Dictionary file.\r\nPlease set the Dictionary File by clicking the Dictionary button before spell check."), MB_ICONERROR);
spelldlg.m_DicFile.Empty();
//return;
}

m_Ed.GetWindowText(spelldlg.m_Content);
Expand Down Expand Up @@ -1225,6 +1228,9 @@ void CPredictEdDlg::OnContextsLoadcontext()
m_Ed.m_STMFileName = m_Context.m_sSTMFile;

ShowMessage();

m_Ed.SetSel(0, 0);

}
else
{
Expand Down
25 changes: 13 additions & 12 deletions PredictEd/SpellCheckDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,23 +296,24 @@ void CSpellCheckDlg::OnBnClickedCancel()

BOOL CSpellCheckDlg::UpdateDictionary()
{
CString dicfilename = m_SysHelper.GetPredictEdFileName(PREDICTED_DIC_FILE);
if (dicfilename.IsEmpty()) return FALSE;
if (m_AddedDicWords.GetCount() > 0)
{
CStdioFile dfile;
if (!dfile.Open(m_DicFile, CStdioFile::modeWrite)) return FALSE;

CStdioFile dfile;
if (!dfile.Open(dicfilename, CStdioFile::modeWrite)) return FALSE;
dfile.SeekToEnd();

dfile.SeekToEnd();
CString line;
for (int n = 0; n < m_AddedDicWords.GetCount(); n++)
{
line = m_AddedDicWords.GetAt(n);
dfile.WriteString(_T("\n"));
dfile.WriteString(line);
}

CString line;
for (int n = 0; n < m_AddedDicWords.GetCount(); n++)
{
line = m_AddedDicWords.GetAt(n);
dfile.WriteString(_T("\n"));
dfile.WriteString(line);
dfile.Close();
}

dfile.Close();
return TRUE;
}

Expand Down
7 changes: 6 additions & 1 deletion PredictEd/SysHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ CString CSysHelper::ReadStringFromFile(CString filename)

if (file.Open(filename, CFile::modeRead))
{
int len = file.GetLength();
ULONG len = file.GetLength();
if (len > 500000000)//500MB
{
AfxMessageBox(_T("Warning: File is too big for this program to handle. Your may get out of memory errors!"));
}

char * buf = new char[len + 1];

file.Read(buf, len);
Expand Down
2 changes: 1 addition & 1 deletion PredictEd/Train.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ UINT TrainDataProc(LPVOID param)

if (!content.IsEmpty())
{
UINT len = content.GetLength();
ULONG len = content.GetLength();
CString word, lastword;

for (UINT np = 0; np < len; np++)
Expand Down

0 comments on commit ebf07af

Please sign in to comment.