diff options
author | mvglasow <michael -at- vonglasow.com> | 2021-01-23 23:40:08 +0200 |
---|---|---|
committer | mvglasow <michael -at- vonglasow.com> | 2021-01-23 23:40:08 +0200 |
commit | d5f9db8cd63398ee8a42e80e4381d4f1a35b2116 (patch) | |
tree | c89cd6957f89083b41a26bac5571d027baacfc62 | |
parent | 9a96b0907272069ce60d08436255936cd1ca2f87 (diff) | |
parent | 91222b892b2f796b8c18dff13eb15f888b276f3b (diff) | |
download | navit-d5f9db8cd63398ee8a42e80e4381d4f1a35b2116.tar.gz |
Merge branch 'master' into traff_0_8
# Conflicts:
# navit/android/AndroidManifest.xml.cmake
94 files changed, 1619 insertions, 417 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index f1c2c6f30..9e4c7f88a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -219,13 +219,11 @@ jobs: command: | bash scripts/update_download_center.sh merge_trunk_in_master: - <<: *defaults + docker: + - image: cimg/base:2020.01 steps: - checkout - run: - name: Install git - command: apt-get update && apt-get -y install ca-certificates git - - run: name: configure ssh git command: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts - add_ssh_keys: @@ -1,11 +1,14 @@ # Active contributors: +Benjamin Davies Bignaux Ronan Charles Curley +David Heidelberg +emaiannone gefin jandegr jkoan +Johan Fitié Joseph Herlant -KAMiKAZOW lains Lionel AINS metalstrolch @@ -15,9 +18,6 @@ Patrick Höhn Pierre Grandin Robert Pohlink Stefan Wildemann -tengel -Timo -youte62 # Retired contributors: afaber @@ -38,7 +38,7 @@ gotwo greg hafting hawke666 -Johan Fitié +KAMiKAZOW kelvinzhao klausg korrosa @@ -65,10 +65,13 @@ singesang spaetz steven_s tegzed +tengel +Timo tinloaf trldp woglinde worldcitizen +youte62 zaxl zintor zoff99 diff --git a/CHANGELOG.md b/CHANGELOG.md index fe557eac9..ef152205c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ Navit follows the semantic versioning: replacement for the previous version (all data formats and interfaces are still supported); minor UI changes (such as moving individual menu items) are also allowed -* `X.y.z` (major): at least one of the following: +* X.y.z (major): at least one of the following: * Major new functionality (such as Augmented Reality, inertial navigation or support for live traffic services): de-facto standard for end-user apps * New user interface (such as moving from the old pulldown menu UI to the Internal @@ -27,7 +27,72 @@ Navit follows the semantic versioning: ## [Unreleased] To get the list of all the unreleased commits, see: -[Full Changelog](https://github.com/navit-gps/navit/compare/v0.5.4...HEAD) +[Full Changelog](https://github.com/navit-gps/navit/compare/v0.5.5...HEAD) + + +## [0.5.5] - 2020-08-08 + +## Added + +* Add poly\_swimming\_pool. [Stefan Wildemann] +* Add:maptool:enhance leisure=track handling and add poi\_archeaological\_site (#1005) [Stefan Wildemann] +* Add:graphics:gtk\_drawing\_area:textured polygons (#1004) [Stefan Wildemann] +* Add:maptool:add waterway=weir as poly\_dam to map. [Stefan Wildemann] +* Add:layout:add textures for quarry and scrub. (#997) [Stefan Wildemann] +* Add:Core:Add mapfeatures (#990) [Stefan Wildemann] +* Add:Core+Graphics+Qt5:Add support for textured polygons (#989) [Stefan Wildemann] +* Add:build:Android build and signing. Also add fastlane for metadata. Set execute on scripts/\*.sh. [jkoan] +* Add:cmake: add compilation flags to harden the security of navit (#969) [Joseph Herlant] + +## Changed + +* Change:core:Remove unused argument from attr\_search. [jkoan] +* Change\_layout:Make sure park, meadow, scrub, and wood render in correct order (#1017) [Johan Fitié] +* Change:style:Reformated style to match gradle. [jkoan] +* Change:core:Reformat all files for ci check (even those i havent touched) [jkoan] +* Change:fastlane:Remove tailing whitespaces from files. [jkoan] +* Change:android:build:Fix empty Variable handling. [jkoan] +* Change:metadata:Rename Title to "Navit" only because everybody knows that its for Android when found within F-Droid or Google Play store. [jkoan] + +## Fixed + +* Android:Remove old, confusing AndroidManifest.xml. [jkoan] +* Android:Readd android:sharedUserId to allow for Updates. [jkoan] +* Readme:Fixed broken link #914 (#1031) [Benjamin Davies] +* Maptool:better map aerodroms and military areas (#1022) [Stefan Wildemann] +* Maptool:Duplicte multipolygons if required (#1019) [Stefan Wildemann] +* Layout:Order Parking (can be covered by Meadow, Wood) and Playground (can cover Meadow) (#1023) [Johan Fitié] +* Build:android: Don't sign apk if no valid keyring is available. [Stefan Wildemann] +* Icons:Update svgz files to be valid for librsvg \> 2.47 (#991) [jkoan] +* POI/poly/labels:Small visual improvements to POI order, poly colors, and labels (#993) [Johan Fitié] +* Android:build:Check if Variables are filled before useing them to avoid errors. [jkoan] +* Metadata:Move Screenshots with German text to German translation. [jkoan] +* Metadata:Rename directorys to prepare for Translations. [jkoan] +* Build:versioncode needs to use 24h format. [jkoan] +* Build:Only master, not all others :D booleans. [jkoan] +* Gui:qml:Fix format string. [jkoan] +* Gui:qml:Add missing NULL to vehicle\_attr\_iter\_new. [jkoan] +* Change:Disable CXX on the the build\_script as well. [jkoan] +* Android:build:css is the other way around, so enable the disable. [jkoan] +* Build:Fdroid buildenviroment has no CXX and failes doue to this/CXX not needed anyway. [jkoan] +* Graphics/android: polygons with hole drawing (#973) [Stefan Wildemann] +* Plugins: too few arguments to functions navit\_attr\_iter\_new and config\_attr\_iter\_new (#966) [Joseph Herlant] +* Port/android:Use new icon for notification (#963) [mvglasow] + +## Other + +* Android: Activate downloaded maps automatically (#1027) [Johan Fitié] +* Improvement:layout:car-dark Improve Car-Dark layout colors (#1028) [Johan Fitié] +* Improvement:layout: Improve Car Dark layout colors, bring all layers up to date with Car Light, automate changes in all layers with script (#1026) [Johan Fitié] +* Improve:layout Improve Car Dark layout polygon colors, bring up to date with Car Light polys, automate changes with script (#1025) [Johan Fitié] +* Improvement:layout: Small color tweaks and added polylines (#1024) [Johan Fitié] +* Enhancement:layout\_car:Add stripes to danger\_area (#1020) [Stefan Wildemann] +* Make sure industry, sport, meadow, scrub, and cemetery render in correct order (#1021) [Johan Fitié] +* Refactor Member Ignoring Method smell in NavitMapDownloader class. [emaiannone] +* Treat sports\_centres as building if building=yes. [Stefan Wildemann] +* Refactoring:GTK: use GDK\_KEY for keys instead of GDK\_ [David Heidelberg] +* Improve layout (#1002) [Johan Fitié] +* Use debian:latest in the CI to get more up-to-date tools (#971) [Joseph Herlant] ## [0.5.4] - 2020-01-18 diff --git a/CMakeLists.txt b/CMakeLists.txt index 362937200..305229c30 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ endif(NOT DISABLE_CXX) set(NAVIT_VERSION_MAJOR "0") set(NAVIT_VERSION_MINOR "5") -set(NAVIT_VERSION_PATCH "4") +set(NAVIT_VERSION_PATCH "5") if(ANDROID) set(PACKAGE_VERSION "${NAVIT_VERSION_MAJOR}.${NAVIT_VERSION_MINOR}.${NAVIT_VERSION_PATCH}.${ANDROID_ABI}") else(ANDROID) @@ -103,9 +103,11 @@ add_module(graphics/sdl "Required library not found" FALSE) add_module(graphics/egl "Required library not found" FALSE) add_module(graphics/qt_qpainter "Qt libraries not found" FALSE) add_module(graphics/qt5 "Qt5 libraries not found" FALSE) +add_module(graphics/svg_debug "native Glib not found" FALSE) add_module(gui/qml "Qt Declarative not found" FALSE) add_module(gui/qt5_qml "Qt5 Declarative not found" FALSE) add_module(gui/gtk "GTK libs not found" FALSE) +add_module(vehicle/geoclue "geoclue lib not found" FALSE) add_module(vehicle/gpsd "gpsd lib not found" FALSE) add_module(vehicle/gypsy "gypsy lib not found" FALSE) add_module(vehicle/maemo "Default" FALSE) @@ -197,6 +199,13 @@ if(PKG_CONFIG_FOUND) if(IMLIB2_FOUND) set(HAVE_IMLIB2 1) endif(IMLIB2_FOUND) + + # Geoclue + pkg_check_modules ( GeoClue libgeoclue-2.0 ) + if(GeoClue_FOUND) + include_directories(${GeoClue_INCLUDE_DIRS}) + set_with_reason(vehicle/geoclue "libgeoclue found" TRUE ${GeoClue_INCLUDE_DIRS}) + endif(GeoClue_FOUND) else(PKG_CONFIG_FOUND) set_with_reason(support/glib "Glib not found" TRUE ${INTL_LIBS}) endif(PKG_CONFIG_FOUND) @@ -317,7 +326,10 @@ if (NOT HAVE_WORDEXP) endif() if (NOT GLIB2_FOUND) set_with_reason(support/ezxml "Glib not found" TRUE) -endif() +else(NOT GLIB2_FOUND) + set_with_reason(graphics/svg_debug "Glib found" TRUE) +endif(NOT GLIB2_FOUND) + if(FREETYPE_FOUND) pkg_check_modules(FRIBIDI fribidi) @@ -58,7 +58,7 @@ are known to work: (see http://wiki.navit-project.org/index.php/OpenStreetMap) - Grosser Reiseplaner and compliant maps: full support - (see http://wiki.navit-project.org/index.php/European_maps) + (see http://wiki.navit-project.org/index.php/Marco_Polo_Grosser_Reiseplaner) - Garmin maps: display, routing, search is being worked on (see http://wiki.navit-project.org/index.php/Garmin_maps) diff --git a/checkstyle.xml b/checkstyle.xml index 8a19f6944..96f871666 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -59,9 +59,6 @@ <property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> </module> - <module name="NeedBraces"> - <property name="severity" value="error"/> - </module> <module name="LeftCurly"/> <module name="RightCurly"> <property name="id" value="RightCurlySame"/> @@ -141,7 +138,7 @@ <property name="severity" value="error"/> </module> <module name="MemberName"> - <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> <message key="name.invalidPattern" value="Member name ''{0}'' must match pattern ''{1}''."/> <property name="severity" value="error"/> @@ -211,7 +208,6 @@ <property name="allowedAbbreviationLength" value="3"/> </module> <module name="OverloadMethodsDeclarationOrder"/> - <module name="VariableDeclarationUsageDistance"/> <module name="CustomImportOrder"> <property name="sortImportsInGroupAlphabetically" value="true"/> <property name="separateLineBetweenGroups" value="true"/> diff --git a/contrib/sailfish/navit-sailfish.spec b/contrib/sailfish/navit-sailfish.spec index 8091533c3..e2b49aea2 100755 --- a/contrib/sailfish/navit-sailfish.spec +++ b/contrib/sailfish/navit-sailfish.spec @@ -9,7 +9,7 @@ Name: harbour-navit Summary: Open Source car navigation system #Version: %{navit_version}_%{git_version} -Version: 0.5.4 +Version: 0.5.5 Release: 1 License: GPL Group: Applications/Productivity diff --git a/gradle/scripts/git-scm-version.gradle b/gradle/scripts/git-scm-version.gradle index 685c95ed8..c6a7cfa09 100644 --- a/gradle/scripts/git-scm-version.gradle +++ b/gradle/scripts/git-scm-version.gradle @@ -15,7 +15,11 @@ import java.time.format.DateTimeFormatter ext { git = Grgit.open(currentDir: projectDir) gitVersionName = git.describe(match: ["v[0-9.rc]*"]) - gitVersionCode = Integer.parseInt(DateTimeFormatter.ofPattern("yyMMddHHmm").format(git.head().dateTime)) + hh = Integer.parseInt(DateTimeFormatter.ofPattern("HH").format(git.head().dateTime)) + mm = Integer.parseInt(DateTimeFormatter.ofPattern("mm").format(git.head().dateTime)) + hhmm = Math.round((hh*4)+(mm/15)).toString() + yyyyMMdd = DateTimeFormatter.ofPattern("yyyyMMdd").format(git.head().dateTime) + gitVersionCode = Integer.parseInt(yyyyMMdd + hhmm) } task printVersion() { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 25f587d12..7292aa85e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,3 +3,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip +distributionSha256Sum=33214524e686838c88a88e14e8b30e2323589cc9698186bc8e0594758b132b31 diff --git a/navit/android/AndroidManifest.xml b/navit/android/AndroidManifest.xml index 019b22fa3..b9e646097 100644 --- a/navit/android/AndroidManifest.xml +++ b/navit/android/AndroidManifest.xml @@ -1,12 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.navitproject.navit" + android:sharedUserId="org.navitproject.navit" android:installLocation="auto"> <uses-feature android:name="android.hardware.location.network" android:required="false"/> <uses-feature android:name="android.hardware.touchscreen" android:required="false"/> <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:resizeable="true" android:anyDensity="true"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> diff --git a/navit/android/AndroidManifest.xml.cmake b/navit/android/AndroidManifest.xml.cmake deleted file mode 100644 index f7abd5240..000000000 --- a/navit/android/AndroidManifest.xml.cmake +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.navitproject.navit" - android:sharedUserId="org.navitproject.navit" - android:versionCode="@ANDROID_VERSION_INT@" - android:versionName="@ANDROID_VERSION_NAME@-@ANDROID_VERSION_INT@" - android:installLocation="auto"> - <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="@ANDROID_API_VERSION@"/> - <uses-feature android:name="android.hardware.location.network" android:required="false"/> - <uses-feature android:name="android.hardware.touchscreen" android:required="false"/> - <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:resizeable="true" android:anyDensity="true"/> - @ANDROID_PERMISSIONS@ - <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> - <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> - <uses-permission android:name="android.permission.WAKE_LOCK" /> - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> - <application android:label="@string/app_name" - android:icon="@mipmap/ic_laucher" - android:name=".NavitAppConfig" - android:theme="@style/NavitBaseTheme"> - <activity android:name="Navit" - android:label="@string/app_name" - android:configChanges="locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|fontScale|screenSize" - android:theme="@style/NavitTheme"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - <intent-filter> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.DEFAULT" /> - <data android:scheme="google.navigation" /> - </intent-filter> - </activity> - <activity android:name=".NavitAddressSearchActivity"></activity> - <activity android:name=".NavitDownloadSelectMapActivity"></activity> - <activity android:name=".NavitAddressResultListActivity"></activity> - <activity android:name=".FileBrowserActivity"></activity> - </application> -</manifest> diff --git a/navit/android/build.gradle b/navit/android/build.gradle index dc19f4f5d..0d5ef7a70 100644 --- a/navit/android/build.gradle +++ b/navit/android/build.gradle @@ -11,7 +11,7 @@ android { storeFile file(System.getenv("KEYSTORE") ?: "/store") keyAlias System.getenv("KEY_ALIAS") storePassword System.getenv("STORE_PASS") - keyPassword System.getenv("KEY_PASS") + keyPassword System.getenv("STORE_PASS") } } defaultConfig { diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java index bacc15213..a9cad9be5 100644 --- a/navit/android/src/org/navitproject/navit/Navit.java +++ b/navit/android/src/org/navitproject/navit/Navit.java @@ -248,10 +248,15 @@ public class Navit extends Activity { private void verifyPermissions() { if (ContextCompat.checkSelfPermission(this, - Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { + return; + } else if (ContextCompat.checkSelfPermission(this, + Manifest.permission.ACCESS_BACKGROUND_LOCATION) == PackageManager.PERMISSION_GRANTED) { + return; + } else { Log.d(TAG,"ask for permission(s)"); ActivityCompat.requestPermissions(this, new String[] { - Manifest.permission.ACCESS_FINE_LOCATION}, MY_PERMISSIONS_REQ_FINE_LOC); + Manifest.permission.ACCESS_BACKGROUND_LOCATION}, MY_PERMISSIONS_REQ_FINE_LOC); } } diff --git a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java index 4ee521c8c..cfc51a56b 100644 --- a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java +++ b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java @@ -27,6 +27,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationManager; +import android.os.Build; import android.os.Bundle; import android.os.Message; import android.support.v4.app.ActivityCompat; @@ -197,7 +198,9 @@ public class NavitDownloadSelectMapActivity extends ExpandableListActivity { String mapIndex = child.get("map_index"); if (mapIndex != null) { int mi = Integer.parseInt(mapIndex); - if (NavitMapDownloader.osm_maps[mi].mEstSizeBytes / 1024 / 1024 / 950 >= 4) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N + && NavitMapDownloader.osm_maps[mi].mEstSizeBytes >= Math.pow(2, 32) * 0.95) { + // limit map download size to 3.8GiB on Android versions before Nougat NavitDialogs.sendDialogMessage(NavitDialogs.MSG_TOAST_LONG, null, getTstring(R.string.map_download_oversize), -1, 0, 0); diff --git a/navit/announcement.c b/navit/announcement.c index c823fe1e1..3a85f3d02 100644 --- a/navit/announcement.c +++ b/navit/announcement.c @@ -30,7 +30,7 @@ struct announcement * announcement_new(struct attr *parent, struct attr **attrs) { struct announcement *this_; struct attr *type_attr; - if (! (type_attr=attr_search(attrs, NULL, attr_name))) { + if (! (type_attr=attr_search(attrs, attr_name))) { return NULL; } this_=g_new0(struct announcement, 1); diff --git a/navit/attr.c b/navit/attr.c index ea907b411..b9d54899f 100644 --- a/navit/attr.c +++ b/navit/attr.c @@ -498,13 +498,12 @@ char *attr_to_text(struct attr *attr, struct map *map, int pretty) { * attribute type and returns the first match. * * @param attrs Points to the array of attribute pointers to be searched - * @param last Not used * @param attr_type The attribute type to search for. Generic types (such as * attr_any or attr_any_xml) are NOT supported. * @return Pointer to the first matching attribute, or NULL if no match was found. */ struct attr * -attr_search(struct attr **attrs, struct attr *last, enum attr_type attr) { +attr_search(struct attr **attrs, enum attr_type attr) { dbg(lvl_info, "enter attrs=%p", attrs); while (*attrs) { dbg(lvl_debug,"*attrs=%p", *attrs); diff --git a/navit/attr.h b/navit/attr.h index d4cd07a1e..a49f033fe 100644 --- a/navit/attr.h +++ b/navit/attr.h @@ -223,7 +223,7 @@ char *attr_to_name(enum attr_type attr); struct attr *attr_new_from_text(const char *name, const char *value); char *attr_to_text_ext(struct attr *attr, char *sep, enum attr_format fmt, enum attr_format def_fmt, struct map *map); char *attr_to_text(struct attr *attr, struct map *map, int pretty); -struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type attr); +struct attr *attr_search(struct attr **attrs, enum attr_type attr); int attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_type type, struct attr *attr, struct attr_iter *iter); struct attr **attr_generic_set_attr(struct attr **attrs, struct attr *attr); diff --git a/navit/attr_def.h b/navit/attr_def.h index 45764ebb2..e498a40a8 100644 --- a/navit/attr_def.h +++ b/navit/attr_def.h @@ -404,6 +404,7 @@ ATTR(street_destination) ATTR(exit_to) ATTR(street_destination_forward) ATTR(street_destination_backward) +ATTR(outputdir) ATTR2(0x0003ffff,type_string_end) ATTR2(0x00040000,type_special_begin) ATTR(order) diff --git a/navit/command.c b/navit/command.c index cc498b1a7..f2c6c0bb0 100644 --- a/navit/command.c +++ b/navit/command.c @@ -158,7 +158,7 @@ static void result_free(struct result *res) { attr_free_content(&res->attr); res->allocated=0; } else { - res->attr.type=type_none; + res->attr.type=attr_none; res->attr.u.data=NULL; } } diff --git a/navit/coord.c b/navit/coord.c index cc64044bd..45d609d6c 100644 --- a/navit/coord.c +++ b/navit/coord.c @@ -56,8 +56,8 @@ struct coord * coord_new(int x, int y) { struct coord * coord_new_from_attrs(struct attr *parent, struct attr **attrs) { struct attr *x,*y; - x=attr_search(attrs, NULL, attr_x); - y=attr_search(attrs, NULL, attr_y); + x=attr_search(attrs, attr_x); + y=attr_search(attrs, attr_y); if (!x || !y) return NULL; return coord_new(x->u.num, y->u.num); diff --git a/navit/debug.c b/navit/debug.c index 6321756b6..e46637cb2 100644 --- a/navit/debug.c +++ b/navit/debug.c @@ -160,13 +160,13 @@ struct debug * debug_new(struct attr *parent, struct attr **attrs) { struct attr *name,*dbg_level_attr,*level_attr; dbg_level level; - name=attr_search(attrs, NULL, attr_name); - dbg_level_attr=attr_search(attrs, NULL, attr_dbg_level); - level_attr=attr_search(attrs, NULL, attr_level); + name=attr_search(attrs, attr_name); + dbg_level_attr=attr_search(attrs, attr_dbg_level); + level_attr=attr_search(attrs, attr_level); level = parse_dbg_level(dbg_level_attr,level_attr); #ifdef HAVE_SOCKET if (!name && level==lvl_unset) { - struct attr *socket_attr=attr_search(attrs, NULL, attr_socket); + struct attr *socket_attr=attr_search(attrs, attr_socket); char *p,*s; if (!socket_attr) return NULL; diff --git a/navit/file.c b/navit/file.c index 680b355b2..1622fd56d 100644 --- a/navit/file.c +++ b/navit/file.c @@ -110,7 +110,7 @@ static int file_request_do(struct file *file, struct attr **options, int connect if (!options) return 0; - attr=attr_search(options, NULL, attr_url); + attr=attr_search(options, attr_url); if (!attr) return 0; name=attr->u.str; @@ -125,11 +125,11 @@ static int file_request_do(struct file *file, struct attr **options, int connect char *method="GET"; char *header=NULL; int persistent=0; - if ((attr=attr_search(options, NULL, attr_http_method)) && attr->u.str) + if ((attr=attr_search(options, attr_http_method)) && attr->u.str) method=attr->u.str; - if ((attr=attr_search(options, NULL, attr_http_header)) && attr->u.str) + if ((attr=attr_search(options, attr_http_header)) && attr->u.str) header=attr->u.str; - if ((attr=attr_search(options, NULL, attr_persistent))) + if ((attr=attr_search(options, attr_persistent))) persistent=attr->u.num; if (path) host[path-name-7]='\0'; @@ -184,14 +184,14 @@ file_create(char *name, struct attr **options) { struct attr *attr; int open_flags=O_LARGEFILE|O_BINARY; - if (options && (attr=attr_search(options, NULL, attr_url))) { + if (options && (attr=attr_search(options, attr_url))) { #ifdef HAVE_SOCKET file_request_do(file, options, 1); #endif } else { - if (options && (attr=attr_search(options, NULL, attr_readwrite)) && attr->u.num) { + if (options && (attr=attr_search(options, attr_readwrite)) && attr->u.num) { open_flags |= O_RDWR; - if ((attr=attr_search(options, NULL, attr_create)) && attr->u.num) + if ((attr=attr_search(options, attr_create)) && attr->u.num) open_flags |= O_CREAT|O_TRUNC; } else open_flags |= O_RDONLY; @@ -210,7 +210,7 @@ file_create(char *name, struct attr **options) { file->name_id = (long)atom(name); } #ifdef CACHE_SIZE - if (!options || !(attr=attr_search(options, NULL, attr_cache)) || attr->u.num) + if (!options || !(attr=attr_search(options, attr_cache)) || attr->u.num) file->cache=1; #endif dbg_assert(file != NULL); diff --git a/navit/graphics.c b/navit/graphics.c index 1ed80defb..2c7cd49ff 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -337,7 +337,7 @@ struct graphics * graphics_new(struct attr *parent, struct attr **attrs) { struct graphics_priv * (*graphicstype_new)(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl); - if (! (type_attr=attr_search(attrs, NULL, attr_type))) { + if (! (type_attr=attr_search(attrs, attr_type))) { dbg(lvl_error,"Graphics plugin type is not set."); return NULL; } @@ -364,8 +364,8 @@ struct graphics * graphics_new(struct attr *parent, struct attr **attrs) { this_->font_size=20; this_->image_cache_hash = g_hash_table_new_full(g_str_hash, g_str_equal,g_free,g_free); /*get dpi */ - virtual_dpi_attr=attr_search(attrs, NULL, attr_virtual_dpi); - real_dpi_attr=attr_search(attrs, NULL, attr_real_dpi); + virtual_dpi_attr=attr_search(attrs, attr_virtual_dpi); + real_dpi_attr=attr_search(attrs, attr_real_dpi); if(virtual_dpi_attr != NULL) { navit_float virtual_dpi, real_dpi=0; virtual_dpi=virtual_dpi_attr->u.num; diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c index ccc929432..2109fee7e 100644 --- a/navit/graphics/android/graphics_android.c +++ b/navit/graphics/android/graphics_android.c @@ -931,7 +931,7 @@ static struct graphics_priv *graphics_android_new(struct navit *nav, struct grap ret->padding->right = 0; ret->padding->bottom = 0; /* attr_background_color is the background color for system bars (API 17+ only) */ - if ((attr=attr_search(attrs, NULL, attr_background_color))) { + if ((attr=attr_search(attrs, attr_background_color))) { ret->bgcolor = (attr->u.color->a / 0x101) << 24 | (attr->u.color->r / 0x101) << 16 | (attr->u.color->g / 0x101) << 8 @@ -942,10 +942,10 @@ static struct graphics_priv *graphics_android_new(struct navit *nav, struct grap /* default is the same as for OSD */ ret->bgcolor = 0xa0000000; } - if ((attr=attr_search(attrs, NULL, attr_use_camera))) { + if ((attr=attr_search(attrs, attr_use_camera))) { use_camera=attr->u.num; } - if ((attr=attr_search(attrs, NULL, attr_callback_list))) { + if ((attr=attr_search(attrs, attr_callback_list))) { command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), ret); } image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal); diff --git a/navit/graphics/egl/graphics_egl.c b/navit/graphics/egl/graphics_egl.c index 2da56047c..87291d739 100644 --- a/navit/graphics/egl/graphics_egl.c +++ b/navit/graphics/egl/graphics_egl.c @@ -1254,16 +1254,16 @@ static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graph this->show_overlays = 1; this->width = SCREEN_WIDTH; - if ((attr = attr_search(attrs, NULL, attr_w))) + if ((attr = attr_search(attrs, attr_w))) this->width = attr->u.num; this->height = SCREEN_HEIGHT; - if ((attr = attr_search(attrs, NULL, attr_h))) + if ((attr = attr_search(attrs, attr_h))) this->height = attr->u.num; this->timeout = 100; - if ((attr = attr_search(attrs, NULL, attr_timeout))) + if ((attr = attr_search(attrs, attr_timeout))) this->timeout = attr->u.num; this->delay = 0; - if ((attr = attr_search(attrs, NULL, attr_delay))) + if ((attr = attr_search(attrs, attr_delay))) this->delay = attr->u.num; this->cbl = cbl; diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c index 0f57263ee..e9d34dd82 100644 --- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c +++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c @@ -1120,18 +1120,18 @@ static struct graphics_priv *graphics_gtk_drawing_area_new(struct navit *nav, st this->nav = nav; this->widget=draw; this->win_w=792; - if ((attr=attr_search(attrs, NULL, attr_w))) + if ((attr=attr_search(attrs, attr_w))) this->win_w=attr->u.num; this->win_h=547; - if ((attr=attr_search(attrs, NULL, attr_h))) + if ((attr=attr_search(attrs, attr_h))) this->win_h=attr->u.num; this->timeout=100; - if ((attr=attr_search(attrs, NULL, attr_timeout))) + if ((attr=attr_search(attrs, attr_timeout))) this->timeout=attr->u.num; this->delay=0; - if ((attr=attr_search(attrs, NULL, attr_delay))) + if ((attr=attr_search(attrs, attr_delay))) this->delay=attr->u.num; - if ((attr=attr_search(attrs, NULL, attr_window_title))) + if ((attr=attr_search(attrs, attr_window_title))) this->window_title=g_strdup(attr->u.str); else this->window_title=g_strdup("Navit"); diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c index 552999d45..a04d12b6a 100644 --- a/navit/graphics/null/graphics_null.c +++ b/navit/graphics/null/graphics_null.c @@ -211,7 +211,7 @@ static struct graphics_priv *graphics_null_new(struct navit *nav, struct graphic struct attr *event_loop_system = NULL; *meth=graphics_methods; - event_loop_system = attr_search(attrs, NULL, attr_event_loop_system); + event_loop_system = attr_search(attrs, attr_event_loop_system); if (event_loop_system && event_loop_system->u.str) { dbg(lvl_debug, "event_system is %s", event_loop_system->u.str); diff --git a/navit/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c index 09292b306..cc644e641 100644 --- a/navit/graphics/opengl/graphics_opengl.c +++ b/navit/graphics/opengl/graphics_opengl.c @@ -1517,16 +1517,16 @@ static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graph this->overlay_enabled = 1; this->width = SCREEN_WIDTH; - if ((attr = attr_search(attrs, NULL, attr_w))) + if ((attr = attr_search(attrs, attr_w))) this->width = attr->u.num; this->height = SCREEN_HEIGHT; - if ((attr = attr_search(attrs, NULL, attr_h))) + if ((attr = attr_search(attrs, attr_h))) this->height = attr->u.num; this->timeout = 100; - if ((attr = attr_search(attrs, NULL, attr_timeout))) + if ((attr = attr_search(attrs, attr_timeout))) this->timeout = attr->u.num; this->delay = 0; - if ((attr = attr_search(attrs, NULL, attr_delay))) + if ((attr = attr_search(attrs, attr_delay))) this->delay = attr->u.num; this->cbl = cbl; diff --git a/navit/graphics/qt5/graphics_qt5.cpp b/navit/graphics/qt5/graphics_qt5.cpp index c87479219..e2747ff78 100644 --- a/navit/graphics/qt5/graphics_qt5.cpp +++ b/navit/graphics/qt5/graphics_qt5.cpp @@ -45,6 +45,7 @@ extern "C" { #include <QFont> #include <QGuiApplication> #include <QPainter> +#include <QPainterPath> #include <QPixmap> #include <QScreen> #include <QSvgRenderer> @@ -954,7 +955,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics //dbg(lvl_debug,"enter"); /* get qt widget attr */ - if ((attr_widget = attr_search(attrs, NULL, attr_qt5_widget))) { + if ((attr_widget = attr_search(attrs, attr_qt5_widget))) { /* check if we shall use qml */ if (strcmp(attr_widget->u.str, "qwidget") == 0) { use_qml = false; @@ -973,7 +974,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics *meth = graphics_methods; /* get event loop from config and request event loop*/ - event_loop_system = attr_search(attrs, NULL, attr_event_loop_system); + event_loop_system = attr_search(attrs, attr_event_loop_system); if (event_loop_system && event_loop_system->u.str) { //dbg(lvl_debug, "event_system is %s", event_loop_system->u.str); if (!event_request_system(event_loop_system->u.str, "graphics_qt5")) @@ -1002,7 +1003,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics graphics_priv->argv[graphics_priv->argc] = g_strdup("navit"); graphics_priv->argc++; /* Get qt platform from config */ - if ((platform = attr_search(attrs, NULL, attr_qt5_platform))) { + if ((platform = attr_search(attrs, attr_qt5_platform))) { graphics_priv->argv[graphics_priv->argc] = g_strdup("-platform"); graphics_priv->argc++; graphics_priv->argv[graphics_priv->argc] = g_strdup(platform->u.str); @@ -1062,7 +1063,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics graphics_priv->widget = new QNavitWidget(graphics_priv, NULL, Qt::Window); } #endif - if ((fullscreen = attr_search(attrs, NULL, attr_fullscreen)) && (fullscreen->u.num)) { + if ((fullscreen = attr_search(attrs, attr_fullscreen)) && (fullscreen->u.num)) { /* show this maximized */ #if USE_QML if (graphics_priv->window != NULL) @@ -1086,10 +1087,10 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics geomet = primary->availableGeometry(); } /* check for height */ - if ((h = attr_search(attrs, NULL, attr_h)) && (h->u.num > 100)) + if ((h = attr_search(attrs, attr_h)) && (h->u.num > 100)) geomet.setHeight(h->u.num); /* check for width */ - if ((w = attr_search(attrs, NULL, attr_w)) && (w->u.num > 100)) + if ((w = attr_search(attrs, attr_w)) && (w->u.num > 100)) geomet.setWidth(w->u.num); #if USE_QML if (graphics_priv->window != NULL) { diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c index d92699307..af033fed7 100644 --- a/navit/graphics/sdl/graphics_sdl.c +++ b/navit/graphics/sdl/graphics_sdl.c @@ -437,7 +437,7 @@ static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, st x_lw_adj = round((float)lw/2.0); y_lw_adj = 0; } else { - angle = (M_PI/2.0) - atan(abs(dx)/abs(dy)); + angle = (M_PI/2.0) - atan(abs((int)dx)/abs((int)dy)); x_lw_adj = round(sin(angle)*(float)lw/2.0); y_lw_adj = round(cos(angle)*(float)lw/2.0); if((x_lw_adj < 0) || (y_lw_adj < 0)) { @@ -1359,17 +1359,17 @@ static struct graphics_priv *graphics_sdl_new(struct navit *nav, struct graphics this->video_flags = SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE; #endif - if ((attr=attr_search(attrs, NULL, attr_w))) + if ((attr=attr_search(attrs, attr_w))) w=attr->u.num; - if ((attr=attr_search(attrs, NULL, attr_h))) + if ((attr=attr_search(attrs, attr_h))) h=attr->u.num; - if ((attr=attr_search(attrs, NULL, attr_bpp))) + if ((attr=attr_search(attrs, attr_bpp))) this->video_bpp=attr->u.num; - if ((attr=attr_search(attrs, NULL, attr_flags))) { + if ((attr=attr_search(attrs, attr_flags))) { if (attr->u.num & 1) this->video_flags = SDL_SWSURFACE; } - if ((attr=attr_search(attrs, NULL, attr_frame))) { + if ((attr=attr_search(attrs, attr_frame))) { if(!attr->u.num) this->video_flags |= SDL_NOFRAME; } @@ -1428,7 +1428,7 @@ static struct graphics_priv *graphics_sdl_new(struct navit *nav, struct graphics this->overlay_enable = 1; this->aa = 1; - if((attr=attr_search(attrs, NULL, attr_antialias))) + if((attr=attr_search(attrs, attr_antialias))) this->aa = attr->u.num; this->resize_callback_initial=1; diff --git a/navit/graphics/svg_debug/CMakeLists.txt b/navit/graphics/svg_debug/CMakeLists.txt new file mode 100644 index 000000000..2bc202c1e --- /dev/null +++ b/navit/graphics/svg_debug/CMakeLists.txt @@ -0,0 +1,2 @@ +module_add_library(graphics_svg_debug graphics_svg_debug.c) + diff --git a/navit/graphics/svg_debug/graphics_svg_debug.c b/navit/graphics/svg_debug/graphics_svg_debug.c new file mode 100644 index 000000000..348906ad8 --- /dev/null +++ b/navit/graphics/svg_debug/graphics_svg_debug.c @@ -0,0 +1,782 @@ +/* + * Navit, a modular navigation system. + * Copyright (C) 2020 Navit Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program 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 this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +/** + * This Plugin can act as a Plugin + * + */ +#include "color.h" +#include <glib.h> +#include "config.h" +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <glib.h> +#include <gio/gio.h> +#include <pthread.h> +#include <poll.h> +#include <signal.h> + +#include "config.h" +#include "debug.h" +#include "point.h" +#include "graphics.h" + +#include "plugin.h" +#include "window.h" +#include "navit.h" +#include "keys.h" +#include "item.h" +#include "attr.h" +#include "item.h" +#include "attr.h" +#include "point.h" +#include "graphics.h" +#include "color.h" +#include "navit.h" +#include "event.h" +#include "debug.h" +#include "callback.h" +#include "util.h" + +struct graphics_priv { + + unsigned int frame; + int width; + int height; + int fullscreen; + struct color bg_color; + FILE *outfile; + const char *outputdir; + void *proxy_priv; + struct graphics_methods *proxy_graphics_methods; + struct navit *nav; + struct callback_list *cbl; +}; + +struct graphics_font_priv { + int size; + char *font; + struct graphics_font graphics_font_proxy; +}; + +struct graphics_gc_priv { + struct graphics_priv *gr; + unsigned int *dashed; + int is_dashed; + struct color fg; + struct color bg; + int linewidth; + struct graphics_image_priv *img; + struct graphics_gc_priv *graphics_gc_priv_proxy; + struct graphics_gc_methods *graphics_gc_methods_proxy; +}; + +struct graphics_image_priv { + int w, h; + char *data; + struct graphics_image_priv *graphics_image_priv_proxy; + struct graphics_image_methods *graphics_image_methods_proxy; +}; + +static void svg_debug_graphics_destroy(struct graphics_priv *gr) { + // TODO +} + +static void svg_debug_font_destroy(struct graphics_font_priv *this); +void svg_debug_get_text_bbox(struct graphics_priv *gr, + struct graphics_font_priv *font, char *text, int dx, int dy, + struct point *ret, int estimate); + +static struct graphics_font_methods font_methods = { .font_destroy = + svg_debug_font_destroy, +}; + +static void resize_callback_do(struct graphics_priv *gr, int w, int h) { + dbg(lvl_debug, "resize_callback w:%i h:%i", w, h) + gr->width = w; + gr->height = h; +} + +static void svg_debug_font_destroy(struct graphics_font_priv *this) { + dbg(lvl_debug, "enter font_destroy"); + if (this->graphics_font_proxy.meth.font_destroy) { + this->graphics_font_proxy.meth.font_destroy( + this->graphics_font_proxy.priv); + } + g_free(this); +} + +static struct graphics_font_priv* svg_debug_font_new(struct graphics_priv *gr, + struct graphics_font_methods *meth, char *font, int size, int flags) { + struct graphics_font_priv *priv = g_new(struct graphics_font_priv, 1); + + *meth = font_methods; + + priv->size = size / 10; + if (gr->proxy_graphics_methods->font_new) { + priv->graphics_font_proxy.priv = gr->proxy_graphics_methods->font_new( + gr->proxy_priv, &priv->graphics_font_proxy.meth, font, size, + flags); + } else { + return priv; + } + if (priv->graphics_font_proxy.priv) { + return priv; + } + return NULL; +} +void svg_debug_get_text_bbox(struct graphics_priv *gr, + struct graphics_font_priv *font, char *text, int dx, int dy, + struct point *ret, int estimate) { + if (gr->proxy_graphics_methods->get_text_bbox) { + gr->proxy_graphics_methods->get_text_bbox(gr->proxy_priv, + font->graphics_font_proxy.priv, text, dx, dy, ret, estimate); + } +} + +static void svg_debug_gc_destroy(struct graphics_gc_priv *gc) { + if (gc->graphics_gc_methods_proxy->gc_destroy) { + gc->graphics_gc_methods_proxy->gc_destroy(gc->graphics_gc_priv_proxy); + } + g_free(gc->graphics_gc_methods_proxy); + g_free(gc); +} + +static void svg_debug_gc_set_linewidth(struct graphics_gc_priv *gc, int w) { + gc->linewidth = w; + if (gc->graphics_gc_methods_proxy->gc_set_linewidth) { + gc->graphics_gc_methods_proxy->gc_set_linewidth( + gc->graphics_gc_priv_proxy, w); + } + +} + +static void svg_debug_gc_set_dashes(struct graphics_gc_priv *gc, int w, + int offset, unsigned char *dash_list, int n) { + gc->dashed = dash_list; + gc->is_dashed = TRUE; + if (gc->graphics_gc_methods_proxy->gc_set_dashes) { + gc->graphics_gc_methods_proxy->gc_set_dashes(gc->graphics_gc_priv_proxy, + w, offset, dash_list, n); + } +} + +static void svg_debug_gc_set_foreground(struct graphics_gc_priv *gc, + struct color *c) { + gc->fg.r = c->r / 256; + gc->fg.g = c->g / 256; + gc->fg.b = c->b / 256; + gc->fg.a = c->a / 256; + if (gc->graphics_gc_methods_proxy->gc_set_foreground) { + gc->graphics_gc_methods_proxy->gc_set_foreground( + gc->graphics_gc_priv_proxy, c); + } +} + +static void svg_debug_gc_set_background(struct graphics_gc_priv *gc, + struct color *c) { + gc->bg.r = c->r / 256; + gc->bg.g = c->g / 256; + gc->bg.b = c->b / 256; + gc->bg.a = c->a / 256; + if (gc->graphics_gc_methods_proxy->gc_set_foreground) { + gc->graphics_gc_methods_proxy->gc_set_foreground( + gc->graphics_gc_priv_proxy, c); + } +} + +static void svg_debug_gc_set_texture(struct graphics_gc_priv *gc, + struct graphics_image_priv *img) { + gc->img = img; +} + +static struct graphics_gc_methods gc_methods = { .gc_destroy = + svg_debug_gc_destroy, .gc_set_linewidth = svg_debug_gc_set_linewidth, + .gc_set_dashes = svg_debug_gc_set_dashes, .gc_set_foreground = + svg_debug_gc_set_foreground, .gc_set_background = + svg_debug_gc_set_background, .gc_set_texture = + svg_debug_gc_set_texture, +}; + +static struct graphics_gc_priv* svg_debug_gc_new(struct graphics_priv *gr, + struct graphics_gc_methods *meth) { + struct graphics_gc_priv *gc = g_new0(struct graphics_gc_priv, 1); + struct graphics_gc_priv *graphics_gc_priv_proxy = g_new0( + struct graphics_gc_priv, 1); + struct graphics_gc_methods *graphics_gc_methods_proxy = g_new0( + struct graphics_gc_methods, 1); + *meth = gc_methods; + gc->gr = gr; + gc->is_dashed = FALSE; + gc->linewidth = 1; + + if (gr->proxy_graphics_methods->gc_new) { + gr->proxy_graphics_methods->gc_new(gr->proxy_priv, + graphics_gc_methods_proxy); + } + gc->graphics_gc_methods_proxy = graphics_gc_methods_proxy; + gc->graphics_gc_priv_proxy = graphics_gc_priv_proxy; + return gc; +} + +void svg_debug_image_destroy(struct graphics_image_priv *img); +void svg_debug_image_destroy(struct graphics_image_priv *img) { + dbg(lvl_debug, "enter image_destroy"); + g_free(img->data); + if (img->graphics_image_methods_proxy->image_destroy) { + img->graphics_image_methods_proxy->image_destroy( + img->graphics_image_priv_proxy); + } + g_free(img->data); + g_free(img->graphics_image_methods_proxy); + g_free(img->graphics_image_priv_proxy); + g_free(img); +} + +static struct graphics_image_methods image_methods = { .image_destroy = + svg_debug_image_destroy, +}; + +static struct graphics_image_priv* svg_debug_image_new(struct graphics_priv *gr, + struct graphics_image_methods *meth, char *path, int *w, int *h, + struct point *hot, int rotation) { + struct graphics_image_priv *image_priv; + struct graphics_image_methods *graphics_image_methods; + char *base64_data_url = NULL; + char *base64_encoded_image = NULL; + char *image_mime_type = NULL; + char *contents = NULL; + char fileext[3] = ""; + gsize img_size; + + image_priv = g_new0(struct graphics_image_priv, 1); + graphics_image_methods = g_new0(struct graphics_image_methods, 1); + *meth = image_methods; + const char *data_url_template = "data:%s;base64,%s"; + + if (g_file_get_contents(path, &contents, &img_size, NULL)) { + dbg(lvl_debug, "image_new loaded %s", path); + + strtolower(fileext, &path[(strlen(path) - 3)]); + if (strcmp(fileext, "png")) { + image_mime_type = "image/png"; + } else if (strcmp(fileext, "jpg")) { + image_mime_type = "image/jpeg"; + } else if (strcmp(fileext, "gif")) { + image_mime_type = "image/gif"; + } else { + image_mime_type = "application/octet-stream"; + } + base64_encoded_image = g_base64_encode((guchar*) contents, img_size); + + base64_data_url = g_malloc0( + strlen(base64_encoded_image) + strlen(data_url_template) + + strlen(image_mime_type) + 1); + sprintf(base64_data_url, data_url_template, image_mime_type, + base64_encoded_image); + g_free(base64_encoded_image); + + image_priv->data = base64_data_url; + g_free(contents); + image_priv->h = *h; + image_priv->w = *w; + } else { + dbg(lvl_error, "image_new failed to load %s", path); + image_priv->data = + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="; + image_priv->h = 1; + image_priv->w = 1; + } + if (gr->proxy_graphics_methods->image_new) { + image_priv->graphics_image_priv_proxy = + gr->proxy_graphics_methods->image_new(gr->proxy_priv, + graphics_image_methods, path, w, h, hot, rotation); + image_priv->graphics_image_methods_proxy = graphics_image_methods; + } + if (image_priv->graphics_image_priv_proxy) { + return image_priv; + } + if (base64_data_url != NULL) { + g_free(base64_data_url); + } + g_free(graphics_image_methods); + g_free(image_priv); + return NULL; +} + +static void svg_debug_draw_lines(struct graphics_priv *gr, + struct graphics_gc_priv *gc, struct point *p, int count) { + const char *line_template_start = "<polyline points=\""; + const char *coord_template = "%i,%i "; + const char *dashed_template_start = "\" stroke-dasharray=\""; + const char *dashed_dasharray = "%i "; + const char *dashed_template_end = ""; + const char *line_template_end = + "\" style=\"fill:none;stroke:rgb(%i,%i,%i);stroke-width:%i\" />\n"; + + fprintf(gr->outfile, line_template_start, ""); + int i; + for (i = 0; i < count; i++) { + fprintf(gr->outfile, coord_template, p[i].x, p[i].y); + } + + if (gc->is_dashed) { + fprintf(gr->outfile, dashed_template_start, ""); + int i; + for (i = 0; i < 4; i++) { + fprintf(gr->outfile, dashed_dasharray, gc->dashed[i]); + } + fprintf(gr->outfile, dashed_template_end, ""); + } + + fprintf(gr->outfile, line_template_end, gc->fg.r, gc->fg.g, gc->fg.b, + gc->linewidth); + + if (gr->proxy_graphics_methods->draw_lines) { + gr->proxy_graphics_methods->draw_lines(gr->proxy_priv, + gc->graphics_gc_priv_proxy, p, count); + } + +} + +static void svg_debug_draw_polygon(struct graphics_priv *gr, + struct graphics_gc_priv *gc, struct point *p, int count) { + const char *coord_template = "%i,%i "; + const char *polygon_template_start = "<polygon points=\"%s"; + const char *polygon_template_end = "\" style=\"fill:rgb(%i,%i,%i)\" />\n"; + fprintf(gr->outfile, polygon_template_start, ""); + int i; + for (i = 0; i < count; i++) { + fprintf(gr->outfile, coord_template, p[i].x, p[i].y); + } + fprintf(gr->outfile, polygon_template_end, gc->fg.r, gc->fg.g, gc->fg.b); + + if (gr->proxy_graphics_methods->draw_polygon) { + gr->proxy_graphics_methods->draw_polygon(gr->proxy_priv, + gc->graphics_gc_priv_proxy, p, count); + } + +} + +static void svg_debug_draw_rectangle(struct graphics_priv *gr, + struct graphics_gc_priv *gc, struct point *p, int w, int h) { + const char *rectangle_template = + "<rect x=\"%i\" y=\"%i\" width=\"%i\" height=\"%i\" style=\"fill:rgb(%i,%i,%i)\"></rect>\n"; + fprintf(gr->outfile, rectangle_template, p->x, p->y, w, h, gc->fg.r, + gc->fg.g, gc->fg.b); + + if (gr->proxy_graphics_methods->draw_rectangle) { + gr->proxy_graphics_methods->draw_rectangle(gr->proxy_priv, + gc->graphics_gc_priv_proxy, p, w, h); + } +} + +static void svg_debug_draw_circle(struct graphics_priv *gr, + struct graphics_gc_priv *gc, struct point *p, int r) { + const char *circle_template = + "<circle cx=\"%i\" cy=\"%i\" r=\"%i\" fill=\"rgb(%i,%i,%i)\" />\n"; + fprintf(gr->outfile, circle_template, p->x, p->y, r / 2, gc->fg.r, gc->fg.g, + gc->fg.b); + + if (gr->proxy_graphics_methods->draw_circle) { + gr->proxy_graphics_methods->draw_circle(gr->proxy_priv, + gc->graphics_gc_priv_proxy, p, r); + } + +} + +static void svg_debug_draw_text(struct graphics_priv *gr, + struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, + struct graphics_font_priv *font, char *text, struct point *p, int dx, + int dy) { + const char *image_template = + "<text x=\"%i\" y=\"%i\" fill=\"rgb(%i,%i,%i)\" style=\"font-size: %ipt;\">%s</text>\n"; + if (dx == 0x10000 || dy == 0) { + fprintf(gr->outfile, image_template, p->x, p->y, fg->fg.r, fg->fg.g, + fg->fg.b, font ? font->size : 0, text); + } + if (gr->proxy_graphics_methods->draw_text && font) { + gr->proxy_graphics_methods->draw_text(gr->proxy_priv, + fg->graphics_gc_priv_proxy, bg->graphics_gc_priv_proxy, + font->graphics_font_proxy.priv, text, p, dx, dy); + } +} + +static void svg_debug_draw_image(struct graphics_priv *gr, + struct graphics_gc_priv *fg, struct point *p, + struct graphics_image_priv *img) { + // Write already encoded image to file + const char *image_template = + "<image x=\"%i\" y=\"%i\" width=\"%i\" height=\"%i\" xlink:href=\"%s\"></image>\n"; + fprintf(gr->outfile, image_template, p->x, p->y, img->w, img->h, img->data); + if (gr->proxy_graphics_methods->draw_image) { + gr->proxy_graphics_methods->draw_image(gr->proxy_priv, fg, p, + img->graphics_image_priv_proxy); + } +} + +static void svg_debug_draw_drag(struct graphics_priv *gr, struct point *p) { + if (gr->proxy_graphics_methods->draw_drag) { + gr->proxy_graphics_methods->draw_drag(gr->proxy_priv, p); + } +} + +static void svg_debug_background_gc(struct graphics_priv *gr, + struct graphics_gc_priv *gc) { + if (gr->proxy_graphics_methods->background_gc) { + gr->proxy_graphics_methods->background_gc(gr->proxy_priv, + gc->graphics_gc_priv_proxy); + } +} + +static void svg_debug_draw_mode(struct graphics_priv *gr, + enum draw_mode_num mode) { + const char *svg_start_template = + "<svg height=\"%i\" width=\"%i\" xmlns= \"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n"; + const char *svg_end_template = "</svg>\n"; + char filename[255]; + switch (mode) { + case draw_mode_begin: + if (gr->outfile) { + dbg(lvl_debug, "Finished drawing %s/svg_debug_after_frame_%u.svg", + gr->outputdir, gr->frame) + fprintf(gr->outfile, svg_end_template, ""); + fclose(gr->outfile); + gr->frame += 1; + } + sprintf(filename, "%s/svg_debug_frame_%u.svg", gr->outputdir, + gr->frame); + gr->outfile = fopen(filename, "w"); + fprintf(gr->outfile, svg_start_template, gr->height, gr->width); + break; + case draw_mode_end: + dbg(lvl_debug, "Finished drawing %s/svg_debug_after_frame_%u.svg", + gr->outputdir, gr->frame) + fprintf(gr->outfile, svg_end_template, ""); + fclose(gr->outfile); + gr->frame += 1; + sprintf(filename, "%s/svg_debug_after_frame_%u.svg", gr->outputdir, + gr->frame); + gr->outfile = fopen(filename, "w"); + fprintf(gr->outfile, svg_start_template, gr->height, gr->width); + break; + default: + break; + } + if (gr->proxy_graphics_methods->draw_mode) { + gr->proxy_graphics_methods->draw_mode(gr->proxy_priv, mode); + } +} + +static void graphics_svg_debug_overlay_draw_mode(struct graphics_priv *gr, + enum draw_mode_num mode) { + // TODO + // https://stackoverflow.com/questions/5451135/embed-svg-in-svg + // more or less like in draw_mode but with different format string + // probably overlay_num so main svg can import it +} + +static struct graphics_priv* graphics_svg_debug_overlay_new( + struct graphics_priv *gr, struct graphics_methods *meth, + struct point *p, int w, int h, int wraparound); + +static int graphics_svg_debug_fullscreen(struct window *win, int on) { + struct graphics_priv *graphics_priv = (struct graphics_priv*) win->priv; + struct window *proxy_win; + if (!graphics_priv->proxy_graphics_methods->get_data) { + return 0; + } + proxy_win = graphics_priv->proxy_graphics_methods->get_data( + graphics_priv->proxy_priv, "window"); + if (proxy_win) { + return proxy_win->fullscreen(proxy_win, on); + } + return 0; +} + +static gboolean graphics_svg_debug_idle(void *data) { + struct graphics_priv *gr = (struct graphics_priv*) data; + static int first_run = TRUE; + if (first_run) { + callback_list_call_attr_2(gr->cbl, attr_resize, + GINT_TO_POINTER(gr->width), GINT_TO_POINTER(gr->height)); + first_run = FALSE; + } + return TRUE; +} + +static void graphics_svg_debug_disable_suspend(struct window *w) { + struct graphics_priv *graphics_priv = (struct graphics_priv*) w->priv; + struct window *proxy_win; + if (!graphics_priv->proxy_graphics_methods->get_data) { + return; + } + proxy_win = graphics_priv->proxy_graphics_methods->get_data( + graphics_priv->proxy_priv, "window"); + if (proxy_win) { + proxy_win->disable_suspend(proxy_win); + } + return; +} + +static void* svg_debug_get_data(struct graphics_priv *this, char const *type) { + if (strcmp(type, "window") == 0) { + struct window *win; + win = g_new0(struct window, 1); + win->priv = this; + win->fullscreen = graphics_svg_debug_fullscreen; + win->disable_suspend = graphics_svg_debug_disable_suspend; + return win; + } + if (this->proxy_graphics_methods->get_data) { + // FIXME: This will leak the proxied graphics_priv... But it works for now + return this->proxy_graphics_methods->get_data(this->proxy_priv, type); + } + return NULL; +} + +static void svg_debug_image_free(struct graphics_priv *gr, + struct graphics_image_priv *img) { + dbg(lvl_debug, "enter image_free"); + if (img->graphics_image_methods_proxy->image_destroy) { + img->graphics_image_methods_proxy->image_destroy( + img->graphics_image_priv_proxy); + } + if (gr->proxy_graphics_methods->image_free) { + gr->proxy_graphics_methods->image_free(gr->proxy_priv, + img->graphics_image_priv_proxy); + } + g_free(img->graphics_image_methods_proxy); + g_free(img->data); + g_free(img); +} + +static void graphics_svg_debug_overlay_disable(struct graphics_priv *gr, + int disable) { + // TODO +} + +static void graphics_svg_debug_overlay_resize(struct graphics_priv *gr, + struct point *p, int w, int h, int wraparound) { + // TODO +} + +static struct graphics_methods graphics_methods = { + .graphics_destroy = svg_debug_graphics_destroy, + .draw_mode = svg_debug_draw_mode, + .draw_lines = svg_debug_draw_lines, + .draw_polygon = svg_debug_draw_polygon, + .draw_rectangle = svg_debug_draw_rectangle, + .draw_circle = svg_debug_draw_circle, + .draw_text = svg_debug_draw_text, + // FIXME: Text size calculation is hard, because the svg is + // interpreted by the viewer, so we don't know its size + + .draw_image = svg_debug_draw_image, + .draw_image_warp = NULL, + .draw_drag = svg_debug_draw_drag, + .font_new = svg_debug_font_new, + .gc_new = svg_debug_gc_new, + .background_gc = svg_debug_background_gc, + .overlay_new = NULL, //graphics_svg_debug_overlay_new, // TODO + .image_new = svg_debug_image_new, + .get_data = svg_debug_get_data, + .image_free = svg_debug_image_free, + .get_text_bbox = svg_debug_get_text_bbox, + .overlay_disable = NULL, // graphics_svg_debug_overlay_disable, // TODO + .overlay_resize = NULL, // graphics_svg_debug_overlay_resize, // TODO + .set_attr = NULL, // TODO add proxy + .show_native_keyboard = NULL, // TODO add proxy + .hide_native_keyboard = NULL, // TODO add proxy + .get_dpi = NULL, // TODO add proxy + .draw_polygon_with_holes = NULL, // TODO add proxy + +}; + +static struct graphics_priv* graphics_svg_debug_overlay_new( + struct graphics_priv *gr, struct graphics_methods *meth, + struct point *p, int w, int h, int wraparound) { + struct graphics_priv *this = g_new0(struct graphics_priv, 1); + *meth = graphics_methods; + meth->draw_mode = graphics_svg_debug_overlay_draw_mode; + + // TODO + + return this; +} + +static struct graphics_priv* graphics_svg_debug_new(struct navit *nav, + struct graphics_methods *meth, struct attr **attrs, + struct callback_list *cbl) { + struct graphics_priv *this = g_new0(struct graphics_priv, 1); + struct graphics_methods *proxy_graphics_methods = g_new0( + struct graphics_methods, 1); + struct attr *attr; + void *proxy_priv = NULL; + struct graphics_priv* (*proxy_gra)(struct navit *nav, + struct graphics_methods *meth, struct attr **attrs, + struct callback_list *cbl); + + *meth = graphics_methods; + + // Save Parameters for later + this->nav = nav; + this->cbl = cbl; + + // Read configuration + this->width = 32; + if ((attr = attr_search(attrs, attr_w))) + this->width = attr->u.num; + this->height = 32; + if ((attr = attr_search(attrs, attr_h))) + this->height = attr->u.num; + + this->outputdir = g_get_tmp_dir(); + if ((attr = attr_search(attrs, attr_outputdir))) + this->outputdir = attr->u.str; + + // Get plugin to proxy + proxy_gra = NULL; + if ((attr = attr_search(attrs, attr_name))) { + if (attr->u.str[0] != '\0') { + proxy_gra = plugin_get_category_graphics(attr->u.str); + } + if (proxy_gra) { + // Call proxy plugin + proxy_priv = (*proxy_gra)(nav, proxy_graphics_methods, attrs, cbl); + } else { + dbg(lvl_error, "Failed to load graphics plugin %s.", attr->u.str); + return NULL; + } + } else { + if (!event_request_system("glib", "graphics_sdl_new")) { + dbg(lvl_error, "event_request_system failed"); + g_free(this); + return NULL; + } + } + + // Save proxy to call it later + this->proxy_priv = proxy_priv; + this->proxy_graphics_methods = proxy_graphics_methods; + this->frame = 0; + + // If something tries to write before calling draw_mode with start for the first time + this->outfile = fopen("/dev/null", "w"); + + //callbacks = cbl; + g_timeout_add(G_PRIORITY_DEFAULT + 10, graphics_svg_debug_idle, this); + + if (!proxy_gra) { + dbg(lvl_debug, "No Proxied plugin, so do not set functions to NULL") + // see comment below + callback_list_call_attr_2(cbl, attr_resize, + GINT_TO_POINTER(this->width), GINT_TO_POINTER(this->height)); + return this; + } + + // The rest of this function makes sure that svg_debug only supports what the + // proxied graphics plugin supports as well + // for example some graphics plugins don't support circles, but svg_debug does. + // if navit core sees that we support circles we would see it inside the svg, but not + // in the proxied graphics + // + // get_data and draw_mode may not been set to null because they need to exist + if (!this->proxy_graphics_methods->graphics_destroy) { + meth->graphics_destroy = NULL; + } + if (!this->proxy_graphics_methods->draw_lines) { + meth->draw_lines = NULL; + } + if (!this->proxy_graphics_methods->draw_polygon) { + meth->draw_polygon = NULL; + } + if (!this->proxy_graphics_methods->draw_rectangle) { + meth->draw_rectangle = NULL; + } + if (!this->proxy_graphics_methods->draw_circle) { + meth->draw_circle = NULL; + } + if (!this->proxy_graphics_methods->draw_text) { + meth->draw_text = NULL; + } + if (!this->proxy_graphics_methods->draw_image) { + meth->draw_image = NULL; + } + if (!this->proxy_graphics_methods->draw_image_warp) { + meth->draw_image_warp = NULL; + } + if (!this->proxy_graphics_methods->draw_drag) { + meth->draw_drag = NULL; + } + if (!this->proxy_graphics_methods->font_new) { + meth->font_new = NULL; + } + if (!this->proxy_graphics_methods->gc_new) { + meth->gc_new = NULL; + } + if (!this->proxy_graphics_methods->background_gc) { + meth->background_gc = NULL; + } + if (!this->proxy_graphics_methods->overlay_new) { + meth->overlay_new = NULL; + } + if (!this->proxy_graphics_methods->image_new) { + meth->image_new = NULL; + } + if (!this->proxy_graphics_methods->image_free) { + meth->image_free = NULL; + } + if (!this->proxy_graphics_methods->get_text_bbox) { + meth->get_text_bbox = NULL; + } + if (!this->proxy_graphics_methods->overlay_disable) { + meth->overlay_disable = NULL; + } + if (!this->proxy_graphics_methods->overlay_resize) { + meth->overlay_resize = NULL; + } + if (!this->proxy_graphics_methods->set_attr) { + meth->set_attr = NULL; + } + if (!this->proxy_graphics_methods->show_native_keyboard) { + meth->show_native_keyboard = NULL; + } + if (!this->proxy_graphics_methods->hide_native_keyboard) { + meth->hide_native_keyboard = NULL; + } + if (!this->proxy_graphics_methods->get_dpi) { + meth->get_dpi = NULL; + } + if (!this->proxy_graphics_methods->draw_polygon_with_holes) { + meth->draw_polygon_with_holes = NULL; + } + + // Add resize callback so we get called when window is resized so we can adjust the svg size + struct callback *callback = callback_new_attr_1(callback_cast(resize_callback_do), attr_resize, this); + callback_list_add(cbl, callback); + return this; +} + +void plugin_init(void) { + dbg(lvl_error, "enter svg_debug plugin_init") + plugin_register_category_graphics("svg_debug", graphics_svg_debug_new); + //plugin_register_category_event("svg_debug", event_svg_debug_new); +} diff --git a/navit/graphics/win32/graphics_win32.c b/navit/graphics/win32/graphics_win32.c index 6346e59f7..3f20daf2b 100644 --- a/navit/graphics/win32/graphics_win32.c +++ b/navit/graphics/win32/graphics_win32.c @@ -1337,7 +1337,7 @@ static int pngdecode(struct graphics_priv *gr, char *name, struct graphics_image /* expand images to bit-depth 8 (only applicable for grayscale images) */ if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA && bit_depth < 8) - png_set_gray_1_2_4_to_8(png_ptr); + png_set_expand_gray_1_2_4_to_8(png_ptr); /* Expand grayscale to rgb */ if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) @@ -1745,19 +1745,19 @@ static struct graphics_priv* graphics_win32_new( struct navit *nav, struct graph this_=graphics_win32_new_helper(meth); this_->nav=nav; this_->frame=1; - if ((attr=attr_search(attrs, NULL, attr_frame))) + if ((attr=attr_search(attrs, attr_frame))) this_->frame=attr->u.num; this_->x=0; - if ((attr=attr_search(attrs, NULL, attr_x))) + if ((attr=attr_search(attrs, attr_x))) this_->x=attr->u.num; this_->y=0; - if ((attr=attr_search(attrs, NULL, attr_y))) + if ((attr=attr_search(attrs, attr_y))) this_->y=attr->u.num; this_->width=792; - if ((attr=attr_search(attrs, NULL, attr_w))) + if ((attr=attr_search(attrs, attr_w))) this_->width=attr->u.num; this_->height=547; - if ((attr=attr_search(attrs, NULL, attr_h))) + if ((attr=attr_search(attrs, attr_h))) this_->height=attr->u.num; this_->overlays = NULL; this_->cbl=cbl; diff --git a/navit/gui.c b/navit/gui.c index f9de8496d..817bac15e 100644 --- a/navit/gui.c +++ b/navit/gui.c @@ -40,7 +40,7 @@ gui_new(struct attr *parent, struct attr **attrs) { struct attr *type_attr; struct gui_priv *(*guitype_new)(struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui); struct attr cbl; - if (! (type_attr=attr_search(attrs, NULL, attr_type))) { + if (! (type_attr=attr_search(attrs, attr_type))) { return NULL; } diff --git a/navit/gui/gtk/gui_gtk_window.c b/navit/gui/gtk/gui_gtk_window.c index aa510b374..f0d13528a 100644 --- a/navit/gui/gtk/gui_gtk_window.c +++ b/navit/gui/gtk/gui_gtk_window.c @@ -688,19 +688,19 @@ static struct gui_priv *gui_gtk_new(struct navit *nav, struct gui_methods *meth, this=g_new0(struct gui_priv, 1); this->nav=nav; - attr = attr_search(attrs, NULL, attr_menubar); + attr = attr_search(attrs, attr_menubar); if (attr) { this->menubar_enable=attr->u.num; } else { this->menubar_enable=1; } - attr=attr_search(attrs, NULL, attr_toolbar); + attr=attr_search(attrs, attr_toolbar); if (attr) { this->toolbar_enable=attr->u.num; } else { this->toolbar_enable=1; } - attr=attr_search(attrs, NULL, attr_statusbar); + attr=attr_search(attrs, attr_statusbar); if (attr) { this->statusbar_enable=attr->u.num; } else { @@ -747,7 +747,7 @@ static struct gui_priv *gui_gtk_new(struct navit *nav, struct gui_methods *meth, navit_add_callback(nav, callback_new_attr_1(callback_cast(gui_gtk_init), attr_navit, this)); - if ((attr=attr_search(attrs, NULL, attr_fullscreen))) + if ((attr=attr_search(attrs, attr_fullscreen))) fullscreen=attr->u.num; if (fullscreen) { diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c index d9fea2d28..e8759f3d3 100644 --- a/navit/gui/internal/gui_internal.c +++ b/navit/gui/internal/gui_internal.c @@ -2007,7 +2007,7 @@ static void gui_internal_add_vehicle_profile(struct gui_priv *this, struct widge #endif // Figure out the profile name - attr = attr_search(profile->attrs, NULL, attr_name); + attr = attr_search(profile->attrs, attr_name); if (!attr) { dbg(lvl_error, "Adding vehicle profile failed. attr==NULL"); return; @@ -3183,101 +3183,101 @@ static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods this->self.type=attr_gui; this->self.u.gui=gui; - if ((attr=attr_search(attrs, NULL, attr_menu_on_map_click))) + if ((attr=attr_search(attrs, attr_menu_on_map_click))) this->menu_on_map_click=attr->u.num; else this->menu_on_map_click=1; - if ((attr=attr_search(attrs, NULL, attr_on_map_click))) + if ((attr=attr_search(attrs, attr_on_map_click))) this->on_map_click=g_strdup(attr->u.str); - if ((attr=attr_search(attrs, NULL, attr_signal_on_map_click))) + if ((attr=attr_search(attrs, attr_signal_on_map_click))) this->signal_on_map_click=attr->u.num; gui_internal_command_init(this, attrs); - if( (attr=attr_search(attrs,NULL,attr_font_size))) { + if( (attr=attr_search(attrs,attr_font_size))) { this->config.font_size=attr->u.num; } else { this->config.font_size=-1; } - if( (attr=attr_search(attrs,NULL,attr_icon_xs))) { + if( (attr=attr_search(attrs,attr_icon_xs))) { this->config.icon_xs=attr->u.num; } else { this->config.icon_xs=-1; } - if( (attr=attr_search(attrs,NULL,attr_icon_l))) { + if( (attr=attr_search(attrs,attr_icon_l))) { this->config.icon_l=attr->u.num; } else { this->config.icon_l=-1; } - if( (attr=attr_search(attrs,NULL,attr_icon_s))) { + if( (attr=attr_search(attrs,attr_icon_s))) { this->config.icon_s=attr->u.num; } else { this->config.icon_s=-1; } - if( (attr=attr_search(attrs,NULL,attr_spacing))) { + if( (attr=attr_search(attrs,attr_spacing))) { this->config.spacing=attr->u.num; } else { this->config.spacing=-1; } - if( (attr=attr_search(attrs,NULL,attr_gui_speech))) { + if( (attr=attr_search(attrs,attr_gui_speech))) { this->speech=attr->u.num; } - if( (attr=attr_search(attrs,NULL,attr_keyboard))) + if( (attr=attr_search(attrs,attr_keyboard))) this->keyboard=attr->u.num; else this->keyboard=1; - if( (attr=attr_search(attrs,NULL,attr_fullscreen))) + if( (attr=attr_search(attrs,attr_fullscreen))) this->fullscreen=attr->u.num; - if( (attr=attr_search(attrs,NULL,attr_flags))) + if( (attr=attr_search(attrs,attr_flags))) this->flags=attr->u.num; - if( (attr=attr_search(attrs,NULL,attr_background_color))) + if( (attr=attr_search(attrs,attr_background_color))) this->background_color=*attr->u.color; else this->background_color=color_black; - if( (attr=attr_search(attrs,NULL,attr_background_color2))) + if( (attr=attr_search(attrs,attr_background_color2))) this->background2_color=*attr->u.color; else this->background2_color=back2_color; - if( (attr=attr_search(attrs,NULL,attr_text_color))) + if( (attr=attr_search(attrs,attr_text_color))) this->text_foreground_color=*attr->u.color; else this->text_foreground_color=color_white; - if( (attr=attr_search(attrs,NULL,attr_text_background))) + if( (attr=attr_search(attrs,attr_text_background))) this->text_background_color=*attr->u.color; else this->text_background_color=color_black; - if( (attr=attr_search(attrs,NULL,attr_columns))) + if( (attr=attr_search(attrs,attr_columns))) this->cols=attr->u.num; - if( (attr=attr_search(attrs,NULL,attr_osd_configuration))) + if( (attr=attr_search(attrs,attr_osd_configuration))) this->osd_configuration=*attr; - if( (attr=attr_search(attrs,NULL,attr_pitch))) + if( (attr=attr_search(attrs,attr_pitch))) this->pitch=attr->u.num; else this->pitch=20; - if( (attr=attr_search(attrs,NULL,attr_flags_town))) + if( (attr=attr_search(attrs,attr_flags_town))) this->flags_town=attr->u.num; else this->flags_town=-1; - if( (attr=attr_search(attrs,NULL,attr_flags_street))) + if( (attr=attr_search(attrs,attr_flags_street))) this->flags_street=attr->u.num; else this->flags_street=-1; - if( (attr=attr_search(attrs,NULL,attr_flags_house_number))) + if( (attr=attr_search(attrs,attr_flags_house_number))) this->flags_house_number=attr->u.num; else this->flags_house_number=-1; - if( (attr=attr_search(attrs,NULL,attr_radius))) + if( (attr=attr_search(attrs,attr_radius))) this->radius=attr->u.num; else this->radius=10; - if( (attr=attr_search(attrs,NULL,attr_font))) + if( (attr=attr_search(attrs,attr_font))) this->font_name=g_strdup(attr->u.str); - if((attr=attr_search(attrs, NULL, attr_hide_impossible_next_keys))) + if((attr=attr_search(attrs, attr_hide_impossible_next_keys))) this->hide_keys = attr->u.num; else this->hide_keys = 0; diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c index 73def7b18..4c0abcdb5 100644 --- a/navit/gui/internal/gui_internal_command.c +++ b/navit/gui/internal/gui_internal_command.c @@ -1216,7 +1216,7 @@ static struct command_table commands[] = { void gui_internal_command_init(struct gui_priv *this, struct attr **attrs) { struct attr *attr; - if ((attr=attr_search(attrs, NULL, attr_callback_list))) { + if ((attr=attr_search(attrs, attr_callback_list))) { command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), this); } } diff --git a/navit/gui/qml/gui_qml.cpp b/navit/gui/qml/gui_qml.cpp index 764319e78..c8d20450e 100644 --- a/navit/gui/qml/gui_qml.cpp +++ b/navit/gui/qml/gui_qml.cpp @@ -407,34 +407,34 @@ static struct gui_priv * gui_qml_new(struct navit *nav, struct gui_methods *meth navit_ignore_graphics_events(this_->nav, 1); this_->fullscreen = 0; //NO by default - if( (attr=attr_search(attrs,NULL,attr_fullscreen))) + if( (attr=attr_search(attrs,attr_fullscreen))) this_->fullscreen=attr->u.num; this_->menu_on_map_click = 1; //YES by default; - if( (attr=attr_search(attrs,NULL,attr_menu_on_map_click))) + if( (attr=attr_search(attrs,attr_menu_on_map_click))) this_->menu_on_map_click=attr->u.num; this_->signal_on_map_click = 0; //YES by default; - if( (attr=attr_search(attrs,NULL,attr_signal_on_map_click))) + if( (attr=attr_search(attrs,attr_signal_on_map_click))) this_->signal_on_map_click=attr->u.num; this_->radius = 10; //Default value - if( (attr=attr_search(attrs,NULL,attr_radius))) + if( (attr=attr_search(attrs,attr_radius))) this_->radius=attr->u.num; this_->pitch = 20; //Default value - if( (attr=attr_search(attrs,NULL,attr_pitch))) + if( (attr=attr_search(attrs,attr_pitch))) this_->pitch=attr->u.num; this_->lazy = 1; //YES by default - if( (attr=attr_search(attrs,NULL,attr_lazy))) + if( (attr=attr_search(attrs,attr_lazy))) this_->lazy=attr->u.num; this_->w=800; //Default value - if( (attr=attr_search(attrs,NULL,attr_width))) + if( (attr=attr_search(attrs,attr_width))) this_->w=attr->u.num; this_->h=600; //Default value - if( (attr=attr_search(attrs,NULL,attr_height))) + if( (attr=attr_search(attrs,attr_height))) this_->h=attr->u.num; - if( (attr=attr_search(attrs,NULL,attr_source))) + if( (attr=attr_search(attrs,attr_source))) this_->source=attr->u.str; - if( (attr=attr_search(attrs,NULL,attr_skin))) + if( (attr=attr_search(attrs,attr_skin))) this_->skin=attr->u.str; - if( (attr=attr_search(attrs,NULL,attr_icon_src))) + if( (attr=attr_search(attrs,attr_icon_src))) this_->icon_src=attr->u.str; if ( this_->source==NULL ) { @@ -447,7 +447,7 @@ static struct gui_priv * gui_qml_new(struct navit *nav, struct gui_methods *meth this_->icon_src=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"),"/icons/",NULL); } - if ((attr=attr_search(attrs, NULL, attr_callback_list))) { + if ((attr=attr_search(attrs, attr_callback_list))) { command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), this_); } diff --git a/navit/gui/qt5_qml/gui_qt5_qml.cpp b/navit/gui/qt5_qml/gui_qt5_qml.cpp index dfdbf5d14..caab81709 100644 --- a/navit/gui/qt5_qml/gui_qt5_qml.cpp +++ b/navit/gui/qt5_qml/gui_qt5_qml.cpp @@ -281,7 +281,7 @@ static struct gui_priv* gui_qt5_qml_new(struct navit* nav, struct gui_methods* m gui_priv->menu_on_map_click = 1; /* read config */ - if ((attr = attr_search(attrs, NULL, attr_menu_on_map_click))) + if ((attr = attr_search(attrs, attr_menu_on_map_click))) gui_priv->menu_on_map_click = attr->u.num; /* remember navit internal handle */ diff --git a/navit/icons/CMakeLists.txt b/navit/icons/CMakeLists.txt index 9817aa25e..548bef441 100644 --- a/navit/icons/CMakeLists.txt +++ b/navit/icons/CMakeLists.txt @@ -30,7 +30,7 @@ macro(convert_to_png IMAGE_INPUT IMAGE_OUTPUT SCALE) else() set(SCALE_ARGS) endif() - set(COMMAND_ARGS --without-gui --export-background-opacity=0 --export-png ${IMAGE_OUTPUT} ${SCALE_ARGS} ${IMAGE_INPUT}) + set(COMMAND_ARGS --export-type=png --export-background-opacity=0 ${SCALE_ARGS} --export-filename=${IMAGE_OUTPUT} ${IMAGE_INPUT}) else() message(FATAL_ERROR "no svg2png converter defined here.") endif() diff --git a/navit/icons/archaeological_site.svg b/navit/icons/archaeological_site.svg index 19fc27283..31cf5c25a 100644 --- a/navit/icons/archaeological_site.svg +++ b/navit/icons/archaeological_site.svg @@ -5,7 +5,18 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> <dc:title/> + <cc:license + rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" /> </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/publicdomain/zero/1.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + </cc:License> </rdf:RDF> </metadata> <defs id="defs6"/> diff --git a/navit/icons/cave.svg b/navit/icons/cave.svg index c1a900573..575d38a92 100644 --- a/navit/icons/cave.svg +++ b/navit/icons/cave.svg @@ -22,7 +22,18 @@ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> + <cc:license + rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" /> </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/publicdomain/zero/1.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + </cc:License> </rdf:RDF> </metadata> <g diff --git a/navit/icons/navit_svg2png b/navit/icons/navit_svg2png index 668613a61..32939c7f6 100755 --- a/navit/icons/navit_svg2png +++ b/navit/icons/navit_svg2png @@ -19,7 +19,7 @@ svgtopng() $svgtopng --width=$1 --height=$2 --output $4 $3 ;; *inkscape) - $svgtopng --without-gui --export-width=$1 --export-height=$2 --export-png=$BUILDDIR/$4 $3 + $svgtopng --export-width=$1 --export-height=$2 --export-type=png --export-filename=$4 $3 ;; *convert) $svgtopng -alpha on -background none $3 -resize $1x$2 $4 diff --git a/navit/layout.c b/navit/layout.c index deed09ef0..0889fb52b 100644 --- a/navit/layout.c +++ b/navit/layout.c @@ -43,7 +43,7 @@ layout_new(struct attr *parent, struct attr **attrs) { struct attr *name_attr,*color_attr,*order_delta_attr,*font_attr,*day_attr,*night_attr,*active_attr, *underground_alpha_attr,*icon_attr; - if (! (name_attr=attr_search(attrs, NULL, attr_name))) + if (! (name_attr=attr_search(attrs, attr_name))) return NULL; navit = parent->u.navit; if (navit_get_layout_by_name(navit, name_attr->u.str)) { @@ -56,37 +56,37 @@ layout_new(struct attr *parent, struct attr **attrs) { l->func=&layout_func; navit_object_ref((struct navit_object *)l); l->name = g_strdup(name_attr->u.str); - if ((font_attr=attr_search(attrs, NULL, attr_font))) { + if ((font_attr=attr_search(attrs, attr_font))) { l->font = g_strdup(font_attr->u.str); } - if ((day_attr=attr_search(attrs, NULL, attr_daylayout))) { + if ((day_attr=attr_search(attrs, attr_daylayout))) { l->dayname = g_strdup(day_attr->u.str); } - if ((night_attr=attr_search(attrs, NULL, attr_nightlayout))) { + if ((night_attr=attr_search(attrs, attr_nightlayout))) { l->nightname = g_strdup(night_attr->u.str); } - if ((color_attr=attr_search(attrs, NULL, attr_color))) + if ((color_attr=attr_search(attrs, attr_color))) l->color = *color_attr->u.color; else l->color = def_color; - if ((underground_alpha_attr=attr_search(attrs, NULL, attr_underground_alpha))) { + if ((underground_alpha_attr=attr_search(attrs, attr_underground_alpha))) { int a = underground_alpha_attr->u.num; /* for convenience, the alpha value is just 8 bit as usual if using * corresponding attr. therefore we need to shift that up */ l->underground_alpha = (a << 8) | a; } else l->underground_alpha = def_underground_alpha; - if ((icon_attr=attr_search(attrs, NULL, attr_icon_w))) + if ((icon_attr=attr_search(attrs, attr_icon_w))) l->icon_w = icon_attr->u.num; else l->icon_w = -1; - if ((icon_attr=attr_search(attrs, NULL, attr_icon_h))) + if ((icon_attr=attr_search(attrs, attr_icon_h))) l->icon_h = icon_attr->u.num; else l->icon_h = -1; - if ((order_delta_attr=attr_search(attrs, NULL, attr_order_delta))) + if ((order_delta_attr=attr_search(attrs, attr_order_delta))) l->order_delta=order_delta_attr->u.num; - if ((active_attr=attr_search(attrs, NULL, attr_active))) + if ((active_attr=attr_search(attrs, attr_active))) l->active = active_attr->u.num; l->navit=navit; return l; @@ -199,23 +199,23 @@ cursor_new(struct attr *parent, struct attr **attrs) { struct attr *w, *h, *name, *interval, *sequence_range; struct cursor *this; - w=attr_search(attrs, NULL, attr_w); - h=attr_search(attrs, NULL, attr_h); + w=attr_search(attrs, attr_w); + h=attr_search(attrs, attr_h); if (! w || ! h) return NULL; this=g_new0(struct cursor,1); this->w=w->u.num; this->h=h->u.num; - name=attr_search(attrs, NULL, attr_name); + name=attr_search(attrs, attr_name); if (name) this->name=g_strdup(name->u.str); else this->name=g_strdup("default"); - interval=attr_search(attrs, NULL, attr_interval); + interval=attr_search(attrs, attr_interval); if (interval) this->interval=interval->u.num; - sequence_range=attr_search(attrs, NULL, attr_sequence_range); + sequence_range=attr_search(attrs, attr_sequence_range); if (sequence_range) { struct range *r=g_new0(struct range,1); r->min=sequence_range->u.range.min; @@ -358,11 +358,11 @@ struct itemgra * itemgra_new(struct attr *parent, struct attr **attrs) { struct range defrange; itm = g_new0(struct itemgra, 1); - order=attr_search(attrs, NULL, attr_order); - item_types=attr_search(attrs, NULL, attr_item_types); - speed_range=attr_search(attrs, NULL, attr_speed_range); - angle_range=attr_search(attrs, NULL, attr_angle_range); - sequence_range=attr_search(attrs, NULL, attr_sequence_range); + order=attr_search(attrs, attr_order); + item_types=attr_search(attrs, attr_item_types); + speed_range=attr_search(attrs, attr_speed_range); + angle_range=attr_search(attrs, attr_angle_range); + sequence_range=attr_search(attrs, attr_sequence_range); defrange.min=0; defrange.max=32767; if (order) @@ -409,14 +409,14 @@ int itemgra_add_attr(struct itemgra *itemgra, struct attr *attr) { static void element_set_oneway(struct element *e, struct attr **attrs) { struct attr *oneway; - oneway=attr_search(attrs, NULL, attr_oneway); + oneway=attr_search(attrs, attr_oneway); if (oneway) e->oneway=oneway->u.num; } static void element_set_color(struct element *e, struct attr **attrs) { struct attr *color; - color=attr_search(attrs, NULL, attr_color); + color=attr_search(attrs, attr_color); if (color) e->color=*color->u.color; } @@ -424,7 +424,7 @@ static void element_set_color(struct element *e, struct attr **attrs) { static void element_set_background_color(struct color *c, struct attr **attrs) { struct attr *color; - color=attr_search(attrs, NULL, attr_background_color); + color=attr_search(attrs, attr_background_color); if (color) *c=*color->u.color; } @@ -432,14 +432,14 @@ static void element_set_background_color(struct color *c, struct attr **attrs) { static void element_set_text_size(struct element *e, struct attr **attrs) { struct attr *text_size; - text_size=attr_search(attrs, NULL, attr_text_size); + text_size=attr_search(attrs, attr_text_size); if (text_size) e->text_size=text_size->u.num; } static void element_set_arrows_width(struct element *e, struct attr **attrs) { struct attr *width; - width=attr_search(attrs, NULL, attr_width); + width=attr_search(attrs, attr_width); if (width) e->u.arrows.width=width->u.num; else @@ -448,14 +448,14 @@ static void element_set_arrows_width(struct element *e, struct attr **attrs) { static void element_set_polyline_width(struct element *e, struct attr **attrs) { struct attr *width; - width=attr_search(attrs, NULL, attr_width); + width=attr_search(attrs, attr_width); if (width) e->u.polyline.width=width->u.num; } static void element_set_polyline_directed(struct element *e, struct attr **attrs) { struct attr *directed; - directed=attr_search(attrs, NULL, attr_directed); + directed=attr_search(attrs, attr_directed); if (directed) e->u.polyline.directed=directed->u.num; } @@ -464,7 +464,7 @@ static void element_set_polyline_dash(struct element *e, struct attr **attrs) { struct attr *dash; int i; - dash=attr_search(attrs, NULL, attr_dash); + dash=attr_search(attrs, attr_dash); if (dash) { for (i=0; i<4; i++) { if (!dash->u.dash[i]) @@ -477,21 +477,21 @@ static void element_set_polyline_dash(struct element *e, struct attr **attrs) { static void element_set_polyline_offset(struct element *e, struct attr **attrs) { struct attr *offset; - offset=attr_search(attrs, NULL, attr_offset); + offset=attr_search(attrs, attr_offset); if (offset) e->u.polyline.offset=offset->u.num; } static void element_set_circle_width(struct element *e, struct attr **attrs) { struct attr *width; - width=attr_search(attrs, NULL, attr_width); + width=attr_search(attrs, attr_width); if (width) e->u.circle.width=width->u.num; } static void element_set_circle_radius(struct element *e, struct attr **attrs) { struct attr *radius; - radius=attr_search(attrs, NULL, attr_radius); + radius=attr_search(attrs, attr_radius); if (radius) e->u.circle.radius=radius->u.num; } @@ -502,7 +502,7 @@ polygon_new(struct attr *parent, struct attr **attrs) { int add_size_to_e=0; struct attr *src,*w,*h,*rotation,*x,*y; /* search fot icon src first as this increases the required memory for e*/ - src=attr_search(attrs, NULL, attr_src); + src=attr_search(attrs, attr_src); if (src != NULL) { add_size_to_e += strlen(src->u.str)+1; } @@ -517,27 +517,27 @@ polygon_new(struct attr *parent, struct attr **attrs) { if (src != NULL) { e->u.polygon.src=(char *)(e+1); strcpy(e->u.polygon.src,src->u.str); - if ((w=attr_search(attrs, NULL, attr_w))) + if ((w=attr_search(attrs, attr_w))) e->u.polygon.width=w->u.num; else e->u.polygon.width=-1; - if ((h=attr_search(attrs, NULL, attr_h))) + if ((h=attr_search(attrs, attr_h))) e->u.polygon.height=h->u.num; else e->u.polygon.height=-1; - if ((x=attr_search(attrs, NULL, attr_x))) + if ((x=attr_search(attrs, attr_x))) e->u.polygon.x=x->u.num; else e->u.polygon.x=-1; - if ((y=attr_search(attrs, NULL, attr_y))) + if ((y=attr_search(attrs, attr_y))) e->u.polygon.y=y->u.num; else e->u.polygon.y=-1; - if ((rotation=attr_search(attrs, NULL, attr_rotation))) + if ((rotation=attr_search(attrs, attr_rotation))) e->u.polygon.rotation=rotation->u.num; } @@ -601,29 +601,29 @@ struct icon * icon_new(struct attr *parent, struct attr **attrs) { struct element *e; struct attr *src,*w,*h,*rotation,*x,*y; - src=attr_search(attrs, NULL, attr_src); + src=attr_search(attrs, attr_src); if (! src) return NULL; e = g_malloc0(sizeof(*e)+strlen(src->u.str)+1); e->type=element_icon; e->u.icon.src=(char *)(e+1); - if ((w=attr_search(attrs, NULL, attr_w))) + if ((w=attr_search(attrs, attr_w))) e->u.icon.width=w->u.num; else e->u.icon.width=-1; - if ((h=attr_search(attrs, NULL, attr_h))) + if ((h=attr_search(attrs, attr_h))) e->u.icon.height=h->u.num; else e->u.icon.height=-1; - if ((x=attr_search(attrs, NULL, attr_x))) + if ((x=attr_search(attrs, attr_x))) e->u.icon.x=x->u.num; else e->u.icon.x=-1; - if ((y=attr_search(attrs, NULL, attr_y))) + if ((y=attr_search(attrs, attr_y))) e->u.icon.y=y->u.num; else e->u.icon.y=-1; - if ((rotation=attr_search(attrs, NULL, attr_rotation))) + if ((rotation=attr_search(attrs, attr_rotation))) e->u.icon.rotation=rotation->u.num; strcpy(e->u.icon.src,src->u.str); diff --git a/navit/log.c b/navit/log.c index d68312938..490414c03 100644 --- a/navit/log.c +++ b/navit/log.c @@ -369,7 +369,7 @@ log_new(struct attr * parent,struct attr **attrs) { dbg(lvl_debug,"enter"); ret->func=&log_func; navit_object_ref((struct navit_object *)ret); - data=attr_search(attrs, NULL, attr_data); + data=attr_search(attrs, attr_data); if (! data) return NULL; filename=data->u.str; @@ -382,19 +382,19 @@ log_new(struct attr * parent,struct attr **attrs) { ret->filename=g_strdup(filename); if (wexp) file_wordexp_destroy(wexp); - overwrite=attr_search(attrs, NULL, attr_overwrite); + overwrite=attr_search(attrs, attr_overwrite); if (overwrite) ret->overwrite=overwrite->u.num; - lazy=attr_search(attrs, NULL, attr_lazy); + lazy=attr_search(attrs, attr_lazy); if (lazy) ret->lazy=lazy->u.num; - mkdir=attr_search(attrs, NULL, attr_mkdir); + mkdir=attr_search(attrs, attr_mkdir); if (mkdir) ret->mkdir=mkdir->u.num; - flush_size=attr_search(attrs, NULL, attr_flush_size); + flush_size=attr_search(attrs, attr_flush_size); if (flush_size) ret->flush_size=flush_size->u.num; - flush_time=attr_search(attrs, NULL, attr_flush_time); + flush_time=attr_search(attrs, attr_flush_time); if (flush_time) ret->flush_time=flush_time->u.num; if (ret->flush_time) { diff --git a/navit/map.c b/navit/map.c index 66b1cd303..c8cddbcc2 100644 --- a/navit/map.c +++ b/navit/map.c @@ -92,7 +92,7 @@ struct map * map_new(struct attr *parent, struct attr **attrs) { struct map *m; struct map_priv *(*maptype_new)(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl); - struct attr *type=attr_search(attrs, NULL, attr_type); + struct attr *type=attr_search(attrs, attr_type); if (! type) { dbg(lvl_error,"missing type"); diff --git a/navit/map/binfile/binfile.c b/navit/map/binfile/binfile.c index 865e3d72b..ab65dcaf5 100644 --- a/navit/map/binfile/binfile.c +++ b/navit/map/binfile/binfile.c @@ -565,7 +565,7 @@ static int binfile_attr_get(void *priv_data, enum attr_type attr_type, struct at size_rem-=subsize+1; i++; } - mr->attrs[i].type=type_none; + mr->attrs[i].type=attr_none; mr->attrs[i].u.data=NULL; attr->u.attrs=mr->attrs; } else { @@ -2647,7 +2647,7 @@ static void binfile_check_version(struct map_priv *m) { static struct map_priv *map_new_binfile(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct map_priv *m; - struct attr *data=attr_search(attrs, NULL, attr_data); + struct attr *data=attr_search(attrs, attr_data); struct attr *check_version,*flags,*url,*download_enabled; struct file_wordexp *wexp; char **wexp_data; @@ -2664,16 +2664,16 @@ static struct map_priv *map_new_binfile(struct map_methods *meth, struct attr ** m->id=++map_id; m->filename=g_strdup(wexp_data[0]); file_wordexp_destroy(wexp); - check_version=attr_search(attrs, NULL, attr_check_version); + check_version=attr_search(attrs, attr_check_version); if (check_version) m->check_version=check_version->u.num; - flags=attr_search(attrs, NULL, attr_flags); + flags=attr_search(attrs, attr_flags); if (flags) m->flags=flags->u.num; - url=attr_search(attrs, NULL, attr_url); + url=attr_search(attrs, attr_url); if (url) m->url=g_strdup(url->u.str); - download_enabled = attr_search(attrs, NULL, attr_update); + download_enabled = attr_search(attrs, attr_update); if (download_enabled) m->download_enabled=download_enabled->u.num; diff --git a/navit/map/csv/csv.c b/navit/map/csv/csv.c index e463985b0..e54a840d4 100644 --- a/navit/map/csv/csv.c +++ b/navit/map/csv/csv.c @@ -661,7 +661,7 @@ static struct map_priv *map_new_csv(struct map_methods *meth, struct attr **attr m->qitem_hash = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, quadtree_item_free_do); m->tree_root = tree_root; - attr_types = attr_search(attrs, NULL, attr_attr_types); + attr_types = attr_search(attrs, attr_attr_types); if(attr_types) { enum attr_type* at = attr_types->u.attr_types; while(*at != attr_none) { @@ -682,7 +682,7 @@ static struct map_priv *map_new_csv(struct map_methods *meth, struct attr **attr return NULL; } - charset = attr_search(attrs, NULL, attr_charset); + charset = attr_search(attrs, attr_charset); if(charset) { dbg(lvl_debug,"charset:%s",charset->u.str); m->charset=g_strdup(charset->u.str); @@ -694,7 +694,7 @@ static struct map_priv *map_new_csv(struct map_methods *meth, struct attr **attr return NULL; } - item_type_attr=attr_search(attrs, NULL, attr_item_type); + item_type_attr=attr_search(attrs, attr_item_type); if( !item_type_attr || item_type_attr->u.item_type==type_none) { return NULL; @@ -702,13 +702,13 @@ static struct map_priv *map_new_csv(struct map_methods *meth, struct attr **attr m->item_type = item_type_attr->u.item_type; - flags=attr_search(attrs, NULL, attr_flags); + flags=attr_search(attrs, attr_flags); if (flags) m->flags=flags->u.num; *meth = map_methods_csv; - data=attr_search(attrs, NULL, attr_data); + data=attr_search(attrs, attr_data); if(data) { struct file_wordexp *wexp; diff --git a/navit/map/filter/filter.c b/navit/map/filter/filter.c index c8f4f1029..1925b9e80 100644 --- a/navit/map/filter/filter.c +++ b/navit/map/filter/filter.c @@ -354,7 +354,7 @@ static struct map_methods map_methods_filter = { static struct map_priv *map_filter_new(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct map_priv *m=NULL; - struct attr **parent_attrs,type,*subtype=attr_search(attrs, NULL, attr_subtype),*filter=attr_search(attrs, NULL, + struct attr **parent_attrs,type,*subtype=attr_search(attrs, attr_subtype),*filter=attr_search(attrs, attr_filter); struct map *map; int i,j; diff --git a/navit/map/garmin/garmin.c b/navit/map/garmin/garmin.c index 00a6fa115..2f4808b3b 100644 --- a/navit/map/garmin/garmin.c +++ b/navit/map/garmin/garmin.c @@ -873,16 +873,16 @@ static struct map_priv *gmap_new(struct map_methods *meth, struct attr **attrs, struct gar_config cfg; int debugmask = 0; - data=attr_search(attrs, NULL, attr_data); + data=attr_search(attrs, attr_data); if (! data) return NULL; - debug=attr_search(attrs, NULL, attr_debug); + debug=attr_search(attrs, attr_debug); if (debug) { dl = atoi(debug->u.str); if (!dl) dl = 1; } - flags=attr_search(attrs, NULL, attr_flags); + flags=attr_search(attrs, attr_flags); if (flags) { debugmask = flags->u.num; } diff --git a/navit/map/garmin_img/garmin_img.c b/navit/map/garmin_img/garmin_img.c index 73a7dc92b..79219cf06 100644 --- a/navit/map/garmin_img/garmin_img.c +++ b/navit/map/garmin_img/garmin_img.c @@ -1411,7 +1411,7 @@ static struct map_methods map_methods_garmin_img = { static struct map_priv *map_new_garmin_img(struct map_methods *meth, struct attr **attrs) { struct map_priv *m; - struct attr *data=attr_search(attrs, NULL, attr_data); + struct attr *data=attr_search(attrs, attr_data); if (! data) return NULL; diff --git a/navit/map/mg/map.c b/navit/map/mg/map.c index 50860e193..071ba131e 100644 --- a/navit/map/mg/map.c +++ b/navit/map/mg/map.c @@ -549,7 +549,7 @@ struct map_priv * map_new_mg(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct map_priv *m; int i,maybe_missing; - struct attr *data=attr_search(attrs, NULL, attr_data); + struct attr *data=attr_search(attrs, attr_data); char *filename; struct file_wordexp *wexp; char **wexp_data; @@ -561,7 +561,7 @@ map_new_mg(struct map_methods *meth, struct attr **attrs, struct callback_list * wexp_data=file_wordexp_get_array(wexp); *meth=map_methods_mg; - data=attr_search(attrs, NULL, attr_data); + data=attr_search(attrs, attr_data); m=g_new(struct map_priv, 1); m->id=++map_id; diff --git a/navit/map/shapefile/shapefile.c b/navit/map/shapefile/shapefile.c index 1031b6903..66e7cb380 100644 --- a/navit/map/shapefile/shapefile.c +++ b/navit/map/shapefile/shapefile.c @@ -590,10 +590,10 @@ static struct map_methods map_methods_shapefile = { static struct map_priv *map_new_shapefile(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct map_priv *m; - struct attr *data=attr_search(attrs, NULL, attr_data); - struct attr *charset=attr_search(attrs, NULL, attr_charset); - struct attr *projectionname=attr_search(attrs, NULL, attr_projectionname); - struct attr *flags=attr_search(attrs, NULL, attr_flags); + struct attr *data=attr_search(attrs, attr_data); + struct attr *charset=attr_search(attrs, attr_charset); + struct attr *projectionname=attr_search(attrs, attr_projectionname); + struct attr *flags=attr_search(attrs, attr_flags); struct file_wordexp *wexp; char *wdata; char **wexp_data; diff --git a/navit/map/textfile/textfile.c b/navit/map/textfile/textfile.c index 12381d6c0..0211a4526 100644 --- a/navit/map/textfile/textfile.c +++ b/navit/map/textfile/textfile.c @@ -328,10 +328,10 @@ static struct map_methods map_methods_textfile = { static struct map_priv *map_new_textfile(struct map_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct map_priv *m; - struct attr *data=attr_search(attrs, NULL, attr_data); - struct attr *charset=attr_search(attrs, NULL, attr_charset); - struct attr *flags=attr_search(attrs, NULL, attr_flags); - struct attr *no_warn=attr_search(attrs, NULL, attr_no_warning_if_map_file_missing); + struct attr *data=attr_search(attrs, attr_data); + struct attr *charset=attr_search(attrs, attr_charset); + struct attr *flags=attr_search(attrs, attr_flags); + struct attr *no_warn=attr_search(attrs, attr_no_warning_if_map_file_missing); struct file_wordexp *wexp; int len,is_pipe=0; char *wdata; diff --git a/navit/maps.c b/navit/maps.c index 4caf6dcf8..a92041ec0 100644 --- a/navit/maps.c +++ b/navit/maps.c @@ -40,13 +40,13 @@ maps_new(struct attr *parent, struct attr **attrs) { } dbg(lvl_debug,"enter"); attrs_dup=attr_list_dup(attrs); - data=attr_search(attrs_dup, NULL, attr_data); + data=attr_search(attrs_dup, attr_data); if (data) { struct file_wordexp *wexp=file_wordexp_new(data->u.str); int i,count=file_wordexp_get_count(wexp); char **array=file_wordexp_get_array(wexp); struct attr *name; - struct attr *name_provided = attr_search(attrs_dup, NULL, attr_name); + struct attr *name_provided = attr_search(attrs_dup, attr_name); // if no name was provided, fill the name with the location if (!name_provided) { @@ -54,7 +54,7 @@ maps_new(struct attr *parent, struct attr **attrs) { name_tmp.type = attr_name; name_tmp.u.str="NULL"; attrs_dup=attr_generic_add_attr(attrs_dup, &name_tmp); - name = attr_search(attrs_dup, NULL, attr_name); + name = attr_search(attrs_dup, attr_name); } for (i = 0 ; i < count ; i++) { diff --git a/navit/maptool/maptool.h b/navit/maptool/maptool.h index 37590e30b..49b13fd92 100644 --- a/navit/maptool/maptool.h +++ b/navit/maptool/maptool.h @@ -406,7 +406,7 @@ int write_aux_tiles(struct zip_info *zip_info); int create_tile_hash(void); void write_tilesdir(struct tile_info *info, struct zip_info *zip_info, FILE *out); void merge_tiles(struct tile_info *info); -struct attr map_information_attrs[32]; +extern struct attr map_information_attrs[32]; void index_init(struct zip_info *info, int version); void index_submap_add(struct tile_info *info, struct tile_head *th); diff --git a/navit/navigation.c b/navit/navigation.c index 1ddec7d33..dd7c9fbf5 100644 --- a/navit/navigation.c +++ b/navit/navigation.c @@ -793,13 +793,13 @@ navigation_new(struct attr *parent, struct attr **attrs) { } } - if ((attr=attr_search(attrs, NULL, attr_tell_street_name))) { + if ((attr=attr_search(attrs, attr_tell_street_name))) { ret->tell_street_name = attr->u.num; } - if ((attr=attr_search(attrs, NULL, attr_delay))) { + if ((attr=attr_search(attrs, attr_delay))) { ret->delay = attr->u.num; } - if ((attr=attr_search(attrs, NULL, attr_flags))) { + if ((attr=attr_search(attrs, attr_flags))) { ret->flags = attr->u.num; } return ret; @@ -4294,7 +4294,7 @@ static struct map_priv *navigation_map_new(struct map_methods *meth, struct attr struct map_priv *ret; struct attr *navigation_attr; - navigation_attr=attr_search(attrs, NULL, attr_navigation); + navigation_attr=attr_search(attrs, attr_navigation); if (! navigation_attr) return NULL; ret=g_new0(struct map_priv, 1); diff --git a/navit/navit.c b/navit/navit.c index dc5fb8fdb..d94e123cb 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -767,7 +767,7 @@ static void navit_autozoom(struct navit *this_, struct coord *center, int speed, new_scale = (double)distance / w * 16; } - if (abs(new_scale - scale) < 2) { + if (abs((int)new_scale - (int)scale) < 2) { return; // Smoothing } if (new_scale > this_->autozoom_max) diff --git a/navit/navit_shipped.xml b/navit/navit_shipped.xml index 5473349c7..5c2c404dc 100644 --- a/navit/navit_shipped.xml +++ b/navit/navit_shipped.xml @@ -37,6 +37,21 @@ <navit center="11.5666 48.1333" zoom="256" tracking="1" orientation="-1" recent_dest="250" drag_bitmap="0" default_layout="Car"> <!-- Use one of gtk_drawing_area, qt_qpainter or sdl. On windows systems, use win32 --> <graphics type="gtk_drawing_area"/> + + <!-- + To debug the graphics plugin in question it is possible to proxy it with svg_debug + This way every frame will be written as a svg file. In addition to this the real graphics plugin will + be called. To configure this, set type to svg_debug and the name attribute to the proxied plugin. + Parameters are past to the proxied plugin as well. But resize callbacks currently only passed to the proxied + plugin, and not handled by svg_debug, so resizing the window will not update the width and height of the resulting + scg file. But all calls will still be recorded and written to the file, so you will see those drawing when opening + the svg in an editor like inkscape. + Example: + --> + <!-- + <graphics type="svg_debug" name="sdl2" window_title="Alternative attributes as passed to proxied plugin" w="1000" h="1000" /> + --> + <!-- The following line let you select which graphical user interface you'd like to use. Options include internal (optimized for touch screen devices), gtk (useful for desktop computers). diff --git a/navit/osd.c b/navit/osd.c index 8b548b044..218a4a51d 100644 --- a/navit/osd.c +++ b/navit/osd.c @@ -45,7 +45,7 @@ struct osd * osd_new(struct attr *parent, struct attr **attrs) { struct osd *o; struct osd_priv *(*new)(struct navit *nav, struct osd_methods *meth, struct attr **attrs); - struct attr *type=attr_search(attrs, NULL, attr_type),cbl; + struct attr *type=attr_search(attrs, attr_type),cbl; if (! type) return NULL; @@ -301,55 +301,55 @@ void osd_set_std_attr(struct attr **attrs, struct osd_item *item, int flags) { item->color_bg.a = 0x9fff; } - attr=attr_search(attrs, NULL, attr_osd_configuration); + attr=attr_search(attrs, attr_osd_configuration); if (attr) item->osd_configuration = attr->u.num; - attr=attr_search(attrs, NULL, attr_enable_expression); + attr=attr_search(attrs, attr_enable_expression); if (attr) { item->enable_cs = command_saved_new(attr->u.str, item->navit, NULL, 0); } - attr = attr_search(attrs, NULL, attr_w); + attr = attr_search(attrs, attr_w); if (attr) { item->rel_w = attr->u.num; } - attr = attr_search(attrs, NULL, attr_h); + attr = attr_search(attrs, attr_h); if (attr) { item->rel_h = attr->u.num; } - attr = attr_search(attrs, NULL, attr_x); + attr = attr_search(attrs, attr_x); if (attr) { item->rel_x = attr->u.num; } - attr = attr_search(attrs, NULL, attr_y); + attr = attr_search(attrs, attr_y); if (attr) { item->rel_y = attr->u.num; } - attr = attr_search(attrs, NULL, attr_font_size); + attr = attr_search(attrs, attr_font_size); if (attr) item->font_size = attr->u.num; - attr=attr_search(attrs, NULL, attr_background_color); + attr=attr_search(attrs, attr_background_color); if (attr) item->color_bg=*attr->u.color; - attr = attr_search(attrs, NULL, attr_command); + attr = attr_search(attrs, attr_command); if (attr) item->command = g_strdup(attr->u.str); - attr=attr_search(attrs, NULL, attr_text_color); + attr=attr_search(attrs, attr_text_color); if (attr) item->text_color=*attr->u.color; - attr=attr_search(attrs, NULL, attr_foreground_color); + attr=attr_search(attrs, attr_foreground_color); if (attr) item->color_fg=*attr->u.color; - attr=attr_search(attrs, NULL, attr_accesskey); + attr=attr_search(attrs, attr_accesskey); if (attr) item->accesskey = g_strdup(attr->u.str); - attr=attr_search(attrs, NULL, attr_font); + attr=attr_search(attrs, attr_font); if (attr) item->font_name = g_strdup(attr->u.str); diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c index d0b96a51e..40ea4350d 100644 --- a/navit/osd/core/osd_core.c +++ b/navit/osd/core/osd_core.c @@ -8,13 +8,13 @@ * * This program 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 + * 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 this program; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Boston, MA 02110-1301, USA. */ #include "config.h" @@ -450,7 +450,7 @@ static void osd_route_guard_init(struct osd_priv_common *opc, struct navit *nav) while ((map=mapset_next(msh, 1))) { struct attr attr; if(map_get_attr(map, attr_name, &attr, NULL)) { - if( ! strcmp(this->map_name, attr.u.str) ) { + if(!strcmp(this->map_name, attr.u.str) ) { mr=map_rect_new(map, NULL); if (mr) { while ((item=map_rect_get_item(mr))) { @@ -514,34 +514,34 @@ static struct osd_priv *osd_route_guard_new(struct navit *nav, struct osd_method osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_min_dist); + attr = attr_search(attrs, attr_min_dist); if (attr) { this->min_dist = attr->u.num; } else this->min_dist = 30; //default tolerance is 30m - attr = attr_search(attrs, NULL, attr_max_dist); + attr = attr_search(attrs, attr_max_dist); if (attr) { this->max_dist = attr->u.num; } else this->max_dist = 500; //default - attr = attr_search(attrs, NULL, attr_item_name); + attr = attr_search(attrs, attr_item_name); if (attr) { this->item_name = g_strdup(attr->u.str); } else this->item_name = NULL; - attr = attr_search(attrs, NULL, attr_map_name); + attr = attr_search(attrs, attr_map_name); if (attr) { this->map_name = g_strdup(attr->u.str); } else this->map_name = NULL; - attr = attr_search(attrs, NULL, attr_update_period); + attr = attr_search(attrs, attr_update_period); this->update_period=attr ? attr->u.num : 10; - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_route_guard_init), attr_graphics_ready, opc)); @@ -740,7 +740,7 @@ static void draw_aligned_osd_text(char *buffer, int align, struct osd_item *osd_ } while (*last) { - if (! g_ascii_isspace(*last)) { + if (!g_ascii_isspace(*last)) { lines++; break; } @@ -830,7 +830,7 @@ static void osd_odometer_draw(struct osd_priv_common *opc, struct navit *nav, st int secs; int imperial=0; - char buffer [256+1]=""; + char buffer[256+1]=""; char buffer2[256+1]=""; if(nav) { @@ -903,7 +903,7 @@ static void osd_odometer_draw(struct osd_priv_common *opc, struct navit *nav, st time_buffer = g_strdup_printf("%02d:%02d:%02d",hours,mins,secs); } - buffer [0] = 0; + buffer[0] = 0; buffer2[0] = 0; if(this->text) { str_replace(buffer,this->text,"${avg_spd}",spd_buffer); @@ -1069,45 +1069,45 @@ static struct osd_priv *osd_odometer_new(struct navit *nav, struct osd_methods * this->last_coord.x = -1; this->last_coord.y = -1; - attr = attr_search(attrs, NULL, attr_label); + attr = attr_search(attrs, attr_label); //FIXME find some way to free text!!!! if (attr) { this->text = g_strdup(attr->u.str); } else this->text = NULL; - attr = attr_search(attrs, NULL, attr_name); + attr = attr_search(attrs, attr_name); //FIXME find some way to free text!!!! if (attr) { this->name = g_strdup(attr->u.str); } else this->name = NULL; - attr = attr_search(attrs, NULL, attr_disable_reset); + attr = attr_search(attrs, attr_disable_reset); if (attr) this->bDisableReset = attr->u.num; else this->bDisableReset = 0; - attr = attr_search(attrs, NULL, attr_autostart); + attr = attr_search(attrs, attr_autostart); if (attr) this->bAutoStart = attr->u.num; else this->bAutoStart = 0; - attr = attr_search(attrs, NULL, attr_autosave_period); + attr = attr_search(attrs, attr_autosave_period); if (attr) this->autosave_period = attr->u.num; else this->autosave_period = -1; //disabled by default - attr = attr_search(attrs, NULL, attr_align); + attr = attr_search(attrs, attr_align); if (attr) this->align=attr->u.num; osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; - attr = attr_search(attrs, NULL, attr_idle_color); + attr = attr_search(attrs, attr_idle_color); this->idle_color=attr ? *attr->u.color : orange_color; // text idle_color defaults to orange this->last_coord.x = -1; @@ -1278,13 +1278,13 @@ static struct osd_priv *osd_cmd_interface_new(struct navit *nav, struct osd_meth osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; - attr = attr_search(attrs, NULL, attr_update_period); + attr = attr_search(attrs, attr_update_period); this->update_period=attr ? attr->u.num : 5; //default update period is 5 seconds - attr = attr_search(attrs, NULL, attr_command); + attr = attr_search(attrs, attr_command); this->command = attr ? g_strdup(attr->u.str) : g_strdup(""); if(b_commandtable_added == 0) { @@ -1436,11 +1436,11 @@ static struct osd_priv *osd_stopwatch_new(struct navit *nav, struct osd_methods this->last_click_time = 0; osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; - attr = attr_search(attrs, NULL, attr_idle_color); + attr = attr_search(attrs, attr_idle_color); this->idle_color=attr ? *attr->u.color : orange_color; // text idle_color defaults to orange - attr = attr_search(attrs, NULL, attr_disable_reset); + attr = attr_search(attrs, attr_disable_reset); if (attr) this->bDisableReset = attr->u.num; else @@ -1550,12 +1550,12 @@ static struct osd_priv *osd_compass_new(struct navit *nav, struct osd_methods *m 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, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; - attr = attr_search(attrs, NULL, attr_destination_dir_color); + attr = attr_search(attrs, attr_destination_dir_color); this->destination_dir_color=attr ? *attr->u.color : green_color; /* Pick destination color from configuration, default to green if unspecified */ - attr = attr_search(attrs, NULL, attr_north_color); + attr = attr_search(attrs, attr_north_color); this->north_color=attr ? *attr->u.color : red_color; /* Pick north handle color from configuration, default to red if unspecified */ @@ -1741,7 +1741,7 @@ static struct osd_priv *osd_button_new(struct navit *nav, struct osd_methods *me meth->set_attr = set_std_osd_attr; opc->spec_set_attr_func = osd_button_set_attr; - attr=attr_search(attrs, NULL, attr_use_overlay); + attr=attr_search(attrs, attr_use_overlay); if (attr) this->use_overlay=attr->u.num; @@ -1751,12 +1751,12 @@ static struct osd_priv *osd_button_new(struct navit *nav, struct osd_methods *me dbg(lvl_error, "no command"); goto error; } - attr = attr_search(attrs, NULL, attr_src_dir); + attr = attr_search(attrs, attr_src_dir); if (attr) this->src_dir=graphics_icon_path(attr->u.str); else this->src_dir=NULL; - attr = attr_search(attrs, NULL, attr_src); + attr = attr_search(attrs, attr_src); if (!attr) { dbg(lvl_error, "no src"); goto error; @@ -1825,14 +1825,14 @@ static struct osd_priv *osd_image_new(struct navit *nav, struct osd_methods *met meth->set_attr = set_std_osd_attr; opc->spec_set_attr_func = osd_button_set_attr; - attr=attr_search(attrs, NULL, attr_use_overlay); + attr=attr_search(attrs, 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); + attr = attr_search(attrs, attr_src); if (!attr) { dbg(lvl_error, "no src"); goto error; @@ -2019,15 +2019,15 @@ static struct osd_priv *osd_navigation_status_new(struct navit *nav, struct osd_ this->icon_h = -1; this->last_status = status_invalid; - attr = attr_search(attrs, NULL, attr_icon_w); + attr = attr_search(attrs, attr_icon_w); if (attr) this->icon_w = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_h); + attr = attr_search(attrs, attr_icon_h); if (attr) this->icon_h = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_src); + attr = attr_search(attrs, attr_icon_src); if (attr) { struct file_wordexp *we; char **array; @@ -2165,15 +2165,15 @@ static struct osd_priv *osd_nav_next_turn_new(struct navit *nav, struct osd_meth this->active = -1; this->level = 0; - attr = attr_search(attrs, NULL, attr_icon_w); + attr = attr_search(attrs, attr_icon_w); if (attr) this->icon_w = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_h); + attr = attr_search(attrs, attr_icon_h); if (attr) this->icon_h = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_src); + attr = attr_search(attrs, attr_icon_src); if (attr) { struct file_wordexp *we; char **array; @@ -2185,7 +2185,7 @@ static struct osd_priv *osd_nav_next_turn_new(struct navit *nav, struct osd_meth this->icon_src = graphics_icon_path("%s_wh.svg"); } - attr = attr_search(attrs, NULL, attr_level); + attr = attr_search(attrs, attr_level); if (attr) this->level=attr->u.num; @@ -2287,7 +2287,7 @@ static struct osd_priv *osd_nav_toggle_announcer_new(struct navit *nav, struct o this->last_state = -1; - attr = attr_search(attrs, NULL, attr_icon_src); + attr = attr_search(attrs, attr_icon_src); if (attr) { struct file_wordexp *we; char **array; @@ -2473,11 +2473,11 @@ static void osd_speed_cam_draw(struct osd_priv_common *opc, struct navit *navit, } if(this_->text) { - char buffer [256]=""; + char buffer[256]=""; char buffer2[256]=""; char dir_str[16]; char spd_str[16]; - buffer [0] = 0; + buffer[0] = 0; buffer2[0] = 0; osd_fill_with_bgcolor(&opc->osd_item); @@ -2562,25 +2562,25 @@ static struct osd_priv *osd_speed_cam_new(struct navit *nav, struct osd_methods meth->set_attr = set_std_osd_attr; osd_set_std_attr(attrs, &opc->osd_item, ITEM_HAS_TEXT); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; - attr = attr_search(attrs, NULL, attr_idle_color); + attr = attr_search(attrs, attr_idle_color); this->idle_color=attr ? *attr->u.color : default_color; // text idle_color defaults to orange - attr = attr_search(attrs, NULL, attr_label); + attr = attr_search(attrs, attr_label); if (attr) { this->text = g_strdup(attr->u.str); } else this->text = NULL; - attr = attr_search(attrs, NULL, attr_announce_on); + attr = attr_search(attrs, attr_announce_on); if (attr) { this->announce_on = attr->u.num; } else { this->announce_on = 1; //announce by default } - attr = attr_search(attrs, NULL, attr_flags); + attr = attr_search(attrs, attr_flags); if (attr) { this->flags = attr->u.num; } else { @@ -2692,7 +2692,7 @@ static void osd_speed_warner_draw(struct osd_priv_common *opc, struct navit *nav img = this->img_active; } } else { - osd_color = this-> grey; + osd_color = this->grey; img = this->img_off; this->announce_state = eNoWarn; } @@ -2820,33 +2820,33 @@ static struct osd_priv *osd_speed_warner_new(struct navit *nav, struct osd_metho opc->osd_item.meth.draw = osd_draw_cast(osd_speed_warner_draw); meth->set_attr = set_std_osd_attr; - attr = attr_search(attrs, NULL, attr_speed_exceed_limit_offset); + attr = attr_search(attrs, attr_speed_exceed_limit_offset); if (attr) { this->speed_exceed_limit_offset = attr->u.num; } else this->speed_exceed_limit_offset = 15; //by default 15 km/h - attr = attr_search(attrs, NULL, attr_speed_exceed_limit_percent); + attr = attr_search(attrs, attr_speed_exceed_limit_percent); if (attr) { this->speed_exceed_limit_percent = attr->u.num; } else this->speed_exceed_limit_percent = 10; //by default factor of 1.1 this->bTextOnly = 0; //by default display graphics also - attr = attr_search(attrs, NULL, attr_label); + attr = attr_search(attrs, attr_label); if (attr) { this->label_str = g_strdup(attr->u.str); if (!strcmp("text_only",attr->u.str)) { this->bTextOnly = 1; } } - attr = attr_search(attrs, NULL, attr_timeout); + attr = attr_search(attrs, attr_timeout); if (attr) this->timeout = attr->u.num; else this->timeout = 10; // 10s timeout by default - attr = attr_search(attrs, NULL, attr_announce_on); + attr = attr_search(attrs, attr_announce_on); if (attr) this->announce_on = attr->u.num; else @@ -2898,6 +2898,19 @@ static char *osd_text_format_attr(struct attr *attr, char *format, int imperial) case attr_position_speed: return format_speed(*attr->u.numd,"",format,imperial); case attr_position_height: + /** + * johnk 8/13/2020 + * if format is "feet" then return feet + * else + * if format is "imperial" + * return meters or feet as controlled by "imperial" + * return meters + */ + if (format && + (!strcmp(format, "feet") || (!strcmp(format, "imperial") && imperial == 1))) { + return (format_float_0(*attr->u.numd * FEET_PER_METER) ); + } + return (format_float_0(*attr->u.numd) ); case attr_position_direction: return format_float_0(*attr->u.numd); case attr_position_magnetic_direction: @@ -2966,7 +2979,7 @@ static char *osd_text_format_attr(struct attr *attr, char *format, int imperial) if (!strcmp(format,"value") || !strcmp(format,"unit")) { char *ret,*tmp=format_distance(attr->u.num," ",imperial); char *pos=strchr(tmp,' '); - if (! pos) + if (!pos) return tmp; *pos++='\0'; if (!strcmp(format,"value")) @@ -2982,7 +2995,7 @@ static char *osd_text_format_attr(struct attr *attr, char *format, int imperial) } else { if (strstr(format, "local;") == format) { textt = iso8601_to_secs(attr->u.str); - memcpy ((void *) &tm, (void *) localtime(&textt), sizeof(tm)); + memcpy((void *) &tm, (void *) localtime(&textt), sizeof(tm)); strftime(buffer, sizeof(buffer), (char *)(format + 6), &tm); } else if ((sscanf(format, "%*c%2d:%2d;", &(text_tm.tm_hour), &(text_tm.tm_min)) == 2) && (strchr("+-", format[0]))) { if (strchr("-", format[0])) { @@ -2990,7 +3003,7 @@ static char *osd_text_format_attr(struct attr *attr, char *format, int imperial) } else { textt = iso8601_to_secs(attr->u.str) + text_tm.tm_hour * 3600 + text_tm.tm_min * 60; } - memcpy ((void *) &tm, (void *) gmtime(&textt), sizeof(tm)); + memcpy((void *) &tm, (void *) gmtime(&textt), sizeof(tm)); strftime(buffer, sizeof(buffer), &format[strcspn(format, ";") + 1], &tm); } else { sscanf(attr->u.str, "%4d-%2d-%2dT%2d:%2d:%2d", &(tm.tm_year), &(tm.tm_mon), &(tm.tm_mday), &(tm.tm_hour), &(tm.tm_min), @@ -3214,7 +3227,7 @@ static void osd_text_draw(struct osd_priv_common *opc, struct navit *navit, stru } while (*last) { - if (! g_ascii_isspace(*last)) { + if (!g_ascii_isspace(*last)) { lines++; break; } @@ -3336,7 +3349,7 @@ static void osd_text_prepare(struct osd_priv_common *opc, struct navit *nav) { } end=strstr(start,"}"); - if (! end) + if (!end) break; *end++='\0'; @@ -3456,12 +3469,12 @@ static struct osd_priv *osd_text_new(struct navit *nav, struct osd_methods *meth this->active = -1; this->last = NULL; - attr = attr_search(attrs, NULL, attr_label); + attr = attr_search(attrs, attr_label); if (attr) this->text = g_strdup(attr->u.str); else this->text = NULL; - attr = attr_search(attrs, NULL, attr_align); + attr = attr_search(attrs, attr_align); if (attr) this->align=attr->u.num; @@ -3525,7 +3538,7 @@ static void osd_gps_status_draw(struct osd_priv_common *opc, struct navit *navit if (gr_image) { p.x = (opc->osd_item.w - gr_image->width) / 2; p.y = (opc->osd_item.h - gr_image->height) / 2; - graphics_draw_image(opc->osd_item.gr, opc->osd_item. graphic_fg, &p, gr_image); + graphics_draw_image(opc->osd_item.gr, opc->osd_item.graphic_fg, &p, gr_image); graphics_image_free(opc->osd_item.gr, gr_image); } g_free(image); @@ -3566,15 +3579,15 @@ static struct osd_priv *osd_gps_status_new(struct navit *nav, struct osd_methods this->active = -1; this->strength = -2; - attr = attr_search(attrs, NULL, attr_icon_w); + attr = attr_search(attrs, attr_icon_w); if (attr) this->icon_w = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_h); + attr = attr_search(attrs, attr_icon_h); if (attr) this->icon_h = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_src); + attr = attr_search(attrs, attr_icon_src); if (attr) { struct file_wordexp *we; char **array; @@ -3611,7 +3624,7 @@ static void osd_volume_draw(struct osd_priv_common *opc, struct navit *navit, st if (gr_image) { p.x = (opc->osd_item.w - gr_image->width) / 2; p.y = (opc->osd_item.h - gr_image->height) / 2; - graphics_draw_image(opc->osd_item.gr, opc->osd_item. graphic_fg, &p, gr_image); + graphics_draw_image(opc->osd_item.gr, opc->osd_item.graphic_fg, &p, gr_image); graphics_image_free(opc->osd_item.gr, gr_image); } g_free(image); @@ -3643,7 +3656,7 @@ static void osd_volume_init(struct osd_priv_common *opc, struct navit *nav) { struct volume *this = (struct volume *)opc->data; osd_set_std_graphic(nav, &opc->osd_item, (struct osd_priv *)opc); - navit_add_callback(nav, this->click_cb = callback_new_attr_1(callback_cast (osd_volume_click), attr_button, opc)); + navit_add_callback(nav, this->click_cb = callback_new_attr_1(callback_cast(osd_volume_click), attr_button, opc)); osd_volume_draw(opc, nav, NULL); } @@ -3670,15 +3683,15 @@ static struct osd_priv *osd_volume_new(struct navit *nav, struct osd_methods *me this->active = -1; this->strength = -1; - attr = attr_search(attrs, NULL, attr_icon_w); + attr = attr_search(attrs, attr_icon_w); if (attr) this->icon_w = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_h); + attr = attr_search(attrs, attr_icon_h); if (attr) this->icon_h = attr->u.num; - attr = attr_search(attrs, NULL, attr_icon_src); + attr = attr_search(attrs, attr_icon_src); if (attr) { struct file_wordexp *we; char **array; @@ -3827,7 +3840,7 @@ static struct osd_priv *osd_scale_new(struct navit *nav, struct osd_methods *met 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, + 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; @@ -3891,17 +3904,17 @@ static void osd_auxmap_init(struct osd_priv_common *opc, struct navit *nav) { struct color red= {0xffff,0x0,0x0,0xffff}; this->nav=nav; - if (! navit_get_attr(nav, attr_graphics, &attr, NULL)) + if (!navit_get_attr(nav, attr_graphics, &attr, NULL)) return; gra=attr.u.graphics; graphics_add_callback(gra, callback_new_attr_1(callback_cast(osd_auxmap_draw), attr_postdraw, opc)); - if (! navit_get_attr(nav, attr_transformation, &attr, NULL)) + if (!navit_get_attr(nav, attr_transformation, &attr, NULL)) return; this->ntrans=attr.u.transformation; - if (! navit_get_attr(nav, attr_displaylist, &attr, NULL)) + if (!navit_get_attr(nav, attr_displaylist, &attr, NULL) ) return; this->displaylist=attr.u.displaylist; - if (! navit_get_attr(nav, attr_layout, &attr, NULL)) + if (!navit_get_attr(nav, attr_layout, &attr, NULL)) return; this->layout=attr.u.layout; osd_set_std_graphic(nav, &opc->osd_item, NULL); diff --git a/navit/plugin.c b/navit/plugin.c index 259d8e7e6..499f7d124 100644 --- a/navit/plugin.c +++ b/navit/plugin.c @@ -243,17 +243,17 @@ plugin_new(struct attr *parent, struct attr **attrs) { if (parent) pls=parent->u.plugins; - if (! (path_attr=attr_search(attrs, NULL, attr_path))) { + if (! (path_attr=attr_search(attrs, attr_path))) { dbg(lvl_error,"missing path"); return NULL; } - if ( (attr=attr_search(attrs, NULL, attr_active))) { + if ( (attr=attr_search(attrs, attr_active))) { active=attr->u.num; } - if ( (attr=attr_search(attrs, NULL, attr_lazy))) { + if ( (attr=attr_search(attrs, attr_lazy))) { lazy=attr->u.num; } - if ( (attr=attr_search(attrs, NULL, attr_ondemand))) { + if ( (attr=attr_search(attrs, attr_ondemand))) { ondemand=attr->u.num; } dbg(lvl_debug, "path=\"%s\", active=%d, lazy=%d, ondemand=%d",path_attr->u.str, active, lazy, ondemand); diff --git a/navit/plugin/j1850/j1850.c b/navit/plugin/j1850/j1850.c index 08b9c3ff0..bdef8a4fa 100644 --- a/navit/plugin/j1850/j1850.c +++ b/navit/plugin/j1850/j1850.c @@ -316,7 +316,7 @@ static void osd_j1850_init(struct j1850 *this, struct navit *nav) { graphics_gc_set_linewidth(this->white, this->width); - graphics_gc_set_linewidth(this->osd_item.graphic_fg_white, this->width); + graphics_gc_set_linewidth(this->osd_item.graphic_fg, this->width); event_add_timeout(500, 1, callback_new_1(callback_cast(osd_j1850_draw), this)); @@ -461,7 +461,7 @@ static struct osd_priv *osd_j1850_new(struct navit *nav, struct osd_methods *met this->osd_item.meth.draw = osd_draw_cast(osd_j1850_draw); osd_set_std_attr(attrs, &this->osd_item, 2); - attr = attr_search(attrs, NULL, attr_width); + attr = attr_search(attrs, attr_width); this->width=attr ? attr->u.num : 2; navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_j1850_init), attr_graphics_ready, this)); return (struct osd_priv *) this; diff --git a/navit/plugin/pedestrian/pedestrian.c b/navit/plugin/pedestrian/pedestrian.c index 08ff1076a..ec17680eb 100644 --- a/navit/plugin/pedestrian/pedestrian.c +++ b/navit/plugin/pedestrian/pedestrian.c @@ -940,7 +940,7 @@ static struct map_priv *map_route_occluded_new(struct map_methods *meth, struct struct map_priv *ret; struct attr *navit; dbg(lvl_debug, "enter\n"); - navit = attr_search(attrs, NULL, attr_navit); + navit = attr_search(attrs, attr_navit); if (!navit) { return NULL; } diff --git a/navit/route.c b/navit/route.c index e15d0fcf9..4c85e3fe9 100644 --- a/navit/route.c +++ b/navit/route.c @@ -4058,7 +4058,7 @@ static struct map_priv *route_map_new_helper(struct map_methods *meth, struct at struct map_priv *ret; struct attr *route_attr; - route_attr=attr_search(attrs, NULL, attr_route); + route_attr=attr_search(attrs, attr_route); if (! route_attr) return NULL; ret=g_new0(struct map_priv, 1); diff --git a/navit/script.c b/navit/script.c index dfc071caa..1af8b6239 100644 --- a/navit/script.c +++ b/navit/script.c @@ -34,7 +34,7 @@ struct script { }; static void script_run(struct script *scr) { - struct attr *xml_text=attr_search(scr->attrs, NULL, attr_xml_text); + struct attr *xml_text=attr_search(scr->attrs, attr_xml_text); int error; if (!xml_text || !xml_text->u.str) { dbg(lvl_error,"no text"); diff --git a/navit/speech.c b/navit/speech.c index fa560635c..2f219d469 100644 --- a/navit/speech.c +++ b/navit/speech.c @@ -38,7 +38,7 @@ speech_new(struct attr *parent, struct attr **attrs) { struct speech_priv *(*speech_new)(struct speech_methods *meth, struct attr **attrs, struct attr *parent); struct attr *attr; - attr=attr_search(attrs, NULL, attr_type); + attr=attr_search(attrs, attr_type); if (! attr) { dbg(lvl_error,"type missing"); return NULL; diff --git a/navit/speech/android/speech_android.c b/navit/speech/android/speech_android.c index a2aa24bfd..d7be8e975 100644 --- a/navit/speech/android/speech_android.c +++ b/navit/speech/android/speech_android.c @@ -99,7 +99,7 @@ static struct speech_priv *speech_android_new(struct speech_methods *meth, struc g_free(this); this=NULL; } - if ((flags = attr_search(attrs, NULL, attr_flags))) + if ((flags = attr_search(attrs, attr_flags))) this->flags=flags->u.num; return this; diff --git a/navit/speech/cmdline/speech_cmdline.c b/navit/speech/cmdline/speech_cmdline.c index 11537e570..b4a3ede0d 100644 --- a/navit/speech/cmdline/speech_cmdline.c +++ b/navit/speech/cmdline/speech_cmdline.c @@ -207,16 +207,16 @@ static struct speech_methods speechd_meth = { static struct speech_priv *speechd_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent) { struct speech_priv *this; struct attr *attr; - attr=attr_search(attrs, NULL, attr_data); + attr=attr_search(attrs, attr_data); if (! attr) return NULL; this=g_new0(struct speech_priv,1); this->cmdline=g_strdup(attr->u.str); - if ((attr=attr_search(attrs, NULL, attr_sample_dir))) + if ((attr=attr_search(attrs, attr_sample_dir))) this->sample_dir=g_strdup(attr->u.str); - if ((attr=attr_search(attrs, NULL, attr_sample_suffix))) + if ((attr=attr_search(attrs, attr_sample_suffix))) this->sample_suffix=g_strdup(attr->u.str); - if ((attr=attr_search(attrs, NULL, attr_flags))) + if ((attr=attr_search(attrs, attr_flags))) this->flags=attr->u.num; if (this->sample_dir && this->sample_suffix) { void *handle=file_opendir(this->sample_dir); diff --git a/navit/speech/espeak/speak.c b/navit/speech/espeak/speak.c index 593e1677b..766854766 100644 --- a/navit/speech/espeak/speak.c +++ b/navit/speech/espeak/speak.c @@ -385,7 +385,7 @@ static struct speech_priv *espeak_new(struct speech_methods *meth, struct attr * struct attr *language; char *lang_str=NULL; - path=attr_search(attrs, NULL, attr_path); + path=attr_search(attrs, attr_path); if (path) strcpy(path_home,path->u.str); else @@ -396,7 +396,7 @@ static struct speech_priv *espeak_new(struct speech_methods *meth, struct attr * return NULL; } - language=attr_search(attrs, NULL, attr_language); + language=attr_search(attrs, attr_language); if ( language ) { lang_str=g_strdup(language->u.str); } else { diff --git a/navit/speech/qt5_espeak/qt5_espeak.cpp b/navit/speech/qt5_espeak/qt5_espeak.cpp index a0372ff39..f56aeac33 100755 --- a/navit/speech/qt5_espeak/qt5_espeak.cpp +++ b/navit/speech/qt5_espeak/qt5_espeak.cpp @@ -75,7 +75,7 @@ static bool qt5_espeak_init_espeak(struct speech_priv* sr, struct attr** attrs) struct attr* path; /* prepare espeak library path home */ - path = attr_search(attrs, NULL, attr_path); + path = attr_search(attrs, attr_path); if (path) { sr->path_home = g_strdup(path->u.str); } else { @@ -114,7 +114,7 @@ static bool qt5_espeak_init_language(struct speech_priv* pr, struct attr** attrs espeak_ERROR error; espeak_VOICE voice_spec; - language = attr_search(attrs, NULL, attr_language); + language = attr_search(attrs, attr_language); if (language) { lang_str = g_strdup(language->u.str); } else { diff --git a/navit/support/espeak/readclause.c b/navit/support/espeak/readclause.c index 172ebad15..eda455901 100644 --- a/navit/support/espeak/readclause.c +++ b/navit/support/espeak/readclause.c @@ -2887,7 +2887,7 @@ if(option_ssml) parag=1; // Unless it's a hyphen or apostrophe (which is used by TranslateClause() ) if(IsBracket(c1)) { - c1 = 0xe000 + '('; // Unicode private useage area. So TranslateRules() knows the bracket name has been spoken + c1 = 0xe000 + '('; // Unicode private usage area. So TranslateRules() knows the bracket name has been spoken } else if(c1 != '-') diff --git a/navit/textures/CMakeLists.txt b/navit/textures/CMakeLists.txt index 5eb1fcf7e..5cd70205f 100644 --- a/navit/textures/CMakeLists.txt +++ b/navit/textures/CMakeLists.txt @@ -30,7 +30,7 @@ macro(convert_to_png TEXTURE_INPUT TEXTURE_OUTPUT SCALE) else() set(SCALE_ARGS) endif() - set(COMMAND_ARGS --without-gui --export-background-opacity=0 --export-png ${TEXTURE_OUTPUT} ${SCALE_ARGS} ${TEXTURE_INPUT}) + set(COMMAND_ARGS --export-type=png --export-background-opacity=0 ${SCALE_ARGS} --export-filename=${TEXTURE_OUTPUT} ${TEXTURE_INPUT}) else() message(FATAL_ERROR "no svg2png converter defined here.") endif() diff --git a/navit/textures/cemetery.svg b/navit/textures/cemetery.svg index f9683d378..a0a34a37a 100644 --- a/navit/textures/cemetery.svg +++ b/navit/textures/cemetery.svg @@ -19,7 +19,18 @@ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> + <cc:license + rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" /> </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/publicdomain/zero/1.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + </cc:License> </rdf:RDF> </metadata> <defs diff --git a/navit/textures/diagonal-stripes-gray.svg b/navit/textures/diagonal-stripes-gray.svg index 7b6858521..6337ced17 100644 --- a/navit/textures/diagonal-stripes-gray.svg +++ b/navit/textures/diagonal-stripes-gray.svg @@ -46,7 +46,18 @@ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> + <cc:license + rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" /> </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/publicdomain/zero/1.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + </cc:License> </rdf:RDF> </metadata> <g diff --git a/navit/textures/diagonal-stripes.svg b/navit/textures/diagonal-stripes.svg index a5ba67996..9bf8e92a4 100644 --- a/navit/textures/diagonal-stripes.svg +++ b/navit/textures/diagonal-stripes.svg @@ -46,7 +46,18 @@ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> + <cc:license + rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" /> </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/publicdomain/zero/1.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + </cc:License> </rdf:RDF> </metadata> <g diff --git a/navit/textures/quarry.svg b/navit/textures/quarry.svg index 1de09a22c..b6ecddd7f 100644 --- a/navit/textures/quarry.svg +++ b/navit/textures/quarry.svg @@ -42,7 +42,18 @@ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> + <cc:license + rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" /> </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/publicdomain/zero/1.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + </cc:License> </rdf:RDF> </metadata> <defs diff --git a/navit/textures/scrub.svg b/navit/textures/scrub.svg index 3e0d18522..7e0143e5b 100644 --- a/navit/textures/scrub.svg +++ b/navit/textures/scrub.svg @@ -46,7 +46,18 @@ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> + <cc:license + rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" /> </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/publicdomain/zero/1.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + </cc:License> </rdf:RDF> </metadata> <g diff --git a/navit/textures/wetland.svg b/navit/textures/wetland.svg index 2c84b04f1..05ea07cb9 100644 --- a/navit/textures/wetland.svg +++ b/navit/textures/wetland.svg @@ -22,7 +22,18 @@ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> + <cc:license + rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" /> </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/publicdomain/zero/1.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + </cc:License> </rdf:RDF> </metadata> <defs diff --git a/navit/textures/wood.svg b/navit/textures/wood.svg index a6f8f7d39..1b5f40d66 100644 --- a/navit/textures/wood.svg +++ b/navit/textures/wood.svg @@ -42,7 +42,18 @@ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> + <cc:license + rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" /> </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/publicdomain/zero/1.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + </cc:License> </rdf:RDF> </metadata> <defs diff --git a/navit/track.c b/navit/track.c index 37a7d70a4..70b89c6fc 100644 --- a/navit/track.c +++ b/navit/track.c @@ -637,10 +637,11 @@ void tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofi !vehicle_get_attr(tr->vehicle, attr_position_direction, &direction_attr, NULL) || !vehicle_get_attr(tr->vehicle, attr_position_coord_geo, &coord_geo, NULL) || !vehicle_get_attr(tr->vehicle, attr_position_time_iso8601, &time_attr, NULL)) { - dbg(lvl_error,"failed to get position data %d %d %d", + dbg(lvl_error,"failed to get position data speed:%d direction:%d coord:%d time:%d", vehicle_get_attr(tr->vehicle, attr_position_speed, &speed_attr, NULL), vehicle_get_attr(tr->vehicle, attr_position_direction, &direction_attr, NULL), - vehicle_get_attr(tr->vehicle, attr_position_coord_geo, &coord_geo, NULL)); + vehicle_get_attr(tr->vehicle, attr_position_coord_geo, &coord_geo, NULL), + vehicle_get_attr(tr->vehicle, attr_position_time_iso8601, &time_attr, NULL)); return; } if (tr->tunnel_extrapolation) { @@ -1143,7 +1144,7 @@ static struct map_priv *tracking_map_new(struct map_methods *meth, struct attr * struct map_priv *ret; struct attr *tracking_attr; - tracking_attr=attr_search(attrs, NULL, attr_trackingo); + tracking_attr=attr_search(attrs, attr_trackingo); if (! tracking_attr) return NULL; ret=g_new0(struct map_priv, 1); diff --git a/navit/traffic.c b/navit/traffic.c index 9cf22a371..73d74b673 100644 --- a/navit/traffic.c +++ b/navit/traffic.c @@ -426,12 +426,12 @@ static int seg_data_equals(struct seg_data * l, struct seg_data * r) { return 0; /* FIXME this will break if multiple attributes of the same type are present and have different values */ for (attrs = l->attrs; attrs; attrs++) { - attr = attr_search(r->attrs, NULL, (*attrs)->type); + attr = attr_search(r->attrs, (*attrs)->type); if (!attr || (attr->u.data != (*attrs)->u.data)) return 0; } for (attrs = r->attrs; attrs; attrs++) { - attr = attr_search(l->attrs, NULL, (*attrs)->type); + attr = attr_search(l->attrs, (*attrs)->type); if (!attr || (attr->u.data != (*attrs)->u.data)) return 0; } @@ -633,7 +633,7 @@ static void tm_item_update_attrs(struct item * item, struct route * route) { * resulting in a cost of 90 s for the segment. */ if (speed < INT_MAX) { - attr = attr_search(priv_data->attrs, NULL, attr_maxspeed); + attr = attr_search(priv_data->attrs, attr_maxspeed); if (!attr) { attr = g_new0(struct attr, 1); attr->type = attr_maxspeed; @@ -650,12 +650,12 @@ static void tm_item_update_attrs(struct item * item, struct route * route) { attr->u.num = speed; } } else { - while ((attr = attr_search(priv_data->attrs, NULL, attr_maxspeed))) + while ((attr = attr_search(priv_data->attrs, attr_maxspeed))) priv_data->attrs = attr_generic_remove_attr(priv_data->attrs, attr); } if (delay) { - attr = attr_search(priv_data->attrs, NULL, attr_delay); + attr = attr_search(priv_data->attrs, attr_delay); if (!attr) { attr = g_new0(struct attr, 1); attr->type = attr_delay; @@ -673,7 +673,7 @@ static void tm_item_update_attrs(struct item * item, struct route * route) { } } else { while (1) { - attr = attr_search(priv_data->attrs, NULL, attr_delay); + attr = attr_search(priv_data->attrs, attr_delay); if (!attr) break; priv_data->attrs = attr_generic_remove_attr(priv_data->attrs, attr); @@ -4597,7 +4597,7 @@ static struct traffic * traffic_new(struct attr *parent, struct attr **attrs) { struct attr **attrs, struct callback_list *cbl); struct attr *attr; - attr = attr_search(attrs, NULL, attr_type); + attr = attr_search(attrs, attr_type); if (!attr) { dbg(lvl_error, "type missing"); return NULL; @@ -5756,7 +5756,7 @@ static struct map_priv * traffic_map_new(struct map_methods *meth, struct attr * struct map_priv *ret; struct attr *traffic_attr; - traffic_attr = attr_search(attrs, NULL, attr_traffic); + traffic_attr = attr_search(attrs, attr_traffic); if (!traffic_attr) { dbg(lvl_error, "attr_traffic not found!"); return NULL; diff --git a/navit/vehicle.c b/navit/vehicle.c index fee989638..78fadfd46 100644 --- a/navit/vehicle.c +++ b/navit/vehicle.c @@ -116,7 +116,7 @@ vehicle_new(struct attr *parent, struct attr **attrs) { struct pcoord center; dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); if (!source) { dbg(lvl_error, "incomplete vehicle definition: missing attribute 'source'"); return NULL; @@ -420,7 +420,7 @@ int vehicle_get_cursor_data(struct vehicle *this, struct point *pnt, int *angle, static void vehicle_set_default_name(struct vehicle *this_) { struct attr default_name; - if (!attr_search(this_->attrs, NULL, attr_name)) { + if (!attr_search(this_->attrs, attr_name)) { default_name.type=attr_name; // Safe cast: attr_generic_set_attr does not modify its parameter. default_name.u.str=(char*)_("Unnamed vehicle"); @@ -600,7 +600,7 @@ static void vehicle_log_gpx(struct vehicle *this_, struct log *log) { && this_->meth.position_attr_get(this_->priv, attr_position_speed, &attr)) logstr=g_strconcat_printf(logstr,"\t<speed>%.2f</speed>\n",(*attr.u.numd / 3.6)); if (attr_types_contains_default(attr_types, attr_profilename, 0) - && (attrp=attr_search(this_->attrs, NULL, attr_profilename))) { + && (attrp=attr_search(this_->attrs, attr_profilename))) { logstr=g_strconcat_printf(logstr,"%s\t\t<navit:profilename>%s</navit:profilename>\n",extensions,attrp->u.str); extensions=""; } diff --git a/navit/vehicle/file/vehicle_file.c b/navit/vehicle/file/vehicle_file.c index 1502b9860..666fd59c6 100644 --- a/navit/vehicle/file/vehicle_file.c +++ b/navit/vehicle/file/vehicle_file.c @@ -951,7 +951,7 @@ static struct vehicle_priv *vehicle_file_new_file(struct vehicle_methods dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); if(source == NULL) { dbg(lvl_error,"Missing source attribute"); return NULL; @@ -965,13 +965,13 @@ static struct vehicle_priv *vehicle_file_new_file(struct vehicle_methods ret->baudrate=B4800; ret->fixtime[0] = '\0'; ret->ev_fix_timeout = NULL; - state_file=attr_search(attrs, NULL, attr_state_file); + state_file=attr_search(attrs, attr_state_file); if (state_file) ret->statefile=g_strdup(state_file->u.str); - time = attr_search(attrs, NULL, attr_time); + time = attr_search(attrs, attr_time); if (time) ret->time=time->u.num; - baudrate = attr_search(attrs, NULL, attr_baudrate); + baudrate = attr_search(attrs, attr_baudrate); if (baudrate) { switch (baudrate->u.num) { case 4800: @@ -1000,11 +1000,11 @@ static struct vehicle_priv *vehicle_file_new_file(struct vehicle_methods #endif } } - checksum_ignore = attr_search(attrs, NULL, attr_checksum_ignore); + checksum_ignore = attr_search(attrs, attr_checksum_ignore); if (checksum_ignore) ret->checksum_ignore=checksum_ignore->u.num; ret->attrs = attrs; - on_eof = attr_search(attrs, NULL, attr_on_eof); + on_eof = attr_search(attrs, attr_on_eof); if (on_eof && !g_ascii_strcasecmp(on_eof->u.str, "stop")) ret->on_eof=1; if (on_eof && !g_ascii_strcasecmp(on_eof->u.str, "exit")) diff --git a/navit/vehicle/geoclue/CMakeLists.txt b/navit/vehicle/geoclue/CMakeLists.txt new file mode 100644 index 000000000..2a447ab02 --- /dev/null +++ b/navit/vehicle/geoclue/CMakeLists.txt @@ -0,0 +1,2 @@ +module_add_library(vehicle_geoclue vehicle_geoclue.c) +target_link_libraries(vehicle_geoclue ${GeoClue_LIBRARIES}) diff --git a/navit/vehicle/geoclue/vehicle_geoclue.c b/navit/vehicle/geoclue/vehicle_geoclue.c new file mode 100644 index 000000000..6384a1cc3 --- /dev/null +++ b/navit/vehicle/geoclue/vehicle_geoclue.c @@ -0,0 +1,236 @@ +/* + * Navit, a modular navigation system. + * Copyright 2020 Navit Team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program 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 this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include <stdlib.h> +#include <locale.h> +#include <glib/gi18n.h> +#include <geoclue.h> +#include "debug.h" +#include "callback.h" +#include "coord.h" +#include "item.h" +#include "vehicle.h" +#include "plugin.h" + +/** + * @defgroup vehicle-gypsy Vehicle GeoClue + * @ingroup vehicle-plugins + * @brief The Vehicle to gain position data from GeoClue. + * @Author jkoan + * @date 2020 + * + * @{ + */ + + +struct vehicle_priv { + GClueLocation *location; + char *bla; + struct callback_list *cbl; + double speed; + double direction; + double height; + struct coord_geo geo; + int accuracy; + char* time_str; + GClueSimple *simple; +}; +GClueClient *client = NULL; + +/** + * @brief Free the geoclue_vehicle + * + * @param priv + * @returns nothing + */ +static void vehicle_geoclue_destroy(struct vehicle_priv *priv) { + g_clear_object(&client); + g_clear_object(&priv->simple); +} + +static void print_location(GClueSimple *simple, + GParamSpec *pspec, + gpointer user_data) { + GClueLocation *location; + gdouble altitude; + gdouble speed; + gdouble direction; + GVariant *timestamp; + struct vehicle_priv *priv = user_data; + + location = gclue_simple_get_location(simple); + + priv->geo.lat = gclue_location_get_latitude(location); + priv->geo.lng = gclue_location_get_longitude(location); + priv->accuracy = gclue_location_get_accuracy(location); + altitude = gclue_location_get_altitude(location); + if(altitude != -G_MAXDOUBLE) { + priv->height=altitude; + } + speed = gclue_location_get_speed(location); + if(speed != -G_MAXDOUBLE) { + priv->speed=speed; + } + direction = gclue_location_get_heading(location); + if(direction != -G_MAXDOUBLE) { + priv->direction=direction; + } + + timestamp= gclue_location_get_timestamp(location); + if(timestamp) { + GDateTime *date_time; + glong second_since_epoch; + + + g_variant_get (timestamp, "(tt)", &second_since_epoch, NULL); + + date_time = g_date_time_new_from_unix_local (second_since_epoch); + + priv->time_str = g_date_time_format_iso8601(g_date_time_to_utc(date_time)); + + } + callback_list_call_attr_0(priv->cbl, attr_position_coord_geo); +} + +static void on_client_active_notify(GClueClient *client, + GParamSpec *pspec, + gpointer user_data) { + if(gclue_client_get_active(client)) + return; + + g_print("Geolocation disabled. Quitting..\n"); + //vehicle_geoclue_destroy(&user_data); +} + +static void on_simple_ready(GObject *source_object, + GAsyncResult *res, + gpointer user_data) { + GError *error = NULL; + + struct vehicle_priv* priv = user_data; + + priv->simple = gclue_simple_new_finish(res, &error); + if(error != NULL) { + dbg(lvl_error,"Failed to connect to GeoClue2 service: %s", error->message); + + exit(-1); + } + client = gclue_simple_get_client(priv->simple); + if(client) { + g_object_ref(client); + dbg(lvl_debug,"Client object: %s\n", + g_dbus_proxy_get_object_path(G_DBUS_PROXY(client))); + + g_signal_connect(client, + "notify::active", + G_CALLBACK(on_client_active_notify), + NULL); + } + print_location(priv->simple,NULL,priv); + + g_signal_connect(priv->simple, + "notify::location", + G_CALLBACK(print_location), + priv); +} + +/** + * @brief Provide the outside with information + * + * @param priv + * @param type TODO: What can this be? + * @param attr + * @returns true/false + */ +static int vehicle_geoclue_position_attr_get(struct vehicle_priv *priv, + enum attr_type type, struct attr *attr) { + switch(type) { + case attr_position_height: + attr->u.numd = &priv->height; + break; + case attr_position_speed: + attr->u.numd = &priv->speed; + break; + case attr_position_direction: + attr->u.numd = &priv->direction; + break; + case attr_position_qual: + attr->u.num = priv->accuracy; + break; + case attr_position_coord_geo: + attr->u.coord_geo = &priv->geo; + break; + case attr_position_time_iso8601: + if(!priv->time_str) { + return 0; + } + attr->u.str=priv->time_str; + break; + case attr_active: + return 1; + default: + return 0; + } + attr->type = type; + return 1; +} + +struct vehicle_methods vehicle_geoclue_methods = { + .destroy = vehicle_geoclue_destroy, + .position_attr_get = vehicle_geoclue_position_attr_get, +}; + +/** + * @brief Create geoclue_vehicle + * + * @param meth[out] Methodes supported by geoclue Plugin + * @param cbl[in] Callback List reference + * @param attrs Configuration attributes + * @returns vehicle_priv The newly created Vehicle priv + */ +static struct vehicle_priv *vehicle_geoclue_new(struct vehicle_methods *meth, + struct callback_list *cbl, + struct attr **attrs) { + struct vehicle_priv *ret; + dbg(lvl_debug, "enter"); + + *meth = vehicle_geoclue_methods; + + ret = (struct vehicle_priv*)g_new0(struct vehicle_priv, 1); + ret->cbl = cbl; + gclue_simple_new("navit", + GCLUE_ACCURACY_LEVEL_EXACT, + NULL, + on_simple_ready, + ret + ); + return ret; +}; + +/** + * @brief register vehicle_geoclue + * + * @returns nothing + */ +void plugin_init(void) { + dbg(lvl_error, "enter"); + plugin_register_category_vehicle("geoclue", vehicle_geoclue_new); +}; + diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c index 564d41695..f7324d24c 100644 --- a/navit/vehicle/gpsd/vehicle_gpsd.c +++ b/navit/vehicle/gpsd/vehicle_gpsd.c @@ -17,7 +17,6 @@ * Boston, MA 02110-1301, USA. */ -#include <config.h> #include <gps.h> #include <string.h> #include <glib.h> @@ -166,7 +165,12 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, data->set &= ~SATELLITE_SET; } if (data->set & STATUS_SET) { +#if GPSD_API_MAJOR_VERSION >= 10 + priv->status = data->fix.status; +#else priv->status = data->status; +#endif // GPSD_API_MAJOR_VERSION >= 10 + data->set &= ~STATUS_SET; } if (data->set & MODE_SET) { @@ -414,7 +418,7 @@ static int vehicle_gpsd_position_attr_get(struct vehicle_priv *priv, } break; case attr_active: - active = attr_search(priv->attrs,NULL,attr_active); + active = attr_search(priv->attrs,attr_active); if(active != NULL) { attr->u.num=active->u.num; return 1; @@ -440,20 +444,20 @@ static struct vehicle_priv *vehicle_gpsd_new_gpsd(struct vehicle_methods struct attr *source, *query, *retry_int; dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); ret = g_new0(struct vehicle_priv, 1); #if GPSD_API_MAJOR_VERSION >= 5 ret->gps = g_new0(struct gps_data_t, 1); #endif ret->source = g_strdup(source->u.str); - query = attr_search(attrs, NULL, attr_gpsd_query); + query = attr_search(attrs, attr_gpsd_query); if (query) { ret->gpsd_query = g_strconcat(query->u.str, "\n", NULL); } else { ret->gpsd_query = g_strdup("w+x\n"); } dbg(lvl_debug,"Format string for gpsd_query: %s",ret->gpsd_query); - retry_int = attr_search(attrs, NULL, attr_retry_interval); + retry_int = attr_search(attrs, attr_retry_interval); if (retry_int) { ret->retry_interval = retry_int->u.num; if (ret->retry_interval < MIN_RETRY_INTERVAL) { diff --git a/navit/vehicle/gypsy/vehicle_gypsy.c b/navit/vehicle/gypsy/vehicle_gypsy.c index 077f219a1..33dde34c2 100644 --- a/navit/vehicle/gypsy/vehicle_gypsy.c +++ b/navit/vehicle/gypsy/vehicle_gypsy.c @@ -384,7 +384,7 @@ static int vehicle_gypsy_position_attr_get(struct vehicle_priv *priv, return 0; } case attr_active: - active = attr_search(priv->attrs,NULL,attr_active); + active = attr_search(priv->attrs,attr_active); if(active != NULL && active->u.num == 1) return 1; else @@ -423,10 +423,10 @@ static struct vehicle_priv *vehicle_gypsy_new_gypsy(struct vehicle_methods *meth dbus_uint32_t serial,pid=getpid(); struct attr *destination,*path,*interface,*method; - destination=attr_search(attrs, NULL, attr_dbus_destination); - path=attr_search(attrs, NULL, attr_dbus_path); - interface=attr_search(attrs, NULL, attr_dbus_interface); - method=attr_search(attrs, NULL, attr_dbus_method); + destination=attr_search(attrs, attr_dbus_destination); + path=attr_search(attrs, attr_dbus_path); + interface=attr_search(attrs, attr_dbus_interface); + method=attr_search(attrs, attr_dbus_method); if (destination && path && interface && method) { conn=dbus_bus_get(DBUS_BUS_SESSION, NULL); if (conn) { @@ -441,12 +441,12 @@ static struct vehicle_priv *vehicle_gypsy_new_gypsy(struct vehicle_methods *meth } #endif dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); ret = g_new0(struct vehicle_priv, 1); ret->have_cords = 0; ret->source = g_strdup(source->u.str); ret->attrs = attrs; - retry_int = attr_search(attrs, NULL, attr_retry_interval); + retry_int = attr_search(attrs, attr_retry_interval); if (retry_int) { ret->retry_interval = retry_int->u.num; if (ret->retry_interval < MIN_RETRY_INTERVAL) { diff --git a/navit/vehicle/iphone/vehicle_iphone.c b/navit/vehicle/iphone/vehicle_iphone.c index 790166238..26b778a6e 100644 --- a/navit/vehicle/iphone/vehicle_iphone.c +++ b/navit/vehicle/iphone/vehicle_iphone.c @@ -137,12 +137,12 @@ static struct vehicle_priv *vehicle_iphone_new(struct vehicle_methods ret->cbl = cbl; ret->interval=1000; ret->config_speed=40; - if ((speed=attr_search(attrs, NULL, attr_speed))) { + if ((speed=attr_search(attrs, attr_speed))) { ret->config_speed=speed->u.num; } - if ((interval=attr_search(attrs, NULL, attr_interval))) + if ((interval=attr_search(attrs, attr_interval))) ret->interval=interval->u.num; - if ((position_coord_geo=attr_search(attrs, NULL, attr_position_coord_geo))) { + if ((position_coord_geo=attr_search(attrs, attr_position_coord_geo))) { ret->geo=*(position_coord_geo->u.coord_geo); ret->position_set=1; dbg(lvl_debug,"position_set %f %f", ret->geo.lat, ret->geo.lng); diff --git a/navit/vehicle/maemo/vehicle_maemo.c b/navit/vehicle/maemo/vehicle_maemo.c index 4717deb04..34514ad0e 100644 --- a/navit/vehicle/maemo/vehicle_maemo.c +++ b/navit/vehicle/maemo/vehicle_maemo.c @@ -269,7 +269,7 @@ static int vehicle_maemo_position_attr_get(struct vehicle_priv *priv, break; case attr_active: dbg(lvl_debug,"Attr requested: position_active"); - active = attr_search(priv->attrs,NULL,attr_active); + active = attr_search(priv->attrs,attr_active); if(active != NULL) { attr->u.num=active->u.num; return 1; @@ -295,10 +295,10 @@ static struct vehicle_priv *vehicle_maemo_new_maemo(struct vehicle_methods struct attr *source, *retry_int; dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); ret = g_new0(struct vehicle_priv, 1); ret->source = g_strdup(source->u.str); - retry_int = attr_search(attrs, NULL, attr_retry_interval); + retry_int = attr_search(attrs, attr_retry_interval); if (retry_int) { ret->retry_interval = retry_int->u.num; if (ret->retry_interval !=1 && ret->retry_interval !=2 && ret->retry_interval !=5 && ret->retry_interval !=10 diff --git a/navit/vehicle/qt5/vehicle_qt5.cpp b/navit/vehicle/qt5/vehicle_qt5.cpp index 9daa2ecb9..ac475bd61 100644 --- a/navit/vehicle/qt5/vehicle_qt5.cpp +++ b/navit/vehicle/qt5/vehicle_qt5.cpp @@ -212,7 +212,7 @@ static int vehicle_qt5_position_attr_get(struct vehicle_priv* priv, break; case attr_active: - active = attr_search(priv->attrs, NULL, attr_active); + active = attr_search(priv->attrs, attr_active); if (active != NULL) { attr->u.num = active->u.num; return 1; diff --git a/navit/vehicle/wince/vehicle_wince.c b/navit/vehicle/wince/vehicle_wince.c index 4d2afa0e9..afb39a959 100644 --- a/navit/vehicle/wince/vehicle_wince.c +++ b/navit/vehicle/wince/vehicle_wince.c @@ -913,7 +913,7 @@ static struct vehicle_priv *vehicle_wince_new(struct vehicle_methods char *cp; dbg(lvl_debug, "enter"); - source = attr_search(attrs, NULL, attr_source); + source = attr_search(attrs, attr_source); ret = g_new0(struct vehicle_priv, 1); ret->fd = -1; ret->cbl = cbl; @@ -933,18 +933,18 @@ static struct vehicle_priv *vehicle_wince_new(struct vehicle_methods ret->fixtime[0] = '\0'; ret->ev_fix_timeout = NULL; - time = attr_search(attrs, NULL, attr_time); + time = attr_search(attrs, attr_time); if (time) ret->time=time->u.num; - baudrate = attr_search(attrs, NULL, attr_baudrate); + baudrate = attr_search(attrs, attr_baudrate); if (baudrate) { ret->baudrate = baudrate->u.num; } - checksum_ignore = attr_search(attrs, NULL, attr_checksum_ignore); + checksum_ignore = attr_search(attrs, attr_checksum_ignore); if (checksum_ignore) ret->checksum_ignore=checksum_ignore->u.num; ret->attrs = attrs; - on_eof = attr_search(attrs, NULL, attr_on_eof); + on_eof = attr_search(attrs, attr_on_eof); if (on_eof && !g_strcasecmp(on_eof->u.str, "stop")) ret->on_eof=1; if (on_eof && !g_strcasecmp(on_eof->u.str, "exit")) @@ -961,7 +961,7 @@ static struct vehicle_priv *vehicle_wince_new(struct vehicle_methods ret->read_buffer = g_malloc(buffer_size); - handle_bluetooth = attr_search(attrs, NULL, attr_bluetooth); + handle_bluetooth = attr_search(attrs, attr_bluetooth); if ( handle_bluetooth && handle_bluetooth->u.num == 1 ) initBth(ret); diff --git a/navit/vehicleprofile.c b/navit/vehicleprofile.c index 905d2defa..493646f94 100644 --- a/navit/vehicleprofile.c +++ b/navit/vehicleprofile.c @@ -211,7 +211,7 @@ struct vehicleprofile * vehicleprofile_new(struct attr *parent, struct attr **attrs) { struct vehicleprofile *this_; struct attr **attr, *type_attr; - if (! (type_attr=attr_search(attrs, NULL, attr_name))) { + if (! (type_attr=attr_search(attrs, attr_name))) { return NULL; } this_=g_new0(struct vehicleprofile, 1); diff --git a/scripts/setup_publish_keys.sh b/scripts/setup_publish_keys.sh index 2b1331d8e..b363d9d32 100755 --- a/scripts/setup_publish_keys.sh +++ b/scripts/setup_publish_keys.sh @@ -7,8 +7,7 @@ if [[ -n $GOOGLE_KEY ]]; then fi if [[ -n $KEY ]]; then wget "https://github.com/navit-gps/infrastructure-blackbox/raw/master/keyrings/keystore.gpg" - openssl aes-256-cbc -d -in keystore.gpg -md md5 -k $KEY > ~/.keystore - keytool -importkeystore -srcstorepass "$STORE_PASS" -deststorepass "$STORE_PASS" -srckeystore ~/.keystore -destkeystore ~/.keystore -deststoretype pkcs12 - keytool -keypasswd -alias $KEY_ALIAS -storepass $STORE_PASS -new $KEY_PASS -keystore ~/.keystore - rm keystore.gpg + openssl aes-256-cbc -d -in keystore.gpg -md md5 -k $KEY > keystore + keytool -importkeystore -srcstorepass "$STORE_PASS" -deststorepass "$STORE_PASS" -srckeystore keystore -destkeystore ~/.keystore -deststoretype pkcs12 + rm keystore.gpg keystore fi |