Commit 513a285a authored by Jose Maria Celorio's avatar Jose Maria Celorio
Browse files

more work. I'll start writing ChangeLog entries from now on

parent 9de1c2af
Chema Celorio <chema@ximian.com>
Thanks to :
Michal Palczewski <mpalczew@u.washington.edu>
Michal Palczewski <mpalczew@u.washington.edu> - Widget tree window
Neil Mock <mock_nt0@yahoo.com> - XML saving
Archit Baweja <bighead@crosswinds.net> - New widgets, _get_type
Shane Butler <shane_b@operamail.com> - Glade Widget signals
\ No newline at end of file
This is the current state of the TODO items for glade2. Please keep
in mind that for the first milestone we just want to clone the orignal
glade minus :
- gtk advanced widgets
- gnome/gnome-db widets
- bonobo controls
plus :
- Undo/redo
- Multiple project support
TODO
====
TAKEN ITEMS (someone is already working on)
-----------
- File loading and saving
- Cleaning and adding new .xml descriptions for widgets
- Signal editor
- Common part of the editor
OPEN ITEMS [PLease let me know before starting working on any of this]
----------
- Implement glade_widget_delete inside glade-widget.c, delete can already
be called from the popup menu.
- Implement the popup menu option "Select", it needs to create submenus for
every parent widget and a "Select" option inside it. Inside glade-popup.c
- Implement file opened history feature.
- Implement gtk stock buttons.
- gtklabels can't be selected. This looks like a fun thing and maybe tricky
to fix. I am guessing that gtklabeles don't like the idea of disabling
double buffering because of pango, but this is just a guess.
- Implement show clipboard (blocks on copy/cut)
- Fix "click thru". When we click on a widget we grab the mouse clicked event.
This does not allow checkbuttons to be set/unset or buttons to be pressed.
- Implement the menu bar widget and the menu editor.
- Implement the glade-property type "File". For example to be used with a pixmap
that specifies a file.
- Fix multiple lines GladeEditor text entries. See glade-editor.c,
function : glade_editor_create_input_text.
- Implement tooltips for the "Widget" page of the widget editor.
NOT-SO-EASY TO IMPLEMENT ITEMS
------------------------------
This items may prove tricky to implement if they are "done right"
- The packing tab of the editor
- Undo/Redo
- Copy/Cut/Paste
NOT YET (Items that we need to do, but are not a priority right now)
-------
- Implement the custom widget
......@@ -33,6 +33,7 @@ glade2_SOURCES = \
glade-cursor.c \
glade-property.c \
glade-property-class.c \
glade-popup.c \
glade-widget.c \
glade-catalog.c \
glade-choice.c \
......@@ -55,6 +56,7 @@ noinst_HEADERS = \
glade-widget-class.h \
glade-property.h \
glade-property-class.h \
glade-popup.h \
glade-choice.h \
glade-catalog.h \
glade-xml-utils.h
......@@ -424,7 +424,10 @@ glade_editor_create_input_text (GladeEditorProperty *property)
return entry;
} else {
#warning FIXME GtkText is not working
#if 0
#if 0
/* This code worked with the old gtk, but the GtkText widget was
* deprecated for VERY good reasons. Chema
*/
GtkWidget *text;
GtkWidget *scrolled_window;
gint line_height;
......
......@@ -39,8 +39,8 @@ glade_placeholder_replace_box (GladePlaceholder *placeholder,
GladeWidget *widget,
GladeWidget *parent)
{
/* Some Gtk Hackery. */
GtkBoxChild *child_info;
/* Some Gtk Hackery. Not beautifull but needed. */
GtkBoxChild *child_info = NULL;
GtkWidget *child;
GtkBox *box;
GList *list;
......@@ -78,8 +78,8 @@ glade_placeholder_replace_table (GladePlaceholder *placeholder,
GladeWidget *widget,
GladeWidget *parent)
{
/* Some Gtk Hackery */
GtkTableChild *table_child;
/* Some Gtk Hackery. Not beautifull, but needed */
GtkTableChild *table_child = NULL;
GtkWidget *child;
GtkTable *table;
GList *list;
......
......@@ -5,22 +5,22 @@
G_BEGIN_DECLS
void glade_placeholder_add (GladeWidgetClass *class,
GladeWidget *widget,
GladePropertyQueryResult *result);
GladeWidget *widget,
GladePropertyQueryResult *result);
GladeWidget * glade_placeholder_get_parent (GladePlaceholder *placeholder);
/* Hacks */
void glade_placeholder_replace_box (GladePlaceholder *place_holder,
GladeWidget *widget,
GladeWidget *parent);
GladeWidget *widget,
GladeWidget *parent);
void glade_placeholder_replace_table (GladePlaceholder *placeholder,
GladeWidget *widget,
GladeWidget *parent);
GladeWidget *widget,
GladeWidget *parent);
void glade_placeholder_replace_container (GladePlaceholder *placeholder,
GladeWidget *widget,
GladeWidget *parent);
GladeWidget *widget,
GladeWidget *parent);
G_END_DECLS
......
......@@ -231,7 +231,7 @@ glade_project_view_add_item (GladeProjectView *view,
WIDGET_COLUMN, widget,
-1);
glade_project_selection_set (view->project, widget, TRUE);
glade_project_selection_set (widget, TRUE);
}
......@@ -298,7 +298,7 @@ glade_project_view_selection_changed_cb (GtkTreeSelection *selection,
if (widget == NULL)
return TRUE;
glade_project_selection_set (view->project, widget, TRUE);
glade_project_selection_set (widget, TRUE);
return TRUE;
}
......@@ -313,7 +313,7 @@ glade_project_view_create_widget (GladeProjectView *view)
GtkWidget *widget;
GtkWidget *scrolled_window;
model = gtk_tree_store_new_with_types (1, GTK_TYPE_POINTER);
model = gtk_tree_store_new (1, GTK_TYPE_POINTER);
view->model = model;
glade_project_view_populate_model (model, view);
......@@ -321,7 +321,7 @@ glade_project_view_create_widget (GladeProjectView *view)
cell = gtk_cell_renderer_text_pixbuf_new ();
column = gtk_tree_view_column_new_with_attributes ("Widget", cell, NULL);
gtk_tree_view_column_set_cell_data_func (column, glade_project_view_cell_function, NULL, NULL);
gtk_tree_view_column_set_cell_data_func (column, cell, glade_project_view_cell_function, NULL, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column);
gtk_object_unref (GTK_OBJECT (column));
......@@ -330,7 +330,7 @@ glade_project_view_create_widget (GladeProjectView *view)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
g_signal_connect_data (G_OBJECT (selection),
"changed", GTK_SIGNAL_FUNC (glade_project_view_selection_changed_cb),
view, NULL, FALSE, FALSE);
view, NULL, 0);
gtk_widget_set_usize (widget, 272, 130);
gtk_widget_show (widget);
......
......@@ -20,6 +20,7 @@
* Chema Celorio <chema@celorio.com>
*/
#include <string.h>
#include <string.h>
#include "glade.h"
......@@ -257,12 +258,15 @@ glade_project_selection_clear (GladeProject *project, gboolean emit_signal)
}
void
glade_project_selection_remove (GladeProject *project, GladeWidget *widget,
glade_project_selection_remove (GladeWidget *widget,
gboolean emit_signal)
{
g_return_if_fail (GLADE_IS_PROJECT (project));
GladeProject *project;
g_return_if_fail (GLADE_IS_WIDGET (widget));
project = widget->project;
g_return_if_fail (GLADE_IS_PROJECT (project));
if (!widget->selected)
return;
......@@ -275,11 +279,14 @@ glade_project_selection_remove (GladeProject *project, GladeWidget *widget,
}
void
glade_project_selection_add (GladeProject *project, GladeWidget *widget,
glade_project_selection_add (GladeWidget *widget,
gboolean emit_signal)
{
g_return_if_fail (GLADE_IS_PROJECT (project));
GladeProject *project;
g_return_if_fail (GLADE_IS_WIDGET (widget));
project = widget->project;
g_return_if_fail (GLADE_IS_PROJECT (project));
if (widget->selected)
return;
......@@ -292,19 +299,22 @@ glade_project_selection_add (GladeProject *project, GladeWidget *widget,
}
void
glade_project_selection_set (GladeProject *project, GladeWidget *widget,
glade_project_selection_set (GladeWidget *widget,
gboolean emit_signal)
{
GladeProject *project;
GList *list;
g_return_if_fail (GLADE_IS_PROJECT (project));
g_return_if_fail (GLADE_IS_WIDGET (widget));
project = widget->project;
g_return_if_fail (GLADE_IS_PROJECT (project));
list = project->selection;
/* Check if the selection is different than what we have */
if ((list) && (list->next == NULL) && (list->data == widget))
return;
glade_project_selection_clear (project, FALSE);
glade_project_selection_add (project, widget, emit_signal);
glade_project_selection_add (widget, emit_signal);
}
......@@ -69,9 +69,10 @@ void glade_project_widget_name_changed (GladeProject *project,
GladeWidget *widget);
/* Selection */
void glade_project_selection_set (GladeProject *project, GladeWidget *widget, gboolean emit_signal);
void glade_project_selection_add (GladeProject *project, GladeWidget *widget, gboolean emit_signal);
void glade_project_selection_remove (GladeProject *project, GladeWidget *widget, gboolean emit_signal);
void glade_project_selection_set (GladeWidget *widget, gboolean emit_signal);
void glade_project_selection_add (GladeWidget *widget, gboolean emit_signal);
void glade_project_selection_remove (GladeWidget *widget, gboolean emit_signal);
void glade_project_selection_clear (GladeProject *project, gboolean emit_signal);
G_END_DECLS
......
......@@ -148,7 +148,7 @@ glade_property_class_get_specs (GladeWidgetClass *class, GParamSpec ***specs, gi
*specs = g_object_class_list_properties (object_class, n_specs);
}
static GParamSpec *
GParamSpec *
glade_property_class_find_spec (GladeWidgetClass *class, const gchar *name)
{
GParamSpec **specs = NULL;
......@@ -165,13 +165,11 @@ glade_property_class_find_spec (GladeWidgetClass *class, const gchar *name)
g_warning ("Spec does not have a valid name, or invalid spec");
return NULL;
}
if (strcmp (spec->name, name) == 0)
return spec;
}
g_warning ("Could not find spec by name %s\n", name);
return NULL;
}
......
......@@ -134,9 +134,10 @@ struct _GladePropertyClass {
GtkWidget * glade_property_class_create_label (GladePropertyClass *pclass);
GtkWidget * glade_property_class_create_input (GladePropertyClass *pclass);
GList * glade_property_class_list_new_from_node (xmlNodePtr node, GladeWidgetClass *class);
GParamSpec * glade_property_class_find_spec (GladeWidgetClass *class, const gchar *name);
G_END_DECLS
#endif /* __GLADE_PROPERTY_CLASS_H__ */
......@@ -176,17 +176,20 @@ glade_property_list_new_from_widget_class (GladeWidgetClass *class,
GladeProperty *
glade_property_get_from_name (GList *settings_list, const gchar *name)
glade_property_get_from_gtk_arg (GList *settings_list, const gchar *arg)
{
GList *list;
GladeProperty *property;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (arg != NULL, NULL);
list = settings_list;
for (; list != NULL; list = list->next) {
property = list->data;
if (strcmp (property->class->name, name) == 0)
g_return_val_if_fail (property, NULL);
g_return_val_if_fail (property->class, NULL);
g_return_val_if_fail (property->class->gtk_arg, NULL);
if (strcmp (property->class->gtk_arg, arg) == 0)
return property;
}
......@@ -250,6 +253,9 @@ glade_property_changed_float (GladeProperty *property, gfloat val)
g_free (property->value);
property->value = g_strdup_printf ("%g", val);
gtk_object_set (GTK_OBJECT (property->widget->widget),
property->class->gtk_arg, val, NULL);
}
void
......
......@@ -45,6 +45,9 @@ struct _GladePropertyQueryResult {
};
GList * glade_property_list_new_from_widget_class (GladeWidgetClass *class,
GladeWidget *widget);
void glade_property_changed_text (GladeProperty *property, const gchar *text);
void glade_property_changed_integer (GladeProperty *property, gint val);
void glade_property_changed_float (GladeProperty *property, gfloat val);
......@@ -58,13 +61,13 @@ gboolean glade_property_get_boolean (GladeProperty *property);
GladeChoice * glade_property_get_choice (GladeProperty *property);
GList * glade_property_list_new_from_widget_class (GladeWidgetClass *class,
GladeWidget *widget);
/* Get a GladeProperty */
GladeProperty * glade_property_get_from_name (GList *property_list,
const gchar *name);
GladeProperty * glade_property_get_from_class (GladeWidget *widget,
GladePropertyClass *class);
GladeProperty * glade_property_get_from_gtk_arg (GList *settings_list,
const gchar *arg);
/* Property Queries */
GladePropertyQueryResult * glade_property_query_result_new (void);
......
......@@ -88,7 +88,7 @@ glade_signal_editor_dialog_cb (GtkButton *button, GladeSignalEditor *editor)
gtk_box_pack_start_defaults (GTK_BOX (vbox), GTK_WIDGET (scroll));
lst_model = GTK_TREE_MODEL (gtk_tree_store_new_with_types (1, G_TYPE_STRING));
lst_model = GTK_TREE_MODEL (gtk_tree_store_new (1, G_TYPE_STRING));
lst_view = GTK_TREE_VIEW (gtk_tree_view_new_with_model (GTK_TREE_MODEL (lst_model)));
gtk_widget_set_usize (GTK_WIDGET (lst_view), 150, 200);
......@@ -443,7 +443,7 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
GtkTreeView *view;
GtkWidget *view_widget;
model = gtk_tree_store_new_with_types (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
model = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
view_widget = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
view = GTK_TREE_VIEW (view_widget);
......
......@@ -91,6 +91,7 @@ glade_widget_class_add_virtual_methods (GladeWidgetClass *class)
g_return_if_fail (class->name != NULL);
/* I don't love this. Make it better. Chema */
#warning FIXME
if ((strcmp (class->name, "GtkVBox") == 0) ||
(strcmp (class->name, "GtkHBox") == 0))
class->placeholder_replace = glade_placeholder_replace_box;
......
......@@ -30,6 +30,7 @@
#include "glade-project-window.h"
#include "glade-property.h"
#include "glade-property-class.h"
#include "glade-popup.h"
#include "glade-placeholder.h"
......@@ -98,7 +99,7 @@ glade_widget_new (GladeProject *project, GladeWidgetClass *class, GtkWidget *gtk
* Return Value: a GladeWidget pointer for @widget, NULL if the widget does not
* have a GladeWidget counterpart.
**/
static GladeWidget *
GladeWidget *
glade_widget_get_from_gtk_widget (GtkWidget *widget)
{
return gtk_object_get_data (GTK_OBJECT (widget), GLADE_WIDGET_DATA_TAG);
......@@ -148,7 +149,6 @@ glade_widget_find_inside_container (GtkWidget *widget, gpointer data_in)
/**
* glade_widget_get_from_event_widget:
* @event_widget:
* @event_glade_widget:
* @event:
*
* Returns the real widget that was "clicked over" for a given event (cooridantes) and a widget
......@@ -159,7 +159,7 @@ glade_widget_find_inside_container (GtkWidget *widget, gpointer data_in)
* Return Value:
**/
static GladeWidget *
glade_widget_get_from_event_widget (GtkWidget *event_widget, GladeWidget *event_glade_widget, GdkEventButton *event)
glade_widget_get_from_event_widget (GtkWidget *event_widget, GdkEventButton *event)
{
GladeFindInContainerData data;
GladeWidget *found = NULL;
......@@ -179,12 +179,10 @@ glade_widget_get_from_event_widget (GtkWidget *event_widget, GladeWidget *event_
#ifdef DEBUG
g_print ("Window [%d,%d]\n", win_x, win_y);
g_print ("\n\nWe want to find the real widget that was clicked at %d,%d\n", x, y);
g_print ("The widget that received the event was \"%s\" a \"%s\" [%d]\n"
"The REAL widget is %s\n",
glade_widget_get_name (event_glade_widget),
g_print ("The widget that received the event was \"%s\" a \"%s\" [%d]\n",
NULL,
gtk_widget_get_name (event_widget),
GPOINTER_TO_INT (event_widget),
glade_widget_get_name (real_event_glade_widget));
GPOINTER_TO_INT (event_widget));
#endif
parent_window = event_widget->parent ? event_widget->parent->window : event_widget->window;
......@@ -252,29 +250,38 @@ glade_widget_get_from_event_widget (GtkWidget *event_widget, GladeWidget *event_
}
static gboolean
glade_widget_button_press (GtkWidget *event_widget, GdkEventButton *event, GladeWidget *event_glade_widget)
glade_widget_button_press (GtkWidget *event_widget, GdkEventButton *event, gpointer not_used)
{
GladeWidget *glade_widget;
glade_widget = glade_widget_get_from_event_widget (event_widget, event);
#ifdef DEBUG
g_print ("button press for a %s\n", event_glade_widget->class->name);
g_print ("button press for a %s\n", glade_widget->class->name);
#endif
if (!glade_widget) {
g_warning ("Button press event but the gladewidget was not found\n");
return FALSE;
}
glade_widget = glade_widget_get_from_event_widget (event_widget, event_glade_widget, event);
if (glade_widget)
glade_project_selection_set (glade_widget->project, glade_widget, TRUE);
g_print ("Event button %d\n", event->button);
if (event->button == 1)
glade_project_selection_set (glade_widget, TRUE);
else if (event->button == 3)
glade_popup_pop (glade_widget, event);
else
g_print ("BUtton press not handled yet.\n");
#ifdef DEBUG
g_print ("The widget found was a %s\n", glade_widget->class->name);
#endif
#endif
return TRUE;
}
#undef DEBUG
static gboolean
glade_widget_button_release (GtkWidget *widget, GdkEventButton *event, GladeWidget *glade_widget)
glade_widget_button_release (GtkWidget *widget, GdkEventButton *event, gpointer not_used)
{
#ifdef DEBUG
g_print ("button release\n");
......@@ -458,9 +465,36 @@ glade_widget_connect_mouse_signals (GladeWidget *glade_widget)
}
gtk_signal_connect (GTK_OBJECT (widget), "button_press_event",
GTK_SIGNAL_FUNC (glade_widget_button_press), glade_widget);
GTK_SIGNAL_FUNC (glade_widget_button_press), NULL);
gtk_signal_connect (GTK_OBJECT (widget), "button_release_event",
GTK_SIGNAL_FUNC (glade_widget_button_release), glade_widget);
GTK_SIGNAL_FUNC (glade_widget_button_release), NULL);
}
/**
* glade_widget_set_contents:
* @widget:
*
* Loads the name of the widget. For example a button will have the
* "button1" text in it, or a label will have "label4". right after
* it is created.
**/
static void
glade_widget_set_contents (GladeWidget *widget)
{
GladeProperty *property = NULL;
GladeWidgetClass *class;
class = widget->class;
if (glade_property_class_find_spec (class, "label") != NULL)
property = glade_property_get_from_gtk_arg (widget->properties,
"label");
if (glade_property_class_find_spec (class, "title") != NULL)
property = glade_property_get_from_gtk_arg (widget->properties,
"title");
if (property != NULL)
glade_property_changed_text (property, widget->name);
}
static GladeWidget *
......@@ -492,20 +526,7 @@ glade_widget_create_gtk_widget (GladeProject *project,
/* We need to be able to get to the GladeWidget * from a GtkWidget * */
gtk_object_set_data (GTK_OBJECT (glade_widget->widget), GLADE_WIDGET_DATA_TAG, glade_widget);
/* FIXME */
if ((strcmp (class->name, "GtkLabel") == 0) ||
(strcmp (class->name, "GtkButton") == 0)) {
GladeProperty *property;
property = glade_property_get_from_name (glade_widget->properties,
"Label");
if (property != NULL)
glade_property_changed_text (property, name);
else
g_warning ("Could not set the label to the widget name\n");
}
glade_widget_set_contents (glade_widget);
glade_widget_connect_mouse_signals (glade_widget);
glade_widget_connect_draw_signals (glade_widget);
......@@ -636,3 +657,10 @@ glade_widget_select (GladeWidget *widget)
widget->selected = TRUE;
gtk_widget_queue_draw (widget->widget);
}
void
glade_widget_delete (GladeWidget *widget)
{
g_print ("Implement delete. Widget : %s\n",
glade_widget_get_name (widget));
}
......@@ -50,6 +50,8 @@ struct _GladeWidget {
*/
gboolean selected;
GtkWidget *popup_menu;
};
/* GladeWidgetSignal is a structure that holds information about a signal a
......@@ -73,8 +75,15 @@ GladeProperty * glade_widget_get_property_from_class (GladeWidget *widget,
void glade_widget_set_name (GladeWidget *widget, const gchar *name);
/* Widget functions */
typedef void (*GladeWidgetFunction) (GladeWidget *widget);
void glade_widget_unselect (GladeWidget *widget);
void glade_widget_select (GladeWidget *widget);
void glade_widget_delete (GladeWidget *widget);
GladeWidget * glade_widget_get_from_gtk_widget (GtkWidget *widget);
G_END_DECLS
......
......@@ -8,6 +8,7 @@
* Chema Celorio <chema@gnome.org>
*/
#include <string.h>
#include <glib.h>
#include <string.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment