Diff of /trunk/src/area_edit.c

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

revision 273 by harbaum, Thu Aug 27 15:18:06 2009 UTC revision 275 by harbaum, Mon Aug 31 18:28:30 2009 UTC
# Line 41  typedef struct { Line 41  typedef struct {
41    
42    struct {    struct {
43      GtkWidget *minlat, *maxlat, *minlon, *maxlon;      GtkWidget *minlat, *maxlat, *minlon, *maxlon;
44        GtkWidget *error;
45    } direct;    } direct;
46    
47    struct {    struct {
48      GtkWidget *lat, *lon, *height, *width, *mil_km;      GtkWidget *lat, *lon, *height, *width, *mil_km;
49      gboolean is_mil;      gboolean is_mil;
50        GtkWidget *error;
51    } extent;    } extent;
52    
53  #ifdef USE_HILDON  #ifdef USE_HILDON
# Line 149  static void area_main_update(context_t * Line 151  static void area_main_update(context_t *
151    pos_lon_label_set(context->minlon, context->min.lon);    pos_lon_label_set(context->minlon, context->min.lon);
152    pos_lon_label_set(context->maxlon, context->max.lon);    pos_lon_label_set(context->maxlon, context->max.lon);
153    
154      /* also setup the local error messages here, so they are */
155      /* updated for all entries at once */
156      if(context->min.lat >= context->max.lat ||
157         context->min.lon >= context->max.lon) {
158        gtk_label_set(GTK_LABEL(context->direct.error),
159                      _("\"From\" must be smaller than \"to\" value!"));
160        gtk_label_set(GTK_LABEL(context->extent.error),
161                      _("Extents must be positive!"));
162    
163        gtk_dialog_set_response_sensitive(GTK_DIALOG(context->dialog),
164                                          GTK_RESPONSE_ACCEPT, FALSE);
165    
166      } else {
167        gtk_label_set(GTK_LABEL(context->direct.error), "");
168        gtk_label_set(GTK_LABEL(context->extent.error), "");
169    
170        gtk_dialog_set_response_sensitive(GTK_DIALOG(context->dialog),
171                                          GTK_RESPONSE_ACCEPT, TRUE);
172      }
173    
174    /* check if area size exceeds recommended values */    /* check if area size exceeds recommended values */
175    pos_float_t center_lat = (context->max.lat + context->min.lat)/2;    pos_float_t center_lat = (context->max.lat + context->min.lat)/2;
176    double vscale = DEG2RAD(POS_EQ_RADIUS / 1000.0);    double vscale = DEG2RAD(POS_EQ_RADIUS / 1000.0);
# Line 218  static void map_update(context_t *contex Line 240  static void map_update(context_t *contex
240    
241      /* ---------- draw border (as a gps track) -------------- */      /* ---------- draw border (as a gps track) -------------- */
242      osm_gps_map_clear_tracks(OSM_GPS_MAP(context->map.widget));      osm_gps_map_clear_tracks(OSM_GPS_MAP(context->map.widget));
243    
244      GSList *box = pos_append(NULL, context->min.lat, context->min.lon);      if(context->max.lat > context->min.lat &&
245      box = pos_append(box, context->max.lat, context->min.lon);         context->max.lon > context->min.lon) {
246      box = pos_append(box, context->max.lat, context->max.lon);        GSList *box = pos_append(NULL, context->min.lat, context->min.lon);
247      box = pos_append(box, context->min.lat, context->max.lon);        box = pos_append(box, context->max.lat, context->min.lon);
248      box = pos_append(box, context->min.lat, context->min.lon);        box = pos_append(box, context->max.lat, context->max.lon);
249          box = pos_append(box, context->min.lat, context->max.lon);
250      osm_gps_map_add_track(OSM_GPS_MAP(context->map.widget), box);        box = pos_append(box, context->min.lat, context->min.lon);
251    
252          osm_gps_map_add_track(OSM_GPS_MAP(context->map.widget), box);
253        }
254    }    }
255    
256    context->map.needs_redraw = FALSE;    context->map.needs_redraw = FALSE;
# Line 551  static gboolean map_gps_update(gpointer Line 576  static gboolean map_gps_update(gpointer
576    
577  gboolean area_edit(area_edit_t *area) {  gboolean area_edit(area_edit_t *area) {
578    GtkWidget *vbox;    GtkWidget *vbox;
579      GdkColor color;
580      gdk_color_parse("red", &color);
581    
582    context_t context;    context_t context;
583    memset(&context, 0, sizeof(context_t));    memset(&context, 0, sizeof(context_t));
# Line 632  gboolean area_edit(area_edit_t *area) { Line 659  gboolean area_edit(area_edit_t *area) {
659    /* ------------ direct min/max edit --------------- */    /* ------------ direct min/max edit --------------- */
660    
661    vbox = gtk_vbox_new(FALSE, 10);    vbox = gtk_vbox_new(FALSE, 10);
662    table = gtk_table_new(3, 3, FALSE);  // x, y    table = gtk_table_new(3, 4, FALSE);  // x, y
663    gtk_table_set_col_spacings(GTK_TABLE(table), 10);    gtk_table_set_col_spacings(GTK_TABLE(table), 10);
664    gtk_table_set_row_spacings(GTK_TABLE(table), 5);    gtk_table_set_row_spacings(GTK_TABLE(table), 5);
665    
# Line 667  gboolean area_edit(area_edit_t *area) { Line 694  gboolean area_edit(area_edit_t *area) {
694    label = gtk_label_new(_("(recommended min/max diff <0.03 degrees)"));    label = gtk_label_new(_("(recommended min/max diff <0.03 degrees)"));
695    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 3, 2, 3);    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 3, 2, 3);
696    
697      /* error label */
698      context.direct.error = gtk_label_new("");
699      gtk_widget_modify_fg(context.direct.error, GTK_STATE_NORMAL, &color);
700      gtk_table_attach_defaults(GTK_TABLE(table), context.direct.error, 0, 3, 3, 4);
701    
702    gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);    gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
703    gtk_notebook_append_page(GTK_NOTEBOOK(context.notebook),    gtk_notebook_append_page(GTK_NOTEBOOK(context.notebook),
704             vbox, gtk_label_new(_(TAB_LABEL_DIRECT)));             vbox, gtk_label_new(_(TAB_LABEL_DIRECT)));
# Line 674  gboolean area_edit(area_edit_t *area) { Line 706  gboolean area_edit(area_edit_t *area) {
706    /* ------------- center/extent edit ------------------------ */    /* ------------- center/extent edit ------------------------ */
707    
708    vbox = gtk_vbox_new(FALSE, 10);    vbox = gtk_vbox_new(FALSE, 10);
709    table = gtk_table_new(3, 4, FALSE);  // x, y    table = gtk_table_new(3, 5, FALSE);  // x, y
710    gtk_table_set_col_spacings(GTK_TABLE(table), 10);    gtk_table_set_col_spacings(GTK_TABLE(table), 10);
711    gtk_table_set_row_spacings(GTK_TABLE(table), 5);    gtk_table_set_row_spacings(GTK_TABLE(table), 5);
712    
# Line 728  gboolean area_edit(area_edit_t *area) { Line 760  gboolean area_edit(area_edit_t *area) {
760    label = gtk_label_new(_("(recommended width/height < 2km/1.25mi)"));    label = gtk_label_new(_("(recommended width/height < 2km/1.25mi)"));
761    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 3, 3, 4);    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 3, 3, 4);
762    
763      /* error label */
764      context.extent.error = gtk_label_new("");
765      gtk_widget_modify_fg(context.extent.error, GTK_STATE_NORMAL, &color);
766      gtk_table_attach_defaults(GTK_TABLE(table), context.extent.error, 0, 3, 4, 5);
767    
768    gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);    gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
769    gtk_notebook_append_page(GTK_NOTEBOOK(context.notebook),    gtk_notebook_append_page(GTK_NOTEBOOK(context.notebook),
770                     vbox, gtk_label_new(_(TAB_LABEL_EXTENT)));                     vbox, gtk_label_new(_(TAB_LABEL_EXTENT)));

Legend:
Removed from v.273  
changed lines
  Added in v.275