Skip to content

Commit 7a9705b

Browse files
committed
Memory and theme enhancements
- Improved theming of the script editor - Fixed a parser issue in the lua interface - Fixed a memory leak - Fixed issue #5
1 parent d6c4875 commit 7a9705b

File tree

29 files changed

+364
-276
lines changed

29 files changed

+364
-276
lines changed

src/Couchcoding.Logbert.Gui/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.5.2.0")]
35-
[assembly: AssemblyFileVersion("1.5.2.0")]
34+
[assembly: AssemblyVersion("1.5.3.0")]
35+
[assembly: AssemblyFileVersion("1.5.3.0")]

src/Couchcoding.Logbert.Theme/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.5.2.0")]
35-
[assembly: AssemblyFileVersion("1.5.2.0")]
34+
[assembly: AssemblyVersion("1.5.3.0")]
35+
[assembly: AssemblyFileVersion("1.5.3.0")]

src/Couchcoding.Logbert.Theme/ThemeManager.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,19 @@ public static void ApplyTo(Control control)
9292
return;
9393
}
9494

95-
if (control is ContextMenuStrip contextMenuStripControl)
96-
{
97-
CurrentApplicationTheme.DockingTheme.ApplyTo(contextMenuStripControl);
98-
return;
99-
}
100-
10195
if (control is DockPanel dockPanelControl)
10296
{
10397
CurrentApplicationTheme.DockingTheme.ApplyTo(dockPanelControl);
104-
return;
10598
}
10699

107100
if (control is IThemable themableControl)
108101
{
109102
themableControl.ApplyTheme(CurrentApplicationTheme);
103+
}
110104

111-
foreach (Control childControl in themableControl.Controls)
112-
{
113-
ApplyTo(childControl);
114-
}
105+
foreach (Control childControl in control.Controls)
106+
{
107+
ApplyTo(childControl);
115108
}
116109
}
117110

src/Logbert/App.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,15 @@
561561
<setting name="UseInvertedColorForSelection" serializeAs="String">
562562
<value>False</value>
563563
</setting>
564+
<setting name="CodeElement_Identifier_ForegroundColor" serializeAs="String">
565+
<value>Blue</value>
566+
</setting>
567+
<setting name="CodeElement_Identifier_BackgroundColor" serializeAs="String">
568+
<value>White</value>
569+
</setting>
570+
<setting name="CodeElement_Identifier_FontStyle" serializeAs="String">
571+
<value>Regular</value>
572+
</setting>
564573
</Couchcoding.Logbert.Properties.Settings>
565574
</userSettings>
566575
<applicationSettings>

src/Logbert/Controls/Log4NetDetailsControl.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,11 @@ private void PbxCopyPropertiesClick(object sender, EventArgs e)
246246
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
247247
protected override void Dispose(bool disposing)
248248
{
249-
if (disposing && (components != null))
249+
if (disposing)
250250
{
251-
components.Dispose();
251+
components?.Dispose();
252+
253+
SelectLogMessage(null);
252254

253255
if (mBoldCaptionFont != null)
254256
{

src/Logbert/Controls/OptionPanels/OptionPanelScriptEditor.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,13 @@ public override string ToString()
130130
/// <param name="key">The settings key used to load existing values.</param>
131131
public static CodeElement Load(string name, string key)
132132
{
133-
CodeElement newElement = new CodeElement(name, key);
133+
CodeElement newElement = new CodeElement(name, key)
134+
{
135+
Forecolor = (Color)Settings.Default["CodeElement_" + key + "_ForegroundColor"],
136+
Backcolor = (Color)Settings.Default["CodeElement_" + key + "_BackgroundColor"],
137+
Style = (FontStyle)Settings.Default["CodeElement_" + key + "_FontStyle"]
138+
};
134139

135-
newElement.Forecolor = (Color) Settings.Default["CodeElement_" + key + "_ForegroundColor"];
136-
newElement.Backcolor = (Color) Settings.Default["CodeElement_" + key + "_BackgroundColor"];
137-
newElement.Style = (FontStyle)Settings.Default["CodeElement_" + key + "_FontStyle"];
138140

139141
return newElement;
140142
}
@@ -328,6 +330,7 @@ public override void InitializeControl()
328330
lstElements.Items.Add(CodeElement.Load("Bracket", "Bracket" ));
329331
lstElements.Items.Add(CodeElement.Load("Comment", "Comment" ));
330332
lstElements.Items.Add(CodeElement.Load("Default Text", "DefaultText" ));
333+
lstElements.Items.Add(CodeElement.Load("Identifier", "Identifier" ));
331334
lstElements.Items.Add(CodeElement.Load("Keyword", "Keyword" ));
332335
lstElements.Items.Add(CodeElement.Load("Logbert Function", "LogbertFunction"));
333336
lstElements.Items.Add(CodeElement.Load("Lua Function", "LuaFunction" ));

src/Logbert/Dialogs/Docking/FrmLogBookmarks.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ private void TsbZoomOutClick(object sender, System.EventArgs e)
209209
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
210210
protected override void Dispose(bool disposing)
211211
{
212-
if (disposing && (components != null))
212+
if (disposing)
213213
{
214-
components.Dispose();
215-
}
214+
components?.Dispose();
216215

217-
if (mBookmarkProvider != null)
218-
{
219-
mBookmarkProvider.RegisterBookmarkObserver(this);
216+
if (mBookmarkProvider != null)
217+
{
218+
mBookmarkProvider.UnregisterBookmarkObserver(this);
219+
}
220220
}
221221

222222
base.Dispose(disposing);

src/Logbert/Dialogs/Docking/FrmLogDocument.Designer.cs

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Logbert/Dialogs/Docking/FrmLogDocument.cs

Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
using Couchcoding.Logbert.Properties;
4444

4545
using WeifenLuo.WinFormsUI.Docking;
46-
using Couchcoding.Logbert.Gui.Helper;
47-
using Couchcoding.Logbert.Theme.Palettes;
4846
using Couchcoding.Logbert.Theme.Interfaces;
4947
using Couchcoding.Logbert.Theme;
5048
using Couchcoding.Logbert.Theme.Themes;
@@ -888,58 +886,60 @@ private void CmsSaveMessagesCsvClick(object sender, EventArgs e)
888886
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
889887
protected override void Dispose(bool disposing)
890888
{
891-
if (disposing && components != null)
889+
if (disposing)
892890
{
893-
components.Dispose();
894-
}
895-
896-
if (mLogProvider != null)
897-
{
898-
// Shutdown the logger functionality.
899-
mLogProvider.Shutdown();
900-
901-
try
902-
{
903-
// Save the current docking layout.
904-
using (MemoryStream memStream = new MemoryStream())
905-
{
906-
LogDockPanel.SaveAsXml(
907-
memStream
908-
, Encoding.UTF8);
909-
910-
memStream.Flush();
911-
912-
memStream.Seek(
913-
0
914-
, SeekOrigin.Begin);
915-
916-
if (memStream.Length > 0)
917-
{
918-
mLogProvider.SaveLayout(
919-
Encoding.UTF8.GetString(memStream.ToArray())
920-
, ((FrmLogWindow)mLogWindow).GetColumnLayout());
921-
}
922-
}
923-
}
924-
catch (Exception ex)
925-
{
926-
Logger.Error(
927-
"An error occured while saving the current docking layout: {0}"
928-
, ex.Message);
891+
components?.Dispose();
892+
893+
if (mLogProvider != null)
894+
{
895+
// Shutdown the logger functionality.
896+
mLogProvider.Shutdown();
897+
898+
try
899+
{
900+
// Save the current docking layout.
901+
using (MemoryStream memStream = new MemoryStream())
902+
{
903+
LogDockPanel.SaveAsXml(
904+
memStream
905+
, Encoding.UTF8);
906+
907+
memStream.Flush();
908+
909+
memStream.Seek(
910+
0
911+
, SeekOrigin.Begin);
912+
913+
if (memStream.Length > 0)
914+
{
915+
mLogProvider.SaveLayout(
916+
Encoding.UTF8.GetString(memStream.ToArray())
917+
, ((FrmLogWindow)mLogWindow).GetColumnLayout());
918+
}
919+
}
920+
}
921+
catch (Exception ex)
922+
{
923+
Logger.Error(
924+
"An error occured while saving the current docking layout: {0}"
925+
, ex.Message);
926+
}
927+
}
928+
929+
if (tmrUpdate != null && tmrUpdate.Enabled)
930+
{
931+
tmrUpdate.Tick -= TmrUpdateTick;
932+
933+
tmrUpdate.Stop();
934+
tmrUpdate.Dispose();
929935
}
930-
}
931936

932-
if (tmrUpdate != null && tmrUpdate.Enabled)
933-
{
934-
tmrUpdate.Tick -= TmrUpdateTick;
935-
936-
tmrUpdate.Stop();
937-
tmrUpdate.Dispose();
937+
((ILogFilterHandler)mLogWindow).UnregisterFilterProvider(this);
938+
((FrmLogWindow)mLogWindow).OnLogMessageSelected -= OnLogMessageSelected;
939+
940+
mLogMessages?.Clear();
938941
}
939942

940-
((ILogFilterHandler)mLogWindow).UnregisterFilterProvider(this);
941-
((FrmLogWindow)mLogWindow).OnLogMessageSelected -= OnLogMessageSelected;
942-
943943
base.Dispose(disposing);
944944
}
945945

@@ -1166,12 +1166,15 @@ public void SearchLogMessage(string pattern, bool searchForward = true, bool sea
11661166
}
11671167
}
11681168

1169-
/// <summary>
1170-
/// Applies the current theme to the <see cref="Control"/>.
1171-
/// </summary>
1169+
/// <summary>
1170+
/// Applies the current theme to the <see cref="Control"/>.
1171+
/// </summary>
11721172
/// <param name="theme">The <see cref="BaseTheme"/> instance to apply.</param>
1173-
public void ApplyTheme(BaseTheme theme)
1173+
public void ApplyTheme(BaseTheme theme)
11741174
{
1175+
txtTimeShift.BackColor = theme.ColorPalette.ContentBackground;
1176+
txtTimeShift.ForeColor = theme.ColorPalette.ContentForeground;
1177+
11751178
tsbShowTrace.Image = theme.Resources.Images["FrmMainTbTrace"];
11761179
tsbShowDebug.Image = theme.Resources.Images["FrmMainTbDebug"];
11771180
tsbShowInfo.Image = theme.Resources.Images["FrmMainTbInfo"];

src/Logbert/Dialogs/Docking/FrmLogDocument.resx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,28 +120,13 @@
120120
<metadata name="tsMessages.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121121
<value>17, 17</value>
122122
</metadata>
123-
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
124-
<data name="tsbTimeShiftUnit.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
125-
<value>
126-
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
127-
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
128-
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
129-
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
130-
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
131-
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
132-
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
133-
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
134-
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
135-
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
136-
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
137-
</value>
138-
</data>
139123
<metadata name="tmrUpdate.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
140124
<value>122, 17</value>
141125
</metadata>
142126
<metadata name="stBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
143127
<value>233, 17</value>
144128
</metadata>
129+
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
145130
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
146131
<value>
147132
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA

0 commit comments

Comments
 (0)