Patch #2442 2008-04-18 22:38
jgm
AutoVersioning bugs, new features- Download
- 2442-AutoVersioning.patch (8.3 KB)
Index: src/plugins/contrib/AutoVersioning/AutoVersioning.cpp
===================================================================
--- src/plugins/contrib/AutoVersioning/AutoVersioning.cpp (revision 5005)
+++ src/plugins/contrib/AutoVersioning/AutoVersioning.cpp (working copy)
@@ -65,7 +65,6 @@
ProjectLoaderHooks::HookFunctorBase* AutoVerHook =
new ProjectLoaderHooks::HookFunctor<AutoVersioning>(this, &AutoVersioning::OnProjectLoadingHook);
m_AutoVerHookId = ProjectLoaderHooks::RegisterHook(AutoVerHook);
- m_IsCurrentProjectVersioned = false;
m_Modified = false;
m_Project = 0;
} // end of constructor
@@ -128,11 +127,11 @@
// TODO (KILLERBOT) : should we have default values, in case something would be missing ?
// OPTI : we could choose not to write out default values in the xml --> smaller cbp
avConfig Config;
- m_IsCurrentProjectVersioned = false; // default not active unless we find xml for it
+ m_IsVersioned[project] = false; // default not active unless we find xml for it
const TiXmlElement* Node = elem->FirstChildElement("AutoVersioning");
if (Node)
{
- m_IsCurrentProjectVersioned = true;
+ m_IsVersioned[project] = true;
TiXmlHandle Handle(const_cast<TiXmlElement*>(Node));
if(const TiXmlElement* pElem = Handle.FirstChildElement("Scheme").ToElement())
{
@@ -215,7 +214,6 @@
}
m_ProjectMap[project] = Config;
m_ProjectMapVersionState[project] = VersionState;
- m_Project = project;
}
else
{
@@ -226,7 +224,7 @@
// if plugins that use that element are not loaded atm).
// so, instead of blindly inserting the element, we must first check it's
// not already there (and if it is, clear its contents)
- if(m_IsCurrentProjectVersioned)
+ if(m_IsVersioned[project])
{
TiXmlElement* node = elem->FirstChildElement("AutoVersioning");
if (!node)
@@ -281,7 +279,8 @@
if (IsAttached())
{
m_ProjectMap.erase(event.GetProject());
- m_ProjectMapVersionState.erase(event.GetProject());
+ m_ProjectMapVersionState.erase(event.GetProject());
+ m_IsVersioned.erase(event.GetProject());
if(m_Project == event.GetProject())
{ // should always be the case (??? we hope ??)
m_Project = 0;
@@ -294,7 +293,7 @@
// be activated and each has the compilerstarted/Finished ?????
void AutoVersioning::OnCompilerStarted(CodeBlocksEvent& event)
{
- if (m_Project && IsAttached() && m_IsCurrentProjectVersioned)
+ if (m_Project && IsAttached() && m_IsVersioned[event.GetProject()])
{
if (m_Modified)
{
@@ -317,7 +316,7 @@
void AutoVersioning::OnCompilerFinished(CodeBlocksEvent& event)
{
- if (m_Project && IsAttached() && m_IsCurrentProjectVersioned)
+ if (m_Project && IsAttached() && m_IsVersioned[event.GetProject()])
{
++(GetVersionState().Values.BuildCount);
}
@@ -325,7 +324,7 @@
void AutoVersioning::OnTimerVerify(wxTimerEvent& event)
{
- if (m_Project && IsAttached() && m_IsCurrentProjectVersioned)
+ if (m_Project && IsAttached() && m_IsVersioned[m_Project])
{
if (!m_Modified)
{
@@ -348,7 +347,7 @@
{
if (m_Project)
{
- if (m_IsCurrentProjectVersioned)
+ if (m_IsVersioned[m_Project])
{
SetVersionAndSettings(*m_Project, true);
UpdateVersionHeader();
@@ -357,8 +356,20 @@
{
if (wxMessageBox(_("Configure the project \"") + m_Project->GetTitle() + _("\" for Autoversioning?"),_("Autoversioning"),wxYES_NO) == wxYES)
{
+ if(wxFileExists(m_Project->GetBasePath() + _T("version.h")))
+ {
+ wxMessageBox(
+ _T("The header version.h already exist on your projects path. "
+ "The content will be overwritten by the the version info generated code."
+ "\n\nYou can change the default version.h file on the \"Settings\" Tab."
+ ),
+ _T("Warning"),
+ wxICON_EXCLAMATION | wxOK
+ );
+ }
+
// we activated
- m_IsCurrentProjectVersioned = true;
+ m_IsVersioned[m_Project] = true;
// just becasue we activated the project becomes modified
m_Project->SetModified();
@@ -382,7 +393,7 @@
void AutoVersioning::OnMenuCommitChanges(wxCommandEvent&)
{
- if (m_Project && IsAttached() && m_IsCurrentProjectVersioned)
+ if (m_Project && IsAttached() && m_IsVersioned[m_Project])
{
if(m_Modified)
{
@@ -406,7 +417,7 @@
{
download for full patch...
History
jgm 2008-04-18 22:40
Changes:
- Now works correctly on workspaces
- Warns when first time configuration and version.h exist on the projects path
- Formats the header file name and uses it as the header guard