static void on_cam_renderer_param_widget_changed (GtkuParamWidget *pw, const char *param, void *user_data) { cam_renderer_t *cr = (cam_renderer_t*) user_data; // delete the old texture object if it exists. make sure that we've // selected the correct OpenGL context if (cr->texture) { if (cr->render_place == RENDER_IN_WIDGET) { gtku_gl_drawing_area_set_context (cr->gl_area); } else { gtku_gl_drawing_area_set_context (cr->renderer->viewer->gl_area); } glutil_texture_free (cr->texture); cr->texture = NULL; } cr->render_place = gtku_param_widget_get_enum (pw, PARAM_RENDER_IN); if (cr->render_place == RENDER_IN_WIDGET) { gtk_widget_show (GTK_WIDGET (cr->gl_area)); } else { gtk_widget_hide (GTK_WIDGET (cr->gl_area)); } cr->is_uploaded = 0; viewer_request_redraw (cr->renderer->viewer); }
static void on_param_widget_changed (GtkuParamWidget *pw, const char *name, void *user) { RendererSimTraffic *self = (RendererSimTraffic*) user; viewer_request_redraw (self->viewer); }
static void on_lcgl_data (const lcm_recv_buf_t *rbuf, const char *channel, const botlcm_lcmgl_data_t *_msg, void *user_data ) { RendererLcmgl *self = (RendererLcmgl*) user_data; lcgl_channel_t *chan = (lcgl_channel_t*) g_hash_table_lookup(self->channels, _msg->name); if (!chan) { chan = (lcgl_channel_t*) calloc(1, sizeof(lcgl_channel_t)); chan->enabled=1; //chan->backbuffer = g_ptr_array_new(); chan->frontbuffer = g_ptr_array_new(); g_hash_table_insert(self->channels, strdup(_msg->name), chan); bot_gtk_param_widget_add_booleans (self->pw, BOT_GTK_PARAM_WIDGET_DEFAULTS, strdup(_msg->name), 1, NULL); } #if 0 int current_scene = -1; if (chan->backbuffer->len > 0) { botlcm_lcmgl_data_t *ld = g_ptr_array_index(chan->backbuffer, 0); current_scene = ld->scene; } // new scene? if (current_scene != _msg->scene) { // free objects in foreground buffer for (int i = 0; i < chan->frontbuffer->len; i++) botlcm_lcmgl_data_t_destroy(g_ptr_array_index(chan->frontbuffer, i)); g_ptr_array_set_size(chan->frontbuffer, 0); // swap front and back buffers GPtrArray *tmp = chan->backbuffer; chan->backbuffer = chan->frontbuffer; chan->frontbuffer = tmp; viewer_request_redraw( self->viewer ); } #endif for (int i = 0; i < (int) chan->frontbuffer->len; i++) botlcm_lcmgl_data_t_destroy((botlcm_lcmgl_data_t*) g_ptr_array_index(chan->frontbuffer, i)); g_ptr_array_set_size (chan->frontbuffer, 0); g_ptr_array_add(chan->frontbuffer, botlcm_lcmgl_data_t_copy(_msg)); viewer_request_redraw( self->viewer ); }
static void on_param_changed( GtkuParamWidget *pw, const char *name, void *user_data ) { RendererTextured *self = (RendererTextured*) user_data; self->numScans = gtku_param_widget_get_int(self->pw, PARAM_MEMORY); viewer_request_redraw( self->viewer ); }
static gboolean on_redraw_timer(void *user_data) { Viewer * self = (Viewer *) user_data; self->redraw_timer_pending = 0; viewer_request_redraw (self); return FALSE; // this is a one-shot event. }
static gboolean on_motion_notify (GtkWidget *widget, GdkEventMotion *event, void *user_data) { Viewer *self = (Viewer*) user_data; gtku_gl_drawing_area_set_context (self->gl_area); double ray_start[3]; double ray_dir[3]; _window_coord_to_ray (event->x, widget->allocation.height - event->y, ray_start, ray_dir); // is anyone hovering? if (self->picking_handler == NULL || !self->picking_handler->picking) { // find a new hover? double best_distance = HUGE; EventHandler *best_handler = NULL; for (unsigned int eidx = 0; eidx < g_ptr_array_size(self->event_handlers); eidx++) { EventHandler *handler = g_ptr_array_index(self->event_handlers, eidx); handler->hovering = 0; if (handler->enabled && handler->hover_query) { double this_distance = handler->hover_query(self, handler, ray_start, ray_dir); if (this_distance < best_distance && this_distance >= 0) { best_distance = this_distance; best_handler = handler; } } } // notify the new handler if (best_handler) best_handler->hovering = 1; viewer_request_redraw(self); } // give picking handler first dibs int consumed = 0; if (self->picking_handler && !self->picking_handler->picking) self->picking_handler = NULL; if (self->picking_handler && self->picking_handler->enabled && self->picking_handler->mouse_motion) { consumed = self->picking_handler->mouse_motion(self, self->picking_handler, ray_start, ray_dir, event); update_status_bar(self); } // try all the other handlers in order of priority for (unsigned int eidx = 0; !consumed && eidx < g_ptr_array_size(self->event_handlers); eidx++) { EventHandler *handler = g_ptr_array_index(self->event_handlers, eidx); if (handler != self->picking_handler && handler->enabled && handler->mouse_motion) if (handler->mouse_motion(self, handler, ray_start, ray_dir, event)) break; } return TRUE; }
static gboolean on_gl_configure (GtkWidget *widget, GdkEventConfigure *event, void* user_data) { Viewer * self = (Viewer *) user_data; update_status_bar(self); // redraw our window size viewer_request_redraw (self); return TRUE; }
static int pose_listener (CTrans * ctrans, ctrans_update_type_t type, void *user) { if (type != CTRANS_POSE_UPDATE) return 0; RendererCar *self = (RendererCar*) user; ViewHandler *vhandler = self->viewer->view_handler; lcmtypes_pose_t pose; ctrans_local_pose (self->ctrans, &pose); double lastpos[3] = {0,0,0}; if (gu_ptr_circular_size(self->path)) memcpy(lastpos, gu_ptr_circular_index(self->path, 0), 3 * sizeof(double)); double diff[3]; vector_subtract_3d(pose.pos, lastpos, diff); if (vector_magnitude_3d(diff) > 2.0) { // clear the buffer if we jump gu_ptr_circular_clear(self->path); } if (vector_magnitude_3d(diff) > 0.1 || gu_ptr_circular_size(self->path)==0) { double *p = (double*) calloc(3, sizeof(double)); memcpy(p, pose.pos, sizeof(double)*3); gu_ptr_circular_add(self->path, p); } if (vhandler && vhandler->update_follow_target && !self->teleport_car) { vhandler->update_follow_target(vhandler, pose.pos, pose.orientation); } if (!self->did_teleport) on_find_button(NULL, self); self->did_teleport = 1; int64_t dt = pose.utime - self->last_pose.utime; double r = config_get_double_or_default (self->config, "renderer_car.wheel_radius", 0.3); if (self->last_pose.utime) { int i; for (i = 0; i < 4; i++) { self->wheelpos[i] += self->wheelspeeds[i] * dt * 1e-6 / r; self->wheelpos[i] = mod2pi (self->wheelpos[i]); } } memcpy (&self->last_pose, &pose, sizeof (lcmtypes_pose_t)); viewer_request_redraw(self->viewer); return 0; }
static void on_event_handler_enabled_toggled (GtkCheckMenuItem *cmi, void *user_data) { Viewer *self = (Viewer*) user_data; EventHandler *ehandler = (EventHandler*) g_object_get_data (G_OBJECT(cmi), "Viewer:plugin"); ehandler->enabled = gtk_check_menu_item_get_active (cmi); viewer_request_redraw (self); }
static void on_navigator_plan (const lcm_recv_buf_t *rbuf, const char *channel, const lcmtypes_navigator_plan_t *msg, void *user_data ) { RendererNavigator *self = (RendererNavigator*) user_data; if (self->nav) lcmtypes_navigator_plan_t_destroy (self->nav); self->nav = lcmtypes_navigator_plan_t_copy(msg); viewer_request_redraw(self->viewer); }
static void on_param_widget_changed (BotGtkParamWidget *pw, const char *name, RendererScrollingPlots *self) { if (! strcmp (name, PARAM_NAME_SHOW_LEGEND)) { BotGlScrollPlot2dLegendLocation legloc = BOT_GL_SCROLLPLOT2D_HIDDEN; if (bot_gtk_param_widget_get_bool (self->pw, PARAM_NAME_SHOW_LEGEND)) { legloc = BOT_GL_SCROLLPLOT2D_TOP_RIGHT; } bot_gl_scrollplot2d_set_show_legend (self->psi_distance_plot, legloc); } viewer_request_redraw (self->viewer); }
static void on_param_widget_changed (GtkuParamWidget *pw, const char *name, RendererRrtDebug *self) { if (! strcmp (name, PARAM_NAME_RENDER_CTRL)) { self->plot_ctrl = gtku_param_widget_get_bool (self->pw, PARAM_NAME_RENDER_CTRL); } else if (! strcmp (name, PARAM_NAME_RENDER_STATE)) { self->plot_state = gtku_param_widget_get_bool (self->pw, PARAM_NAME_RENDER_STATE); } viewer_request_redraw (self->viewer); }
static void on_pose(const lcm_recv_buf_t *rbuf, const char *channel, const botlcm_pose_t *pose, void *user_data) { RendererCar *self = (RendererCar*) user_data; ViewHandler *vhandler = self->viewer->view_handler; double lastpos[3] = {0,0,0}; if (bot_ptr_circular_size(self->path)) memcpy(lastpos, bot_ptr_circular_index(self->path, 0), 3 * sizeof(double)); double diff[3]; bot_vector_subtract_3d(pose->pos, lastpos, diff); if (bot_vector_magnitude_3d(diff) > 2.0) { // clear the buffer if we jump bot_ptr_circular_clear(self->path); } if (bot_vector_magnitude_3d(diff) > 0.1 || bot_ptr_circular_size(self->path)==0) { double *p = (double*) calloc(3, sizeof(double)); memcpy(p, pose->pos, sizeof(double)*3); bot_ptr_circular_add(self->path, p); } if (vhandler && vhandler->update_follow_target && !self->teleport_car) { vhandler->update_follow_target(vhandler, pose->pos, pose->orientation); } if (!self->did_teleport) on_find_button(NULL, self); self->did_teleport = 1; int64_t dt = pose->utime - self->last_pose.utime; double r = bot_conf_get_double_or_default (self->config, "renderer_car.wheel_radius", 0.3); if (self->last_pose.utime) { int i; for (i = 0; i < 4; i++) { self->wheelpos[i] += self->wheelspeeds[i] * dt * 1e-6 / r; self->wheelpos[i] = bot_mod2pi (self->wheelpos[i]); } } memcpy (&self->last_pose, &pose, sizeof (botlcm_pose_t)); viewer_request_redraw(self->viewer); }
static void on_sim_goals_new(const lcm_recv_buf_t *rbuf, const char *channel, const lcmtypes_goal_list_t *msg, void *_user) { RendererGoal *self = (RendererGoal*) _user; pthread_mutex_lock(&self->mutex); g_array_set_size(self->my_goals,msg->num_goals); memcpy(self->my_goals->data,msg->goals,msg->num_goals*sizeof(lcmtypes_goal_t)); activate_simgoals_transmitter(self); pthread_mutex_unlock(&self->mutex); viewer_request_redraw(self->viewer); }
static void on_rrt_debug (const lcm_recv_buf_t *rbuf, const char *channel, const lcmtypes_rrt_debug_t *msg, void *user_data ) { RendererRrtDebug *self = (RendererRrtDebug*) user_data; if (!ctrans_have_pose (self->ctrans)) return; if (self->data) lcmtypes_rrt_debug_t_destroy (self->data); self->data = lcmtypes_rrt_debug_t_copy(msg); self->min_node_id = get_min_node_id (self->data); viewer_request_redraw(self->viewer); }
static void on_param_widget_changed (GtkuParamWidget *pw, const char *name, void *user) { RendererCar *self = (RendererCar*) user; Viewer *viewer = self->viewer; viewer->view_handler->follow_mode = 0; if (gtku_param_widget_get_bool(pw, PARAM_FOLLOW_POS)) viewer->view_handler->follow_mode |= FOLLOW_POS; if (gtku_param_widget_get_bool(pw, PARAM_FOLLOW_YAW)) viewer->view_handler->follow_mode |= FOLLOW_YAW; self->max_draw_poses = gtku_param_widget_get_int(pw, PARAM_MAXPOSES); viewer_request_redraw ( self->viewer); }
static void on_goals(const lcm_recv_buf_t *rbuf, const char *channel, const lcmtypes_goal_list_t *msg, void *_user) { RendererGoal *self = (RendererGoal*) _user; int i; for (i = 0; i < self->recv_goal_lists->len; i++) { lcmtypes_goal_list_t * l = g_ptr_array_index (self->recv_goal_lists, i); if (l->sender_id == msg->sender_id) { lcmtypes_goal_list_t_destroy (l); g_ptr_array_remove_index_fast (self->recv_goal_lists, i); break; } } g_ptr_array_add (self->recv_goal_lists, lcmtypes_goal_list_t_copy (msg)); viewer_request_redraw(self->viewer); }
static void on_param_widget_changed (BotGtkParamWidget *pw, const char *name, void *user) { RendererLcmgl *self = (RendererLcmgl*) user; // iterate over each channel GList *keys = bot_g_hash_table_get_keys(self->channels); for (GList *kiter=keys; kiter; kiter=kiter->next) { lcgl_channel_t *chan = (lcgl_channel_t*) g_hash_table_lookup(self->channels, kiter->data); chan->enabled = bot_gtk_param_widget_get_bool (pw, (const char*)kiter->data); } g_list_free (keys); viewer_request_redraw(self->viewer); }
static void on_motion_cmd (const lcm_recv_buf_t *buf, const char *channel, const fblcm_motion_cmd_t *msg, void *user) { RendererScrollingPlots *self = (RendererScrollingPlots *) user; if (bot_gtk_param_widget_get_bool (self->pw, PARAM_NAME_FREEZE)) return; update_xaxis(self, msg->utime); double timestamp = msg->utime * 1e-6; bot_gl_scrollplot2d_add_point (self->navigator_rotation_plot, "control", timestamp, msg->rotation_speed); bot_gl_scrollplot2d_add_point (self->navigator_translation_plot, "control", timestamp, msg->translation_speed); viewer_request_redraw (self->viewer); }
static gboolean on_render_timer (Viewer * self) { #ifdef USE_ZMOV self->movie_draw_pending = 1; viewer_request_redraw(self); #else if (self->fb_area) { fb_gl_drawing_area_begin (self->fb_area); render_scene (self); fb_gl_drawing_area_end (self->fb_area); fb_gl_drawing_area_swap_buffers (self->fb_area); } #endif return TRUE; }
static void on_velodyne(const lcm_recv_buf_t *rbuf, const char *channel, const lcmtypes_velodyne_t *v, void *user_data) { RendererVelodyne *self = (RendererVelodyne*) user_data; if (!ctrans_have_pose(self->ctrans)) return; struct velodyne_data *vdata = (struct velodyne_data*) calloc(1, sizeof(struct velodyne_data)); vdata->data = (void*) malloc(v->datalen); vdata->datalen = v->datalen; memcpy(vdata->data, v->data, v->datalen); if (config_util_sensor_to_local(channel, vdata->m)) printf("Velodyne: no calibration\n"); gu_ptr_circular_add(self->circular, vdata); viewer_request_redraw( self->viewer ); }
static void on_class_state (const lcm_recv_buf_t *buf, const char *channel, const navlcm_class_param_t *msg, void *user) { RendererScrollingPlots *self = (RendererScrollingPlots *) user; if (bot_gtk_param_widget_get_bool (self->pw, PARAM_NAME_FREEZE)) return; update_xaxis(self, msg->utime); double timestamp = msg->utime * 1e-6; bot_gl_scrollplot2d_add_point (self->psi_distance_plot, "status", timestamp, msg->psi_distance); bot_gl_scrollplot2d_add_point (self->psi_distance_plot, "control", timestamp, msg->psi_distance_thresh); viewer_request_redraw (self->viewer); }
static int on_velodyne(const lcm_recv_buf_t *rbuf, const char *channel, const lcmtypes_rgbvelodyne_t *v, void *user_data) { RendererTextured *self = (RendererTextured*) user_data; if (!ctrans_have_pose(self->ctrans)) return 0; struct velodyne_data *vdata = (struct velodyne_data*) calloc(1, sizeof(struct velodyne_data)); vdata->rgbdata = (lcmtypes_rgbvelodyne_t*)calloc(1, sizeof(lcmtypes_rgbvelodyne_t)); //vdata->rgbdata->data = (uint8_t*) malloc(v->datalen); vdata->datalen = v->datalen; //memcpy(vdata->rgbdata->data, v->data, v->datalen); vdata->rgbdata->datalen = vdata->datalen; vdata->rgbdata->rgb = (uint8_t**)malloc(v->datalen*sizeof(uint8_t*)); //uint64_t tstart = timestamp_now(); for(int i = 0; i < vdata->datalen; i++) { vdata->rgbdata->rgb[i] = (uint8_t*)malloc(3*sizeof(uint8_t)); vdata->rgbdata->rgb[i][0] = v->rgb[i][0]; vdata->rgbdata->rgb[i][1] = v->rgb[i][1]; vdata->rgbdata->rgb[i][2] = v->rgb[i][2]; } //uint64_t tend = timestamp_now(); //uint64_t diff = tend - tstart; //printf("diff = %lld\n",diff); vdata->rgbdata->datalen = vdata->datalen; //vdata->data = (velodyne_t*)calloc(1, sizeof(velodyne_t)); //vdata->data->data = (uint8_t*)malloc(v->datalen); vdata->data = (void*)malloc(v->datalen); memcpy(vdata->data, v->data, v->datalen); //vdata->data->datalen = v->datalen; //vdata->data->utime = v->utime; if (config_util_sensor_to_local("VELODYNE", vdata->m)) printf("Velodyne: no calibration\n"); gu_ptr_circular_add(self->circular, vdata); viewer_request_redraw( self->viewer ); return 0; }
static void on_renderer_enabled_toggled (GtkCheckMenuItem *cmi, void *user_data) { Viewer *self = (Viewer*) user_data; Renderer *r = (Renderer*) g_object_get_data (G_OBJECT (cmi), "Viewer:plugin"); r->enabled = gtk_check_menu_item_get_active (cmi); if (r->widget) { GtkWidget *frame = g_object_get_data (G_OBJECT (r->widget), "Viewer:frame"); if (frame) { if (r->enabled) { gtk_widget_show (frame); } else { gtk_widget_hide (frame); } } } viewer_request_redraw (self); }
static void on_find_button(GtkWidget *button, RendererCar *self) { ViewHandler *vhandler = self->viewer->view_handler; double eye[3]; double lookat[3]; double up[3]; vhandler->get_eye_look(vhandler, eye, lookat, up); double diff[3]; vector_subtract_3d(eye, lookat, diff); double pos[3] = { 0, 0, 0 }; ctrans_local_pos (self->ctrans, pos); vector_add_3d(pos, diff, eye); vhandler->set_look_at(vhandler, eye, pos, up); viewer_request_redraw(self->viewer); }
static int mouse_press (Viewer *viewer, EventHandler *ehandler, const double ray_start[3], const double ray_dir[3], const GdkEventButton *event) { RendererCar *self = (RendererCar*) ehandler->user; // only handle mouse button 1. if (self->teleport_car_request&&(event->button == 1)) { self->teleport_car = 1; } if (event->type == GDK_2BUTTON_PRESS) { self->display_detail = (self->display_detail + 1) % NUM_DETAILS; viewer_request_redraw(self->viewer); } double carpos[3] = { 0, 0, 0 }; ctrans_local_pos (self->ctrans, carpos); geom_ray_z_plane_intersect_3d(POINT3D(ray_start), POINT3D(ray_dir), carpos[2], POINT2D(self->last_xy)); return 0; }
static void on_image (const lcm_recv_buf_t *rbuf, const char *channel, const lcmtypes_image_t *msg, void *user_data) { RendererCamThumb *self = (RendererCamThumb*) user_data; if (! self->renderer.enabled) return; cam_renderer_t *cr = g_hash_table_lookup (self->cam_handlers, channel); if (!cr) { cr = (cam_renderer_t*) calloc (1, sizeof (cam_renderer_t)); cr->renderer = self; cr->render_place = 0; cr->channel = strdup (channel); g_hash_table_replace (self->cam_handlers, cr->channel, cr); } if (! cr->msg_received) { cr->gl_area = GTKU_GL_DRAWING_AREA (gtku_gl_drawing_area_new (FALSE)); cr->pw = GTKU_PARAM_WIDGET (gtku_param_widget_new ()); gtku_param_widget_add_enum (cr->pw, PARAM_RENDER_IN, 0, cr->render_place, "Here", RENDER_IN_WIDGET, "Top Left", RENDER_IN_TOP_LEFT, "Top Cent.", RENDER_IN_TOP_CENTER, "Top Right", RENDER_IN_TOP_RIGHT, "Bot. Left", RENDER_IN_BOTTOM_LEFT, "Bot. Cent.", RENDER_IN_BOTTOM_CENTER, "Bot. Right", RENDER_IN_BOTTOM_RIGHT, NULL); cr->expander = gtk_expander_new (channel); gtk_box_pack_start (GTK_BOX (self->renderer.widget), cr->expander, TRUE, TRUE, 0); GtkWidget *vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (cr->expander), vbox); gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (cr->pw), TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (cr->gl_area), TRUE, TRUE, 0); g_signal_connect (G_OBJECT (cr->gl_area), "size-allocate", G_CALLBACK (on_gl_area_size), cr); cr->width = msg->width; cr->height = msg->height; gtk_widget_show_all (GTK_WIDGET (cr->expander)); gtk_expander_set_expanded (GTK_EXPANDER (cr->expander), cr->expanded); if (cr->render_place == RENDER_IN_WIDGET) { gtk_widget_show (GTK_WIDGET (cr->gl_area)); } else { gtk_widget_hide (GTK_WIDGET (cr->gl_area)); } g_signal_connect (G_OBJECT (cr->pw), "changed", G_CALLBACK (on_cam_renderer_param_widget_changed), cr); g_signal_connect (G_OBJECT (cr->gl_area), "expose-event", G_CALLBACK (on_gl_area_expose), cr); g_signal_connect (G_OBJECT (cr->expander), "notify::expanded", G_CALLBACK (on_expander_expanded), cr); cr->texture = NULL; cr->last_image = NULL; cr->renderer = self; cr->uncompressed_buffer_size = msg->width * msg->height * 3; cr->uncompresed_buffer = (uint8_t*) malloc (cr->uncompressed_buffer_size); cr->msg_received = 1; } if (cr->last_image) { lcmtypes_image_t_destroy (cr->last_image); } cr->last_image = lcmtypes_image_t_copy (msg); cr->is_uploaded = 0; switch (gtku_param_widget_get_enum (cr->pw, PARAM_RENDER_IN)) { case RENDER_IN_WIDGET: if (gtk_expander_get_expanded (GTK_EXPANDER (cr->expander))) gtku_gl_drawing_area_invalidate (cr->gl_area); default: viewer_request_redraw (self->viewer); break; } }
static void viewer_init (Viewer *viewer) { viewer->renderers = g_ptr_array_new(); viewer->renderers_sorted = g_ptr_array_new(); viewer->renderers_sorted_with_controls = g_ptr_array_new(); viewer->event_handlers = g_ptr_array_new(); viewer->event_handlers_sorted = g_ptr_array_new(); viewer->modes = g_ptr_array_new(); viewer->prettier_flag = (getenv("DGC_VIEWER_PRETTIER") != NULL && atoi(getenv("DGC_VIEWER_PRETTIER"))>0);; printf("DGC_VIEWER_PRETTIER: %d\n", viewer->prettier_flag); viewer->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(viewer->window), "Viewer"); gtk_window_set_resizable(GTK_WINDOW(viewer->window), TRUE); gtk_window_set_default_size(GTK_WINDOW(viewer->window), 800, 540); GtkWidget *vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(viewer->window), vbox); make_menus(viewer, vbox); viewer->tips = gtk_tooltips_new (); make_toolbar(viewer, vbox); GtkWidget *hpaned = gtk_hpaned_new(); gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); GtkWidget *gl_box = gtk_event_box_new(); gtk_paned_pack1(GTK_PANED(hpaned), gl_box, TRUE, TRUE); GtkWidget *controls_align = gtk_alignment_new(.5, .5, 1, 1); gtk_paned_pack2(GTK_PANED(hpaned), controls_align, FALSE, TRUE); gtk_paned_set_position(GTK_PANED(hpaned), 560); GtkWidget *controls_scroll = gtk_scrolled_window_new(NULL, NULL); gtk_container_add(GTK_CONTAINER(controls_align), controls_scroll); GtkWidget *controls_view = gtk_viewport_new(NULL, NULL); gtk_container_add(GTK_CONTAINER(controls_scroll), controls_view); viewer->controls_box = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(controls_view), viewer->controls_box); viewer->status_bar = gtk_statusbar_new(); gtk_box_pack_start(GTK_BOX(vbox), viewer->status_bar, FALSE, FALSE, 0); viewer_set_status_bar_message(viewer, "Ready"); // create the aspect area to maintain a 1:1 aspect ratio viewer->gl_area = GTKU_GL_DRAWING_AREA (gtku_gl_drawing_area_new (FALSE)); gtk_widget_set_events (GTK_WIDGET (viewer->gl_area), GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK); gtk_container_add (GTK_CONTAINER (gl_box), GTK_WIDGET (viewer->gl_area)); gtk_widget_show (GTK_WIDGET (viewer->gl_area)); g_signal_connect (G_OBJECT (viewer->gl_area), "configure-event", G_CALLBACK (on_gl_configure), viewer); g_signal_connect (G_OBJECT (viewer->gl_area), "expose-event", G_CALLBACK (on_gl_expose), viewer); g_signal_connect (G_OBJECT (viewer->gl_area), "button-press-event", G_CALLBACK (on_button_press), viewer); g_signal_connect (G_OBJECT (viewer->gl_area), "button-release-event", G_CALLBACK (on_button_release), viewer); g_signal_connect (G_OBJECT (viewer->gl_area), "motion-notify-event", G_CALLBACK (on_motion_notify), viewer); g_signal_connect (G_OBJECT (viewer->gl_area), "scroll-event", G_CALLBACK (on_scroll_notify), viewer); g_signal_connect (G_OBJECT (viewer->window), "key_press_event", G_CALLBACK (on_main_window_key_press_event), viewer); g_signal_connect (G_OBJECT (viewer->window), "delete_event", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect (G_OBJECT (viewer->window), "delete_event", G_CALLBACK (gtk_widget_hide_on_delete), NULL); g_signal_connect (G_OBJECT (viewer->window), "destroy_event", G_CALLBACK(gtk_main_quit), NULL); //////////////////////////////////////////////////////////////////// // Create plugins menu // plugins will be inserted here as add_plugin is called gtk_widget_show_all(viewer->window); DefaultViewHandler *dvh = default_view_handler_new(viewer); viewer->default_view_handler = &dvh->vhandler; viewer_request_redraw(viewer); }
static void on_param_changed( GtkuParamWidget *pw, const char *name, void *user_data ) { RendererVelodyne *self = (RendererVelodyne*) user_data; viewer_request_redraw( self->viewer ); }
static void on_clear_button(GtkWidget *button, RendererCar *self) { gu_ptr_circular_clear(self->path); viewer_request_redraw(self->viewer); }