ide/CodeEditor: Customizable color scheme support
[sdk] / ide / src / panels / WatchesView.ec
index 973993e..f421c2a 100644 (file)
@@ -16,20 +16,23 @@ class WatchesView : Window
    {
       parent = this, hasHeader = true, hasVertScroll = true, alwaysEdit = true, collapseControl = true, resizable = true;
       anchor = Anchor { left = 0, right = 0, top = 0, bottom = 0 };
-      background = viewsBackground;
-      foreground = viewsText;
-      selectionColor = selectionColor, selectionText = selectionText;
+      /*
+      background = colorScheme.viewsBackground;
+      foreground = colorScheme.viewsText;
+      selectionColor = colorScheme.selectionColor;
+      selectionText = colorScheme.selectionText;
+      */
 
       bool NotifyChanged(ListBox listBox, DataRow row)
       {
          char * expression = row.GetData(expressionField);
-         
+
          if(expression && expression[0])
          {
             TrimLSpaces(expression, expression);
             TrimRSpaces(expression, expression);
          }
-         
+
          if(expression && expression[0])
          {
             row.SetData(valueField, null);
@@ -72,6 +75,13 @@ class WatchesView : Window
          }
          return true;
       }
+
+      bool NotifySelect(ListBox listBox, DataRow row, Modifiers mods)
+      {
+         if(listBox.currentField != expressionField)
+            listBox.currentField = expressionField;
+         return true;
+      }
    };
    DataField expressionField { "char *", true, width = 130, header = $"Expression" };
    DataField typeField { "Type", false, width = 180, header = $"Type" };
@@ -94,16 +104,6 @@ class WatchesView : Window
       return true;
    }
 
-   bool OnActivate(bool active, Window previous, bool * goOnWithActivation, bool direct)
-   {
-      if(active)
-      {
-         //listBox.SelectRow(listBox.firstRow);
-         ide.RepositionWindows(false);
-      }
-      return true;
-   }
-
    bool OnClose(bool parentClosing)
    {
       visible = false;
@@ -115,6 +115,7 @@ class WatchesView : Window
    void Show()
    {
       visible = true;
+      ide.RepositionWindows(false);
       Activate();
    }
 
@@ -127,7 +128,7 @@ class WatchesView : Window
    void AddWatch(Watch wh)
    {
       DataRow row = listBox.AddRowAfter(listBox.lastRow.previous);
-      row.tag = (int64)wh;
+      row.tag = (int64)(intptr)wh;
       wh.row = row;
       UpdateWatch(wh);
    }
@@ -155,6 +156,11 @@ class WatchesView : Window
       row.SetData(expressionField, null);
       row.SetData(typeField, null);
       row.SetData(valueField, null);
+      if(ide.workspace)
+      {
+         for(w : ide.workspace.watches)
+            w.row = null;
+      }
    }
 }
 
@@ -174,7 +180,7 @@ class WatchMultiLineString : String
             modifyVirtualArea = false,
             anchor = { 0, 0, 0, 0 };
             //position = { x + dataBox.absPosition.x, y + dataBox.absPosition.y };
-            //size = { w, h * 4 }; 
+            //size = { w, h * 4 };
             multiLine = true;
 
             bool OnKeyDown(Key key, unichar ch)
@@ -195,11 +201,11 @@ class WatchMultiLineString : String
 
             void DataBox::NotifyUpdate(EditBox editBox)
             {
-               Modified();          
+               Modified();
 
             }
          };
-         dataBox.size = { w, h * 4 + 2 }; 
+         dataBox.size = { w, h * 4 + 2 };
          if(dataBox.size.h + dataBox.position.y > dataBox.parent.clientSize.h)
             dataBox.position.y = dataBox.parent.clientSize.h - dataBox.size.h;
          if(dataBox.size.w + dataBox.position.x > dataBox.parent.clientSize.w)
@@ -258,7 +264,7 @@ class WatchMultiLineString : String
          char * string = this;
          char actualString[8196];
          int c, len = 0;
-         for(c = 0; (ch = string[c]); c++)
+         for(c = 0; (ch = string[c]) && len < sizeof(actualString)-1; c++)
          {
             if(ch == '\t') { actualString[len++] = '\\'; actualString[len++] = 't'; }
             else if(ch == '\r') { actualString[len++] = '\\'; actualString[len++] = 'r'; }