Enlightenment CVS committal

Author  : werkt
Project : misc
Module  : ewler

Dir     : misc/ewler/src


Modified Files:
        form.c layout.c layout.h selected.c widgets.c 


Log Message:
Added break layout and fixed segvs on 'Delete'.

===================================================================
RCS file: /cvsroot/enlightenment/misc/ewler/src/form.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- form.c      27 Jul 2004 13:51:05 -0000      1.10
+++ form.c      9 Aug 2004 09:03:14 -0000       1.11
@@ -38,6 +38,7 @@
 __free_elements_cb( void *val )
 {
        widget_destroy_info( EWL_WIDGET(val) );
+       ewl_callback_del_type( EWL_WIDGET(val), EWL_CALLBACK_DESTROY );
 }
 
 static void
@@ -304,6 +305,14 @@
                        ewl_container_append_child(EWL_CONTAINER(form->popup), 
menu_item);
                        ewl_widget_show(menu_item);
 
+                       menu_item = ewl_menu_item_new(NULL, "Break Layout");
+                       ewl_callback_append( menu_item, EWL_CALLBACK_SELECT,
+                                                                                      
                  layout_break_cb, form );
+                       ewl_callback_append( menu_item, EWL_CALLBACK_SELECT,
+                                                                                      
                  __destroy_popup, form );
+                       ewl_container_append_child(EWL_CONTAINER(form->popup), 
menu_item);
+                       ewl_widget_show(menu_item);
+
                        menu_item = EWL_WIDGET(ewl_menu_separator_new());
                        ewl_container_append_child(EWL_CONTAINER(form->popup), 
menu_item);
                        ewl_widget_show(menu_item);
@@ -561,8 +570,6 @@
                                                                                       
          PACKAGE_DATA_DIR"/themes/ewler.eet");
        ewl_theme_data_set_str(form->overlay, "/background/group", "background");
 
-       ewl_container_append_child( EWL_CONTAINER(form->window), form->overlay );
-
        ewl_callback_del_type( form->overlay, EWL_CALLBACK_MOUSE_DOWN );
        ewl_callback_del_type( form->overlay, EWL_CALLBACK_MOUSE_UP );
        ewl_callback_del_type( form->overlay, EWL_CALLBACK_FOCUS_IN );
@@ -577,6 +584,7 @@
                                                                                       
  __mouse_move_widget, form );
        ewl_callback_append( form->overlay, EWL_CALLBACK_KEY_DOWN,
                                                                                       
  __key_down_form, form );
+       ewl_container_append_child( EWL_CONTAINER(form->window), form->overlay );
 
        form->selected = ecore_list_new();
        form->has_been_saved = 1;
@@ -664,8 +672,12 @@
 
        ecore_list_goto_first( form->selected );
 
-       while( (s = ecore_list_next( form->selected)) )
+       while( (s = ecore_list_remove( form->selected)) ) {
+               if( s == form->overlay )
+                       continue;
+
                ewl_widget_destroy( s );
+       }
 
        form_selected_clear( form );
 }
===================================================================
RCS file: /cvsroot/enlightenment/misc/ewler/src/layout.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- layout.c    27 Jul 2004 13:51:05 -0000      1.1
+++ layout.c    9 Aug 2004 09:03:14 -0000       1.2
@@ -8,6 +8,7 @@
 static int count = 0;
 
 static void layout_widgets( Ewler_Form *form, Ewl_Orientation orientation );
+static void break_layout( Ewler_Form *form );
 
 void
 layout_horizontal_cb( Ewl_Widget *w, void *ev_data, void *user_data )
@@ -25,6 +26,14 @@
        layout_widgets( form, EWL_ORIENTATION_VERTICAL );
 }
 
+void
+layout_break_cb( Ewl_Widget *w, void *ev_data, void *user_data )
+{
+       Ewler_Form *form = user_data;
+
+       break_layout( form );
+}
+
 static void
 __layout_realize_cb( Ewl_Widget *w, void *ev_data, void *user_data )
 {
@@ -135,3 +144,79 @@
                form_selected_append( form, s );
        }
 }
+
+static void
+break_layout( Ewler_Form *form )
+{
+       Ewl_Widget *s = ecore_list_goto_first( form->selected );
+       Ewl_Widget *p, *np, *cw;
+       Ecore_List *cl;
+       int x, y;
+
+       if( s == form->overlay ) {
+               if( form->layout ) {
+
+                       cl = ecore_list_new();
+
+                       ecore_list_goto_first( EWL_CONTAINER(form->layout)->children );
+
+                       while( (s = 
ecore_list_next(EWL_CONTAINER(form->layout)->children)) ) {
+                               if( s == form->popup )
+                                       continue;
+
+                               ecore_list_append( cl, s );
+                       }
+
+                       p = form->layout;
+                       np = form->overlay;
+                       form->layout = NULL;
+               } else {
+                       return;
+               }
+       } else if( ecore_list_nodes( form->selected ) == 1 &&
+                                                (cw = 
ewler_selected_get(EWLER_SELECTED(s))) &&
+                                                widget_is_type( cw, "Ewl_Box" ) &&
+                                                !widget_is_type( s->parent, "Ewl_Box" 
) ) {
+               /* see comment below for the crazy parent derefs... they're safe */
+               p = cw;
+               np = s->parent;
+
+               cl = ecore_list_new();
+
+               ecore_list_goto_first(EWL_CONTAINER(p)->children);
+
+               while( (cw = ecore_list_next(EWL_CONTAINER(p)->children)) )
+                       ecore_list_append( cl, cw );
+       } else {
+               p = s->parent;
+               /* ok, new parent is the current parent's grandparent (since its parent
+                * is a selector */
+               np = p->parent->parent;
+
+               cl = ecore_list_new();
+
+               while( (s = ecore_list_next( form->selected )) ) {
+                       if( s == form->overlay || p != s->parent ) {
+                               /* can't break widgets that do not have a common 
parent */
+                               ecore_list_destroy( cl );
+                               return;
+                       }
+                       ecore_list_append( cl, s );
+               }
+       }
+
+       ecore_list_goto_first( cl );
+
+       while( (cw = ecore_list_remove( cl )) ) {
+               ewl_container_append_child( EWL_CONTAINER(np), cw );
+               x = CURRENT_X(cw);
+               y = CURRENT_Y(cw);
+
+               ewl_object_request_position( EWL_OBJECT(cw), x, y );
+       }
+
+       ecore_list_destroy( cl );
+
+       if( ecore_list_is_empty( EWL_CONTAINER(p)->children ) )
+               ewl_widget_destroy( p->parent );
+}
===================================================================
RCS file: /cvsroot/enlightenment/misc/ewler/src/layout.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- layout.h    27 Jul 2004 13:51:05 -0000      1.1
+++ layout.h    9 Aug 2004 09:03:14 -0000       1.2
@@ -3,5 +3,6 @@
 
 void layout_horizontal_cb( Ewl_Widget *w, void *ev_data, void *user_data );
 void layout_vertical_cb( Ewl_Widget *w, void *ev_data, void *user_data );
+void layout_break_cb( Ewl_Widget *w, void *ev_data, void *user_data );
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/misc/ewler/src/selected.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- selected.c  27 Jul 2004 13:51:05 -0000      1.11
+++ selected.c  9 Aug 2004 09:03:14 -0000       1.12
@@ -11,8 +11,6 @@
 #define SELECTED_MIN_WIDTH     15
 #define SELECTED_MIN_HEIGHT    15
 
-static int part_selected;
-
 /**
  * @param w: the child widget to be selected
  * @return Returns NULL on failure, or a newly allocated selected on success.
@@ -124,6 +122,8 @@
        Ewler_Selected *s;
        int x, y, width, height;
 
+       ewl_widget_set_state( w, w->bit_state );
+
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        s = EWLER_SELECTED(w);
@@ -155,8 +155,10 @@
         * HIDE IT IF THE BITSTATE DOESN'T SAY DEFAULT */
        if( !strcmp( w->bit_state, "default" ) )
                evas_object_layer_set(w->theme_object, 1000);
-       else
+       else {
+               ewl_widget_set_state( w, "none" );
                ewl_widget_set_state( w, "deselect" );
+       }
 
        ewl_container_append_child(EWL_CONTAINER(s), s->selected);
 
@@ -284,8 +286,6 @@
        s->corners.u = CURRENT_X(sw) + CURRENT_W(sw);
        s->corners.v = CURRENT_Y(sw) + CURRENT_H(sw);
 
-       part_selected = 1;
-
        form_clear_widget_dragging();
 }
 
@@ -309,7 +309,7 @@
        Ewler_Selected *s = EWLER_SELECTED(w);
 
        embed = ewl_embed_find_by_widget(w);
-       
+
        evas_event_feed_mouse_move(embed->evas, ev->x, ev->y);
 
        if( s->dragging ) {
@@ -331,10 +331,12 @@
                ewl_object_set_preferred_size(EWL_OBJECT(s),
                                                                                       
                                                 s->corners.u - s->corners.x,
                                                                                       
                                                 s->corners.v - s->corners.y);
+               ewl_object_set_maximum_size(EWL_OBJECT(s->selected), 100000, 100000);
                ewl_object_set_preferred_size(EWL_OBJECT(s->selected),
                                                                                       
                                                 s->corners.u - s->corners.x,
                                                                                       
                                                 s->corners.v - s->corners.y);
 
+
        }
 
        s->last_pos.x = ev->x;
@@ -363,11 +365,9 @@
                form_set_widget_dragging( s->selected, ev );
                embed = ewl_embed_find_by_widget(w);
 
-               part_selected = 0;
-
                evas_event_feed_mouse_down(embed->evas, ev->button);
 
-               if( !part_selected && !form_widget_created() ) {
+               if( !form_widget_created() ) {
                        ewl_container_nointercept_callback(EWL_CONTAINER(s),
                                                                                       
                                                                          
EWL_CALLBACK_MOUSE_DOWN);
                        form_clear_widget_selected();
===================================================================
RCS file: /cvsroot/enlightenment/misc/ewler/src/widgets.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- widgets.c   27 Jul 2004 13:51:05 -0000      1.4
+++ widgets.c   9 Aug 2004 09:03:14 -0000       1.5
@@ -435,6 +435,12 @@
                                        if( data->type->w.set )
                                                data->type->w.set( o, (int) 
data->w_str.value );
                                        return;
+                               case WIDGET_ENUM_TYPE:
+                                       data->w_enum.value =
+                                               (int) ecore_hash_get( 
data->type->w_enum.map, value );
+                                       if( data->type->w.set )
+                                               data->type->w.set( o, 
data->w_enum.value );
+                                       return;
                        }
                }
 }




-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to