navit  0.5.3-trunk
gui_internal.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <glib.h>
#include <time.h>
#include "config.h"
#include <sys/time.h>
#include "item.h"
#include "xmlconfig.h"
#include "file.h"
#include "navit.h"
#include "navit_nls.h"
#include "gui.h"
#include "coord.h"
#include "point.h"
#include "plugin.h"
#include "graphics.h"
#include "transform.h"
#include "color.h"
#include "map.h"
#include "callback.h"
#include "vehicle.h"
#include "vehicleprofile.h"
#include "window.h"
#include "config_.h"
#include "keys.h"
#include "mapset.h"
#include "route.h"
#include "navit/search.h"
#include "track.h"
#include "country.h"
#include "event.h"
#include "navigation.h"
#include "gui_internal.h"
#include "command.h"
#include "util.h"
#include "bookmarks.h"
#include "linguistics.h"
#include "debug.h"
#include "fib.h"
#include "types.h"
#include "gui_internal_widget.h"
#include "gui_internal_priv.h"
#include "gui_internal_html.h"
#include "gui_internal_bookmark.h"
#include "gui_internal_menu.h"
#include "gui_internal_search.h"
#include "gui_internal_gesture.h"
#include "gui_internal_poi.h"
#include "gui_internal_command.h"
#include "gui_internal_keyboard.h"

Data Structures

struct  vehicle_and_profilename
 

Functions

static void gui_internal_cmd_view_in_browser (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_prepare_search_results_map (struct gui_priv *this, struct widget *table, struct coord_rect *r)
 Create a map rect highlighting one of multiple points provided in argument @data and displayed using the style type_found_item (name for each point will also be displayed aside) More...
 
static int gui_internal_is_active_vehicle (struct gui_priv *this, struct vehicle *vehicle)
 
static struct graphics_imageimage_new_scaled (struct gui_priv *this, const char *name, int w, int h)
 Displays an image scaled to a specific size. More...
 
struct graphics_imageimage_new_xs (struct gui_priv *this, const char *name)
 Displays an image scaled to xs (extra small) size. More...
 
struct graphics_imageimage_new_s (struct gui_priv *this, const char *name)
 Displays an image scaled to s (small) size. More...
 
struct graphics_imageimage_new_l (struct gui_priv *this, const char *name)
 Displays an image scaled to l (large) size. More...
 
static int gui_internal_button_attr_update (struct gui_priv *this, struct widget *w)
 
static void gui_internal_button_attr_callback (struct gui_priv *this, struct widget *w)
 
static void gui_internal_button_attr_pressed (struct gui_priv *this, struct widget *w, void *data)
 
struct widgetgui_internal_button_navit_attr_new (struct gui_priv *this, const char *text, enum flags flags, struct attr *on, struct attr *off)
 
struct widgetgui_internal_button_map_attr_new (struct gui_priv *this, const char *text, enum flags flags, struct map *map, struct attr *on, struct attr *off, int deflt)
 
static void gui_internal_motion_cb (struct gui_priv *this)
 
static void gui_internal_call_highlighted (struct gui_priv *this)
 
void gui_internal_say (struct gui_priv *this, struct widget *w, int questionmark)
 
void gui_internal_back (struct gui_priv *this, struct widget *w, void *data)
 
void gui_internal_cmd_return (struct gui_priv *this, struct widget *wm, void *data)
 
void gui_internal_cmd_main_menu (struct gui_priv *this, struct widget *wm, void *data)
 
struct widgetgui_internal_time_help (struct gui_priv *this)
 
void gui_internal_apply_config (struct gui_priv *this)
 
static void gui_internal_cmd_set_destination (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_cmd_insert_destination_do (struct gui_priv *this, struct widget *wm, void *data)
 
void gui_internal_select_waypoint (struct gui_priv *this, const char *title, const char *hint, struct widget *wm_, void(*cmd)(struct gui_priv *priv, struct widget *widget, void *data), void *data)
 
static void gui_internal_cmd_insert_destination (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_cmd_set_position (struct gui_priv *this, struct widget *wm, void *data)
 
void gui_internal_call_linked_on_finish (struct gui_priv *this, struct widget *wm, void *data)
 Generic notification function for Editable widgets to call Another widget notification function when Enter is pressed in editable field. The Editable widget should have data member pointing to the Another widget. More...
 
struct widgetgui_internal_keyboard (struct gui_priv *this, int mode)
 Creates a keyboard widget. More...
 
struct widgetgui_internal_keyboard_show_native (struct gui_priv *this, struct widget *w, int mode, char *lang)
 Shows the platform's native on-screen keyboard or other input method. More...
 
static void gui_internal_cmd_delete_bookmark (struct gui_priv *this, struct widget *wm, void *data)
 
char * removecase (char *s)
 Remove the case in a string. More...
 
static void gui_internal_cmd_view_on_map (struct gui_priv *this, struct widget *wm, void *data)
 Apply the command "View on Map", centers the map on the selected point and highlight this point using type_found_item style. More...
 
static void gui_internal_cmd_view_attribute_details (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_cmd_view_attributes (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_cmd_results_to_map (struct gui_priv *this, struct widget *wm, void *data)
 Apply the command "Show results on the map", highlighting one of multiple points using type_found_item style (with their respective name placed aside) More...
 
static void gui_internal_cmd_results_map_clean (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_cmd_delete_waypoint (struct gui_priv *this, struct widget *wm, void *data)
 
void gui_internal_cmd_position_do (struct gui_priv *this, struct pcoord *pc_in, struct coord_geo *g_in, struct widget *wm, const char *name, int flags)
 Displays the commands available for a location. More...
 
void gui_internal_cmd_position (struct gui_priv *this, struct widget *wm, void *data)
 
void gui_internal_cmd_bookmarks (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_keynav_highlight_next (struct gui_priv *this, int dx, int dy, int rotary)
 Move keyboard focus to the next widget. More...
 
static int gui_internal_keynav_find_next (struct widget *wi, struct widget *current_highlight, struct widget **result)
 
static int gui_internal_keynav_find_prev (struct widget *wi, struct widget *current_highlight, struct widget **result)
 
static struct widgetgui_internal_keynav_find_next_sensitive_child (struct widget *wi)
 
void gui_internal_keypress_do (struct gui_priv *this, char *key)
 
char * gui_internal_cmd_match_expand (char *pattern, struct attr **in)
 
static int gui_internal_match (const char *pattern, const char *string)
 
int gui_internal_set (char *remove, char *add)
 
static void gui_internal_window_closed (struct gui_priv *this)
 
static void gui_internal_cmd_map_download_do (struct gui_priv *this, struct widget *wm, void *data)
 
void gui_internal_cmd_map_download (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_cmd_set_active_vehicle (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_cmd_show_satellite_status (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_cmd_show_nmea_data (struct gui_priv *this, struct widget *wm, void *data)
 
static void save_vehicle_xml (struct vehicle *v)
 
static void gui_internal_cmd_set_active_profile (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_add_vehicle_profile (struct gui_priv *this, struct widget *parent, struct vehicle *v, struct vehicleprofile *profile)
 
void gui_internal_menu_vehicle_settings (struct gui_priv *this, struct vehicle *v, char *name)
 
void gui_internal_cmd_vehicle_settings (struct gui_priv *this, struct widget *wm, void *data)
 
static void gui_internal_motion (void *data, struct point *p)
 
void gui_internal_evaluate (struct gui_priv *this, const char *command)
 
void gui_internal_enter (struct gui_priv *this, int ignore)
 
void gui_internal_leave (struct gui_priv *this)
 
void gui_internal_set_click_coord (struct gui_priv *this, struct point *p)
 
static void gui_internal_set_position_coord (struct gui_priv *this)
 
void gui_internal_enter_setup (struct gui_priv *this)
 
void gui_internal_cmd_menu (struct gui_priv *this, int ignore, char *href)
 
static void gui_internal_cmd_log_do (struct gui_priv *this, struct widget *widget)
 
void gui_internal_cmd_log_clicked (struct gui_priv *this, struct widget *widget, void *data)
 
void gui_internal_check_exit (struct gui_priv *this)
 
static int gui_internal_get_attr (struct gui_priv *this, enum attr_type type, struct attr *attr)
 
static int gui_internal_add_attr (struct gui_priv *this, struct attr *attr)
 
static int gui_internal_set_attr (struct gui_priv *this, struct attr *attr)
 
static void gui_internal_dbus_signal (struct gui_priv *this, struct point *p)
 
static int gui_internal_coordinate_parse (char *s, char plus, char minus, double *x)
 Converts one geo coordinate in human readable form to double value. More...
 
static void gui_internal_cmd_enter_coord_do (struct gui_priv *this, struct widget *widget)
 
void gui_internal_cmd_enter_coord_clicked (struct gui_priv *this, struct widget *widget, void *data)
 
static void gui_internal_button (void *data, int pressed, int button, struct point *p)
 Handles mouse clicks and scroll wheel movement. More...
 
static void gui_internal_setup (struct gui_priv *this)
 
static void gui_internal_resize (void *data, int wnew, int hnew)
 Callback function invoked when display area is resized. More...
 
static void gui_internal_keynav_point (struct widget *w, int dx, int dy, struct point *p)
 
static void gui_internal_keynav_find_closest (struct widget *wi, struct point *p, int dx, int dy, int *distance, struct widget **result)
 
static void gui_internal_keypress (void *data, char *key)
 
static int gui_internal_set_graphics (struct gui_priv *this, struct graphics *gra)
 
static void gui_internal_disable_suspend (struct gui_priv *this)
 
static void gui_internal_add_callback (struct gui_priv *priv, struct callback *cb)
 
static void gui_internal_remove_callback (struct gui_priv *priv, struct callback *cb)
 
static enum flags gui_internal_get_flags (struct widget *widget)
 
static void gui_internal_set_flags (struct widget *widget, enum flags flags)
 
static int gui_internal_get_state (struct widget *widget)
 
static void gui_internal_set_state (struct widget *widget, int state)
 
static void gui_internal_set_func (struct widget *widget, void(*func)(struct gui_priv *priv, struct widget *widget, void *data))
 
static void gui_internal_set_data (struct widget *widget, void *data)
 
static void gui_internal_set_default_background (struct gui_priv *this, struct widget *widget)
 
int line_intersection (struct coord *a1, struct coord *a2, struct coord *b1, struct coord *b2, struct coord *res)
 finds the intersection point of 2 lines More...
 
struct heightlineitem_get_heightline (struct item *item)
 
void gui_internal_route_update (struct gui_priv *this, struct navit *navit, struct vehicle *v)
 Called when the route is updated. More...
 
void gui_internal_route_screen_free (struct gui_priv *this_, struct widget *w)
 Called when the route screen is closed (deallocated). More...
 
void gui_internal_populate_route_table (struct gui_priv *this, struct navit *navit)
 Populates the route table with route information. More...
 
static struct gui_privgui_internal_new (struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui)
 
void plugin_init (void)
 

Variables

const int LARGE_PROFILE =0
 
const int MEDIUM_PROFILE =1
 
const int SMALL_PROFILE =2
 
static struct gui_config_settings config_profiles []
 
struct gui_methods gui_internal_methods
 
static struct gui_internal_methods gui_internal_methods_ext
 
static struct gui_internal_widget_methods gui_internal_widget_methods
 

Function Documentation

◆ gui_internal_add_attr()

static int gui_internal_add_attr ( struct gui_priv this,
struct attr attr 
)
static

References attr::str, attr::type, and attr::u.

◆ gui_internal_add_callback()

static void gui_internal_add_callback ( struct gui_priv priv,
struct callback cb 
)
static

◆ gui_internal_add_vehicle_profile()

static void gui_internal_add_vehicle_profile ( struct gui_priv this,
struct widget parent,
struct vehicle v,
struct vehicleprofile profile 
)
static

◆ gui_internal_apply_config()

void gui_internal_apply_config ( struct gui_priv this)

Applies the configuration values to this based on the settings specified in the configuration file (this->config) and the most appropriate default profile based on screen resolution.

This function should be run after this->root is setup and could be rerun after the window is resized.

Author
Steve Singer ssing.nosp@m.er_p.nosp@m.g@sym.nosp@m.pati.nosp@m.co.ca (09/2008)

References config_profiles, dbg, gui_config_settings::font_size, graphics_font_new(), graphics_named_font_new(), gui_config_settings::icon_l, gui_config_settings::icon_s, gui_config_settings::icon_xs, LARGE_PROFILE, lvl_debug, lvl_info, MEDIUM_PROFILE, SMALL_PROFILE, and gui_config_settings::spacing.

Referenced by gui_internal_menu(), and gui_internal_menu_resize().

◆ gui_internal_back()

void gui_internal_back ( struct gui_priv this,
struct widget w,
void *  data 
)

◆ gui_internal_button()

◆ gui_internal_button_attr_callback()

static void gui_internal_button_attr_callback ( struct gui_priv this,
struct widget w 
)
static

◆ gui_internal_button_attr_pressed()

static void gui_internal_button_attr_pressed ( struct gui_priv this,
struct widget w,
void *  data 
)
static

◆ gui_internal_button_attr_update()

◆ gui_internal_button_map_attr_new()

◆ gui_internal_button_navit_attr_new()

◆ gui_internal_call_highlighted()

static void gui_internal_call_highlighted ( struct gui_priv this)
static

◆ gui_internal_call_linked_on_finish()

void gui_internal_call_linked_on_finish ( struct gui_priv this,
struct widget wm,
void *  data 
)

Generic notification function for Editable widgets to call Another widget notification function when Enter is pressed in editable field. The Editable widget should have data member pointing to the Another widget.

References data, gui_internal_reason_keypress_finish, widget::reason, and widget::w.

Referenced by gui_internal_cmd_add_bookmark2(), gui_internal_cmd_add_bookmark_folder2(), gui_internal_cmd_enter_coord(), gui_internal_cmd_log(), and gui_internal_cmd_rename_bookmark().

◆ gui_internal_check_exit()

◆ gui_internal_cmd_bookmarks()

◆ gui_internal_cmd_delete_bookmark()

static void gui_internal_cmd_delete_bookmark ( struct gui_priv this,
struct widget wm,
void *  data 
)
static

◆ gui_internal_cmd_delete_waypoint()

◆ gui_internal_cmd_enter_coord_clicked()

void gui_internal_cmd_enter_coord_clicked ( struct gui_priv this,
struct widget widget,
void *  data 
)

◆ gui_internal_cmd_enter_coord_do()

static void gui_internal_cmd_enter_coord_do ( struct gui_priv this,
struct widget widget 
)
static

◆ gui_internal_cmd_insert_destination()

static void gui_internal_cmd_insert_destination ( struct gui_priv this,
struct widget wm,
void *  data 
)
static

◆ gui_internal_cmd_insert_destination_do()

static void gui_internal_cmd_insert_destination_do ( struct gui_priv this,
struct widget wm,
void *  data 
)
static

◆ gui_internal_cmd_log_clicked()

void gui_internal_cmd_log_clicked ( struct gui_priv this,
struct widget widget,
void *  data 
)

◆ gui_internal_cmd_log_do()

static void gui_internal_cmd_log_do ( struct gui_priv this,
struct widget widget 
)
static

◆ gui_internal_cmd_main_menu()

void gui_internal_cmd_main_menu ( struct gui_priv this,
struct widget wm,
void *  data 
)

◆ gui_internal_cmd_map_download()

◆ gui_internal_cmd_map_download_do()

◆ gui_internal_cmd_match_expand()

char* gui_internal_cmd_match_expand ( char *  pattern,
struct attr **  in 
)

References attr_to_text(), and p.

Referenced by gui_internal_cmd2_set().

◆ gui_internal_cmd_menu()

void gui_internal_cmd_menu ( struct gui_priv this,
int  ignore,
char *  href 
)

◆ gui_internal_cmd_position()

◆ gui_internal_cmd_position_do()

void gui_internal_cmd_position_do ( struct gui_priv this,
struct pcoord pc_in,
struct coord_geo g_in,
struct widget wm,
const char *  name,
int  flags 
)

Displays the commands available for a location.

This displays the available commands for the given location in a dialog from which the user can choose an action. The location can be supplied either in projected coordinates via the

pc_in

argument or in WGS84 coordinates (i.e. latitude and longitude in degrees) via the

g_in

argument. One of these must be supplied, the other should be

NULL

.

Parameters
thisThe GUI context
pc_inProjected coordinates of the position
g_inWGS84 coordinates of the position
wmThe widget that points to this function as a callback
nameThe display name for the position
flagsFlags specifying the operations available from the GUI

References _, widget::c, c, widget::data, widget::data_free, dbg, display(), displaylist_get_clicked_list(), displaylist_get_selection(), flags_expand, flags_fill, g_free_func, graphics_displayitem_get_item(), graphics_displaylist_close(), graphics_displaylist_open(), gravity_left, gravity_left_center, gravity_left_top, gravity_top_center, gui_internal_box_new(), gui_internal_button_new(), gui_internal_button_new_with_callback(), gui_internal_cmd_add_bookmark2(), gui_internal_cmd_copy_bookmark(), gui_internal_cmd_cut_bookmark(), gui_internal_cmd_delete_bookmark(), gui_internal_cmd_delete_waypoint(), gui_internal_cmd_insert_destination(), gui_internal_cmd_paste_bookmark(), gui_internal_cmd_pois(), gui_internal_cmd_pois_item(), gui_internal_cmd_rename_bookmark(), gui_internal_cmd_results_map_clean(), gui_internal_cmd_results_to_map(), gui_internal_cmd_set_destination(), gui_internal_cmd_set_position(), gui_internal_cmd_view_attributes(), gui_internal_cmd_view_in_browser(), gui_internal_cmd_view_on_map(), gui_internal_label_new(), gui_internal_menu(), gui_internal_menu_render(), gui_internal_search_house_number_in_street(), gui_internal_search_street_in_town(), gui_internal_widget_append(), gui_internal_widget_table_new(), gui_internal_widget_table_row_new(), item::id_hi, item::id_lo, image_new_xs(), widget::item, item, item_attr_get(), item_to_name(), lvl_info, item::map, map_convert_string_tmp(), map_rect_destroy(), map_rect_get_item_byid(), map_rect_new(), map_selection_destroy(), widget::name, name, navit_get_attr(), navit_get_destination_count(), navit_get_displaylist(), navit_get_trans(), orientation_horizontal, orientation_vertical, p, pcoord_format_degree_short(), item::priv_data, pcoord::pro, attr::projection, widget::selection_id, attr::str, attr::text, widget::text, transform_from_geo(), transform_point(), transform_to_geo(), item::type, attr::u, vehicle_get_attr(), widget::w, pcoord::x, and pcoord::y.

Referenced by gui_internal_cmd2_position(), and gui_internal_cmd_position().

◆ gui_internal_cmd_results_map_clean()

static void gui_internal_cmd_results_map_clean ( struct gui_priv this,
struct widget wm,
void *  data 
)
static

◆ gui_internal_cmd_results_to_map()

static void gui_internal_cmd_results_to_map ( struct gui_priv this,
struct widget wm,
void *  data 
)
static

Apply the command "Show results on the map", highlighting one of multiple points using type_found_item style (with their respective name placed aside)

Parameters
thisThe GUI context
wmThe widget that called us
dataPrivate data provided during callback (should be a pointer to the table widget containing results, or NULL to remove all previous results from the map).

References data, and gui_internal_prepare_search_results_map().

Referenced by gui_internal_cmd_position_do(), and gui_internal_cmd_results_map_clean().

◆ gui_internal_cmd_return()

void gui_internal_cmd_return ( struct gui_priv this,
struct widget wm,
void *  data 
)

◆ gui_internal_cmd_set_active_profile()

◆ gui_internal_cmd_set_active_vehicle()

static void gui_internal_cmd_set_active_vehicle ( struct gui_priv this,
struct widget wm,
void *  data 
)
static

◆ gui_internal_cmd_set_destination()

static void gui_internal_cmd_set_destination ( struct gui_priv this,
struct widget wm,
void *  data 
)
static

◆ gui_internal_cmd_set_position()

static void gui_internal_cmd_set_position ( struct gui_priv this,
struct widget wm,
void *  data 
)
static

◆ gui_internal_cmd_show_nmea_data()

◆ gui_internal_cmd_show_satellite_status()

◆ gui_internal_cmd_vehicle_settings()

void gui_internal_cmd_vehicle_settings ( struct gui_priv this,
struct widget wm,
void *  data 
)

◆ gui_internal_cmd_view_attribute_details()

◆ gui_internal_cmd_view_attributes()

◆ gui_internal_cmd_view_in_browser()

◆ gui_internal_cmd_view_on_map()

static void gui_internal_cmd_view_on_map ( struct gui_priv this,
struct widget wm,
void *  data 
)
static

Apply the command "View on Map", centers the map on the selected point and highlight this point using type_found_item style.

Parameters
thisThe GUI context
wmThe widget that points to this function as a callback
dataPrivate data provided during callback (unused)

References widget::c, graphics_add_selection(), graphics_clear_selection(), gui_internal_box_new_with_label(), gui_internal_prepare_search_results_map(), gui_internal_prune_menu(), gui_internal_widget_append(), gui_internal_widget_destroy(), gui_internal_widget_table_new(), gui_internal_widget_table_row_new(), widget::item, label, widget::name, navit_set_center(), item::priv_data, item::type, type, widget::w, pcoord::x, and pcoord::y.

Referenced by gui_internal_cmd_position_do().

◆ gui_internal_coordinate_parse()

static int gui_internal_coordinate_parse ( char *  s,
char  plus,
char  minus,
double *  x 
)
static

Converts one geo coordinate in human readable form to double value.

Author
Martin Bruns (05/2012), mdankov

References dbg, and lvl_debug.

Referenced by gui_internal_cmd_enter_coord_do().

◆ gui_internal_dbus_signal()

◆ gui_internal_disable_suspend()

static void gui_internal_disable_suspend ( struct gui_priv this)
static

◆ gui_internal_enter()

void gui_internal_enter ( struct gui_priv this,
int  ignore 
)

◆ gui_internal_enter_setup()

void gui_internal_enter_setup ( struct gui_priv this)

◆ gui_internal_evaluate()

void gui_internal_evaluate ( struct gui_priv this,
const char *  command 
)

◆ gui_internal_get_attr()

static int gui_internal_get_attr ( struct gui_priv this,
enum attr_type  type,
struct attr attr 
)
static

◆ gui_internal_get_flags()

static enum flags gui_internal_get_flags ( struct widget widget)
static

◆ gui_internal_get_state()

static int gui_internal_get_state ( struct widget widget)
static

References widget::state.

◆ gui_internal_is_active_vehicle()

static int gui_internal_is_active_vehicle ( struct gui_priv this,
struct vehicle vehicle 
)
static

Figures out whether the given vehicle is the active vehicle.

Returns
true if the vehicle is active, false otherwise.

References navit_get_attr(), attr::u, attr::vehicle, and vehicle.

Referenced by gui_internal_cmd_set_active_profile(), and gui_internal_menu_vehicle_settings().

◆ gui_internal_keyboard()

struct widget* gui_internal_keyboard ( struct gui_priv this,
int  mode 
)

Creates a keyboard widget.

This function creates a widget to display the internal GUI keyboard.

The

mode

argument specifies the type of keyboard which should initially be displayed. Refer to vkbd_mode for a list of possible modes and their meaning.

Parameters
thisThe internal GUI instance
modeThe mode for the keyboard
Returns
A new keyboard widget

References gui_internal_keyboard_do().

Referenced by gui_internal_cmd_add_bookmark2(), gui_internal_cmd_add_bookmark_folder2(), gui_internal_cmd_enter_coord(), gui_internal_cmd_log(), gui_internal_cmd_pois_filter(), gui_internal_cmd_rename_bookmark(), gui_internal_html_menu(), and gui_internal_search().

◆ gui_internal_keyboard_show_native()

struct widget* gui_internal_keyboard_show_native ( struct gui_priv this,
struct widget w,
int  mode,
char *  lang 
)

Shows the platform's native on-screen keyboard or other input method.

This method is a wrapper around the corresponding method of the graphics plugin, which takes care of all platform-specific details. In particular, it is up to the graphics plugin to determine how to handle the request: it may show its on-screen keyboard or another input method (such as stroke recognition). It may choose to simply ignore the request, which will typically occur when a hardware keyboard (or other hardware input) is available.

The platform's native input method may obstruct parts of Navit's UI. To prevent parts of the UI from becoming unreachable, this method will insert an empty box widget in the appropriate size at the appropriate position, provided the graphics plugin reports the correct values. Otherwise a zero-size widget is inserted. If the graphics driver decides not to display an on-screen input method, no widget will be created and the return value will be

NULL

.

The widget's

wfree

function, to be called when the widget is destroyed, will be used to hide the platform keyboard when it is no longer needed.

Parameters
thisThe internal GUI instance
wThe parent of the widget requiring text input
modeThe requested keyboard mode
langThe language for text input, used to select a keyboard layout
Returns
The placeholder widget for the on-screen keyboard, may be
NULL

References widget::data, dbg, flags_fill, graphics_show_native_keyboard(), gravity_center, gui_internal_box_new(), gui_internal_keyboard_hide_native(), gui_internal_menu_data(), gui_internal_widget_append(), graphics_keyboard::h, widget::h, widget::hmin, menu_data::keyboard, menu_data::keyboard_mode, graphics_keyboard::lang, lvl_error, graphics_keyboard::mode, orientation_horizontal_vertical, graphics_keyboard::w, widget::w, widget::wfree, and widget::wmin.

Referenced by gui_internal_cmd_add_bookmark2(), gui_internal_cmd_add_bookmark_folder2(), gui_internal_cmd_enter_coord(), gui_internal_cmd_log(), gui_internal_cmd_pois_filter(), gui_internal_cmd_rename_bookmark(), gui_internal_html_menu(), and gui_internal_search().

◆ gui_internal_keynav_find_closest()

static void gui_internal_keynav_find_closest ( struct widget wi,
struct point p,
int  dx,
int  dy,
int *  distance,
struct widget **  result 
)
static

◆ gui_internal_keynav_find_next()

static int gui_internal_keynav_find_next ( struct widget wi,
struct widget current_highlight,
struct widget **  result 
)
static

◆ gui_internal_keynav_find_next_sensitive_child()

static struct widget * gui_internal_keynav_find_next_sensitive_child ( struct widget wi)
static

◆ gui_internal_keynav_find_prev()

static int gui_internal_keynav_find_prev ( struct widget wi,
struct widget current_highlight,
struct widget **  result 
)
static

◆ gui_internal_keynav_highlight_next()

static void gui_internal_keynav_highlight_next ( struct gui_priv this,
int  dx,
int  dy,
int  rotary 
)
static

Move keyboard focus to the next widget.

Move keyboard focus to the appropriate next widget, depending on the direction of focus movement.

Parameters
thisGUI context
thisdx horizontal movement (-1=left, +1=right), unless rotary==1
thisdy vertical movement (+1=up, -1=down)
rotary(0/1) input from rotary encoder - dx indicates forwards/backwards movement through all widgets

References dbg, gui_internal_highlight_do(), gui_internal_keynav_find_closest(), gui_internal_keynav_find_next(), gui_internal_keynav_find_prev(), gui_internal_keynav_point(), gui_internal_say(), lvl_debug, and p.

Referenced by gui_internal_keypress().

◆ gui_internal_keynav_point()

static void gui_internal_keynav_point ( struct widget w,
int  dx,
int  dy,
struct point p 
)
static

◆ gui_internal_keypress()

◆ gui_internal_keypress_do()

◆ gui_internal_leave()

void gui_internal_leave ( struct gui_priv this)

◆ gui_internal_match()

static int gui_internal_match ( const char *  pattern,
const char *  string 
)
static

References p.

Referenced by gui_internal_set().

◆ gui_internal_menu_vehicle_settings()

◆ gui_internal_motion()

◆ gui_internal_motion_cb()

◆ gui_internal_new()

static struct gui_priv* gui_internal_new ( struct navit nav,
struct gui_methods meth,
struct attr **  attrs,
struct gui gui 
)
static

◆ gui_internal_populate_route_table()

◆ gui_internal_prepare_search_results_map()

static void gui_internal_prepare_search_results_map ( struct gui_priv this,
struct widget table,
struct coord_rect r 
)
static

Create a map rect highlighting one of multiple points provided in argument @data and displayed using the style type_found_item (name for each point will also be displayed aside)

Parameters
thisThe GUI context
tableA table widget or any of its descendants. The table contain results to place on the map. Providing NULL here will remove all previous results from the map.
[out]rThe minimum rect focused to contain all results placed on the map (or unchanged if r==NULL)

References widget::c, widget::children, widget::data, dbg, gui_internal_prune_menu(), lvl_warning, widget::name, navit_populate_search_results_map(), navit_set_attr(), navit_zoom_to_rect(), attr::num, p, widget::parent, attr::type, widget::type, attr::u, widget::w, widget_table, widget_table_row, pcoord::x, and pcoord::y.

Referenced by gui_internal_cmd_results_to_map(), and gui_internal_cmd_view_on_map().

◆ gui_internal_remove_callback()

static void gui_internal_remove_callback ( struct gui_priv priv,
struct callback cb 
)
static

◆ gui_internal_resize()

static void gui_internal_resize ( void *  data,
int  wnew,
int  hnew 
)
static

Callback function invoked when display area is resized.

Parameters
dataA generic argument structure pointer, here we use it to store the the internal GUI context (this)
wnewThe new width of the display area
hnewThe new height of the display area
Author
Martin Schaller
Date
2008/04

References changed(), widget::children, data, dbg, gui_priv::gra, graphics_get_data(), gui_internal_menu_needs_resizing(), gui_internal_menu_render(), gui_internal_menu_resize(), gui_internal_setup(), gui_internal_widget_reload_href(), lvl_debug, gui_priv::nav, navit_handle_resize(), gui_priv::root, widget::w, and gui_priv::w.

Referenced by gui_internal_set_graphics().

◆ gui_internal_route_screen_free()

void gui_internal_route_screen_free ( struct gui_priv this_,
struct widget w 
)

Called when the route screen is closed (deallocated).

The main purpose of this function is to remove the widgets from references route_data because those widgets are about to be freed.

References gui_priv::route_data, route_data::route_showing, and route_data::route_table.

Referenced by gui_internal_cmd2_route_description().

◆ gui_internal_route_update()

void gui_internal_route_update ( struct gui_priv this,
struct navit navit,
struct vehicle v 
)

◆ gui_internal_say()

void gui_internal_say ( struct gui_priv this,
struct widget w,
int  questionmark 
)

◆ gui_internal_select_waypoint()

◆ gui_internal_set()

int gui_internal_set ( char *  remove,
char *  add 
)

◆ gui_internal_set_attr()

static int gui_internal_set_attr ( struct gui_priv this,
struct attr attr 
)
static

◆ gui_internal_set_click_coord()

◆ gui_internal_set_data()

static void gui_internal_set_data ( struct widget widget,
void *  data 
)
static

References widget::data, and data.

◆ gui_internal_set_default_background()

static void gui_internal_set_default_background ( struct gui_priv this,
struct widget widget 
)
static

References widget::background.

◆ gui_internal_set_flags()

static void gui_internal_set_flags ( struct widget widget,
enum flags  flags 
)
static

References widget::flags.

◆ gui_internal_set_func()

static void gui_internal_set_func ( struct widget widget,
void(*)(struct gui_priv *priv, struct widget *widget, void *data func 
)
static

References widget::func.

◆ gui_internal_set_graphics()

◆ gui_internal_set_position_coord()

◆ gui_internal_set_state()

static void gui_internal_set_state ( struct widget widget,
int  state 
)
static

References widget::state.

◆ gui_internal_setup()

◆ gui_internal_time_help()

◆ gui_internal_window_closed()

static void gui_internal_window_closed ( struct gui_priv this)
static

◆ image_new_l()

struct graphics_image* image_new_l ( struct gui_priv this,
const char *  name 
)

Displays an image scaled to l (large) size.

Parameters
thisOur gui context
nameimage name
Returns
image_struct Ptr to scaled image struct or NULL if not scaled or found

References image_new_scaled(), and name.

Referenced by gui_internal_time_help(), and html_image().

◆ image_new_s()

struct graphics_image* image_new_s ( struct gui_priv this,
const char *  name 
)

Displays an image scaled to s (small) size.

Parameters
thisOur gui context
nameimage name
Returns
image_struct Ptr to scaled image struct or NULL if not scaled or found

References image_new_scaled(), and name.

Referenced by gui_internal_cmd_pois_selector(), gui_internal_top_bar(), and html_image().

◆ image_new_scaled()

static struct graphics_image* image_new_scaled ( struct gui_priv this,
const char *  name,
int  w,
int  h 
)
static

Displays an image scaled to a specific size.

Searches for scaleable and pre-scaled image

Parameters
thisOur gui context
nameimage name
wdesired width of image
hdesired height of image
Returns
image_struct Ptr to scaled image struct or NULL if not scaled or found

References dbg, graphics_icon_path(), graphics_image_new_scaled(), lvl_debug, lvl_error, and name.

Referenced by image_new_l(), image_new_s(), and image_new_xs().

◆ image_new_xs()

◆ item_get_heightline()

◆ line_intersection()

int line_intersection ( struct coord a1,
struct coord a2,
struct coord b1,
struct coord b2,
struct coord res 
)

finds the intersection point of 2 lines

Parameters
coorda1, a2, b1, b2 : coords of the start and end of the first and the second line
coordres, will become the coords of the intersection if found
Returns
: TRUE if intersection found, otherwise FALSE

References dbg, lvl_info, coord::x, and coord::y.

Referenced by gui_internal_cmd2_route_height_profile().

◆ plugin_init()

void plugin_init ( void  )

References gui_internal_new().

◆ removecase()

char* removecase ( char *  s)

Remove the case in a string.

Warning
Result should be g_free()d after use.
Parameters
sThe input utf-8 string
Returns
An equivalent string prepared for case insensitive search

References linguistics_casefold().

Referenced by gui_internal_cmd_pois_item_selected(), gui_internal_poi_param_set_filter(), and gui_internal_search_cmp().

◆ save_vehicle_xml()

Variable Documentation

◆ config_profiles

struct gui_config_settings config_profiles[]
static
Initial value:
= {
{545,32,48,96,10}
, {300,32,48,64,3}
,{200,16,32,48,2}
}

The default config profiles.

[0] => LARGE_PROFILE (screens 640 in one dimension) [1] => MEDIUM PROFILE (screens larger than 320 in one dimension [2] => Small profile (default)

Referenced by gui_internal_apply_config().

◆ gui_internal_methods

Initial value:
= {
NULL,
NULL,
NULL,
NULL,
NULL,
}
static int gui_internal_set_attr(struct gui_priv *this, struct attr *attr)
Definition: gui_internal.c:2284
static int gui_internal_get_attr(struct gui_priv *this, enum attr_type type, struct attr *attr)
Definition: gui_internal.c:2239
static int gui_internal_add_attr(struct gui_priv *this, struct attr *attr)
Definition: gui_internal.c:2273
static int gui_internal_set_graphics(struct gui_priv *this, struct graphics *gra)
Definition: gui_internal.c:2874
static void gui_internal_disable_suspend(struct gui_priv *this)
Definition: gui_internal.c:2908

Referenced by gui_internal_new().

◆ gui_internal_methods_ext

struct gui_internal_methods gui_internal_methods_ext
static
Initial value:
= {
}
struct graphics_image * image_new_xs(struct gui_priv *this, const char *name)
Displays an image scaled to xs (extra small) size.
Definition: gui_internal.c:164
struct graphics_image * image_new_l(struct gui_priv *this, const char *name)
Displays an image scaled to l (large) size.
Definition: gui_internal.c:189
static void gui_internal_add_callback(struct gui_priv *priv, struct callback *cb)
Definition: gui_internal.c:2932
static void gui_internal_remove_callback(struct gui_priv *priv, struct callback *cb)
Definition: gui_internal.c:2936
void gui_internal_menu_render(struct gui_priv *this)
Renders a menu GUI on the display.
Definition: gui_internal_menu.c:307

Referenced by gui_internal_new().

◆ gui_internal_widget_methods

Initial value:
= {
}
static void gui_internal_set_state(struct widget *widget, int state)
Definition: gui_internal.c:2962
static void gui_internal_set_func(struct widget *widget, void(*func)(struct gui_priv *priv, struct widget *widget, void *data))
Definition: gui_internal.c:2966
static void gui_internal_set_flags(struct widget *widget, enum flags flags)
Definition: gui_internal.c:2954
static void gui_internal_set_data(struct widget *widget, void *data)
Definition: gui_internal.c:2971
static void gui_internal_set_default_background(struct gui_priv *this, struct widget *widget)
Definition: gui_internal.c:2975
struct widget * gui_internal_keyboard(struct gui_priv *this, int mode)
Creates a keyboard widget.
Definition: gui_internal_keyboard.c:676
static int gui_internal_get_state(struct widget *widget)
Definition: gui_internal.c:2958
static enum flags gui_internal_get_flags(struct widget *widget)
Definition: gui_internal.c:2950
struct widget * gui_internal_menu(struct gui_priv *this, const char *label)
Initializes a GUI menu screen.
Definition: gui_internal_menu.c:223
struct widget * gui_internal_label_new(struct gui_priv *this, const char *text)
Definition: gui_internal_widget.c:110
struct widget * gui_internal_image_new(struct gui_priv *this, struct graphics_image *image)
Definition: gui_internal_widget.c:137
void gui_internal_widget_append(struct widget *parent, struct widget *child)
Adds a child widget to a parent widget, making it the last child.
Definition: gui_internal_widget.c:757
struct widget * gui_internal_button_new(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags)
Definition: gui_internal_widget.c:261
struct widget * gui_internal_box_new(struct gui_priv *this, enum flags flags)
Definition: gui_internal_widget.c:357
struct widget * gui_internal_button_new_with_callback(struct gui_priv *this, const char *text, struct graphics_image *image, enum flags flags, void(*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data)
Definition: gui_internal_widget.c:255

Referenced by gui_internal_new().

◆ LARGE_PROFILE

const int LARGE_PROFILE =0

Navit, a modular navigation system. Copyright (C) 2005-2010 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. Indexes into the config_profiles array.

Referenced by gui_internal_apply_config().

◆ MEDIUM_PROFILE

const int MEDIUM_PROFILE =1

◆ SMALL_PROFILE

const int SMALL_PROFILE =2