diff mde/gui/WidgetDataSet.d @ 137:9f035cd139c6

BIG commit. Major change: old Options class is gone, all content values are loaded and saved automatically. All options updated to reflect this, some changed. Content restrutured a lot: New IContent module, Content module includes more functionality. New ContentLoader module to manage content loading/saving/translation. Translation module moved to content dir and cut down to reflect current usage. File format unchanged except renames: FontOptions -> Font, VideoOptions -> Screen. Font render mode and LCD filter options are now enums. GUI loading needs to create content (and set type for enums), but doesn't save/load value. Some setup of mainSchedule moved to mde.mainLoop. Content callbacks are called on content change now. ContentLists are set up implicitly from content symbols. Not as fast but much easier! Bug-fix in the new MTTagReader. Renamed MT *Reader maker functions to avoid confusion in paths.d. New mde.setup.logger module to allow logger setup before any other module's static this().
author Diggory Hardy <diggory.hardy@gmail.com>
date Sat, 07 Feb 2009 12:46:03 +0000
parents 41582439a42b
children 66c58e5b0062
line wrap: on
line diff
--- a/mde/gui/WidgetDataSet.d	Sun Feb 01 12:36:21 2009 +0000
+++ b/mde/gui/WidgetDataSet.d	Sat Feb 07 12:46:03 2009 +0000
@@ -29,7 +29,6 @@
 
 public import mde.gui.types;
 import mde.content.AStringContent;
-import Items = mde.content.Items;
 
 // For loading from file:
 import mt = mde.file.mergetag.DataSet;
@@ -43,9 +42,9 @@
     logger = Log.getLogger ("mde.gui.WidgetDataSet");
 }
 
-/*************************************************************************************************
+/******************************************************************************
  * Contains data for all widgets in a GUI.
- *************************************************************************************************/
+ *****************************************************************************/
 class WidgetDataSet : mt.IDataSection
 {
     //BEGIN Mergetag code
@@ -55,11 +54,9 @@
             widgetData[id] = deserialize!(WidgetData) (dt);
         } else if (tp == "WDims" && (id in dimData) is null) {
             dimData[id] = cast(wdims) deserialize!(int[]) (dt);
-        } else if (tp == "EnumContent" && (id in enumContent) is null) {
-            // Add dynamic content. NOTE: could confict with content from another design/section.
-            EnumContent a = new EnumContent (id, deserialize!(EnumContent.EnumCStruct) (dt));
-            enumContent[id] = a;
-            Items.addContent (a);
+        } else if (tp == "EnumContent" && (id in Content.allContent) is null) {
+            // Add dynamic content.
+            new EnumContent (id, deserialize!(char[][]) (dt));
         }
     }
     // Only WidgetDataChanges is used for writing.
@@ -85,7 +82,6 @@
 protected:
     WidgetData[widgetID] widgetData;    // Per-widget data
     wdims[widgetID] dimData;            // Per-widget sizes
-    EnumContent[char[]] enumContent;
 }
 
 /*************************************************************************************************
@@ -112,8 +108,6 @@
             dlg ("WidgetData", id, serialize!(WidgetData) (data));
         foreach (id,dim; dimData)
             dlg ("WDims", id, serialize!(int[]) (cast(int[]) dim));
-        foreach (id,c; base.enumContent)
-            dlg ("EnumContent", id, serialize (c.structOf));
     }
     //END Mergetag code
     
@@ -132,7 +126,7 @@
     
     /** Do any changes exist? True if no changes have been stored. */
     bool noChanges () {
-        return widgetData.length == 0 && dimData.length == 0 && enumContent.length == 0;
+        return widgetData.length == 0 && dimData.length == 0;
     }
     
     protected WidgetDataSet base;