aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-09-13 12:50:43 +0000
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-09-13 12:50:43 +0000
commit3e93e1e290952df1c9ed86ffea8835e2f12679a4 (patch)
treeed0d3e59e927977faad4bb1daf6568d833fe61e2
parent295c13d989a14a706e53bfa368a1c3562ceb0cbf (diff)
iface.POLLING_INTERVAL in the run loop, block comments for styling
-rw-r--r--Crow/src/Fill/BmpPicture.cs2
-rw-r--r--Crow/src/IML/IMLContext.cs8
-rw-r--r--Crow/src/Interface.cs17
-rw-r--r--Crow/src/Widgets/ComboBox.cs2
-rw-r--r--Crow/src/Widgets/TemplatedControl.cs7
-rw-r--r--Crow/src/styling/StyleReader.cs15
6 files changed, 35 insertions, 16 deletions
diff --git a/Crow/src/Fill/BmpPicture.cs b/Crow/src/Fill/BmpPicture.cs
index 8b72b8b3..6bf9add5 100644
--- a/Crow/src/Fill/BmpPicture.cs
+++ b/Crow/src/Fill/BmpPicture.cs
@@ -40,7 +40,7 @@ namespace Crow
}
using (Stream stream = iFace.GetStreamFromPath (Path)) {
load (stream);
- //loadBitmap (new System.Drawing.Bitmap (stream));
+ //loadBitmap (new System.Drawing.Bitmap (stream));
iFace.sharedPictures[Path] = new sharedPicture (image, Dimensions);
}
}
diff --git a/Crow/src/IML/IMLContext.cs b/Crow/src/IML/IMLContext.cs
index 5d66a5e0..a69f7b2d 100644
--- a/Crow/src/IML/IMLContext.cs
+++ b/Crow/src/IML/IMLContext.cs
@@ -49,10 +49,10 @@ namespace Crow.IML
il.Emit (OpCodes.Nop);
//set local GraphicObject to root object
ConstructorInfo ci = rootType.GetConstructor (
- BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public,
+ BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public,
null, Type.EmptyTypes, null);
if (ci == null)
- throw new Exception ("No default parameterless constructor found in " + rootType.Name);
+ throw new Exception ("No default parameterless constructor found in " + rootType.Name);
il.Emit (OpCodes.Newobj, ci);
il.Emit (OpCodes.Stloc_0);
CompilerServices.emitSetCurInterface (il);
@@ -125,7 +125,7 @@ namespace Crow.IML
}
/// <summary>
/// Stores all the names found in current iml for binding resolution if any of them
- /// are targeting named widget
+ /// are targeting named widget
/// </summary>
public void StoreCurrentName(string name){
if (!Names.ContainsKey(name))
@@ -136,7 +136,7 @@ namespace Crow.IML
foreach (BindingDefinition bd in UnresolvedTargets) {
if (bd.HasUnresolvedTargetName) {
try {
- ResolveName (bd);
+ ResolveName (bd);
} catch (Exception ex) {
System.Diagnostics.Debug.WriteLine (ex.ToString ());
continue;
diff --git a/Crow/src/Interface.cs b/Crow/src/Interface.cs
index b8e52a56..b46bf018 100644
--- a/Crow/src/Interface.cs
+++ b/Crow/src/Interface.cs
@@ -478,8 +478,10 @@ namespace Crow
public virtual void UpdateFrame () {
#if VKVG
Update ();
-#endif
Thread.Sleep (UPDATE_INTERVAL);
+#else
+ Thread.Sleep (POLLING_INTERVAL);
+#endif
}
public virtual void Quit () => Glfw3.SetWindowShouldClose (hWin, 1);
@@ -548,6 +550,11 @@ namespace Crow
const int INIT_QUEUE_CAPACITY = 512;
/// <summary>Time interval in milisecond between Updates of the interface</summary>
public static int UPDATE_INTERVAL = 5;
+ /// <summary>
+ /// Time interval in milisecond between Glfw polling for devices. Wait is done in
+ /// the 'UpdateFrame' method in the 'Run' cycle and may be overriden.
+ /// </summary>
+ public static int POLLING_INTERVAL = 1;
/// <summary>Crow configuration root path</summary>
public static string CROW_CONFIG_ROOT;
/// <summary>If true, mouse focus is given when mouse is over control</summary>
@@ -857,7 +864,7 @@ namespace Crow
/// </summary>
internal Dictionary<string, sharedPicture> sharedPictures = new Dictionary<string, sharedPicture> ();
- static bool tryGetResource (Assembly a, string resId, out Stream stream) {
+ static bool tryFindResource (Assembly a, string resId, out Stream stream) {
stream = null;
if (a == null)
return false;
@@ -871,17 +878,17 @@ namespace Crow
if (path.StartsWith ("#", StringComparison.Ordinal)) {
Stream stream = null;
string resId = path.Substring (1);
- if (tryGetResource (Assembly.GetEntryAssembly (), resId, out stream))
+ if (tryFindResource (Assembly.GetEntryAssembly (), resId, out stream))
return stream;
string[] assemblyNames = resId.Split ('.');
if (AppDomain.CurrentDomain.GetAssemblies ().FirstOrDefault (aa => aa.GetName ().Name == assemblyNames[0]).TryGetResource (resId, out stream))
return stream;
if (assemblyNames.Length > 3)
- if (tryGetResource (AppDomain.CurrentDomain.GetAssemblies ()
+ if (tryFindResource (AppDomain.CurrentDomain.GetAssemblies ()
.FirstOrDefault (aa => aa.GetName ().Name == $"{assemblyNames[0]}.{assemblyNames[1]}"), resId, out stream))
return stream;
foreach (Assembly ca in crowAssemblies)
- if (tryGetResource (ca, resId, out stream))
+ if (tryFindResource (ca, resId, out stream))
return stream;
throw new Exception ("Resource not found: " + path);
}
diff --git a/Crow/src/Widgets/ComboBox.cs b/Crow/src/Widgets/ComboBox.cs
index 22672645..22103ac3 100644
--- a/Crow/src/Widgets/ComboBox.cs
+++ b/Crow/src/Widgets/ComboBox.cs
@@ -28,7 +28,7 @@ namespace Crow
base.OnLayoutChanges (layoutType);
if (layoutType == LayoutingType.Width)
- MinimumPopupSize = new Size (this.Slot.Width, minimumPopupSize.Height);
+ MinimumPopupSize = new Size (this.Slot.Width, minimumPopupSize.Height);
}
}
}
diff --git a/Crow/src/Widgets/TemplatedControl.cs b/Crow/src/Widgets/TemplatedControl.cs
index 909c4bb8..c1e20eae 100644
--- a/Crow/src/Widgets/TemplatedControl.cs
+++ b/Crow/src/Widgets/TemplatedControl.cs
@@ -116,6 +116,9 @@ namespace Crow
/// It must be an embedded ressource with ID = fullTypeName.template
/// Entry assembly is search first, then the one where the type is defined
/// </summary>
+ /// <Remark>
+ /// Setting the default template path in style will provide an interned string for itor search.
+ /// </Remark>
/// <param name="template">Optional template instance</param>
protected virtual void loadTemplate(Widget template = null)
{
@@ -124,8 +127,8 @@ namespace Crow
if (template == null) {
try {
- string defTmpId = $"#{this.GetType ().FullName}.template";
- this.SetChild (IFace.GetInstantiator (defTmpId).CreateInstance());
+ string defaultTemplatePath = $"#{this.GetType().FullName}.template";
+ this.SetChild (IFace.GetInstantiator (defaultTemplatePath).CreateInstance());
} catch (Exception ex) {
throw new Exception ($"Default template loading error for '{this.GetType ().FullName}'", ex);
}
diff --git a/Crow/src/styling/StyleReader.cs b/Crow/src/styling/StyleReader.cs
index 2df90a22..23e3047c 100644
--- a/Crow/src/styling/StyleReader.cs
+++ b/Crow/src/styling/StyleReader.cs
@@ -89,9 +89,18 @@ namespace Crow
switch (Peek ()) {
case '/':
ReadChar ();
- if (PeekChar () != '/')
- throw new ParserException (line, column, "Unexpected char '/'", resId);
- ReadLine ();
+ if (PeekChar () == '/')
+ ReadLine ();
+ else if (PeekChar () == '*'){
+ while (!EndOfStream) {
+ char c = ReadChar ();
+ if (c == '*' && PeekChar () == '/') {
+ ReadChar();
+ break;
+ }
+ }
+ }else
+ throw new ParserException (line, column, $"Unexpected char '{PeekChar ()}'", resId);
break;
case ',':
ReadChar ();