[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: CVS update: x_window.c



  User: cnieves 
  Date: 06/09/30 15:04:35

  Modified:    .        x_window.c x_event.c
  Log:
  Fix for bug #1527465. Do a zoom extents for all pages when the
  
  main window is maximized.
  
  
  
  
  Revision  Changes    Path
  1.46      +3 -2      eda/geda/gaf/gschem/src/x_window.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_window.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_window.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -b -r1.45 -r1.46
  --- x_window.c	30 Sep 2006 11:30:26 -0000	1.45
  +++ x_window.c	30 Sep 2006 19:04:35 -0000	1.46
  @@ -359,6 +359,7 @@
     struct event_reg_t main_window_events[] = {
       { "enter_notify_event",   G_CALLBACK(x_event_enter)           },
       { "scroll_event",         G_CALLBACK(x_event_scroll)          },
  +    { "window_state_event",   G_CALLBACK(x_event_window_state)    },
       { NULL,                   NULL                                } };
     struct event_reg_t *tmp;
   
  @@ -370,6 +371,7 @@
                            GDK_ENTER_NOTIFY_MASK |
                            GDK_KEY_PRESS_MASK |
                            GDK_BUTTON_RELEASE_MASK);
  +
     for (tmp = drawing_area_events; tmp->detailed_signal != NULL; tmp++) {
       g_signal_connect (w_current->drawing_area,
                         tmp->detailed_signal,
  @@ -383,7 +385,6 @@
                         tmp->c_handler,
                         w_current);
     }
  -  
   }
   
   
  
  
  
  1.40      +58 -1     eda/geda/gaf/gschem/src/x_event.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_event.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_event.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -b -r1.39 -r1.40
  --- x_event.c	9 Sep 2006 02:56:42 -0000	1.39
  +++ x_event.c	30 Sep 2006 19:04:35 -0000	1.40
  @@ -1246,6 +1246,7 @@
   {
     int new_height, new_width;
     double cx,cy;
  +  PAGE *page_ptr, *page_current;
   
     exit_if_null(w_current);
     global_window_current = w_current;
  @@ -1354,8 +1355,9 @@
   		 w_current->page_current->right) /2;
     cy = (double) (w_current->page_current->top +
                    w_current->page_current->bottom) /2;	
  -  a_pan_general(w_current, cx, cy, 1.0, A_PAN_DONT_REDRAW);	
   	
  +  /* This call is necessary. Otherwise the variables are not setup correctly */
  +  a_pan_general(w_current, cx, cy, 1.0, A_PAN_DONT_REDRAW);	
   
     if (w_current->backingstore) {
       gdk_pixmap_unref(w_current->backingstore);
  @@ -1365,6 +1367,31 @@
                                              widget->allocation.width,
                                              widget->allocation.height,
                                              -1);
  +
  +  /* w_current->window_maximized is set by x_event_window_state, 
  +     which is the handler of the window_state_event of the main_window.
  +     That signal is issued when maximizing/iconifying the window */
  +  if (w_current->window_maximized) { 
  +    page_ptr = w_current->page_head;
  +    /* Skip the page head */
  +    if (page_ptr)
  +      page_ptr = page_ptr->next;
  +
  +    /* Maximize all pages without redrawing them */    
  +    page_current = w_current->page_current;
  +    while (page_ptr) {
  +      s_page_goto(w_current, page_ptr);
  +      /* This call to a_pan_general is necessary. 
  +	 Otherwise the variables are not setup correctly */
  +      a_pan_general(w_current, cx, cy, 1.0, A_PAN_DONT_REDRAW);	
  +  
  +      a_zoom_extents(w_current, w_current->page_current->object_head, 
  +		     A_PAN_DONT_REDRAW);      
  +      page_ptr = page_ptr->next;
  +    }
  +    s_page_goto(w_current, page_current); /* Go to the original page */
  +  }
  +
     if (!w_current->DONT_REDRAW) {
       o_redraw_all_fast(w_current);
       x_scrollbars_update(w_current);
  @@ -1627,3 +1654,33 @@
   
     return(0);
   }
  +
  +/*! \brief Do a zoom extents whenever the window is maximized/minimized.
  + *  \par Function Description
  + *  This function was added so gschem could do a zoom extents whenever 
  + *  the window is maximized/minimized.
  + *  It seems that when this function gets executed, the new size has not 
  + *  been set, and there is no way to get it.
  + *  So this function just sets the window_maximized variable in the 
  + *  TOPLEVEL structure. 
  + *  Since a configure event is called when maximizing or minimizing,
  + *  x_event_configure will look for this variable and do the zoom extents.
  + * 
  + *  \param widget [in] the widget which received the signal.
  + *  \param event [in] the event structure.
  + *  \param w_current [in] the gschem's TOPLEVEL structure.
  + *  \return FALSE always. (TRUE to stop other handlers from being invoked 
  + *   for the event. FALSE to propagate the event further.)
  + */
  +gint x_event_window_state(GtkWidget *widget, GdkEventWindowState *event,
  +			  TOPLEVEL *w_current)
  +{
  +  if ( (event->new_window_state & event->changed_mask &
  +      GDK_WINDOW_STATE_MAXIMIZED)  != 0)
  +    w_current->window_maximized = TRUE;
  +  else
  +    w_current->window_maximized = FALSE;
  +
  +  return FALSE;
  +}
  +
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs