- GtkTreePath *path; // = gtk_tree_path_new();
- gint *indices;
- gdouble value;
- ControlFlowData *Control_Flow_Data = (ControlFlowData*)data;
-
- gtk_tree_view_get_cursor(GTK_TREE_VIEW(Control_Flow_Data->Tree_V), &path, NULL);
- if(path == NULL)
- {
- /* No prior cursor, put it at beginning of page and let the execution do */
- path = gtk_tree_path_new_from_indices(0, -1);
- gtk_tree_view_set_cursor(GTK_TREE_VIEW(Control_Flow_Data->Tree_V), path, NULL, FALSE);
- }
-
- indices = gtk_tree_path_get_indices(path);
-
- g_critical("DEBUG : move cursor step : %u , int : %i , indice : %i", (guint)arg1, arg2, indices[0]) ;
-
- value = gtk_adjustment_get_value(Control_Flow_Data->VAdjust_C);
-
- if(arg1 == GTK_MOVEMENT_DISPLAY_LINES)
- {
- /* Move one line */
- if(arg2 == 1)
- {
- /* move one line down */
- if(indices[0] == Control_Flow_Data->Num_Visible_Events - 1)
- {
- if(value + Control_Flow_Data->Num_Visible_Events <=
- Control_Flow_Data->Number_Of_Events -1)
- {
- g_critical("need 1 event down") ;
- Control_Flow_Data->Currently_Selected_Event += 1;
- gtk_adjustment_set_value(Control_Flow_Data->VAdjust_C, value+1);
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(Control_Flow_Data->Num_Visible_Events-1, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(Control_Flow_Data->Tree_V), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- }
- }
- } else {
- /* Move one line up */
- if(indices[0] == 0)
- {
- if(value - 1 >= 0 )
- {
- g_critical("need 1 event up") ;
- Control_Flow_Data->Currently_Selected_Event -= 1;
- gtk_adjustment_set_value(Control_Flow_Data->VAdjust_C, value-1);
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(0, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(Control_Flow_Data->Tree_V), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- }
-
- }
- }
-
- }
-
- if(arg1 == GTK_MOVEMENT_PAGES)
- {
- /* Move one page */
- if(arg2 == 1)
- {
- if(Control_Flow_Data->Num_Visible_Events == 1)
- value += 1 ;
- /* move one page down */
- if(value + Control_Flow_Data->Num_Visible_Events-1 <=
- Control_Flow_Data->Number_Of_Events )
- {
- g_critical("need 1 page down") ;
-
- Control_Flow_Data->Currently_Selected_Event += Control_Flow_Data->Num_Visible_Events-1;
- gtk_adjustment_set_value(Control_Flow_Data->VAdjust_C,
- value+(Control_Flow_Data->Num_Visible_Events-1));
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(0, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(Control_Flow_Data->Tree_V), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- }
- } else {
- /* Move one page up */
- if(Control_Flow_Data->Num_Visible_Events == 1)
- value -= 1 ;
-
- if(indices[0] < Control_Flow_Data->Num_Visible_Events - 2 )
- {
- if(value - (Control_Flow_Data->Num_Visible_Events-1) >= 0)
- {
- g_critical("need 1 page up") ;
-
- Control_Flow_Data->Currently_Selected_Event -= Control_Flow_Data->Num_Visible_Events-1;
-
- gtk_adjustment_set_value(Control_Flow_Data->VAdjust_C,
- value-(Control_Flow_Data->Num_Visible_Events-1));
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(0, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(Control_Flow_Data->Tree_V), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
-
- } else {
- /* Go to first Event */
- g_critical("need 1 page up") ;
-
- Control_Flow_Data->Currently_Selected_Event == 0 ;
- gtk_adjustment_set_value(Control_Flow_Data->VAdjust_C,
- 0);
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(0, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(Control_Flow_Data->Tree_V), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
-
- }
- }
-
- }
-
- }
-
- if(arg1 == GTK_MOVEMENT_BUFFER_ENDS)
- {
- /* Move to the ends of the buffer */
- if(arg2 == 1)
- {
- /* move end of buffer */
- g_critical("End of buffer") ;
- Control_Flow_Data->Currently_Selected_Event = Control_Flow_Data->Number_Of_Events-1 ;
- gtk_adjustment_set_value(Control_Flow_Data->VAdjust_C,
- Control_Flow_Data->Number_Of_Events -
- Control_Flow_Data->Num_Visible_Events);
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(Control_Flow_Data->Num_Visible_Events-1, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(Control_Flow_Data->Tree_V), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- } else {
- /* Move beginning of buffer */
- g_critical("Beginning of buffer") ;
- Control_Flow_Data->Currently_Selected_Event = 0 ;
- gtk_adjustment_set_value(Control_Flow_Data->VAdjust_C, 0);
- //gtk_tree_path_free(path);
- //path = gtk_tree_path_new_from_indices(0, -1);
- //gtk_tree_view_set_cursor(GTK_TREE_VIEW(Control_Flow_Data->Tree_V), path, NULL, FALSE);
- g_signal_stop_emission_by_name(G_OBJECT(widget), "move-cursor");
- }
-
- }
-