Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Small changes in code editor + xshd #174

Merged
merged 5 commits into from

2 participants

mrvux joreg
mrvux

Quite minor, just moved hardcoded colors from codeeditor and searchbar to xshd.

mrvux

Bump, pluginIo fix went into that since was not merged

joreg joreg merged commit a4d6722 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 30, 2014
  1. mrvux

    Added more custom colors in definition template

    mrvux authored
    Code Editor and Search bar use colors from xshd instead of hardcoded values
  2. mrvux
Commits on Jan 31, 2014
  1. mrvux

    Added clear markers method.

    mrvux authored
    Clear search markers when we go out of search br
Commits on Feb 6, 2014
  1. mrvux
Commits on Feb 26, 2014
  1. mrvux
This page is out of date. Refresh to see the latest.
5 vvvv45/lib/thirdparty/CSharp-Mode.xshd
View
@@ -10,6 +10,11 @@
<CaretMarker color = "#F0F0F0"/>
<Custom name="TypeReference" bold="false" italic="false" color="#04ABAB" />
<Custom name="UnknownEntity" bold="false" italic="false" color="#AB0404" />
+ <Custom name="SearchResult" bold="false" italic="false" bgcolor="Beige" />
+ <Custom name="Link" bold="false" italic="false" color="Blue" />
+ <Custom name="Warning" bold="false" italic="false" color="Orange" />
+ <Custom name="Error" bold="false" italic="false" color="Red" />
+ <Custom name="TypeHighlight" bold="false" italic="false" bgcolor="LightGray" />
</Environment>
<Properties>
5 vvvv45/lib/thirdparty/HLSL-Mode.xshd
View
@@ -8,6 +8,11 @@
<VRuler color = "DarkGray"/>
<LineNumbers color = "Black" bgcolor = "#F0F0F0"/>
<CaretMarker color = "#F0F0F0"/>
+ <Custom name="SearchResult" bold="false" italic="false" bgcolor="Beige" />
+ <Custom name="Link" bold="false" italic="false" color="Blue" />
+ <Custom name="Warning" bold="false" italic="false" color="Orange" />
+ <Custom name="Error" bold="false" italic="false" color="Red" />
+ <Custom name="TypeHighlight" bold="false" italic="false" bgcolor="LightGray" />
</Environment>
<Properties>
9 vvvv45/src/core/PluginInterfaces/V2/Pin.cs
View
@@ -38,13 +38,14 @@ public class Pin<T> : Spread<T>, ISpread<T>, IDisposable
{
private readonly IIOFactory FFactory;
private readonly IPluginIO FPluginIO;
- private int FConnectionCount = 0;
+ private bool FConnected;
public Pin(IIOFactory factory, IPluginIO pluginIO, MemoryIOStream<T> stream)
: base(stream)
{
FFactory = factory;
FPluginIO = pluginIO;
+ FConnected = pluginIO.IsConnected;
FFactory.Connected += HandleConnected;
FFactory.Disconnected += HandleDisconnected;
@@ -63,7 +64,7 @@ public override string ToString()
public bool IsConnected
{
- get { return FConnectionCount > 0; }
+ get { return FConnected; }
}
public IPluginIO PluginIO
@@ -98,7 +99,7 @@ void HandleConnected(object sender, ConnectionEventArgs e)
{
if (e.PluginIO == FPluginIO)
{
- FConnectionCount++;
+ FConnected = this.PluginIO.IsConnected;
OnConnected(new PinConnectionEventArgs(e.OtherPin));
}
}
@@ -107,7 +108,7 @@ void HandleDisconnected(object sender, ConnectionEventArgs e)
{
if (e.PluginIO == FPluginIO)
{
- FConnectionCount--;
+ FConnected = this.PluginIO.IsConnected;
OnDisconnected(new PinConnectionEventArgs(e.OtherPin));
}
}
53 vvvv45/src/nodes/editors/CodeEditor/CodeEditor.cs
View
@@ -379,8 +379,19 @@ void FTextEditorControl_ActiveTextAreaControl_SelectionManager_SelectionChanged(
{
var offset = lineSegment.Offset + word.Offset + start;
var location = doc.OffsetToPosition(offset);
+
+ SD.TextMarker marker;
+
+ if (this.HasForeGround("TypeHighlight"))
+ {
+ marker = new SD.TextMarker(offset, selectedText.Length, SD.TextMarkerType.SolidBlock, this.GetBackColor("TypeHighlight"));
+ }
+ else
+ {
+ marker = new SD.TextMarker(offset, selectedText.Length, SD.TextMarkerType.SolidBlock,
+ this.GetBackColor("TypeHighlight"), this.GetForeColor("TypeHighlight"));
+ }
- var marker = new SD.TextMarker(offset, selectedText.Length, SD.TextMarkerType.SolidBlock, Color.LightGray);
FSelectionMarkers.Add(marker);
doc.MarkerStrategy.AddMarker(marker);
@@ -503,11 +514,11 @@ void MouseMoveCB(object sender, System.Windows.Forms.MouseEventArgs e)
var hoverRegion = FLink.HoverRegion;
int offset = doc.PositionToOffset(hoverRegion.ToTextLocation());
int length = hoverRegion.EndColumn - hoverRegion.BeginColumn;
-
- FUnderlineMarker = new SD.TextMarker(offset, length, SD.TextMarkerType.Underlined, Color.Blue);
+
+ FUnderlineMarker = new SD.TextMarker(offset, length, SD.TextMarkerType.Underlined, Document.HighlightingStrategy.GetColorFor("Link").Color);
doc.MarkerStrategy.AddMarker(FUnderlineMarker);
-
- FHighlightMarker = new SD.TextMarker(offset, length, SD.TextMarkerType.SolidBlock, Document.HighlightingStrategy.GetColorFor("Default").BackgroundColor, Color.Blue);
+
+ FHighlightMarker = new SD.TextMarker(offset, length, SD.TextMarkerType.SolidBlock, Document.HighlightingStrategy.GetColorFor("Default").BackgroundColor, Document.HighlightingStrategy.GetColorFor("Link").Color);
doc.MarkerStrategy.AddMarker(FHighlightMarker);
doc.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToLineEnd, doc.OffsetToPosition(offset)));
@@ -688,8 +699,8 @@ internal void ShowCompilerErrors(IEnumerable<CompilerError> compilerErrors)
foreach (var compilerError in compilerErrors)
{
var color = compilerError.IsWarning
- ? Color.Orange
- : Color.Red;
+ ? this.GetForeColor("Warning")
+ : this.GetForeColor("Error");
try
{
if (string.Compare(compilerError.FileName, TextDocument.LocalPath, StringComparison.InvariantCultureIgnoreCase) == 0)
@@ -710,7 +721,8 @@ internal void ClearCompilerErrors()
ClearErrorMarkers(FCompilerErrorMarkers);
Document.CommitUpdate();
}
-
+
+
List<SD.TextMarker> FRuntimeErrorMarkers = new List<SD.TextMarker>();
internal void ShowRuntimeErrors(IEnumerable<RuntimeError> runtimeErrors)
{
@@ -722,12 +734,12 @@ internal void ShowRuntimeErrors(IEnumerable<RuntimeError> runtimeErrors)
if (!string.IsNullOrEmpty(runtimeError.FileName))
{
if (string.Compare(runtimeError.FileName, TextDocument.LocalPath, StringComparison.InvariantCultureIgnoreCase) == 0)
- AddErrorMarker(FRuntimeErrorMarkers, 0, runtimeError.Line - 1, Color.Red);
+ AddErrorMarker(FRuntimeErrorMarkers, 0, runtimeError.Line - 1, this.GetForeColor("Error"));
}
else
{
// Showing the error in wrong editor is better than not to.
- AddErrorMarker(FRuntimeErrorMarkers, 0, 0, Color.Red);
+ AddErrorMarker(FRuntimeErrorMarkers, 0, 0, this.GetForeColor("Error"));
}
}
@@ -767,6 +779,27 @@ public void JumpTo(int line, int column)
ActiveTextAreaControl.Caret.Line = line;
ActiveTextAreaControl.Caret.Column = column;
}
+
+ private bool HasForeGround(string key)
+ {
+ return Document.HighlightingStrategy.GetColorFor(key).HasForeground;
+ }
+
+ private bool HasBackGround(string key)
+ {
+ return Document.HighlightingStrategy.GetColorFor(key).HasBackground;
+ }
+
+ private Color GetForeColor(string key)
+ {
+ return Document.HighlightingStrategy.GetColorFor(key).Color;
+ }
+
+
+ private Color GetBackColor(string key)
+ {
+ return Document.HighlightingStrategy.GetColorFor(key).BackgroundColor;
+ }
#region Code completion
32 vvvv45/src/nodes/editors/CodeEditor/Gui/SearchBar/SearchBar.cs
View
@@ -92,6 +92,7 @@ public void ShowSearchBar()
public void CloseSearchBar()
{
+ this.ClearMarkers();
Hide();
}
@@ -164,6 +165,21 @@ void FTextEditorControl_ActiveTextAreaControl_Resize(object sender, EventArgs e)
{
UpdateControlBounds();
}
+
+ private void ClearMarkers()
+ {
+ var doc = FTextEditorControl.Document;
+
+ foreach (var marker in FSearchMarkers)
+ {
+ var markerLocation = doc.OffsetToPosition(marker.Offset);
+
+ doc.MarkerStrategy.RemoveMarker(marker);
+
+ doc.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToLineEnd, markerLocation));
+ }
+ FSearchMarkers.Clear();
+ }
protected void JumpToOffset(TextAreaControl textAreaControl, IDocument doc, int offset)
{
@@ -180,16 +196,8 @@ protected void HighlightSearchText()
var markerStrategy = doc.MarkerStrategy;
// Clear all previous markers
- foreach (var marker in FSearchMarkers)
- {
- var markerLocation = doc.OffsetToPosition(marker.Offset);
-
- markerStrategy.RemoveMarker(marker);
-
- doc.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToLineEnd, markerLocation));
- }
- FSearchMarkers.Clear();
-
+ this.ClearMarkers();
+
var searchText = FSearchTextBox.Text;
var searchTextLength = searchText.Length;
var stringComparison = CaseSensitive ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;
@@ -205,8 +213,8 @@ protected void HighlightSearchText()
var lineSegment = doc.GetLineSegment(line);
var offset = lineSegment.Offset + startIndex;
var location = doc.OffsetToPosition(offset);
-
- var marker = new TextMarker(offset, searchTextLength, TextMarkerType.SolidBlock, Color.Beige);
+
+ var marker = new TextMarker(offset, searchTextLength, TextMarkerType.SolidBlock, doc.HighlightingStrategy.GetColorFor("SearchResult").BackgroundColor);
FSearchMarkers.Add(marker);
markerStrategy.AddMarker(marker);
Something went wrong with that request. Please try again.