sdk: const correctness
[sdk] / ide / src / panels / ThreadsView.ec
index 011d57f..fc45561 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdarg.h>
 
 import "ecere"
+import "CodeEditor"
 
 class ThreadsView : Window
 {
@@ -17,7 +18,7 @@ class ThreadsView : Window
 
    bool moved, logging;
    FindDialog findDialog { master = this, editBox = editBox, isModal = true, autoCreate = false, text = "Find" };
-   
+
    BitmapResource bmpCursor            { ":codeMarks/cursor.png", window = this };
    BitmapResource bmpCursorError       { ":codeMarks/cursorError.png", window = this };
    BitmapResource bmpTopFrame          { ":codeMarks/topFrame.png", window = this };
@@ -49,6 +50,9 @@ class ThreadsView : Window
       parent = this, freeCaret = true, autoEmpty = true, multiLine = true, readOnly = true;
       hasVertScroll = true, hasHorzScroll = true, borderStyle = none;
       anchor = { left = 20, right = 0, top = 0, bottom = 0 };
+      background = viewsBackground;
+      foreground = viewsText;
+      selectionColor = selectionColor, selectionText = selectionText;
 
       bool NotifyDoubleClick(EditBox editBox, EditLine line, Modifiers mods)
       {
@@ -88,12 +92,12 @@ class ThreadsView : Window
 
    };
 
-   Menu editMenu { menu, "Edit", e };
+   Menu editMenu { menu, $"Edit", e };
    MenuItem item;
-   
+
    MenuItem copyItem
    {
-      editMenu, "Copy", c, ctrlC;
+      editMenu, $"Copy", c, ctrlC;
       bool NotifySelect(MenuItem selection, Modifiers mods)
       {
          editBox.Copy();
@@ -101,45 +105,45 @@ class ThreadsView : Window
       }
    };
    MenuDivider { editMenu };
-   MenuItem { editMenu, "Find Previous", e, Key { f3, shift = true }, NotifySelect = MenuEditFind, id = 0 };
-   MenuItem { editMenu, "Find Next", n, f3, NotifySelect = MenuEditFind, id = 1 };
-   MenuItem { editMenu, "Find", f, ctrlF, NotifySelect = MenuEditFind, id = 2 };
+   MenuItem { editMenu, $"Find Previous", e, Key { f3, shift = true }, NotifySelect = MenuEditFind, id = 0 };
+   MenuItem { editMenu, $"Find Next", n, f3, NotifySelect = MenuEditFind, id = 1 };
+   MenuItem { editMenu, $"Find", f, ctrlF, NotifySelect = MenuEditFind, id = 2 };
 
    bool MenuEditFind(MenuItem selection, Modifiers mods)
    {
-      int id = selection.id;
-      char * searchString = findDialog.searchString;
+      int64 id = selection.id;
+      const char * searchString = findDialog.searchString;
       if(id != 2 && searchString[0])
       {
-         editBox.Find(searchString, findDialog.wholeWord, findDialog.matchCase, id);
+         editBox.Find(searchString, findDialog.wholeWord, findDialog.matchCase, id != 0);
          return true;
       }
       findDialog.Create();
       return true;
    }
 
-   void Logf(char * format, ...)
+   void Logf(const char * format, ...)
    {
       char string[MAX_F_STRING*10];
-
       va_list args;
       va_start(args, format);
-      vsprintf(string, format, args);
+      vsnprintf(string, sizeof(string), format, args);
+      string[sizeof(string)-1] = 0;
       va_end(args);
 
       Log(string);
    }
-   void LogSprintf(char * entry)
+   void LogSprintf(const char * entry)
    {
       char string[MAX_F_STRING];
       sprintf(string, entry);
       Log(string);
    }
-   void LogRaw(char * entry)
+   void LogRaw(const char * entry)
    {
       Log(entry);
    }
-   void Log(char * string)
+   void Log(const char * string)
    {
       EditLine line1;
       EditLine line2;
@@ -173,6 +177,7 @@ class ThreadsView : Window
    void Show()
    {
       visible = true;
+      ide.RepositionWindows(false);
       Activate();
    }
 
@@ -183,7 +188,7 @@ class ThreadsView : Window
       int boxH = clientSize.h;
       int lineNumber;
       int activeThread, hitThread, signalThread;
-      
+
       if(OnGetThreadsInfo(&activeThread, &hitThread, &signalThread))
       {
          EditLine line;