eda: Using 'Id' rather than uint or uint64
authorJerome St-Louis <jerome@ecere.com>
Wed, 2 Dec 2015 22:29:57 +0000 (17:29 -0500)
committerJerome St-Louis <jerome@ecere.com>
Tue, 22 Dec 2015 06:45:13 +0000 (01:45 -0500)
eda/drivers/sqlite/EDASQLite.ec
eda/libeda/src/gui.ec
eda/libeda/src/gui/TableEditor.ec
eda/libeda/src/idList.ec

index a81505c..7870abb 100644 (file)
@@ -1573,7 +1573,7 @@ class SQLiteRow : DriverRow
             FieldFindData * fieldFind = &findData[c]; \
             SQLiteField sqlFld = (SQLiteField)findData->field; \
             Class dataType = sqlFld.type; \
-            BindData(stmt, bindId++, sqlFld, (dataType.type == structClass || dataType.type == noHeadClass || dataType.type == normalClass) ? fieldFind->value.p : &fieldFind->value.i, null); \
+            BindData(stmt, bindId++, sqlFld, (dataType.type == structClass || dataType.type == noHeadClass || dataType.type == normalClass) ? fieldFind->value.p : &fieldFind->value.i64, null); \
          }
 
       if(numFields)
index ab52eba..04a9216 100644 (file)
@@ -116,14 +116,14 @@ public class TableDropBox : DropBox
    borderStyle = deep;
 
 public:
-   uint filter;
+   Id filter;
    bool filtered;
    Field nameField;
-   uint exclusion;
+   Id exclusion;
    Table table;
    Field filterField;
 
-   property uint filter
+   property Id filter
    {
       set
       {
@@ -133,7 +133,7 @@ public:
       get { return filter; }
    }
    property Field nameField { set { nameField = value; } }
-   property uint exclusion { set { exclusion = value; } }
+   property Id exclusion { set { exclusion = value; } }
    property Table table { set { table = value; if(!nameField && value) nameField = value.FindField(defaultNameField); } }
 
    virtual void Refill()
@@ -301,9 +301,9 @@ public class DropDataBox : DataBox
 
 public:
 
-   property uint filter { set { filtered = true; filter = value; } get { return filter; } }
+   property Id filter { set { filtered = true; filter = value; } get { return filter; } }
    property bool filtered { set { filtered = value; } }
-   property uint exclusion { set { exclusion = value; } }
+   property Id exclusion { set { exclusion = value; } }
    property Field filterField { set { filterField = value; } }
    property Field nameField { set { nameField = value; } }
    virtual void TableDropBox::RefillFunction();
@@ -314,7 +314,7 @@ public:
       if(editor)
       {
          TableDropBox dropBox = (TableDropBox) editor;
-         uint id = data ? *(uint *)data : MAXDWORD;
+         Id id = data ? *(Id *)data : MAXDWORD;
          void * notifyChanged = (void *)NotifyChanged;
 
          OnConfigure(dropBox);
@@ -344,8 +344,8 @@ public:
 private:
    Field nameField;
    Field filterField;
-   uint exclusion;
-   uint filter;
+   Id exclusion;
+   Id filter;
    bool filtered;
    bool showNone;
 }
@@ -570,9 +570,9 @@ public class FieldDropDataBox : FieldDataBox
    showNone = true;
 
 public:
-   property uint filter { set { filtered = true; filter = value; } get { return filter; } }
+   property Id filter { set { filtered = true; filter = value; } get { return filter; } }
    property bool filtered { set { filtered = value; } }
-   property uint exclusion { set { exclusion = value; } }
+   property Id exclusion { set { exclusion = value; } }
    property Field filterField { set { filterField = value; } }
    property Field nameField { set { nameField = value; } }
    virtual void TableDropBox::RefillFunction();
@@ -583,7 +583,7 @@ public:
       if(editor)
       {
          TableDropBox dropBox = (TableDropBox) editor;
-         uint id = data ? *(uint *)data : MAXDWORD;
+         Id id = data ? *(Id *)data : MAXDWORD;
          OnConfigure(dropBox);
          dropBox.Refill();
          if(id != MAXDWORD) dropBox.SelectRow(dropBox.FindSubRow(id));
@@ -606,8 +606,8 @@ public:
 private:
    Field nameField;
    Field filterField;
-   uint exclusion;
-   uint filter;
+   Id exclusion;
+   Id filter;
    bool filtered;
    bool showNone;
 }
@@ -762,7 +762,7 @@ public:
          list.NotifySelect(this, list, null, 0);
          if(!editor.modifiedDocument)
          {
-            uint id; // = table.rowsCount + 1; // this is bad with deleted rows, won't work, how to have unique id?
+            Id id; // = table.rowsCount + 1; // this is bad with deleted rows, won't work, how to have unique id?
             Row r { table };
 
             if(r.Last())   // this will reuse ids in cases where the item(s) with the last id have been deleted
@@ -885,14 +885,14 @@ public:
       }
    };
 
-   virtual void Window::NotifySelectListRow(ListSection listSection, uint64 id);
+   virtual void Window::NotifySelectListRow(ListSection listSection, Id id);
 
    void SelectListRow(DataRow row)
    {
       // Time startTime = GetTime();
       if(row)
       {
-         uint64 id = row.tag;
+         Id id = row.tag;
          lastRow = row;
 
          if(list.currentRow != row)
index c26fa68..9114e98 100644 (file)
@@ -462,13 +462,13 @@ public:
             {
                Row row { f.lookupFindIndex ? f.lookupFindIndex : f.lookupFindField.table };
                // todo: make this work for all types
-               uint id = 0;
+               Id id = 0;
                editRow.GetData(f.lookupValueField, id);
                // TODO: add alternative class instance for creation when no rows are found via lookup
                for(row.Find(f.lookupFindField, middle, nil, id); !row.nil; row.Next())
                {
                   // todo: make this work for all types, although this is meant to be an id field
-                  uint id = 0;
+                  Id id = 0;
                   TableEditor editor = eInstance_New(f.editorClass);
                   incref editor;
                   editor.parent = f.parentWindow;
@@ -523,7 +523,7 @@ public:
       //list.NotifySelect(this, list, null, 0);
       if(table && editRow && editRow.tbl && !modifiedDocument)
       {
-         uint id; // = table.rowsCount + 1; // this is bad with deleted rows, won't work, how to have unique id?
+         Id id; // = table.rowsCount + 1; // this is bad with deleted rows, won't work, how to have unique id?
                                // I think the 3 following comment lines apply to the old sqlite driver before many fix we done for wsms
          Row r = editRow;// { table }; // the multipurpose row is buggy with sqlite driver, you can't use the same row to do Row::Last(), Row::Next(), Row::Find(), etc...
          //Row r { editRow.tbl };                    // for example, Row::Last() here is not using the proper sqlite statement and fails to
@@ -2083,7 +2083,7 @@ struct WordEntryBinaryTree : BinaryTree
    void OnSerialize(IOChannel channel)
    {
       WordEntry node;
-      uint id;
+      Id id;
       DebugLn("WordEntryBinaryTree::OnSerialize");
       for(id = 1, node = (WordEntry)root; node;)
       {
@@ -2176,7 +2176,7 @@ class WordEntry : struct
 
    IdList items;
    IdList words;
-   uint id;
+   Id id;
 
    ~WordEntry()
    {
@@ -2199,7 +2199,7 @@ class WordEntry : struct
             channel.Serialize(words.count);
             for(c = 0; c < words.count; c++)
             {
-               uint id = (uint)((WordEntry)(uintptr)words.ids[c]).id;
+               Id id = (Id)((WordEntry)(uintptr)words.ids[c]).id;
                channel.Serialize(id);
             }
          }
@@ -2215,7 +2215,7 @@ class WordEntry : struct
       }
       else
       {
-         uint nothing = 0;
+         Id nothing = 0;
          channel.Serialize(nothing);
       }
 #endif
@@ -2224,7 +2224,7 @@ class WordEntry : struct
    void OnUnserialize(IOChannel channel)
    {
 #ifdef FULL_STRING_SEARCH
-      uint id;
+      Id id;
       channel.Unserialize(id);
       if(id)
       {
index 267a2b8..1293680 100644 (file)
@@ -67,8 +67,7 @@ public class Id : uint64
 
             bool DataBox::NotifySelect(DropBox control, DataRow row, Modifiers mods)
             {
-               // TOFIX: Id is still 32 bit
-               uint id = (uint)(row ? row.tag : 0);
+               Id id = (Id)(row ? row.tag : 0);
                SetData(&id, mods.closingDropDown);
                return true;
             }
@@ -155,7 +154,7 @@ public class Id : uint64
       dropBox.Create();
       dropBox.currentRow = dropBox.FindSubRow(this);
       if(!dropBox.currentRow && this)
-         dataBox.SetData((uint *)&this, false);
+         dataBox.SetData((Id *)&this, false);
       {
          DataRow r = dropBox.currentRow;
          if(r)
@@ -234,7 +233,7 @@ public class Id : uint64
          }
          else
          {
-            uint id = this;
+            Id id = this;
             id.OnGetString(tempString, null, null);
          }
       }
@@ -395,7 +394,7 @@ public:
          int c;
          for(c = 0; c<count; c++)
          {
-            uint64 idA = ids[c], idB = b.ids[c];
+            Id idA = ids[c], idB = b.ids[c];
             if(idA > idB) return 1;
             else if(idA < idB) return -1;
          }
@@ -971,7 +970,7 @@ public struct DataList : OldList
             // if(type.type != normalClass || strcmp(type.dataTypeString, "char *"))
             if(type)
             {
-               void * data = ((type.type == normalClass || type.type == noHeadClass || type.type == structClass) ? row.GetData(null) : (void *)(uintptr)*(uint *)row.GetData(null));
+               void * data = ((type.type == normalClass || type.type == noHeadClass || type.type == structClass) ? row.GetData(null) : (void *)(uintptr)*(Id *)row.GetData(null));
                if(!data)
                {
                   //if(strcmp(type.dataTypeString, char *"))