Author: everaldo
Date: 2007-06-03 21:42:04 -0400 (Sun, 03 Jun 2007)
New Revision: 78520
Modified:
trunk/moon/plugin/ChangeLog
trunk/moon/plugin/moon-plugin-glue.cpp
trunk/moon/plugin/moon-plugin.cpp
trunk/moon/plugin/moon-plugin.h
Log:
[Clean up demo and make some class fields private ]
* moon-plugin-glue.c,
* moon-plugin.h,
* moon-plugin.c: Now just a surface control is added to plugn container,
some field is now private demo was refactored.
2007-06-03 Everaldo Canuto <[EMAIL PROTECTED]>
Modified: trunk/moon/plugin/ChangeLog
===================================================================
--- trunk/moon/plugin/ChangeLog 2007-06-04 01:14:49 UTC (rev 78519)
+++ trunk/moon/plugin/ChangeLog 2007-06-04 01:42:04 UTC (rev 78520)
@@ -1,5 +1,14 @@
2007-06-03 Everaldo Canuto <[EMAIL PROTECTED]>
+ [Clean up demo and make some class fields private ]
+
+ * moon-plugin-glue.c,
+ * moon-plugin.h,
+ * moon-plugin.c: Now just a surface control is added to plugn container,
+ some field is now private demo was refactored.
+
+2007-06-03 Everaldo Canuto <[EMAIL PROTECTED]>
+
* Makefile.am: Compile if needed for install-plugin target.
2007-06-03 Everaldo Canuto <[EMAIL PROTECTED]>
Modified: trunk/moon/plugin/moon-plugin-glue.cpp
===================================================================
--- trunk/moon/plugin/moon-plugin-glue.cpp 2007-06-04 01:14:49 UTC (rev
78519)
+++ trunk/moon/plugin/moon-plugin-glue.cpp 2007-06-04 01:42:04 UTC (rev
78520)
@@ -159,7 +159,7 @@
{
DEBUG ("plugin_new");
- PluginInstance *plugin = new PluginInstance ();
+ PluginInstance *plugin = new PluginInstance (instance, mode);
if (!instance)
return NPERR_INVALID_INSTANCE_ERROR;
@@ -175,8 +175,8 @@
memset (plugin, 0, sizeof (PluginInstance));
- plugin->mode = mode;
- plugin->instance = instance;
+ //plugin->mode = mode;
+ //plugin->instance = instance;
return NPERR_NO_ERROR;
}
Modified: trunk/moon/plugin/moon-plugin.cpp
===================================================================
--- trunk/moon/plugin/moon-plugin.cpp 2007-06-04 01:14:49 UTC (rev 78519)
+++ trunk/moon/plugin/moon-plugin.cpp 2007-06-04 01:42:04 UTC (rev 78520)
@@ -10,50 +10,35 @@
*
*/
-
#include "moon-plugin.h"
-#include "runtime.h"
-static void moon_plugin_demo (PluginInstance *plugin)
+static void moon_plugin_demo (Surface *surface)
{
DEBUG ("*** moon_plugin_demo");
- GtkWidget *w, *box, *button;
cairo_matrix_t trans;
Rectangle *r;
- box = gtk_hbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (plugin->container), box);
- gtk_widget_show_all (box);
-
- //button = gtk_button_new_with_label ("dingus");
- //gtk_container_add (GTK_CONTAINER (box), button);
-
- // Create our objects
- Surface *t = surface_new (300, 600);
- gtk_container_add (GTK_CONTAINER (box), t->drawing_area);
-
r = rectangle_new (50, 50, 100, 100);
Color c = Color (1.0, 0.0, 0.5, 0.5);
shape_set_stroke (r, new SolidColorBrush (c));
cairo_matrix_init_rotate (&trans, 0.4);
- //item_set_transform (r, (double *) (&trans));
- surface_repaint (t, 0, 0, 300, 300);
+ item_set_transform (r, (double *) (&trans));
+ surface_repaint (surface, 0, 0, 300, 300);
#if VIDEO_DEMO
UIElement *v, *v2;
v = video_new ("/home/everaldo/BoxerSmacksdownInhoffe.wmv", 0, 0);
- //item_transform_set (v, (double *) (&trans));
- panel_child_add (t, v);
+ item_set_transform (v, (double *) (&trans));
+ panel_child_add (surface, v);
v2 = video_new ("/home/everaldo/sawamu.wmv", 100, 30);
- panel_child_add (t, v2);
+ panel_child_add (surface, v2);
#endif
- panel_child_add (t, r);
+ panel_child_add (surface, r);
- gtk_widget_show_all (box);
//gtk_timeout_add (60, repaint, w);
}
@@ -115,8 +100,10 @@
return handled;
}
-PluginInstance::PluginInstance ()
+PluginInstance::PluginInstance (NPP instance, uint16 mode)
{
+ this->mode = mode;
+ this->instance = instance;
}
PluginInstance::~PluginInstance ()
@@ -147,8 +134,6 @@
this->window = window;
this->CreateControls ();
- //moon_plugin_create_window (this->instance, window);
-
return NPERR_NO_ERROR;
}
@@ -157,18 +142,16 @@
{
DEBUG ("creating window (%d,%d,%d,%d)", window->x, window->y,
window->width, window->height);
- //box = gtk_hbox_new (FALSE, 0);
-
- /* GtkPlug container and drawing canvas inside */
+ // GtkPlug container and surface inside
this->container = gtk_plug_new ((GdkNativeWindow) window->window);
- this->canvas = gtk_drawing_area_new ();
+ this->surface = surface_new (window->width, window->height);
+ gtk_container_add (GTK_CONTAINER (container),
this->surface->drawing_area);
+
+ // Connect signals to container
+ GTK_WIDGET_SET_FLAGS (GTK_WIDGET (this->container), GTK_CAN_FOCUS);
- gtk_container_add (GTK_CONTAINER (this->container), this->canvas);
-
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (this->canvas), GTK_CAN_FOCUS);
-
gtk_widget_add_events (
- this->canvas,
+ this->container,
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_KEY_PRESS_MASK |
@@ -182,12 +165,11 @@
GDK_FOCUS_CHANGE_MASK
);
- g_signal_connect (G_OBJECT(this->canvas), "event", G_CALLBACK
(plugin_event_callback), this);
+ g_signal_connect (G_OBJECT(this->container), "event", G_CALLBACK
(plugin_event_callback), this);
- //moon_plugin_demo (Instance);
+ moon_plugin_demo (this->surface);
- gtk_widget_show (this->canvas);
- gtk_widget_show (this->container);
+ gtk_widget_show_all (this->container);
}
NPError
Modified: trunk/moon/plugin/moon-plugin.h
===================================================================
--- trunk/moon/plugin/moon-plugin.h 2007-06-04 01:14:49 UTC (rev 78519)
+++ trunk/moon/plugin/moon-plugin.h 2007-06-04 01:42:04 UTC (rev 78520)
@@ -23,6 +23,8 @@
#include "glib.h"
#include "gtk/gtk.h"
+#include "runtime.h"
+
#define DEBUG_PLUGIN
#define PLUGIN_NAME "Novell MoonLight"
@@ -44,8 +46,13 @@
private:
void CreateControls ();
+ uint16 mode; // NP_EMBED, NP_FULL, or NP_BACKGROUND
+ NPWindow *window; // Mozilla window object
+ NPP instance; // Mozilla instance object
+ bool xembed_supported; // XEmbed Extension supported
+
public:
- PluginInstance ();
+ PluginInstance (NPP instance, uint16 mode);
~PluginInstance ();
NPError GetValue (NPPVariable variable, void *result);
@@ -59,13 +66,9 @@
void Print (NPPrint* platformPrint);
int16 EventHandle (void* event);
- uint16 mode; // NP_EMBED, NP_FULL, or NP_BACKGROUND
- NPWindow *window; // Mozilla window object
- NPP instance; // Mozilla instance object
- bool xembed_supported; // XEmbed Extension supported
-
GtkWidget *container; // plugin container object
GtkWidget *canvas; // plugin canvas object
+ Surface *surface; // plugin surface object
};
#endif /* MOON_PLUGIN */
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches