Skip to content

Commit

Permalink
fixing stuff ...
Browse files Browse the repository at this point in the history
  • Loading branch information
braunms committed Sep 12, 2023
1 parent ae9ee22 commit 11912ee
Show file tree
Hide file tree
Showing 23 changed files with 594 additions and 557 deletions.
71 changes: 46 additions & 25 deletions Core/GUI/ColorTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,42 @@ public class ColorTheme

// DATA -----------------------------------------------------

public static Color StrokeSelected { get { return Colors.Red; } }
public static Color StrokeDefault { get { return Color.FromArgb(0x00, 0x00, 0x00, 0x00); } }
public static Color Color_StrokeSelected { get { return Colors.Red; } }
public static Color Color_StrokeDefault { get { return Color.FromArgb(0x00, 0x00, 0x00, 0x00); } }

public static Random random_generator = new Random();

public static Color RandomColor()
{
byte alpha = 0xAF;
int size = 2048; // in bytes
byte[] b = new byte[size];
random_generator.NextBytes(b);
var r_index = random_generator.Next(0, size - 1);
var g_index = random_generator.Next(0, size - 1);
var b_index = random_generator.Next(0, size - 1);
var r_byte = 0x0F | b[r_index];
var g_byte = 0x0F | b[g_index];
var b_byte = 0x0F | b[b_index];
return Color.FromArgb(alpha, (byte)r_byte, (byte)g_byte, (byte)b_byte);
}


// GENERIC -----------------------------------------------------

public static Brush DarkBackground { get { return Brushes.Black; } }
public static Brush DarkForeground { get { return Brushes.Black; } }
public static Brush Brush_DarkBackground { get { return Brushes.Black; } }
public static Brush Brush_DarkForeground { get { return Brushes.Black; } }

public static Brush Brush_LightBackground { get { return Brushes.AliceBlue; } }
public static Brush Brush_LightForeground { get { return Brushes.AliceBlue; } }

public static Color Color_LightForeground { get { return Colors.AliceBlue; } }

public static Brush LightBackground { get { return Brushes.AliceBlue; } }
public static Brush LightForeground { get { return Brushes.WhiteSmoke; } }


// TEXT -----------------------------------------------------------

public static Brush TextDisabled { get { return Brushes.DimGray; } }
public static Brush Brush_TextDisabled { get { return Brushes.DimGray; } }


// HYPER LINK ----------------------------------------------------
Expand All @@ -61,16 +82,16 @@ public static Style HyperlinkStyle()

// LOG MESSAGES ---------------------------------------------------

public static Brush LogMessageInfo { get { return Brushes.White; } }
public static Brush LogMessageDebug { get { return Brushes.Gray; } }
public static Brush LogMessageWarn { get { return Brushes.Yellow; } }
public static Brush LogMessageError { get { return Brushes.IndianRed; } }
public static Brush Brush_LogMessageInfo { get { return Brushes.White; } }
public static Brush Brush_LogMessageDebug { get { return Brushes.Gray; } }
public static Brush Brush_LogMessageWarn { get { return Brushes.Yellow; } }
public static Brush Brush_LogMessageError { get { return Brushes.IndianRed; } }


// GRID SPLITTER -------------------------------------------------

public static Brush GridSplitterBackground { get { return Brushes.SteelBlue; } }
public static Brush GridSplitterHovered { get { return Brushes.SkyBlue; } }
public static Brush Brush_GridSplitterBackground { get { return Brushes.SteelBlue; } }
public static Brush Brush_GridSplitterHovered { get { return Brushes.SkyBlue; } }
public static double GridSplitterSize { get { return 5.0; } }

public static Style GridSplitterStyle()
Expand All @@ -80,7 +101,7 @@ public static Style GridSplitterStyle()

Setter setter_background = new Setter();
setter_background.Property = GridSplitter.BackgroundProperty;
setter_background.Value = ColorTheme.GridSplitterBackground;
setter_background.Value = ColorTheme.Brush_GridSplitterBackground;
style.Setters.Add(setter_background);

// Create trigger for color change on mouse hover
Expand All @@ -89,7 +110,7 @@ public static Style GridSplitterStyle()
trigger.Value = true;
Setter setter_trigger = new Setter();
setter_trigger.Property = GridSplitter.BackgroundProperty;
setter_trigger.Value = ColorTheme.GridSplitterHovered;
setter_trigger.Value = ColorTheme.Brush_GridSplitterHovered;
trigger.Setters.Add(setter_trigger);
style.Triggers.Add(trigger);

Expand All @@ -106,7 +127,7 @@ public static Style ContentMenuStyle()

Setter setter_background = new Setter();
setter_background.Property = Grid.BackgroundProperty;
setter_background.Value = ColorTheme.LightBackground;
setter_background.Value = ColorTheme.Brush_LightBackground;
style.Setters.Add(setter_background);

Setter setter_height = new Setter();
Expand All @@ -124,12 +145,12 @@ public static Style CaptionStyle()

Setter setter_background = new Setter();
setter_background.Property = TextBlock.BackgroundProperty;
setter_background.Value = ColorTheme.LightBackground;
setter_background.Value = ColorTheme.Brush_LightBackground;
style.Setters.Add(setter_background);

Setter setter_foreground = new Setter();
setter_foreground.Property = TextBlock.ForegroundProperty;
setter_foreground.Value = ColorTheme.DarkForeground;
setter_foreground.Value = ColorTheme.Brush_DarkForeground;
style.Setters.Add(setter_foreground);

Setter setter_horiz = new Setter();
Expand All @@ -153,8 +174,8 @@ public static Style CaptionStyle()

// MENU -----------------------------------------------------------

public static Brush MenuBackground { get { return Brushes.SteelBlue; } }
public static Brush MenuForeground { get { return Brushes.White; } }
public static Brush Brush_MenuBackground { get { return Brushes.SteelBlue; } }
public static Brush Brush_MenuForeground { get { return Brushes.White; } }


public static Style MenuStyle()
Expand All @@ -164,12 +185,12 @@ public static Style MenuStyle()

Setter setter_background = new Setter();
setter_background.Property = Menu.BackgroundProperty;
setter_background.Value = ColorTheme.MenuBackground;
setter_background.Value = ColorTheme.Brush_MenuBackground;
style.Setters.Add(setter_background);

Setter setter_foreground = new Setter();
setter_foreground.Property = Menu.ForegroundProperty;
setter_foreground.Value = ColorTheme.MenuForeground;
setter_foreground.Value = ColorTheme.Brush_MenuForeground;
style.Setters.Add(setter_foreground);

Setter setter_height = new Setter();
Expand All @@ -183,8 +204,8 @@ public static Style MenuStyle()

// MENU ITEM ------------------------------------------------------

public static Brush MenuItemBackground { get { return Brushes.AliceBlue; } }
public static Brush MenuItemForeground { get { return Brushes.Black; } }
public static Brush Brush_MenuItemBackground { get { return Brushes.AliceBlue; } }
public static Brush Brush_MenuItemForeground { get { return Brushes.Black; } }

public static Style MenuItemStyle(string icon_filename = null)
{
Expand All @@ -200,7 +221,7 @@ public static Style MenuItemStyle(string icon_filename = null)
}
Setter setter_foreground = new Setter();
setter_foreground.Property = MenuItem.ForegroundProperty;
setter_foreground.Value = ColorTheme.MenuItemForeground;
setter_foreground.Value = ColorTheme.Brush_MenuItemForeground;
style.Setters.Add(setter_foreground);

return style;
Expand Down
6 changes: 4 additions & 2 deletions Core/GUI/Windows/WindowBranch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ public void ResetRoot()

if (_child_leaf != null)
{
_child_leaf.ResetLeaf();
/// XXX Don't do that because this will delete newly added visualizations having the same ID as the previous one:
//_child_leaf.ResetLeaf();
_child_leaf = null;
}
_orientation = SplitOrientation.None;
Expand Down Expand Up @@ -420,7 +421,8 @@ private void reset_window()
_children = null;
if (_child_leaf != null)
{
_child_leaf.ResetLeaf();
/// XXX Don't do that because this will delete newly added visualizations having the same ID as the previous one:
//_child_leaf.ResetLeaf();
_child_leaf = null;
}
_orientation = SplitOrientation.None;
Expand Down
4 changes: 2 additions & 2 deletions Core/GUI/Windows/WindowLeaf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ public WindowLeaf(WindowBranch parent_branch, bool parent_is_root, ContentCallba
}

_content = new Grid();
_content.Background = ColorTheme.LightBackground;
_content.Background = ColorTheme.Brush_LightBackground;
_content.Name = "grid_" + UniqueID.Generate();

var info_text = new TextBlock();
info_text.Text = " [Right-click for Context Menu]";
info_text.Foreground = ColorTheme.TextDisabled;
info_text.Foreground = ColorTheme.Brush_TextDisabled;
_content.Children.Add(info_text);

// Drag and drop
Expand Down
2 changes: 1 addition & 1 deletion Visualizations/Data/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public object RequestDataCallback(Type data_type)
}
else if (data_type == typeof(ParallelCoordinateDataSource<ExpandoObject>))
{
var variety = new DataVarietySciChartParallel<GenericPCPData>();
var variety = new DataVarietySciChartParallel<ExpandoObject>();
variety.Create(ref data, data.DataDimension(), data.ValueTypes());
_data_library.Add(variety.Variety, variety);
}
Expand Down
10 changes: 0 additions & 10 deletions Visualizations/Data/Interfaces/AbstractDataInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public abstract class AbstractDataInterface
/* ------------------------------------------------------------------*/
// public properties

public DataStyles DataStyle { get; set; }

public DataManager.RequestCallback_Delegate RequestDataCallback { get; set; }


Expand All @@ -51,14 +49,6 @@ public virtual bool Set(ref GenericDataStructure data_parent)
{
throw new InvalidOperationException("Call Set() method of derived class");
}

/// <summary>
/// TODO
/// </summary>
protected virtual Style ApplyStyle()
{
return null;
}
}
}
}
3 changes: 0 additions & 3 deletions Visualizations/Data/Interfaces/DataInterfaceGeneric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows;

using Core.Utilities;
using SciChart.Charting.Visuals.RenderableSeries;

using Visualizations.Abstracts;


Expand Down Expand Up @@ -36,7 +34,6 @@ public override bool Set(ref GenericDataStructure data_parent)
}

data_parent = data;

return true;
}
}
Expand Down
35 changes: 0 additions & 35 deletions Visualizations/Data/Interfaces/DataInterfaceSciChartParallel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
using SciChart.Charting.Visuals.RenderableSeries;
using Visualizations.Varieties;
using Visualizations.Abstracts;
using System.Windows;
using SciChart.Charting.ChartModifiers;



Expand Down Expand Up @@ -44,42 +42,9 @@ public override bool Set(object data_parent)
return false;
}

/// TODO parent.RenderableSeriesStyle = ApplyStyle();
parent.ParallelCoordinateDataSource = data;

return true;
}


/* ------------------------------------------------------------------*/
// protected functions

protected override Style ApplyStyle()
{
var default_style = new Style();
default_style.TargetType = typeof(SciChartParallelCoordinateSurface);

switch (DataStyle)
{
case (DataStyles.Lines):
{

}
break;
case (DataStyles.Columns):
{

}
break;
case (DataStyles.Points):
{

}
break;
default: break;
}
return default_style;
}
}
}
}
Loading

0 comments on commit 11912ee

Please sign in to comment.