struct _MainWindow{
GtkWidget* mwindow; /* Main Window */
+ int window_width;
/* Status bar information */
// guint MainSBarContextID; /* Context ID of main status bar */
GtkWidget * viewer;
LttvTracesetSelector * s;
TimeInterval * time_interval;
- TimeWindow time_window;
+ TimeWindow time_window, t;
mw_data = get_window_data_struct(widget);
if(!mw_data->current_tab) return;
time_window = mw_data->current_tab->time_window;
time_interval = (TimeInterval*)g_object_get_data(G_OBJECT(viewer), TRACESET_TIME_SPAN);
if(time_interval){
+ t = time_window;
time_window.start_time = time_interval->startTime;
time_window.time_width = ltt_time_sub(time_interval->endTime,time_interval->startTime);
}
redraw_viewer(mw_data,&time_window);
set_current_time(mw_data,&(mw_data->current_tab->current_time));
+ if(time_interval){
+ set_time_window(mw_data,&t);
+ }
}
}
gtk_main_quit ();
}
+gboolean
+on_MWindow_configure (GtkWidget *widget,
+ GdkEventConfigure *event,
+ gpointer user_data)
+{
+ MainWindow * mw_data = get_window_data_struct((GtkWidget*)widget);
+ float width = event->width;
+ Tab * tab = mw_data->tab;
+ TimeWindow time_win;
+ double ratio;
+ TimeInterval *time_span;
+ LttTime time;
+
+ while(tab){
+ if(mw_data->window_width){
+ time_span = LTTV_TRACESET_CONTEXT(tab->traceset_info->traceset_context)->Time_Span ;
+ time_win = tab->time_window;
+ ratio = width / mw_data->window_width;
+ tab->time_window.time_width = ltt_time_mul(time_win.time_width,ratio);
+ time = ltt_time_sub(time_span->endTime, time_win.start_time);
+ if(ltt_time_compare(time, tab->time_window.time_width) < 0){
+ tab->time_window.time_width = time;
+ }
+ }
+ tab = tab->next;
+ }
+
+ mw_data->window_width = (int)width;
+ return FALSE;
+}
void
on_MNotebook_switch_page (GtkNotebook *notebook,
on_MWindow_destroy (GtkObject *object,
gpointer user_data);
+gboolean
+on_MWindow_configure (GtkWidget *widget,
+ GdkEventConfigure *event,
+ gpointer user_data);
void
on_insert_viewer_test_activate (GtkMenuItem *menuitem,
void gtk_multi_vpaned_scroll_value_changed(GtkRange *range, gpointer multi_vpaned_arg)
{
+ TimeWindow time_window;
+ TimeInterval *time_span;
LttTime time;
GtkMultiVPaned * multi_vpaned = (GtkMultiVPaned*)multi_vpaned_arg;
gdouble value = gtk_range_get_value(range);
- time = ltt_time_from_double(value / NANOSECONDS_PER_SECOND);
- set_current_time(multi_vpaned->mw, &time);
- g_warning("The current time is second :%d, nanosecond : %d\n", time.tv_sec, time.tv_nsec);
+ gdouble upper, lower, ratio;
+
+ time_window = multi_vpaned->mw->current_tab->time_window;
+
+ time_span = LTTV_TRACESET_CONTEXT(multi_vpaned->mw->current_tab->traceset_info->
+ traceset_context)->Time_Span ;
+ lower = multi_vpaned->hadjust->lower;
+ upper = multi_vpaned->hadjust->upper;
+ ratio = (value - lower) / (upper - lower);
+
+ time = ltt_time_sub(time_span->endTime, time_span->startTime);
+ time = ltt_time_mul(time, (float)ratio);
+ time = ltt_time_add(time_span->startTime, time);
+
+ time_window.start_time = time;
+
+ time = ltt_time_sub(time_span->endTime, time);
+ if(ltt_time_compare(time,time_window.time_width) < 0){
+ time_window.time_width = time;
+ }
+ set_time_window(multi_vpaned->mw, &time_window);
}
g_signal_connect ((gpointer) MWindow, "destroy",
G_CALLBACK (on_MWindow_destroy),
NULL);
+ g_signal_connect ((gpointer) MWindow, "configure-event",
+ G_CALLBACK (on_MWindow_configure),
+ NULL);
// g_signal_connect ((gpointer) EmptyTraceset, "activate",
// G_CALLBACK (on_empty_traceset_activate),
// NULL);