You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(92) |
Dec
(141) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(126) |
Feb
(72) |
Mar
(31) |
Apr
(200) |
May
(81) |
Jun
(130) |
Jul
(112) |
Aug
(134) |
Sep
(76) |
Oct
(89) |
Nov
(153) |
Dec
(9) |
2007 |
Jan
(59) |
Feb
(82) |
Mar
(50) |
Apr
(20) |
May
(9) |
Jun
(81) |
Jul
(41) |
Aug
(109) |
Sep
(91) |
Oct
(87) |
Nov
(33) |
Dec
(60) |
2008 |
Jan
(21) |
Feb
(15) |
Mar
(38) |
Apr
(75) |
May
(59) |
Jun
(46) |
Jul
(30) |
Aug
(20) |
Sep
(35) |
Oct
(32) |
Nov
(34) |
Dec
(19) |
2009 |
Jan
(29) |
Feb
(71) |
Mar
(54) |
Apr
(17) |
May
(4) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(58) |
Sep
(7) |
Oct
(7) |
Nov
(12) |
Dec
(18) |
2011 |
Jan
(17) |
Feb
(29) |
Mar
(11) |
Apr
(5) |
May
(1) |
Jun
|
Jul
|
Aug
(11) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(87) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(44) |
Jun
(79) |
Jul
(16) |
Aug
(31) |
Sep
|
Oct
(51) |
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Ehud S. <esh...@us...> - 2006-11-24 11:09:20
|
Update of /cvsroot/roadmap/roadmap_editor/src/ssd In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24544 Modified Files: ssd_button.c Log Message: Modify button icons. Add sound. Index: ssd_button.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_button.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ssd_button.c 21 Nov 2006 09:32:51 -0000 1.3 --- ssd_button.c 24 Nov 2006 11:09:17 -0000 1.4 *************** *** 32,35 **** --- 32,36 ---- #include "roadmap_res.h" #include "roadmap_canvas.h" + #include "roadmap_sound.h" #include "ssd_widget.h" *************** *** 114,117 **** --- 115,123 ---- struct ssd_button_data *data = (struct ssd_button_data *) widget->data; + RoadMapSoundList list = roadmap_sound_list_create (); + if (roadmap_sound_list_add (list, "click.wav") != -1) { + roadmap_sound_play_list (list); + } + if (widget->callback) { (*widget->callback) (widget, SSD_BUTTON_SHORT_CLICK); *************** *** 128,131 **** --- 134,142 ---- struct ssd_button_data *data = (struct ssd_button_data *) widget->data; + RoadMapSoundList list = roadmap_sound_list_create (); + if (roadmap_sound_list_add (list, "click_long.wav") != -1) { + roadmap_sound_play_list (list); + } + if (widget->callback) { (*widget->callback) (widget, SSD_BUTTON_LONG_CLICK); *************** *** 197,202 **** int flags, SsdCallback callback) { ! const char *button_icon[] = {"button"}; ! SsdWidget button = ssd_button_new (name, "", button_icon, 1, flags, callback); ssd_widget_add (button, --- 208,213 ---- int flags, SsdCallback callback) { ! const char *button_icon[] = {"button_up", "button_down"}; ! SsdWidget button = ssd_button_new (name, "", button_icon, 2, flags, callback); ssd_widget_add (button, |
From: Ehud S. <esh...@us...> - 2006-11-24 11:08:47
|
Update of /cvsroot/roadmap/roadmap_editor/src/navigate In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv24153 Modified Files: navigate_main.c navigate_plugin.c Added Files: navigate_traffic.c navigate_traffic.h Log Message: Calculate routes using traffic statistics. --- NEW FILE: navigate_traffic.c --- /* navigate_traffic.c - manage traffic statistics * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See navigate_traffic.h */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include "roadmap.h" #include "roadmap_line.h" #include "roadmap_line_route.h" #include "roadmap_lang.h" #include "roadmap_layer.h" #include "roadmap_locator.h" #include "roadmap_config.h" #include "roadmap_start.h" #include "roadmap_main.h" #include "navigate_traffic.h" #define MAX_LAYERS (ROADMAP_ROAD_LAST + 1) #define MAX_PEN_LAYERS 2 #define MAX_ROAD_COLORS 2 static RoadMapConfigDescriptor NavigateUseTrafficCfg = ROADMAP_CONFIG_ITEM("Traffic", "Use for calculating routes"); static RoadMapConfigDescriptor TrafficDisplayEnabledCfg = ROADMAP_CONFIG_ITEM("Traffic", "Display traffic information"); static int TrafficDisplayEnabled = 0; static RoadMapPen TrafficPens[MAX_LAYERS][MAX_PEN_LAYERS]; #define STATE_UNKNOWN 0x00 #define STATE_NORMAL 0x01 #define STATE_CONGESTION 0x02 #define CACHE_ENTRY 2 typedef struct navigate_cache { int fips; int *bits; int size; /* amount of entries (2 bits per entry) */ } NavigateCache; static NavigateCache Cache; static int CacheMask; #ifdef SSD #include "ssd/ssd_dialog.h" #include "ssd/ssd_container.h" #include "ssd/ssd_text.h" #include "ssd/ssd_choice.h" #include "ssd/ssd_button.h" static const char *yesno_label[2]; static const char *yesno[2]; static int button_callback (SsdWidget widget, const char *new_value) { if (!strcmp(widget->name, "OK")) { roadmap_config_set (&NavigateUseTrafficCfg, (const char *)ssd_dialog_get_data ("navigate")); roadmap_config_set (&TrafficDisplayEnabledCfg, (const char *)ssd_dialog_get_data ("display")); navigate_traffic_display (roadmap_config_match(&TrafficDisplayEnabledCfg, "yes")); ssd_dialog_hide_current (); return 1; } ssd_dialog_hide_current (); return 1; } static void create_ssd_dialog (void) { SsdWidget box; SsdWidget dialog = ssd_dialog_new ("traffic_prefs", roadmap_lang_get ("Traffic preferences"), SSD_CONTAINER_BORDER|SSD_CONTAINER_TITLE| SSD_DIALOG_FLOAT|SSD_ALIGN_CENTER|SSD_ALIGN_VCENTER); if (!yesno[0]) { yesno_label[0] = roadmap_lang_get ("Yes"); yesno_label[1] = roadmap_lang_get ("No"); yesno[0] = "yes"; yesno[1] = "no"; } ssd_widget_set_color (dialog, "#000000", "#ffffffee"); box = ssd_container_new ("navigate group", NULL, SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_WIDGET_SPACE|SSD_END_ROW); ssd_widget_set_color (box, "#000000", NULL); ssd_widget_add (box, ssd_text_new ("navigate_label", roadmap_lang_get ("Use for calculating routes"), -1, SSD_TEXT_LABEL|SSD_END_ROW)); ssd_widget_add (box, ssd_choice_new ("navigate", 2, (const char **)yesno_label, (const void **)yesno, SSD_END_ROW, NULL)); ssd_widget_add (dialog, box); box = ssd_container_new ("display group", NULL, SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_WIDGET_SPACE|SSD_END_ROW); ssd_widget_set_color (box, "#000000", NULL); ssd_widget_add (box, ssd_text_new ("display_label", roadmap_lang_get ("Display traffic information"), -1, SSD_TEXT_LABEL|SSD_END_ROW)); ssd_widget_add (box, ssd_choice_new ("display", 2, (const char **)yesno_label, (const void **)yesno, SSD_END_ROW, NULL)); ssd_widget_add (dialog, box); ssd_widget_add (dialog, ssd_button_label ("OK", roadmap_lang_get ("Ok"), SSD_ALIGN_CENTER|SSD_START_NEW_ROW, button_callback)); } void traffic_preferences (void) { const char *value; if (!ssd_dialog_activate ("traffic_prefs", NULL)) { create_ssd_dialog (); ssd_dialog_activate ("traffic_prefs", NULL); } if (roadmap_config_match(&NavigateUseTrafficCfg, "yes")) value = yesno[0]; else value = yesno[1]; ssd_dialog_set_data ("navigate", (void *) value); if (roadmap_config_match(&TrafficDisplayEnabledCfg, "yes")) value = yesno[0]; else value=yesno[1]; ssd_dialog_set_data ("display", (void *) value); } #else void traffic_preferences (void) {} #endif static void create_pens (void) { int i; int j; char name[80]; /* FIXME should only create pens for road class */ for (i=1; i<MAX_LAYERS; ++i) for (j=0; j<MAX_PEN_LAYERS; j++) { RoadMapPen *pen = &TrafficPens[i][j]; snprintf (name, sizeof(name), "TrafficPen%d", i*100+j*10); *pen = roadmap_canvas_create_pen (name); if (!j) { roadmap_canvas_set_foreground ("#000000"); } else { roadmap_canvas_set_foreground ("dark red"); } roadmap_canvas_set_thickness (1); } } static void verify_cache (int fips) { int count; if (Cache.fips == fips) return; if (Cache.fips != -1) navigate_traffic_refresh (); count = roadmap_line_count(); if (Cache.size >= count) return; if (Cache.size) { free (Cache.bits); } Cache.fips = fips; Cache.size = count; Cache.bits = calloc ((Cache.size / (8 / CACHE_ENTRY * sizeof(int))) + 1, sizeof(int)); roadmap_check_allocated(Cache.bits); } static int cache_get (int fips, int line) { int res; int shift; verify_cache (fips); res = Cache.bits[line / (8 / CACHE_ENTRY * sizeof(int))]; shift = (line % (8 * sizeof(int) / CACHE_ENTRY)) * CACHE_ENTRY; res = res >> shift; return res & CacheMask; } static void cache_set (int fips, int line, int state) { int *res; int shift; res = &Cache.bits[line / (8 / CACHE_ENTRY * sizeof(int))]; shift = (line % (8 * sizeof(int) / CACHE_ENTRY)) * CACHE_ENTRY; state = state << shift; *res = *res | state; } /* TODO: this is a bad callback which is called from roadmap_layer_adjust(). * This should be changed. Currently when the editor is enabled, an explicit * call to roadmap_layer_adjust() is called. When this is fixed, that call * should be removed. */ void navigate_traffic_adjust_layer (int layer, int thickness, int pen_count) { int i; if (layer > ROADMAP_ROAD_LAST) return; if (thickness < 1) thickness = 1; if ((pen_count > 1) && (thickness < 3)) { pen_count = 1; } for (i=0; i<MAX_PEN_LAYERS; i++) { RoadMapPen *pen = &TrafficPens[layer][i]; roadmap_canvas_select_pen (*pen); if (i == 1) { roadmap_canvas_set_thickness (thickness - 2); } else { roadmap_canvas_set_thickness (thickness); } } } void navigate_traffic_initialize (void) { int i; for (i=0; i<CACHE_ENTRY; i++) { CacheMask = (CacheMask << 1) | 1; } create_pens (); roadmap_config_declare_enumeration ("preferences", &TrafficDisplayEnabledCfg, "no", "yes", NULL); roadmap_config_declare_enumeration ("preferences", &NavigateUseTrafficCfg, "yes", "no", NULL); navigate_traffic_display (roadmap_config_match(&TrafficDisplayEnabledCfg, "yes")); roadmap_start_add_action ("traffic", "Traffic data", NULL, NULL, "Chage Traffic data settings", traffic_preferences); } void navigate_traffic_display (int status) { if (status && TrafficDisplayEnabled) { return; } else if (!status && !TrafficDisplayEnabled) { return; } TrafficDisplayEnabled = status; if (TrafficDisplayEnabled) { roadmap_layer_adjust (); } } int navigate_traffic_override_pen (int line, int cfcc, int fips, int pen_type, RoadMapPen *override_pen) { if (!TrafficDisplayEnabled) return 0; if (pen_type > 1) return 0; if (cfcc > 3) return 0; if (roadmap_locator_activate (fips) >= 0) { int avg1; int avg2; int speed1; int speed2; int cache_res; cache_res = cache_get (fips, line); if (cache_res == STATE_NORMAL) return 0; if (cache_res == STATE_CONGESTION) { *override_pen = TrafficPens[cfcc][pen_type]; return 1; } speed1 = roadmap_line_route_get_speed (line, 0); if (speed1) { avg1 = roadmap_line_route_get_avg_speed (line, 0); if (avg1 < 15) { cache_set (fips, line, STATE_NORMAL); return 0; } if (speed1 < (avg1 / 2)) { *override_pen = TrafficPens[cfcc][pen_type]; cache_set (fips, line, STATE_CONGESTION); return 1; } } speed2 = roadmap_line_route_get_speed (line, 1); if (speed2) { avg2 = roadmap_line_route_get_avg_speed (line, 1); if (avg2 < 15) { cache_set (fips, line, STATE_NORMAL); return 0; } if (speed2 < (avg2 / 2)) { *override_pen = TrafficPens[cfcc][pen_type]; cache_set (fips, line, STATE_CONGESTION); return 1; } } } cache_set (fips, line, STATE_NORMAL); return 0; } void navigate_traffic_refresh (void) { Cache.fips = -1; if (Cache.size) { memset(Cache.bits, 0, Cache.size / (8/CACHE_ENTRY*sizeof(int)) * sizeof(int)); } } int navigate_traffic_get_cross_time (int line, int direction) { if (!roadmap_config_match(&NavigateUseTrafficCfg, "yes")) return 0; return roadmap_line_route_get_cross_time (line, direction); } Index: navigate_plugin.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/navigate/navigate_plugin.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** navigate_plugin.c 21 Nov 2006 09:30:24 -0000 1.3 --- navigate_plugin.c 24 Nov 2006 11:08:35 -0000 1.4 *************** *** 31,34 **** --- 31,35 ---- #include "navigate_main.h" + #include "navigate_traffic.h" #include "navigate_plugin.h" *************** *** 41,45 **** NULL, NULL, ! &navigate_main_override_pen, &navigate_main_screen_repaint, NULL, --- 42,46 ---- NULL, NULL, ! &navigate_traffic_override_pen, &navigate_main_screen_repaint, NULL, *************** *** 47,51 **** NULL, NULL, ! &navigate_main_adjust_layer, NULL, NULL, --- 48,52 ---- NULL, NULL, ! &navigate_traffic_adjust_layer, NULL, NULL, --- NEW FILE: navigate_traffic.h --- /* navigate_traffic.h - MAnage traffic statistics * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef INCLUDE__NAVIGATE_TRAFFIC__H #define INCLUDE__NAVIGATE_TRAFFIC__H #include "roadmap_canvas.h" void navigate_traffic_initialize (void); void navigate_traffic_adjust_layer (int layer, int thickness, int pen_count); void navigate_traffic_display (int status); int navigate_traffic_override_pen (int line, int cfcc, int fips, int pen_type, RoadMapPen *override_pen); void navigate_traffic_refresh (void); int navigate_traffic_get_cross_time (int line, int direction); #endif // INCLUDE__NAVIGATE_TRAFFIC__H Index: navigate_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/navigate/navigate_main.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** navigate_main.c 21 Nov 2006 09:30:23 -0000 1.16 --- navigate_main.c 24 Nov 2006 11:08:35 -0000 1.17 *************** *** 64,73 **** #include "navigate_bar.h" #include "navigate_instr.h" #include "navigate_main.h" #define ROUTE_PEN_WIDTH 4 - #define MAX_LAYERS (ROADMAP_ROAD_LAST + 1) - #define MAX_PEN_LAYERS 2 - #define MAX_ROAD_COLORS 2 int NavigateEnabled = 0; --- 64,71 ---- #include "navigate_bar.h" #include "navigate_instr.h" + #include "navigate_traffic.h" #include "navigate_main.h" #define ROUTE_PEN_WIDTH 4 int NavigateEnabled = 0; *************** *** 77,81 **** static RoadMapPen NavigatePen; static RoadMapPen NavigatePenEst; - static RoadMapPen TrafficPens[MAX_LAYERS][MAX_PEN_LAYERS]; static void navigate_update (RoadMapPosition *position, PluginLine *current); --- 75,78 ---- *************** *** 109,170 **** - static void create_pens (void) { - - int i; - int j; - char name[80]; - - /* FIXME should only create pens for road class */ - - for (i=1; i<MAX_LAYERS; ++i) - for (j=0; j<MAX_PEN_LAYERS; j++) { - - RoadMapPen *pen = &TrafficPens[i][j]; - - snprintf (name, sizeof(name), "TrafficPen%d", i*100+j*10); - *pen = roadmap_canvas_create_pen (name); - - if (!j) { - roadmap_canvas_set_foreground ("#000000"); - } else { - roadmap_canvas_set_foreground ("dark red"); - } - roadmap_canvas_set_thickness (1); - } - } - - - /* TODO: this is a bad callback which is called from roadmap_layer_adjust(). - * This should be changed. Currently when the editor is enabled, an explicit - * call to roadmap_layer_adjust() is called. When this is fixed, that call - * should be removed. - */ - void navigate_main_adjust_layer (int layer, int thickness, int pen_count) { - - int i; - - if (layer > ROADMAP_ROAD_LAST) return; - - if (thickness < 1) thickness = 1; - if ((pen_count > 1) && (thickness < 3)) { - pen_count = 1; - } - - for (i=0; i<MAX_PEN_LAYERS; i++) { - - RoadMapPen *pen = &TrafficPens[layer][i]; - - roadmap_canvas_select_pen (*pen); - - if (i == 1) { - roadmap_canvas_set_thickness (thickness - 2); - } else { - roadmap_canvas_set_thickness (thickness); - } - - } - } - - static int navigate_find_track_points (PluginLine *from_line, int *from_point, PluginLine *to_line, int *to_point) { --- 106,109 ---- *************** *** 717,725 **** roadmap_canvas_set_thickness (ROUTE_PEN_WIDTH); - create_pens (); - navigate_bar_initialize (); - NavigatePluginID = navigate_plugin_register (); navigate_main_set (1); --- 656,662 ---- roadmap_canvas_set_thickness (ROUTE_PEN_WIDTH); navigate_bar_initialize (); NavigatePluginID = navigate_plugin_register (); + navigate_traffic_initialize (); navigate_main_set (1); *************** *** 741,748 **** NavigateEnabled = status; - - if (NavigateEnabled) { - roadmap_layer_adjust (); - } } --- 678,681 ---- *************** *** 922,989 **** - int navigate_main_override_pen (int line, - int cfcc, - int fips, - int pen_type, - RoadMapPen *override_pen) { - - if (pen_type > 1) return 0; - - if (cfcc > 3) return 0; - - return 0; - - if (roadmap_locator_activate (fips) >= 0) { - int avg1; - int avg2; - int speed1; - int speed2; - - speed1 = roadmap_line_route_get_speed (line, 0); - - if (speed1) { - avg1 = roadmap_line_route_get_avg_speed (line, 0); - if (avg1 < 20) return 0; - - if (speed1 < (avg1 / 2)) { - *override_pen = TrafficPens[cfcc][pen_type]; - return 1; - } - } - - speed2 = roadmap_line_route_get_speed (line, 1); - - if (speed2) { - avg2 = roadmap_line_route_get_avg_speed (line, 1); - if (avg2 < 20) return 0; - - if (speed2 < (avg2 / 2)) { - *override_pen = TrafficPens[cfcc][pen_type]; - return 1; - } - } - } - - return 0; - - #if 0 - int j; - - for (j=0; j<NavigateNumSegments; j++) { - - if (line == NavigateSegments[j]) { - *override_pen = NavigatePen; - return 1; - } - } - - *override_pen = NULL; - return 0; - #endif - } - - int navigate_main_reload_data (void) { return navigate_reload_data (); } --- 855,861 ---- int navigate_main_reload_data (void) { + navigate_traffic_refresh (); return navigate_reload_data (); } |
From: Ehud S. <esh...@us...> - 2006-11-24 11:07:41
|
Update of /cvsroot/roadmap/roadmap_editor/src/navigate In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23743 Modified Files: navigate_dglib.c Log Message: Calculate routes using traffic statistics. Index: navigate_dglib.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/navigate/navigate_dglib.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** navigate_dglib.c 3 Nov 2006 12:40:11 -0000 1.8 --- navigate_dglib.c 24 Nov 2006 11:07:37 -0000 1.9 *************** *** 42,45 **** --- 42,46 ---- #include "navigate_main.h" + #include "navigate_traffic.h" #include "navigate_graph.h" *************** *** 79,83 **** if (from_line == -to_line) return 1; ! new_cost = roadmap_line_route_get_cross_time (abs(to_line), (to_line < 0)); if (new_cost) pOut->nEdgeCost = new_cost; --- 80,84 ---- if (from_line == -to_line) return 1; ! new_cost = navigate_traffic_get_cross_time (abs(to_line), (to_line < 0)); if (new_cost) pOut->nEdgeCost = new_cost; |
From: Ehud S. <esh...@us...> - 2006-11-24 11:06:41
|
Update of /cvsroot/roadmap/roadmap_editor/src/editor/track In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23323 Modified Files: editor_track_main.c Log Message: Do not create new roads by default. Index: editor_track_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/editor/track/editor_track_main.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** editor_track_main.c 17 Nov 2006 18:38:08 -0000 1.16 --- editor_track_main.c 24 Nov 2006 11:06:38 -0000 1.17 *************** *** 41,44 **** --- 41,46 ---- #include "roadmap_fuzzy.h" #include "roadmap_navigate.h" + #include "roadmap_start.h" + #include "roadmap_state.h" #include "roadmap_screen.h" *************** *** 79,82 **** --- 81,85 ---- static int is_new_track = 1; + static int EditorAllowNewRoads = 0; RoadMapPosition* track_point_pos (int index) { *************** *** 265,268 **** --- 268,275 ---- } + if (!EditorAllowNewRoads) { + road_type = ED_LINE_CONNECTION; + } + if (end_node.plugin_id == ROADMAP_PLUGIN_ID) { end_node.id = editor_point_roadmap_to_editor (end_node.id); *************** *** 496,500 **** int line_id = create_new_line (start_point, end_point, -1, end_node_id, 4); ! if ((line_id != -1) && (type == TRACK_ROAD_CONNECTION)) { int cfcc; int flags; --- 503,508 ---- int line_id = create_new_line (start_point, end_point, -1, end_node_id, 4); ! if ((line_id != -1) && ! ((type == TRACK_ROAD_CONNECTION) || !EditorAllowNewRoads)) { int cfcc; int flags; *************** *** 689,695 **** --- 697,719 ---- } + static void editor_track_toggle_new_roads (void) { + if (EditorAllowNewRoads) EditorAllowNewRoads = 0; + else EditorAllowNewRoads = 1; + roadmap_screen_redraw (); + } + + static int editor_allow_new_roads_state (void) { + + return EditorAllowNewRoads; + } void editor_track_initialize (void) { + roadmap_start_add_action ("togglenewroads", "Toggle new roads creation", NULL, NULL, + "Allow / prevent automatic creation of new roads", + editor_track_toggle_new_roads); + + roadmap_state_add ("new_roads", &editor_allow_new_roads_state); + roadmap_gps_register_listener(editor_gps_update); } |
From: Ehud S. <esh...@us...> - 2006-11-24 11:06:02
|
Update of /cvsroot/roadmap/roadmap_editor/src/editor In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22919 Modified Files: editor_screen.c Log Message: Add pointer registration priorities. Index: editor_screen.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/editor/editor_screen.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** editor_screen.c 21 Nov 2006 09:27:40 -0000 1.18 --- editor_screen.c 24 Nov 2006 11:05:56 -0000 1.19 *************** *** 288,292 **** SelectedLines[select_count].line = line; if (!select_count) { ! roadmap_pointer_register_long_click (editor_screen_long_click); } select_count++; --- 288,293 ---- SelectedLines[select_count].line = line; if (!select_count) { ! roadmap_pointer_register_long_click ! (editor_screen_long_click, POINTER_NORMAL); } select_count++; *************** *** 367,392 **** int has_route = 0; - return NO_ROAD_STATE; - if (plugin_id == ROADMAP_PLUGIN_ID) { - if (roadmap_locator_activate (fips) >= 0) { - int speed1 = roadmap_line_route_get_speed (line, 0); - int speed2 = roadmap_line_route_get_speed (line, 1); - int slow = 25; - - if (cfcc == ROADMAP_ROAD_FREEWAY) slow = 45; - - if (!speed1 && !speed2) return NO_ROAD_STATE; - - if (!speed1) speed1 = speed2; - else if (!speed2) speed2 = speed1; - - if ((speed1 <= slow) || (speed2 <= slow)) { - return NO_DATA_STATE; - } else { - return NO_ROAD_STATE; - } - } return NO_ROAD_STATE; --- 368,373 ---- *************** *** 797,801 **** if (status) { ! roadmap_pointer_register_short_click (editor_screen_short_click); roadmap_layer_adjust(); } else { --- 778,783 ---- if (status) { ! roadmap_pointer_register_short_click ! (editor_screen_short_click, POINTER_NORMAL); roadmap_layer_adjust(); } else { |
From: Ehud S. <esh...@us...> - 2006-11-24 11:04:41
|
Update of /cvsroot/roadmap/roadmap_editor/src/libpng In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv21932 Added Files: png.c pngconf.h pngerror.c pnggccrd.c pngget.c png.h pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c pngset.c pngtest.c pngtrans.c pngvcrd.c pngwio.c pngwrite.c pngwtran.c pngwutil.c Log Message: Import libpng. --- NEW FILE: pngwtran.c --- /* pngwtran.c - transforms the data in a row for PNG writers * * Last changed in libpng 1.2.9 April 14, 2006 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2006 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ #define PNG_INTERNAL #include "png.h" #ifdef PNG_WRITE_SUPPORTED /* Transform the data according to the user's wishes. The order of * transformations is significant. */ void /* PRIVATE */ png_do_write_transformations(png_structp png_ptr) { png_debug(1, "in png_do_write_transformations\n"); if (png_ptr == NULL) return; #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) if (png_ptr->transformations & PNG_USER_TRANSFORM) if(png_ptr->write_user_transform_fn != NULL) (*(png_ptr->write_user_transform_fn)) /* user write transform function */ (png_ptr, /* png_ptr */ &(png_ptr->row_info), /* row_info: */ /* png_uint_32 width; width of row */ /* png_uint_32 rowbytes; number of bytes in row */ /* png_byte color_type; color type of pixels */ /* png_byte bit_depth; bit depth of samples */ /* png_byte channels; number of channels (1-4) */ /* png_byte pixel_depth; bits per pixel (depth*channels) */ png_ptr->row_buf + 1); /* start of pixel data for row */ #endif #if defined(PNG_WRITE_FILLER_SUPPORTED) if (png_ptr->transformations & PNG_FILLER) png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr->flags); #endif #if defined(PNG_WRITE_PACKSWAP_SUPPORTED) if (png_ptr->transformations & PNG_PACKSWAP) png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif #if defined(PNG_WRITE_PACK_SUPPORTED) if (png_ptr->transformations & PNG_PACK) png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1, (png_uint_32)png_ptr->bit_depth); #endif #if defined(PNG_WRITE_SWAP_SUPPORTED) if (png_ptr->transformations & PNG_SWAP_BYTES) png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif #if defined(PNG_WRITE_SHIFT_SUPPORTED) if (png_ptr->transformations & PNG_SHIFT) png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1, &(png_ptr->shift)); #endif #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) if (png_ptr->transformations & PNG_SWAP_ALPHA) png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) if (png_ptr->transformations & PNG_INVERT_ALPHA) png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif #if defined(PNG_WRITE_BGR_SUPPORTED) if (png_ptr->transformations & PNG_BGR) png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif #if defined(PNG_WRITE_INVERT_SUPPORTED) if (png_ptr->transformations & PNG_INVERT_MONO) png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1); #endif } #if defined(PNG_WRITE_PACK_SUPPORTED) /* Pack pixels into bytes. Pass the true bit depth in bit_depth. The * row_info bit depth should be 8 (one pixel per byte). The channels * should be 1 (this only happens on grayscale and paletted images). */ void /* PRIVATE */ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) { png_debug(1, "in png_do_pack\n"); if (row_info->bit_depth == 8 && #if defined(PNG_USELESS_TESTS_SUPPORTED) row != NULL && row_info != NULL && #endif row_info->channels == 1) { switch ((int)bit_depth) { case 1: { png_bytep sp, dp; int mask, v; png_uint_32 i; png_uint_32 row_width = row_info->width; sp = row; dp = row; mask = 0x80; v = 0; for (i = 0; i < row_width; i++) { if (*sp != 0) v |= mask; sp++; if (mask > 1) mask >>= 1; else { mask = 0x80; *dp = (png_byte)v; dp++; v = 0; } } if (mask != 0x80) *dp = (png_byte)v; break; } case 2: { png_bytep sp, dp; int shift, v; png_uint_32 i; png_uint_32 row_width = row_info->width; sp = row; dp = row; shift = 6; v = 0; for (i = 0; i < row_width; i++) { png_byte value; value = (png_byte)(*sp & 0x03); v |= (value << shift); if (shift == 0) { shift = 6; *dp = (png_byte)v; dp++; v = 0; } else shift -= 2; sp++; } if (shift != 6) *dp = (png_byte)v; break; } case 4: { png_bytep sp, dp; int shift, v; png_uint_32 i; png_uint_32 row_width = row_info->width; sp = row; dp = row; shift = 4; v = 0; for (i = 0; i < row_width; i++) { png_byte value; value = (png_byte)(*sp & 0x0f); v |= (value << shift); if (shift == 0) { shift = 4; *dp = (png_byte)v; dp++; v = 0; } else shift -= 4; sp++; } if (shift != 4) *dp = (png_byte)v; break; } } row_info->bit_depth = (png_byte)bit_depth; row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels); row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->width); } } #endif #if defined(PNG_WRITE_SHIFT_SUPPORTED) /* Shift pixel values to take advantage of whole range. Pass the * true number of bits in bit_depth. The row should be packed * according to row_info->bit_depth. Thus, if you had a row of * bit depth 4, but the pixels only had values from 0 to 7, you * would pass 3 as bit_depth, and this routine would translate the * data to 0 to 15. */ void /* PRIVATE */ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth) { png_debug(1, "in png_do_shift\n"); #if defined(PNG_USELESS_TESTS_SUPPORTED) if (row != NULL && row_info != NULL && #else if ( #endif row_info->color_type != PNG_COLOR_TYPE_PALETTE) { int shift_start[4], shift_dec[4]; int channels = 0; if (row_info->color_type & PNG_COLOR_MASK_COLOR) { shift_start[channels] = row_info->bit_depth - bit_depth->red; shift_dec[channels] = bit_depth->red; channels++; shift_start[channels] = row_info->bit_depth - bit_depth->green; shift_dec[channels] = bit_depth->green; channels++; shift_start[channels] = row_info->bit_depth - bit_depth->blue; shift_dec[channels] = bit_depth->blue; channels++; } else { shift_start[channels] = row_info->bit_depth - bit_depth->gray; shift_dec[channels] = bit_depth->gray; channels++; } if (row_info->color_type & PNG_COLOR_MASK_ALPHA) { shift_start[channels] = row_info->bit_depth - bit_depth->alpha; shift_dec[channels] = bit_depth->alpha; channels++; } /* with low row depths, could only be grayscale, so one channel */ if (row_info->bit_depth < 8) { png_bytep bp = row; png_uint_32 i; png_byte mask; png_uint_32 row_bytes = row_info->rowbytes; if (bit_depth->gray == 1 && row_info->bit_depth == 2) mask = 0x55; else if (row_info->bit_depth == 4 && bit_depth->gray == 3) mask = 0x11; else mask = 0xff; for (i = 0; i < row_bytes; i++, bp++) { png_uint_16 v; int j; v = *bp; *bp = 0; for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0]) { if (j > 0) *bp |= (png_byte)((v << j) & 0xff); else *bp |= (png_byte)((v >> (-j)) & mask); } } } else if (row_info->bit_depth == 8) { png_bytep bp = row; png_uint_32 i; png_uint_32 istop = channels * row_info->width; for (i = 0; i < istop; i++, bp++) { png_uint_16 v; int j; int c = (int)(i%channels); v = *bp; *bp = 0; for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c]) { if (j > 0) *bp |= (png_byte)((v << j) & 0xff); else *bp |= (png_byte)((v >> (-j)) & 0xff); } } } else { png_bytep bp; png_uint_32 i; png_uint_32 istop = channels * row_info->width; for (bp = row, i = 0; i < istop; i++) { int c = (int)(i%channels); png_uint_16 value, v; int j; v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1)); value = 0; for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c]) { if (j > 0) value |= (png_uint_16)((v << j) & (png_uint_16)0xffff); else value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff); } *bp++ = (png_byte)(value >> 8); *bp++ = (png_byte)(value & 0xff); } } } } #endif #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) void /* PRIVATE */ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_write_swap_alpha\n"); #if defined(PNG_USELESS_TESTS_SUPPORTED) if (row != NULL && row_info != NULL) #endif { if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { /* This converts from ARGB to RGBA */ if (row_info->bit_depth == 8) { png_bytep sp, dp; png_uint_32 i; png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { png_byte save = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = save; } } /* This converts from AARRGGBB to RRGGBBAA */ else { png_bytep sp, dp; png_uint_32 i; png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { png_byte save[2]; save[0] = *(sp++); save[1] = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = save[0]; *(dp++) = save[1]; } } } else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { /* This converts from AG to GA */ if (row_info->bit_depth == 8) { png_bytep sp, dp; png_uint_32 i; png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { png_byte save = *(sp++); *(dp++) = *(sp++); *(dp++) = save; } } /* This converts from AAGG to GGAA */ else { png_bytep sp, dp; png_uint_32 i; png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { png_byte save[2]; save[0] = *(sp++); save[1] = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = save[0]; *(dp++) = save[1]; } } } } } #endif #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) void /* PRIVATE */ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_write_invert_alpha\n"); #if defined(PNG_USELESS_TESTS_SUPPORTED) if (row != NULL && row_info != NULL) #endif { if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { /* This inverts the alpha channel in RGBA */ if (row_info->bit_depth == 8) { png_bytep sp, dp; png_uint_32 i; png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { /* does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); */ sp+=3; dp = sp; *(dp++) = (png_byte)(255 - *(sp++)); } } /* This inverts the alpha channel in RRGGBBAA */ else { png_bytep sp, dp; png_uint_32 i; png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { /* does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); *(dp++) = *(sp++); */ sp+=6; dp = sp; *(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++)); } } } else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { /* This inverts the alpha channel in GA */ if (row_info->bit_depth == 8) { png_bytep sp, dp; png_uint_32 i; png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { *(dp++) = *(sp++); *(dp++) = (png_byte)(255 - *(sp++)); } } /* This inverts the alpha channel in GGAA */ else { png_bytep sp, dp; png_uint_32 i; png_uint_32 row_width = row_info->width; for (i = 0, sp = dp = row; i < row_width; i++) { /* does nothing *(dp++) = *(sp++); *(dp++) = *(sp++); */ sp+=2; dp = sp; *(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++)); } } } } } #endif #if defined(PNG_MNG_FEATURES_SUPPORTED) /* undoes intrapixel differencing */ void /* PRIVATE */ png_do_write_intrapixel(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_write_intrapixel\n"); if ( #if defined(PNG_USELESS_TESTS_SUPPORTED) row != NULL && row_info != NULL && #endif (row_info->color_type & PNG_COLOR_MASK_COLOR)) { int bytes_per_pixel; png_uint_32 row_width = row_info->width; if (row_info->bit_depth == 8) { png_bytep rp; png_uint_32 i; if (row_info->color_type == PNG_COLOR_TYPE_RGB) bytes_per_pixel = 3; else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) bytes_per_pixel = 4; else return; for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) { *(rp) = (png_byte)((*rp - *(rp+1))&0xff); *(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff); } } else if (row_info->bit_depth == 16) { png_bytep rp; png_uint_32 i; if (row_info->color_type == PNG_COLOR_TYPE_RGB) bytes_per_pixel = 6; else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) bytes_per_pixel = 8; else return; for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) { png_uint_32 s0 = (*(rp ) << 8) | *(rp+1); png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3); png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5); png_uint_32 red = (png_uint_32)((s0-s1) & 0xffffL); png_uint_32 blue = (png_uint_32)((s2-s1) & 0xffffL); *(rp ) = (png_byte)((red >> 8) & 0xff); *(rp+1) = (png_byte)(red & 0xff); *(rp+4) = (png_byte)((blue >> 8) & 0xff); *(rp+5) = (png_byte)(blue & 0xff); } } } } #endif /* PNG_MNG_FEATURES_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */ --- NEW FILE: pngrio.c --- /* pngrio.c - functions for data input * * Last changed in libpng 1.2.9 April 14, 2006 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2006 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * This file provides a location for all input. Users who need * special handling are expected to write a function that has the same * arguments as this and performs a similar function, but that possibly * has a different input method. Note that you shouldn't change this * function, but rather write a replacement function and then make * libpng use it at run time with png_set_read_fn(...). */ #define PNG_INTERNAL #include "png.h" #if defined(PNG_READ_SUPPORTED) /* Read the data from whatever input you are using. The default routine reads from a file pointer. Note that this routine sometimes gets called with very small lengths, so you should implement some kind of simple buffering if you are using unbuffered reads. This should never be asked to read more then 64K on a 16 bit machine. */ void /* PRIVATE */ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { png_debug1(4,"reading %d bytes\n", (int)length); if (png_ptr->read_data_fn != NULL) (*(png_ptr->read_data_fn))(png_ptr, data, length); else png_error(png_ptr, "Call to NULL read function"); } #if !defined(PNG_NO_STDIO) /* This is the function that does the actual reading of data. If you are not reading from a standard C stream, you should create a replacement read_data function and use it at run time with png_set_read_fn(), rather than changing the library. */ #ifndef USE_FAR_KEYWORD void PNGAPI png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { png_size_t check; /* fread() returns 0 on error, so it is OK to store this in a png_size_t * instead of an int, which is what fread() actually returns. */ #if defined(_WIN32_WCE) if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) check = 0; #else check = (png_size_t)fread(data, (png_size_t)1, length, (png_FILE_p)png_ptr->io_ptr); #endif if (check != length) png_error(png_ptr, "Read Error"); } #else /* this is the model-independent version. Since the standard I/O library can't handle far buffers in the medium and small models, we have to copy the data. */ #define NEAR_BUF_SIZE 1024 #define MIN(a,b) (a <= b ? a : b) static void PNGAPI png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { int check; png_byte *n_data; png_FILE_p io_ptr; /* Check if data really is near. If so, use usual code. */ n_data = (png_byte *)CVT_PTR_NOCHECK(data); io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); if ((png_bytep)n_data == data) { #if defined(_WIN32_WCE) if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) check = 0; #else check = fread(n_data, 1, length, io_ptr); #endif } else { png_byte buf[NEAR_BUF_SIZE]; png_size_t read, remaining, err; check = 0; remaining = length; do { read = MIN(NEAR_BUF_SIZE, remaining); #if defined(_WIN32_WCE) if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) ) err = 0; #else err = fread(buf, (png_size_t)1, read, io_ptr); #endif png_memcpy(data, buf, read); /* copy far buffer to near buffer */ if(err != read) break; else check += err; data += read; remaining -= read; } while (remaining != 0); } if ((png_uint_32)check != (png_uint_32)length) png_error(png_ptr, "read Error"); } #endif #endif /* This function allows the application to supply a new input function for libpng if standard C streams aren't being used. This function takes as its arguments: png_ptr - pointer to a png input data structure io_ptr - pointer to user supplied structure containing info about the input functions. May be NULL. read_data_fn - pointer to a new input function that takes as its arguments a pointer to a png_struct, a pointer to a location where input data can be stored, and a 32-bit unsigned int that is the number of bytes to be read. To exit and output any fatal error messages the new write function should call png_error(png_ptr, "Error msg"). */ void PNGAPI png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn) { png_ptr->io_ptr = io_ptr; #if !defined(PNG_NO_STDIO) if (read_data_fn != NULL) png_ptr->read_data_fn = read_data_fn; else png_ptr->read_data_fn = png_default_read_data; #else png_ptr->read_data_fn = read_data_fn; #endif /* It is an error to write to a read device */ if (png_ptr->write_data_fn != NULL) { png_ptr->write_data_fn = NULL; png_warning(png_ptr, "It's an error to set both read_data_fn and write_data_fn in the "); png_warning(png_ptr, "same structure. Resetting write_data_fn to NULL."); } #if defined(PNG_WRITE_FLUSH_SUPPORTED) png_ptr->output_flush_fn = NULL; #endif } #endif /* PNG_READ_SUPPORTED */ --- NEW FILE: pngvcrd.c --- /* pngvcrd.c - mixed C/assembler version of utilities to read a PNG file * * For Intel x86 CPU and Microsoft Visual C++ compiler * * Last changed in libpng 1.2.6 - August 15, 2004 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2004 Glenn Randers-Pehrson * Copyright (c) 1998, Intel Corporation * * Contributed by Nirav Chhatrapati, Intel Corporation, 1998 * Interface to libpng contributed by Gilles Vollant, 1999 * * * In png_do_read_interlace() in libpng versions 1.0.3a through 1.0.4d, * a sign error in the post-MMX cleanup code for each pixel_depth resulted * in bad pixels at the beginning of some rows of some images, and also * (due to out-of-range memory reads and writes) caused heap corruption * when compiled with MSVC 6.0. The error was fixed in version 1.0.4e. [...3865 lines suppressed...] p = c; */ p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; *rp = (png_byte)(((int)(*rp) + p) & 0xff); rp++; } } break; } default: png_warning(png_ptr, "Ignoring bad row filter type"); *row=0; break; } } #endif /* PNG_ASSEMBLER_CODE_SUPPORTED && PNG_USE_PNGVCRD */ --- NEW FILE: pngget.c --- /* pngget.c - retrieval of values from info struct * * Last changed in libpng 1.2.9 April 14, 2006 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2006 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ #define PNG_INTERNAL #include "png.h" #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) png_uint_32 PNGAPI png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->valid & flag); else return(0); } png_uint_32 PNGAPI png_get_rowbytes(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->rowbytes); else return(0); } #if defined(PNG_INFO_IMAGE_SUPPORTED) png_bytepp PNGAPI png_get_rows(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->row_pointers); else return(0); } #endif #ifdef PNG_EASY_ACCESS_SUPPORTED /* easy access to info, added in libpng-0.99 */ png_uint_32 PNGAPI png_get_image_width(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) { return info_ptr->width; } return (0); } png_uint_32 PNGAPI png_get_image_height(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) { return info_ptr->height; } return (0); } png_byte PNGAPI png_get_bit_depth(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) { return info_ptr->bit_depth; } return (0); } png_byte PNGAPI png_get_color_type(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) { return info_ptr->color_type; } return (0); } png_byte PNGAPI png_get_filter_type(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) { return info_ptr->filter_type; } return (0); } png_byte PNGAPI png_get_interlace_type(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) { return info_ptr->interlace_type; } return (0); } png_byte PNGAPI png_get_compression_type(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) { return info_ptr->compression_type; } return (0); } png_uint_32 PNGAPI png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) #if defined(PNG_pHYs_SUPPORTED) if (info_ptr->valid & PNG_INFO_pHYs) { png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter"); if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER) return (0); else return (info_ptr->x_pixels_per_unit); } #else return (0); #endif return (0); } png_uint_32 PNGAPI png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) #if defined(PNG_pHYs_SUPPORTED) if (info_ptr->valid & PNG_INFO_pHYs) { png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter"); if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER) return (0); else return (info_ptr->y_pixels_per_unit); } #else return (0); #endif return (0); } png_uint_32 PNGAPI png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) #if defined(PNG_pHYs_SUPPORTED) if (info_ptr->valid & PNG_INFO_pHYs) { png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter"); if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER || info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit) return (0); else return (info_ptr->x_pixels_per_unit); } #else return (0); #endif return (0); } #ifdef PNG_FLOATING_POINT_SUPPORTED float PNGAPI png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) #if defined(PNG_pHYs_SUPPORTED) if (info_ptr->valid & PNG_INFO_pHYs) { png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio"); if (info_ptr->x_pixels_per_unit == 0) return ((float)0.0); else return ((float)((float)info_ptr->y_pixels_per_unit /(float)info_ptr->x_pixels_per_unit)); } #else return (0.0); #endif return ((float)0.0); } #endif png_int_32 PNGAPI png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) #if defined(PNG_oFFs_SUPPORTED) if (info_ptr->valid & PNG_INFO_oFFs) { png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns"); if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) return (0); else return (info_ptr->x_offset); } #else return (0); #endif return (0); } png_int_32 PNGAPI png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) #if defined(PNG_oFFs_SUPPORTED) if (info_ptr->valid & PNG_INFO_oFFs) { png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns"); if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) return (0); else return (info_ptr->y_offset); } #else return (0); #endif return (0); } png_int_32 PNGAPI png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) #if defined(PNG_oFFs_SUPPORTED) if (info_ptr->valid & PNG_INFO_oFFs) { png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns"); if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) return (0); else return (info_ptr->x_offset); } #else return (0); #endif return (0); } png_int_32 PNGAPI png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) #if defined(PNG_oFFs_SUPPORTED) if (info_ptr->valid & PNG_INFO_oFFs) { png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns"); if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) return (0); else return (info_ptr->y_offset); } #else return (0); #endif return (0); } #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) png_uint_32 PNGAPI png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) { return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr) *.0254 +.5)); } png_uint_32 PNGAPI png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) { return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr) *.0254 +.5)); } png_uint_32 PNGAPI png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) { return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr) *.0254 +.5)); } float PNGAPI png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr) { return ((float)png_get_x_offset_microns(png_ptr, info_ptr) *.00003937); } float PNGAPI png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr) { return ((float)png_get_y_offset_microns(png_ptr, info_ptr) *.00003937); } #if defined(PNG_pHYs_SUPPORTED) png_uint_32 PNGAPI png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) { png_uint_32 retval = 0; if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) { png_debug1(1, "in %s retrieval function\n", "pHYs"); if (res_x != NULL) { *res_x = info_ptr->x_pixels_per_unit; retval |= PNG_INFO_pHYs; } if (res_y != NULL) { *res_y = info_ptr->y_pixels_per_unit; retval |= PNG_INFO_pHYs; } if (unit_type != NULL) { *unit_type = (int)info_ptr->phys_unit_type; retval |= PNG_INFO_pHYs; if(*unit_type == 1) { if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50); if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50); } } } return (retval); } #endif /* PNG_pHYs_SUPPORTED */ #endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ /* png_get_channels really belongs in here, too, but it's been around longer */ #endif /* PNG_EASY_ACCESS_SUPPORTED */ png_byte PNGAPI png_get_channels(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->channels); else return (0); } png_bytep PNGAPI png_get_signature(png_structp png_ptr, png_infop info_ptr) { if (png_ptr != NULL && info_ptr != NULL) return(info_ptr->signature); else return (NULL); } #if defined(PNG_bKGD_SUPPORTED) png_uint_32 PNGAPI png_get_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p *background) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) && background != NULL) { png_debug1(1, "in %s retrieval function\n", "bKGD"); *background = &(info_ptr->background); return (PNG_INFO_bKGD); } return (0); } #endif #if defined(PNG_cHRM_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI png_get_cHRM(png_structp png_ptr, png_infop info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, double *blue_y) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) { png_debug1(1, "in %s retrieval function\n", "cHRM"); if (white_x != NULL) *white_x = (double)info_ptr->x_white; if (white_y != NULL) *white_y = (double)info_ptr->y_white; if (red_x != NULL) *red_x = (double)info_ptr->x_red; if (red_y != NULL) *red_y = (double)info_ptr->y_red; if (green_x != NULL) *green_x = (double)info_ptr->x_green; if (green_y != NULL) *green_y = (double)info_ptr->y_green; if (blue_x != NULL) *blue_x = (double)info_ptr->x_blue; if (blue_y != NULL) *blue_y = (double)info_ptr->y_blue; return (PNG_INFO_cHRM); } return (0); } #endif #ifdef PNG_FIXED_POINT_SUPPORTED png_uint_32 PNGAPI png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x, png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, png_fixed_point *blue_x, png_fixed_point *blue_y) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) { png_debug1(1, "in %s retrieval function\n", "cHRM"); if (white_x != NULL) *white_x = info_ptr->int_x_white; if (white_y != NULL) *white_y = info_ptr->int_y_white; if (red_x != NULL) *red_x = info_ptr->int_x_red; if (red_y != NULL) *red_y = info_ptr->int_y_red; if (green_x != NULL) *green_x = info_ptr->int_x_green; if (green_y != NULL) *green_y = info_ptr->int_y_green; if (blue_x != NULL) *blue_x = info_ptr->int_x_blue; if (blue_y != NULL) *blue_y = info_ptr->int_y_blue; return (PNG_INFO_cHRM); } return (0); } #endif #endif #if defined(PNG_gAMA_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) && file_gamma != NULL) { png_debug1(1, "in %s retrieval function\n", "gAMA"); *file_gamma = (double)info_ptr->gamma; return (PNG_INFO_gAMA); } return (0); } #endif #ifdef PNG_FIXED_POINT_SUPPORTED png_uint_32 PNGAPI png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point *int_file_gamma) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) && int_file_gamma != NULL) { png_debug1(1, "in %s retrieval function\n", "gAMA"); *int_file_gamma = info_ptr->int_gamma; return (PNG_INFO_gAMA); } return (0); } #endif #endif #if defined(PNG_sRGB_SUPPORTED) png_uint_32 PNGAPI png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB) && file_srgb_intent != NULL) { png_debug1(1, "in %s retrieval function\n", "sRGB"); *file_srgb_intent = (int)info_ptr->srgb_intent; return (PNG_INFO_sRGB); } return (0); } #endif #if defined(PNG_iCCP_SUPPORTED) png_uint_32 PNGAPI png_get_iCCP(png_structp png_ptr, png_infop info_ptr, png_charpp name, int *compression_type, png_charpp profile, png_uint_32 *proflen) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP) && name != NULL && profile != NULL && proflen != NULL) { png_debug1(1, "in %s retrieval function\n", "iCCP"); *name = info_ptr->iccp_name; *profile = info_ptr->iccp_profile; /* compression_type is a dummy so the API won't have to change if we introduce multiple compression types later. */ *proflen = (int)info_ptr->iccp_proflen; *compression_type = (int)info_ptr->iccp_compression; return (PNG_INFO_iCCP); } return (0); } #endif #if defined(PNG_sPLT_SUPPORTED) png_uint_32 PNGAPI png_get_sPLT(png_structp png_ptr, png_infop info_ptr, png_sPLT_tpp spalettes) { if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) *spalettes = info_ptr->splt_palettes; return ((png_uint_32)info_ptr->splt_palettes_num); } #endif #if defined(PNG_hIST_SUPPORTED) png_uint_32 PNGAPI png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) && hist != NULL) { png_debug1(1, "in %s retrieval function\n", "hIST"); *hist = info_ptr->hist; return (PNG_INFO_hIST); } return (0); } #endif png_uint_32 PNGAPI png_get_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_type, int *compression_type, int *filter_type) { if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL && bit_depth != NULL && color_type != NULL) { png_debug1(1, "in %s retrieval function\n", "IHDR"); *width = info_ptr->width; *height = info_ptr->height; *bit_depth = info_ptr->bit_depth; if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16) png_error(png_ptr, "Invalid bit depth"); *color_type = info_ptr->color_type; if (info_ptr->color_type > 6) png_error(png_ptr, "Invalid color type"); if (compression_type != NULL) *compression_type = info_ptr->compression_type; if (filter_type != NULL) *filter_type = info_ptr->filter_type; if (interlace_type != NULL) *interlace_type = info_ptr->interlace_type; /* check for potential overflow of rowbytes */ if (*width == 0 || *width > PNG_UINT_31_MAX) png_error(png_ptr, "Invalid image width"); if (*height == 0 || *height > PNG_UINT_31_MAX) png_error(png_ptr, "Invalid image height"); if (info_ptr->width > (PNG_UINT_32_MAX >> 3) /* 8-byte RGBA pixels */ - 64 /* bigrowbuf hack */ - 1 /* filter byte */ - 7*8 /* rounding of width to multiple of 8 pixels */ - 8) /* extra max_pixel_depth pad */ { png_warning(png_ptr, "Width too large for libpng to process image data."); } return (1); } return (0); } #if defined(PNG_oFFs_SUPPORTED) png_uint_32 PNGAPI png_get_oFFs(png_structp png_ptr, png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) && offset_x != NULL && offset_y != NULL && unit_type != NULL) { png_debug1(1, "in %s retrieval function\n", "oFFs"); *offset_x = info_ptr->x_offset; *offset_y = info_ptr->y_offset; *unit_type = (int)info_ptr->offset_unit_type; return (PNG_INFO_oFFs); } return (0); } #endif #if defined(PNG_pCAL_SUPPORTED) png_uint_32 PNGAPI png_get_pCAL(png_structp png_ptr, png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *units, png_charpp *params) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL) && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL && nparams != NULL && units != NULL && params != NULL) { png_debug1(1, "in %s retrieval function\n", "pCAL"); *purpose = info_ptr->pcal_purpose; *X0 = info_ptr->pcal_X0; *X1 = info_ptr->pcal_X1; *type = (int)info_ptr->pcal_type; *nparams = (int)info_ptr->pcal_nparams; *units = info_ptr->pcal_units; *params = info_ptr->pcal_params; return (PNG_INFO_pCAL); } return (0); } #endif #if defined(PNG_sCAL_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED png_uint_32 PNGAPI png_get_sCAL(png_structp png_ptr, png_infop info_ptr, int *unit, double *width, double *height) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL)) { *unit = info_ptr->scal_unit; *width = info_ptr->scal_pixel_width; *height = info_ptr->scal_pixel_height; return (PNG_INFO_sCAL); } return(0); } #else #ifdef PNG_FIXED_POINT_SUPPORTED png_uint_32 PNGAPI png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr, int *unit, png_charpp width, png_charpp height) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL)) { *unit = info_ptr->scal_unit; *width = info_ptr->scal_s_width; *height = info_ptr->scal_s_height; return (PNG_INFO_sCAL); } return(0); } #endif #endif #endif #if defined(PNG_pHYs_SUPPORTED) png_uint_32 PNGAPI png_get_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) { png_uint_32 retval = 0; if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) { png_debug1(1, "in %s retrieval function\n", "pHYs"); if (res_x != NULL) { *res_x = info_ptr->x_pixels_per_unit; retval |= PNG_INFO_pHYs; } if (res_y != NULL) { *res_y = info_ptr->y_pixels_per_unit; retval |= PNG_INFO_pHYs; } if (unit_type != NULL) { *unit_type = (int)info_ptr->phys_unit_type; retval |= PNG_INFO_pHYs; } } return (retval); } #endif png_uint_32 PNGAPI png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette, int *num_palette) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE) && palette != NULL) { png_debug1(1, "in %s retrieval function\n", "PLTE"); *palette = info_ptr->palette; *num_palette = info_ptr->num_palette; png_debug1(3, "num_palette = %d\n", *num_palette); return (PNG_INFO_PLTE); } return (0); } #if defined(PNG_sBIT_SUPPORTED) png_uint_32 PNGAPI png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) && sig_bit != NULL) { png_debug1(1, "in %s retrieval function\n", "sBIT"); *sig_bit = &(info_ptr->sig_bit); return (PNG_INFO_sBIT); } return (0); } #endif #if defined(PNG_TEXT_SUPPORTED) png_uint_32 PNGAPI png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, int *num_text) { if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0) { png_debug1(1, "in %s retrieval function\n", (png_ptr->chunk_name[0] == '\0' ? "text" : (png_const_charp)png_ptr->chunk_name)); if (text_ptr != NULL) *text_ptr = info_ptr->text; if (num_text != NULL) *num_text = info_ptr->num_text; return ((png_uint_32)info_ptr->num_text); } if (num_text != NULL) *num_text = 0; return(0); } #endif #if defined(PNG_tIME_SUPPORTED) png_uint_32 PNGAPI png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) { if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) && mod_time != NULL) { png_debug1(1, "in %s retrieval function\n", "tIME"); *mod_time = &(info_ptr->mod_time); return (PNG_INFO_tIME); } return (0); } #endif #if defined(PNG_tRNS_SUPPORTED) png_uint_32 PNGAPI png_get_tRNS(png_structp png_ptr, png_infop info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values) { png_uint_32 retval = 0; if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) { png_debug1(1, "in %s retrieval function\n", "tRNS"); if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { if (trans != NULL) { *trans = info_ptr->trans; retval |= PNG_INFO_tRNS; } if (trans_values != NULL) *trans_values = &(info_ptr->trans_values); } else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */ { if (trans_values != NULL) { *trans_values = &(info_ptr->trans_values); retval |= PNG_INFO_tRNS; } if(trans != NULL) *trans = NULL; } if(num_trans != NULL) { *num_trans = info_ptr->num_trans; retval |= PNG_INFO_tRNS; } } return (retval); } #endif #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) png_uint_32 PNGAPI png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, png_unknown_chunkpp unknowns) { if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL) *unknowns = info_ptr->unknown_chunks; return ((png_uint_32)info_ptr->unknown_chunks_num); } #endif #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) png_byte PNGAPI png_get_rgb_to_gray_status (png_structp png_ptr) { return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0); } #endif #if defined(PNG_USER_CHUNKS_SUPPORTED) png_voidp PNGAPI png_get_user_chunk_ptr(png_structp png_ptr) { return (png_ptr? png_ptr->user_chunk_ptr : NULL); } #endif #ifdef PNG_WRITE_SUPPORTED png_uint_32 PNGAPI png_get_compression_buffer_size(png_structp png_ptr) { return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L); } #endif #ifndef PNG_1_0_X #ifdef PNG_ASSEMBLER_CODE_SUPPORTED /* this function was added to libpng 1.2.0 and should exist by default */ png_uint_32 PNGAPI png_get_asm_flags (png_structp png_ptr) { return (png_uint_32)(png_ptr? png_ptr->asm_flags : 0L); } /* this function was added to libpng 1.2.0 and should exist by default */ png_uint_32 PNGAPI png_get_asm_flagmask (int flag_select) { png_uint_32 settable_asm_flags = 0; if (flag_select & PNG_SELECT_READ) settable_asm_flags |= PNG_ASM_FLAG_MMX_READ_COMBINE_ROW | PNG_ASM_FLAG_MMX_READ_INTERLACE | PNG_ASM_FLAG_MMX_READ_FILTER_SUB | PNG_ASM_FLAG_MMX_READ_FILTER_UP | PNG_ASM_FLAG_MMX_READ_FILTER_AVG | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ; /* no non-MMX flags yet */ #if 0 /* GRR: no write-flags yet, either, but someday... */ if (flag_select & PNG_SELECT_WRITE) settable_asm_flags |= PNG_ASM_FLAG_MMX_WRITE_ [whatever] ; #endif /* 0 */ return settable_asm_flags; /* _theoretically_ settable capabilities only */ } #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */ /* this function was added to libpng 1.2.0 */ png_uint_32 PNGAPI png_get_mmx_flagmask (int flag_select, int *compilerID) { png_uint_32 settable_mmx_flags = 0; if (flag_select & PNG_SELECT_READ) settable_mmx_flags |= PNG_ASM_FLAG_MMX_READ_COMBINE_ROW | PNG_ASM_FLAG_MMX_READ_INTERLACE | PNG_ASM_FLAG_MMX_READ_FILTER_SUB | PNG_ASM_FLAG_MMX_READ_FILTER_UP | PNG_ASM_FLAG_MMX_READ_FILTER_AVG | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ; #if 0 /* GRR: no MMX write support yet, but someday... */ if (flag_select & PNG_SELECT_WRITE) settable_mmx_flags |= PNG_ASM_FLAG_MMX_WRITE_ [whatever] ; #endif /* 0 */ if (compilerID != NULL) { #ifdef PNG_USE_PNGVCRD *compilerID = 1; /* MSVC */ #else #ifdef PNG_USE_PNGGCCRD *compilerID = 2; /* gcc/gas */ #else *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */ #endif #endif } return settable_mmx_flags; /* _theoretically_ settable capabilities only */ } /* this function was added to libpng 1.2.0 */ png_byte PNGAPI png_get_mmx_bitdepth_threshold (png_structp png_ptr) { return (png_byte)(png_ptr? png_ptr->mmx_bitdepth_threshold : 0); } /* this function was added to libpng 1.2.0 */ png_uint_32 PNGAPI png_get_mmx_rowbytes_threshold (png_structp png_ptr) { return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L); } #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #endif /* ?PNG_1_0_X */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED /* these functions were added to libpng 1.2.6 */ png_uint_32 PNGAPI png_get_user_width_max (png_structp png_ptr) { return (png_ptr? png_ptr->user_width_max : 0); } png_uint_32 PNGAPI png_get_user_height_max (png_structp png_ptr) { return (png_ptr? png_ptr->user_height_max : 0); } #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ --- NEW FILE: pngread.c --- /* pngread.c - read a PNG file * * Last changed in libpng 1.2.11 June 7, 2006 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2006 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * This file contains routines that an application calls directly to * read a PNG file or stream. */ #define PNG_INTERNAL #include "png.h" #if defined(PNG_READ_SUPPORTED) /* Create a PNG structure for reading, and allocate any memory needed. */ [...1422 lines suppressed...] for (row = 0; row < (int)info_ptr->height; row++) { info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); } } png_read_image(png_ptr, info_ptr->row_pointers); info_ptr->valid |= PNG_INFO_IDAT; /* read rest of file, and get additional chunks in info_ptr - REQUIRED */ png_read_end(png_ptr, info_ptr); if(transforms == 0 || params == NULL) /* quiet compiler warnings */ return; } #endif /* PNG_INFO_IMAGE_SUPPORTED */ #endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */ --- NEW FILE: pngrutil.c --- /* pngrutil.c - utilities to read a PNG file * * Last changed in libpng 1.2.11 June 4, 2006 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2006 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * This file contains routines that are only called from within * libpng itself during the course of reading an image. */ #define PNG_INTERNAL #include "png.h" #if defined(PNG_READ_SUPPORTED) #if defined(_WIN32_WCE) [...3084 lines suppressed...] if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L) png_error(png_ptr, "This image requires a row greater than 64KB"); #endif if ((png_uint_32)png_ptr->rowbytes > PNG_SIZE_MAX - 1) png_error(png_ptr, "Row has too many bytes to allocate in memory."); png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)( png_ptr->rowbytes + 1)); png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1); png_debug1(3, "width = %lu,\n", png_ptr->width); png_debug1(3, "height = %lu,\n", png_ptr->height); png_debug1(3, "iwidth = %lu,\n", png_ptr->iwidth); png_debug1(3, "num_rows = %lu\n", png_ptr->num_rows); png_debug1(3, "rowbytes = %lu,\n", png_ptr->rowbytes); png_debug1(3, "irowbytes = %lu,\n", png_ptr->irowbytes); png_ptr->flags |= PNG_FLAG_ROW_INIT; } #endif /* PNG_READ_SUPPORTED */ --- NEW FILE: png.c --- /* png.c - location for general purpose libpng functions * * Last changed in libpng 1.2.9 April 14, 2006 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2006 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ #define PNG_INTERNAL #define PNG_NO_EXTERN #include "png.h" /* Generate a compiler error if there is an old png.h in the search path. */ typedef version_1_2_12 Your_png_h_is_not_version_1_2_12; /* Version information for C files. This had better match the version * string defined in png.h. */ #ifdef PNG_USE_GLOBAL_ARRAYS /* png_libpng_ver was changed to a function in version 1.0.5c */ const char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING; #ifdef PNG_READ_SUPPORTED /* png_sig was changed to a function in version 1.0.5c */ /* Place to hold the signature string for a PNG file. */ const png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10}; #endif /* PNG_READ_SUPPORTED */ /* Invoke global declarations for constant strings for known chunk types */ PNG_IHDR; PNG_IDAT; PNG_IEND; PNG_PLTE; PNG_bKGD; PNG_cHRM; PNG_gAMA; PNG_hIST; PNG_iCCP; PNG_iTXt; PNG_oFFs; PNG_pCAL; PNG_sCAL; PNG_pHYs; PNG_sBIT; PNG_sPLT; PNG_sRGB; PNG_tEXt; PNG_tIME; PNG_tRNS; PNG_zTXt; #ifdef PNG_READ_SUPPORTED /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* start of interlace block */ const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; /* offset to next interlace block */ const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; /* start of interlace block in the y direction */ const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; /* offset to next interlace block in the y direction */ const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; /* width of interlace block (used in assembler routines only) */ #ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; #endif /* Height of interlace block. This is not currently used - if you need * it, uncomment it here and in png.h const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; */ /* Mask to determine which pixels are valid in a pass */ const int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; /* Mask to determine which pixels to overwrite while displaying */ const int FARDATA png_pass_dsp_mask[] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; #endif /* PNG_READ_SUPPORTED */ #endif /* PNG_USE_GLOBAL_ARRAYS */ /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another * stream we can set num_bytes = 8 so that libpng will not attempt to read * or write any of the magic bytes before it starts on the IHDR. */ #ifdef PNG_READ_SUPPORTED void PNGAPI png_set_sig_bytes(png_structp png_ptr, int num_bytes) { png_debug(1, "in png_set_sig_bytes\n"); if (num_bytes > 8) png_error(png_ptr, "Too many bytes for PNG signature."); png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes); } /* Checks whether the supplied bytes match the PNG signature. We allow * checking less than the full 8-byte signature so that those apps that * already read the first few bytes of a file to determine the file type * can simply check the remaining bytes for extra assurance. Returns * an integer less than, equal to, or greater than zero if sig is found, * respectively, to be less than, to match, or be greater than the correct * PNG signature (this is the same behaviour as strcmp, memcmp, etc). */ int PNGAPI png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check) { png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; if (num_to_check > 8) num_to_check = 8; else if (num_to_check < 1) return (-1); if (start > 7) return (-1); if (start + num_to_check > 8) num_to_check = 8 - start; return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check))); } #if defined(PNG_1_0_X) || defined(PNG_1_2_X) /* (Obsolete) function to check signature bytes. It does not allow one * to check a partial signature. This function might be removed in the * future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG. */ int PNGAPI png_check_sig(png_bytep sig, int num) { return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num)); } #endif #endif /* PNG_READ_SUPPORTED */ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) /* Function to allocate memory for zlib and clear it to 0. */ #ifdef PNG_1_0_X voidpf PNGAPI #else voidpf /* private */ #endif png_zalloc(voidpf png_ptr, uInt items, uInt size) { png_voidp ptr; png_structp p=png_ptr; png_uint_32 save_flags=p->flags; png_uint_32 num_bytes; if (items > PNG_UINT_32_MAX/size) { png_warning (png_ptr, "Potential overflow in png_zalloc()"); return (NULL); } num_bytes = (png_uint_32)items * size; p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK; ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes); p->flags=save_flags; #if defined(PNG_1_0_X) && !defined(PNG_NO_ZALLOC_ZERO) if (ptr == NULL) return ((voidpf)ptr); if (num_bytes > (png_uint_32)0x8000L) { png_memset(ptr, 0, (png_size_t)0x8000L); png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0, (png_size_t)(num_bytes - (png_uint_32)0x8000L)); } else { png_memset(ptr, 0, (png_size_t)num_bytes); } #endif return ((voidpf)ptr); } /* function to free memory for zlib */ #ifdef PNG_1_0_X void PNGAPI #else void /* private */ #endif png_zfree(voidpf png_ptr, voidpf ptr) { png_free((png_structp)png_ptr, (png_voidp)ptr); } /* Reset the CRC variable to 32 bits of 1's. Care must be taken * in case CRC is > 32 bits to leave the top bits 0. */ void /* PRIVATE */ png_reset_crc(png_structp png_ptr) { png_ptr->crc = crc32(0, Z_NULL, 0); } /* Calculate the CRC over a section of data. We can only pass as * much data to this routine as the largest single buffer size. We * also check that this data will actually be used before going to the * trouble of calculating it. */ void /* PRIVATE */ png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length) { int need_crc = 1; if (png_ptr->chunk_name[0] & 0x20) /* ancillary */ { if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) == (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN)) need_crc = 0; } else /* critical */ { if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) need_crc = 0; } if (need_crc) png_ptr->crc = crc32(png_ptr->crc, ptr, (uInt)length); } /* Allocate the memory for an info_struct for the application. We don't * really need the png_ptr, but it could potentially be useful in the * future. This should be used in favour of malloc(png_sizeof(png_info)) * and png_info_init() so that applications that want to use a shared * libpng don't have to be recompiled if png_info changes size. */ png_infop PNGAPI png_create_info_struct(png_structp png_ptr) { png_infop info_ptr; p... [truncated message content] |
From: Ehud S. <esh...@us...> - 2006-11-21 09:36:32
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libwinceguiroadmap In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11295/libwinceguiroadmap Modified Files: libwinceguiroadmap.vcp Log Message: Update evc files. Index: libwinceguiroadmap.vcp =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libwinceguiroadmap/libwinceguiroadmap.vcp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libwinceguiroadmap.vcp 17 Nov 2006 16:48:56 -0000 1.8 --- libwinceguiroadmap.vcp 21 Nov 2006 09:36:29 -0000 1.9 *************** *** 51,63 **** # PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" # PROP Target_Dir "" - CPP=clarm.exe - # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT) /c - # ADD CPP /nologo /W3 /I "./wince_os" /I "../../" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT) /c - LIB32=link.exe -lib - # ADD BASE LIB32 /nologo - # ADD LIB32 /nologo BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo !ELSEIF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE ARM) Debug" --- 51,63 ---- # PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" # PROP Target_Dir "" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo + LIB32=link.exe -lib + # ADD BASE LIB32 /nologo + # ADD LIB32 /nologo + CPP=clarm.exe + # ADD BASE CPP /nologo /W3 /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT) /c + # ADD CPP /nologo /W3 /I "./wince_os" /I "../../" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT) /c !ELSEIF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE ARM) Debug" *************** *** 77,89 **** # PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" # PROP Target_Dir "" - CPP=clarm.exe - # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c - # ADD CPP /nologo /W3 /Zi /Od /I "../../" /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c - LIB32=link.exe -lib - # ADD BASE LIB32 /nologo - # ADD LIB32 /nologo BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo !ELSEIF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE x86) Release" --- 77,89 ---- # PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" # PROP Target_Dir "" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo + LIB32=link.exe -lib + # ADD BASE LIB32 /nologo + # ADD LIB32 /nologo + CPP=clarm.exe + # ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c + # ADD CPP /nologo /W3 /Zi /Od /I "../../" /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c !ELSEIF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE x86) Release" *************** *** 406,409 **** --- 406,410 ---- "..\..\..\roadmap_types.h"\ "..\..\colors.h"\ + "..\..\roadmap_libpng.h"\ "..\..\roadmap_win32.h"\ "..\..\roadmap_wincecanvas.h"\ *************** *** 468,471 **** --- 469,473 ---- "..\..\..\roadmap_types.h"\ "..\..\colors.h"\ + "..\..\roadmap_libpng.h"\ "..\..\roadmap_win32.h"\ "..\..\roadmap_wincecanvas.h"\ *************** *** 670,678 **** "..\..\roadmap_win32.h"\ "..\..\win32_serial.h"\ - {$(INCLUDE)}"aygshell.h"\ - {$(INCLUDE)}"sipapi.h"\ - {$(INCLUDE)}"winuserm.h"\ NODEP_CPP_ROADMA=\ "C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Include\ARMV4\vibrate.h"\ --- 672,680 ---- "..\..\roadmap_win32.h"\ "..\..\win32_serial.h"\ NODEP_CPP_ROADMA=\ + ".\inuserm.h"\ + ".\ipapi.h"\ + ".\ygshell.h"\ "C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Include\ARMV4\vibrate.h"\ *************** *** 758,761 **** --- 760,840 ---- # End Source File + # Begin Source File + + SOURCE=..\..\roadmap_libpng.c + + !IF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE ARM) Release" + + !ELSEIF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE ARM) Debug" + + !ELSEIF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE x86) Release" + + DEP_CPP_ROADMAP_=\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\roadmap_libpng.h"\ + "..\..\roadmap_win32.h"\ + + # ADD CPP /I "../../../zlib" /I "../../../libpng" + + !ELSEIF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE x86) Debug" + + DEP_CPP_ROADMAP_=\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\roadmap_libpng.h"\ + "..\..\roadmap_win32.h"\ + + # ADD CPP /I "../../../zlib" /I "../../../libpng" + + !ELSEIF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE ARMV4) Debug" + + DEP_CPP_ROADMAP_=\ + "..\..\..\libpng\png.h"\ + "..\..\..\libpng\pngconf.h"\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\..\zlib\zconf.h"\ + "..\..\..\zlib\zlib.h"\ + "..\..\roadmap_libpng.h"\ + "..\..\roadmap_win32.h"\ + + NODEP_CPP_ROADMAP_=\ + "..\..\..\libpng\config.h"\ + "..\..\..\libpng\pngusr.h"\ + + # ADD CPP /I "../../../zlib" /I "../../../libpng" + + !ELSEIF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE ARMV4) Release" + + DEP_CPP_ROADMAP_=\ + "..\..\..\libpng\png.h"\ + "..\..\..\libpng\pngconf.h"\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\..\zlib\zconf.h"\ + "..\..\..\zlib\zlib.h"\ + "..\..\roadmap_libpng.h"\ + "..\..\roadmap_win32.h"\ + + NODEP_CPP_ROADMAP_=\ + "..\..\..\libpng\config.h"\ + "..\..\..\libpng\pngusr.h"\ + + # ADD CPP /I "../../../zlib" /I "../../../libpng" + + !ELSEIF "$(CFG)" == "libwinceguiroadmap - Win32 (WCE ARMV4) Profiler" + + DEP_CPP_ROADMAP_=\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\roadmap_libpng.h"\ + "..\..\roadmap_win32.h"\ + + # ADD CPP /I "../../../zlib" /I "../../../libpng" + + !ENDIF + + # End Source File # End Group # Begin Group "Header Files" |
From: Ehud S. <esh...@us...> - 2006-11-21 09:36:32
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libssd In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11295/libssd Modified Files: libssd.vcp Log Message: Update evc files. Index: libssd.vcp =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libssd/libssd.vcp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libssd.vcp 17 Nov 2006 16:48:56 -0000 1.2 --- libssd.vcp 21 Nov 2006 09:36:29 -0000 1.3 *************** *** 125,128 **** --- 125,129 ---- "..\..\..\roadmap_types.h"\ "..\..\..\ssd\ssd_button.h"\ + "..\..\..\ssd\ssd_text.h"\ "..\..\..\ssd\ssd_widget.h"\ "..\..\roadmap_win32.h"\ *************** *** 131,144 **** # Begin Source File ! SOURCE=..\..\..\ssd\ssd_container.c DEP_CPP_SSD_C=\ "..\..\..\roadmap_canvas.h"\ "..\..\..\roadmap_gui.h"\ "..\..\..\roadmap_types.h"\ "..\..\..\ssd\ssd_button.h"\ "..\..\..\ssd\ssd_container.h"\ "..\..\..\ssd\ssd_dialog.h"\ "..\..\..\ssd\ssd_text.h"\ "..\..\..\ssd\ssd_widget.h"\ # End Source File --- 132,165 ---- # Begin Source File ! SOURCE=..\..\..\ssd\ssd_choice.c DEP_CPP_SSD_C=\ + "..\..\..\roadmap.h"\ "..\..\..\roadmap_canvas.h"\ "..\..\..\roadmap_gui.h"\ "..\..\..\roadmap_types.h"\ "..\..\..\ssd\ssd_button.h"\ + "..\..\..\ssd\ssd_choice.h"\ "..\..\..\ssd\ssd_container.h"\ "..\..\..\ssd\ssd_dialog.h"\ + "..\..\..\ssd\ssd_list.h"\ "..\..\..\ssd\ssd_text.h"\ "..\..\..\ssd\ssd_widget.h"\ + "..\..\roadmap_win32.h"\ + + # End Source File + # Begin Source File + + SOURCE=..\..\..\ssd\ssd_container.c + DEP_CPP_SSD_CO=\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_canvas.h"\ + "..\..\..\roadmap_gui.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\..\ssd\ssd_button.h"\ + "..\..\..\ssd\ssd_container.h"\ + "..\..\..\ssd\ssd_dialog.h"\ + "..\..\..\ssd\ssd_text.h"\ + "..\..\..\ssd\ssd_widget.h"\ + "..\..\roadmap_win32.h"\ # End Source File *************** *** 180,184 **** --- 201,209 ---- "..\..\..\roadmap_gui.h"\ "..\..\..\roadmap_types.h"\ + "..\..\..\ssd\ssd_button.h"\ + "..\..\..\ssd\ssd_container.h"\ + "..\..\..\ssd\ssd_dialog.h"\ "..\..\..\ssd\ssd_entry.h"\ + "..\..\..\ssd\ssd_keyboard.h"\ "..\..\..\ssd\ssd_text.h"\ "..\..\..\ssd\ssd_widget.h"\ *************** *** 190,193 **** --- 215,219 ---- SOURCE=..\..\..\ssd\ssd_keyboard.c DEP_CPP_SSD_K=\ + "..\..\..\roadmap.h"\ "..\..\..\roadmap_canvas.h"\ "..\..\..\roadmap_gui.h"\ *************** *** 201,204 **** --- 227,231 ---- "..\..\..\ssd\ssd_text.h"\ "..\..\..\ssd\ssd_widget.h"\ + "..\..\roadmap_win32.h"\ # End Source File *************** *** 207,210 **** --- 234,238 ---- SOURCE=..\..\..\ssd\ssd_list.c DEP_CPP_SSD_L=\ + "..\..\..\roadmap.h"\ "..\..\..\roadmap_canvas.h"\ "..\..\..\roadmap_gui.h"\ *************** *** 216,219 **** --- 244,248 ---- "..\..\..\ssd\ssd_text.h"\ "..\..\..\ssd\ssd_widget.h"\ + "..\..\roadmap_win32.h"\ # End Source File *************** *** 250,253 **** --- 279,283 ---- SOURCE=..\..\..\ssd\ssd_messagebox.c DEP_CPP_SSD_ME=\ + "..\..\..\roadmap.h"\ "..\..\..\roadmap_canvas.h"\ "..\..\..\roadmap_gui.h"\ *************** *** 260,263 **** --- 290,294 ---- "..\..\..\ssd\ssd_text.h"\ "..\..\..\ssd\ssd_widget.h"\ + "..\..\roadmap_win32.h"\ # End Source File |
From: Ehud S. <esh...@us...> - 2006-11-21 09:36:32
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libguiroadmap In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11295/libguiroadmap Modified Files: libguiroadmap.vcp Log Message: Update evc files. Index: libguiroadmap.vcp =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libguiroadmap/libguiroadmap.vcp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libguiroadmap.vcp 17 Nov 2006 16:48:55 -0000 1.8 --- libguiroadmap.vcp 21 Nov 2006 09:36:29 -0000 1.9 *************** *** 353,356 **** --- 353,357 ---- !ELSEIF "$(CFG)" == "libguiroadmap - Win32 (WCE ARMV4) Debug" + # PROP Exclude_From_Build 1 DEP_CPP_ROADM=\ "..\..\..\roadmap.h"\ *************** *** 1336,1339 **** --- 1337,1341 ---- "..\..\..\roadmap_plugin.h"\ "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ "..\..\..\roadmap_sprite.h"\ "..\..\..\roadmap_street.h"\ *************** *** 1359,1362 **** --- 1361,1365 ---- "..\..\..\roadmap_plugin.h"\ "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ "..\..\..\roadmap_sprite.h"\ "..\..\..\roadmap_street.h"\ *************** *** 2168,2171 **** --- 2171,2175 ---- "..\..\..\roadmap_plugin.h"\ "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ "..\..\..\roadmap_types.h"\ "..\..\roadmap_win32.h"\ *************** *** 2187,2190 **** --- 2191,2195 ---- "..\..\..\roadmap_plugin.h"\ "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ "..\..\..\roadmap_types.h"\ "..\..\roadmap_win32.h"\ *************** *** 2283,2286 **** --- 2288,2292 ---- "..\..\..\roadmap_plugin.h"\ "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ "..\..\..\roadmap_types.h"\ "..\..\roadmap_win32.h"\ *************** *** 2298,2301 **** --- 2304,2308 ---- "..\..\..\roadmap_plugin.h"\ "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ "..\..\..\roadmap_types.h"\ "..\..\roadmap_win32.h"\ *************** *** 3163,3166 **** --- 3170,3174 ---- "..\..\..\roadmap_serial.h"\ "..\..\..\roadmap_shape.h"\ + "..\..\..\roadmap_skin.h"\ "..\..\..\roadmap_spawn.h"\ "..\..\..\roadmap_sprite.h"\ *************** *** 3211,3214 **** --- 3219,3223 ---- "..\..\..\roadmap_serial.h"\ "..\..\..\roadmap_shape.h"\ + "..\..\..\roadmap_skin.h"\ "..\..\..\roadmap_spawn.h"\ "..\..\..\roadmap_sprite.h"\ *************** *** 3354,3357 **** --- 3363,3367 ---- "..\..\..\roadmap_path.h"\ "..\..\..\roadmap_pointer.h"\ + "..\..\..\roadmap_res.h"\ "..\..\..\roadmap_screen_obj.h"\ "..\..\..\roadmap_serial.h"\ *************** *** 3382,3385 **** --- 3392,3396 ---- "..\..\..\roadmap_path.h"\ "..\..\..\roadmap_pointer.h"\ + "..\..\..\roadmap_res.h"\ "..\..\..\roadmap_screen_obj.h"\ "..\..\..\roadmap_serial.h"\ *************** *** 3427,3430 **** --- 3438,3522 ---- # Begin Source File + SOURCE=..\..\..\roadmap_skin.c + + !IF "$(CFG)" == "libguiroadmap - Win32 (WCE ARM) Release" + + !ELSEIF "$(CFG)" == "libguiroadmap - Win32 (WCE ARM) Debug" + + !ELSEIF "$(CFG)" == "libguiroadmap - Win32 (WCE x86) Release" + + DEP_CPP_ROADMAP_SK=\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_canvas.h"\ + "..\..\..\roadmap_config.h"\ + "..\..\..\roadmap_gui.h"\ + "..\..\..\roadmap_path.h"\ + "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\roadmap_win32.h"\ + + + !ELSEIF "$(CFG)" == "libguiroadmap - Win32 (WCE x86) Debug" + + DEP_CPP_ROADMAP_SK=\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_canvas.h"\ + "..\..\..\roadmap_config.h"\ + "..\..\..\roadmap_gui.h"\ + "..\..\..\roadmap_path.h"\ + "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\roadmap_win32.h"\ + + + !ELSEIF "$(CFG)" == "libguiroadmap - Win32 (WCE ARMV4) Debug" + + DEP_CPP_ROADMAP_SK=\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_canvas.h"\ + "..\..\..\roadmap_config.h"\ + "..\..\..\roadmap_gui.h"\ + "..\..\..\roadmap_path.h"\ + "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\roadmap_win32.h"\ + + + !ELSEIF "$(CFG)" == "libguiroadmap - Win32 (WCE ARMV4) Release" + + DEP_CPP_ROADMAP_SK=\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_canvas.h"\ + "..\..\..\roadmap_config.h"\ + "..\..\..\roadmap_gui.h"\ + "..\..\..\roadmap_path.h"\ + "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\roadmap_win32.h"\ + + + !ELSEIF "$(CFG)" == "libguiroadmap - Win32 (WCE ARMV4) Profiler" + + DEP_CPP_ROADMAP_SK=\ + "..\..\..\roadmap.h"\ + "..\..\..\roadmap_canvas.h"\ + "..\..\..\roadmap_config.h"\ + "..\..\..\roadmap_gui.h"\ + "..\..\..\roadmap_path.h"\ + "..\..\..\roadmap_screen.h"\ + "..\..\..\roadmap_skin.h"\ + "..\..\..\roadmap_types.h"\ + "..\..\roadmap_win32.h"\ + + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=..\..\..\roadmap_sprite.c *************** *** 3773,3776 **** --- 3865,3869 ---- "..\..\..\roadmap_screen_obj.h"\ "..\..\..\roadmap_serial.h"\ + "..\..\..\roadmap_skin.h"\ "..\..\..\roadmap_sound.h"\ "..\..\..\roadmap_spawn.h"\ *************** *** 3783,3786 **** --- 3876,3880 ---- "..\..\..\roadmap_voice.h"\ "..\..\..\ssd\ssd_menu.h"\ + "..\..\..\ssd\ssd_widget.h"\ "..\..\roadmap_win32.h"\ "..\..\win32_serial.h"\ *************** *** 3841,3844 **** --- 3935,3939 ---- "..\..\..\roadmap_screen_obj.h"\ "..\..\..\roadmap_serial.h"\ + "..\..\..\roadmap_skin.h"\ "..\..\..\roadmap_sound.h"\ "..\..\..\roadmap_spawn.h"\ *************** *** 3851,3854 **** --- 3946,3950 ---- "..\..\..\roadmap_voice.h"\ "..\..\..\ssd\ssd_menu.h"\ + "..\..\..\ssd\ssd_widget.h"\ "..\..\roadmap_win32.h"\ "..\..\win32_serial.h"\ |
From: Ehud S. <esh...@us...> - 2006-11-21 09:36:32
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libpng In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11295/libpng Added Files: lpngce.vcp Log Message: Update evc files. --- NEW FILE: lpngce.vcp --- # Microsoft eMbedded Visual Tools Project File - Name="lpngce" - Package Owner=<4> # Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02 # ** DO NOT EDIT ** # TARGTYPE "Win32 (WCE x86em) Dynamic-Link Library" 0x7f02 # TARGTYPE "Win32 (WCE SH3) Dynamic-Link Library" 0x8102 # TARGTYPE "Win32 (WCE PPC) Dynamic-Link Library" 0x8402 # TARGTYPE "Win32 (WCE x86) Dynamic-Link Library" 0x8302 # TARGTYPE "Win32 (WCE MIPSFP) Dynamic-Link Library" 0x8702 # TARGTYPE "Win32 (WCE ARM) Dynamic-Link Library" 0x8502 # TARGTYPE "Win32 (WCE SH4) Dynamic-Link Library" 0x8602 # TARGTYPE "Win32 (WCE ARMV4) Dynamic-Link Library" 0xa302 # TARGTYPE "Win32 (WCE MIPS) Dynamic-Link Library" 0x8202 CFG=lpngce - Win32 (WCE MIPS) Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "lpngce.vcn". [...3083 lines suppressed...] # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=..\..\..\libpng\png.h # End Source File # Begin Source File SOURCE=..\..\..\libpng\pngconf.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project |
From: Ehud S. <esh...@us...> - 2006-11-21 09:35:50
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libpng In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10853/libpng Log Message: Directory /cvsroot/roadmap/roadmap_editor/src/win32/wince_env/libpng added to the repository |
From: Ehud S. <esh...@us...> - 2006-11-21 09:35:20
|
Update of /cvsroot/roadmap/roadmap_editor/src/zlib In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10735 Modified Files: gzio.c Log Message: mark out errno stuff. Index: gzio.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/zlib/gzio.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gzio.c 14 Oct 2006 09:11:40 -0000 1.3 --- gzio.c 21 Nov 2006 09:35:15 -0000 1.4 *************** *** 179,183 **** s->stream.avail_out = Z_BUFSIZE; ! errno = 0; s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); --- 179,183 ---- s->stream.avail_out = Z_BUFSIZE; ! //errno = 0; s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); *************** *** 265,269 **** if (s->z_eof) return EOF; if (s->stream.avail_in == 0) { ! errno = 0; s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { --- 265,269 ---- if (s->z_eof) return EOF; if (s->stream.avail_in == 0) { ! //errno = 0; s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { *************** *** 301,305 **** if (len < 2) { if (len) s->inbuf[0] = s->stream.next_in[0]; ! errno = 0; len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO; --- 301,305 ---- if (len < 2) { if (len) s->inbuf[0] = s->stream.next_in[0]; ! //errno = 0; len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO; *************** *** 450,454 **** if (s->stream.avail_in == 0 && !s->z_eof) { ! errno = 0; s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { --- 450,454 ---- if (s->stream.avail_in == 0 && !s->z_eof) { ! //errno = 0; s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); if (s->stream.avail_in == 0) { |
From: Ehud S. <esh...@us...> - 2006-11-21 09:34:44
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10318 Modified Files: preferences roadmap_path.c Log Message: Skin management. Index: roadmap_path.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/win32/roadmap_path.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** roadmap_path.c 18 Aug 2006 17:58:25 -0000 1.5 --- roadmap_path.c 21 Nov 2006 09:34:40 -0000 1.6 *************** *** 37,46 **** struct RoadMapPathRecord { ! RoadMapPathList next; ! char *name; ! int count; ! char **items; ! char *preferred; }; --- 37,46 ---- struct RoadMapPathRecord { ! RoadMapPathList next; ! char *name; ! int count; ! char **items; ! char *preferred; }; *************** *** 51,67 **** static const char *RoadMapPathConfig[] = { "&", ! "\\Program Files\\roadmap", ! "\\Storage Card\\roadmap", ! NULL }; static const char *RoadMapPathConfigPreferred = "\\Storage Card\\roadmap"; /* The default path for the map files (the "maps" path): */ static const char *RoadMapPathMaps[] = { "&\\maps", ! "\\Program Files\\roadmap\\maps", ! "\\Storage Card\\roadmap\\maps", ! NULL }; --- 51,76 ---- static const char *RoadMapPathConfig[] = { "&", ! "\\Program Files\\roadmap", ! "\\Storage Card\\roadmap", ! NULL }; static const char *RoadMapPathConfigPreferred = "\\Storage Card\\roadmap"; + /* Skins directories */ + static const char *RoadMapPathSkin[] = { + "&\\skins\\default\\day", + "&\\skins\\default", + NULL + }; + + static const char *RoadMapPathSkinPreferred = "&\\skins"; + /* The default path for the map files (the "maps" path): */ static const char *RoadMapPathMaps[] = { "&\\maps", ! "\\Program Files\\roadmap\\maps", ! "\\Storage Card\\roadmap\\maps", ! NULL }; *************** *** 70,74 **** /* We don't have a user directory in wince so we'll leave this one empty */ static const char *RoadMapPathUser[] = { ! NULL }; --- 79,83 ---- /* We don't have a user directory in wince so we'll leave this one empty */ static const char *RoadMapPathUser[] = { ! NULL }; *************** *** 77,125 **** static void roadmap_path_list_create(const char *name, ! const char *items[], ! const char *preferred) { ! int i; ! int count; ! RoadMapPathList new_path; ! for (count = 0; items[count] != NULL; ++count) ; ! new_path = malloc (sizeof(struct RoadMapPathRecord)); ! roadmap_check_allocated(new_path); ! new_path->next = RoadMapPaths; ! new_path->name = strdup(name); ! new_path->count = count; ! new_path->items = calloc (count, sizeof(char *)); ! roadmap_check_allocated(new_path->items); ! for (i = 0; i < count; ++i) { ! new_path->items[i] = roadmap_path_expand (items[i], strlen(items[i])); ! } new_path->preferred = roadmap_path_expand (preferred, strlen(preferred)); ! RoadMapPaths = new_path; } static RoadMapPathList roadmap_path_find (const char *name) { ! RoadMapPathList cursor; ! if (RoadMapPaths == NULL) { ! /* Add the hardcoded configuration. */ ! roadmap_path_list_create ("user", RoadMapPathUser, roadmap_path_user()); ! roadmap_path_list_create ("config", RoadMapPathConfig, ! RoadMapPathConfigPreferred); ! roadmap_path_list_create ("maps", RoadMapPathMaps, ! RoadMapPathMapsPreferred); ! } ! for (cursor = RoadMapPaths; cursor != NULL; cursor = cursor->next) { ! if (strcasecmp(cursor->name, name) == 0) break; ! } ! return cursor; } --- 86,136 ---- static void roadmap_path_list_create(const char *name, ! const char *items[], ! const char *preferred) { ! int i; ! int count; ! RoadMapPathList new_path; ! for (count = 0; items[count] != NULL; ++count) ; ! new_path = malloc (sizeof(struct RoadMapPathRecord)); ! roadmap_check_allocated(new_path); ! new_path->next = RoadMapPaths; ! new_path->name = strdup(name); ! new_path->count = count; ! new_path->items = calloc (count, sizeof(char *)); ! roadmap_check_allocated(new_path->items); ! for (i = 0; i < count; ++i) { ! new_path->items[i] = roadmap_path_expand (items[i], strlen(items[i])); ! } new_path->preferred = roadmap_path_expand (preferred, strlen(preferred)); ! RoadMapPaths = new_path; } static RoadMapPathList roadmap_path_find (const char *name) { ! RoadMapPathList cursor; ! if (RoadMapPaths == NULL) { ! /* Add the hardcoded configuration. */ ! roadmap_path_list_create ("user", RoadMapPathUser, roadmap_path_user()); ! roadmap_path_list_create ("config", RoadMapPathConfig, ! RoadMapPathConfigPreferred); ! roadmap_path_list_create ("skin", RoadMapPathSkin, ! RoadMapPathSkinPreferred); ! roadmap_path_list_create ("maps", RoadMapPathMaps, ! RoadMapPathMapsPreferred); ! } ! for (cursor = RoadMapPaths; cursor != NULL; cursor = cursor->next) { ! if (strcasecmp(cursor->name, name) == 0) break; ! } ! return cursor; } *************** *** 129,141 **** static char *roadmap_path_cat (const char *s1, const char *s2) { ! char *result = malloc (strlen(s1) + strlen(s2) + 4); ! roadmap_check_allocated (result); ! strcpy (result, s1); ! strcat (result, "\\"); ! strcat (result, s2); ! return result; } --- 140,152 ---- static char *roadmap_path_cat (const char *s1, const char *s2) { ! char *result = malloc (strlen(s1) + strlen(s2) + 4); ! roadmap_check_allocated (result); ! strcpy (result, s1); ! strcat (result, "\\"); ! strcat (result, s2); ! return result; } *************** *** 143,150 **** char *roadmap_path_join (const char *path, const char *name) { ! if (path == NULL) { ! return strdup (name); ! } ! return roadmap_path_cat (path, name); } --- 154,161 ---- char *roadmap_path_join (const char *path, const char *name) { ! if (path == NULL) { ! return strdup (name); ! } ! return roadmap_path_cat (path, name); } *************** *** 152,166 **** char *roadmap_path_parent (const char *path, const char *name) { ! char *separator; ! char *full_name = roadmap_path_join (path, name); ! separator = strrchr (full_name, '\\'); ! if (separator == NULL) { ! return "."; ! } ! *separator = 0; ! return full_name; } --- 163,177 ---- char *roadmap_path_parent (const char *path, const char *name) { ! char *separator; ! char *full_name = roadmap_path_join (path, name); ! separator = strrchr (full_name, '\\'); ! if (separator == NULL) { ! return "."; ! } ! *separator = 0; ! return full_name; } *************** *** 168,176 **** char *roadmap_path_skip_directories (const char *name) { ! char *result = strrchr (name, '\\'); ! if (result == NULL) return (char *)name; ! return result + 1; } --- 179,187 ---- char *roadmap_path_skip_directories (const char *name) { ! char *result = strrchr (name, '\\'); ! if (result == NULL) return (char *)name; ! return result + 1; } *************** *** 178,193 **** char *roadmap_path_remove_extension (const char *name) { ! char *result; ! char *p; ! result = strdup(name); ! roadmap_check_allocated(result); ! p = roadmap_path_skip_directories (result); ! p = strrchr (p, '.'); ! if (p != NULL) *p = 0; ! return result; } --- 189,204 ---- char *roadmap_path_remove_extension (const char *name) { ! char *result; ! char *p; ! result = strdup(name); ! roadmap_check_allocated(result); ! p = roadmap_path_skip_directories (result); ! p = strrchr (p, '.'); ! if (p != NULL) *p = 0; ! return result; } *************** *** 195,215 **** const char *roadmap_path_user (void) { ! static char *RoadMapUser = NULL; ! if (RoadMapUser == NULL) { ! WCHAR path_unicode[MAX_PATH]; ! char *path; ! char *tmp; ! /* We don't have a user directory so we'll use the executable path */ ! GetModuleFileName(NULL, path_unicode, ! sizeof(path_unicode)/sizeof(path_unicode[0])); ! path = ConvertToMultiByte(path_unicode, CP_UTF8); ! tmp = strrchr (path, '\\'); ! if (tmp != NULL) { ! *tmp = '\0'; ! } ! RoadMapUser = path; ! } ! return RoadMapUser; } --- 206,226 ---- const char *roadmap_path_user (void) { ! static char *RoadMapUser = NULL; ! if (RoadMapUser == NULL) { ! WCHAR path_unicode[MAX_PATH]; ! char *path; ! char *tmp; ! /* We don't have a user directory so we'll use the executable path */ ! GetModuleFileName(NULL, path_unicode, ! sizeof(path_unicode)/sizeof(path_unicode[0])); ! path = ConvertToMultiByte(path_unicode, CP_UTF8); ! tmp = strrchr (path, '\\'); ! if (tmp != NULL) { ! *tmp = '\0'; ! } ! RoadMapUser = path; ! } ! return RoadMapUser; } *************** *** 217,231 **** const char *roadmap_path_trips (void) { ! static char RoadMapDefaultTrips[] = "trips"; ! static char *RoadMapTrips = NULL; ! if (RoadMapTrips == NULL) { ! RoadMapTrips = ! roadmap_path_cat (roadmap_path_user(), RoadMapDefaultTrips); ! roadmap_path_create(RoadMapTrips); ! } ! return RoadMapTrips; } --- 228,242 ---- const char *roadmap_path_trips (void) { ! static char RoadMapDefaultTrips[] = "trips"; ! static char *RoadMapTrips = NULL; ! if (RoadMapTrips == NULL) { ! RoadMapTrips = ! roadmap_path_cat (roadmap_path_user(), RoadMapDefaultTrips); ! roadmap_path_create(RoadMapTrips); ! } ! return RoadMapTrips; } *************** *** 258,322 **** void roadmap_path_set (const char *name, const char *path) { ! int i; ! int count; ! const char *item; ! const char *next_item; ! RoadMapPathList path_list = roadmap_path_find (name); ! if (path_list == NULL) { ! roadmap_log(ROADMAP_FATAL, "unknown path set '%s'", name); ! } ! while (*path == ',') path += 1; ! if (*path == 0) return; /* Ignore empty path: current is better. */ ! if (path_list->items != NULL) { ! /* This replaces a path that was already set. */ ! for (i = path_list->count-1; i >= 0; --i) { ! free (path_list->items[i]); ! } ! free (path_list->items); ! } ! /* Count the number of items in this path string. */ ! count = 0; ! for (item = path-1; item != NULL; item = strchr (item+1, ',')) { ! count += 1; ! } ! path_list->items = calloc (count, sizeof(char *)); ! roadmap_check_allocated(path_list->items); ! /* Extract and expand each item of the path. ! * Ignore directories that do not exist yet. ! */ ! for (i = 0, item = path-1; item != NULL; item = next_item) { ! item += 1; ! next_item = strchr (item, ','); ! if (next_item == NULL) { path_list->items[i] = roadmap_path_expand (item, strlen(item)); ! } else { path_list->items[i] = roadmap_path_expand (item, (size_t)(next_item - item)); ! } ! if (roadmap_file_exists(NULL, path_list->items[i])) { ! ++i; ! } else { ! free (path_list->items[i]); ! path_list->items[i] = NULL; ! } ! } ! path_list->count = i; } --- 269,333 ---- void roadmap_path_set (const char *name, const char *path) { ! int i; ! int count; ! const char *item; ! const char *next_item; ! RoadMapPathList path_list = roadmap_path_find (name); ! if (path_list == NULL) { ! roadmap_log(ROADMAP_FATAL, "unknown path set '%s'", name); ! } ! while (*path == ',') path += 1; ! if (*path == 0) return; /* Ignore empty path: current is better. */ ! if (path_list->items != NULL) { ! /* This replaces a path that was already set. */ ! for (i = path_list->count-1; i >= 0; --i) { ! free (path_list->items[i]); ! } ! free (path_list->items); ! } ! /* Count the number of items in this path string. */ ! count = 0; ! for (item = path-1; item != NULL; item = strchr (item+1, ',')) { ! count += 1; ! } ! path_list->items = calloc (count, sizeof(char *)); ! roadmap_check_allocated(path_list->items); ! /* Extract and expand each item of the path. ! * Ignore directories that do not exist yet. ! */ ! for (i = 0, item = path-1; item != NULL; item = next_item) { ! item += 1; ! next_item = strchr (item, ','); ! if (next_item == NULL) { path_list->items[i] = roadmap_path_expand (item, strlen(item)); ! } else { path_list->items[i] = roadmap_path_expand (item, (size_t)(next_item - item)); ! } ! if (roadmap_path_is_directory(path_list->items[i])) { ! ++i; ! } else { ! free (path_list->items[i]); ! path_list->items[i] = NULL; ! } ! } ! path_list->count = i; } *************** *** 324,338 **** const char *roadmap_path_first (const char *name) { ! RoadMapPathList path_list = roadmap_path_find (name); ! if (path_list == NULL) { ! roadmap_log (ROADMAP_FATAL, "invalid path set '%s'", name); ! } ! if (path_list->count > 0) { ! return path_list->items[0]; ! } ! return NULL; } --- 335,349 ---- const char *roadmap_path_first (const char *name) { ! RoadMapPathList path_list = roadmap_path_find (name); ! if (path_list == NULL) { ! roadmap_log (ROADMAP_FATAL, "invalid path set '%s'", name); ! } ! if (path_list->count > 0) { ! return path_list->items[0]; ! } ! return NULL; } *************** *** 340,355 **** const char *roadmap_path_next (const char *name, const char *current) { ! int i; ! RoadMapPathList path_list = roadmap_path_find (name); ! for (i = 0; i < path_list->count-1; ++i) { ! if (path_list->items[i] == current) { ! return path_list->items[i+1]; ! } ! } ! return NULL; } --- 351,366 ---- const char *roadmap_path_next (const char *name, const char *current) { ! int i; ! RoadMapPathList path_list = roadmap_path_find (name); ! for (i = 0; i < path_list->count-1; ++i) { ! if (path_list->items[i] == current) { ! return path_list->items[i+1]; ! } ! } ! return NULL; } *************** *** 357,370 **** const char *roadmap_path_last (const char *name) { ! RoadMapPathList path_list = roadmap_path_find (name); ! if (path_list == NULL) { ! roadmap_log (ROADMAP_FATAL, "invalid path set '%s'", name); ! } ! if (path_list->count > 0) { ! return path_list->items[path_list->count-1]; ! } ! return NULL; } --- 368,381 ---- const char *roadmap_path_last (const char *name) { ! RoadMapPathList path_list = roadmap_path_find (name); ! if (path_list == NULL) { ! roadmap_log (ROADMAP_FATAL, "invalid path set '%s'", name); ! } ! if (path_list->count > 0) { ! return path_list->items[path_list->count-1]; ! } ! return NULL; } *************** *** 372,385 **** const char *roadmap_path_previous (const char *name, const char *current) { ! int i; ! RoadMapPathList path_list = roadmap_path_find (name); ! for (i = path_list->count-1; i > 0; --i) { ! if (path_list->items[i] == current) { ! return path_list->items[i-1]; ! } ! } ! return NULL; } --- 383,396 ---- const char *roadmap_path_previous (const char *name, const char *current) { ! int i; ! RoadMapPathList path_list = roadmap_path_find (name); ! for (i = path_list->count-1; i > 0; --i) { ! if (path_list->items[i] == current) { ! return path_list->items[i-1]; ! } ! } ! return NULL; } *************** *** 400,406 **** void roadmap_path_create (const char *path) { ! LPWSTR path_unicode = ConvertToWideChar(path, CP_UTF8); ! CreateDirectory(path_unicode, NULL); ! free(path_unicode); } --- 411,417 ---- void roadmap_path_create (const char *path) { ! LPWSTR path_unicode = ConvertToWideChar(path, CP_UTF8); ! CreateDirectory(path_unicode, NULL); ! free(path_unicode); } *************** *** 410,451 **** char **roadmap_path_list (const char *path, const char *extension) { ! WIN32_FIND_DATA wfd; ! WCHAR strPath[MAX_PATH]; ! HANDLE hFound; ! LPWSTR path_unicode = ConvertToWideChar(path, CP_UTF8); ! LPWSTR ext_unicode = ConvertToWideChar(extension, CP_UTF8); ! int count; ! char **result; ! char **cursor; ! _snwprintf(strPath, MAX_PATH, TEXT("%s\\*%s"), path_unicode, ext_unicode); ! free(path_unicode); ! free(ext_unicode); ! hFound = FindFirstFile(strPath, &wfd); ! if (hFound == INVALID_HANDLE_VALUE) return &RoadMapPathEmptyList; ! count = 1; ! while(FindNextFile(hFound, &wfd)) ++count; ! FindClose(hFound); ! cursor = result = calloc (count+1, sizeof(char *)); ! roadmap_check_allocated (result); ! hFound = FindFirstFile(strPath, &wfd); ! if (hFound == INVALID_HANDLE_VALUE) return &RoadMapPathEmptyList; ! do { ! if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { ! char *name = ConvertToMultiByte(wfd.cFileName, CP_UTF8); ! *(cursor++) = name; ! } ! } while (FindNextFile(hFound, &wfd)); ! *cursor = NULL; ! return result; } --- 421,462 ---- char **roadmap_path_list (const char *path, const char *extension) { ! WIN32_FIND_DATA wfd; ! WCHAR strPath[MAX_PATH]; ! HANDLE hFound; ! LPWSTR path_unicode = ConvertToWideChar(path, CP_UTF8); ! LPWSTR ext_unicode = ConvertToWideChar(extension, CP_UTF8); ! int count; ! char **result; ! char **cursor; ! _snwprintf(strPath, MAX_PATH, TEXT("%s\\*%s"), path_unicode, ext_unicode); ! free(path_unicode); ! free(ext_unicode); ! hFound = FindFirstFile(strPath, &wfd); ! if (hFound == INVALID_HANDLE_VALUE) return &RoadMapPathEmptyList; ! count = 1; ! while(FindNextFile(hFound, &wfd)) ++count; ! FindClose(hFound); ! cursor = result = calloc (count+1, sizeof(char *)); ! roadmap_check_allocated (result); ! hFound = FindFirstFile(strPath, &wfd); ! if (hFound == INVALID_HANDLE_VALUE) return &RoadMapPathEmptyList; ! do { ! if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { ! char *name = ConvertToMultiByte(wfd.cFileName, CP_UTF8); ! *(cursor++) = name; ! } ! } while (FindNextFile(hFound, &wfd)); ! *cursor = NULL; ! return result; } *************** *** 453,464 **** void roadmap_path_list_free (char **list) { ! char **cursor; ! if ((list == NULL) || (list == &RoadMapPathEmptyList)) return; ! for (cursor = list; *cursor != NULL; ++cursor) { ! free (*cursor); ! } ! free (list); } --- 464,475 ---- void roadmap_path_list_free (char **list) { ! char **cursor; ! if ((list == NULL) || (list == &RoadMapPathEmptyList)) return; ! for (cursor = list; *cursor != NULL; ++cursor) { ! free (*cursor); ! } ! free (list); } *************** *** 466,470 **** void roadmap_path_free (const char *path) { ! free ((char *) path); } --- 477,481 ---- void roadmap_path_free (const char *path) { ! free ((char *) path); } *************** *** 472,484 **** const char *roadmap_path_search_icon (const char *name) { ! static char result[256]; ! sprintf (result, "%s\\icons\\rm_%s.png", roadmap_path_user(), name); ! if (roadmap_file_exists(NULL, result)) return result; ! sprintf (result, "\\Storage Card\\Roadmap\\icons\\rm_%s.png", name); ! if (roadmap_file_exists(NULL, result)) return result; ! return NULL; /* Not found. */ } --- 483,495 ---- const char *roadmap_path_search_icon (const char *name) { ! static char result[256]; ! sprintf (result, "%s\\icons\\rm_%s.png", roadmap_path_user(), name); ! if (roadmap_file_exists(NULL, result)) return result; ! sprintf (result, "\\Storage Card\\Roadmap\\icons\\rm_%s.png", name); ! if (roadmap_file_exists(NULL, result)) return result; ! return NULL; /* Not found. */ } *************** *** 498,499 **** --- 509,519 ---- return roadmap_path_user(); } + + int roadmap_path_is_directory (const char *name) { + LPWSTR full_name_unicode = ConvertToWideChar(name, CP_UTF8); + + DWORD dwAttributes = GetFileAttributes (full_name_unicode); + free(full_name_unicode); + return dwAttributes & FILE_ATTRIBUTE_DIRECTORY; + } + Index: preferences =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/win32/preferences,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** preferences 18 Aug 2006 18:00:07 -0000 1.10 --- preferences 21 Nov 2006 09:34:40 -0000 1.11 *************** *** 56,60 **** Map.Refresh: normal Map.Signs: yes - Map.Background: #ffffcc Accuracy.Mouse: 20 Display.Rotate: yes --- 56,59 ---- |
From: Ehud S. <esh...@us...> - 2006-11-21 09:34:25
|
Update of /cvsroot/roadmap/roadmap_editor/src/win32 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10281 Modified Files: roadmap_canvas_agg.cpp Added Files: roadmap_libpng.c roadmap_libpng.h Log Message: Add support for loading PNG files. --- NEW FILE: roadmap_libpng.c --- /* * Guillaume Cottenceau (gc at mandrakesoft.com) * * Copyright 2002 MandrakeSoft * * This software may be freely redistributed under the terms of the GNU * public license. * */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdarg.h> #include <png.h> #include "roadmap.h" #include "roadmap_libpng.h" unsigned char *read_png_file(const char* file_name, int *width, int *height, int *stride) { png_byte color_type; png_byte bit_depth; png_structp png_ptr; png_infop info_ptr; int number_of_passes; png_bytep* row_pointers; int y; char header[8]; // 8 is the maximum size that can be checked unsigned char *buf; HANDLE fp; LPWSTR url_unicode; DWORD num_bytes; url_unicode = ConvertToWideChar(file_name, CP_UTF8); fp = CreateFile (url_unicode, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); free(url_unicode); /* open file and test for it being a png */ if (fp == INVALID_HANDLE_VALUE) return NULL; ReadFile(fp, header, 8, &num_bytes, NULL); if (png_sig_cmp(header, 0, 8)) { roadmap_log (ROADMAP_ERROR, "[read_png_file] File %s is not recognized as a PNG file", file_name); CloseHandle(fp); return NULL; } /* initialize stuff */ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { roadmap_log (ROADMAP_ERROR, "[read_png_file] png_create_read_struct failed"); CloseHandle(fp); return NULL; } info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { roadmap_log (ROADMAP_ERROR, "[read_png_file] png_create_info_struct failed"); CloseHandle(fp); return NULL; } if (setjmp(png_jmpbuf(png_ptr))) { roadmap_log (ROADMAP_ERROR, "[read_png_file] Error during init_io"); CloseHandle(fp); return NULL; } png_init_io(png_ptr, fp); png_set_sig_bytes(png_ptr, 8); png_read_info(png_ptr, info_ptr); *width = info_ptr->width; *height = info_ptr->height; *stride = info_ptr->rowbytes; color_type = info_ptr->color_type; bit_depth = info_ptr->bit_depth; number_of_passes = png_set_interlace_handling(png_ptr); png_read_update_info(png_ptr, info_ptr); /* read file */ if (setjmp(png_jmpbuf(png_ptr))) { roadmap_log (ROADMAP_ERROR, "[read_png_file] Error during read_image"); CloseHandle(fp); return NULL; } row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * *height); buf = malloc (*height * info_ptr->rowbytes); for (y=0; y<*height; y++) { row_pointers[y] = (png_byte*) (buf + y * info_ptr->rowbytes); } png_read_image(png_ptr, row_pointers); CloseHandle(fp); return buf; } Index: roadmap_canvas_agg.cpp =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/win32/roadmap_canvas_agg.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** roadmap_canvas_agg.cpp 17 Sep 2006 18:24:58 -0000 1.8 --- roadmap_canvas_agg.cpp 21 Nov 2006 09:34:22 -0000 1.9 *************** *** 63,67 **** #include "colors.h" } ! #include "../roadmap_canvas_agg.h" --- 63,68 ---- #include "colors.h" } ! ! #include "roadmap_libpng.h" #include "../roadmap_canvas_agg.h" *************** *** 235,250 **** } - RoadMapImage roadmap_canvas_agg_load_image (const char *path, const char *file_name) { ! char *full_name = roadmap_path_join (path, file_name); agg::pixel_map pmap_tmp; if(!pmap_tmp.load_from_bmp(full_name)) { - free(full_name); return NULL; } - free(full_name); - if (pmap_tmp.bpp() != 24) { return NULL; --- 236,248 ---- } ! static RoadMapImage load_bmp (const char *full_name) { agg::pixel_map pmap_tmp; + if(!pmap_tmp.load_from_bmp(full_name)) { return NULL; } if (pmap_tmp.bpp() != 24) { return NULL; *************** *** 272,275 **** --- 270,310 ---- + static RoadMapImage load_png (const char *full_name) { + + int width; + int height; + int stride; + + unsigned char *buf = read_png_file(full_name, &width, &height, &stride); + + if (!buf) return NULL; + + RoadMapImage image = new roadmap_canvas_image(); + image->rbuf.attach (buf, width, height, stride); + + return image; + } + + + RoadMapImage roadmap_canvas_agg_load_image (const char *path, + const char *file_name) { + + char *full_name = roadmap_path_join (path, file_name); + RoadMapImage image; + + if ((strlen(file_name) > 4) && + !strcasecmp (file_name + strlen(file_name) - 4, ".png")) { + + image = load_png (full_name); + } else { + image = load_bmp (full_name); + } + + free (full_name); + + return image; + } + + void roadmap_canvas_agg_free_image (RoadMapImage image) { --- NEW FILE: roadmap_libpng.h --- /* * Guillaume Cottenceau (gc at mandrakesoft.com) * * Copyright 2002 MandrakeSoft * * This software may be freely redistributed under the terms of the GNU * public license. * */ #ifndef __ROADMAP_LIBPNG_H_ #define __ROADMAP_LIBPNG_H_ #ifdef __cplusplus extern "C" #endif unsigned char *read_png_file(const char* file_name, int *width, int *height, int *stride); #endif |
From: Ehud S. <esh...@us...> - 2006-11-21 09:33:25
|
Update of /cvsroot/roadmap/roadmap_editor/src/unix In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv9821 Modified Files: roadmap_path.c Log Message: Skin management. Index: roadmap_path.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/unix/roadmap_path.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** roadmap_path.c 3 Nov 2006 12:25:48 -0000 1.4 --- roadmap_path.c 21 Nov 2006 09:33:22 -0000 1.5 *************** *** 67,70 **** --- 67,78 ---- + /* Skins directories */ + static const char *RoadMapPathSkin[] = { + "~/.roadmap/skins/default/day", + "~/.roadmap/skins/default", + NULL + }; + static const char *RoadMapPathSkinPreferred = "~/.roadmap/skins"; + /* The hardcoded path for configuration files (the "config" path). * (Note that the user directory (~/.roadmap) does not appear here *************** *** 79,82 **** --- 87,91 ---- #else /* This is for standard Unix configurations. */ + "~/.roadmap", "/etc/roadmap", "/usr/local/share/roadmap", *************** *** 89,93 **** "/mnt/cf/QtPalmtop/share/roadmap"; #else ! "/usr/local/share/roadmap"; #endif --- 98,102 ---- "/mnt/cf/QtPalmtop/share/roadmap"; #else ! "~/.roadmap"; #endif *************** *** 167,170 **** --- 176,182 ---- RoadMapPathConfigPreferred); + roadmap_path_list_create ("skin", RoadMapPathSkin, + RoadMapPathSkinPreferred); + roadmap_path_list_create ("maps", RoadMapPathMaps, RoadMapPathMapsPreferred); |
From: Ehud S. <esh...@us...> - 2006-11-21 09:32:55
|
Update of /cvsroot/roadmap/roadmap_editor/src/ssd In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv9420 Modified Files: ssd_button.c ssd_button.h ssd_container.c ssd_dialog.c ssd_dialog.h ssd_entry.c ssd_keyboard.c ssd_list.c ssd_menu.c ssd_menu.h ssd_messagebox.c ssd_widget.c ssd_widget.h Added Files: ssd_choice.c ssd_choice.h ssd_keyboard.h Log Message: Some more layout fixes. Added a new choice widget. Index: ssd_button.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_button.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ssd_button.c 17 Nov 2006 16:46:49 -0000 1.2 --- ssd_button.c 21 Nov 2006 09:32:51 -0000 1.3 *************** *** 34,37 **** --- 34,38 ---- #include "ssd_widget.h" + #include "ssd_text.h" #include "ssd_button.h" *************** *** 59,63 **** for (i=data->state; i>=0; i--) { if (data->bitmaps[i] && ! (image = roadmap_res_get (RES_BITMAP, 0, data->bitmaps[i]))) { break; } --- 60,64 ---- for (i=data->state; i>=0; i--) { if (data->bitmaps[i] && ! (image = roadmap_res_get (RES_BITMAP, RES_SKIN, data->bitmaps[i]))) { break; } *************** *** 146,151 **** else widget->value = ""; ! bmp = roadmap_res_get (RES_BITMAP, 0, data->bitmaps[0]); ! if (!bmp) return -1; widget->size.height = roadmap_canvas_image_height(bmp); --- 147,156 ---- else widget->value = ""; ! bmp = roadmap_res_get (RES_BITMAP, RES_SKIN, data->bitmaps[0]); ! if (!bmp) { ! widget->size.height = widget->size.width = 0; ! ! return -1; ! } widget->size.height = roadmap_canvas_image_height(bmp); *************** *** 189,190 **** --- 194,207 ---- + SsdWidget ssd_button_label (const char *name, const char *label, + int flags, SsdCallback callback) { + + const char *button_icon[] = {"button"}; + SsdWidget button = ssd_button_new (name, "", button_icon, 1, + flags, callback); + ssd_widget_add (button, + ssd_text_new ("label", label, -1, SSD_ALIGN_VCENTER| SSD_ALIGN_CENTER)); + + return button; + } + Index: ssd_keyboard.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_keyboard.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ssd_keyboard.c 17 Nov 2006 16:46:49 -0000 1.2 --- ssd_keyboard.c 21 Nov 2006 09:32:51 -0000 1.3 *************** *** 77,82 **** int len; if (!strcmp (roadmap_lang_get ("Ok"), widget->name)) { ! return 0; } else if (!strcmp (roadmap_lang_get ("Del"), widget->name)) { --- 77,89 ---- int len; + SsdKeyboard *keyboard; + SsdWidget k = widget->parent; + + keyboard = (SsdKeyboard *)k->context; + if (!strcmp (roadmap_lang_get ("Ok"), widget->name)) { ! return (*keyboard->callback) ! (SSD_KEYBOARD_OK, ssd_dialog_get_value ("input"), ! keyboard->context); } else if (!strcmp (roadmap_lang_get ("Del"), widget->name)) { *************** *** 95,99 **** if (len == value_len) { ssd_dialog_set_value ("input", ""); ! return 0; } --- 102,106 ---- if (len == value_len) { ssd_dialog_set_value ("input", ""); ! return 1; } *************** *** 105,109 **** ssd_dialog_set_value ("input", text); ! return 0; } else if (!strcmp (roadmap_lang_get ("SPC"), widget->name)) { --- 112,116 ---- ssd_dialog_set_value ("input", text); ! return 1; } else if (!strcmp (roadmap_lang_get ("SPC"), widget->name)) { *************** *** 138,142 **** ssd_dialog_set_value ("input", text); ! return 0; } --- 145,149 ---- ssd_dialog_set_value ("input", text); ! return 1; } *************** *** 159,164 **** char value[255]; const char *icons[] = { ! "key_button1.bmp", ! "key_button2.bmp" }; --- 166,171 ---- char value[255]; const char *icons[] = { ! "key_button1", ! "key_button2" }; *************** *** 188,192 **** if ((type == SSD_BUTTON_KEY) && strcmp (key1, key2)) { SsdWidget w = ssd_text_new ("key2", key2, 13, SSD_ALIGN_RIGHT|SSD_END_ROW); ! ssd_widget_set_color (w, "ffaaff", 0); ssd_widget_set_offset (w, 9, 3); ssd_widget_add (button, w); --- 195,199 ---- if ((type == SSD_BUTTON_KEY) && strcmp (key1, key2)) { SsdWidget w = ssd_text_new ("key2", key2, 13, SSD_ALIGN_RIGHT|SSD_END_ROW); ! ssd_widget_set_color (w, "ffff00ff", 0); ssd_widget_set_offset (w, 9, 3); ssd_widget_add (button, w); Index: ssd_button.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_button.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ssd_button.h 17 Nov 2006 16:46:49 -0000 1.2 --- ssd_button.h 21 Nov 2006 09:32:51 -0000 1.3 *************** *** 36,38 **** --- 36,41 ---- int flags, SsdCallback callback); + SsdWidget ssd_button_label (const char *name, const char *label, + int flags, SsdCallback callback); + #endif // __SSD_WIDGET_BUTTON_H_ --- NEW FILE: ssd_choice.c --- /* ssd_choice.c - combo box widget * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * SYNOPSYS: * * See ssd_choice.h. */ #include <string.h> #include <stdlib.h> #include "ssd_dialog.h" #include "ssd_container.h" #include "ssd_list.h" #include "ssd_button.h" #include "ssd_text.h" #include "ssd_choice.h" struct ssd_choice_data { SsdCallback callback; int num_values; const char **labels; const void **values; }; static int list_callback (int type, const char *new_value, void *context) { ((SsdWidget)context)->set_value ((SsdWidget)context, new_value); ssd_list_hide (); return 1; } static int choice_callback (SsdWidget widget, const char *new_value) { struct ssd_choice_data *data; widget = widget->parent; data = (struct ssd_choice_data *)widget->data; ssd_list_show ("", data->num_values, data->labels, NULL, list_callback, widget); return 1; } static const char *get_value (SsdWidget widget) { return ssd_widget_get_value (widget, "Label"); } static const void *get_data (SsdWidget widget) { struct ssd_choice_data *data = (struct ssd_choice_data *)widget->data; const char *value = get_value (widget); int i; for (i=0; i<data->num_values; i++) { if (!strcmp(value, data->labels[i])) break; } if (i == data->num_values) return NULL; return data->values[i]; } static int set_value (SsdWidget widget, const char *value) { struct ssd_choice_data *data = (struct ssd_choice_data *)widget->data; if ((data->callback) && !(*data->callback) (widget, value)) { return 0; } return ssd_widget_set_value (widget, "Label", value); } static int set_data (SsdWidget widget, const void *value) { struct ssd_choice_data *data = (struct ssd_choice_data *)widget->data; int i; for (i=0; i<data->num_values; i++) { if (data->values[i] == value) break; } if (i == data->num_values) return -1; return ssd_widget_set_value (widget, "Label", data->labels[i]); } SsdWidget ssd_choice_new (const char *name, int count, const char **labels, const void **values, int flags, SsdCallback callback) { const char *edit_button[] = {"edit"}; struct ssd_choice_data *data = (struct ssd_choice_data *)calloc (1, sizeof(*data)); SsdWidget choice = ssd_container_new (name, NULL, SSD_MIN_SIZE, SSD_MIN_SIZE, flags); SsdWidget text_box = ssd_container_new ("text_box", NULL, SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_CONTAINER_BORDER|SSD_ALIGN_VCENTER); data->callback = callback; data->num_values = count; data->labels = labels; data->values = values; choice->get_value = get_value; choice->get_data = get_data; choice->set_value = set_value; choice->set_data = set_data; choice->data = data; choice->bg_color = NULL; text_box->callback = choice_callback; text_box->bg_color = NULL; ssd_widget_add (text_box, ssd_text_new ("Label", labels[0], -1, 0)); ssd_widget_add (choice, text_box); ssd_widget_add (choice, ssd_button_new ("edit_button", "", edit_button, 1, SSD_ALIGN_VCENTER, choice_callback)); return choice; } Index: ssd_list.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_list.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ssd_list.c 17 Nov 2006 16:46:49 -0000 1.1 --- ssd_list.c 21 Nov 2006 09:32:51 -0000 1.2 *************** *** 94,98 **** if (!strcmp(widget->name, "scroll_down")) { if ((data->first_row_index + data->num_rows) >= data->num_values) { ! return -1; } --- 94,98 ---- if (!strcmp(widget->name, "scroll_down")) { if ((data->first_row_index + data->num_rows) >= data->num_values) { ! return 0; } *************** *** 101,105 **** } ! return 0; } --- 101,105 ---- } ! return 1; } *************** *** 191,197 **** SsdWidget ssd_list_new (const char *name, int width, int height, int flags) { ! const char *scroll_up_icons[] = {"up.bmp"}; ! const char *scroll_down_icons[] = {"down.bmp"}; ! SsdSize scroll_size; SsdSize button_size; SsdWidget list; --- 191,196 ---- SsdWidget ssd_list_new (const char *name, int width, int height, int flags) { ! const char *scroll_up_icons[] = {"up"}; ! const char *scroll_down_icons[] = {"down"}; SsdSize button_size; SsdWidget list; *************** *** 226,230 **** scroll_bar = ssd_container_new ("scroll_bar", NULL, button_size.width, ! scroll_size.height - button_size.height*2, SSD_CONTAINER_BORDER|SSD_END_ROW); --- 225,229 ---- scroll_bar = ssd_container_new ("scroll_bar", NULL, button_size.width, ! 0, SSD_CONTAINER_BORDER|SSD_END_ROW); Index: ssd_entry.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_entry.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ssd_entry.c 17 Nov 2006 16:46:49 -0000 1.2 --- ssd_entry.c 21 Nov 2006 09:32:51 -0000 1.3 *************** *** 1,3 **** ! /* ssd_entry.c - Text entry widget * * LICENSE: --- 1,3 ---- ! /* ssd_entry.c - entry widget * * LICENSE: *************** *** 23,121 **** * SYNOPSYS: * ! * See ssd_entry.h */ - #include <stdlib.h> #include <string.h> ! #include "roadmap.h" ! #include "roadmap_canvas.h" ! ! #include "ssd_widget.h" #include "ssd_text.h" ! #include "ssd_entry.h" ! ! static int initialized; ! static RoadMapPen bg; ! static RoadMapPen text_pen; ! static void init (void) { ! bg = roadmap_canvas_create_pen ("ssd_entry_bg"); ! roadmap_canvas_set_foreground ("#ffffff"); - text_pen = roadmap_canvas_create_pen ("ssd_entry_txt"); - roadmap_canvas_set_foreground ("#000000"); ! initialized = 1; } ! static void draw (SsdWidget widget, RoadMapGuiRect *rect, int flags) { ! RoadMapGuiPoint points[5]; ! int count = 5; ! if (!(flags & SSD_GET_SIZE)) { ! roadmap_canvas_select_pen (bg); ! roadmap_canvas_erase_area (rect); ! } ! points[0].x = rect->minx; ! points[0].y = rect->miny; ! points[1].x = rect->maxx; ! points[1].y = rect->miny; ! points[2].x = rect->maxx; ! points[2].y = rect->maxy; ! points[3].x = rect->minx; ! points[3].y = rect->maxy; ! points[4].x = rect->minx; ! points[4].y = rect->miny; ! if (!(flags & SSD_GET_SIZE)) { ! roadmap_canvas_select_pen (text_pen); ! roadmap_canvas_draw_multiple_lines (1, &count, points, 0); ! } ! rect->minx += 1; ! rect->miny += 1; ! rect->maxx -= 1; ! rect->maxy -= 1; } static int set_value (SsdWidget widget, const char *value) { - SsdWidget w = ssd_widget_get (widget, "text"); - w->set_value (w, value); - - widget->value = w->value; ! return 0; } ! SsdWidget ssd_entry_new (const char *name, const char *value, int flags) { ! SsdWidget w; ! if (!initialized) { ! init (); ! } ! w = ssd_widget_new (name, flags); ! w->typeid = "Entry"; ! w->draw = draw; ! w->set_value = set_value; ! w->flags = flags; ! // w->size.height = 24; ! // w->size.width = roadmap_canvas_width() - 6; ! w->children = ssd_text_new ("text", value, 20, 0); ! set_value (w, value); ! return w; } --- 23,104 ---- * SYNOPSYS: * ! * See ssd_entry.h. */ #include <string.h> + #include <stdlib.h> ! #include "ssd_dialog.h" ! #include "ssd_container.h" #include "ssd_text.h" ! #include "ssd_button.h" ! #include "ssd_keyboard.h" ! #include "ssd_entry.h" ! static int keyboard_callback (int type, const char *new_value, void *context) { ! if (type == SSD_KEYBOARD_OK) { ! ((SsdWidget)context)->set_value ((SsdWidget)context, new_value); ! ssd_keyboard_hide (SSD_KEYBOARD_LETTERS); ! } ! return 1; } ! static int edit_callback (SsdWidget widget, const char *new_value) { ! const char *value; ! /* Get the entry widget */ ! widget = widget->parent; ! value = widget->get_value (widget); ! ssd_keyboard_show (SSD_KEYBOARD_LETTERS, "", value, keyboard_callback, ! widget); ! return 1; } static int set_value (SsdWidget widget, const char *value) { + return ssd_widget_set_value (widget, "Text", value); + } ! const char *get_value (SsdWidget widget) { ! return ssd_widget_get_value (widget, "Text"); } ! SsdWidget ssd_entry_new (const char *name, ! const char *value, ! int flags) { ! const char *edit_button[] = {"edit"}; ! SsdWidget entry = ! ssd_container_new (name, NULL, SSD_MIN_SIZE, SSD_MIN_SIZE, flags); ! SsdWidget text_box = ! ssd_container_new ("text_box", NULL, SSD_MIN_SIZE, ! SSD_MIN_SIZE, SSD_CONTAINER_BORDER|SSD_ALIGN_VCENTER); ! entry->get_value = get_value; ! entry->set_value = set_value; ! entry->bg_color = NULL; ! text_box->callback = edit_callback; ! text_box->bg_color = NULL; ! ssd_widget_add (text_box, ssd_text_new ("Text", value, -1, 0)); ! ssd_widget_add (entry, text_box); ! ssd_widget_add (entry, ! ssd_button_new ("edit_button", "", edit_button, 1, ! SSD_ALIGN_VCENTER, edit_callback)); ! return entry; } Index: ssd_dialog.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_dialog.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ssd_dialog.c 17 Nov 2006 16:46:49 -0000 1.2 --- ssd_dialog.c 21 Nov 2006 09:32:51 -0000 1.3 *************** *** 55,58 **** --- 55,59 ---- void *context; /* References a caller-specific context. */ + RoadMapCallback callback; /* Called before hide */ SsdWidget container; *************** *** 62,69 **** static SsdDialog RoadMapDialogCurrent = NULL; - static RoadMapPointerClickHandler PrevPressedClickHandler; - static RoadMapPointerHandler PrevShortClickHandler; - static RoadMapPointerHandler PrevLongClickHandler; - static RoadMapGuiPoint LastPointerPoint; --- 63,66 ---- *************** *** 680,683 **** --- 677,686 ---- static int ssd_dialog_pressed (RoadMapGuiPoint *point) { + SsdWidget container = RoadMapDialogCurrent->container; + if (!ssd_widget_find_by_pos (container, point)) { + LastPointerPoint.x = -1; + return 0; + } + LastPointerPoint = *point; ssd_widget_pointer_down (RoadMapDialogCurrent->container, point); *************** *** 686,697 **** } ! static void ssd_dialog_short_click (RoadMapGuiPoint *point) { ssd_widget_short_click (RoadMapDialogCurrent->container, &LastPointerPoint); roadmap_screen_redraw (); } ! static void ssd_dialog_long_click (RoadMapGuiPoint *point) { ssd_widget_long_click (RoadMapDialogCurrent->container, &LastPointerPoint); roadmap_screen_redraw (); } --- 689,710 ---- } ! static int ssd_dialog_short_click (RoadMapGuiPoint *point) { ! if (LastPointerPoint.x < 0) { ! return 0; ! } ssd_widget_short_click (RoadMapDialogCurrent->container, &LastPointerPoint); roadmap_screen_redraw (); + + return 1; } ! static int ssd_dialog_long_click (RoadMapGuiPoint *point) { ! if (!LastPointerPoint.x < 0) { ! return 0; ! } ssd_widget_long_click (RoadMapDialogCurrent->container, &LastPointerPoint); roadmap_screen_redraw (); + + return 1; } *************** *** 704,711 **** SsdDialog child; ! int width = roadmap_canvas_width (); ! int height = roadmap_canvas_height (); ! child = (SsdDialog) malloc (sizeof (*child)); roadmap_check_allocated(child); --- 717,724 ---- SsdDialog child; ! int width = SSD_MAX_SIZE; ! int height = SSD_MAX_SIZE; ! child = (SsdDialog) calloc (sizeof (*child), 1); roadmap_check_allocated(child); *************** *** 713,722 **** if (flags & SSD_DIALOG_FLOAT) { ! width -= 70; ! height = -1; } child->container = ! ssd_container_new (name, title, SSD_MAX_SIZE, SSD_MAX_SIZE, flags); child->next = RoadMapDialogWindows; --- 726,735 ---- if (flags & SSD_DIALOG_FLOAT) { ! width = SSD_MAX_SIZE; ! height = SSD_MIN_SIZE; } child->container = ! ssd_container_new (name, title, width, height, flags); child->next = RoadMapDialogWindows; *************** *** 789,795 **** if (current) { ! roadmap_log (ROADMAP_FATAL, ! "Trying to activate an already activated dialog: %s", ! name); } --- 802,806 ---- if (current) { ! return current->container; } *************** *** 800,809 **** if (!RoadMapDialogCurrent) { /* Grab pointer hooks */ ! PrevPressedClickHandler = ! roadmap_pointer_register_pressed (ssd_dialog_pressed); ! PrevShortClickHandler = ! roadmap_pointer_register_short_click (ssd_dialog_short_click); ! PrevLongClickHandler = ! roadmap_pointer_register_long_click (ssd_dialog_long_click); } --- 811,817 ---- if (!RoadMapDialogCurrent) { /* Grab pointer hooks */ ! roadmap_pointer_register_pressed (ssd_dialog_pressed); ! roadmap_pointer_register_short_click (ssd_dialog_short_click); ! roadmap_pointer_register_long_click (ssd_dialog_long_click); } *************** *** 830,835 **** if (!dialog) { ! roadmap_log (ROADMAP_FATAL, ! "Trying to hide dialog '%s', but it is not active.", name); } --- 838,842 ---- if (!dialog) { ! return; } *************** *** 841,847 **** if (!RoadMapDialogCurrent) { ! roadmap_pointer_register_pressed (PrevPressedClickHandler); ! roadmap_pointer_register_short_click (PrevShortClickHandler); ! roadmap_pointer_register_long_click (PrevLongClickHandler); } --- 848,858 ---- if (!RoadMapDialogCurrent) { ! roadmap_pointer_unregister_pressed (ssd_dialog_pressed); ! roadmap_pointer_unregister_short_click (ssd_dialog_short_click); ! roadmap_pointer_unregister_long_click (ssd_dialog_long_click); ! } ! ! if (dialog->callback) { ! (*dialog->callback) (); } *************** *** 879,882 **** --- 890,899 ---- + const void *ssd_dialog_get_data (const char *name) { + + return ssd_widget_get_data (RoadMapDialogCurrent->container, name); + } + + int ssd_dialog_set_value (const char *name, const char *value) { *************** *** 885,886 **** --- 902,929 ---- + int ssd_dialog_set_data (const char *name, const void *value) { + return ssd_widget_set_data (RoadMapDialogCurrent->container, name, value); + } + + + void ssd_dialog_set_callback (RoadMapCallback callback) { + + if (!RoadMapDialogCurrent) { + roadmap_log (ROADMAP_FATAL, + "Trying to set a dialog callback, but no active dialogs exist"); + } + + RoadMapDialogCurrent->callback = callback; + } + + + void *ssd_dialog_context (void) { + if (!RoadMapDialogCurrent) { + roadmap_log (ROADMAP_FATAL, + "Trying to get dialog context, but no active dialogs exist"); + } + + return RoadMapDialogCurrent->context; + } + + --- NEW FILE: ssd_keyboard.h --- /* ssd_keyboard.h - Full screen keyboard * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SSD_KEYBOARD_H_ #define __SSD_KEYBOARD_H_ #define SSD_KEYBOARD_LETTERS 1 #define SSD_KEYBOARD_DIGITS 2 /* key types */ #define SSD_KEYBOARD_OK 0x1 #include "ssd_dialog.h" void ssd_keyboard_show (int type, const char *title, const char *value, SsdDialogCB callback, void *context); void ssd_keyboard_hide (int type); #endif // __SSD_KEYBOARD_H_ Index: ssd_dialog.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_dialog.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ssd_dialog.h 17 Nov 2006 16:46:49 -0000 1.2 --- ssd_dialog.h 21 Nov 2006 09:32:51 -0000 1.3 *************** *** 27,30 **** --- 27,31 ---- #define __SSD_DIALOG_H_ + #include "roadmap.h" #include "roadmap_canvas.h" #include "ssd_widget.h" *************** *** 45,51 **** --- 46,58 ---- const char *ssd_dialog_get_value (const char *name); + const void *ssd_dialog_get_data (const char *name); int ssd_dialog_set_value (const char *name, const char *value); + int ssd_dialog_set_data (const char *name, const void *value); + + void *ssd_dialog_context (void); void ssd_dialog_hide_current (void); + void ssd_dialog_set_callback (RoadMapCallback callback); + #endif // __SSD_DIALOG_H_ Index: ssd_container.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_container.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ssd_container.c 17 Nov 2006 16:46:49 -0000 1.2 --- ssd_container.c 21 Nov 2006 09:32:51 -0000 1.3 *************** *** 136,140 **** static void add_title (SsdWidget w, int flags) { SsdWidget title; ! const char *close_icon[] = {"rm_quit.bmp"}; title = ssd_container_new ("title_bar", NULL, SSD_MAX_SIZE, SSD_MIN_SIZE, --- 136,140 ---- static void add_title (SsdWidget w, int flags) { SsdWidget title; ! const char *close_icon[] = {"rm_quit"}; title = ssd_container_new ("title_bar", NULL, SSD_MAX_SIZE, SSD_MIN_SIZE, --- NEW FILE: ssd_choice.h --- /* ssd_choice.h - Combo box widget * * LICENSE: * * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. * * RoadMap is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * RoadMap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RoadMap; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __SSD_CHOICE_LIST_H_ #define __SSD_CHOICE_LIST_H_ #include "ssd_widget.h" SsdWidget ssd_choice_new (const char *name, int count, const char **labels, const void **values, int flags, SsdCallback callback); #endif // __SSD_CHOICE_LIST_H_ Index: ssd_messagebox.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_messagebox.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ssd_messagebox.c 17 Nov 2006 16:46:49 -0000 1.1 --- ssd_messagebox.c 21 Nov 2006 09:32:51 -0000 1.2 *************** *** 45,50 **** SsdWidget dialog; - SsdWidget button; - const char *ok_button[] = {"button.bmp"}; dialog = ssd_dialog_new ("message_box", "", --- 45,48 ---- *************** *** 59,70 **** ssd_container_new ("spacer1", NULL, 0, 20, SSD_END_ROW)); ! button = ssd_button_new ("confirm", "", ok_button, 1, ! SSD_ALIGN_CENTER|SSD_START_NEW_ROW, button_callback); ! ! ssd_widget_add (button, ! ssd_text_new ("ok", roadmap_lang_get ("Ok"), 16, ! SSD_ALIGN_VCENTER| SSD_ALIGN_CENTER)); ! ! ssd_widget_add (dialog, button); } --- 57,63 ---- ssd_container_new ("spacer1", NULL, 0, 20, SSD_END_ROW)); ! ssd_widget_add (dialog, ! ssd_button_label ("confirm", roadmap_lang_get ("Ok"), ! SSD_ALIGN_CENTER|SSD_START_NEW_ROW, button_callback)); } Index: ssd_widget.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_widget.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ssd_widget.h 17 Nov 2006 16:46:49 -0000 1.2 --- ssd_widget.h 21 Nov 2006 09:32:51 -0000 1.3 *************** *** 40,43 **** --- 40,44 ---- #define SSD_WIDGET_SPACE 0x80 #define SSD_WIDGET_HIDE 0x100 + #define SSD_ALIGN_BOTTOM 0x200 /* Buttons flags */ *************** *** 99,103 **** --- 100,108 ---- void *data; /* Widget specific data */ + const char * (*get_value) (SsdWidget widget); + const void * (*get_data) (SsdWidget widget); + int (*set_value) (SsdWidget widget, const char *value); + int (*set_data) (SsdWidget widget, const void *value); void (*draw) (SsdWidget widget, RoadMapGuiRect *rect, int flags); int (*pointer_down) (SsdWidget widget, const RoadMapGuiPoint *point); *************** *** 118,126 **** --- 123,135 ---- const char *ssd_widget_get_value (const SsdWidget widget, const char *name); + const void *ssd_widget_get_data (const SsdWidget widget, const char *name); int ssd_widget_set_value (const SsdWidget widget, const char *name, const char *value); + int ssd_widget_set_data (const SsdWidget widget, const char *name, + const void *value); void ssd_widget_add (SsdWidget parent, SsdWidget child); + void ssd_widget_set_flags (SsdWidget widget, int flags); void ssd_widget_set_size (SsdWidget widget, int width, int height); void ssd_widget_set_offset (SsdWidget widget, int x, int y); *************** *** 139,141 **** --- 148,153 ---- void ssd_widget_show (SsdWidget w); + SsdWidget ssd_widget_find_by_pos (SsdWidget widget, + const RoadMapGuiPoint *point); + #endif // __SSD_WIDGET_H_ Index: ssd_menu.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_menu.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ssd_menu.c 17 Nov 2006 16:46:49 -0000 1.2 --- ssd_menu.c 21 Nov 2006 09:32:51 -0000 1.3 *************** *** 81,99 **** static void ssd_menu_new (const char *name, const char *items[], ! const RoadMapAction *actions) { int i; ! const char *icons[255] = {0}; const char **menu_items = ! roadmap_factory_user_config (name, "menu", actions, icons); ! SsdWidget dialog = ssd_dialog_new (name, "תפר×× ×¨×ש×", ! SSD_CONTAINER_BORDER|SSD_CONTAINER_TITLE); SsdWidget container; ! container = ssd_container_new (name, NULL, SSD_MAX_SIZE, SSD_MAX_SIZE, SSD_ALIGN_GRID); /* Override short and long click */ --- 81,108 ---- static void ssd_menu_new (const char *name, + const char *items_file, const char *items[], ! const RoadMapAction *actions, ! int flags) { int i; ! int next_item_flags = 0; const char **menu_items = ! roadmap_factory_user_config (items_file, "menu", actions); ! SsdWidget dialog = ssd_dialog_new (name, roadmap_lang_get (name), flags); SsdWidget container; ! if (flags & SSD_DIALOG_FLOAT) { ! container = ssd_container_new (name, NULL, SSD_MAX_SIZE, ! SSD_MIN_SIZE, 0); ! ssd_widget_set_size (dialog, SSD_MIN_SIZE, SSD_MIN_SIZE); ! ssd_widget_set_color (dialog, "#000000", "#ffffffaa"); ! ssd_widget_set_color (container, "#000000", NULL); ! } else { ! container = ssd_container_new (name, NULL, SSD_MAX_SIZE, SSD_MAX_SIZE, SSD_ALIGN_GRID); + } /* Override short and long click */ *************** *** 108,127 **** if (item == RoadMapFactorySeparator) { } else { SsdWidget text_box; const RoadMapAction *this_action = find_action (actions, item); const char *button_icon[] = { ! icons[i], NULL }; SsdWidget w = ssd_container_new (item, NULL, ! SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_ALIGN_CENTER); SsdWidget button; SsdWidget text; ! if (!icons[i]) continue; button = ssd_button_new --- 117,139 ---- if (item == RoadMapFactorySeparator) { + next_item_flags = SSD_START_NEW_ROW; } else { SsdWidget text_box; + SsdSize size; const RoadMapAction *this_action = find_action (actions, item); const char *button_icon[] = { ! item, NULL }; SsdWidget w = ssd_container_new (item, NULL, ! SSD_MIN_SIZE, SSD_MIN_SIZE, ! SSD_ALIGN_CENTER|next_item_flags); SsdWidget button; SsdWidget text; ! ssd_widget_set_color (w, "#000000", NULL); button = ssd_button_new *************** *** 129,138 **** button_callback); ssd_widget_set_context (button, this_action->callback); ssd_widget_add (w, button); ! text_box = ssd_container_new ("text_box", NULL, 60, SSD_MIN_SIZE, SSD_ALIGN_CENTER|SSD_END_ROW); text = ssd_text_new (item, roadmap_lang_get (this_action->label_long), --- 141,156 ---- button_callback); + ssd_widget_get_size (button ,&size, NULL); + ssd_widget_set_context (button, this_action->callback); ssd_widget_add (w, button); ! text_box = ssd_container_new ("text_box", NULL, ! size.width + size.width / 4, ! SSD_MIN_SIZE, SSD_ALIGN_CENTER|SSD_END_ROW); + ssd_widget_set_color (text_box, "#000000", NULL); + text = ssd_text_new (item, roadmap_lang_get (this_action->label_long), *************** *** 142,145 **** --- 160,165 ---- ssd_widget_add (container, w); + + next_item_flags = 0; } } *************** *** 150,165 **** void ssd_menu_activate (const char *name, const char *items[], ! const RoadMapAction *actions) { ! if (ssd_dialog_activate (name, NULL)) { ssd_dialog_draw (); return; } ! ssd_menu_new (name, items, actions); ssd_dialog_activate (name, NULL); ssd_dialog_draw (); } --- 170,199 ---- void ssd_menu_activate (const char *name, + const char *items_file, const char *items[], ! RoadMapCallback callback, ! const RoadMapAction *actions, ! int flags) { ! SsdWidget dialog = ssd_dialog_activate (name, NULL); ! ! if (dialog) { ! ssd_dialog_set_callback (callback); ! ssd_widget_set_flags (dialog, flags); ssd_dialog_draw (); return; } ! ssd_menu_new (name, items_file, items, actions, flags); ssd_dialog_activate (name, NULL); + ssd_dialog_set_callback (callback); ssd_dialog_draw (); } + + void ssd_menu_hide (const char *name) { + + ssd_dialog_hide (name); + } + Index: ssd_widget.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_widget.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ssd_widget.c 17 Nov 2006 16:46:49 -0000 1.2 --- ssd_widget.c 21 Nov 2006 09:32:51 -0000 1.3 *************** *** 156,162 **** ssd_widget_get_size (w, &size, NULL); w->position.x = x; w->position.y = y; - w->position.y += (height - size.height) / 2; if (size.width && size.height) { --- 156,165 ---- ssd_widget_get_size (w, &size, NULL); + if (w->flags & SSD_ALIGN_VCENTER) { + y += (height - size.height) / 2; + } + w->position.x = x; w->position.y = y; if (size.width && size.height) { *************** *** 181,184 **** --- 184,188 ---- int space; int vcenter = 0; + int bottom = 0; int i; SsdWidget prev_widget; *************** *** 193,199 **** if (size.height > row_height) row_height = size.height; if (w[i]->flags & SSD_ALIGN_VCENTER) vcenter = 1; } ! if (vcenter) { y += (height - row_height) / 2 - 1; } --- 197,207 ---- if (size.height > row_height) row_height = size.height; if (w[i]->flags & SSD_ALIGN_VCENTER) vcenter = 1; + if (w[i]->flags & SSD_ALIGN_BOTTOM) bottom = 1; } ! if (bottom) { ! y += (height - row_height); ! ! } else if (vcenter) { y += (height - row_height) / 2 - 1; } *************** *** 338,363 **** - static SsdWidget ssd_widget_find_by_pos (SsdWidget widget, - const RoadMapGuiPoint *point) { - - while (widget != NULL) { - SsdSize size; - ssd_widget_get_size (widget, &size, NULL); - - if ((widget->position.x <= point->x) && - ((widget->position.x + size.width) >= point->x) && - (widget->position.y <= point->y) && - ((widget->position.y + size.height) >= point->y)) { - - return widget; - } - - widget = widget->next; - } - - return NULL; - } - - static void ssd_widget_draw_grid (SsdWidget w, const RoadMapGuiRect *rect) { SsdWidget widgets[100]; --- 346,349 ---- *************** *** 548,551 **** --- 534,559 ---- + SsdWidget ssd_widget_find_by_pos (SsdWidget widget, + const RoadMapGuiPoint *point) { + + while (widget != NULL) { + SsdSize size; + ssd_widget_get_size (widget, &size, NULL); + + if ((widget->position.x <= point->x) && + ((widget->position.x + size.width) >= point->x) && + (widget->position.y <= point->y) && + ((widget->position.y + size.height) >= point->y)) { + + return widget; + } + + widget = widget->next; + } + + return NULL; + } + + void ssd_widget_set_callback (SsdWidget widget, SsdCallback callback) { widget->callback = callback; *************** *** 616,623 **** --- 624,642 ---- if (!w) return ""; + if (w->get_value) return w->get_value (w); + return w->value; } + const void *ssd_widget_get_data (const SsdWidget widget, const char *name) { + SsdWidget w = ssd_widget_get (widget, name); + if (!w) return ""; + + if (w->get_data) return w->get_data (w); + else return NULL; + } + + int ssd_widget_set_value (const SsdWidget widget, const char *name, const char *value) { *************** *** 629,632 **** --- 648,662 ---- } + + int ssd_widget_set_data (const SsdWidget widget, const char *name, + const void *value) { + + SsdWidget w = ssd_widget_get (widget, name); + if (!w || !w->set_data) return -1; + + return w->set_data(w, value); + } + + void ssd_widget_add (SsdWidget parent, SsdWidget child) { *************** *** 688,693 **** if (w->flags & SSD_DIALOG_FLOAT) { ! size->width = max->width - 70; ! size->height = SSD_MIN_SIZE; } else { --- 718,723 ---- if (w->flags & SSD_DIALOG_FLOAT) { ! if (size->width == SSD_MAX_SIZE) size->width = max->width - 70; ! if (size->height == SSD_MAX_SIZE) size->height = max->height; } else { *************** *** 810,811 **** --- 840,845 ---- + void ssd_widget_set_flags (SsdWidget widget, int flags) { + widget->flags = flags; + } + Index: ssd_menu.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/ssd/ssd_menu.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ssd_menu.h 3 Nov 2006 12:39:18 -0000 1.1 --- ssd_menu.h 21 Nov 2006 09:32:51 -0000 1.2 *************** *** 29,34 **** void ssd_menu_activate (const char *name, const char *items[], ! const RoadMapAction *actions); #endif // __SSD_MENU_H_ --- 29,39 ---- void ssd_menu_activate (const char *name, + const char *items_file, const char *items[], ! RoadMapCallback callback, ! const RoadMapAction *actions, ! int flags); ! ! void ssd_menu_hide (const char *name); #endif // __SSD_MENU_H_ |
From: Ehud S. <esh...@us...> - 2006-11-21 09:31:29
|
Update of /cvsroot/roadmap/roadmap_editor/src/navigate In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv9013 Modified Files: navigate_bar.c Log Message: Skin management. Index: navigate_bar.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/navigate/navigate_bar.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** navigate_bar.c 17 Jul 2006 06:34:27 -0000 1.3 --- navigate_bar.c 21 Nov 2006 09:31:26 -0000 1.4 *************** *** 31,36 **** #include "roadmap_canvas.h" #include "roadmap_screen_obj.h" - #include "roadmap_path.h" #include "roadmap_file.h" #include "roadmap_math.h" --- 31,36 ---- #include "roadmap_canvas.h" #include "roadmap_screen_obj.h" #include "roadmap_file.h" + #include "roadmap_res.h" #include "roadmap_math.h" *************** *** 50,55 **** static NavigateBarPanel NavigateBarDefaultPanels[] = { ! {"nav_panel_wide.bmp", 320, {0, 0}, {0, 65, 48, 110}, {3, 70}, {3, 95}, 75, 230}, ! {"nav_panel.bmp", 240, {0, 0}, {55, 0, 95, 50}, {55, 5}, {58, 30}, 98, 133} }; --- 50,55 ---- static NavigateBarPanel NavigateBarDefaultPanels[] = { ! {"nav_panel_wide", 320, {0, 0}, {0, 65, 48, 110}, {3, 70}, {3, 95}, 75, 230}, ! {"nav_panel", 240, {0, 0}, {55, 0, 95, 50}, {55, 5}, {58, 30}, 98, 133} }; *************** *** 60,69 **** const char NAVIGATE_DIR_IMG[][40] = { ! "nav_turn_left.bmp", ! "nav_turn_right.bmp", ! "nav_keep_left.bmp", ! "nav_keep_right.bmp", ! "nav_continue.bmp", ! "nav_approaching.bmp" }; --- 60,69 ---- const char NAVIGATE_DIR_IMG[][40] = { ! "nav_turn_left", ! "nav_turn_right", ! "nav_keep_left", ! "nav_keep_right", ! "nav_continue", ! "nav_approaching" }; *************** *** 78,115 **** static int NavigateBarEnabled = 0; - static RoadMapImage navigate_bar_load_image (const char *name) { - - RoadMapImage image = NULL; - const char *cursor; - char *file = roadmap_path_join ("icons", name); - - for (cursor = roadmap_path_first ("config"); - cursor != NULL; - cursor = roadmap_path_next ("config", cursor)) { - - if (roadmap_file_exists (cursor, file)) { - image = roadmap_canvas_load_image (cursor, file); - break; - } - } - - if (!image) { - for (cursor = roadmap_path_first ("user"); - cursor != NULL; - cursor = roadmap_path_next ("user", cursor)) { - - if (roadmap_file_exists (cursor, file)) { - image = roadmap_canvas_load_image (cursor, file); - break; - } - } - } - - free (file); - - return image; - } - - static int navigate_bar_align_text (char *text, char **line1, char **line2, int size) { --- 78,81 ---- *************** *** 218,227 **** } ! NavigateBarBG = navigate_bar_load_image (NavigatePanel->image_file); ! NavigateBarImage = navigate_bar_load_image (NavigatePanel->image_file); if (!NavigateBarBG || !NavigateBarImage) goto error; for (i=0; i<LAST_DIRECTION; i++) { ! NavigateDirections[i] = navigate_bar_load_image (NAVIGATE_DIR_IMG[i]); if (!NavigateDirections[i]) goto error; } --- 184,202 ---- } ! NavigateBarBG = ! (RoadMapImage) roadmap_res_get ! (RES_BITMAP, RES_SKIN|RES_NOCACHE, NavigatePanel->image_file); ! ! NavigateBarImage = ! (RoadMapImage) roadmap_res_get ! (RES_BITMAP, RES_SKIN, NavigatePanel->image_file); ! if (!NavigateBarBG || !NavigateBarImage) goto error; for (i=0; i<LAST_DIRECTION; i++) { ! NavigateDirections[i] = ! (RoadMapImage) roadmap_res_get ! (RES_BITMAP, RES_SKIN, NAVIGATE_DIR_IMG[i]); ! if (!NavigateDirections[i]) goto error; } |
From: Ehud S. <esh...@us...> - 2006-11-21 09:30:27
|
Update of /cvsroot/roadmap/roadmap_editor/src/navigate In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8553 Modified Files: navigate_main.c navigate_main.h navigate_plugin.c Log Message: Show traffic congestions. Index: navigate_plugin.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/navigate/navigate_plugin.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** navigate_plugin.c 15 May 2006 19:52:15 -0000 1.2 --- navigate_plugin.c 21 Nov 2006 09:30:24 -0000 1.3 *************** *** 47,51 **** NULL, NULL, ! NULL, NULL, NULL, --- 47,51 ---- NULL, NULL, ! &navigate_main_adjust_layer, NULL, NULL, Index: navigate_main.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/navigate/navigate_main.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** navigate_main.h 18 Aug 2006 17:52:50 -0000 1.7 --- navigate_main.h 21 Nov 2006 09:30:23 -0000 1.8 *************** *** 71,74 **** --- 71,75 ---- RoadMapPen *override_pen); + void navigate_main_adjust_layer (int layer, int thickness, int pen_count); #endif /* INCLUDE__NAVIGATE_MAIN__H */ Index: navigate_main.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/navigate/navigate_main.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** navigate_main.c 4 Sep 2006 06:51:42 -0000 1.15 --- navigate_main.c 21 Nov 2006 09:30:23 -0000 1.16 *************** *** 54,57 **** --- 54,58 ---- #include "roadmap_address.h" #include "roadmap_sound.h" + #include "roadmap_locator.h" #include "roadmap_main.h" *************** *** 66,69 **** --- 67,73 ---- #define ROUTE_PEN_WIDTH 4 + #define MAX_LAYERS (ROADMAP_ROAD_LAST + 1) + #define MAX_PEN_LAYERS 2 + #define MAX_ROAD_COLORS 2 int NavigateEnabled = 0; *************** *** 73,76 **** --- 77,81 ---- static RoadMapPen NavigatePen; static RoadMapPen NavigatePenEst; + static RoadMapPen TrafficPens[MAX_LAYERS][MAX_PEN_LAYERS]; static void navigate_update (RoadMapPosition *position, PluginLine *current); *************** *** 104,107 **** --- 109,170 ---- + static void create_pens (void) { + + int i; + int j; + char name[80]; + + /* FIXME should only create pens for road class */ + + for (i=1; i<MAX_LAYERS; ++i) + for (j=0; j<MAX_PEN_LAYERS; j++) { + + RoadMapPen *pen = &TrafficPens[i][j]; + + snprintf (name, sizeof(name), "TrafficPen%d", i*100+j*10); + *pen = roadmap_canvas_create_pen (name); + + if (!j) { + roadmap_canvas_set_foreground ("#000000"); + } else { + roadmap_canvas_set_foreground ("dark red"); + } + roadmap_canvas_set_thickness (1); + } + } + + + /* TODO: this is a bad callback which is called from roadmap_layer_adjust(). + * This should be changed. Currently when the editor is enabled, an explicit + * call to roadmap_layer_adjust() is called. When this is fixed, that call + * should be removed. + */ + void navigate_main_adjust_layer (int layer, int thickness, int pen_count) { + + int i; + + if (layer > ROADMAP_ROAD_LAST) return; + + if (thickness < 1) thickness = 1; + if ((pen_count > 1) && (thickness < 3)) { + pen_count = 1; + } + + for (i=0; i<MAX_PEN_LAYERS; i++) { + + RoadMapPen *pen = &TrafficPens[layer][i]; + + roadmap_canvas_select_pen (*pen); + + if (i == 1) { + roadmap_canvas_set_thickness (thickness - 2); + } else { + roadmap_canvas_set_thickness (thickness); + } + + } + } + + static int navigate_find_track_points (PluginLine *from_line, int *from_point, PluginLine *to_line, int *to_point) { *************** *** 654,658 **** --- 717,726 ---- roadmap_canvas_set_thickness (ROUTE_PEN_WIDTH); + create_pens (); + navigate_bar_initialize (); + + NavigatePluginID = navigate_plugin_register (); + navigate_main_set (1); *************** *** 661,666 **** roadmap_address_register_nav (navigate_address_cb); - - NavigatePluginID = navigate_plugin_register (); } --- 729,732 ---- *************** *** 675,678 **** --- 741,748 ---- NavigateEnabled = status; + + if (NavigateEnabled) { + roadmap_layer_adjust (); + } } *************** *** 858,861 **** --- 928,968 ---- RoadMapPen *override_pen) { + if (pen_type > 1) return 0; + + if (cfcc > 3) return 0; + + return 0; + + if (roadmap_locator_activate (fips) >= 0) { + int avg1; + int avg2; + int speed1; + int speed2; + + speed1 = roadmap_line_route_get_speed (line, 0); + + if (speed1) { + avg1 = roadmap_line_route_get_avg_speed (line, 0); + if (avg1 < 20) return 0; + + if (speed1 < (avg1 / 2)) { + *override_pen = TrafficPens[cfcc][pen_type]; + return 1; + } + } + + speed2 = roadmap_line_route_get_speed (line, 1); + + if (speed2) { + avg2 = roadmap_line_route_get_avg_speed (line, 1); + if (avg2 < 20) return 0; + + if (speed2 < (avg2 / 2)) { + *override_pen = TrafficPens[cfcc][pen_type]; + return 1; + } + } + } + return 0; |
From: Ehud S. <esh...@us...> - 2006-11-21 09:29:24
|
Update of /cvsroot/roadmap/roadmap_editor/src/gtk2 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8177 Modified Files: Makefile roadmap_canvas_agg.cpp Added Files: roadmap_libpng.c roadmap_libpng.h Log Message: Add support for loading PNG files. --- NEW FILE: roadmap_libpng.c --- /* * Guillaume Cottenceau (gc at mandrakesoft.com) * * Copyright 2002 MandrakeSoft * * This software may be freely redistributed under the terms of the GNU * public license. * */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdarg.h> #include <png.h> #include "roadmap.h" #include "roadmap_libpng.h" unsigned char *read_png_file(const char* file_name, int *width, int *height, int *stride) { png_byte color_type; png_byte bit_depth; png_structp png_ptr; png_infop info_ptr; int number_of_passes; png_bytep* row_pointers; int y; char header[8]; // 8 is the maximum size that can be checked unsigned char *buf; FILE *fp; /* open file and test for it being a png */ fp = fopen(file_name, "rb"); if (!fp) return NULL; fread(header, 1, 8, fp); if (png_sig_cmp(header, 0, 8)) { roadmap_log (ROADMAP_ERROR, "[read_png_file] File %s is not recognized as a PNG file", file_name); fclose(fp); return NULL; } /* initialize stuff */ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { roadmap_log (ROADMAP_ERROR, "[read_png_file] png_create_read_struct failed"); fclose(fp); return NULL; } info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { roadmap_log (ROADMAP_ERROR, "[read_png_file] png_create_info_struct failed"); fclose(fp); return NULL; } if (setjmp(png_jmpbuf(png_ptr))) { roadmap_log (ROADMAP_ERROR, "[read_png_file] Error during init_io"); fclose(fp); return NULL; } png_init_io(png_ptr, fp); png_set_sig_bytes(png_ptr, 8); png_read_info(png_ptr, info_ptr); *width = info_ptr->width; *height = info_ptr->height; *stride = info_ptr->rowbytes; color_type = info_ptr->color_type; bit_depth = info_ptr->bit_depth; number_of_passes = png_set_interlace_handling(png_ptr); png_read_update_info(png_ptr, info_ptr); /* read file */ if (setjmp(png_jmpbuf(png_ptr))) { roadmap_log (ROADMAP_ERROR, "[read_png_file] Error during read_image"); fclose(fp); return NULL; } row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * *height); buf = malloc (*height * info_ptr->rowbytes); for (y=0; y<*height; y++) { row_pointers[y] = (png_byte*) (buf + y * info_ptr->rowbytes); } png_read_image(png_ptr, row_pointers); fclose(fp); return buf; } Index: Makefile =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/gtk2/Makefile,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Makefile 17 Nov 2006 16:50:32 -0000 1.11 --- Makefile 21 Nov 2006 09:29:21 -0000 1.12 *************** *** 75,79 **** # roadmap_messagebox.c \ ! RMLIBOBJS=$(RMLIBSRCS:.c=.o) roadmap_canvas_agg.o ../agg/roadmap_canvas.o ../agg/font_freetype/agg_font_freetype.o ../roadmap_libpng.o --- 75,79 ---- # roadmap_messagebox.c \ ! RMLIBOBJS=$(RMLIBSRCS:.c=.o) roadmap_canvas_agg.o ../agg/roadmap_canvas.o ../agg/font_freetype/agg_font_freetype.o roadmap_libpng.o Index: roadmap_canvas_agg.cpp =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/gtk2/roadmap_canvas_agg.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** roadmap_canvas_agg.cpp 9 Aug 2006 07:31:32 -0000 1.6 --- roadmap_canvas_agg.cpp 21 Nov 2006 09:29:21 -0000 1.7 *************** *** 1,7 **** ! /* roadmap_canvas.c - manage the canvas that is used to draw the map. * * LICENSE: * * Copyright 2002 Pascal F. Martin * * This file is part of RoadMap. --- 1,8 ---- ! /* roadmap_canvas_agg.c - manage the canvas for agg. * * LICENSE: * * Copyright 2002 Pascal F. Martin + * Copyright 2006 Ehud Shabtai * * This file is part of RoadMap. *************** *** 65,68 **** --- 66,70 ---- } + #include "roadmap_libpng.h" #include "roadmap_canvas_agg.h" *************** *** 109,119 **** ! RoadMapImage roadmap_canvas_agg_load_image (const char *path, ! const char *file_name) { ! ! char *full_name = roadmap_path_join (path, file_name); GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(full_name, NULL); - free (full_name); if (pixbuf == NULL) { --- 111,117 ---- ! static RoadMapImage load_bmp (const char *full_name) { GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(full_name, NULL); if (pixbuf == NULL) { *************** *** 152,155 **** --- 150,190 ---- + static RoadMapImage load_png (const char *full_name) { + + int width; + int height; + int stride; + + unsigned char *buf = read_png_file(full_name, &width, &height, &stride); + + if (!buf) return NULL; + + RoadMapImage image = new roadmap_canvas_image(); + image->rbuf.attach (buf, width, height, stride); + + return image; + } + + + RoadMapImage roadmap_canvas_agg_load_image (const char *path, + const char *file_name) { + + char *full_name = roadmap_path_join (path, file_name); + RoadMapImage image; + + if ((strlen(file_name) > 4) && + !strcasecmp (file_name + strlen(file_name) - 4, ".png")) { + + image = load_png (full_name); + } else { + image = load_bmp (full_name); + } + + free (full_name); + + return image; + } + + void roadmap_canvas_agg_free_image (RoadMapImage image) { --- NEW FILE: roadmap_libpng.h --- /* * Guillaume Cottenceau (gc at mandrakesoft.com) * * Copyright 2002 MandrakeSoft * * This software may be freely redistributed under the terms of the GNU * public license. * */ #ifndef __ROADMAP_LIBPNG_H_ #define __ROADMAP_LIBPNG_H_ #ifdef __cplusplus extern "C" #endif unsigned char *read_png_file(const char* file_name, int *width, int *height, int *stride); #endif |
From: Ehud S. <esh...@us...> - 2006-11-21 09:28:16
|
Update of /cvsroot/roadmap/roadmap_editor/src/editor/static In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7718 Modified Files: editor_dialog.c update_range.c Log Message: SSD support. Index: editor_dialog.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/editor/static/editor_dialog.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** editor_dialog.c 3 Sep 2006 18:10:41 -0000 1.10 --- editor_dialog.c 21 Nov 2006 09:28:10 -0000 1.11 *************** *** 33,37 **** --- 33,47 ---- #include "roadmap.h" + #ifdef SSD + #include "ssd/ssd_dialog.h" + #include "ssd/ssd_text.h" + #include "ssd/ssd_choice.h" + #include "ssd/ssd_container.h" + #include "ssd/ssd_entry.h" + #include "ssd/ssd_button.h" + #else #include "roadmap_dialog.h" + #endif + #include "roadmap_lang.h" #include "roadmap_layer.h" #include "roadmap_line.h" *************** *** 63,207 **** static const char *def_values[2] = {"", ""}; ! /* NOTE: This function modifies the street_range parameter */ ! #if 0 ! static void decode_range (char *street_range, ! int *from1, ! int *to1, ! int *from2, ! int *to2) { ! ! int i = 0; ! int max = strlen(street_range); ! char *ranges[4]; ! int num_ranges=0; ! ! while (i <= max) { ! ! while (!isdigit (street_range[i]) && (i <= max)) i++; ! if (i>max) break; ! ! ranges[num_ranges++] = street_range+i; ! if (num_ranges == (sizeof(ranges) / sizeof(ranges[0]) - 1)) break; ! ! while (isdigit (street_range[i]) && (i <= max)) i++; ! ! street_range[i] = '\0'; ! i++; ! } ! ! if (num_ranges == 4) { ! *from1 = atoi (ranges[0]); ! *to1 = atoi (ranges[1]); ! ! if (from2 && to2) { ! *from2 = atoi (ranges[2]); ! *to2 = atoi (ranges[3]); ! } ! } else if (num_ranges > 1) { ! *from1 = atoi (ranges[0]); ! *to1 = atoi (ranges[1]); ! if (((*from1 & 1) && !(*to1 & 1)) || ! (!(*from1 & 1) && (*to1 & 1))) { ! (*to1)--; ! } ! if (from2 && to2) { ! *from2 = (*from1) + 1; ! *to2 = (*to1) + 1; ! } ! } } - #endif ! static const char *editor_segments_find_city ! (int line, int plugin_id, int fips) { ! ! int i; ! int count; ! int layers_count; ! int layers[128]; ! RoadMapPosition point; ! RoadMapNeighbour neighbours[50]; ! ! roadmap_locator_activate (fips); ! editor_db_activate (fips); ! ! if (plugin_id == EditorPluginID) { ! editor_line_get (line, &point, NULL, NULL, NULL, NULL); ! } else { ! roadmap_line_from (line, &point); ! } ! ! layers_count = roadmap_layer_all_roads (layers, 128); ! ! count = roadmap_street_get_closest ! (&point, ! layers, ! layers_count, ! neighbours, ! sizeof(neighbours) / sizeof(RoadMapNeighbour)); ! ! count = roadmap_plugin_get_closest ! (&point, layers, layers_count, neighbours, count, ! sizeof(neighbours) / sizeof(RoadMapNeighbour)); ! ! for (i = 0; i < count; ++i) { ! ! const char *city; ! ! if (roadmap_plugin_get_id (&neighbours[i].line) == EditorPluginID) { ! EditorStreetProperties properties; ! ! editor_street_get_properties ! (roadmap_plugin_get_line_id (&neighbours[i].line), ! &properties); ! ! city = ! editor_street_get_street_city ! (&properties, ED_STREET_LEFT_SIDE); ! ! } else if (roadmap_plugin_get_id (&neighbours[i].line) == ! ROADMAP_PLUGIN_ID) { ! RoadMapStreetProperties properties; ! ! roadmap_street_get_properties ! (roadmap_plugin_get_line_id (&neighbours[i].line), ! &properties); ! city = ! roadmap_street_get_street_city ! (&properties, ROADMAP_STREET_LEFT_SIDE); ! } else { ! city = ""; ! } ! if (strlen(city)) { ! return city; ! } } ! return ""; ! } ! ! ! static void editor_dialog_city_result (const char *result, void *data) { ! ! roadmap_dialog_activate ("Segment Properties", data); ! ! if ((result == NULL) || !strlen (result)) return; ! ! roadmap_dialog_set_data ("General", "City", result); } static void editor_dialog_city_cb (const char *name, void *context) { - if (!strcmp(roadmap_dialog_get_data ("General", "City"), def_values[1])) { roadmap_dialog_set_data ("General", "City", def_values[0]); roadmap_address_search_dialog --- 73,116 ---- static const char *def_values[2] = {"", ""}; ! static void editor_dialog_city_result (const char *result, void *data) { ! #ifdef SSD ! ssd_dialog_activate ("Segment Properties", data); ! #else ! roadmap_dialog_activate ("Segment Properties", data); ! #endif ! if ((result == NULL) || !strlen (result)) return; ! #ifdef SSD ! ssd_dialog_set_value ("City", result); ! #else ! roadmap_dialog_set_data ("General", "City", result); ! #endif } ! #ifdef SSD ! static int editor_dialog_city_cb (SsdWidget widget, const char *new_value) { ! if (!strcmp(new_value, def_values[1])) { ! ssd_dialog_set_value ("City", def_values[0]); ! roadmap_address_search_dialog ! (NULL, editor_dialog_city_result, widget->context); ! return 0; } ! return 1; } + #else static void editor_dialog_city_cb (const char *name, void *context) { if (!strcmp(roadmap_dialog_get_data ("General", "City"), def_values[1])) { roadmap_dialog_set_data ("General", "City", def_values[0]); + roadmap_dialog_hide ("Segment Properties"); roadmap_address_search_dialog *************** *** 210,214 **** --- 119,126 ---- } + #endif + + #ifndef SSD static void editor_segments_cancel (const char *name, void *context) { *************** *** 216,223 **** roadmap_dialog_hide (name); } static void editor_segments_apply (const char *name, void *context) { - DialogSelectedLines *selected_lines = (DialogSelectedLines *)context; int i; --- 128,142 ---- roadmap_dialog_hide (name); } + #endif + #ifdef SSD + static int editor_segments_apply (SsdWidget widget, const char *new_value) { + DialogSelectedLines *selected_lines = + (DialogSelectedLines *) ssd_dialog_context (); + #else static void editor_segments_apply (const char *name, void *context) { DialogSelectedLines *selected_lines = (DialogSelectedLines *)context; + #endif + int i; *************** *** 225,228 **** --- 144,163 ---- LineRouteFlag route_from_flags; LineRouteFlag route_to_flags; + #ifdef SSD + int type = (int) ssd_dialog_get_data ("Road type"); + int cfcc = type + ROADMAP_ROAD_FIRST; + int direction = 0; + + char *street_type = (char *) ssd_dialog_get_value ("Street type"); + + char *street_name = (char *) ssd_dialog_get_value ("Name"); + + char *t2s = (char *) ssd_dialog_get_value ("Text to Speech"); + + char *city = (char *) ssd_dialog_get_value ("City"); + char *zip = ""; + + char *speed_limit_str = ""; + #else int type = (int) roadmap_dialog_get_data ("General", "Road type"); int cfcc = type + ROADMAP_ROAD_FIRST; *************** *** 246,250 **** char *speed_limit_str = (char *) roadmap_dialog_get_data ("General", "Speed Limit"); ! int street_id; int street_range_id; --- 181,187 ---- char *speed_limit_str = (char *) roadmap_dialog_get_data ("General", "Speed Limit"); ! #endif ! ! int street_id; int street_range_id; *************** *** 282,286 **** (ROADMAP_ERROR, "Can't set line attributes - copy line failed."); ! return; } --- 219,223 ---- (ROADMAP_ERROR, "Can't set line attributes - copy line failed."); ! continue; } *************** *** 368,373 **** --- 305,618 ---- editor_screen_reset_selected (); + #ifdef SSD + ssd_dialog_hide_current (); + return 1; + #else free (context); roadmap_dialog_hide (name); + #endif + } + + + #ifdef SSD + static void activate_dialog (const char *name, + DialogSelectedLines *selected_lines) { + + if (!ssd_dialog_activate (name, selected_lines)) { + + int *values; + int count = ROADMAP_ROAD_LAST - ROADMAP_ROAD_FIRST + 1; + int i; + char **categories; + static const char *lang_categories[ROADMAP_ROAD_LAST - ROADMAP_ROAD_FIRST + 1]; + SsdWidget dialog; + SsdWidget group; + + if (!def_values[1][0]) { + def_values[1] = roadmap_lang_get ("Search"); + } + + dialog = ssd_dialog_new (name, roadmap_lang_get (name), + SSD_CONTAINER_BORDER|SSD_CONTAINER_TITLE); + + group = ssd_container_new ("Length group", NULL, + SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_WIDGET_SPACE|SSD_END_ROW); + ssd_widget_set_color (group, NULL, NULL); + ssd_widget_add (group, + ssd_text_new ("Label", roadmap_lang_get("Length"), -1, + SSD_TEXT_LABEL)); + ssd_widget_add (group, ssd_text_new ("Length", "", -1, 0)); + ssd_widget_add (dialog, group); + + group = ssd_container_new ("Time group", NULL, + SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_WIDGET_SPACE|SSD_END_ROW); + ssd_widget_set_color (group, NULL, NULL); + ssd_widget_add (group, + ssd_text_new ("Label", roadmap_lang_get("Time"), -1, + SSD_TEXT_LABEL)); + ssd_widget_add (group, ssd_text_new ("Time", "", -1, SSD_END_ROW)); + ssd_widget_add (dialog, group); + + roadmap_layer_get_categories_names (&categories, &i); + values = malloc ((count+1) * sizeof (int)); + + for (i=0; i<count; i++) { + values[i] = i; + lang_categories[i] = roadmap_lang_get (categories[i]); + } + + group = ssd_container_new ("Road type group", NULL, + SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_WIDGET_SPACE|SSD_END_ROW); + + ssd_widget_add (group, + ssd_text_new ("Label", roadmap_lang_get("Road type"), -1, + SSD_TEXT_LABEL|SSD_ALIGN_VCENTER)); + + ssd_widget_add (group, + ssd_choice_new ("Road type", count, + (const char **)lang_categories, + (const void**)values, + SSD_END_ROW|SSD_ALIGN_VCENTER, NULL)); + ssd_widget_add (dialog, group); + + group = ssd_container_new ("Name group", NULL, + SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_WIDGET_SPACE|SSD_END_ROW); + ssd_widget_add (group, + ssd_text_new ("Label", roadmap_lang_get("Name"), -1, + SSD_TEXT_LABEL|SSD_ALIGN_VCENTER)); + + ssd_widget_add (group, + ssd_entry_new ("Name", "", SSD_ALIGN_VCENTER)); + ssd_widget_add (dialog, group); + + group = ssd_container_new ("Text to Speech group", NULL, + SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_WIDGET_SPACE|SSD_END_ROW); + ssd_widget_add (group, + ssd_text_new ("Label", roadmap_lang_get("Text to Speech"), -1, + SSD_TEXT_LABEL|SSD_ALIGN_VCENTER)); + + ssd_widget_add (group, + ssd_entry_new ("Text to Speech", "", SSD_ALIGN_VCENTER)); + ssd_widget_add (dialog, group); + + group = ssd_container_new ("City group", NULL, + SSD_MIN_SIZE, SSD_MIN_SIZE, SSD_WIDGET_SPACE|SSD_END_ROW); + + ssd_widget_add (group, + ssd_text_new ("Label", roadmap_lang_get("City"), -1, + SSD_TEXT_LABEL|SSD_ALIGN_VCENTER)); + + ssd_widget_add (group, + ssd_choice_new ("City", + sizeof(def_values) / sizeof(char **), + def_values, + (const void **)def_values, + SSD_END_ROW|SSD_ALIGN_VCENTER, + editor_dialog_city_cb)); + + ssd_widget_add (dialog, group); + + ssd_widget_add (dialog, + ssd_button_label ("confirm", roadmap_lang_get ("Ok"), + SSD_ALIGN_CENTER|SSD_START_NEW_ROW, + editor_segments_apply)); + + ssd_dialog_activate (name, selected_lines); + } + } + + #else + + static void activate_dialog (const char *name, + DialogSelectedLines *selected_lines) { + + if (roadmap_dialog_activate ("Segment Properties", selected_lines)) { + + int *values; + int count = ROADMAP_ROAD_LAST - ROADMAP_ROAD_FIRST + 1; + int i; + char **categories; + static const char *lang_categories[ROADMAP_ROAD_LAST - ROADMAP_ROAD_FIRST + 1]; + + if (!def_values[1][0]) { + def_values[1] = roadmap_lang_get ("Search"); + } + + /* + char *direction_txts[] = + { "Unknown", "With road", "Against road", "Both directions"}; + int direction_values[] = {0, 1, 2, 3}; + */ + + roadmap_dialog_new_label ("Info", "Length"); + roadmap_dialog_new_label ("Info", "Time"); + + #if 0 + roadmap_dialog_new_entry ("Right", "Street range", NULL); + roadmap_dialog_new_entry ("Right", "City", NULL); + roadmap_dialog_new_entry ("Right", "Zip code", NULL); + + roadmap_dialog_new_entry ("Left", "Street range", NULL); + roadmap_dialog_new_entry ("Left", "City", NULL); + roadmap_dialog_new_entry ("Left", "Zip code", NULL); + #endif + roadmap_layer_get_categories_names (&categories, &i); + values = malloc ((count+1) * sizeof (int)); + + for (i=0; i<count; i++) { + values[i] = i; + lang_categories[i] = roadmap_lang_get (categories[i]); + } + + roadmap_dialog_new_choice ("General", "Road type", count, + (const char **)lang_categories, + (void**)values, NULL); + free (values); + + /* roadmap_dialog_new_entry ("General", "Street type", NULL); */ + roadmap_dialog_new_entry ("General", "Name", NULL); + roadmap_dialog_new_entry ("General", "Text to Speech", NULL); + /* roadmap_dialog_new_entry ("General", "Street range", NULL); */ + roadmap_dialog_new_choice ("General", "City", + sizeof(def_values) / sizeof(char **), + def_values, (void **)def_values, editor_dialog_city_cb); + + /* roadmap_dialog_new_choice ("General", "Direction", 4, direction_txts, + (void**)direction_values, NULL); + roadmap_dialog_new_entry ("General", "Zip code", NULL); + roadmap_dialog_new_entry ("General", "Speed Limit", NULL); */ + + roadmap_dialog_add_button ("Cancel", editor_segments_cancel); + roadmap_dialog_add_button ("Ok", editor_segments_apply); + + roadmap_dialog_complete (roadmap_preferences_use_keyboard ()); + } + } + #endif + + + /* NOTE: This function modifies the street_range parameter */ + #if 0 + static void decode_range (char *street_range, + int *from1, + int *to1, + int *from2, + int *to2) { + + int i = 0; + int max = strlen(street_range); + char *ranges[4]; + int num_ranges=0; + + while (i <= max) { + + while (!isdigit (street_range[i]) && (i <= max)) i++; + if (i>max) break; + + ranges[num_ranges++] = street_range+i; + if (num_ranges == (sizeof(ranges) / sizeof(ranges[0]) - 1)) break; + + while (isdigit (street_range[i]) && (i <= max)) i++; + + street_range[i] = '\0'; + i++; + } + + if (num_ranges == 4) { + *from1 = atoi (ranges[0]); + *to1 = atoi (ranges[1]); + + if (from2 && to2) { + *from2 = atoi (ranges[2]); + *to2 = atoi (ranges[3]); + } + + } else if (num_ranges > 1) { + *from1 = atoi (ranges[0]); + *to1 = atoi (ranges[1]); + + if (((*from1 & 1) && !(*to1 & 1)) || + (!(*from1 & 1) && (*to1 & 1))) { + (*to1)--; + } + + if (from2 && to2) { + *from2 = (*from1) + 1; + *to2 = (*to1) + 1; + } + } + } + #endif + + + static const char *editor_segments_find_city + (int line, int plugin_id, int fips) { + + int i; + int count; + int layers_count; + int layers[128]; + RoadMapPosition point; + RoadMapNeighbour neighbours[50]; + + roadmap_locator_activate (fips); + editor_db_activate (fips); + + if (plugin_id == EditorPluginID) { + editor_line_get (line, &point, NULL, NULL, NULL, NULL); + } else { + roadmap_line_from (line, &point); + } + + layers_count = roadmap_layer_all_roads (layers, 128); + + count = roadmap_street_get_closest + (&point, + layers, + layers_count, + neighbours, + sizeof(neighbours) / sizeof(RoadMapNeighbour)); + + count = roadmap_plugin_get_closest + (&point, layers, layers_count, neighbours, count, + sizeof(neighbours) / sizeof(RoadMapNeighbour)); + + for (i = 0; i < count; ++i) { + + const char *city; + + if (roadmap_plugin_get_id (&neighbours[i].line) == EditorPluginID) { + EditorStreetProperties properties; + + editor_street_get_properties + (roadmap_plugin_get_line_id (&neighbours[i].line), + &properties); + + city = + editor_street_get_street_city + (&properties, ED_STREET_LEFT_SIDE); + + } else if (roadmap_plugin_get_id (&neighbours[i].line) == + ROADMAP_PLUGIN_ID) { + RoadMapStreetProperties properties; + + roadmap_street_get_properties + (roadmap_plugin_get_line_id (&neighbours[i].line), + &properties); + + city = + roadmap_street_get_street_city + (&properties, ROADMAP_STREET_LEFT_SIDE); + + } else { + city = ""; + } + + if (strlen(city)) { + return city; + } + } + + return ""; } *************** *** 397,401 **** int same_r_zip = 1; ! char range_str[100]; int i; --- 642,646 ---- int same_r_zip = 1; ! //char range_str[100]; int i; *************** *** 613,616 **** --- 858,873 ---- } + #ifdef SSD + ssd_dialog_set_data ("Road type", (void *) (cfcc - ROADMAP_ROAD_FIRST)); + ssd_dialog_set_value ("Name", street_name); + ssd_dialog_set_value ("Text to Speech", t2s); + + if (strlen(l_city)) { + ssd_dialog_set_value ("City", l_city); + } else { + ssd_dialog_set_value ("City", r_city); + } + + #else roadmap_dialog_set_data ("General", "Road type", (void *) (cfcc - ROADMAP_ROAD_FIRST)); *************** *** 619,622 **** --- 876,889 ---- roadmap_dialog_set_data ("General", "Text to Speech", t2s); + if (strlen(l_city)) { + roadmap_dialog_set_data ("General", "City", l_city); + } else { + roadmap_dialog_set_data ("General", "City", r_city); + } + + #endif + + + #if 0 if ((l_from != -1) && (l_to != -1) && *************** *** 632,641 **** roadmap_dialog_set_data ("General", "Street range", range_str); - if (strlen(l_city)) { - roadmap_dialog_set_data ("General", "City", l_city); - } else { - roadmap_dialog_set_data ("General", "City", r_city); - } - roadmap_dialog_set_data ("General", "Direction", (void *)direction); --- 899,902 ---- *************** *** 667,671 **** roadmap_dialog_set_data ("Right", "City", r_city); roadmap_dialog_set_data ("Right", "Zip code", r_zip); ! } --- 928,932 ---- roadmap_dialog_set_data ("Right", "City", r_city); roadmap_dialog_set_data ("Right", "Zip code", r_zip); ! #endif } *************** *** 682,747 **** selected_lines->count = lines_count; ! if (roadmap_dialog_activate ("Segment Properties", selected_lines)) { ! ! int *values; ! int count = ROADMAP_ROAD_LAST - ROADMAP_ROAD_FIRST + 1; ! int i; ! char **categories; ! static const char *lang_categories[ROADMAP_ROAD_LAST - ROADMAP_ROAD_FIRST + 1]; ! ! if (!def_values[1][0]) { ! def_values[1] = roadmap_lang_get ("Search"); ! } ! ! /* ! char *direction_txts[] = ! { "Unknown", "With road", "Against road", "Both directions"}; ! int direction_values[] = {0, 1, 2, 3}; ! */ ! ! roadmap_dialog_new_label ("Info", "Length"); ! roadmap_dialog_new_label ("Info", "Time"); ! ! #if 0 ! roadmap_dialog_new_entry ("Right", "Street range", NULL); ! roadmap_dialog_new_entry ("Right", "City", NULL); ! roadmap_dialog_new_entry ("Right", "Zip code", NULL); ! ! roadmap_dialog_new_entry ("Left", "Street range", NULL); ! roadmap_dialog_new_entry ("Left", "City", NULL); ! roadmap_dialog_new_entry ("Left", "Zip code", NULL); ! #endif ! roadmap_layer_get_categories_names (&categories, &i); ! values = malloc ((count+1) * sizeof (int)); ! ! for (i=0; i<count; i++) { ! values[i] = i; ! lang_categories[i] = roadmap_lang_get (categories[i]); ! } ! ! roadmap_dialog_new_choice ("General", "Road type", count, ! (const char **)lang_categories, ! (void**)values, NULL); ! free (values); ! ! /* roadmap_dialog_new_entry ("General", "Street type", NULL); */ ! roadmap_dialog_new_entry ("General", "Name", NULL); ! roadmap_dialog_new_entry ("General", "Text to Speech", NULL); ! /* roadmap_dialog_new_entry ("General", "Street range", NULL); */ ! roadmap_dialog_new_choice ("General", "City", ! sizeof(def_values) / sizeof(char **), ! def_values, (void **)def_values, editor_dialog_city_cb); ! ! /* roadmap_dialog_new_choice ("General", "Direction", 4, direction_txts, ! (void**)direction_values, NULL); ! roadmap_dialog_new_entry ("General", "Zip code", NULL); ! roadmap_dialog_new_entry ("General", "Speed Limit", NULL); */ ! ! roadmap_dialog_add_button ("Cancel", editor_segments_cancel); ! roadmap_dialog_add_button ("Ok", editor_segments_apply); ! ! roadmap_dialog_complete (roadmap_preferences_use_keyboard ()); ! } ! editor_segments_fill_dialog (lines, lines_count); --- 943,947 ---- selected_lines->count = lines_count; ! activate_dialog("Segment Properties", selected_lines); editor_segments_fill_dialog (lines, lines_count); *************** *** 788,796 **** --- 988,1005 ---- snprintf (str, sizeof(str), "%d %s", total_length, roadmap_lang_get("meters")); + #ifdef SSD + ssd_dialog_set_value ("Length", str); + #else roadmap_dialog_set_data ("Info", "Length", str); + #endif snprintf (str, sizeof(str), "%d %s", total_time, roadmap_lang_get("seconds")); + + #ifdef SSD + ssd_dialog_set_value ("Time", str); + #else roadmap_dialog_set_data ("Info", "Time", str); + #endif } Index: update_range.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/editor/static/update_range.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** update_range.c 18 Aug 2006 17:47:12 -0000 1.3 --- update_range.c 21 Nov 2006 09:28:10 -0000 1.4 *************** *** 50,53 **** --- 50,61 ---- #include "../editor_log.h" + #ifdef SSD + #include "ssd/ssd_dialog.h" + #include "ssd/ssd_container.h" + #include "ssd/ssd_button.h" + #include "ssd/ssd_keyboard.h" + #include "ssd/ssd_text.h" + #endif + #include "update_range.h" *************** *** 110,113 **** --- 118,122 ---- + static int update_range_export(int marker, const char **description, *************** *** 223,226 **** --- 232,451 ---- + static void update_range (const char *updated_left, const char *updated_right, + const char *city, const char *street) { + + char note[100]; + int fips; + + if (!*updated_left && !*updated_right) { + return; + } + + if (roadmap_county_by_position (&CurrentFixedPosition, &fips, 1) < 1) { + roadmap_messagebox ("Error", "Can't locate county"); + return; + } + + if (editor_db_activate (fips) == -1) { + + editor_db_create (fips); + + if (editor_db_activate (fips) == -1) { + + roadmap_messagebox ("Error", "Can't update range"); + return; + } + } + + snprintf(note, sizeof(note), "%s: %s%s", + roadmap_lang_get (STREET_PREFIX), (char *)street, + NEW_LINE); + + snprintf(note + strlen(note), sizeof(note) - strlen(note), + "%s: %s%s", roadmap_lang_get (CITY_PREFIX), (char *)city, + NEW_LINE); + + if (*updated_left) { + + snprintf(note + strlen(note), sizeof(note) - strlen(note), + "%s: %s%s", roadmap_lang_get (UPDATE_LEFT), updated_left, + NEW_LINE); + } + + if (*updated_right) { + + snprintf(note + strlen(note), sizeof(note) - strlen(note), + "%s: %s%s", roadmap_lang_get (UPDATE_RIGHT), updated_right, + NEW_LINE); + } + + if (editor_marker_add (CurrentFixedPosition.longitude, + CurrentFixedPosition.latitude, + CurrentGpsPoint.steering, + time(NULL), + UpdateRangeMarkerType, + ED_MARKER_UPLOAD, note) == -1) { + + roadmap_messagebox ("Error", "Can't save marker."); + } + + } + + #ifdef SSD + static int keyboard_callback (int type, const char *new_value, void *context) { + SsdWidget button = (SsdWidget)context; + + if (type != SSD_KEYBOARD_OK) return 1; + + if (!strcmp(button->name, "left_button")) { + ssd_widget_set_value (button->parent, UPDATE_LEFT, new_value); + } else { + ssd_widget_set_value (button->parent, UPDATE_RIGHT, new_value); + } + + ssd_keyboard_hide (SSD_KEYBOARD_DIGITS); + return 1; + } + + static int button_callback (SsdWidget widget, const char *new_value) { + + const char *title; + const char *value; + + if (!strcmp(widget->name, "OK")) { + update_range ( + ssd_widget_get_value (widget->parent, UPDATE_LEFT), + ssd_widget_get_value (widget->parent, UPDATE_RIGHT), + ssd_dialog_get_value (CITY_PREFIX), + ssd_dialog_get_value (STREET_PREFIX)); + + ssd_dialog_hide_current (); + + return 1; + + } else if (!strcmp(widget->name, "left_button")) { + title = roadmap_lang_get (UPDATE_LEFT); + value = ssd_widget_get_value (widget->parent, UPDATE_LEFT); + } else { + title = roadmap_lang_get (UPDATE_RIGHT); + value = ssd_widget_get_value (widget->parent, UPDATE_RIGHT); + } + + ssd_keyboard_show (SSD_KEYBOARD_DIGITS, + title, value, keyboard_callback, (void *)widget); + + return 1; + } + + static void create_ssd_dialog (void) { + + const char *left_icon[] = {"left"}; + const char *right_icon[] = {"right"}; + SsdWidget left; + SsdWidget right; + SsdWidget box; + SsdWidget text; + int align; + + SsdWidget dialog = ssd_dialog_new ("Update street range", + roadmap_lang_get ("Update street range"), + SSD_CONTAINER_BORDER|SSD_CONTAINER_TITLE|SSD_DIALOG_FLOAT| + SSD_ALIGN_CENTER|SSD_ALIGN_VCENTER); + + ssd_widget_set_color (dialog, "#000000", "#ffffffdd"); + + /* Labels */ + box = ssd_container_new ("labels_box", NULL, -1, -1, SSD_WIDGET_SPACE); + ssd_widget_set_color (box, "#000000", NULL); + + ssd_widget_add (box, + ssd_text_new ("street_label", roadmap_lang_get (STREET_PREFIX), + 14, SSD_TEXT_LABEL|SSD_END_ROW)); + + ssd_widget_add (box, + ssd_text_new ("city_label", roadmap_lang_get (CITY_PREFIX), + 14, SSD_TEXT_LABEL|SSD_END_ROW)); + + ssd_widget_add (dialog, box); + + /* Values */ + box = ssd_container_new ("values_box", NULL, -1, -1, SSD_END_ROW); + ssd_widget_set_color (box, "#000000", NULL); + + ssd_widget_add (box, + ssd_text_new (STREET_PREFIX, "", 14, SSD_END_ROW)); + + ssd_widget_add (box, + ssd_text_new (CITY_PREFIX, "", 14, SSD_END_ROW)); + + ssd_widget_add (dialog, box); + + /* Spacer */ + ssd_widget_add (dialog, + ssd_container_new ("spacer1", NULL, 0, 16, SSD_END_ROW)); + + /* Left side */ + if (ssd_widget_rtl ()) { + align = SSD_ALIGN_RIGHT; + } + + left = ssd_container_new ("left", NULL, -1, -1, align); + ssd_widget_set_color (left, "#000000", NULL); + ssd_widget_set_offset (left, 2, 0); + + box = ssd_container_new ("left_box", NULL, 50, 20, + SSD_CONTAINER_BORDER|SSD_ALIGN_CENTER|SSD_END_ROW); + ssd_widget_set_color (box, "#000000", NULL); + + ssd_widget_add (box, + ssd_text_new ("estimated_left", "", 16, SSD_END_ROW|SSD_ALIGN_CENTER)); + ssd_widget_add (left, box); + + ssd_widget_add (left, + ssd_button_new ("left_button", "", left_icon, 1, + SSD_ALIGN_CENTER|SSD_END_ROW, button_callback)); + + text = ssd_text_new (UPDATE_LEFT, "", 15, SSD_END_ROW|SSD_ALIGN_CENTER); + ssd_widget_set_color (text, "#ff0000", 0); + ssd_widget_add (left, text); + + /* Right side */ + if (ssd_widget_rtl ()) align = 0; + else align = SSD_ALIGN_RIGHT; + + right = ssd_container_new ("right", NULL, -1, -1, align); + ssd_widget_set_offset (right, 2, 0); + ssd_widget_set_color (right, "#000000", NULL); + box = ssd_container_new ("right_box", NULL, 50, 20, + SSD_CONTAINER_BORDER|SSD_ALIGN_CENTER|SSD_END_ROW); + ssd_widget_set_color (box, "#000000", NULL); + + ssd_widget_add (box, + ssd_text_new ("estimated_right", "", 16, SSD_END_ROW|SSD_ALIGN_CENTER)); + ssd_widget_add (right, box); + + ssd_widget_add (right, + ssd_button_new ("right_button", "", right_icon, 1, + SSD_ALIGN_CENTER|SSD_END_ROW, button_callback)); + + text = ssd_text_new (UPDATE_RIGHT, "", 15, SSD_END_ROW|SSD_ALIGN_CENTER); + ssd_widget_set_color (text, "#ff0000", 0); + ssd_widget_add (right, text); + + if (ssd_widget_rtl ()) { + ssd_widget_add (dialog, right); + ssd_widget_add (dialog, left); + } else { + ssd_widget_add (dialog, left); + ssd_widget_add (dialog, right); + } + + ssd_widget_add (dialog, + ssd_button_label ("OK", roadmap_lang_get ("Ok"), + SSD_ALIGN_CENTER|SSD_START_NEW_ROW, button_callback)); + + } + #endif + static int get_estimated_range(const PluginLine *line, const RoadMapPosition *pos, *************** *** 302,312 **** } - roadmap_dialog_set_data ("Update", STREET_PREFIX, street_name); - if (!city_name) city_name = ""; - roadmap_dialog_set_data ("Update", CITY_PREFIX, city_name); get_estimated_range (line, pos, direction, fraddl, toaddl, fraddr, toaddr, &left, &right); snprintf(str, sizeof(str), "%s:%d %s:%d", --- 527,538 ---- } if (!city_name) city_name = ""; get_estimated_range (line, pos, direction, fraddl, toaddl, fraddr, toaddr, &left, &right); + #ifndef SSD + roadmap_dialog_set_data ("Update", STREET_PREFIX, street_name); + + roadmap_dialog_set_data ("Update", CITY_PREFIX, city_name); snprintf(str, sizeof(str), "%s:%d %s:%d", *************** *** 318,325 **** --- 544,560 ---- roadmap_dialog_set_data ("Update", UPDATE_LEFT, ""); roadmap_dialog_set_data ("Update", UPDATE_RIGHT, ""); + #else + ssd_dialog_set_value (STREET_PREFIX, street_name); + ssd_dialog_set_value (CITY_PREFIX, city_name); + sprintf(str, "%d", left); + ssd_dialog_set_value ("estimated_left", str); + sprintf(str, "%d", right); + ssd_dialog_set_value ("estimated_right", str); + #endif return 0; } + #ifndef SSD static void update_range_apply(const char *name, void *context) { *************** *** 330,391 **** roadmap_dialog_get_data ("Update", UPDATE_RIGHT); ! if (!*updated_left && !*updated_right) { ! roadmap_dialog_hide (name); ! return; ! ! } else { ! char note[100]; ! int fips; ! ! if (roadmap_county_by_position (&CurrentFixedPosition, &fips, 1) < 1) { ! roadmap_messagebox ("Error", "Can't locate county"); ! return; ! } ! ! if (editor_db_activate (fips) == -1) { ! ! editor_db_create (fips); ! ! if (editor_db_activate (fips) == -1) { ! ! roadmap_messagebox ("Error", "Can't update range"); ! return; ! } ! } ! ! snprintf(note, sizeof(note), "%s: %s%s", ! roadmap_lang_get (STREET_PREFIX), ! (char *)roadmap_dialog_get_data ("Update", STREET_PREFIX), ! NEW_LINE); ! ! snprintf(note + strlen(note), sizeof(note) - strlen(note), ! "%s: %s%s", roadmap_lang_get (CITY_PREFIX), ! (char *)roadmap_dialog_get_data ("Update", CITY_PREFIX), ! NEW_LINE); ! ! if (*updated_left) { ! ! snprintf(note + strlen(note), sizeof(note) - strlen(note), ! "%s: %s%s", roadmap_lang_get (UPDATE_LEFT), updated_left, ! NEW_LINE); ! } ! ! if (*updated_right) { ! ! snprintf(note + strlen(note), sizeof(note) - strlen(note), ! "%s: %s%s", roadmap_lang_get (UPDATE_RIGHT), updated_right, ! NEW_LINE); ! } ! ! if (editor_marker_add (CurrentFixedPosition.longitude, ! CurrentFixedPosition.latitude, ! CurrentGpsPoint.steering, ! time(NULL), ! UpdateRangeMarkerType, ! ED_MARKER_UPLOAD, note) == -1) { ! ! roadmap_messagebox ("Error", "Can't save marker."); ! } ! } roadmap_dialog_hide (name); --- 565,571 ---- roadmap_dialog_get_data ("Update", UPDATE_RIGHT); ! update_range (updated_left, updated_right, ! roadmap_dialog_get_data ("Update", CITY_PREFIX), ! roadmap_dialog_get_data ("Update", STREET_PREFIX)); roadmap_dialog_hide (name); *************** *** 397,400 **** --- 577,581 ---- roadmap_dialog_hide (name); } + #endif *************** *** 424,428 **** } ! if (roadmap_dialog_activate ("Update street range", NULL)) { --- 605,609 ---- } ! #ifndef SSD if (roadmap_dialog_activate ("Update street range", NULL)) { *************** *** 439,443 **** roadmap_dialog_complete (roadmap_preferences_use_keyboard ()); } ! fill_dialog (&line, &CurrentFixedPosition, direction); } --- 620,630 ---- roadmap_dialog_complete (roadmap_preferences_use_keyboard ()); } ! #else ! if (!ssd_dialog_activate ("Update street range", NULL)) { ! create_ssd_dialog(); ! ssd_dialog_activate ("Update street range", NULL); ! ssd_dialog_draw (); ! } ! #endif fill_dialog (&line, &CurrentFixedPosition, direction); } |
From: Ehud S. <esh...@us...> - 2006-11-21 09:27:43
|
Update of /cvsroot/roadmap/roadmap_editor/src/editor In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7370 Modified Files: editor_screen.c Log Message: Adjust for the new pointer registration interfaces. Replace context menu with icons. Index: editor_screen.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/editor/editor_screen.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** editor_screen.c 18 Aug 2006 17:39:32 -0000 1.17 --- editor_screen.c 21 Nov 2006 09:27:40 -0000 1.18 *************** *** 48,51 **** --- 48,52 ---- #include "roadmap_sprite.h" #include "roadmap_lang.h" + #include "roadmap_start.h" #include "roadmap_main.h" *************** *** 93,98 **** static int select_count; ! static RoadMapPointerHandler SaveShortClickHandler; ! static RoadMapPointerHandler SaveLongClickHandler; /* track which lines were drawn */ --- 94,108 ---- static int select_count; ! static char const *PopupMenuItems[] = { ! ! "setasdeparture", ! "setasdestination", ! "properties", ! "deleteroads", ! ! NULL, ! }; ! ! /* track which lines were drawn */ *************** *** 153,157 **** static void editor_screen_update_segments (void) { ! editor_segments_properties (SelectedLines, select_count); } --- 163,169 ---- static void editor_screen_update_segments (void) { ! if (select_count) { ! editor_segments_properties (SelectedLines, select_count); ! } } *************** *** 198,206 **** } ! void editor_screen_long_click (RoadMapGuiPoint *point) { static RoadMapMenu menu; ! if (select_count == 0) return; if (menu == NULL) { --- 210,218 ---- } ! static int editor_screen_long_click (RoadMapGuiPoint *point) { static RoadMapMenu menu; ! if (select_count == 0) return 0; if (menu == NULL) { *************** *** 221,228 **** roadmap_main_popup_menu (menu, point->x, point->y); } ! void editor_screen_short_click (RoadMapGuiPoint *point) { RoadMapPosition position; --- 233,247 ---- roadmap_main_popup_menu (menu, point->x, point->y); + + return 1; } ! static void popup_menu_callback (void) { ! editor_screen_reset_selected (); ! } ! ! ! static int editor_screen_short_click (RoadMapGuiPoint *point) { RoadMapPosition position; *************** *** 236,244 **** if (roadmap_navigate_retrieve_line ! (&position, 1, &line, &distance, LAYER_ALL_ROADS) == -1) { roadmap_display_hide ("Selected Street"); editor_screen_reset_selected (); ! return; } --- 255,266 ---- if (roadmap_navigate_retrieve_line ! (&position, 7, &line, &distance, LAYER_ALL_ROADS) == -1) { roadmap_display_hide ("Selected Street"); + roadmap_trip_set_point ("Selection", &position); + roadmap_start_hide_menu ("Editor Menu"); editor_screen_reset_selected (); ! roadmap_screen_redraw (); ! return 1; } *************** *** 257,261 **** if (!select_count) { ! roadmap_pointer_register_long_click (SaveLongClickHandler); } --- 279,283 ---- if (!select_count) { ! roadmap_pointer_unregister_long_click (editor_screen_long_click); } *************** *** 266,271 **** SelectedLines[select_count].line = line; if (!select_count) { ! SaveLongClickHandler = roadmap_pointer_register_long_click ! (editor_screen_long_click); } select_count++; --- 288,292 ---- SelectedLines[select_count].line = line; if (!select_count) { ! roadmap_pointer_register_long_click (editor_screen_long_click); } select_count++; *************** *** 275,279 **** --- 296,304 ---- roadmap_trip_set_point ("Selection", &position); roadmap_display_activate ("Selected Street", &line, &position, &street); + roadmap_start_popup_menu ("Editor Menu", PopupMenuItems, + popup_menu_callback, point); roadmap_screen_redraw (); + + return 1; } *************** *** 336,346 **** ! static int editor_screen_get_road_state (int line, int plugin_id, int fips) { int has_street = 0; int has_route = 0; if (plugin_id == ROADMAP_PLUGIN_ID) { return NO_ROAD_STATE; --- 361,392 ---- ! static int editor_screen_get_road_state (int line, int cfcc, ! int plugin_id, int fips) { int has_street = 0; int has_route = 0; + return NO_ROAD_STATE; + if (plugin_id == ROADMAP_PLUGIN_ID) { + if (roadmap_locator_activate (fips) >= 0) { + int speed1 = roadmap_line_route_get_speed (line, 0); + int speed2 = roadmap_line_route_get_speed (line, 1); + int slow = 25; + + if (cfcc == ROADMAP_ROAD_FREEWAY) slow = 45; + + if (!speed1 && !speed2) return NO_ROAD_STATE; + + if (!speed1) speed1 = speed2; + else if (!speed2) speed2 = speed1; + + if ((speed1 <= slow) || (speed2 <= slow)) { + return NO_DATA_STATE; + } else { + return NO_ROAD_STATE; + } + } return NO_ROAD_STATE; *************** *** 436,440 **** if (!roadmap_screen_is_dragging() && (pen_type > 0)) { ! road_state = editor_screen_get_road_state (line, 0, fips); } else { road_state = NO_ROAD_STATE; --- 482,486 ---- if (!roadmap_screen_is_dragging() && (pen_type > 0)) { ! road_state = editor_screen_get_road_state (line, cfcc, 0, fips); } else { road_state = NO_ROAD_STATE; *************** *** 630,634 **** } else { ! road_state = editor_screen_get_road_state (line, 1, fips); } --- 676,680 ---- } else { ! road_state = editor_screen_get_road_state (line, cfcc, 1, fips); } *************** *** 751,762 **** if (status) { ! SaveShortClickHandler = roadmap_pointer_register_short_click ! (editor_screen_short_click); roadmap_layer_adjust(); } else { ! roadmap_pointer_register_short_click (SaveShortClickHandler); if (select_count) { ! roadmap_pointer_register_long_click (SaveLongClickHandler); select_count = 0; } --- 797,807 ---- if (status) { ! roadmap_pointer_register_short_click (editor_screen_short_click); roadmap_layer_adjust(); } else { ! roadmap_pointer_unregister_short_click (editor_screen_short_click); if (select_count) { ! roadmap_pointer_unregister_long_click (editor_screen_long_click); select_count = 0; } *************** *** 768,772 **** if (select_count) { ! roadmap_pointer_register_long_click (SaveLongClickHandler); } --- 813,817 ---- if (select_count) { ! roadmap_pointer_unregister_long_click (editor_screen_long_click); } *************** *** 806,809 **** --- 851,862 ---- roadmap_canvas_set_thickness (1); + roadmap_start_add_action ("properties", "Properties", + "Update road properties", NULL, "Update road properties", + editor_screen_update_segments); + + roadmap_start_add_action ("deleteroads", "Delete", "Delete selected roads", + NULL, "Delete selected roads", + editor_screen_delete_segments); + screen_prev_after_refresh = roadmap_screen_subscribe_after_refresh (editor_screen_after_refresh); |
From: Ehud S. <esh...@us...> - 2006-11-21 09:26:11
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6730 Modified Files: roadmap_label.c roadmap_label.h roadmap_res.c roadmap_res.h roadmap_start.c roadmap_start.h Log Message: Skin management. Index: roadmap_res.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_res.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_res.h 3 Nov 2006 12:30:29 -0000 1.1 --- roadmap_res.h 21 Nov 2006 09:26:07 -0000 1.2 *************** *** 28,31 **** --- 28,35 ---- #define MAX_RESOURCES 1 + /* Flags */ + #define RES_SKIN 0x1 + #define RES_NOCACHE 0x2 + void *roadmap_res_get (unsigned int type, unsigned int flags, const char *name); Index: roadmap_start.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_start.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** roadmap_start.h 17 Nov 2006 16:53:18 -0000 1.6 --- roadmap_start.h 21 Nov 2006 09:26:07 -0000 1.7 *************** *** 57,60 **** --- 57,73 ---- (RoadMapStartSubscriber handler); + void roadmap_start_context_menu (const RoadMapGuiPoint *point); + + int roadmap_start_add_action (const char *name, const char *label_long, + const char *label_short, const char *label_terse, + const char *tip, RoadMapCallback callback); + + void roadmap_start_popup_menu (const char *name, + const char *items[], + RoadMapCallback callback, + const RoadMapGuiPoint *point); + + void roadmap_start_hide_menu (const char *name); + #endif /* INCLUDE__ROADMAP_START__H */ Index: roadmap_label.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_label.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** roadmap_label.c 3 Nov 2006 12:35:37 -0000 1.8 --- roadmap_label.c 21 Nov 2006 09:26:07 -0000 1.9 *************** *** 58,61 **** --- 58,62 ---- #endif + #include "roadmap_skin.h" #include "roadmap_list.h" #include "roadmap_label.h" *************** *** 649,653 **** } ! int roadmap_label_activate (void) { --- 650,654 ---- } ! void roadmap_label_activate (void) { *************** *** 660,675 **** RoadMapLabelMinFeatSizeSq = roadmap_config_get_integer (&RoadMapConfigMinFeatureSize); RoadMapLabelMinFeatSizeSq *= RoadMapLabelMinFeatSizeSq; - - return 0; } - int roadmap_label_initialize (void) { roadmap_config_declare ! ("preferences", &RoadMapConfigMinFeatureSize, "25"); roadmap_config_declare ! ("preferences", &RoadMapConfigLabelsColor, "#000000"); --- 661,673 ---- RoadMapLabelMinFeatSizeSq = roadmap_config_get_integer (&RoadMapConfigMinFeatureSize); RoadMapLabelMinFeatSizeSq *= RoadMapLabelMinFeatSizeSq; } int roadmap_label_initialize (void) { roadmap_config_declare ! ("schema", &RoadMapConfigMinFeatureSize, "25"); roadmap_config_declare ! ("schema", &RoadMapConfigLabelsColor, "#000000"); *************** *** 678,681 **** --- 676,680 ---- ROADMAP_LIST_INIT(&RoadMapLabelNew); + roadmap_skin_register (roadmap_label_activate); return 0; } Index: roadmap_res.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_res.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** roadmap_res.c 3 Nov 2006 12:30:29 -0000 1.1 --- roadmap_res.c 21 Nov 2006 09:26:07 -0000 1.2 *************** *** 27,30 **** --- 27,31 ---- #include <string.h> + #include <stdio.h> #include <stdlib.h> *************** *** 72,86 **** const char *name, int *mem) { ! char *path; ! switch (type) { ! case RES_BITMAP: ! path = roadmap_path_join (roadmap_path_user(), "icons"); ! *mem = 0; - return roadmap_canvas_load_image (path, name); } ! return NULL; } --- 73,95 ---- const char *name, int *mem) { ! const char *cursor; ! void *data = NULL; ! for (cursor = roadmap_path_first ("skin"); ! cursor != NULL; ! cursor = roadmap_path_next ("skin", cursor)) { ! ! switch (type) { ! case RES_BITMAP: ! *mem = 0; ! ! data = roadmap_canvas_load_image (cursor, name); ! } ! ! if (data) break; } ! return data; } *************** *** 116,132 **** RoadMapResource *res = &Resources[type]; ! data = find_resource (type, name); ! if (data) return data; ! if (!Resources[type].count) allocate_resource (type); ! //TODO implement grow (or old deletion) ! if (Resources[type].count == Resources[type].max) return NULL; ! data = load_resource (type, flags, name, &mem); if (!data) return NULL; res->slots[res->count].data = data; res->slots[res->count].name = name; --- 125,163 ---- RoadMapResource *res = &Resources[type]; ! if (! (flags & RES_NOCACHE)) { ! data = find_resource (type, name); ! if (data) return data; ! if (!Resources[type].count) allocate_resource (type); ! //TODO implement grow (or old deletion) ! if (Resources[type].count == Resources[type].max) return NULL; ! } ! switch (type) { ! case RES_BITMAP: ! if (strchr (name, '.')) { ! data = load_resource (type, flags, name, &mem); ! } else { ! char *full_name = malloc (strlen (name) + 5); ! sprintf(full_name, "%s.png", name); ! data = load_resource (type, flags, full_name, &mem); ! if (!data) { ! sprintf(full_name, "%s.bmp", name); ! data = load_resource (type, flags, full_name, &mem); ! } ! free (full_name); ! } ! break; ! ! default: ! data = load_resource (type, flags, name, &mem); ! } if (!data) return NULL; + if (flags & RES_NOCACHE) return data; + res->slots[res->count].data = data; res->slots[res->count].name = name; Index: roadmap_label.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_label.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** roadmap_label.h 11 Aug 2006 18:12:20 -0000 1.4 --- roadmap_label.h 21 Nov 2006 09:26:07 -0000 1.5 *************** *** 34,38 **** int featuresize, const PluginLine *line); ! int roadmap_label_activate (void); int roadmap_label_initialize (void); --- 34,38 ---- int featuresize, const PluginLine *line); ! void roadmap_label_activate (void); int roadmap_label_initialize (void); Index: roadmap_start.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_start.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** roadmap_start.c 17 Nov 2006 16:53:18 -0000 1.31 --- roadmap_start.c 21 Nov 2006 09:26:07 -0000 1.32 *************** *** 74,80 **** --- 74,82 ---- #include "roadmap_sound.h" #include "roadmap_lang.h" + #include "roadmap_skin.h" #include "roadmap_start.h" #ifdef SSD + #include "ssd/ssd_widget.h" #include "ssd/ssd_menu.h" #endif *************** *** 92,95 **** --- 94,98 ---- static const char *RoadMapMainTitle = "RoadMap"; + #define MAX_ACTIONS 100 static int RoadMapStartFrozen = 0; *************** *** 247,250 **** --- 250,254 ---- roadmap_trip_set_selection_as ("Destination"); roadmap_screen_refresh(); + navigate_main_calc_route (); } *************** *** 333,337 **** * will reference an action. */ ! static RoadMapAction RoadMapStartActions[] = { {"preferences", "Preferences", "Preferences", "P", --- 337,341 ---- * will reference an action. */ ! static RoadMapAction RoadMapStartActions[MAX_ACTIONS + 1] = { {"preferences", "Preferences", "Preferences", "P", *************** *** 394,397 **** --- 398,404 ---- "Toggle view mode 2D / 3D", roadmap_screen_toggle_view_mode}, + {"toggleskin", "Toggle skin", "", NULL, + "Toggle skin (day / night)", roadmap_skin_toggle}, + {"toggleorientation", "Toggle orientation mode", "", NULL, "Toggle orientation mode dynamic / fixed", *************** *** 481,484 **** --- 488,495 ---- roadmap_start_set_destination}, + {"traffic", "Traffic data", NULL, NULL, + "Chage Traffic data settings", + roadmap_start_navigate}, + {"navigate", "Navigate", NULL, NULL, "Calculate route", *************** *** 726,730 **** "setasdeparture", "setasdestination", - "navigate", NULL, --- 737,740 ---- *************** *** 811,817 **** #ifdef SSD ! ssd_menu_activate ("quick", RoadMapStartQuickMenu, RoadMapStartActions); ! //ssd_keyboard_show (); ! //ssd_test_list (); #else if (QuickMenu == NULL) { --- 821,826 ---- #ifdef SSD ! ssd_menu_activate ("Main Menu", "quick", RoadMapStartQuickMenu, NULL, ! RoadMapStartActions, SSD_CONTAINER_BORDER|SSD_CONTAINER_TITLE); #else if (QuickMenu == NULL) { *************** *** 1026,1030 **** ! static void roadmap_start_long_click (RoadMapGuiPoint *point) { RoadMapPosition position; --- 1035,1039 ---- ! static int roadmap_start_long_click (RoadMapGuiPoint *point) { RoadMapPosition position; *************** *** 1036,1039 **** --- 1045,1050 ---- roadmap_main_popup_menu (LongClickMenu, point->x, point->y); } + + return 1; } *************** *** 1287,1288 **** --- 1298,1363 ---- } + + int roadmap_start_add_action (const char *name, const char *label_long, + const char *label_short, const char *label_terse, + const char *tip, RoadMapCallback callback) { + RoadMapAction action = + {name, label_long, label_short, label_terse, tip, callback}; + + int i; + + for (i=0; i<MAX_ACTIONS; i++) { + if (RoadMapStartActions[i].name == NULL) break; + } + + if (i == MAX_ACTIONS) { + roadmap_log (ROADMAP_ERROR, "Too many actions."); + return -1; + } + + RoadMapStartActions[i] = action; + RoadMapStartActions[i+1].name = NULL; + + return 0; + } + + + void roadmap_start_context_menu (const RoadMapGuiPoint *point) { + + #ifdef SSD + ssd_menu_activate ("Menu", "context", RoadMapStartLongClickMenu, + NULL, RoadMapStartActions, + SSD_CONTAINER_BORDER|SSD_CONTAINER_TITLE|SSD_DIALOG_FLOAT); + #else + if (LongClickMenu == NULL) return; + + roadmap_main_popup_menu (LongClickMenu, point->x, point->y); + #endif + } + + + void roadmap_start_popup_menu (const char *name, + const char *items[], + RoadMapCallback callback, + const RoadMapGuiPoint *point) { + + int height = roadmap_canvas_height(); + int flags = 0; + #ifdef SSD + if (point->y > height / 2) { + flags = SSD_ALIGN_BOTTOM; + } + + ssd_menu_activate (name, "", items, callback, RoadMapStartActions, + SSD_DIALOG_FLOAT|flags); + #endif + } + + + void roadmap_start_hide_menu (const char *name) { + #ifdef SSD + ssd_menu_hide (name); + #endif + } + + |
From: Ehud S. <esh...@us...> - 2006-11-21 09:24:43
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6119 Modified Files: roadmap_line_route.c roadmap_line_route.h Log Message: Add interface for avg speed. Index: roadmap_line_route.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_line_route.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** roadmap_line_route.h 3 Nov 2006 12:29:48 -0000 1.2 --- roadmap_line_route.h 21 Nov 2006 09:24:39 -0000 1.3 *************** *** 45,52 **** --- 45,56 ---- (int line, LineRouteTime *from, LineRouteTime *to); + int roadmap_line_route_get_avg_cross_time (int line, int against_dir); + int roadmap_line_route_get_cross_time (int line, int against_dir); int roadmap_line_route_get_speed (int line, int against_dir); + int roadmap_line_route_get_avg_speed (int line, int against_dir); + extern roadmap_db_handler RoadMapLineRouteHandler; Index: roadmap_line_route.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_line_route.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_line_route.c 3 Nov 2006 12:29:48 -0000 1.3 --- roadmap_line_route.c 21 Nov 2006 09:24:39 -0000 1.4 *************** *** 262,265 **** --- 262,282 ---- + int roadmap_line_route_get_avg_cross_time (int line, int against_dir) { + + RoadMapLineRoute *route; + + if (RoadMapLineRouteActive == NULL) return -1; /* No data. */ + if (RoadMapLineRouteActive->LineRouteCount <= line) return -1; + + route = &RoadMapLineRouteActive->LineRoute[line]; + + if (!against_dir) { + return calc_avg_cross_time (line, route->from_speed_ref); + } else { + return calc_avg_cross_time (line, route->to_speed_ref); + } + } + + int roadmap_line_route_get_speed (int line, int against_dir) { *************** *** 286,287 **** --- 303,325 ---- } + int roadmap_line_route_get_avg_speed (int line, int against_dir) { + + RoadMapLineRoute *route; + int speed_ref; + + if (RoadMapLineRouteActive == NULL) return -1; /* No data. */ + if (RoadMapLineRouteActive->LineRouteCount <= line) return -1; + + route = &RoadMapLineRouteActive->LineRoute[line]; + + if (!against_dir) { + speed_ref = route->from_speed_ref; + } else { + speed_ref = route->to_speed_ref; + } + + if (speed_ref == INVALID_SPEED) return 0; + + return roadmap_line_speed_get_avg (speed_ref); + } + |
From: Ehud S. <esh...@us...> - 2006-11-21 09:24:23
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6073 Modified Files: roadmap_pointer.c roadmap_pointer.h roadmap_screen_obj.c Log Message: Modify pointer registration interfaces. Index: roadmap_screen_obj.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_screen_obj.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** roadmap_screen_obj.c 3 Nov 2006 12:34:22 -0000 1.7 --- roadmap_screen_obj.c 21 Nov 2006 09:24:20 -0000 1.8 *************** *** 44,47 **** --- 44,48 ---- #include "roadmap_state.h" #include "roadmap_pointer.h" + #include "roadmap_res.h" #include "roadmap_screen_obj.h" *************** *** 76,79 **** --- 77,81 ---- const RoadMapAction *action; + const RoadMapAction *long_action; RoadMapStateFn state_fn; *************** *** 89,96 **** static int OffsetY = 0; - static RoadMapPointerClickHandler PrevPressedHandler; - static RoadMapPointerHandler PrevShortClick; - static RoadMapPointerHandler PrevLongClick; - static char *roadmap_object_string (const char *data, int length) { --- 91,94 ---- *************** *** 153,201 **** for (i = 1; i <= argc; ++i) { char arg[256]; roadmap_screen_obj_decode_arg (arg, sizeof(arg), argv[i], argl[i]); - if (!strchr(arg, '.')) { - /* this is a sprite icon */ - object->sprites[object->states_count] = - roadmap_object_string (arg, argl[i]); - } else { - RoadMapImage image = NULL; - const char *cursor; - char *file = roadmap_path_join ("icons", arg); ! for (cursor = roadmap_path_first ("config"); ! cursor != NULL; ! cursor = roadmap_path_next ("config", cursor)) { ! if (roadmap_file_exists (cursor, file)) { ! image = roadmap_canvas_load_image (cursor, file); ! break; ! } ! } ! if (!image) { ! for (cursor = roadmap_path_first ("user"); ! cursor != NULL; ! cursor = roadmap_path_next ("user", cursor)) { - if (roadmap_file_exists (cursor, file)) { - image = roadmap_canvas_load_image (cursor, file); - break; - } - } - } ! free (file); ! if (image == NULL) { ! roadmap_log (ROADMAP_ERROR, ! "screen object:'%s' can't load image:%s.", ! object->name, ! arg); ! } ! object->images[object->states_count] = image; ! } } --- 151,196 ---- for (i = 1; i <= argc; ++i) { + RoadMapImage image = NULL; char arg[256]; roadmap_screen_obj_decode_arg (arg, sizeof(arg), argv[i], argl[i]); ! image = roadmap_res_get (RES_BITMAP, RES_SKIN, arg); ! if (image == NULL) { ! roadmap_log (ROADMAP_ERROR, ! "screen object:'%s' can't load image:%s.", ! object->name, ! arg); ! } ! object->images[object->states_count] = image; ! } ! ++object->states_count; ! } ! static void roadmap_screen_obj_decode_sprite ! (RoadMapScreenObj object, ! int argc, const char **argv, int *argl) { ! int i; ! ! argc -= 1; ! ! if (object->states_count > MAX_STATES) { ! roadmap_log (ROADMAP_ERROR, "screen object:'%s' has too many states.", ! object->name); ! return; ! } ! ! for (i = 1; i <= argc; ++i) { ! char arg[256]; ! ! roadmap_screen_obj_decode_arg (arg, sizeof(arg), argv[i], argl[i]); ! ! object->sprites[object->states_count] = ! roadmap_object_string (arg, argl[i]); } *************** *** 302,306 **** argc -= 1; ! if (argc != 1) { roadmap_log (ROADMAP_ERROR, "screen object:'%s' illegal action.", object->name); --- 297,301 ---- argc -= 1; ! if (argc < 1) { roadmap_log (ROADMAP_ERROR, "screen object:'%s' illegal action.", object->name); *************** *** 316,319 **** --- 311,325 ---- object->name); } + + if (argc == 1) return; + + roadmap_screen_obj_decode_arg (arg, sizeof(arg), argv[2], argl[2]); + + object->long_action = roadmap_start_find_action (arg); + + if (!object->long_action) { + roadmap_log (ROADMAP_ERROR, "screen object:'%s' can't find action.", + object->name); + } } *************** *** 399,402 **** --- 405,413 ---- break; + case 'E': + + roadmap_screen_obj_decode_sprite (object, argc, argv, argl); + break; + case 'S': *************** *** 480,484 **** RoadMapScreenObjSelected = roadmap_screen_obj_by_pos (point); ! if (!RoadMapScreenObjSelected) return (*PrevPressedHandler)(point); if (RoadMapScreenObjSelected->state_fn) { --- 491,495 ---- RoadMapScreenObjSelected = roadmap_screen_obj_by_pos (point); ! if (!RoadMapScreenObjSelected) return 0; if (RoadMapScreenObjSelected->state_fn) { *************** *** 501,511 **** ! static void roadmap_screen_obj_short_click (RoadMapGuiPoint *point) { RoadMapScreenObj object = RoadMapScreenObjSelected; if (!RoadMapScreenObjSelected) { ! (*PrevShortClick)(point); ! return; } --- 512,521 ---- ! static int roadmap_screen_obj_short_click (RoadMapGuiPoint *point) { RoadMapScreenObj object = RoadMapScreenObjSelected; if (!RoadMapScreenObjSelected) { ! return 0; } *************** *** 515,537 **** (*(object->action->callback)) (); } } ! static void roadmap_screen_obj_long_click (RoadMapGuiPoint *point) { RoadMapScreenObj object = RoadMapScreenObjSelected; if (!RoadMapScreenObjSelected) { ! (*PrevLongClick)(point); ! return; } RoadMapScreenObjSelected = NULL; ! if (object->action) { (*(object->action->callback)) (); } } void roadmap_screen_obj_move (const char *name, const RoadMapGuiPoint *position) { --- 525,590 ---- (*(object->action->callback)) (); } + + return 1; } ! static int roadmap_screen_obj_long_click (RoadMapGuiPoint *point) { RoadMapScreenObj object = RoadMapScreenObjSelected; if (!RoadMapScreenObjSelected) { ! return 0; } RoadMapScreenObjSelected = NULL; ! if (object->long_action) { ! (*(object->long_action->callback)) (); ! ! } else if (object->action) { (*(object->action->callback)) (); } + + return 1; + } + + + static void roadmap_screen_obj_reload (void) { + + const char *cursor; + RoadMapFileContext file; + unsigned int i; + int height = roadmap_canvas_height (); + const char *object_name = NULL; + + for (i=0; i<sizeof(RoadMapObjFiles)/sizeof(RoadMapObjFiles[0]); i++) { + + if (height >= RoadMapObjFiles[i].min_screen_height) { + object_name = RoadMapObjFiles[i].name; + break; + } + } + + if (!object_name) { + roadmap_log + (ROADMAP_ERROR, "Can't find object file for screen height: %d", + height); + return; + } + + + for (cursor = roadmap_file_map ("skin", object_name, NULL, "r", &file); + cursor != NULL; + cursor = roadmap_file_map ("skin", object_name, cursor, "r", &file)) { + + roadmap_screen_obj_load (roadmap_file_base(file), roadmap_file_size(file)); + + roadmap_file_unmap (&file); + return; + } } + void roadmap_screen_obj_move (const char *name, const RoadMapGuiPoint *position) { *************** *** 571,622 **** void roadmap_screen_obj_initialize (void) { ! const char *cursor; ! RoadMapFileContext file; ! unsigned int i; ! int height = roadmap_canvas_height (); ! const char *object_name = NULL; ! ! PrevPressedHandler = ! roadmap_pointer_register_pressed (roadmap_screen_obj_pressed); ! PrevShortClick = ! roadmap_pointer_register_short_click (roadmap_screen_obj_short_click); ! PrevLongClick = ! roadmap_pointer_register_long_click (roadmap_screen_obj_long_click); ! ! for (i=0; i<sizeof(RoadMapObjFiles)/sizeof(RoadMapObjFiles[0]); i++) { ! ! if (height >= RoadMapObjFiles[i].min_screen_height) { ! object_name = RoadMapObjFiles[i].name; ! break; ! } ! } ! ! if (!object_name) { ! roadmap_log ! (ROADMAP_ERROR, "Can't find object file for screen height: %d", ! height); ! return; ! } ! ! ! for (cursor = roadmap_file_map ("config", object_name, NULL, "r", &file); ! cursor != NULL; ! cursor = roadmap_file_map ("config", object_name, cursor, "r", &file)) { ! ! roadmap_screen_obj_load (roadmap_file_base(file), roadmap_file_size(file)); ! ! roadmap_file_unmap (&file); ! return; ! } ! ! for (cursor = roadmap_file_map ("user", object_name, NULL, "r", &file); ! cursor != NULL; ! cursor = roadmap_file_map ("user", object_name, cursor, "r", &file)) { ! ! roadmap_screen_obj_load (roadmap_file_base(file), roadmap_file_size(file)); ! roadmap_file_unmap (&file); ! return; ! } } --- 624,632 ---- void roadmap_screen_obj_initialize (void) { ! roadmap_pointer_register_pressed (roadmap_screen_obj_pressed); ! roadmap_pointer_register_short_click (roadmap_screen_obj_short_click); ! roadmap_pointer_register_long_click (roadmap_screen_obj_long_click); ! roadmap_screen_obj_reload (); } Index: roadmap_pointer.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_pointer.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** roadmap_pointer.h 3 Nov 2006 12:34:22 -0000 1.3 --- roadmap_pointer.h 21 Nov 2006 09:24:20 -0000 1.4 *************** *** 31,53 **** ! typedef void (*RoadMapPointerHandler) (RoadMapGuiPoint *point); ! typedef int (*RoadMapPointerClickHandler) (RoadMapGuiPoint *point); void roadmap_pointer_initialize (void); const RoadMapGuiPoint *roadmap_pointer_position (void); ! RoadMapPointerHandler roadmap_pointer_register_short_click ! (RoadMapPointerHandler handler); ! RoadMapPointerHandler roadmap_pointer_register_long_click ! (RoadMapPointerHandler handler); ! RoadMapPointerHandler roadmap_pointer_register_drag_start ! (RoadMapPointerHandler handler); ! RoadMapPointerHandler roadmap_pointer_register_drag_motion ! (RoadMapPointerHandler handler); ! RoadMapPointerHandler roadmap_pointer_register_drag_end ! (RoadMapPointerHandler handler); ! RoadMapPointerClickHandler roadmap_pointer_register_pressed ! (RoadMapPointerClickHandler handler); #endif // INCLUDE__ROADMAP_POINTER__H --- 31,52 ---- ! typedef int (*RoadMapPointerHandler) (RoadMapGuiPoint *point); void roadmap_pointer_initialize (void); const RoadMapGuiPoint *roadmap_pointer_position (void); ! void roadmap_pointer_register_short_click (RoadMapPointerHandler handler); ! void roadmap_pointer_register_long_click (RoadMapPointerHandler handler); ! void roadmap_pointer_register_drag_start (RoadMapPointerHandler handler); ! void roadmap_pointer_register_drag_motion (RoadMapPointerHandler handler); ! void roadmap_pointer_register_drag_end (RoadMapPointerHandler handler); ! void roadmap_pointer_register_pressed (RoadMapPointerHandler handler); ! void roadmap_pointer_unregister_short_click (RoadMapPointerHandler handler); ! void roadmap_pointer_unregister_long_click (RoadMapPointerHandler handler); ! void roadmap_pointer_unregister_drag_start (RoadMapPointerHandler handler); ! void roadmap_pointer_unregister_drag_motion (RoadMapPointerHandler handler); ! void roadmap_pointer_unregister_drag_end (RoadMapPointerHandler handler); ! void roadmap_pointer_unregister_pressed (RoadMapPointerHandler handler); #endif // INCLUDE__ROADMAP_POINTER__H Index: roadmap_pointer.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_pointer.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** roadmap_pointer.c 3 Nov 2006 12:34:22 -0000 1.6 --- roadmap_pointer.c 21 Nov 2006 09:24:20 -0000 1.7 *************** *** 28,31 **** --- 28,32 ---- #include <time.h> #include <stdlib.h> + #include <string.h> #include "roadmap.h" *************** *** 45,76 **** static RoadMapGuiPoint last_pointer_point; ! /* The pointer events callbacks: all callbacks are initialized to do-nothing ! * functions, so that we don't care checking if one has been setup. ! */ ! static void roadmap_pointer_ignore_event (RoadMapGuiPoint *point) {} ! static int roadmap_pointer_ignore_click_event (RoadMapGuiPoint *point) { ! return 0; ! } ! ! static RoadMapPointerHandler RoadMapPointerShortClick = ! roadmap_pointer_ignore_event; ! static RoadMapPointerHandler RoadMapPointerLongClick = ! roadmap_pointer_ignore_event; ! static RoadMapPointerClickHandler RoadMapPointerPressed = ! roadmap_pointer_ignore_click_event; - static RoadMapPointerHandler RoadMapPointerReleased = - roadmap_pointer_ignore_event; ! static RoadMapPointerHandler RoadMapPointerDragStart = ! roadmap_pointer_ignore_event; ! static RoadMapPointerHandler RoadMapPointerDragMotion = ! roadmap_pointer_ignore_event; ! static RoadMapPointerHandler RoadMapPointerDragEnd = ! roadmap_pointer_ignore_event; --- 46,68 ---- static RoadMapGuiPoint last_pointer_point; ! enum POINTER_EVENT {SHORT_CLICK = 0, LONG_CLICK, PRESSED, RELEASED, DRAG_START, DRAG_MOTION, DRAG_END, MAX_EVENTS}; ! #define MAX_CALLBACKS 10 ! static RoadMapPointerHandler pointer_callbacks[MAX_EVENTS][MAX_CALLBACKS]; ! static int exec_callbacks (int event, RoadMapGuiPoint *point) { ! int i = 0; ! int res = 0; ! while ((i<MAX_CALLBACKS) && pointer_callbacks[event][i]) { ! res = (pointer_callbacks[event][i]) (point); ! if (res) break; ! i++; ! } ! return res; ! } *************** *** 79,83 **** roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! RoadMapPointerLongClick(&last_pointer_point); is_button_down = 0; } --- 71,75 ---- roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! exec_callbacks (LONG_CLICK, &last_pointer_point); is_button_down = 0; } *************** *** 92,96 **** roadmap_main_remove_periodic(roadmap_pointer_drag_flow_control); ! RoadMapPointerDragMotion(&last_pointer_point); is_drag_flow_control_on = 0; } --- 84,88 ---- roadmap_main_remove_periodic(roadmap_pointer_drag_flow_control); ! exec_callbacks (DRAG_MOTION, &last_pointer_point); is_drag_flow_control_on = 0; } *************** *** 100,104 **** last_pointer_point = *point; ! if (RoadMapPointerPressed (point)) { /* If a handler returns true dragging event is off. */ --- 92,97 ---- last_pointer_point = *point; ! if (exec_callbacks (PRESSED, point)) { ! /* If a handler returns true dragging event is off. */ *************** *** 122,126 **** } ! RoadMapPointerDragEnd(point); is_dragging = 0; is_button_down = 0; --- 115,120 ---- } ! exec_callbacks (DRAG_END, point); ! is_dragging = 0; is_button_down = 0; *************** *** 128,132 **** roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! RoadMapPointerShortClick(point); is_button_down = 0; } --- 122,126 ---- roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! exec_callbacks (SHORT_CLICK, point); is_button_down = 0; } *************** *** 144,148 **** roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! RoadMapPointerDragStart(&last_pointer_point); last_pointer_point = *point; --- 138,142 ---- roadmap_main_remove_periodic(roadmap_pointer_button_timeout); ! exec_callbacks (DRAG_START, &last_pointer_point); last_pointer_point = *point; *************** *** 163,166 **** --- 157,190 ---- + static void remove_callback (int event, void *handler) { + int i=0; + for (i=0; i<MAX_CALLBACKS; i++) { + if (pointer_callbacks[event][i] == handler) break; + } + + if (i==MAX_CALLBACKS) { + roadmap_log (ROADMAP_FATAL, "Can't find a callback to remove. Event: %d", + event); + } + + memmove (&pointer_callbacks[event][i], &pointer_callbacks[event][i+1], + sizeof(void*) * (MAX_CALLBACKS - i - 1)); + + pointer_callbacks[event][MAX_CALLBACKS - 1] = NULL; + } + + + static void queue_callback (int event, void *handler) { + if (pointer_callbacks[event][MAX_CALLBACKS-1]) { + roadmap_log (ROADMAP_FATAL, "Too many callbacks for event: %d", event); + } + + memmove (&pointer_callbacks[event][1], &pointer_callbacks[event][0], + sizeof(void*) * (MAX_CALLBACKS-1)); + + pointer_callbacks[event][0] = handler; + } + + void roadmap_pointer_initialize (void) { *************** *** 180,250 **** ! RoadMapPointerHandler roadmap_pointer_register_short_click ! (RoadMapPointerHandler handler) { ! RoadMapPointerHandler old = RoadMapPointerShortClick; ! RoadMapPointerShortClick = handler; ! return old; } ! RoadMapPointerHandler roadmap_pointer_register_long_click ! (RoadMapPointerHandler handler) { ! RoadMapPointerHandler old = RoadMapPointerLongClick; ! RoadMapPointerLongClick = handler; ! return old; } ! RoadMapPointerClickHandler roadmap_pointer_register_pressed ! (RoadMapPointerClickHandler handler) { ! RoadMapPointerClickHandler old = RoadMapPointerPressed; ! RoadMapPointerPressed = handler; ! return old; } ! RoadMapPointerHandler roadmap_pointer_register_released ! (RoadMapPointerHandler handler) { ! RoadMapPointerHandler old = RoadMapPointerReleased; ! RoadMapPointerReleased = handler; ! return old; } ! RoadMapPointerHandler roadmap_pointer_register_drag_start ! (RoadMapPointerHandler handler) { ! RoadMapPointerHandler old = RoadMapPointerDragStart; ! RoadMapPointerDragStart = handler; ! return old; } ! RoadMapPointerHandler roadmap_pointer_register_drag_motion ! (RoadMapPointerHandler handler) { ! RoadMapPointerHandler old = RoadMapPointerDragMotion; ! RoadMapPointerDragMotion = handler; ! return old; } ! RoadMapPointerHandler roadmap_pointer_register_drag_end ! (RoadMapPointerHandler handler) { ! RoadMapPointerHandler old = RoadMapPointerDragEnd; ! RoadMapPointerDragEnd = handler; ! return old; } --- 204,288 ---- ! void roadmap_pointer_register_short_click (RoadMapPointerHandler handler) { ! queue_callback (SHORT_CLICK, handler); ! } ! ! void roadmap_pointer_register_long_click (RoadMapPointerHandler handler) { ! ! queue_callback (LONG_CLICK, handler); } ! void roadmap_pointer_register_pressed (RoadMapPointerHandler handler) { ! queue_callback (PRESSED, handler); ! } ! ! void roadmap_pointer_register_released (RoadMapPointerHandler handler) { ! ! queue_callback (RELEASED, handler); } ! void roadmap_pointer_register_drag_start (RoadMapPointerHandler handler) { ! queue_callback (DRAG_START, handler); ! } ! ! void roadmap_pointer_register_drag_motion (RoadMapPointerHandler handler) { ! ! queue_callback (DRAG_MOTION, handler); } ! void roadmap_pointer_register_drag_end (RoadMapPointerHandler handler) { ! queue_callback (DRAG_END, handler); ! } ! ! void roadmap_pointer_unregister_short_click (RoadMapPointerHandler handler) { ! ! remove_callback (SHORT_CLICK, handler); } ! void roadmap_pointer_unregister_long_click (RoadMapPointerHandler handler) { ! remove_callback (LONG_CLICK, handler); ! } ! ! void roadmap_pointer_unregister_pressed (RoadMapPointerHandler handler) { ! ! remove_callback (PRESSED, handler); } ! void roadmap_pointer_unregister_released (RoadMapPointerHandler handler) { ! remove_callback (RELEASED, handler); ! } ! ! void roadmap_pointer_unregister_drag_start (RoadMapPointerHandler handler) { ! ! remove_callback (DRAG_START, handler); } ! void roadmap_pointer_unregister_drag_motion (RoadMapPointerHandler handler) { ! remove_callback (DRAG_MOTION, handler); ! } ! ! void roadmap_pointer_unregister_drag_end (RoadMapPointerHandler handler) { ! ! remove_callback (DRAG_END, handler); } |
From: Ehud S. <esh...@us...> - 2006-11-21 09:23:44
|
Update of /cvsroot/roadmap/roadmap_editor/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv5702 Modified Files: roadmap_layer.c roadmap_path.h Log Message: Skin management. Index: roadmap_layer.c =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_layer.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** roadmap_layer.c 23 Apr 2006 14:26:54 -0000 1.4 --- roadmap_layer.c 21 Nov 2006 09:23:41 -0000 1.5 *************** *** 35,38 **** --- 35,39 ---- #include "roadmap_canvas.h" #include "roadmap_plugin.h" + #include "roadmap_skin.h" #include "roadmap_layer.h" *************** *** 119,122 **** --- 120,223 ---- + static void roadmap_layer_reload (void) { + + int i; + int j; + RoadMapConfigDescriptor descriptor = ROADMAP_CONFIG_ITEM_EMPTY; + + for (i = 1; i <= RoadMapCategoryCount; ++i) { + + struct roadmap_canvas_category *category = RoadMapCategory + i; + + const char *name = RoadMapDefaultCategoryTable[i-1]; + const char *color[ROADMAP_LAYER_PENS]; + + int thickness; + int other_pens_length = strlen(name) + 64; + char *other_pens = malloc(other_pens_length); + + descriptor.category = name; + descriptor.name = "Class"; + descriptor.age = 0; + descriptor.reference = NULL; + + + /* Retrieve the category thickness & declutter. */ + + category->thickness.reference = NULL; + thickness = roadmap_config_get_integer (&category->thickness); + + category->declutter.reference = NULL; + + /* Retrieve the first pen's color (mandatory). */ + + descriptor.name = "Color"; + descriptor.reference = NULL; + + color[0] = roadmap_config_get (&descriptor); + + /* Retrieve the category's other colors (optional). */ + + for (j = 1; j < ROADMAP_LAYER_PENS; ++j) { + + snprintf (other_pens, other_pens_length, "Delta%d", j); + + descriptor.name = other_pens; + descriptor.reference = NULL; + + category->delta_thickness[j] = + roadmap_config_get_integer (&descriptor); + + if (category->delta_thickness[j] == 0) break; + + snprintf (other_pens, other_pens_length, "Color%d", j); + + descriptor.name = other_pens; + descriptor.reference = NULL; + + color[j] = roadmap_config_get (&descriptor); + + if (*color[j] == 0) break; + } + category->pen_count = j; + if (j > RoadMapMaxUsedPen) RoadMapMaxUsedPen = j; + + + /* Create all necessary pens. */ + + category->pen[0] = roadmap_canvas_create_pen (name); + + roadmap_canvas_set_thickness + (roadmap_config_get_integer (&category->thickness)); + + if (color[0] != NULL && *(color[0]) > ' ') { + roadmap_canvas_set_foreground (color[0]); + } + + for (j = 1; j < category->pen_count; ++j) { + + snprintf (other_pens, other_pens_length, "%s%d", name, j); + + category->pen[j] = roadmap_canvas_create_pen (other_pens); + + if (category->delta_thickness[j] < 0) { + thickness += category->delta_thickness[j]; + } else { + thickness = category->delta_thickness[j]; + } + + roadmap_canvas_set_foreground (color[j]); + if (thickness > 0) { + roadmap_canvas_set_thickness (thickness); + } + } + + free (other_pens); + } + + roadmap_layer_adjust (); + } + + int roadmap_layer_max_pen(void) { if (! roadmap_config_match (&RoadMapConfigStylePretty, "yes")) { *************** *** 456,460 **** --- 557,565 ---- } } + + free (other_pens); } + + roadmap_skin_register (roadmap_layer_reload); } Index: roadmap_path.h =================================================================== RCS file: /cvsroot/roadmap/roadmap_editor/src/roadmap_path.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** roadmap_path.h 15 Oct 2005 22:18:50 -0000 1.1.1.1 --- roadmap_path.h 21 Nov 2006 09:23:41 -0000 1.2 *************** *** 137,140 **** --- 137,142 ---- const char *roadmap_path_temporary (void); + int roadmap_path_is_directory (const char *name); + #endif // INCLUDE__ROADMAP_PATH__H |