Patch #1989 2007-05-09 06:55

pauliusz

fixes new file not added to project bug
Download
1989-fixes_new_file.patch (2.4 KB)
Category
Application::Bugfix
Status
Closed
Close date
2007-05-09 10:57
Assigned to
 
Index: src/plugins/scriptedwizard/filepathpanel.cpp
===================================================================
--- src/plugins/scriptedwizard/filepathpanel.cpp    (revision 3947)
+++ src/plugins/scriptedwizard/filepathpanel.cpp    (working copy)
@@ -131,14 +131,14 @@
 {
     int selection = -1;
 
-    if (m_Selection > clbTargets->GetCount()-2) // (m_Selection >= clbTargets->GetCount()-1)
+    if (m_Selection > (int)clbTargets->GetCount()-2) // (m_Selection >= clbTargets->GetCount()-1)
     {
         m_Selection = -1; // Reset -> notify about "last item" with -1
         return m_Selection;
     }
 
     // start with next (x+1) or first (-1+1 = 0) item
-    for (selection = m_Selection+1; selection<clbTargets->GetCount(); ++selection)
+    for (selection = m_Selection+1; selection<(int)clbTargets->GetCount(); ++selection)
     {
         if (clbTargets->IsChecked(selection))
             break; // selection found. break for-loop to save item's index
@@ -187,13 +187,13 @@
 
 void FilePathPanel::OnbtnAllClick(wxCommandEvent& event)
 {
-    for (int i=0; i<clbTargets->GetCount(); ++i)
+    for (int i=0; i<(int)clbTargets->GetCount(); ++i)
         clbTargets->Check(i, true);
 }
 
 void FilePathPanel::OnbtnNoneClick(wxCommandEvent& event)
 {
-    for (int i=0; i<clbTargets->GetCount(); ++i)
+    for (int i=0; i<(int)clbTargets->GetCount(); ++i)
         clbTargets->Check(i, false);
 }
 
Index: src/plugins/scriptedwizard/resources/common_functions.script
===================================================================
--- src/plugins/scriptedwizard/resources/common_functions.script    (revision 3947)
+++ src/plugins/scriptedwizard/resources/common_functions.script    (working copy)
@@ -433,10 +433,10 @@
         {
             // Check first if the file exists in Active Project
             local pf_check = prj.GetFileByFilename(the_file, false, false);
-            if (!IsNull(pf_check)) // File exists, Remove it first
-                prj.RemoveFile(pf_check)
-            // Now add the file to the first selected target
-            local pf = prj.AddFile(tgtidx, the_file);
+            if (!IsNull(pf_check)) // File exists, Remove it first
+                prj.RemoveFile(pf_check)
+            // Now add the file to the first selected target
+            local pf = prj.AddFile(tgtidx, the_file);
             GetProjectManager().RebuildTree(); // make sure our view is current
 
             // if the file was added succesfully, (...)
pauliusz 2007-05-09 06:59

Actually the bug itself was in this line:

if (m_Selection > clbTargets->GetCount()-2)

in wx26 GetCount() returns int, but in wx28 it returns unsigned int. This caused evaluation to be always true.

killerbot 2007-05-09 10:57

applied : thanks for the help.