Diff of /trunk/src/misc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 223 by harbaum, Tue Dec 1 20:03:51 2009 UTC revision 228 by harbaum, Thu Dec 3 20:07:13 2009 UTC
# Line 321  static gboolean mark(GtkWidget *widget, Line 321  static gboolean mark(GtkWidget *widget,
321    return valid;    return valid;
322  }  }
323    
324  GtkWidget *red_entry_new(void) {  GtkWidget *red_entry_new_with_text(char *str) {
325    GdkColor color;    GdkColor color;
326    
327    GtkWidget *widget = entry_new();    GtkWidget *widget = entry_new();
328    gdk_color_parse("#ff0000", &color);    gdk_color_parse("#ff0000", &color);
329    gtk_widget_modify_text(widget, TAG_STATE, &color);    gtk_widget_modify_text(widget, TAG_STATE, &color);
330      if(str) gtk_entry_set_text(GTK_ENTRY(widget), str);
331    
332    return widget;    return widget;
333  }  }
334    
# Line 611  GtkWidget *lat_entry_new(float lat) { Line 613  GtkWidget *lat_entry_new(float lat) {
613    pos_lat_str(str, sizeof(str), lat);    pos_lat_str(str, sizeof(str), lat);
614    
615  #ifndef COORDINATE_PICKER  #ifndef COORDINATE_PICKER
616    GdkColor color;    GtkWidget *widget = red_entry_new_with_text(str);
   
   GtkWidget *widget = entry_new();  
   gdk_color_parse("#ff0000", &color);  
   gtk_widget_modify_text(widget, TAG_STATE, &color);  
   
   gtk_entry_set_text(GTK_ENTRY(widget), str);  
617    
618    g_signal_connect(G_OBJECT(widget), "changed",    g_signal_connect(G_OBJECT(widget), "changed",
619                     G_CALLBACK(callback_modified_lat), NULL);                     G_CALLBACK(callback_modified_lat), NULL);
# Line 736  GtkWidget *lon_entry_new(float lon) { Line 732  GtkWidget *lon_entry_new(float lon) {
732    pos_lon_str(str, sizeof(str), lon);    pos_lon_str(str, sizeof(str), lon);
733    
734  #ifndef COORDINATE_PICKER  #ifndef COORDINATE_PICKER
735    GdkColor color;    GtkWidget *widget = red_entry_new_with_text(str);
   
   GtkWidget *widget = entry_new();  
   gdk_color_parse("#ff0000", &color);  
   gtk_widget_modify_text(widget, TAG_STATE, &color);  
   
   gtk_entry_set_text(GTK_ENTRY(widget), str);  
   
736    g_signal_connect(G_OBJECT(widget), "changed",    g_signal_connect(G_OBJECT(widget), "changed",
737                     G_CALLBACK(callback_modified_lon), NULL);                     G_CALLBACK(callback_modified_lon), NULL);
738    
# Line 941  GtkWidget *dist_entry_new(float dist, gb Line 930  GtkWidget *dist_entry_new(float dist, gb
930    distance_str(str, sizeof(str), dist, mil);    distance_str(str, sizeof(str), dist, mil);
931    
932  #ifndef COORDINATE_PICKER  #ifndef COORDINATE_PICKER
933    GdkColor color;    GtkWidget *widget = red_entry_new_with_text(str);
   GtkWidget *widget = entry_new();  
   gdk_color_parse("#ff0000", &color);  
   gtk_widget_modify_text(widget, TAG_STATE, &color);  
   
   gtk_entry_set_text(GTK_ENTRY(widget), str);  
   
934    g_signal_connect(G_OBJECT(widget), "changed",    g_signal_connect(G_OBJECT(widget), "changed",
935                     G_CALLBACK(callback_modified_dist), NULL);                     G_CALLBACK(callback_modified_dist), NULL);
936    
# Line 1195  static void cb_cache(GtkWidget *item, gp Line 1178  static void cb_cache(GtkWidget *item, gp
1178    
1179    if(!id)    if(!id)
1180      pos_set(item, cache->pos.lat, cache->pos.lon);      pos_set(item, cache->pos.lat, cache->pos.lon);
1181    else if(id == 1)    else if(id == 1) {
1182      pos_set(item, cache->notes->pos.lat, cache->notes->pos.lon);      /* fetch position out of notes dialog since they probably */
1183    else {      /* haven't been saved yet */
1184        pos_t pos = notes_get_pos(appdata->cache_context);
1185        pos_set(item, pos.lat, pos.lon);
1186      } else {
1187      wpt_t *wpt = cache->wpt;      wpt_t *wpt = cache->wpt;
1188      while(wpt && id > 2) {      while(wpt && id > 2) {
1189        wpt = wpt->next;        wpt = wpt->next;
# Line 1278  static GtkWidget *popup_menu_create(appd Line 1264  static GtkWidget *popup_menu_create(appd
1264                 name, cb_cache, 0, lon_entry, lat_entry);                 name, cb_cache, 0, lon_entry, lat_entry);
1265    
1266      /* overwritten cache position */      /* overwritten cache position */
1267      if(cache->notes && pos_valid(&cache->notes->pos))      if(appdata->cache_context && notes_get_override(appdata->cache_context))
1268        menu_add(menu, appdata, icon_get_widget(ICON_POS, cache->type + 6),        menu_add(menu, appdata, icon_get_widget(ICON_POS, cache->type + 6),
1269                 _("Modified coordinate"), cb_cache, 1, lon_entry, lat_entry);                 _("Modified coordinate"), cb_cache, 1, lon_entry, lat_entry);
1270    
# Line 1461  static GtkWidget *preset_picker_create(a Line 1447  static GtkWidget *preset_picker_create(a
1447                          name, cb_cache, 0);                          name, cb_cache, 0);
1448    
1449      /* overwritten cache position */      /* overwritten cache position */
1450      if(cache->notes && pos_valid(&cache->notes->pos))      if(appdata->cache_context && notes_get_override(appdata->cache_context))
1451        preset_picker_add(store, appdata, icon_get(ICON_POS, cache->type + 6),        preset_picker_add(store, appdata, icon_get(ICON_POS, cache->type + 6),
1452                          _("Modified coordinate"), cb_cache, 1);                          _("Modified coordinate"), cb_cache, 1);
1453    
# Line 1674  GtkWidget *angle_entry_new(float angle) Line 1660  GtkWidget *angle_entry_new(float angle)
1660    angle_str(str, sizeof(str), angle);    angle_str(str, sizeof(str), angle);
1661    
1662  #ifndef COORDINATE_PICKER  #ifndef COORDINATE_PICKER
1663    GtkWidget *widget = red_entry_new();    GtkWidget *widget = red_entry_new_with_text(str);
   gtk_entry_set_text(GTK_ENTRY(widget), str);  
   
1664    g_signal_connect(G_OBJECT(widget), "changed",    g_signal_connect(G_OBJECT(widget), "changed",
1665                     G_CALLBACK(callback_modified_angle), NULL);                     G_CALLBACK(callback_modified_angle), NULL);
1666  #else  #else

Legend:
Removed from v.223  
changed lines
  Added in v.228