mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
menus, double-clicks hooked up properly
This commit is contained in:
parent
e62394bbe5
commit
b902d7d1c1
@ -339,7 +339,8 @@ set_drag_mode(GtkStatsGraph::DragMode drag_mode) {
|
||||
// window, or any nested window.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
gboolean GtkStatsGraph::
|
||||
handle_button_press(GtkWidget *widget, int graph_x, int graph_y) {
|
||||
handle_button_press(GtkWidget *widget, int graph_x, int graph_y,
|
||||
bool double_click) {
|
||||
if (_potential_drag_mode != DM_none) {
|
||||
set_drag_mode(_potential_drag_mode);
|
||||
_drag_start_x = graph_x;
|
||||
@ -497,7 +498,9 @@ button_press_event_callback(GtkWidget *widget, GdkEventButton *event,
|
||||
(int)event->x, (int)event->y,
|
||||
&graph_x, &graph_y);
|
||||
|
||||
return self->handle_button_press(widget, graph_x, graph_y);
|
||||
bool double_click = (event->type == GDK_2BUTTON_PRESS);
|
||||
|
||||
return self->handle_button_press(widget, graph_x, graph_y, double_click);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -70,7 +70,8 @@ protected:
|
||||
virtual DragMode consider_drag_start(int graph_x, int graph_y);
|
||||
virtual void set_drag_mode(DragMode drag_mode);
|
||||
|
||||
virtual gboolean handle_button_press(GtkWidget *widget, int graph_x, int graph_y);
|
||||
virtual gboolean handle_button_press(GtkWidget *widget, int graph_x, int graph_y,
|
||||
bool double_click);
|
||||
virtual gboolean handle_button_release(GtkWidget *widget, int graph_x, int graph_y);
|
||||
virtual gboolean handle_motion(GtkWidget *widget, int graph_x, int graph_y);
|
||||
|
||||
|
@ -229,5 +229,10 @@ leave_notify_event_callback(GtkWidget *widget, GdkEventCrossing *event,
|
||||
gboolean GtkStatsLabel::
|
||||
button_press_event_callback(GtkWidget *widget, GdkEventButton *event,
|
||||
gpointer data) {
|
||||
GtkStatsLabel *self = (GtkStatsLabel *)data;
|
||||
bool double_click = (event->type == GDK_2BUTTON_PRESS);
|
||||
if (double_click) {
|
||||
self->_graph->clicked_label(self->_collector_index);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -525,15 +525,20 @@ create_window() {
|
||||
|
||||
// Pack the menu into the window.
|
||||
GtkWidget *main_vbox = gtk_vbox_new(FALSE, 1);
|
||||
// gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1);
|
||||
gtk_container_add(GTK_CONTAINER(_window), main_vbox);
|
||||
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
|
||||
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(_item_factory, "/Speed/3")),
|
||||
TRUE);
|
||||
set_scroll_speed(3);
|
||||
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(_item_factory, "/Options/Units/ms")),
|
||||
TRUE);
|
||||
set_time_units(PStatGraph::GBU_ms);
|
||||
|
||||
gtk_widget_show_all(_window);
|
||||
gtk_widget_show(_window);
|
||||
|
||||
set_time_units(PStatGraph::GBU_ms);
|
||||
set_scroll_speed(3);
|
||||
set_pause(false);
|
||||
}
|
||||
|
||||
|
@ -169,16 +169,7 @@ set_time_units(int unit_mask) {
|
||||
unit_mask |= (old_unit_mask & GBU_show_units);
|
||||
set_guide_bar_units(unit_mask);
|
||||
|
||||
/*
|
||||
RECT rect;
|
||||
GetClientRect(_window, &rect);
|
||||
rect.left = _right_margin;
|
||||
InvalidateRect(_window, &rect, TRUE);
|
||||
|
||||
GetClientRect(_window, &rect);
|
||||
rect.bottom = _top_margin;
|
||||
InvalidateRect(_window, &rect, TRUE);
|
||||
*/
|
||||
gtk_widget_queue_draw(_scale_area);
|
||||
}
|
||||
}
|
||||
|
||||
@ -461,7 +452,15 @@ set_drag_mode(GtkStatsGraph::DragMode drag_mode) {
|
||||
// graph window.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
gboolean GtkStatsStripChart::
|
||||
handle_button_press(GtkWidget *widget, int graph_x, int graph_y) {
|
||||
handle_button_press(GtkWidget *widget, int graph_x, int graph_y,
|
||||
bool double_click) {
|
||||
if (double_click) {
|
||||
// Double-clicking on a color bar in the graph is the same as
|
||||
// double-clicking on the corresponding label.
|
||||
clicked_label(get_collector_under_pixel(graph_x, graph_y));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (_potential_drag_mode == DM_none) {
|
||||
set_drag_mode(DM_scale);
|
||||
_drag_scale_start = pixel_to_height(graph_y);
|
||||
@ -475,7 +474,8 @@ handle_button_press(GtkWidget *widget, int graph_x, int graph_y) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return GtkStatsGraph::handle_button_press(widget, graph_x, graph_y);
|
||||
return GtkStatsGraph::handle_button_press(widget, graph_x, graph_y,
|
||||
double_click);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
@ -64,7 +64,8 @@ protected:
|
||||
virtual DragMode consider_drag_start(int graph_x, int graph_y);
|
||||
virtual void set_drag_mode(DragMode drag_mode);
|
||||
|
||||
virtual gboolean handle_button_press(GtkWidget *widget, int graph_x, int graph_y);
|
||||
virtual gboolean handle_button_press(GtkWidget *widget, int graph_x, int graph_y,
|
||||
bool double_click);
|
||||
virtual gboolean handle_button_release(GtkWidget *widget, int graph_x, int graph_y);
|
||||
virtual gboolean handle_motion(GtkWidget *widget, int graph_x, int graph_y);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user