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

gEDA-cvs: CVS update: o_text.nw



  User: ahvezda 
  Date: 05/08/19 22:08:11

  Modified:    .        o_text.nw x_dialog.nw
  Log:
  Applied Matthias Wenzel's color usability patch.
  
  
  
  
  Revision  Changes    Path
  1.16      +4 -0      eda/geda/devel/gschem/noweb/o_text.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_text.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_text.nw,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -b -r1.15 -r1.16
  --- o_text.nw	21 Feb 2005 03:07:44 -0000	1.15
  +++ o_text.nw	20 Aug 2005 02:08:10 -0000	1.16
  @@ -761,6 +761,10 @@
           object->text->size = text_size;
           object->text->alignment = text_alignment;
   		
  +        /* probably the text object should be extended to carry a color */
  +        /* and we should pass it here with a function parameter (?) */
  +        object->saved_color = w_current->edit_color;
  +
           o_text_erase(w_current, object);
           o_text_recreate(w_current, object);
           o_text_draw(w_current, object);
  
  
  
  1.34      +56 -12    eda/geda/devel/gschem/noweb/x_dialog.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_dialog.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/x_dialog.nw,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -b -r1.33 -r1.34
  --- x_dialog.nw	9 Mar 2005 22:02:32 -0000	1.33
  +++ x_dialog.nw	20 Aug 2005 02:08:10 -0000	1.34
  @@ -768,6 +768,8 @@
     return(menu);
   }
   
  +/* we reuse the color menu so we need to declare it */
  +static GtkWidget *create_color_menu(TOPLEVEL * w_current, int * select_index);
   
   @ %def create_menu_alignement
   
  @@ -970,6 +972,19 @@
         gtk_widget_grab_focus(w_current->teentry);
       }
   
  +    label = gtk_label_new(_("Edit Text Color"));
  +    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);
  +    gtk_widget_show(label);
  +    
  +    optionmenu = gtk_option_menu_new();
  +    int select_index=0;
  +    
  +    gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu), create_color_menu(w_current, &select_index));
  +    gtk_option_menu_set_history(GTK_OPTION_MENU(optionmenu), select_index);
  +	
  +    gtk_box_pack_start(GTK_BOX(vbox), optionmenu, FALSE, TRUE, 5);
  +    gtk_widget_show(optionmenu);
  +
       label = gtk_label_new (_("Edit Text Size"));
       gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);
       gtk_widget_show (label);
  @@ -3434,13 +3449,13 @@
   
   @section Function @code{create_color_menu()}
   
  -@defun create_color_menu w_current
  +@defun create_color_menu w_current select_index
   @end defun
   
   <<x_dialog.c : create_color_menu()>>=
   /* this is from gtktest.c */
   static GtkWidget*
  -create_color_menu (TOPLEVEL *w_current)
  +create_color_menu (TOPLEVEL * w_current, int * select_index)
   {
     GtkWidget *menu;
     GtkWidget *menuitem;
  @@ -3450,22 +3465,35 @@
     char *menu_string;
     char *temp=NULL;
     int found=0;
  -  int set_first=0;
   
     menu = gtk_menu_new ();
     group = NULL;
   
  +  /* first lets see if we have a selected object, if so select its color */
  +  int select_col = -1;
  +  int item_index = 0;
  +  SELECTION *s_current = NULL;
  +  OBJECT *object = NULL;
  +  /* skip over head */
  +  s_current = w_current->page_current->selection2_head->next;
  +
  +  if (s_current != NULL) {
  +
  +    object = s_current->selected_object;
  +    if (object == NULL) {
  +      fprintf(stderr, "no object selected - WHEE!\n");
  +    }else{
  +      select_col = object->saved_color;
  +      //fprintf(stderr, "setting object color %d\n", select_col);
  +    }
  +  }else /*fprintf(stderr, "no object selected\n")*/;
  +
     found = x_color_get_name(index, buf);
  +  /* this looks weired, but besides TRUE(1) and FALSE(0) there's -1 */
     while (found != FALSE) {
   
       if (found == TRUE) {
   
  -      /* set the default to the first entry */
  -      if (!set_first) {
  -        global_window_current->edit_color = index;
  -        set_first = 1;
  -      }
  -
         temp = index2functionstring(index);
         menu_string = g_strdup_printf("%d | %s | %s", index, 
   				    temp,
  @@ -3490,7 +3518,22 @@
         /* treated as one, it's then cast to an int in */
         /* color_set.  This should be ok as long as sizeof(void *) >= sizeof(int) */
   
  -      gtk_widget_show (menuitem);
  +      if (select_col == -1){
  +      /* set the default to the current color */
  +        if (index == global_window_current->edit_color) {
  +          gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
  +          //fprintf(stderr, "checking item %d\n", index);
  +	  *select_index = item_index;
  +        }
  +      }else{
  +        if (index == select_col){
  +          gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
  +          //fprintf(stderr, "checking selected item %d\n", index);
  +	  *select_index = item_index;
  +        }
  +      }
  +      gtk_widget_show(menuitem);
  +      item_index++;
       }
   
       index++;
  @@ -3636,9 +3679,10 @@
   #endif
   
       optionmenu = gtk_option_menu_new ();
  +    int select_index = 0;
       gtk_option_menu_set_menu(GTK_OPTION_MENU(optionmenu),
  -                             create_color_menu (w_current));
  -    gtk_option_menu_set_history(GTK_OPTION_MENU (optionmenu), 0);
  +                             create_color_menu (w_current, &select_index));
  +    gtk_option_menu_set_history(GTK_OPTION_MENU (optionmenu), select_index);
       gtk_box_pack_start(
                          GTK_BOX(vbox),
                          optionmenu, TRUE, TRUE, 0);