summaryrefslogtreecommitdiff
path: root/navit/gui
diff options
context:
space:
mode:
authorLionel AINS <lains@caramail.com>2018-11-19 18:49:50 +0100
committerLionel AINS <lains@caramail.com>2018-11-19 18:49:50 +0100
commitb51f7a91b79f40de3701311210725f820a0a21ea (patch)
tree7b4d12fcde1f888e48e06c783e2433aeedb1de62 /navit/gui
parent0adf12a0166337bf1c33427e009e7cf6194a0c9a (diff)
downloadnavit-b51f7a91b79f40de3701311210725f820a0a21ea.tar.gz
Removing debug logs, adding doxygen comments
Diffstat (limited to 'navit/gui')
-rw-r--r--navit/gui/internal/gui_internal.c10
-rw-r--r--navit/gui/internal/gui_internal_menu.c63
-rw-r--r--navit/gui/internal/gui_internal_widget.c7
3 files changed, 64 insertions, 16 deletions
diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c
index 31b6e10d2..afae9a9f1 100644
--- a/navit/gui/internal/gui_internal.c
+++ b/navit/gui/internal/gui_internal.c
@@ -2706,25 +2706,21 @@ static void gui_internal_resize(void *data, int wnew, int hnew) {
*/
if (!changed && this->gra && graphics_get_data(this->gra, "padding"))
changed = 1;
- dbg(lvl_debug,"w=%d h=%d children=%p", wnew, hnew, this->root.children);
navit_handle_resize(this->nav, wnew, hnew);
if (this->root.children) {
if (changed) {
l = g_list_last(this->root.children);
if (l) {
w=l->data;
- void (*redisplay)(struct gui_priv *priv, struct widget *widget, void *data);
- redisplay=w->menu_data->redisplay;
- dbg(lvl_error, "redisplay%c=NULL", redisplay?'!':'=');
if (!gui_internal_widget_reload_href(this,
w)) { /* If the foremost widget is a HTML menu, reload & redraw it from its href */
/* If not, resize the foremost widget */
- dbg(lvl_error, "Current GUI displayed is not a menu");
- dbg(lvl_error, "Will call resize with w=%d, h=%d", wnew, hnew)
+ dbg(lvl_debug, "Current GUI displayed is not a menu");
+ dbg(lvl_debug, "Will call resize with w=%d, h=%d", wnew, hnew)
gui_internal_menu_resize(this, wnew, hnew);
gui_internal_menu_render(this);
} else {
- dbg(lvl_error,"Current GUI displayed is a menu");
+ dbg(lvl_debug,"Current GUI displayed is a menu");
}
}
} else {
diff --git a/navit/gui/internal/gui_internal_menu.c b/navit/gui/internal/gui_internal_menu.c
index 9b2d4b90a..5c55bfba6 100644
--- a/navit/gui/internal/gui_internal_menu.c
+++ b/navit/gui/internal/gui_internal_menu.c
@@ -38,6 +38,12 @@ int gui_internal_menu_needs_resizing(struct gui_priv *this, struct widget *w, in
}
}
+/**
+ * @brief destroy a menu widget and perform the associated cleanup in the menu & submenu list
+ *
+ * @param this The GUI instance
+ * @param w The menu widget to destroy
+ */
void gui_internal_menu_destroy(struct gui_priv *this, struct widget *w) {
struct menu_data *menu_data=w->menu_data;
if (menu_data) {
@@ -122,23 +128,34 @@ static void gui_internal_prune_menu_do(struct gui_priv *this, struct widget *w,
/* If the foremost widget is a HTML menu, reload & redraw it from its href using gui_internal_widget_reload_href() */
if (!gui_internal_widget_reload_href(this,w)) {
/* If not, resize the foremost widget */
- dbg(lvl_error, "Current GUI displayed is not a menu");
- dbg(lvl_error, "Will call resize with w=%d, h=%d", this->root.w, this->root.h)
gui_internal_menu_resize(this, this->root.w, this->root.h);
}
gui_internal_menu_render(this);
}
}
return;
- }
- gui_internal_menu_destroy(this, wd);
+ } else
+ gui_internal_menu_destroy(this, wd);
}
}
+/**
+ * @brief Destroy (discard) all menu screens that have been placed after widget @p w and redraw the display, showing widget @w
+ *
+ * @param this The internal GUI instance
+ * @param w A widget corresponding to the last menu to keep, and to draw (all subsequent menus in the list will be destroyed). NULL if all menus should be destroyed.
+ */
void gui_internal_prune_menu(struct gui_priv *this, struct widget *w) {
gui_internal_prune_menu_do(this, w, 1);
}
+/**
+ * @brief Destroy (discard) the last @p count menu screens
+ *
+ * @param this The internal GUI instance
+ * @param count The number of menus to destroy at the tail of the menu/submenu stack (if <=0, no menu will be destroyed)
+ * @param render whether we should render the new last menu in the stack (render!=0) or not (render==0)
+ */
void gui_internal_prune_menu_count(struct gui_priv *this, int count, int render) {
GList *l=g_list_last(this->root.children);
struct widget *w=NULL;
@@ -150,16 +167,49 @@ void gui_internal_prune_menu_count(struct gui_priv *this, int count, int render)
}
}
+/**
+ * @brief Resize the main box widget (and its children) corresponding to a menu, effectively resizing the whole menu display size
+ *
+ * Note: once this function has been run, widget @p w and its children have been resized, a call to gui_internal_box_render() needs to be done by the caller
+ *
+ * @param this The internal GUI instance
+ * @param w A box widget corresponding to the menu
+ * @param data Some data to pass to the box resize handler
+ * @param neww The new width of the display
+ * @param newh The new height of the display
+ */
void gui_internal_menu_topbox_resize(struct gui_priv *this, struct widget *w, void *data, int neww, int newh) {
+
+ if (w->type != widget_box) {
+ dbg(lvl_warning, "Called on a non-box widget, ignoring");
+ return;
+ }
w->w=neww;
w->h=newh;
gui_internal_box_resize(this, w, data, w->w, w->h);
- /* Note: this widget and its children have been resized, a call to gui_internal_box_render() needs to be done by the caller */
}
+/**
+ * @brief Resize the box widget (and its children) corresponding to a menu
+ *
+ * Menus are stored in a main box (topbox) that spawn the entire screen, thus, once the topbox has been resized, it will in turn resize its children,
+ * effectively resizing the whole menu display size
+ *
+ * Note: once this function has been run, widget @p w and its children have been resized, a call to gui_internal_box_render() needs to be done by the caller
+ *
+ * @param this The internal GUI instance
+ * @param w A box widget corresponding to the menu widget
+ * @param data Some data to pass to the box resize handler
+ * @param neww The new width of the display
+ * @param newh The new height of the display
+ */
void gui_internal_menu_menu_resize(struct gui_priv *this, struct widget *w, void *data, int neww, int newh) {
struct padding *padding = NULL;
+ if (w->type != widget_box) {
+ dbg(lvl_warning, "Called on a non-box widget, ignoring");
+ return;
+ }
if (this->gra) {
padding = graphics_get_data(this->gra, "padding");
} else
@@ -176,11 +226,10 @@ void gui_internal_menu_menu_resize(struct gui_priv *this, struct widget *w, void
w->h = newh;
}
gui_internal_box_resize(this, w, data, w->w, w->h);
- /* Note: this widget and its children have been resized, a call to gui_internal_box_render() needs to be done by the caller */
}
/**
- * @brief Initializes a GUI screen
+ * @brief Initializes a GUI menu screen
*
* This method initializes the internal GUI's screen on which all other elements (such as HTML menus,
* dialogs or others) are displayed.
diff --git a/navit/gui/internal/gui_internal_widget.c b/navit/gui/internal/gui_internal_widget.c
index 082392648..e398babb5 100644
--- a/navit/gui/internal/gui_internal_widget.c
+++ b/navit/gui/internal/gui_internal_widget.c
@@ -619,14 +619,17 @@ void gui_internal_box_resize(struct gui_priv *this, struct widget *w, void *data
l=w->children;
while (l) {
wb=l->data;
- dbg(lvl_error, "Checking if widget at %p has resize handler", wb);
if (wb->on_resize) {
- dbg(lvl_error, "Widget at %p has resize handler", wb);
int orientation=w->flags & 0xffff0000;
switch(orientation) {
case orientation_horizontal:
+ dbg(lvl_error, "Box has hrz orientation");
+ break;
case orientation_vertical:
+ dbg(lvl_error, "Box has vrt orientation");
+ break;
case orientation_horizontal_vertical:
+ dbg(lvl_error, "Box has hrz+vrt orientation");
break;
default:
dbg(lvl_error, "Box has no specific orientation, should be expanded to parent size");