Index: HexagonBase/hex.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/hexagon/HexagonBase/Attic/hex.info,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 hex.info
--- HexagonBase/hex.info	21 May 2010 18:22:37 -0000	1.1.2.5
+++ HexagonBase/hex.info	24 May 2010 18:06:39 -0000
@@ -103,31 +103,9 @@ settings[ie_style_link_limiter] = 0
 ; General patterns.
 file patterns[] = ^logo\.png$
 
-; Template files used for processing the registry and picking out template
-; suggestions.
-file patterns[theme:theme_hook_templates] =  ^[a-zA-Z0-9_-]+\.tpl\.php$
-
-; Support files for processing theming hooks.
-file patterns[all:theme_hook_includes] = ^[a-zA-Z0-9_-]+\.(func|vars|theme)\.inc$
-; Ignore the example files.
-ignore patterns[all:theme_hook_includes] = ^(OWNER|HOOK)[a-zA-Z0-9_-]*\.inc$
-
 ; Load these files on initialization:
 ;  - PLUGIN_NAME.plug.inc
 file patterns[all:init_include] = ^[a-zA-Z0-9_-]+\.(plug)\.inc$
 ; Ignore the example files.
 ;ignore patterns[plugin:include_init] = ^(PLUGIN_NAME)[a-zA-Z0-9._-]*\.inc$
 
-; Load these files on initialization when the theme registry must be rebuilt.
-; Anything containing a theme function or variable process function must be
-; included here in order for it to be discovered.
-;  - [theme|PLUGIN_NAME].cache.inc
-;  - [PLUGIN_NAME].plug.inc
-;  - [MODULE_NAME|THEME_NAME|PLUGIN_NAME].theme.inc
-;  - [HOOK_NAME].func.inc
-;  - [HOOK_NAME].vars.inc
-;  - template.php
-file patterns[all:init_include_registry_rebuild] = (^[a-zA-Z0-9_-]+\.(cache|theme|func|vars)\.inc$|^template.php$)
-; Ignore the example files.
-ignore patterns[all:init_include_registry_rebuild] = ^(OWNER|HOOK)[a-zA-Z0-9._-]*\.inc$
-
Index: HexagonBase/template.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/hexagon/HexagonBase/Attic/template.php,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 template.php
--- HexagonBase/template.php	21 May 2010 18:22:37 -0000	1.1.2.5
+++ HexagonBase/template.php	24 May 2010 18:06:39 -0000
@@ -54,17 +54,11 @@ function hex_init() {
 
   // See if the theme registry needs to be rebuilt.
   if ($registry_is_empty = !cache_get('theme_registry:' . hex_active_theme(), 'cache')) {
-    include_once drupal_get_path('theme', 'hex') . '/includes/build_theme_registry.inc';
-
+    include_once hex_theme_path('hex') . '/includes/build_theme_registry.inc';
     hex_clear_cache();
-
-    // Include necessary files for rebuilding the theme registry.
-    foreach (hex_group_file_paths('init_include_registry_rebuild', 'all') as $file_path) {
-      include_once $file_path;
-    }
   }
 
-  // Include general files.
+  // Include general files defined by .info or .pinfo.
   foreach (hex_group_file_paths('init_include', 'all') as $file_path) {
     include_once $file_path;
   }
@@ -96,7 +90,7 @@ function _hex_cache($key) {
     }
     else {
       // Build and store plugin data.
-      include_once drupal_get_path('theme', 'hex') . "/includes/build_$key.inc";
+      include_once hex_theme_path('hex') . "/includes/build_$key.inc";
       $cache[$key] = call_user_func("_hex_build_$key");
       cache_set("hex_$key:" . hex_active_theme(), $cache[$key]);
     }
Index: HexagonBase/includes/build_file_paths.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/hexagon/HexagonBase/includes/Attic/build_file_paths.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 build_file_paths.inc
--- HexagonBase/includes/build_file_paths.inc	21 May 2010 15:53:41 -0000	1.1.2.2
+++ HexagonBase/includes/build_file_paths.inc	24 May 2010 18:06:39 -0000
@@ -4,54 +4,47 @@
 /**
  * Scans for files based on regex patterns and returns an array of paths.
  * 
- * The scanning starts from base themes to connected sub-themes which are
- * currently active. This will ignore plug-ins.
- * 
- * @param $patterns
- *  Regex pattern to be compared with the name of the file. String or an array
- *  of strings are accepted.
- * @param $ignore_patterns
- *  Regex patterns to be compared with the full path including the name of the
- *  file. Any matches will be ignored. String or an array of strings are
- *  accepted.
- * @param $theme_offset
- *  This signals at which base or subtheme to start scanning as it digs further
- *  into connected subthemes.
+ * @see hex_get_file_paths()
  */
-function hex_theme_file_scan($patterns, $ignore_patterns = NULL, $theme_offset = NULL) {
+function _hex_get_file_paths($patterns, $ignore_patterns = NULL, $theme_offset = NULL) {
 
-  foreach (list_themes() as $theme => $theme_data) {
-    $theme_paths[$theme] = dirname($theme_data->filename);
-  }
-  foreach (hex_plugin_list('all') as $plugin) {
-    $plugin_paths[] = hex_plugin_path($plugin);
-  }
+  list($theme_paths, $plugin_paths, $ignore_all_plugins, $ignore_inactive_plugins) = _hex_prepare_paths();
 
-  // This path will be cut down in the next loop.
+  // This path will be cut down with each itteration in the following loop
+  // to prevent unintentional scanning of unconnected themes and to force
+  // a specific order while discovering files.
   $_ignore_paths = $theme_paths;
 
   $found_files = array();
 
-  $start_from_theme_key = $theme_offset;
-  // Sorted from base themes to their child sub-themes.
-  // This scanning order is necessary to guarantee the correct order in collecting paths.
-  foreach (hex_active_themes() as $theme_key) {
-    // This will be used to prevent the base theme from scanning child themes or any
-    // other theme that could possibly be inactive and live within the base theme.
-    unset($_ignore_paths[$theme_key]);
-
-    // If there's an offset and it does not match, skip the loop until it matches.
-    if (isset($start_from_theme_key) && $theme_key != $start_from_theme_key) {
-      continue;
-    }
-    elseif (isset($start_from_theme_key) && $theme_key == $start_from_theme_key) {
-      unset($start_from_theme_key);
+  foreach (hex_active_themes() as $theme) {
+    unset($_ignore_paths[$theme]);
+    $ignore_subthemes = array_values($_ignore_paths);
+
+    // Scan and process plug-in owned files first. This is important for
+    // cascading order. Theme files have the final hand in overriding files
+    // so process theme owned files later.
+    foreach (hex_plugin_list_by_owner($theme) as $plugin) {
+      foreach (hex_file_scan($plugin_paths[$plugin], $patterns, $ignore_inactive_plugins, $ignore_patterns) as $file_name => $paths) {
+        if (isset($found_files[$file_name])) {
+          $found_files[$file_name] = array_merge($found_files[$file_name], $paths);
+        }
+        else {
+          $found_files[$file_name] = $paths;
+        }
+        $found_files[$file_name] = array_unique($found_files[$file_name]);
+      }
     }
 
-    // Scan theme files but ignore plugins, inactive themes and sub-themes.
-    // Subthemes will be scanned in subsequent loops.
-    foreach (hex_file_scan(hex_theme_path($theme_key), $patterns, $_ignore_paths + $plugin_paths, $ignore_patterns) as $paths) {
-      $found_files = array_merge($found_files, $paths);
+    // Scan and process theme owned files. Theme owned files are placed last.
+    // Files listed later in the array have more importance in the cascade.
+    foreach (hex_file_scan($theme_paths[$theme], $patterns, array_merge($ignore_subthemes, $ignore_all_plugins), $ignore_patterns) as $file_name => $paths) {
+      if (isset($found_files[$file_name])) {
+        $found_files[$file_name] = array_merge($found_files[$file_name], $paths);
+      }
+      else {
+        $found_files[$file_name] = $paths;
+      }
     }
   }
 
@@ -71,27 +64,14 @@ function hex_theme_file_scan($patterns, 
  */
 function _hex_build_file_paths() {
 
-  foreach (list_themes() as $theme => $theme_data) {
-    $theme_paths[$theme] = dirname($theme_data->filename);
-  }
-  foreach (hex_plugin_list('all') as $plugin) {
-    $plugin_paths[$plugin] = hex_plugin_path($plugin);
-  }
-  // Build list of disabled plug-in paths to be ignored.
-  // Also build a list of active plug-in paths.
-  $plugin_paths_inactive = $plugin_paths;
-  foreach (hex_plugin_list() as $plugin) {
-    unset($plugin_paths_inactive[$plugin]);
-  }
-  $ignore_all_plugins = array_values($plugin_paths);
-  $ignore_inactive_plugins = array_values($plugin_paths_inactive);
+  list($theme_paths, $plugin_paths, $ignore_all_plugins, $ignore_inactive_plugins) = _hex_prepare_paths();
 
   // This path will be cut down with each itteration in the following loop
   // to prevent unintentional scanning of unconnected themes and to force
   // a specific order while discovering files.
   $_ignore_paths = $theme_paths;
 
-  $discovered_files = $patterns = array();
+  $found_files = $patterns = array();
 
   foreach (hex_active_themes() as $theme) {
 
@@ -101,31 +81,13 @@ function _hex_build_file_paths() {
     // Collect patterns!
     foreach (array('file patterns', 'ignore patterns') as $pattern_type) {
 
-      // Look for theme defined patterns first.
-      foreach (hex_theme_info($pattern_type, array(), $theme) as $set => $pattern) {
-        // Define search scope as pattern set.
-        $search_scopes = array('theme');
-        if (!is_string($set)) {
-          $set = 'general';
-        }
-        elseif (strpos($set, ':') !== FALSE) {
-          $search_scopes = explode(':', $set);
-          $set = array_pop($search_scopes);
-        }
-        foreach ($search_scopes as $scope) {
-          $patterns[$scope][$set][$pattern_type][] = $pattern;
-        }
-      }
-
-      // Do the same for plug-in's to allow their patterns to influence themes.
-      // This will not find files hosted within plug-in's though. That will be
-      // processed separately.
+      // First look for plug-in patterns.
       $current_theme_plugin_paths = array();
       foreach (hex_plugin_list_by_owner($theme) as $plugin) {
         $current_theme_plugin_paths[$plugin] = $plugin_paths[$plugin];
         foreach (hex_plugin_info($plugin, $pattern_type, array(), $theme) as $set => $pattern) {
-
-          // Define search scope as pattern set.
+          // Get search scope (prefixed) from pattern set. General sets defined
+          // from plug-ins default to the plug-in scope.
           $search_scopes = array('plugin');
           if (!is_string($set)) {
             $set = 'general';
@@ -137,7 +99,23 @@ function _hex_build_file_paths() {
           foreach ($search_scopes as $scope) {
             $patterns[$scope][$set][$pattern_type][] = $pattern;
           }
+        }
+      }
 
+      // Next, look for theme defined patterns.
+      foreach (hex_theme_info($pattern_type, array(), $theme) as $set => $pattern) {
+        // Get search scope (prefixed) from pattern set. General sets defined
+        // from themes default to the theme scope.
+        $search_scopes = array('theme');
+        if (!is_string($set)) {
+          $set = 'general';
+        }
+        elseif (strpos($set, ':') !== FALSE) {
+          $search_scopes = explode(':', $set);
+          $set = array_pop($search_scopes);
+        }
+        foreach ($search_scopes as $scope) {
+          $patterns[$scope][$set][$pattern_type][] = $pattern;
         }
       }
     }
@@ -156,27 +134,9 @@ function _hex_build_file_paths() {
           $pattern['ignore patterns'] = array();
         }
 
-        if ($scope == 'all' || $scope == 'theme') {
-          foreach (hex_file_scan($theme_paths[$theme], $pattern['file patterns'], array_merge($ignore_subthemes, $ignore_all_plugins), $pattern['ignore patterns']) as $file_name => $paths) {
-            if (isset($found_files[$scope][$set][$file_name])) {
-              $found_files[$scope][$set][$file_name] = array_merge($found_files[$scope][$set][$file_name], $paths);
-            }
-            else {
-              $found_files[$scope][$set][$file_name] = $paths;
-            }
-            // Add to theme scope key so it can be selective when called with
-            // the scope parameter in hex_path_to_file() and related functions.
-            if ($scope == 'all') {
-              if (isset($found_files['theme'][$set][$file_name])) {
-                $found_files['theme'][$set][$file_name] = array_merge($found_files[$scope][$set][$file_name], $paths);
-              }
-              else {
-                $found_files['theme'][$set][$file_name] = $paths;
-              }
-            }
-          }
-        }
-
+        // Scan and process plug-in owned files first. This is important for
+        // cascading order. Theme files have the final hand in overriding files
+        // so process theme owned files later.
         if ($scope == 'all' || $scope == 'plugin') {
           foreach ($current_theme_plugin_paths as $plugin => $path) {
             foreach (hex_file_scan($path, $pattern['file patterns'], $ignore_inactive_plugins, $pattern['ignore patterns']) as $file_name => $paths) {
@@ -199,7 +159,30 @@ function _hex_build_file_paths() {
                 }
                 $found_files['plugin'][$set][$file_name] = array_unique($found_files[$scope][$set][$file_name]);
               }
-              
+
+            }
+          }
+        }
+
+        // Scan and process theme owned files. Theme owned files are placed last.
+        // Files listed later in the array have more importance in the cascade.
+        if ($scope == 'all' || $scope == 'theme') {
+          foreach (hex_file_scan($theme_paths[$theme], $pattern['file patterns'], array_merge($ignore_subthemes, $ignore_all_plugins), $pattern['ignore patterns']) as $file_name => $paths) {
+            if (isset($found_files[$scope][$set][$file_name])) {
+              $found_files[$scope][$set][$file_name] = array_merge($found_files[$scope][$set][$file_name], $paths);
+            }
+            else {
+              $found_files[$scope][$set][$file_name] = $paths;
+            }
+            // Add to theme scope key so it can be selective when called with
+            // the scope parameter in hex_path_to_file() and related functions.
+            if ($scope == 'all') {
+              if (isset($found_files['theme'][$set][$file_name])) {
+                $found_files['theme'][$set][$file_name] = array_merge($found_files[$scope][$set][$file_name], $paths);
+              }
+              else {
+                $found_files['theme'][$set][$file_name] = $paths;
+              }
             }
           }
         }
@@ -212,6 +195,29 @@ function _hex_build_file_paths() {
 }
 
 /**
+ * Helper function for hex_get_file_paths() and _hex_build_file_paths().
+ * Prepares needed paths.
+ */
+function _hex_prepare_paths() {
+  foreach (list_themes() as $theme => $theme_data) {
+    $theme_paths[$theme] = dirname($theme_data->filename);
+  }
+  foreach (hex_plugin_list('all') as $plugin) {
+    $plugin_paths[$plugin] = hex_plugin_path($plugin);
+  }
+  // Build list of disabled plug-in paths to be ignored.
+  // Also build a list of active plug-in paths.
+  $plugin_paths_inactive = $plugin_paths;
+  foreach (hex_plugin_list() as $plugin) {
+    unset($plugin_paths_inactive[$plugin]);
+  }
+  $ignore_all_plugins = array_values($plugin_paths);
+  $ignore_inactive_plugins = array_values($plugin_paths_inactive);
+
+  return array($theme_paths, $plugin_paths, $ignore_all_plugins, $ignore_inactive_plugins);
+}
+
+/**
  * Pass a path and regex pattern, get an array of file paths in return.
  * 
  * @param $path
@@ -258,5 +264,3 @@ function hex_file_scan($path, $patterns,
 
   return $found_files;
 }
-
-
Index: HexagonBase/includes/build_plugins.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/hexagon/HexagonBase/includes/Attic/build_plugins.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 build_plugins.inc
--- HexagonBase/includes/build_plugins.inc	21 May 2010 06:42:02 -0000	1.1.2.1
+++ HexagonBase/includes/build_plugins.inc	24 May 2010 18:06:39 -0000
@@ -9,7 +9,7 @@ define(HEX_BASE_COMPATIBILITY, '1.x');
 function _hex_build_plugins() {
 
   // Needed for hex_file_scan().
-  include_once drupal_get_path('theme', 'hex') . '/includes/build_file_paths.inc';
+  include_once hex_theme_path('hex') . '/includes/build_file_paths.inc';
 
   foreach (list_themes() as $theme => $theme_data) {
     $theme_paths[$theme] = dirname($theme_data->filename);
Index: HexagonBase/includes/build_theme_registry.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/hexagon/HexagonBase/includes/Attic/build_theme_registry.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 build_theme_registry.inc
--- HexagonBase/includes/build_theme_registry.inc	21 May 2010 15:53:41 -0000	1.1.2.2
+++ HexagonBase/includes/build_theme_registry.inc	24 May 2010 18:06:39 -0000
@@ -28,7 +28,7 @@ function hex_theme() {
  *   suggestions discovery. Pairing a base template with its alternate is no
  *   longer necessary due to this change.
  */
-function _hex_theme_registry_alter(&$registry) {
+function _hex_theme_registry_alter(&$registry, $auto_includes = array()) {
 
   // If the modified registry doesn't behave as expected. Uncomment this to
   // inspect all modules which alter the theme registry. The modifications
@@ -47,16 +47,9 @@ function _hex_theme_registry_alter(&$reg
     $path_to_owner[hex_plugin_path($plugin)] = $plugin;
   }
 
-  // Prepare files for auto includes.
-  $auto_includes = array();
-  foreach (hex_group_file_paths('theme_hook_includes', 'all') as $file_path) {
-    $auto_includes[basename($file_path)][] = $file_path;
-  }
-
   // This will be used to find template suggestions.
-  $theme_templates = array();
-  foreach (hex_group_file_paths('theme_hook_templates') as $file_path) {
-    $theme_templates[basename($file_path)] = $file_path;
+  foreach (hex_get_file_paths('^[a-zA-Z0-9_-]+\.tpl\.php$') as $file_name => $file_paths) {
+    $theme_templates[$file_name] = array_pop($file_paths);
   }
 
   // Gather prefixes in the correct order.
@@ -156,7 +149,6 @@ function _hex_theme_registry_alter(&$reg
       }
 
       if (!empty($registry[$hook]['preprocess functions'])) {
-        $registry[$hook]['preprocess functions'][] = 'hex_func_preprocess_finalize';
         $registry[$hook]['arguments']['-hex']->hook = $hook;
         $registry[$hook]['arguments']['-hex']->type = 'function';
         $registry[$hook]['arguments']['-hex']->owner_type = $type_is_module ? 'module' : 'theme';
@@ -204,7 +196,6 @@ function _hex_theme_registry_alter(&$reg
       if ($includes_compatibility) {
         array_unshift($registry[$hook]['preprocess functions'], 'hex_process_includes');
       }
-      $registry[$hook]['preprocess functions'][] = 'hex_tpl_preprocess_finalize';
 
       // First create a filter so templates beginning with a similar prefix
       // as the current hook is not mistakenly added.
@@ -215,14 +206,15 @@ function _hex_theme_registry_alter(&$reg
         }
       }
 
-      // Filter for template suggestions.
-      $template_alts = array();
+      // Filter for template suggestions to get to their paths.
       foreach ($theme_templates as $name => $template_path) {
         if (preg_match('/^' . str_replace('_', '-', $hook) . '[a-zA-Z0-9_-]+\.tpl\.php$/', $name)) {
           if (!empty($tpl_filter) && preg_match('/^(' . implode('|', $tpl_filter) . ')[a-zA-Z0-9_-]*\.tpl\.php$/', $name)) {
             continue;
           }
-          $template_alts[basename($name, '.tpl.php')] = $template_path;
+          if (!in_array(dirname($template_path), $info['theme paths'])) {
+            $registry[$hook]['theme paths'][] = dirname($template_path);
+          }
         }
       }
 
@@ -232,7 +224,6 @@ function _hex_theme_registry_alter(&$reg
       $registry[$hook]['arguments']['-hex']->original_owner = $original_owner;
       $registry[$hook]['arguments']['-hex']->current_owner  = $current_owner;
       $registry[$hook]['arguments']['-hex']->arguments = !empty($info['arguments']) ? array_keys($info['arguments']) : array();
-      $registry[$hook]['arguments']['-hex']->template_alts = $template_alts;
       $registry[$hook]['arguments']['-hex']->post_render_callback = '';
     }
 
@@ -251,11 +242,11 @@ function _hex_theme_registry_alter(&$reg
     // noticed only when unserializing very large data sets. Something we aren't
     // doing here. And this will seldom run anyways.
     if ($state_for_module_theme_function_hook && $state_for_module_theme_function_hook != serialize($registry[$hook])) {
-      $registry[$hook]['type'] = 'base_theme';
+      $registry[$hook]['type'] = 'module:theme_altered';
     }
     // Hook templates owned by modules are always changed.
     elseif ($hook_is_template && $type_is_module) {
-      $registry[$hook]['type'] = 'base_theme';
+      $registry[$hook]['type'] = 'module:theme_altered';
     }
   }
 
@@ -280,6 +271,27 @@ function _hex_build_registry() {
   $theme = $theme_info;
   $base_theme = $base_theme_info;
 
+  // Prepare files for auto includes.
+  $auto_includes = array();
+  // Load these files on initialization when the theme registry must be rebuilt.
+  // Anything containing a theme function or variable process function must be
+  // included here in order for it to be discovered.
+  //  - [theme|PLUGIN_NAME].cache.inc
+  //  - [PLUGIN_NAME].plug.inc
+  //  - [MODULE_NAME|THEME_NAME|PLUGIN_NAME].theme.inc
+  //  - [HOOK_NAME].func.inc
+  //  - [HOOK_NAME].vars.inc
+  //  - template.php
+  // Second parameter used to ignore example files.
+  foreach (hex_get_file_paths('(^[a-zA-Z0-9_-]+\.(cache|theme|func|vars)\.inc$|^template.php$)', '^(OWNER|HOOK)[a-zA-Z0-9._-]*\.inc$') as $file_name => $file_paths) {
+    foreach ($file_paths as $file_path) {
+      $auto_includes[$file_name][] = $file_path;
+      // Included early to allow function discovery.
+      include_once $file_path;
+    }
+  }
+
+
   ////////////////////////////////////////////////////////////////////////////
   // COPY START _theme_build_registry() //////////////////////////////////////
 
@@ -321,7 +333,7 @@ function _hex_build_registry() {
   drupal_alter('theme_registry', $cache);
 
   // Final alterations, save then set.
-  _hex_theme_registry_alter($cache);
+  _hex_theme_registry_alter($cache, $auto_includes);
   _theme_save_registry($theme_info, $cache);
   _theme_set_registry($cache);
 
Index: HexagonBase/includes/file_paths.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/hexagon/HexagonBase/includes/Attic/file_paths.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 file_paths.inc
--- HexagonBase/includes/file_paths.inc	21 May 2010 06:42:02 -0000	1.1.2.1
+++ HexagonBase/includes/file_paths.inc	24 May 2010 18:06:39 -0000
@@ -77,3 +77,29 @@ function hex_list_file_groups() {
   return $list;
 }
 
+/**
+ * Scans for files based on regex patterns and returns an array of paths.
+ * 
+ * The scanning starts from base themes and their plug-ins to connected
+ * sub-themes which are currently active.
+ * 
+ * This function should be seldom used as it can place quite a load on the
+ * server. Using the cached files for most file searches.
+ * 
+ * @param $patterns
+ *  Regex pattern to be compared with the name of the file. String or an array
+ *  of strings are accepted.
+ * @param $ignore_patterns
+ *  Regex patterns to be compared with the full path including the name of the
+ *  file. Any matches will be ignored. String or an array of strings are
+ *  accepted.
+ * @param $theme_offset
+ *  This signals at which base or subtheme to start scanning as it digs further
+ *  into connected subthemes.
+ * 
+ * @see _hex_get_file_paths()
+ */
+function hex_get_file_paths($patterns, $ignore_patterns = NULL, $theme_offset = NULL) {
+  include_once hex_theme_path('hex') . '/includes/build_file_paths.inc';
+  return _hex_get_file_paths($patterns, $ignore_patterns, $theme_offset);
+}
\ No newline at end of file
Index: HexagonBase/includes/theme_hook_process.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/hexagon/HexagonBase/includes/Attic/theme_hook_process.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 theme_hook_process.inc
--- HexagonBase/includes/theme_hook_process.inc	21 May 2010 06:42:02 -0000	1.1.2.2
+++ HexagonBase/includes/theme_hook_process.inc	24 May 2010 18:06:39 -0000
@@ -73,58 +73,6 @@ function hex_process_includes(&$variable
 }
 
 /**
- * Last preprocess function for templates.
- */
-function hex_tpl_preprocess_finalize(&$variables, $hook) {
-
-  if (isset($variables['template_files'])) {
-    $suggestions = $variables['template_files'];
-  }
-  if (isset($variables['template_file'])) {
-    $suggestions[] = $variables['template_file'];
-  }
-
-  $variables['-hex']->template_file = '';
-  // This allows templates to not be paired with the base template.
-  if (!empty($suggestions) && !empty($variables['-hex']->template_alts)) {
-    // Loop through suggestions in FIFO order.
-    foreach (array_reverse($suggestions) as $suggestion) {
-      if (isset($variables['-hex']->template_alts[$name . '.tpl.php'])) {
-        $variables['-hex']->template_file = $variables['-hex']->template_alts[$name . '.tpl.php'];
-        // These are removed so Core doesn't have to go searching for what's been found over here.
-        unset($variables['template_files']);
-        unset($variables['template_file']);
-        break;
-      }
-    }
-  }
-
-}
-
-/**
- * Last preprocess function used only for theme functions.
- * 
- * This is where the original theme function is called.
- */
-function hex_func_preprocess_finalize(&$variables, $hook) {
-
-  if (isset($variables['template_file'])) {
-    unset($variables['template_file']);
-  }
-  if (isset($variables['template_files'])) {
-    unset($variables['template_files']);
-  }
-
-  // Set expected arguments for the theme function.
-  $args = array();
-  foreach ($variables['-hex']->arguments as $arg_key) {
-    $args[] = $variables[$arg_key];
-  }
-  $variables['-hex']->contents = call_user_func_array($variables['-hex']->function, $args);
-
-}
-
-/**
  * Render a template or pass through content set for theme functions using
  * variable preprocessors.
  * 
@@ -134,12 +82,14 @@ function hex_func_preprocess_finalize(&$
 function phptemplate_render_template($template_file, $variables) {
 
   if (isset($variables['-hex']->function)) {
-    $contents = $variables['-hex']->contents;
+    // Set expected arguments for the theme function.
+    $args = array();
+    foreach ($variables['-hex']->arguments as $arg_key) {
+      $args[] = $variables[$arg_key];
+    }
+    $contents = call_user_func_array($variables['-hex']->function, $args);
   }
   else {
-    if (!empty($variables['-hex']->template_file)) {
-      $template_file = $variables['-hex']->template_file;
-    }
     extract($variables, EXTR_REFS);  // Extract the variables to a local namespace
     ob_start();                      // Start output buffering
     include "./$template_file";      // Include the template file
Index: HexagonBase/plug-ins/smarter-styles/page.vars.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/hexagon/HexagonBase/plug-ins/smarter-styles/Attic/page.vars.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 page.vars.inc
--- HexagonBase/plug-ins/smarter-styles/page.vars.inc	21 May 2010 18:22:37 -0000	1.1.2.2
+++ HexagonBase/plug-ins/smarter-styles/page.vars.inc	24 May 2010 18:06:39 -0000
@@ -44,10 +44,7 @@ function smarter_styles_re_process_page(
           // If the file exists with the default path assume the themer intended to
           // use what was set. Otherwise, find a matching file on some other path.
           if (!file_exists($style_path)) {
-            $style_path = hex_path_to_file($basename, 'smarter_styles', 'theme');
-            if (!$style_path) {
-              $style_path = hex_path_to_file($basename, 'smarter_styles', 'plugin');
-            }
+            $style_path = hex_path_to_file($basename, 'smarter_styles', 'all');
           }
           $info_css[$media][$basename] = array(
             'basename'   => $basename,
@@ -72,10 +69,7 @@ function smarter_styles_re_process_page(
           continue;
         }
         if (!isset($added_css[$media][$basename])) {
-          $override_style_path = hex_path_to_file($basename, 'smarter_styles', 'theme');
-          if (!$override_style_path) {
-            $override_style_path = hex_path_to_file($basename, 'smarter_styles', 'plugin');
-          }
+          $override_style_path = hex_path_to_file($basename, 'smarter_styles', 'all');
           $added_css[$media][$basename] = array(
             'basename'   => $basename,
             'group'      => $preprocess ? 'main' : 'sub',
@@ -99,10 +93,7 @@ function smarter_styles_re_process_page(
         foreach ($scripts[$script_type] as $script_path => $script_data) {
           $basename = basename($script_path, '.js') . '-js.css';
           // Path to style must exist.
-          $style_path = hex_path_to_file($basename, 'smarter_styles', 'theme');
-          if (!$style_path) {
-            $style_path = hex_path_to_file($basename, 'smarter_styles', 'plugin');
-          }
+          $style_path = hex_path_to_file($basename, 'smarter_styles', 'all');
           if ($style_path) {
             $script_css[$media][$basename] = array(
               'basename'   => $basename,
@@ -234,15 +225,8 @@ function _smarter_styles_get_alt($style,
   if (file_exists($alt_path = dirname($style['path']) . '/' .  basename($style['basename'], '.css') . $suffix)) {
     $return_path = $alt_path;
   }
-  else {
-    $basename = str_replace('.css', $suffix, $style['basename']);
-    $alt_path = hex_path_to_file($basename, 'smarter_styles', 'theme');
-    if (!$alt_path) {
-      $alt_path = hex_path_to_file($basename, 'smarter_styles', 'plugin');
-    }
-    if ($alt_path) {
-      $return_path = $alt_path;
-    }
+  elseif ($alt_path = hex_path_to_file(str_replace('.css', $suffix, $style['basename']), 'smarter_styles', 'all')) {
+    $return_path = $alt_path;
   }
   return $return_path;
 }
