Author: zoltan
Date: 2007-09-28 11:42:34 -0400 (Fri, 28 Sep 2007)
New Revision: 86581
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/xaml.cpp
trunk/moon/src/xaml.h
Log:
2007-09-28 Zoltan Varga <[EMAIL PROTECTED]>
* xaml.cpp (SetNameAttribute): New callback to enable managed code to
process
x:Name attributes.
(LoadCode): Change return type to bool to indicate a loading error.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2007-09-28 15:09:08 UTC (rev 86580)
+++ trunk/moon/src/ChangeLog 2007-09-28 15:42:34 UTC (rev 86581)
@@ -1,3 +1,9 @@
+2007-09-28 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * xaml.cpp (SetNameAttribute): New callback to enable managed code to
process
+ x:Name attributes.
+ (LoadCode): Change return type to bool to indicate a loading error.
+
2007-09-28 Jeffrey Stedfast <[EMAIL PROTECTED]>
* media.cpp (SingleMedia::~SingleMedia): Close the media stream.
@@ -89,6 +95,14 @@
* text.cpp: Unref a few newly created objects.
* control.cpp: Remove an unnecessary ref.
+2007-09-26 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * text.cpp (SetValue): Implement proper handling of the Text property.
+ (GetValue): Ditto.
+ (OnPropertyChanged): Force a relayout when the foreground property
changes.
+ (Layout): Remove the laying out of the contents of the Text property,
since the
+ text is now contained in the first inline.
+
2007-09-26 Jeffrey Stedfast <[EMAIL PROTECTED]>
* font.cpp (Layout): Include the space char on the line before
Modified: trunk/moon/src/xaml.cpp
===================================================================
--- trunk/moon/src/xaml.cpp 2007-09-28 15:09:08 UTC (rev 86580)
+++ trunk/moon/src/xaml.cpp 2007-09-28 15:42:34 UTC (rev 86581)
@@ -259,6 +259,8 @@
if (!strcmp ("Name", attr)) {
p->namescope->RegisterName (value, (DependencyObject *)
item->item);
item->item->SetValue (DependencyObject::NameProperty,
Value (value));
+ if (p->loader)
+ p->loader->SetNameAttribute (item->item, value);
return;
}
@@ -415,6 +417,15 @@
//printf ("XamlLoader::SetAttribute (%p, %s, %s)\n", target, name,
value);
}
+void
+XamlLoader::SetNameAttribute (void* target, const char* name)
+{
+ if (callbacks.set_name_attribute) {
+ callbacks.set_name_attribute (target, name);
+ return;
+ }
+}
+
bool
XamlLoader::HookupEvent (void* target, const char* name, const char* value)
{
@@ -496,11 +507,15 @@
return result;
}
-void
+bool
XamlLoader::LoadCode (const char *source, const char *type)
{
+ if (!vm_loaded)
+ LoadVM ();
+
if (callbacks.load_code)
return callbacks.load_code (source, type);
+ return false;
}
XamlLoader::XamlLoader (const char* filename, const char* str, Surface*
surface)
@@ -625,6 +640,7 @@
const char *source = NULL;
const char *type = NULL;
int i;
+ bool res;
i = 0;
while (attr [i]) {
@@ -635,8 +651,13 @@
i += 2;
}
- if (p->loader)
- p->loader->LoadCode (source, type);
+ if (p->loader) {
+ res = p->loader->LoadCode (source, type);
+
+ if (!res)
+ parser_error (p, "", "",
+ g_strdup_printf ("Unable to
load '%s'\n", source));
+ }
}
bool
Modified: trunk/moon/src/xaml.h
===================================================================
--- trunk/moon/src/xaml.h 2007-09-28 15:09:08 UTC (rev 86580)
+++ trunk/moon/src/xaml.h 2007-09-28 15:42:34 UTC (rev 86581)
@@ -24,7 +24,8 @@
typedef bool xaml_hookup_event_callback (void *target, const char *ename,
const char *evalue);
typedef void xaml_insert_mapping_callback (const char* key, const char*
value);
typedef const char* xaml_get_mapping_callback (const char* key);
-typedef void xaml_load_code_callback (const char *source, const char *type);
+typedef bool xaml_load_code_callback (const char *source, const char *type);
+typedef void xaml_set_name_attribute_callback (void *target, const char *name);
G_BEGIN_DECLS
@@ -52,11 +53,13 @@
xaml_get_mapping_callback *get_mapping;
xaml_insert_mapping_callback *insert_mapping;
xaml_load_code_callback *load_code;
+ xaml_set_name_attribute_callback *set_name_attribute;
XamlLoaderCallbacks () :
load_managed_object (NULL), set_custom_attribute (NULL),
hookup_event (NULL), get_mapping (NULL),
- insert_mapping (NULL), load_code (NULL)
+ insert_mapping (NULL), load_code (NULL),
+ set_name_attribute (NULL)
{
}
};
@@ -113,10 +116,11 @@
virtual DependencyObject* CreateManagedObject (const char* xmlns, const
char* name);
virtual DependencyObject* CreateManagedObject (const char* asm_name,
const char* asm_path, const char* name, const char* type_name);
virtual void SetAttribute (void* target, const char* name, const char*
value);
+ virtual void SetNameAttribute (void* target, const char* name);
virtual bool HookupEvent (void* target, const char* name, const char*
value);
virtual void InsertMapping (const char* key, const char* value);
const char* GetMapping (const char* key);
- void LoadCode (const char *source, const char *type);
+ bool LoadCode (const char *source, const char *type);
char* GetFilename () { return filename; }
char* GetString () { return str; }
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches