git-svn-id: http://ltt.polymtl.ca/svn@250 04897980-b3bd-0310-b5e0-8ef037075253
authoryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 26 Sep 2003 16:52:08 +0000 (16:52 +0000)
committeryangxx <yangxx@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 26 Sep 2003 16:52:08 +0000 (16:52 +0000)
ltt/branches/poly/lttv/modules/gui/mainWin/src/Makefile.am
ltt/branches/poly/lttv/modules/gui/mainWin/src/callbacks.c
ltt/branches/poly/lttv/modules/gui/mainWin/src/gtkcustom.c

index 71788097633039e27be62ec5668993706ce78ea9..a0af4c7b1af78ff9836804e97785003fe4578d4f 100644 (file)
@@ -1,5 +1,10 @@
 ## Process this file with automake to produce Makefile.in
 
+AM_CFLAGS = $(GLIB_CFLAGS) 
+AM_CFLAGS += $(GTK_CFLAGS)
+LIBS += $(GLIB_LIBS)
+LIBS += $(GTK_LIBS) -L../../API -lmainWinApi
+
 INCLUDES = \
        -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
        -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
index b766fb0800ab0464755f701bba48b7bed69bb39e..7bb71562cb358d74c02c67adb973e4959ca293ca 100644 (file)
@@ -11,6 +11,7 @@
 #include <lttv/mainWindow.h>
 #include <lttv/menu.h>
 #include <lttv/toolbar.h>
+#include <lttv/gtkTraceSet.h>
 
 extern systemView * gSysView;
 extern LttvTracesetContext * gTracesetContext;
@@ -386,16 +387,6 @@ on_tab_activate                        (GtkMenuItem     *menuitem,
   if(!tmpTab){
     mwData->CurrentTab = NULL;
     tmpTab = g_new(tab,1);
-    tmpTab->traceStartTime.tv_sec  = 0;
-    tmpTab->traceStartTime.tv_nsec = 0;
-    tmpTab->traceEndTime.tv_sec    = G_MAXULONG;
-    tmpTab->traceEndTime.tv_nsec   = G_MAXULONG;
-    tmpTab->startTime.tv_sec       = 0;
-    tmpTab->startTime.tv_nsec      = 0;
-    tmpTab->endTime.tv_sec         = G_MAXULONG;
-    tmpTab->endTime.tv_nsec        = G_MAXULONG;
-    tmpTab->currentTime.tv_sec     = 0;
-    tmpTab->currentTime.tv_nsec    = 0;
     mwData->Tab = tmpTab;    
   }else{
     tmpTab->Next = g_new(tab,1);
@@ -407,10 +398,16 @@ on_tab_activate                        (GtkMenuItem     *menuitem,
     tmpTab->startTime      = mwData->CurrentTab->startTime;
     tmpTab->endTime        = mwData->CurrentTab->endTime;
     tmpTab->currentTime    = mwData->CurrentTab->currentTime;
+  }else{
+    getTracesetTimeSpan(mwData,&tmpTab->traceStartTime, &tmpTab->traceEndTime);
+    tmpTab->startTime   = tmpTab->traceStartTime;
+    tmpTab->endTime     = tmpTab->traceEndTime;
+    tmpTab->currentTime = tmpTab->traceStartTime;
   }
   tmpTab->Attributes = LTTV_IATTRIBUTE(g_object_new(LTTV_ATTRIBUTE_TYPE, NULL));
   //  mwData->CurrentTab = tmpTab;
   tmpTab->custom = (GtkCustom*)gtk_custom_new();
+  tmpTab->custom->mw = mwData;
   gtk_widget_show((GtkWidget*)tmpTab->custom);
   tmpTab->Next = NULL;    
 
index 52249288fb3dddcd8f1584f5e6d17a4221a1d177..385d715f9f9405674c4acfdac038c2baa1a56141 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <lttv/gtkcustom.h>
 //#include "gtkintl.h"
+#include <lttv/gtkTraceSet.h>
 
 static void gtk_custom_class_init (GtkCustomClass    *klass);
 static void gtk_custom_init       (GtkCustom         *custom);
@@ -12,6 +13,8 @@ static void     gtk_custom_size_request   (GtkWidget      *widget,
 static void     gtk_custom_size_allocate  (GtkWidget      *widget,
                                           GtkAllocation  *allocation);
 
+void gtk_custom_scroll_value_changed (GtkRange *range, gpointer custom);
+
 GType
 gtk_custom_get_type (void)
 {
@@ -102,6 +105,9 @@ void gtk_custom_widget_add(GtkCustom * custom, GtkWidget * widget1)
 {
   GtkPaned * tmpPane; 
   GtkWidget * w;
+  TimeInterval timeInterval;
+  LttTime      time;
+  double       tmpValue;
 
   g_return_if_fail(GTK_IS_CUSTOM(custom));
   g_object_ref(G_OBJECT(widget1));
@@ -113,7 +119,31 @@ void gtk_custom_widget_add(GtkCustom * custom, GtkWidget * widget1)
 
     custom->hScrollbar = gtk_hscrollbar_new (NULL);
     gtk_widget_show(custom->hScrollbar);
-    
+
+    custom->hAdjust = gtk_range_get_adjustment(GTK_RANGE(custom->hScrollbar));
+    GetTimeInterval(custom->mw,&timeInterval);
+    GetCurrentTime(custom->mw,&time);
+
+    tmpValue               = timeInterval.startTime.tv_sec;
+    tmpValue              *= NANSECOND_CONST;
+    tmpValue              += timeInterval.startTime.tv_nsec;
+    custom->hAdjust->lower = tmpValue;
+    tmpValue               = timeInterval.endTime.tv_sec;
+    tmpValue              *= NANSECOND_CONST;
+    tmpValue              += timeInterval.endTime.tv_nsec;
+    custom->hAdjust->upper = tmpValue;
+    tmpValue               = time.tv_sec;
+    tmpValue              *= NANSECOND_CONST;
+    tmpValue              += time.tv_nsec;
+    custom->hAdjust->value = tmpValue;
+    custom->hAdjust->step_increment = 1;
+    custom->hAdjust->page_increment = 100000000;
+    custom->hAdjust->page_size = 100000000;
+
+    gtk_range_set_update_policy (GTK_RANGE(custom->hScrollbar), GTK_UPDATE_DISCONTINUOUS);
+    g_signal_connect(G_OBJECT(custom->hScrollbar), "value-changed",
+                    G_CALLBACK(gtk_custom_scroll_value_changed), custom);
+
     custom->vbox = gtk_vbox_new(FALSE,0);
     gtk_widget_show(custom->vbox);
     
@@ -273,6 +303,17 @@ void gtk_custom_widget_move_down(GtkCustom * custom)
   g_object_unref(G_OBJECT(custom->focusedPane));
 }
 
+void gtk_custom_scroll_value_changed(GtkRange *range, gpointer custom_arg)
+{
+  LttTime time;
+  GtkCustom * custom = (GtkCustom*)custom_arg;
+  gdouble value = gtk_range_get_value(range);
+  time.tv_sec  = value / NANSECOND_CONST;
+  time.tv_nsec = (value / NANSECOND_CONST - time.tv_sec) * NANSECOND_CONST; 
+  SetCurrentTime(custom->mw, &time);
+  g_warning("The current time is second :%d, nanosecond : %d\n", time.tv_sec, time.tv_nsec);
+}
+
 
 static void
 gtk_custom_size_request (GtkWidget      *widget,
This page took 0.027515 seconds and 4 git commands to generate.