}
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);
}
}
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);
}
/// <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))
foreach (BindingDefinition bd in UnresolvedTargets) {
if (bd.HasUnresolvedTargetName) {
try {
- ResolveName (bd);
+ ResolveName (bd);
} catch (Exception ex) {
System.Diagnostics.Debug.WriteLine (ex.ToString ());
continue;
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);
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>
/// </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;
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);
}
base.OnLayoutChanges (layoutType);
if (layoutType == LayoutingType.Width)
- MinimumPopupSize = new Size (this.Slot.Width, minimumPopupSize.Height);
+ MinimumPopupSize = new Size (this.Slot.Width, minimumPopupSize.Height);
}
}
}
/// 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)
{
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);
}
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 ();