Author: matt
Date: 2011-07-28 08:43:16 -0700 (Thu, 28 Jul 2011)
New Revision: 8879
Log:
Refactored the environment generating code to make it more compact and readable.

Modified:
   branches/branch-3.0/fltk.flw
   branches/branch-3.0/fluid/CMakeLists.txt
   branches/branch-3.0/fluid/Fl_Type.cxx
   branches/branch-3.0/fluid/Fl_Type.h
   branches/branch-3.0/fluid/file_cmake.cxx
   branches/branch-3.0/fluid/file_make.cxx
   branches/branch-3.0/fluid/file_visualc.cxx
   branches/branch-3.0/fluid/file_xcode.cxx

Modified: branches/branch-3.0/fltk.flw
===================================================================
--- branches/branch-3.0/fltk.flw        2011-07-28 13:20:09 UTC (rev 8878)
+++ branches/branch-3.0/fltk.flw        2011-07-28 15:43:16 UTC (rev 8879)
@@ -114,7 +114,7 @@
         uuid_Xcode4_PBXFileRef {5C0AC8E4-C774-4082-AD48-4DF7D04B0423}
         filename_and_path {fluid/template_panel.cxx}
       }
-      code_file {undo.cxx} {selected
+      code_file {undo.cxx} {
         uuid_Xcode4_PBXBuildFile {9F2F34D6-3E87-4B4C-A4E7-459A6F518639}
         uuid_Xcode4_PBXFileRef {6A66AFC5-0859-4BA2-8EF1-A85C3A828ED7}
         filename_and_path {fluid/undo.cxx}
@@ -160,7 +160,7 @@
         uuid_Xcode4_PBXFileRef {26103935-2D50-4B44-97C7-EE9AA857DE61}
         filename_and_path {fluid/alignment_panel.h}
       }
-      code_file {comments.h} {
+      code_file {comments.h} {selected
         uuid_Xcode4_PBXFileRef {19297348-7E5A-41AE-99F6-7AB10245A1D8}
         filename_and_path {fluid/comments.h}
       }
@@ -195,7 +195,14 @@
 folder Libraries {open
 } {
   app_target fltk {open
-  } {}
+  } {
+    folder Sources {open
+    } {
+      code_file {Fl_Adjuster.cxx} {
+        filename_and_path {src/Fl_Adjuster.cxx}
+      }
+    }
+  }
   app_target fltk_gl {open
   } {}
   app_target fltk_images {open

Modified: branches/branch-3.0/fluid/CMakeLists.txt
===================================================================
--- branches/branch-3.0/fluid/CMakeLists.txt    2011-07-28 13:20:09 UTC (rev 
8878)
+++ branches/branch-3.0/fluid/CMakeLists.txt    2011-07-28 15:43:16 UTC (rev 
8879)
@@ -23,6 +23,30 @@
        undo.cxx
        widget_panel.cxx
        workspace_panel.cxx
+       CodeEditor.cxx
+       Fl_Function_Type.cxx
+       Fl_Group_Type.cxx
+       Fl_Menu_Type.cxx
+       Fl_Type.cxx
+       Fl_Widget_Type.cxx
+       Fl_Window_Type.cxx
+       Fluid_Image.cxx
+       about_panel.cxx
+       align_widget.cxx
+       alignment_panel.cxx
+       code.cxx
+       factory.cxx
+       file.cxx
+       file_cmake.cxx
+       file_make.cxx
+       file_visualc.cxx
+       file_xcode.cxx
+       fluid.cxx
+       function_panel.cxx
+       template_panel.cxx
+       undo.cxx
+       widget_panel.cxx
+       workspace_panel.cxx
 )
 add_executable(fluid ${CPPFILES})
 target_link_libraries(fluid fltk fltk_images fltk_forms)

Modified: branches/branch-3.0/fluid/Fl_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.cxx       2011-07-28 13:20:09 UTC (rev 
8878)
+++ branches/branch-3.0/fluid/Fl_Type.cxx       2011-07-28 15:43:16 UTC (rev 
8879)
@@ -1184,6 +1184,17 @@
   return 0L;
 }
 
+Fl_Target_Type *Fl_Target_Type::find(const char *name) {
+  Fl_Type *tgt = first;
+  while (tgt) {
+    if (tgt->is_target() && strcmp(tgt->name(), name)==0)
+      return (Fl_Target_Type*)tgt;
+    tgt = tgt->next;
+  }
+  return 0;
+}
+
+
 // ------------ Application Target 
---------------------------------------------
 
 Fl_App_Target_Type Fl_App_Target_type;
@@ -1304,6 +1315,56 @@
   }
 }
 
+Fl_File_Type *Fl_File_Type::first_file(Fl_Type *base) {
+  Fl_Type *src = base->next;
+  while (src && src->level>base->level) {
+    if (src->is_file()) 
+      return (Fl_File_Type*)src;
+    src = src->next;
+  }
+  return 0;
+}
+
+Fl_File_Type *Fl_File_Type::next_file(Fl_Type *base) {
+  Fl_Type *src = this->next;
+  while (src && src->level>base->level) {
+    if (src->is_file()) 
+      return (Fl_File_Type*)src;
+    src = src->next;
+  }
+  return 0;
+}
+
+char Fl_File_Type::is_cplusplus_code() {
+  const char *fn = filename();
+  if (fn) {
+    const char *ext = fltk3::filename_ext(fn);
+    if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0)) {
+      return 1;
+    }
+  }
+  return 0;
+}
+
+char Fl_File_Type::is_cplusplus_header() {
+  const char *fn = filename();
+  if (fn) {
+    const char *ext = fltk3::filename_ext(fn);
+    if (ext && (strcmp(ext, ".h")==0 || strcmp(ext, ".H")==0)) {
+      return 1;
+    }
+  }
+  return 0;
+}
+
+const char *Fl_File_Type::filename_name() {
+  const char *fn = filename();
+  if (fn) {
+    return fltk3::filename_name(fn);
+  }
+  return 0;
+}
+
 // ------------ Fluid File 
-----------------------------------------------------
 
 Fl_Fluid_File_Type Fl_Fluid_File_type;

Modified: branches/branch-3.0/fluid/Fl_Type.h
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.h 2011-07-28 13:20:09 UTC (rev 8878)
+++ branches/branch-3.0/fluid/Fl_Type.h 2011-07-28 15:43:16 UTC (rev 8879)
@@ -204,6 +204,8 @@
   Fl_Type *make();
   virtual int is_parent() const { return 1; }
   virtual int is_target() const { return 1; }
+  
+  static Fl_Target_Type *find(const char *name);
 };
 extern Fl_Target_Type Fl_Target_type;
 
@@ -251,9 +253,14 @@
   virtual int pixmapID() { return 53; } // FIXME: draw icon
   void filename(const char *new_name);
   const char *filename() { return pFilename; }
+  const char *filename_name();
   virtual void open();
   virtual void write_properties();
   virtual char read_property(const char *);
+  static Fl_File_Type *first_file(Fl_Type *base);
+  Fl_File_Type *next_file(Fl_Type *base);
+  char is_cplusplus_code();
+  char is_cplusplus_header();
 };
 extern Fl_File_Type Fl_File_type;
 

Modified: branches/branch-3.0/fluid/file_cmake.cxx
===================================================================
--- branches/branch-3.0/fluid/file_cmake.cxx    2011-07-28 13:20:09 UTC (rev 
8878)
+++ branches/branch-3.0/fluid/file_cmake.cxx    2011-07-28 15:43:16 UTC (rev 
8879)
@@ -42,12 +42,7 @@
 
 int write_fltk_cmake() {
   /* find the target named "Fluid" */
-  Fl_Type *tgt = Fl_Type::first;
-  while (tgt) {
-    if (tgt->is_target() && strcmp(tgt->name(), "Fluid")==0)
-      break;
-    tgt = tgt->next;
-  }
+  Fl_Type *tgt = Fl_Target_Type::find("Fluid");
   if (!tgt) {
     printf("FLUID target not found\n");
     return -1;
@@ -65,19 +60,11 @@
   
   fprintf(out, "set(CPPFILES\n");
   
-  Fl_Type *src = tgt->next;
-  while (src && src->level>tgt->level) {
-    if (src->is_file()) {
-      Fl_File_Type *f = (Fl_File_Type*)src;
-      const char *fn = f->filename();
-      if (fn) {
-        const char *ext = fltk3::filename_ext(fn);
-        if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0)) {
-          fprintf(out, "\t%s\n", fltk3::filename_name(fn));
-        }
-      }
+  Fl_File_Type *f;
+  for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+    if (f->is_cplusplus_code()) {
+      fprintf(out, "\t%s\n", f->filename_name());
     }
-    src = src->next;
   }
   
   fprintf(out, ")\n");  

Modified: branches/branch-3.0/fluid/file_make.cxx
===================================================================
--- branches/branch-3.0/fluid/file_make.cxx     2011-07-28 13:20:09 UTC (rev 
8878)
+++ branches/branch-3.0/fluid/file_make.cxx     2011-07-28 15:43:16 UTC (rev 
8879)
@@ -49,12 +49,7 @@
   }
   
   /* find the target named "Fluid" */
-  Fl_Type *tgt = Fl_Type::first;
-  while (tgt) {
-    if (tgt->is_target() && strcmp(tgt->name(), "Fluid")==0)
-      break;
-    tgt = tgt->next;
-  }
+  Fl_Type *tgt = Fl_Target_Type::find("Fluid");
   if (!tgt) {
     printf("FLUID target not found\n");
     return -1;
@@ -100,19 +95,11 @@
   
   /* loop through the target and write out all C++ files */
   fprintf(out, "CPPFILES = ");
-  Fl_Type *src = tgt->next;
-  while (src && src->level>tgt->level) {
-    if (src->is_file()) {
-      Fl_File_Type *f = (Fl_File_Type*)src;
-      const char *fn = f->filename();
-      if (fn) {
-        const char *ext = fltk3::filename_ext(fn);
-        if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0)) {
-          fprintf(out, "\\\n\t%s", fltk3::filename_name(fn));
-        }
-      }
+  Fl_File_Type *f;
+  for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+    if (f->is_cplusplus_code()) {
+      fprintf(out, "\\\n\t%s", f->filename_name());
     }
-    src = src->next;
   }
   fprintf(out, "\n\n");
   

Modified: branches/branch-3.0/fluid/file_visualc.cxx
===================================================================
--- branches/branch-3.0/fluid/file_visualc.cxx  2011-07-28 13:20:09 UTC (rev 
8878)
+++ branches/branch-3.0/fluid/file_visualc.cxx  2011-07-28 15:43:16 UTC (rev 
8879)
@@ -41,6 +41,18 @@
 
 extern char *filename;
 
+const char *DOS_path(const char *filename) {
+  static char buf[2048];
+  char *c;
+  strcpy(buf, filename);
+  for (c=buf;;c++) {
+    switch (*c) {
+      case '/': *c = '\\'; break;
+      case 0: break;
+    }
+  }
+  return buf;
+}
 
 int write_fltk_ide_visualc6() {
   if (!filename) {
@@ -49,12 +61,7 @@
   }
   
   /* find the target named "Fluid" */
-  Fl_Type *tgt = Fl_Type::first;
-  while (tgt) {
-    if (tgt->is_target() && strcmp(tgt->name(), "Fluid")==0)
-      break;
-    tgt = tgt->next;
-  }
+  Fl_Type *tgt = Fl_Target_Type::find("Fluid");
   if (!tgt) {
     printf("FLUID target not found\n");
     return -1;
@@ -163,31 +170,15 @@
   fprintf(out, "# Name \"Fluid - Win32 Debug\"\r\n");
   
   /* loop through the target and write out all C++ files */
-  Fl_Type *src = tgt->next;
-  while (src && src->level>tgt->level) {
-    if (src->is_file()) {
-      Fl_File_Type *f = (Fl_File_Type*)src;
-      const char *fn = f->filename();
-      if (fn) {
-        const char *ext = fltk3::filename_ext(fn);
-        if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0)) {
-          char buf[2048], *c;
-          strcpy(buf, fn);
-          for (c=buf;;) {
-            c = strchr(c, '/');
-            if (!c) break;
-            *c = '\\';
-            c++;
-          }
-          fprintf(out, "# Begin Source File\r\n");
-          fprintf(out, "\r\n");
-          fprintf(out, "SOURCE=..\\..\\%s\r\n", buf);
-          fprintf(out, "# End Source File\r\n");
-        }
-      }
+  Fl_File_Type *f;
+  for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+    if (f->is_cplusplus_code()) {
+      fprintf(out, "# Begin Source File\r\n");
+      fprintf(out, "\r\n");
+      fprintf(out, "SOURCE=..\\..\\%s\r\n", DOS_path(f->filename()));
+      fprintf(out, "# End Source File\r\n");
     }
-    src = src->next;
-  }
+  }  
   
   fprintf(out, "# End Target\r\n");
   fprintf(out, "# End Project\r\n");
@@ -204,12 +195,7 @@
   }
   
   /* find the target named "Fluid" */
-  Fl_Type *tgt = Fl_Type::first;
-  while (tgt) {
-    if (tgt->is_target() && strcmp(tgt->name(), "Fluid")==0)
-      break;
-    tgt = tgt->next;
-  }
+  Fl_Type *tgt = Fl_Target_Type::find("Fluid");
   if (!tgt) {
     printf("FLUID target not found\n");
     return -1;
@@ -620,70 +606,54 @@
   fprintf(out, "\t<Files>\r\n");
   
   /* loop through the target and write out all C++ files */
-  Fl_Type *src = tgt->next;
-  while (src && src->level>tgt->level) {
-    if (src->is_file()) {
-      Fl_File_Type *f = (Fl_File_Type*)src;
-      const char *fn = f->filename();
-      if (fn) {
-        const char *ext = fltk3::filename_ext(fn);
-        if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0)) {
-          char buf[2048], *c;
-          strcpy(buf, fn);
-          for (c=buf;;) {
-            c = strchr(c, '/');
-            if (!c) break;
-            *c = '\\';
-            c++;
-          }          
-          fprintf(out, "\t\t<File\r\n");
-          fprintf(out, "\t\t\tRelativePath=\"..\\..\\%s\"\r\n", buf);
-          fprintf(out, "\t\t\t>\r\n");
-          fprintf(out, "\t\t\t<FileConfiguration\r\n");
-          fprintf(out, "\t\t\t\tName=\"Debug|Win32\"\r\n");
-          fprintf(out, "\t\t\t\t>\r\n");
-          fprintf(out, "\t\t\t\t<Tool\r\n");
-          fprintf(out, "\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n");
-          fprintf(out, "\t\t\t\t\tOptimization=\"0\"\r\n");
-          fprintf(out, "\t\t\t\t\tAdditionalIncludeDirectories=\"\"\r\n");
-          fprintf(out, "\t\t\t\t\tPreprocessorDefinitions=\"\"\r\n");
-          fprintf(out, "\t\t\t\t/>\r\n");
-          fprintf(out, "\t\t\t</FileConfiguration>\r\n");
-          fprintf(out, "\t\t\t<FileConfiguration\r\n");
-          fprintf(out, "\t\t\t\tName=\"Release|Win32\"\r\n");
-          fprintf(out, "\t\t\t\t>\r\n");
-          fprintf(out, "\t\t\t\t<Tool\r\n");
-          fprintf(out, "\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n");
-          fprintf(out, "\t\t\t\t\tFavorSizeOrSpeed=\"0\"\r\n");
-          fprintf(out, "\t\t\t\t\tAdditionalIncludeDirectories=\"\"\r\n");
-          fprintf(out, "\t\t\t\t\tPreprocessorDefinitions=\"\"\r\n");
-          fprintf(out, "\t\t\t\t/>\r\n");
-          fprintf(out, "\t\t\t</FileConfiguration>\r\n");
-          fprintf(out, "\t\t\t<FileConfiguration\r\n");
-          fprintf(out, "\t\t\t\tName=\"Debug Cairo|Win32\"\r\n");
-          fprintf(out, "\t\t\t\t>\r\n");
-          fprintf(out, "\t\t\t\t<Tool\r\n");
-          fprintf(out, "\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n");
-          fprintf(out, "\t\t\t\t\tOptimization=\"0\"\r\n");
-          fprintf(out, "\t\t\t\t\tAdditionalIncludeDirectories=\"\"\r\n");
-          fprintf(out, "\t\t\t\t\tPreprocessorDefinitions=\"\"\r\n");
-          fprintf(out, "\t\t\t\t/>\r\n");
-          fprintf(out, "\t\t\t</FileConfiguration>\r\n");
-          fprintf(out, "\t\t\t<FileConfiguration\r\n");
-          fprintf(out, "\t\t\t\tName=\"Release Cairo|Win32\"\r\n");
-          fprintf(out, "\t\t\t\t>\r\n");
-          fprintf(out, "\t\t\t\t<Tool\r\n");
-          fprintf(out, "\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n");
-          fprintf(out, "\t\t\t\t\tFavorSizeOrSpeed=\"0\"\r\n");
-          fprintf(out, "\t\t\t\t\tAdditionalIncludeDirectories=\"\"\r\n");
-          fprintf(out, "\t\t\t\t\tPreprocessorDefinitions=\"\"\r\n");
-          fprintf(out, "\t\t\t\t/>\r\n");
-          fprintf(out, "\t\t\t</FileConfiguration>\r\n");
-          fprintf(out, "\t\t</File>\r\n");          
-        }
-      }
+  Fl_File_Type *f;
+  for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+    if (f->is_cplusplus_code()) {
+      fprintf(out, "\t\t<File\r\n");
+      fprintf(out, "\t\t\tRelativePath=\"..\\..\\%s\"\r\n", 
DOS_path(f->filename()));
+      fprintf(out, "\t\t\t>\r\n");
+      fprintf(out, "\t\t\t<FileConfiguration\r\n");
+      fprintf(out, "\t\t\t\tName=\"Debug|Win32\"\r\n");
+      fprintf(out, "\t\t\t\t>\r\n");
+      fprintf(out, "\t\t\t\t<Tool\r\n");
+      fprintf(out, "\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n");
+      fprintf(out, "\t\t\t\t\tOptimization=\"0\"\r\n");
+      fprintf(out, "\t\t\t\t\tAdditionalIncludeDirectories=\"\"\r\n");
+      fprintf(out, "\t\t\t\t\tPreprocessorDefinitions=\"\"\r\n");
+      fprintf(out, "\t\t\t\t/>\r\n");
+      fprintf(out, "\t\t\t</FileConfiguration>\r\n");
+      fprintf(out, "\t\t\t<FileConfiguration\r\n");
+      fprintf(out, "\t\t\t\tName=\"Release|Win32\"\r\n");
+      fprintf(out, "\t\t\t\t>\r\n");
+      fprintf(out, "\t\t\t\t<Tool\r\n");
+      fprintf(out, "\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n");
+      fprintf(out, "\t\t\t\t\tFavorSizeOrSpeed=\"0\"\r\n");
+      fprintf(out, "\t\t\t\t\tAdditionalIncludeDirectories=\"\"\r\n");
+      fprintf(out, "\t\t\t\t\tPreprocessorDefinitions=\"\"\r\n");
+      fprintf(out, "\t\t\t\t/>\r\n");
+      fprintf(out, "\t\t\t</FileConfiguration>\r\n");
+      fprintf(out, "\t\t\t<FileConfiguration\r\n");
+      fprintf(out, "\t\t\t\tName=\"Debug Cairo|Win32\"\r\n");
+      fprintf(out, "\t\t\t\t>\r\n");
+      fprintf(out, "\t\t\t\t<Tool\r\n");
+      fprintf(out, "\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n");
+      fprintf(out, "\t\t\t\t\tOptimization=\"0\"\r\n");
+      fprintf(out, "\t\t\t\t\tAdditionalIncludeDirectories=\"\"\r\n");
+      fprintf(out, "\t\t\t\t\tPreprocessorDefinitions=\"\"\r\n");
+      fprintf(out, "\t\t\t\t/>\r\n");
+      fprintf(out, "\t\t\t</FileConfiguration>\r\n");
+      fprintf(out, "\t\t\t<FileConfiguration\r\n");
+      fprintf(out, "\t\t\t\tName=\"Release Cairo|Win32\"\r\n");
+      fprintf(out, "\t\t\t\t>\r\n");
+      fprintf(out, "\t\t\t\t<Tool\r\n");
+      fprintf(out, "\t\t\t\t\tName=\"VCCLCompilerTool\"\r\n");
+      fprintf(out, "\t\t\t\t\tFavorSizeOrSpeed=\"0\"\r\n");
+      fprintf(out, "\t\t\t\t\tAdditionalIncludeDirectories=\"\"\r\n");
+      fprintf(out, "\t\t\t\t\tPreprocessorDefinitions=\"\"\r\n");
+      fprintf(out, "\t\t\t\t/>\r\n");
+      fprintf(out, "\t\t\t</FileConfiguration>\r\n");
+      fprintf(out, "\t\t</File>\r\n");          
     }
-    src = src->next;
   }
   
   fprintf(out, "\t</Files>\r\n");
@@ -703,12 +673,7 @@
   }
   
   /* find the target named "Fluid" */
-  Fl_Type *tgt = Fl_Type::first;
-  while (tgt) {
-    if (tgt->is_target() && strcmp(tgt->name(), "Fluid")==0)
-      break;
-    tgt = tgt->next;
-  }
+  Fl_Type *tgt = Fl_Target_Type::find("Fluid");
   if (!tgt) {
     printf("FLUID target not found\n");
     return -1;
@@ -973,42 +938,26 @@
   fprintf(out, "    </Link>\r\n");
   fprintf(out, "  </ItemDefinitionGroup>\r\n");
   fprintf(out, "  <ItemGroup>\r\n");
-    
+  
   /* loop through the target and write out all C++ files */
-  Fl_Type *src = tgt->next;
-  while (src && src->level>tgt->level) {
-    if (src->is_file()) {
-      Fl_File_Type *f = (Fl_File_Type*)src;
-      const char *fn = f->filename();
-      if (fn) {
-        const char *ext = fltk3::filename_ext(fn);
-        if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0)) {
-          char buf[2048], *c;
-          strcpy(buf, fn);
-          for (c=buf;;) {
-            c = strchr(c, '/');
-            if (!c) break;
-            *c = '\\';
-            c++;
-          }          
-          fprintf(out, "    <ClCompile Include=\"..\\..\\%s\">\r\n", buf);
-          fprintf(out, "      <Optimization 
Condition=\"'$(Configuration)|$(Platform)'=='Debug 
Cairo|Win32'\">Disabled</Optimization>\r\n");
-          fprintf(out, "      <AdditionalIncludeDirectories 
Condition=\"'$(Configuration)|$(Platform)'=='Debug 
Cairo|Win32'\">%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n");
-          fprintf(out, "      <PreprocessorDefinitions 
Condition=\"'$(Configuration)|$(Platform)'=='Debug 
Cairo|Win32'\">%%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n");
-          fprintf(out, "      <Optimization 
Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">Disabled</Optimization>\r\n");
-          fprintf(out, "      <AdditionalIncludeDirectories 
Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n");
-          fprintf(out, "      <PreprocessorDefinitions 
Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">%%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n");
-          fprintf(out, "      <FavorSizeOrSpeed 
Condition=\"'$(Configuration)|$(Platform)'=='Release 
Cairo|Win32'\">Neither</FavorSizeOrSpeed>\r\n");
-          fprintf(out, "      <AdditionalIncludeDirectories 
Condition=\"'$(Configuration)|$(Platform)'=='Release 
Cairo|Win32'\">%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n");
-          fprintf(out, "      <PreprocessorDefinitions 
Condition=\"'$(Configuration)|$(Platform)'=='Release 
Cairo|Win32'\">%%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n");
-          fprintf(out, "      <FavorSizeOrSpeed 
Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">Neither</FavorSizeOrSpeed>\r\n");
-          fprintf(out, "      <AdditionalIncludeDirectories 
Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n");
-          fprintf(out, "      <PreprocessorDefinitions 
Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">%%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n");
-          fprintf(out, "    </ClCompile>\r\n");
-        }
-      }
+  Fl_File_Type *f;
+  for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+    if (f->is_cplusplus_code()) {
+      fprintf(out, "    <ClCompile Include=\"..\\..\\%s\">\r\n", 
DOS_path(f->filename()));
+      fprintf(out, "      <Optimization 
Condition=\"'$(Configuration)|$(Platform)'=='Debug 
Cairo|Win32'\">Disabled</Optimization>\r\n");
+      fprintf(out, "      <AdditionalIncludeDirectories 
Condition=\"'$(Configuration)|$(Platform)'=='Debug 
Cairo|Win32'\">%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n");
+      fprintf(out, "      <PreprocessorDefinitions 
Condition=\"'$(Configuration)|$(Platform)'=='Debug 
Cairo|Win32'\">%%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n");
+      fprintf(out, "      <Optimization 
Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">Disabled</Optimization>\r\n");
+      fprintf(out, "      <AdditionalIncludeDirectories 
Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n");
+      fprintf(out, "      <PreprocessorDefinitions 
Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">%%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n");
+      fprintf(out, "      <FavorSizeOrSpeed 
Condition=\"'$(Configuration)|$(Platform)'=='Release 
Cairo|Win32'\">Neither</FavorSizeOrSpeed>\r\n");
+      fprintf(out, "      <AdditionalIncludeDirectories 
Condition=\"'$(Configuration)|$(Platform)'=='Release 
Cairo|Win32'\">%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n");
+      fprintf(out, "      <PreprocessorDefinitions 
Condition=\"'$(Configuration)|$(Platform)'=='Release 
Cairo|Win32'\">%%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n");
+      fprintf(out, "      <FavorSizeOrSpeed 
Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">Neither</FavorSizeOrSpeed>\r\n");
+      fprintf(out, "      <AdditionalIncludeDirectories 
Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n");
+      fprintf(out, "      <PreprocessorDefinitions 
Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">%%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n");
+      fprintf(out, "    </ClCompile>\r\n");
     }
-    src = src->next;
   }
 
   fprintf(out, "  </ItemGroup>\r\n");

Modified: branches/branch-3.0/fluid/file_xcode.cxx
===================================================================
--- branches/branch-3.0/fluid/file_xcode.cxx    2011-07-28 13:20:09 UTC (rev 
8878)
+++ branches/branch-3.0/fluid/file_xcode.cxx    2011-07-28 15:43:16 UTC (rev 
8879)
@@ -48,12 +48,7 @@
   // destination is ide/Xcode4/FLTK.xcodeproj/project.pbxproj
 
   /* find the target named "Fluid" */
-  Fl_Type *tgt = Fl_Type::first;
-  while (tgt) {
-    if (tgt->is_target() && strcmp(tgt->name(), "Fluid")==0)
-      break;
-    tgt = tgt->next;
-  }
+  Fl_Type *tgt = Fl_Target_Type::find("Fluid");
   if (!tgt) {
     printf("FLUID target not found\n");
     return -1;
@@ -80,118 +75,74 @@
         continue;
       } else { // single hash is a command
         copyLine = 0;
-        //char *semi = strchr(hash, ';');
-        //if (!semi) continue; // syntax error
         if (strncmp(hash, "#FluidBuildFileReferences;", 26)==0) {
-          Fl_Type *src = tgt->next;
-          while (src && src->level>tgt->level) {
-            if (src->is_file()) {
-              Fl_File_Type *f = (Fl_File_Type*)src;
-              const char *fn = f->filename();
-              if (fn) {
-                const char *ext = fltk3::filename_ext(fn);
-                if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0)) 
{
-                  char PBXBuildFile[32]; strcpy(PBXBuildFile, 
f->get_UUID_Xcode("Xcode4_PBXBuildFile"));
-                  char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
-                  // 836: DCB5F32CFF3DCFF6F2DA89E2 /* CodeEditor.cxx in 
Sources */ = {isa = PBXBuildFile; fileRef = CC0C80DA4DD31B6B2DB91096 /* 
CodeEditor.cxx */; };
-                  fprintf(out, "\t\t%s /* %s in %s */ = {isa = PBXBuildFile; 
fileRef = %s /* %s */; };\n", 
-                          PBXBuildFile, 
-                          fltk3::filename_name(fn), 
-                          "Sources", 
-                          PBXFileRef, 
-                          fltk3::filename_name(fn));
-                }
-              }
+          Fl_File_Type *f;
+          for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+            if (f->is_cplusplus_code()) {
+              char PBXBuildFile[32]; strcpy(PBXBuildFile, 
f->get_UUID_Xcode("Xcode4_PBXBuildFile"));
+              char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
+              // 836: DCB5F32CFF3DCFF6F2DA89E2 /* CodeEditor.cxx in Sources */ 
= {isa = PBXBuildFile; fileRef = CC0C80DA4DD31B6B2DB91096 /* CodeEditor.cxx */; 
};
+              fprintf(out, "\t\t%s /* %s in %s */ = {isa = PBXBuildFile; 
fileRef = %s /* %s */; };\n", 
+                      PBXBuildFile, 
+                      f->filename_name(), 
+                      "Sources", 
+                      PBXFileRef, 
+                      f->filename_name());
             }
-            src = src->next;
           }
           hash += 26;
         } else if (strncmp(hash, "#FluidFileReferences;", 21)==0) {
-          Fl_Type *src = tgt->next;
-          while (src && src->level>tgt->level) {
-            if (src->is_file()) {
-              Fl_File_Type *f = (Fl_File_Type*)src;
-              const char *fn = f->filename();
-              if (fn) {
-                const char *ext = fltk3::filename_ext(fn);
-                char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
-                // 4818: CC0C80DA4DD31B6B2DB91096 /* CodeEditor.cxx */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = CodeEditor.cxx; path = ../../fluid/CodeEditor.cxx; sourceTree = 
SOURCE_ROOT; };
-                if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0) 
) {
-                  fprintf(out, "\t\t%s /* %s */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = %s; path = 
../../%s; sourceTree = SOURCE_ROOT; };\n", 
-                          PBXFileRef,
-                          fltk3::filename_name(fn), 
-                          fltk3::filename_name(fn), 
-                          fn);
-                } else if (ext && (strcmp(ext, ".h")==0)) {
-                    fprintf(out, "\t\t%s /* %s */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = %s; path = 
../../%s; sourceTree = SOURCE_ROOT; };\n", 
-                            PBXFileRef,
-                            fltk3::filename_name(fn), 
-                            fltk3::filename_name(fn), 
-                            fn);
-                }
-              }
+          Fl_File_Type *f;
+          for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+            if (f->is_cplusplus_code()) {
+              char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
+              fprintf(out, "\t\t%s /* %s */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = %s; path = 
../../%s; sourceTree = SOURCE_ROOT; };\n", 
+                      PBXFileRef,
+                      f->filename_name(), 
+                      f->filename_name(), 
+                      f->filename());
+            } else if (f->is_cplusplus_header()) {
+              char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
+              fprintf(out, "\t\t%s /* %s */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = %s; path = 
../../%s; sourceTree = SOURCE_ROOT; };\n", 
+                      PBXFileRef,
+                      f->filename_name(), 
+                      f->filename_name(), 
+                      f->filename());
             }
-            src = src->next;
           }
           hash += 21;
         } else if (strncmp(hash, "#FluidHeadersGroup;", 19)==0) {
-          Fl_Type *src = tgt->next;
-          while (src && src->level>tgt->level) {
-            if (src->is_file()) {
-              Fl_File_Type *f = (Fl_File_Type*)src;
-              const char *fn = f->filename();
-              if (fn) {
-                const char *ext = fltk3::filename_ext(fn);
-                if (ext && strcmp(ext, ".h")==0) {
-                  char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
-                  fprintf(out, "\t\t\t\t%s /* %s */,\n", 
-                          PBXFileRef, 
-                          fltk3::filename_name(fn));
-                }
-              }
+          Fl_File_Type *f;
+          for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+            if (f->is_cplusplus_header()) {
+              char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
+              fprintf(out, "\t\t\t\t%s /* %s */,\n", 
+                      PBXFileRef, 
+                      f->filename_name());
             }
-            src = src->next;
           }
           hash += 19;
         } else if (strncmp(hash, "#FluidSourcesGroup;", 19)==0) {
-          Fl_Type *src = tgt->next;
-          while (src && src->level>tgt->level) {
-            if (src->is_file()) {
-              Fl_File_Type *f = (Fl_File_Type*)src;
-              const char *fn = f->filename();
-              if (fn) {
-                const char *ext = fltk3::filename_ext(fn);
-                if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0)) 
{
-                  char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
-                  // 7109: CC0C80DA4DD31B6B2DB91096 /* CodeEditor.cxx */,
-                  fprintf(out, "\t\t\t\t%s /* %s */,\n", 
-                          PBXFileRef, 
-                          fltk3::filename_name(fn));
-                }
-              }
+          Fl_File_Type *f;
+          for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+            if (f->is_cplusplus_code()) {
+              char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
+              fprintf(out, "\t\t\t\t%s /* %s */,\n", 
+                      PBXFileRef, 
+                      f->filename_name());
             }
-            src = src->next;
           }
           hash += 19;
         } else if (strncmp(hash, "#FluidSourcesBuildPhase;", 23)==0) {
-          Fl_Type *src = tgt->next;
-          while (src && src->level>tgt->level) {
-            if (src->is_file()) {
-              Fl_File_Type *f = (Fl_File_Type*)src;
-              const char *fn = f->filename();
-              if (fn) {
-                const char *ext = fltk3::filename_ext(fn);
-                if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0)) 
{
-                  char PBXBuildFile[32]; strcpy(PBXBuildFile, 
f->get_UUID_Xcode("Xcode4_PBXBuildFile"));
-                  // 10787: DCB5F32CFF3DCFF6F2DA89E2 /* CodeEditor.cxx in 
Sources */,
-                  fprintf(out, "\t\t\t\t%s /* %s in %s */,\n", 
-                          PBXBuildFile, 
-                          fltk3::filename_name(fn), 
-                          "Sources");
-                }
-              }
+          Fl_File_Type *f;
+          for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
+            if (f->is_cplusplus_code()) {
+              char PBXBuildFile[32]; strcpy(PBXBuildFile, 
f->get_UUID_Xcode("Xcode4_PBXBuildFile"));
+              fprintf(out, "\t\t\t\t%s /* %s in %s */,\n", 
+                      PBXBuildFile, 
+                      f->filename_name(), 
+                      "Sources");
             }
-            src = src->next;
           }
           hash += 23;
         } else {

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to