ide: Copying bold and size attributes for fonts
[sdk] / ide / src / panels / OutputView.ec
index dfef406..6da95d5 100644 (file)
@@ -21,8 +21,8 @@ class OutputView : Window
    size.h = 240;
    background = formColor;
 
-   virtual void OnGotoError(char * line, bool noParsing);
-   virtual void OnCodeLocationParseAndGoTo(char * line);
+   virtual void OnGotoError(const char * line, bool noParsing);
+   virtual void OnCodeLocationParseAndGoTo(const char * line);
 
    FindDialog findDialog { master = this, editBox = buildBox, isModal = true, autoCreate = false, text = "Find" };
 
@@ -39,7 +39,7 @@ class OutputView : Window
          return true;
       }
    };
-   
+
    Button debugBtn
    {
       this, inactive = true, text = "Debug", bevelOver = true, isRadio = true, bitmap = null;
@@ -52,7 +52,7 @@ class OutputView : Window
          return true;
       }
    };
-   
+
    Button findBtn
    {
       this, inactive = true, text = "Find", bevelOver = true, isRadio = true, bitmap = null;
@@ -115,21 +115,21 @@ class OutputView : Window
 
    EditBox activeBox;
    activeBox = buildBox;
-   
+
    LogBox buildBox
    {
       parent = this, freeCaret = true, autoEmpty = true, multiLine = true;
       readOnly = true, hasVertScroll = true, hasHorzScroll = true;
       anchor = Anchor { left = 0, right = 0, top = 23, bottom = 0 };
-      font = { panelFont.faceName, panelFont.size };
+      font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
       background = outputBackground;
       foreground = outputText;
       selectionColor = selectionColor, selectionText = selectionText;
-      
+
       bool NotifyDoubleClick(EditBox editBox, EditLine line, Modifiers mods)
       {
          OnGotoError(editBox.line.text, mods.ctrl && mods.shift);
-         return false; //true; // why not use true here? 
+         return false;
       }
 
       bool NotifyKeyDown(EditBox editBox, Key key, unichar ch)
@@ -142,24 +142,40 @@ class OutputView : Window
          return true;
       }
    };
-   
+
    LogBox debugBox
    {
       parent = this, freeCaret = true, autoEmpty = true, multiLine = true;
       readOnly = true, hasVertScroll = true, hasHorzScroll = true, visible = false;
       anchor = Anchor { left = 0, right = 0, top = 23, bottom = 0 };
-      font = { panelFont.faceName, panelFont.size };
+      font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
       background = outputBackground;
       foreground = outputText;
       selectionColor = selectionColor, selectionText = selectionText;
+
+      bool NotifyDoubleClick(EditBox editBox, EditLine line, Modifiers mods)
+      {
+         OnCodeLocationParseAndGoTo(editBox.line.text);
+         return false;
+      }
+
+      bool NotifyKeyDown(EditBox editBox, Key key, unichar ch)
+      {
+         if((SmartKey)key == enter)
+         {
+            OnCodeLocationParseAndGoTo(editBox.line.text);
+            return false;
+         }
+         return true;
+      }
    };
-   
+
    LogBox findBox
    {
       parent = this, freeCaret = true, autoEmpty = true, multiLine = true;
       readOnly = true, hasVertScroll = true, hasHorzScroll = true, visible = false;
       anchor = Anchor { left = 0, right = 0, top = 23, bottom = 0 };
-      font = { panelFont.faceName, panelFont.size };
+      font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
       background = outputBackground;
       foreground = outputText;
       selectionColor = selectionColor, selectionText = selectionText;
@@ -167,7 +183,7 @@ class OutputView : Window
       bool NotifyDoubleClick(EditBox editBox, EditLine line, Modifiers mods)
       {
          OnCodeLocationParseAndGoTo(editBox.line.text);
-         return false; //true;
+         return false;
       }
 
       bool NotifyKeyDown(EditBox editBox, Key key, unichar ch)
@@ -187,13 +203,13 @@ class OutputView : Window
       parent = this, freeCaret = true, autoEmpty = true, multiLine = true;
       readOnly = true, hasVertScroll = true, hasHorzScroll = true, visible = false;
       anchor = Anchor { left = 0, right = 0, top = 23, bottom = 0 };
-      font = { panelFont.faceName, panelFont.size };
+      font = { panelFont.faceName, panelFont.size, panelFont.bold, panelFont.italic };
       background = outputBackground;
       foreground = outputText;
       selectionColor = selectionColor, selectionText = selectionText;
    };
 #endif
-   
+
    Menu editMenu { menu, $"Edit", e };
 
    MenuItem item;
@@ -214,10 +230,10 @@ class OutputView : Window
    bool MenuEditFind(MenuItem selection, Modifiers mods)
    {
       int64 id = selection.id;
-      char * searchString = findDialog.searchString;
+      const char * searchString = findDialog.searchString;
       if(id != 2 && searchString[0])
       {
-         activeBox.Find(searchString, findDialog.wholeWord, findDialog.matchCase, (bool)id);
+         activeBox.Find(searchString, findDialog.wholeWord, findDialog.matchCase, id != 0);
          return true;
       }
       findDialog.Create();
@@ -227,6 +243,7 @@ class OutputView : Window
    void Show()
    {
       visible = true;
+      ide.RepositionWindows(false);
       Activate();
    }
    void ShowClearSelectTab(OutputViewTab tab)
@@ -253,7 +270,7 @@ class OutputView : Window
       {
          case shiftTab:
          {
-            OutputViewTab switchTo;
+            OutputViewTab switchTo = build;
             if(activeBox == buildBox)
 #ifdef GDB_DEBUG_OUTPUT
                switchTo = gdb;
@@ -296,7 +313,7 @@ class LogBox : EditBox
 {
    bool moved, logging, tell;
 
-   void Logf(char * format, ...)
+   void Logf(const char * format, ...)
    {
       char string[MAX_F_STRING*10];
       va_list args;
@@ -308,14 +325,7 @@ class LogBox : EditBox
       LogRaw(string);
    }
 
-   void LogSprintf(char * entry)
-   {
-      char string[MAX_F_STRING];
-      sprintf(string, entry);
-      LogRaw(string);
-   }
-
-   void LogRaw(char * entry)
+   void LogRaw(const char * entry)
    {
       // Cut the line longer than 1024 because Logf prints to a buffer (and we don't want to output crazy long lines either)
       //if(len > 1023) line[1023] = '\0';
@@ -325,7 +335,7 @@ class LogBox : EditBox
       if(len > 1023)
       {
          char * newStart, * start = entry;
-         
+
          while(len > 1023)
          {
             char backup[3];
@@ -343,7 +353,7 @@ class LogBox : EditBox
          Log(entry);
    }
 
-   void Log(char * string)
+   void Log(const char * string)
    {
       int x1, y1, x2, y2;
       Point scrl;
@@ -371,7 +381,7 @@ class LogBox : EditBox
       logging = false;
    }
 
-   void Tellf(char * format, ...)
+   void Tellf(const char * format, ...)
    {
       char string[MAX_F_STRING*10];
       va_list args;
@@ -383,7 +393,7 @@ class LogBox : EditBox
       Tell(string);
    }
 
-   void Tell(char * string)
+   void Tell(const char * string)
    {
       Log(string);
       if(!moved)