Remove georges4cvs feature

This commit is contained in:
kaetemi 2014-02-03 00:16:35 +01:00
parent f84aab54c0
commit ce88e5836a
20 changed files with 32 additions and 129 deletions

View file

@ -44,7 +44,7 @@ public:
UFormElm& getRootNode (); UFormElm& getRootNode ();
const UFormElm& getRootNode () const; const UFormElm& getRootNode () const;
const std::string &getComment () const; const std::string &getComment () const;
void write (class NLMISC::IStream &stream, bool georges4CVS); void write (class NLMISC::IStream &stream);
void getDependencies (std::set<std::string> &dependencies) const; void getDependencies (std::set<std::string> &dependencies) const;
uint getNumParent () const; uint getNumParent () const;
UForm *getParentForm (uint parent) const; UForm *getParentForm (uint parent) const;
@ -73,7 +73,7 @@ public:
// ** IO functions // ** IO functions
// Set the filename before saving the form // Set the filename before saving the form
void write (xmlDocPtr doc, const char *filename, bool georges4CVS); void write (xmlDocPtr doc, const char *filename);
// ** Parent access // ** Parent access

View file

@ -161,7 +161,7 @@ public:
}; };
// ** IO functions // ** IO functions
void write (xmlDocPtr root, const char *filename, bool georges4CVS); void write (xmlDocPtr root, const char *filename);
// Count parent DFN // Count parent DFN
uint countParentDfn (uint32 round=0) const; uint countParentDfn (uint32 round=0) const;

View file

@ -63,7 +63,7 @@ private:
TTypeMap _MapType; TTypeMap _MapType;
// Map of filename / CRefPtr<CFormDfnCFormDfn> // Map of filename / CRefPtr<CFormDfnCFormDfn>
TFormDfnMap _MapFormDfn; TFormDfnMap _MapFormDfn;
// Map of form / CRefPtr<CForm> // Map of form / CRefPtr<CForm>
TFormMap _MapForm; TFormMap _MapForm;

View file

@ -54,9 +54,6 @@ public:
/// State of the form /// State of the form
TState State; TState State;
/// CVS Revision string
std::string Revision;
/// Comments of the form /// Comments of the form
std::string Comments; std::string Comments;
@ -65,7 +62,7 @@ public:
/// ** IO functions /// ** IO functions
void read (xmlNodePtr root); void read (xmlNodePtr root);
void write (xmlNodePtr node, bool georges4CVS) const; void write (xmlNodePtr node) const;
// Get state string // Get state string
static const char *getStateString (TState state); static const char *getStateString (TState state);

View file

@ -55,7 +55,7 @@ public:
static bool uiCompatible (TType type, TUI ui); static bool uiCompatible (TType type, TUI ui);
// ** IO functions // ** IO functions
void write (xmlDocPtr doc, bool georges4CVS) const; void write (xmlDocPtr doc) const;
// Header // Header
CFileHeader Header; CFileHeader Header;

View file

@ -53,9 +53,8 @@ public:
/** Write the form in a stream. /** Write the form in a stream.
* *
* \param stream is the stream used to write the form * \param stream is the stream used to write the form
* \param georges4CVS should be true if you use Georges with CVS false else
*/ */
virtual void write (NLMISC::IStream &stream, bool georges4CVS) = 0; virtual void write (NLMISC::IStream &stream) = 0;
/** /**
* Access form parents * Access form parents

View file

@ -289,7 +289,7 @@ int main(void)
// and finally save the form out in case we made changes. // and finally save the form out in case we made changes.
// if you're accessing a form read-only (not using set*) you can skip this. // if you're accessing a form read-only (not using set*) you can skip this.
NLMISC::COFile saveSample(sampleConfigFile); NLMISC::COFile saveSample(sampleConfigFile);
form->write(saveSample, false); form->write(saveSample);
nlinfo("Saved sample config file."); nlinfo("Saved sample config file.");
} else { } else {
// CPath didn't find the file, just print an error and exit. // CPath didn't find the file, just print an error and exit.

View file

@ -104,7 +104,7 @@ CForm::~CForm ()
// *************************************************************************** // ***************************************************************************
void CForm::write (xmlDocPtr doc, const char *filename, bool georges4CVS) void CForm::write (xmlDocPtr doc, const char *filename)
{ {
// Save the filename // Save the filename
if (filename) if (filename)
@ -137,7 +137,7 @@ void CForm::write (xmlDocPtr doc, const char *filename, bool georges4CVS)
} }
// Header // Header
Header.write (node, georges4CVS); Header.write (node);
} }
// *************************************************************************** // ***************************************************************************
@ -259,14 +259,14 @@ const std::string &CForm::getComment () const
// *************************************************************************** // ***************************************************************************
void CForm::write (class NLMISC::IStream &stream, bool georges4CVS) void CForm::write (class NLMISC::IStream &stream)
{ {
// Xml stream // Xml stream
COXml xmlStream; COXml xmlStream;
xmlStream.init (&stream); xmlStream.init (&stream);
// Write the file // Write the file
write (xmlStream.getDocument (), NULL, georges4CVS); write (xmlStream.getDocument (), NULL);
} }
// *************************************************************************** // ***************************************************************************

View file

@ -41,7 +41,7 @@ void warning (bool exception, const char *format, ... );
// *************************************************************************** // ***************************************************************************
void CFormDfn::write (xmlDocPtr doc, const char *filename, bool georges4CVS) void CFormDfn::write (xmlDocPtr doc, const char *filename)
{ {
// Save filename // Save filename
_Filename = CFile::getFilename (filename); _Filename = CFile::getFilename (filename);
@ -101,7 +101,7 @@ void CFormDfn::write (xmlDocPtr doc, const char *filename, bool georges4CVS)
} }
// Header // Header
Header.write (node, georges4CVS); Header.write (node);
} }
// *************************************************************************** // ***************************************************************************

View file

@ -38,27 +38,16 @@ CFileHeader::CFileHeader ()
MajorVersion = 0; MajorVersion = 0;
MinorVersion = 0; MinorVersion = 0;
State = Modified; State = Modified;
Revision = "$R";
Revision += "evision$";
} }
// *************************************************************************** // ***************************************************************************
void CFileHeader::write (xmlNodePtr node, bool georges4CVS) const void CFileHeader::write (xmlNodePtr node) const
{ {
// Version for CVS ? // Georges version system
if (georges4CVS) char tmp[512];
{ smprintf (tmp, 512, "%d.%d", MajorVersion, MinorVersion);
// Georges version system xmlSetProp (node, (const xmlChar*)"Version", (const xmlChar*)tmp);
xmlSetProp (node, (const xmlChar*)"Revision", (const xmlChar*)Revision.c_str ());
}
else
{
// Georges version system
char tmp[512];
smprintf (tmp, 512, "%d.%d", MajorVersion, MinorVersion);
xmlSetProp (node, (const xmlChar*)"Version", (const xmlChar*)tmp);
}
// State // State
if (State == Modified) if (State == Modified)
@ -137,23 +126,6 @@ void CFileHeader::read (xmlNodePtr root)
MinorVersion = 0; MinorVersion = 0;
} }
// Get the revision
value = (const char*)xmlGetProp (root, (xmlChar*)"Revision");
if (value)
{
// Set the value
Revision = value;
// Delete the value
xmlFree ((void*)value);
}
else
{
// Set default
Revision = "$R";
Revision += "evision$";
}
// Get the version // Get the version
value = (const char*)xmlGetProp (root, (xmlChar*)"State"); value = (const char*)xmlGetProp (root, (xmlChar*)"State");
if (value) if (value)

View file

@ -54,7 +54,7 @@ CType::~CType ()
// *************************************************************************** // ***************************************************************************
void CType::write (xmlDocPtr doc, bool georges4CVS) const void CType::write (xmlDocPtr doc) const
{ {
// Create the first node // Create the first node
xmlNodePtr node = xmlNewDocNode (doc, NULL, (const xmlChar*)"TYPE", NULL); xmlNodePtr node = xmlNewDocNode (doc, NULL, (const xmlChar*)"TYPE", NULL);
@ -98,7 +98,7 @@ void CType::write (xmlDocPtr doc, bool georges4CVS) const
} }
// Header // Header
Header.write (node, georges4CVS); Header.write (node);
} }
// *************************************************************************** // ***************************************************************************

View file

@ -1200,7 +1200,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
} }
else else
{ {
form->write(output, true); form->write(output);
output.close(); output.close();
if (!CPath::exists(filename + ext)) if (!CPath::exists(filename + ext))

View file

@ -73,7 +73,6 @@ CGeorgesEditApp::CGeorgesEditApp() : MemStream (false, false, 1024*1024)
ResizeMain = true; ResizeMain = true;
ExeStandalone = false; ExeStandalone = false;
StartExpanded = true; StartExpanded = true;
Georges4CVS = true;
FormClipBoardFormatStruct = RegisterClipboardFormat ("GeorgesFormStruct"); FormClipBoardFormatStruct = RegisterClipboardFormat ("GeorgesFormStruct");
FormClipBoardFormatVirtualStruct = RegisterClipboardFormat ("GeorgesFormVirtualStruct"); FormClipBoardFormatVirtualStruct = RegisterClipboardFormat ("GeorgesFormVirtualStruct");
@ -547,11 +546,6 @@ bool CGeorgesEditApp::loadCfg ()
if (start_expanded) if (start_expanded)
StartExpanded = start_expanded->asInt () != 0; StartExpanded = start_expanded->asInt () != 0;
// Georges4CVS
CConfigFile::CVar *georges_for_cvs = cf.getVarPtr ("GeorgesForCvs");
if (georges_for_cvs)
Georges4CVS = georges_for_cvs->asInt () != 0;
// MaxUndo // MaxUndo
CConfigFile::CVar *max_undo = cf.getVarPtr ("MaxUndo"); CConfigFile::CVar *max_undo = cf.getVarPtr ("MaxUndo");
if (max_undo) if (max_undo)
@ -633,11 +627,6 @@ bool CGeorgesEditApp::saveCfg ()
if (start_expanded) if (start_expanded)
start_expanded->setAsInt (StartExpanded); start_expanded->setAsInt (StartExpanded);
// Georges4CVS
CConfigFile::CVar *georges_for_cvs= cf.getVarPtr ("GeorgesForCvs");
if (georges_for_cvs)
georges_for_cvs->setAsInt (Georges4CVS);
// MaxUndo // MaxUndo
CConfigFile::CVar *max_undo= cf.getVarPtr ("MaxUndo"); CConfigFile::CVar *max_undo= cf.getVarPtr ("MaxUndo");
if (max_undo) if (max_undo)

View file

@ -99,9 +99,6 @@ public:
// If true, expand document's content node at loading // If true, expand document's content node at loading
bool StartExpanded; bool StartExpanded;
// Georges for CVS
bool Georges4CVS;
// Clipboards ID // Clipboards ID
UINT FormClipBoardFormatStruct; UINT FormClipBoardFormatStruct;
UINT FormClipBoardFormatVirtualStruct; UINT FormClipBoardFormatVirtualStruct;

View file

@ -766,7 +766,7 @@ BOOL CGeorgesEditDoc::OnSaveDocument(LPCTSTR lpszPathName)
Type->Header.MinorVersion++; Type->Header.MinorVersion++;
flushValueChange (); flushValueChange ();
} }
Type->write (xmlStream.getDocument (), theApp.Georges4CVS); Type->write (xmlStream.getDocument ());
modify (NULL, NULL, false); modify (NULL, NULL, false);
flushValueChange (); flushValueChange ();
UpdateAllViews (NULL); UpdateAllViews (NULL);
@ -782,7 +782,7 @@ BOOL CGeorgesEditDoc::OnSaveDocument(LPCTSTR lpszPathName)
Dfn->Header.MinorVersion++; Dfn->Header.MinorVersion++;
flushValueChange (); flushValueChange ();
} }
Dfn->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS); Dfn->write (xmlStream.getDocument (), lpszPathName);
modify (NULL, NULL, false); modify (NULL, NULL, false);
UpdateAllViews (NULL); UpdateAllViews (NULL);
return TRUE; return TRUE;
@ -797,7 +797,7 @@ BOOL CGeorgesEditDoc::OnSaveDocument(LPCTSTR lpszPathName)
((CForm*)(UForm*)Form)->Header.MinorVersion++; ((CForm*)(UForm*)Form)->Header.MinorVersion++;
flushValueChange (); flushValueChange ();
} }
((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS); ((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), lpszPathName);
if (strcmp (xmlStream.getErrorString (), "") != 0) if (strcmp (xmlStream.getErrorString (), "") != 0)
{ {
char message[512]; char message[512];

View file

@ -513,7 +513,7 @@ void CGeorgesImpl::MakeTyp( const std::string& filename, TType type, TUI ui, con
outputXml.init (&output); outputXml.init (&output);
// Write // Write
t.write (outputXml.getDocument (), theApp.Georges4CVS); t.write (outputXml.getDocument ());
} }
catch (Exception &e) catch (Exception &e)
{ {
@ -560,7 +560,7 @@ void CGeorgesImpl::createInstanceFile (const std::string &_sxFullnameWithoutExt,
if (f.open (fullName)) if (f.open (fullName))
{ {
ox.init(&f); ox.init(&f);
((NLGEORGES::CForm*)((UForm*)Form))->write (ox.getDocument(), _sxFullnameWithoutExt.c_str (), theApp.Georges4CVS); ((NLGEORGES::CForm*)((UForm*)Form))->write (ox.getDocument(), _sxFullnameWithoutExt.c_str ());
ox.flush(); ox.flush();
f.close(); f.close();
} }

View file

@ -96,7 +96,6 @@ BOOL CHeaderDialog::OnInitDialog()
IncrementVersion.Create ("Increment Version", WS_VISIBLE|WS_TABSTOP, currentPos, this, BtIncrement); IncrementVersion.Create ("Increment Version", WS_VISIBLE|WS_TABSTOP, currentPos, this, BtIncrement);
initWidget (IncrementVersion); initWidget (IncrementVersion);
getNextPos (currentPos); getNextPos (currentPos);
IncrementVersion.EnableWindow ( theApp.Georges4CVS ? FALSE : TRUE );
// Create the state combo // Create the state combo
setStaticSize (currentPos); setStaticSize (currentPos);
@ -243,55 +242,11 @@ void CHeaderDialog::getFromDocument (const NLGEORGES::CFileHeader &header)
{ {
if (View) if (View)
{ {
if (theApp.Georges4CVS) // Nel standard version number
{ ComboState.SetCurSel (header.State);
// CVS revision number char name[512];
IncrementVersion.EnableWindow ( theApp.Georges4CVS ? FALSE : TRUE ); smprintf (name, 512, "Version %d.%d", header.MajorVersion, header.MinorVersion);
LabelVersion.SetWindowText (name);
// Performs some checks
bool ok = false;
const char *revision = header.Revision.c_str ();
char name[32];
char name2[512];
if (strncmp (revision, "$Revision: ", 11) == 0)
{
// String start
const char *start = revision + 11;
// String end
const char *end = strchr (start, '$');
if (end)
{
// Build a string
int length = std::min (31, (int)(end-start));
memcpy (name, start, length);
name[length] = 0;
// Nice version
smprintf (name2, 512, "CVS Revision %s", name);
// Set the label
LabelVersion.SetWindowText (name2);
// Success
ok = true;
}
}
// Revision not found ?
if (!ok)
{
LabelVersion.SetWindowText ("CVS Revision number not found");
}
}
else
{
// Nel standard version number
ComboState.SetCurSel (header.State);
char name[512];
smprintf (name, 512, "Version %d.%d", header.MajorVersion, header.MinorVersion);
LabelVersion.SetWindowText (name);
}
// Set comments // Set comments
setEditTextMultiLine (Comments, header.Comments.c_str()); setEditTextMultiLine (Comments, header.Comments.c_str());

View file

@ -39,7 +39,6 @@ CSettingsDialog::CSettingsDialog(CWnd* pParent /*=NULL*/)
TypeDfnSubDirectory = _T(""); TypeDfnSubDirectory = _T("");
MaxUndo = 0; MaxUndo = 0;
StartExpanded = TRUE; StartExpanded = TRUE;
Georges4CVS = TRUE;
//}}AFX_DATA_INIT //}}AFX_DATA_INIT
} }
@ -55,7 +54,6 @@ void CSettingsDialog::DoDataExchange(CDataExchange* pDX)
DDX_Text(pDX, IDC_TYP_DFN_PATH, TypeDfnSubDirectory); DDX_Text(pDX, IDC_TYP_DFN_PATH, TypeDfnSubDirectory);
DDX_Text(pDX, IDC_MAX_UNDO, MaxUndo); DDX_Text(pDX, IDC_MAX_UNDO, MaxUndo);
DDX_Check(pDX, IDC_START_EXPANDED, StartExpanded); DDX_Check(pDX, IDC_START_EXPANDED, StartExpanded);
DDX_Check(pDX, IDC_GEORGES_4_CVS, Georges4CVS);
//}}AFX_DATA_MAP //}}AFX_DATA_MAP
} }
@ -93,7 +91,6 @@ BOOL CSettingsDialog::OnInitDialog()
DefaultDfn = theApp.DefaultDfn.c_str (); DefaultDfn = theApp.DefaultDfn.c_str ();
DefaultType = theApp.DefaultType.c_str (); DefaultType = theApp.DefaultType.c_str ();
StartExpanded = theApp.StartExpanded; StartExpanded = theApp.StartExpanded;
Georges4CVS = theApp.Georges4CVS;
UpdateData (FALSE); UpdateData (FALSE);
@ -110,7 +107,6 @@ void CSettingsDialog::OnOK()
theApp.TypeDfnSubDirectory = TypeDfnSubDirectory; theApp.TypeDfnSubDirectory = TypeDfnSubDirectory;
theApp.RememberListSize = RememberListSize; theApp.RememberListSize = RememberListSize;
theApp.StartExpanded = StartExpanded ? TRUE : FALSE; theApp.StartExpanded = StartExpanded ? TRUE : FALSE;
theApp.Georges4CVS = Georges4CVS ? TRUE : FALSE;
theApp.MaxUndo = MaxUndo; theApp.MaxUndo = MaxUndo;
theApp.DefaultDfn = DefaultDfn; theApp.DefaultDfn = DefaultDfn;
theApp.DefaultType = DefaultType; theApp.DefaultType = DefaultType;

View file

@ -44,7 +44,6 @@ public:
CString TypeDfnSubDirectory; CString TypeDfnSubDirectory;
UINT MaxUndo; UINT MaxUndo;
BOOL StartExpanded; BOOL StartExpanded;
BOOL Georges4CVS;
//}}AFX_DATA //}}AFX_DATA
NLMISC::CConfigFile ConfigFile; NLMISC::CConfigFile ConfigFile;

View file

@ -11,6 +11,5 @@ SuperUser = 1;
UserType = { UserType = {
}; };
StartExpanded = 1; StartExpanded = 1;
GeorgesForCvs = 1;
SamplePath = "L:\sound_files\samplebanks"; SamplePath = "L:\sound_files\samplebanks";
PackedSheetPath = "L:\sound_files\"; PackedSheetPath = "L:\sound_files\";