MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / AddToLastOpenDocs

Function AddToLastOpenDocs

sourcecommon/utils.cpp:976–1025  ·  view source on GitHub ↗

--------------------------------------------------------------------------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- ������������ ���������� "������" ����, ��������� � ����

Source from the content-addressed store, hash-verified

974//---------------------------------------------------------------------------
975// ������������ ���������� "������" ����, ��������� � ����
976void AddToLastOpenDocs(char * szIniFile, char * szDocFile)
977{
978 if( !szDocFile ) return;
979 if( lstrlen(szDocFile)<=0 ) return;
980 //
981 TMYIniFile * p = NULL;
982 try
983 {
984 p = new TMYIniFile(szIniFile);
985 char Section[] = "LASTDOCS";
986 char str[20];
987 //
988 AnsiString ld[MAX_LAST_OPEN_DOCS];
989 ld[0] = szDocFile;
990
991 // ��������� ��� ����� ������ � 1 �� 9 (10-�� ������)
992 for(int i=0; i<MAX_LAST_OPEN_DOCS-1; i++)
993 {
994 wsprintf(str, "%u", i+1);
995 ld[i+1] = p->ReadString(Section, str);
996 }
997
998 int index = 1; // ����� ������
999 for(int i=0; i<MAX_LAST_OPEN_DOCS; i++)
1000 {
1001 // ������ ������������� ����� ������...
1002 bool b = false;
1003 for(int j=0; j<i; j++)
1004 {
1005 // ����� ld[i] ��� ��� ? - �������� � ����������
1006 if( MySameText(ld[j],ld[i]) ) { b=true; break; }
1007 }
1008 if( b ) continue;
1009 //
1010 wsprintf(str, "%u", index);
1011 p->WriteString(Section, str, ld[i].c_str());
1012 index++;
1013 }
1014
1015 // ������� ������� ��������
1016 for(int i=index; i<MAX_LAST_OPEN_DOCS; i++)
1017 {
1018 wsprintf(str, "%u", index);
1019 p->WriteString(Section, str, "");
1020 index++;
1021 }
1022 }
1023 catch(...) {}
1024 delete p;
1025}
1026//---------------------------------------------------------------------------
1027void AddLastOpenDocsToMenu(char * szIniFile, TMenuItem ** mi)
1028{

Callers

nothing calls this directly

Calls 3

MySameTextFunction · 0.85
ReadStringMethod · 0.45
WriteStringMethod · 0.45

Tested by

no test coverage detected