diff options
| -rw-r--r-- | ci/build_linux.sh | 19 | ||||
| -rw-r--r-- | ci/build_win32.sh | 2 | ||||
| -rw-r--r-- | navit/android/AndroidManifest.xml.cmake | 10 | ||||
| -rw-r--r-- | navit/android/libs/acra-4.8.5.jar | bin | 154375 -> 0 bytes | |||
| -rwxr-xr-x | navit/android/src/org/navitproject/navit/NavitAppConfig.java | 19 | ||||
| -rw-r--r-- | navit/android/src/org/navitproject/navit/NavitVehicle.java | 16 | ||||
| -rw-r--r-- | navit/attr.c | 23 | ||||
| -rw-r--r-- | navit/map/garmin/garmintypes.txt | 4 | ||||
| -rw-r--r-- | navit/navit_shipped.xml | 6 | ||||
| -rw-r--r-- | navit/osd.c | 11 | ||||
| -rw-r--r-- | navit/osd.h | 4 | ||||
| -rw-r--r-- | navit/osd/core/osd_core.c | 93 |
12 files changed, 116 insertions, 91 deletions
diff --git a/ci/build_linux.sh b/ci/build_linux.sh index 483128558..f84d247af 100644 --- a/ci/build_linux.sh +++ b/ci/build_linux.sh @@ -11,13 +11,16 @@ pushd $BUILD_PATH if [[ "${CIRCLE_PROJECT_USERNAME}" == "navit-gps" && "${CIRCLE_BRANCH}" == "trunk" ]]; then # If we are building the official trunk code, push an update to coverity - wget --progress=dot:giga -c -O /tmp/cov-analysis-linux64-${COVERITY_VERSION}.tar.gz http://sd-55475.dedibox.fr/cov-analysis-linux64-${COVERITY_VERSION}.tar.gz + curl \ + -X POST --data "token=${COVERITY_TOKEN}&project=${CIRCLE_PROJECT_USERNAME}" \ + -o /tmp/cov-analysis-linux64-${COVERITY_VERSION}.tar.gz -s \ + https://scan.coverity.com/download/linux64 + tar xfz /tmp/cov-analysis-linux64-${COVERITY_VERSION}.tar.gz --no-same-owner -C /usr/local/share/ export PATH=/usr/local/share/cov-analysis-linux64-${COVERITY_VERSION}/bin:$PATH - cov-build --dir cov-int cmake ${cmake_opts} ../ - cov-build --dir cov-int make -j $(nproc --all) || exit -1 - cov-build --dir cov-int make -j $(nproc --all) package || exit -1 + cmake ${cmake_opts} ../ + cov-build --dir cov-int make -j $(nproc --all) tar czvf navit.tgz cov-int curl --form token=$COVERITY_TOKEN \ @@ -27,15 +30,17 @@ if [[ "${CIRCLE_PROJECT_USERNAME}" == "navit-gps" && "${CIRCLE_BRANCH}" == "trun --form description="${CIRCLE_BRANCH}-$CIRCLE_SHA1" \ https://scan.coverity.com/builds?project=$CIRCLE_PROJECT_USERNAME + make package + # Then update the translation template on launchpad sed -i '/INTEGER/d' po/navit.pot cp po/navit.pot $CIRCLE_ARTIFACTS/ curl "https://translations.launchpad.net/navit/${CIRCLE_BRANCH}/+translations-upload" -H "$lp_cookie" -H "Referer: https://translations.launchpad.net/navit/${CIRCLE_BRANCH}/+translations-upload" -F file=@po/navit.pot | grep title else - cmake ${cmake_opts} ../ || exit -1 - make -j $(nproc --all) || exit -1 - make package || exit -1 + cmake ${cmake_opts} ../ + make -j $(nproc --all) + make package fi if [[ "$CIRCLE_ARTIFACTS" != "" ]]; then diff --git a/ci/build_win32.sh b/ci/build_win32.sh index cb05c9b49..6ac301449 100644 --- a/ci/build_win32.sh +++ b/ci/build_win32.sh @@ -2,7 +2,7 @@ apt-get update && apt-get install -y mingw32 mingw32-binutils mingw32-runtime de mkdir win32 pushd win32 -cmake -Dbinding/python:BOOL=FALSE -DSAMPLE_MAP=n -DXSLTS=windows -DCMAKE_TOOLCHAIN_FILE=../Toolchain/mingw32.cmake ../ && make -j $(nproc --all) && make -j $(nproc --all) package +cmake -Dbinding/python:BOOL=FALSE -DSAMPLE_MAP=n -DBUILD_MAPTOOL=n -DXSLTS=windows -DCMAKE_TOOLCHAIN_FILE=../Toolchain/mingw32.cmake ../ && make -j $(nproc --all) && make -j $(nproc --all) package popd cp win32/*.exe $CIRCLE_ARTIFACTS/ diff --git a/navit/android/AndroidManifest.xml.cmake b/navit/android/AndroidManifest.xml.cmake index 7aa882bb8..b5bd757cb 100644 --- a/navit/android/AndroidManifest.xml.cmake +++ b/navit/android/AndroidManifest.xml.cmake @@ -37,15 +37,5 @@ <activity android:name=".NavitDownloadSelectMapActivity"></activity> <activity android:name=".NavitAddressResultListActivity"></activity> <activity android:name=".FileBrowserActivity"></activity> - <activity - android:name="org.acra.dialog.CrashReportDialog" - android:theme="@android:style/Theme.Dialog" - android:launchMode="singleInstance" - android:excludeFromRecents="true" - android:finishOnTaskLaunch="true"/> - <service - android:name="org.acra.sender.SenderService" - android:exported="false" - android:process=":acra" /> </application> </manifest> diff --git a/navit/android/libs/acra-4.8.5.jar b/navit/android/libs/acra-4.8.5.jar Binary files differdeleted file mode 100644 index f0044ece8..000000000 --- a/navit/android/libs/acra-4.8.5.jar +++ /dev/null diff --git a/navit/android/src/org/navitproject/navit/NavitAppConfig.java b/navit/android/src/org/navitproject/navit/NavitAppConfig.java index 13ccc9bb4..1a1a61f94 100755 --- a/navit/android/src/org/navitproject/navit/NavitAppConfig.java +++ b/navit/android/src/org/navitproject/navit/NavitAppConfig.java @@ -8,13 +8,7 @@ import org.navitproject.navit.NavitAddressSearchActivity.NavitAddress; import android.app.Application;
import android.content.SharedPreferences;
import android.util.Log;
-import org.acra.*;
-import org.acra.annotation.*;
-//@ReportsCrashes(formKey = "dGlrNVRIOVVKYjB0UGVoLUZPanlzWFE6MQ")
-@ReportsCrashes(mailTo = "android@navit-project.org",
- mode = ReportingInteractionMode.TOAST,
- resToastText = R.string.app_name)
public class NavitAppConfig extends Application {
@@ -27,19 +21,6 @@ public class NavitAppConfig extends Application { @Override
public void onCreate() {
- // call ACRA.init(this) as reflection, because old ant may forgot to include it
- try {
- Class<?> acraClass = Class.forName("org.acra.ACRA");
- Class<?> partypes[] = new Class[1];
- partypes[0] = Application.class;
- java.lang.reflect.Method initMethod = acraClass.getMethod("init", partypes);
- Object arglist[] = new Object[1];
- arglist[0] = this;
- initMethod.invoke(null, arglist);
- } catch (Exception e1) {
- Log.e(TAG, "Could not init ACRA crash reporter");
- }
-
mSettings = getSharedPreferences(Navit.NAVIT_PREFS, MODE_PRIVATE);
super.onCreate();
}
diff --git a/navit/android/src/org/navitproject/navit/NavitVehicle.java b/navit/android/src/org/navitproject/navit/NavitVehicle.java index 313502b96..e1a9c70f1 100644 --- a/navit/android/src/org/navitproject/navit/NavitVehicle.java +++ b/navit/android/src/org/navitproject/navit/NavitVehicle.java @@ -20,11 +20,12 @@ package org.navitproject.navit; import java.util.List; - +import android.Manifest; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.pm.PackageManager; import android.location.Criteria; import android.location.GpsSatellite; import android.location.GpsStatus; @@ -33,6 +34,9 @@ import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; +import android.support.v4.content.ContextCompat; + + public class NavitVehicle { @@ -76,6 +80,11 @@ public class NavitVehicle { * Called when the status of the GPS changes. */ public void onGpsStatusChanged (int event) { + if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION) + != PackageManager.PERMISSION_GRANTED) { + // Permission is not granted + return; + } GpsStatus status = sLocationManager.getGpsStatus(null); int satsInView = 0; int satsUsed = 0; @@ -110,6 +119,11 @@ public class NavitVehicle { * {@code android.location.GPS_FIX_CHANGE} is received, indicating a change in GPS fix status */ NavitVehicle (Context context, int pcbid, int scbid, int fcbid) { + if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION) + != PackageManager.PERMISSION_GRANTED) { + // Permission is not granted + return; + } this.context = context; sLocationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE); preciseLocationListener = new NavitLocationListener(); diff --git a/navit/attr.c b/navit/attr.c index 86bc29489..18ad79f64 100644 --- a/navit/attr.c +++ b/navit/attr.c @@ -605,7 +605,8 @@ attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_ty * contain an attribute whose type matches that of the new one, the new * attribute is inserted into the list. * - * @param attrs Points to the array of attribute pointers to be updated + * @param attrs Points to the array of attribute pointers to be updated (if NULL, this function will + * create a new list containing only the new attribute) * @param attr The new attribute. * @return Pointer to the updated attribute list */ @@ -902,6 +903,15 @@ attr_dup(struct attr *attr) return ret; } +/** + * @brief Frees a list of attributes. + * + * This frees the pointer array as well as the attributes referenced by the pointers. + * + * It is safe to call this function with a NULL argument; doing so is a no-op. + * + * @param attrs The attribute list to free + */ void attr_list_free(struct attr **attrs) { @@ -912,6 +922,17 @@ attr_list_free(struct attr **attrs) g_free(attrs); } +/** + * @brief Duplicates a list of attributes. + * + * This creates a deep copy, i.e. the attributes in the list are copied as well. + * + * It is safe to call this function with a NULL argument; in this case, NULL will be returned. + * + * @param attrs The attribute list to copy + * + * @return The copy of the attribute list + */ struct attr ** attr_list_dup(struct attr **attrs) { diff --git a/navit/map/garmin/garmintypes.txt b/navit/map/garmin/garmintypes.txt index 1fca9ddfa..f8a49c532 100644 --- a/navit/map/garmin/garmintypes.txt +++ b/navit/map/garmin/garmintypes.txt @@ -438,7 +438,7 @@ POINT 1, 0x100b = poi_car_parking, Parking 1, 0x100d = poi_car_dealer_parts, Car Dealer(point) 1, 0x100e = poi_car_wash, Car Wash -1, 0x1011 = poi_bussines_service, Business Service +1, 0x1011 = poi_business_service, Business Service 1, 0x1012 = poi_communication, Communication 1, 0x1013 = poi_repair_service, Repair Service 1, 0x1014 = poi_social_service, Social Service @@ -464,7 +464,7 @@ POINT 1, 0x140c = town_label_1e0, Village (100-200) 1, 0x140d = town_label_0e0, Village (0-100) 1, 0x1500 = poi_personal_service, Personal Service -1, 0x1501 = poi_bussines_service, Bussines Service +1, 0x1501 = poi_business_service, Business Service POLYLINE diff --git a/navit/navit_shipped.xml b/navit/navit_shipped.xml index c605a4408..3a645fbc2 100644 --- a/navit/navit_shipped.xml +++ b/navit/navit_shipped.xml @@ -2021,7 +2021,7 @@ Waypoint</text></img> <icon src="bus_stop.png"/> </itemgra> <itemgra item_types="poi_business_service" order="12-"> - <icon src="bussines_service.xpm"/> + <icon src="business_service.xpm"/> </itemgra> <itemgra item_types="poi_car_rent" order="12-"> <icon src="car_rent.png"/> @@ -3760,7 +3760,7 @@ Waypoint</text></img> <icon src="bus_stop.png"/> </itemgra> <itemgra item_types="poi_business_service" order="0-"> - <icon src="bussines_service.xpm"/> + <icon src="business_service.xpm"/> </itemgra> <itemgra item_types="poi_car_rent" order="11-"> <icon src="car_rent.png"/> @@ -5146,7 +5146,7 @@ Waypoint</text></img> <icon src="bus_stop.png" /> </itemgra> <itemgra item_types="poi_business_service" order="12-"> - <icon src="bussines_service.png" /> + <icon src="business_service.png" /> </itemgra> <itemgra item_types="poi_car_rent" order="12-"> <icon src="car_rent.png" /> diff --git a/navit/osd.c b/navit/osd.c index a0c9183d1..f2ac701d1 100644 --- a/navit/osd.c +++ b/navit/osd.c @@ -292,7 +292,7 @@ osd_std_reconfigure(struct osd_item *item, struct command_saved *cs) dbg(lvl_debug, "enter, item=%p, cs=%p\n", item, cs); if (!command_saved_error(cs)) { item->configured = !! command_saved_get_int(cs); - if (item->gr && !(item->flags & 16)) + if (item->gr && !(item->flags & DISABLE_OVERLAY)) graphics_overlay_disable(item->gr, !item->configured); } else { err = command_error_to_text(command_saved_error(cs)); @@ -305,7 +305,6 @@ void osd_set_std_attr(struct attr **attrs, struct osd_item *item, int flags) { struct attr *attr; - item->flags=flags; item->osd_configuration=-1; item->color_fg.r = 0xffff; @@ -316,7 +315,8 @@ osd_set_std_attr(struct attr **attrs, struct osd_item *item, int flags) item->text_color.g = 0xffff; item->text_color.b = 0xffff; item->text_color.a = 0xffff; - if (flags & 1) { + + if (flags & TRANSPARENT_BG) { item->color_bg.r = 0x0808; item->color_bg.g = 0x0808; item->color_bg.b = 0xf8f8; @@ -404,7 +404,8 @@ osd_std_config(struct osd_item *item, struct navit *navit) attr.u.num=-1; item->configured = !!(attr.u.num & item->osd_configuration); } - if (item->gr && !(item->flags & 16)) + + if (item->gr && !(item->flags & DISABLE_OVERLAY)) graphics_overlay_disable(item->gr, !item->configured); } @@ -475,7 +476,7 @@ osd_set_std_graphic(struct navit *nav, struct osd_item *item, struct osd_priv *p item->graphic_fg = graphics_gc_new(item->gr); graphics_gc_set_foreground(item->graphic_fg, &item->color_fg); - if (item->flags & 2) { + if (item->flags & ITEM_HAS_TEXT) { item->font = graphics_named_font_new(item->gr, item->font_name, item->font_size, 1); item->graphic_fg_text = graphics_gc_new(item->gr); graphics_gc_set_foreground(item->graphic_fg_text, &item->text_color); diff --git a/navit/osd.h b/navit/osd.h index 38fa0e5ff..8694bcd05 100644 --- a/navit/osd.h +++ b/navit/osd.h @@ -23,6 +23,10 @@ struct osd_priv; struct attr; +#define TRANSPARENT_BG 1 +#define ITEM_HAS_TEXT 2 +#define DISABLE_OVERLAY 4 + struct osd_methods { void (*osd_destroy)(struct osd_priv *osd); int (*set_attr)(struct osd_priv *osd, struct attr* attr); diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c index d3bf66a76..aca868f1d 100644 --- a/navit/osd/core/osd_core.c +++ b/navit/osd/core/osd_core.c @@ -539,7 +539,8 @@ osd_route_guard_new(struct navit *nav, struct osd_methods *meth, opc->osd_item.font_size = 200; opc->osd_item.meth.draw = osd_draw_cast(osd_route_guard_draw); meth->set_attr = set_std_osd_attr; - osd_set_std_attr(attrs, &opc->osd_item, 2); + + osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); attr = attr_search(attrs, NULL, attr_min_dist); if (attr) { @@ -1153,7 +1154,7 @@ osd_odometer_new(struct navit *nav, struct osd_methods *meth, if (attr) this->align=attr->u.num; - osd_set_std_attr(attrs, &opc->osd_item, 2); + osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); attr = attr_search(attrs, NULL, attr_width); this->width=attr ? attr->u.num : 2; attr = attr_search(attrs, NULL, attr_idle_color); @@ -1334,7 +1335,7 @@ osd_cmd_interface_new(struct navit *nav, struct osd_methods *meth, opc->spec_set_attr_func = osd_cmd_interface_set_attr; meth->set_attr = set_std_osd_attr; - osd_set_std_attr(attrs, &opc->osd_item, 2); + osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); attr = attr_search(attrs, NULL, attr_width); this->width=attr ? attr->u.num : 2; @@ -1498,7 +1499,7 @@ osd_stopwatch_new(struct navit *nav, struct osd_methods *meth, this->sum_time = 0; this->last_click_time = 0; - osd_set_std_attr(attrs, &opc->osd_item, 2); + osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); attr = attr_search(attrs, NULL, attr_width); this->width=attr ? attr->u.num : 2; attr = attr_search(attrs, NULL, attr_idle_color); @@ -1615,7 +1616,7 @@ osd_compass_new(struct navit *nav, struct osd_methods *meth, opc->osd_item.font_size = 200; opc->osd_item.meth.draw = osd_draw_cast(osd_compass_draw); meth->set_attr = set_std_osd_attr; - osd_set_std_attr(attrs, &opc->osd_item, 2); + osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); attr = attr_search(attrs, NULL, attr_width); this->width=attr ? attr->u.num : 2; attr = attr_search(attrs, NULL, attr_destination_dir_color); @@ -1820,7 +1821,8 @@ osd_button_new(struct navit *nav, struct osd_methods *meth, attr=attr_search(attrs, NULL, attr_use_overlay); if (attr) this->use_overlay=attr->u.num; - osd_set_std_attr(attrs, &opc->osd_item, this->use_overlay ? 1:(1|16)); + + osd_set_std_attr(attrs, &opc->osd_item, this->use_overlay ? TRANSPARENT_BG:(TRANSPARENT_BG|DISABLE_OVERLAY)); if (!opc->osd_item.command) { dbg(lvl_error, "no command\n"); @@ -1878,7 +1880,7 @@ osd_image_init(struct osd_priv_common *opc, struct navit *nav) graphics_draw_mode(opc->osd_item.gr, draw_mode_end); graphics_image_free(opc->osd_item.gr, img); } else { - opc->osd_item.configured=1; + osd_set_std_config(nav, &opc->osd_item); opc->osd_item.gr=gra; opc->osd_item.graphic_bg=graphics_gc_new(opc->osd_item.gr); graphics_add_callback(gra, this->draw_cb=callback_new_attr_2(callback_cast(osd_button_draw), attr_postdraw, opc, nav)); @@ -1903,11 +1905,13 @@ osd_image_new(struct navit *nav, struct osd_methods *meth, meth->set_attr = set_std_osd_attr; opc->spec_set_attr_func = osd_button_set_attr; - osd_set_std_attr(attrs, &opc->osd_item, 1); - attr=attr_search(attrs, NULL, attr_use_overlay); if (attr) this->use_overlay=attr->u.num; + + + osd_set_std_attr(attrs, &opc->osd_item, this->use_overlay ? TRANSPARENT_BG:(TRANSPARENT_BG|DISABLE_OVERLAY)); + attr = attr_search(attrs, NULL, attr_src); if (!attr) { dbg(lvl_error, "no src\n"); @@ -2238,6 +2242,7 @@ osd_nav_next_turn_new(struct navit *nav, struct osd_methods *meth, opc->osd_item.font_size = 200; opc->osd_item.meth.draw = osd_draw_cast(osd_nav_next_turn_draw); meth->set_attr = set_std_osd_attr; + osd_set_std_attr(attrs, &opc->osd_item, 0); this->icon_w = -1; @@ -2666,7 +2671,7 @@ osd_speed_cam_new(struct navit *nav, struct osd_methods *meth, struct attr **att opc->osd_item.meth.draw = osd_draw_cast(osd_speed_cam_draw); meth->set_attr = set_std_osd_attr; - osd_set_std_attr(attrs, &opc->osd_item, 2); + osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); attr = attr_search(attrs, NULL, attr_width); this->width=attr ? attr->u.num : 2; attr = attr_search(attrs, NULL, attr_idle_color); @@ -2964,7 +2969,8 @@ osd_speed_warner_new(struct navit *nav, struct osd_methods *meth, struct attr ** this->announce_on = attr->u.num; else this->announce_on = 1; //announce by default - osd_set_std_attr(attrs, &opc->osd_item, 2); + + osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_speed_warner_init), attr_graphics_ready, opc)); return (struct osd_priv *) opc; } @@ -3604,7 +3610,7 @@ osd_text_new(struct navit *nav, struct osd_methods *meth, opc->osd_item.meth.draw = osd_draw_cast(osd_text_draw); meth->set_attr = set_std_osd_attr; opc->spec_set_attr_func = osd_text_set_attr; - osd_set_std_attr(attrs, &opc->osd_item, 2); + osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); this->active = -1; this->last = NULL; @@ -3717,6 +3723,7 @@ osd_gps_status_new(struct navit *nav, struct osd_methods *meth, opc->osd_item.font_size = 200; opc->osd_item.meth.draw = osd_draw_cast(osd_gps_status_draw); meth->set_attr = set_std_osd_attr; + osd_set_std_attr(attrs, &opc->osd_item, 0); this->icon_w = -1; @@ -3827,6 +3834,7 @@ osd_volume_new(struct navit *nav, struct osd_methods *meth, opc->osd_item.font_size = 200; opc->osd_item.meth.draw = osd_draw_cast(osd_volume_draw); meth->set_attr = set_std_osd_attr; + osd_set_std_attr(attrs, &opc->osd_item, 0); this->icon_w = -1; @@ -3901,14 +3909,12 @@ osd_scale_draw(struct osd_priv_common *opc, struct navit *nav) if (!navit_get_attr(nav, attr_transformation, &transformation, NULL)) return; - if (this->use_overlay) { - graphics_draw_mode(opc->osd_item.gr, draw_mode_begin); - item_pos.x=0; - item_pos.y=0; - graphics_draw_rectangle(opc->osd_item.gr, opc->osd_item.graphic_bg, &item_pos, opc->osd_item.w, opc->osd_item.h); - } else { - item_pos=opc->osd_item.p; - } + + graphics_draw_mode(opc->osd_item.gr, draw_mode_begin); + item_pos.x=0; + item_pos.y=0; + graphics_draw_rectangle(opc->osd_item.gr, opc->osd_item.graphic_bg, &item_pos, opc->osd_item.w, opc->osd_item.h); + scale_line_start=item_pos; scale_line_start.y+=opc->osd_item.h/2; scale_line_start.x+=(opc->osd_item.w-width_reduced)/2; @@ -3943,14 +3949,14 @@ osd_scale_draw(struct osd_priv_common *opc, struct navit *nav) graphics_draw_rectangle(opc->osd_item.gr, opc->osd_item.graphic_fg, p+6, 4,opc->osd_item.h/5+4); graphics_draw_rectangle(opc->osd_item.gr, opc->osd_item.graphic_fg, p+7, p[1].x-p[0].x, 4); graphics_draw_rectangle(opc->osd_item.gr, opc->osd_item.graphic_fg, p+8, 4,opc->osd_item.h/5+4); - graphics_draw_lines(opc->osd_item.gr, this->black, p, 2); - graphics_draw_lines(opc->osd_item.gr, this->black, p+2, 2); - graphics_draw_lines(opc->osd_item.gr, this->black, p+4, 2); + graphics_draw_lines(opc->osd_item.gr, opc->osd_item.graphic_fg_text, p, 2); + graphics_draw_lines(opc->osd_item.gr, opc->osd_item.graphic_fg_text, p+2, 2); + graphics_draw_lines(opc->osd_item.gr, opc->osd_item.graphic_fg_text, p+4, 2); text=format_distance(scale_length_on_map, "", imperial); graphics_get_text_bbox(opc->osd_item.gr, opc->osd_item.font, text, 0x10000, 0, bbox, 0); p[0].x=(opc->osd_item.w-bbox[2].x)/2+item_pos.x; p[0].y=item_pos.y+opc->osd_item.h-opc->osd_item.h/10; - graphics_draw_text(opc->osd_item.gr, this->black, opc->osd_item.graphic_fg, opc->osd_item.font, text, &p[0], 0x10000, 0); + graphics_draw_text(opc->osd_item.gr, opc->osd_item.graphic_fg_text, opc->osd_item.graphic_fg, opc->osd_item.font, text, &p[0], 0x10000, 0); g_free(text); if (this->use_overlay) graphics_draw_mode(opc->osd_item.gr, draw_mode_end); @@ -3961,19 +3967,25 @@ osd_scale_init(struct osd_priv_common *opc, struct navit *nav) { struct osd_scale *this = (struct osd_scale *)opc->data; - struct color color_black={COLOR_BLACK_}; struct graphics *gra = navit_get_graphics(nav); - dbg(lvl_debug, "enter\n"); - if (this->use_overlay) { - osd_set_std_graphic(nav, &opc->osd_item, (struct osd_priv *)opc); - } else { - opc->osd_item.configured=1; - opc->osd_item.gr=gra; - opc->osd_item.font = graphics_font_new(opc->osd_item.gr, opc->osd_item.font_size, 1); - opc->osd_item.graphic_fg=graphics_gc_new(opc->osd_item.gr); + + struct color transparent = {0,0,0,0}; + + opc->osd_item.color_fg.r = 0xffff-opc->osd_item.text_color.r; + opc->osd_item.color_fg.g = 0xffff-opc->osd_item.text_color.g; + opc->osd_item.color_fg.b = 0xffff-opc->osd_item.text_color.b; + opc->osd_item.color_fg.a = 0xffff-opc->osd_item.text_color.a; + + + if(COLOR_IS_SAME(opc->osd_item.color_fg, transparent)){ + opc->osd_item.color_fg.r = 0x1111; + opc->osd_item.color_fg.g = 0x1111; + opc->osd_item.color_fg.b = 0x1111; + opc->osd_item.color_fg.a = 0x1111; } - this->black=graphics_gc_new(opc->osd_item.gr); - graphics_gc_set_foreground(this->black, &color_black); + + osd_set_std_graphic(nav, &opc->osd_item, (struct osd_priv *)opc); + graphics_add_callback(gra, this->draw_cb=callback_new_attr_2(callback_cast(osd_scale_draw), attr_postdraw, opc, nav)); if (navit_get_ready(nav) == 3) osd_scale_draw(opc, nav); @@ -3988,17 +4000,13 @@ osd_scale_new(struct navit *nav, struct osd_methods *meth, struct attr *attr; opc->data = (void*)this; - + opc->osd_item.font_size = 200; opc->osd_item.navit = nav; opc->osd_item.meth.draw = osd_draw_cast(osd_scale_draw); meth->set_attr = set_std_osd_attr; - osd_set_std_attr(attrs, &opc->osd_item, 3); - - attr=attr_search(attrs, NULL, attr_use_overlay); - if (attr) - this->use_overlay=attr->u.num; - + osd_set_std_attr(attrs, &opc->osd_item, TRANSPARENT_BG | ITEM_HAS_TEXT); + navit_add_callback(nav, this->navit_init_cb = callback_new_attr_1(callback_cast (osd_scale_init), attr_graphics_ready, opc)); return (struct osd_priv *) opc; @@ -4108,6 +4116,7 @@ osd_auxmap_new(struct navit *nav, struct osd_methods *meth, struct attr **attrs) opc->osd_item.rel_h = 40; opc->osd_item.font_size = 200; meth->set_attr = set_std_osd_attr; + osd_set_std_attr(attrs, &opc->osd_item, 0); navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_auxmap_init), attr_navit, opc)); |
