typo fix == for =
[lttv.git] / ltt / branches / poly / lttv / modules / guiControlFlow / Event_Hooks.c
1 /*****************************************************************************
2 * Hooks to be called by the main window *
3 *****************************************************************************/
4
5
6 #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
7 #define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
8
9 //#define PANGO_ENABLE_BACKEND
10 #include <gtk/gtk.h>
11 #include <gdk/gdk.h>
12 #include <glib.h>
13 #include <assert.h>
14
15 //#include <pango/pango.h>
16
17 #include <ltt/event.h>
18 #include <ltt/time.h>
19
20 #include <lttv/hook.h>
21 #include <lttv/common.h>
22 #include <lttv/state.h>
23
24
25 #include "Event_Hooks.h"
26 #include "CFV.h"
27 #include "Process_List.h"
28 #include "Drawing.h"
29 #include "CFV-private.h"
30
31
32 #define MAX_PATH_LEN 256
33
34 //FIXME : remove this include when tests finished.
35 #include <string.h>
36
37 void test_draw_item(Drawing_t *Drawing,
38 GdkPixmap *Pixmap)
39 {
40 PropertiesIcon properties_icon;
41 DrawContext draw_context;
42
43 DrawInfo current, previous;
44 ItemInfo over, middle, under, modify_over, modify_middle, modify_under;
45
46 int i=0,j=0;
47
48 //for(i=0; i<1024;i=i+15)
49 {
50 // for(j=0;j<768;j=j+15)
51 {
52 over.x = i;
53 over.y = j;
54
55 current.modify_over = &over;
56
57 draw_context.drawable = Pixmap;
58 draw_context.gc = Drawing->Drawing_Area_V->style->black_gc;
59
60 draw_context.Current = &current;
61 draw_context.Previous = NULL;
62
63 properties_icon.icon_name = g_new(char, MAX_PATH_LEN);
64 strncpy(properties_icon.icon_name,
65 "/home/compudj/local/share/LinuxTraceToolkit/pixmaps/mini-display.xpm",
66 MAX_PATH_LEN);
67 properties_icon.width = -1;
68 properties_icon.height = -1;
69 properties_icon.position = OVER;
70 draw_icon(&properties_icon, &draw_context);
71 g_free(properties_icon.icon_name);
72 }
73 }
74
75 }
76
77 #ifdef NOTUSE
78 /* NOTE : no drawing data should be sent there, since the drawing widget
79 * has not been initialized */
80 void send_test_drawing(ProcessList *Process_List,
81 Drawing_t *Drawing,
82 GdkPixmap *Pixmap,
83 gint x, gint y, // y not used here?
84 gint width,
85 gint height) // height won't be used here ?
86 {
87 int i,j;
88 ProcessInfo Process_Info = {10000, 12000, 55600};
89 //ProcessInfo Process_Info = {156, 14000, 55500};
90 GtkTreeRowReference *got_RowRef;
91 PangoContext *context;
92 PangoLayout *layout;
93 PangoFontDescription *FontDesc;// = pango_font_description_new();
94 gint Font_Size;
95
96 //icon
97 //GdkBitmap *mask = g_new(GdkBitmap, 1);
98 //GdkPixmap *icon_pixmap = g_new(GdkPixmap, 1);
99 GdkGC * gc;
100 // rectangle
101 GdkColor color = { 0, 0xffff, 0x0000, 0x0000 };
102
103 gc = gdk_gc_new(Pixmap);
104 /* Sent text data */
105 layout = gtk_widget_create_pango_layout(Drawing->Drawing_Area_V,
106 NULL);
107 context = pango_layout_get_context(layout);
108 FontDesc = pango_context_get_font_description(context);
109 Font_Size = pango_font_description_get_size(FontDesc);
110 pango_font_description_set_size(FontDesc, Font_Size-3*PANGO_SCALE);
111
112
113
114
115 LttTime birth;
116 birth.tv_sec = 12000;
117 birth.tv_nsec = 55500;
118 g_info("we have : x : %u, y : %u, width : %u, height : %u", x, y, width, height);
119 processlist_get_process_pixels(Process_List,
120 1,
121 &birth,
122 &y,
123 &height);
124
125 g_info("we draw : x : %u, y : %u, width : %u, height : %u", x, y, width, height);
126 drawing_draw_line(
127 Drawing, Pixmap, x,
128 y+(height/2), x + width, y+(height/2),
129 Drawing->Drawing_Area_V->style->black_gc);
130
131 pango_layout_set_text(layout, "Test", -1);
132 gdk_draw_layout(Pixmap, Drawing->Drawing_Area_V->style->black_gc,
133 0, y+height, layout);
134
135 birth.tv_sec = 14000;
136 birth.tv_nsec = 55500;
137
138 processlist_get_process_pixels(Process_List,
139 156,
140 &birth,
141 &y,
142 &height);
143
144
145 drawing_draw_line(
146 Drawing, Pixmap, x,
147 y+(height/2), x + width, y+(height/2),
148 Drawing->Drawing_Area_V->style->black_gc);
149
150 g_info("y : %u, height : %u", y, height);
151
152
153
154 birth.tv_sec = 12000;
155 birth.tv_nsec = 55700;
156
157 processlist_get_process_pixels(Process_List,
158 10,
159 &birth,
160 &y,
161 &height);
162
163 /* Draw rectangle (background color) */
164 gdk_gc_copy(gc, Drawing->Drawing_Area_V->style->black_gc);
165 gdk_gc_set_rgb_fg_color(gc, &color);
166 gdk_draw_rectangle(Pixmap, gc,
167 TRUE,
168 x, y, width, height);
169
170 drawing_draw_line(
171 Drawing, Pixmap, x,
172 y+(height/2), x + width, y+(height/2),
173 Drawing->Drawing_Area_V->style->black_gc);
174
175
176 /* Draw arc */
177 gdk_draw_arc(Pixmap, Drawing->Drawing_Area_V->style->black_gc,
178 TRUE, 100, y, height/2, height/2, 0, 360*64);
179
180 g_info("y : %u, height : %u", y, height);
181
182 for(i=0; i<10; i++)
183 {
184 birth.tv_sec = i*12000;
185 birth.tv_nsec = i*55700;
186
187 processlist_get_process_pixels(Process_List,
188 i,
189 &birth,
190 &y,
191 &height);
192
193
194 drawing_draw_line(
195 Drawing, Pixmap, x,
196 y+(height/2), x + width, y+(height/2),
197 Drawing->Drawing_Area_V->style->black_gc);
198
199 g_critical("y : %u, height : %u", y, height);
200
201 }
202
203 birth.tv_sec = 12000;
204 birth.tv_nsec = 55600;
205
206 processlist_get_process_pixels(Process_List,
207 10,
208 &birth,
209 &y,
210 &height);
211
212
213 drawing_draw_line(
214 Drawing, Pixmap, x,
215 y+(height/2), x + width, y+(height/2),
216 Drawing->Drawing_Area_V->style->black_gc);
217
218 g_info("y : %u, height : %u", y, height);
219
220
221 /* IMPORTANT : This action uses the cpu heavily! */
222 //icon_pixmap = gdk_pixmap_create_from_xpm(Pixmap, &mask, NULL,
223 // "/home/compudj/local/share/LinuxTraceToolkit/pixmaps/move_message.xpm");
224 // "/home/compudj/local/share/LinuxTraceToolkit/pixmaps/mini-display.xpm");
225
226 // gdk_gc_set_clip_mask(Drawing->Drawing_Area_V->style->black_gc, mask);
227
228 // for(i=x;i<x+width;i=i+15)
229 // {
230 // for(j=0;j<height*20;j=j+15)
231 // {
232
233 /* Draw icon */
234 //gdk_gc_copy(gc, Drawing->Drawing_Area_V->style->black_gc);
235 // gdk_gc_set_clip_origin(Drawing->Drawing_Area_V->style->black_gc, i, j);
236 // gdk_draw_drawable(Pixmap,
237 // Drawing->Drawing_Area_V->style->black_gc,
238 // icon_pixmap,
239 // 0, 0, i, j, -1, -1);
240
241 // }
242 // }
243
244 test_draw_item(Drawing,Pixmap);
245
246 //gdk_gc_set_clip_origin(Drawing->Drawing_Area_V->style->black_gc, 0, 0);
247 //gdk_gc_set_clip_mask(Drawing->Drawing_Area_V->style->black_gc, NULL);
248
249 //g_free(icon_pixmap);
250 //g_free(mask);
251
252
253
254
255
256
257 pango_font_description_set_size(FontDesc, Font_Size);
258 g_object_unref(layout);
259 g_free(gc);
260 }
261
262 void send_test_process(ProcessList *Process_List, Drawing_t *Drawing)
263 {
264 guint height, y;
265 int i;
266 ProcessInfo Process_Info = {10000, 12000, 55600};
267 //ProcessInfo Process_Info = {156, 14000, 55500};
268 GtkTreeRowReference *got_RowRef;
269
270 LttTime birth;
271
272 if(Process_List->Test_Process_Sent) return;
273
274 birth.tv_sec = 12000;
275 birth.tv_nsec = 55500;
276
277 processlist_add(Process_List,
278 1,
279 &birth,
280 &y);
281 processlist_get_process_pixels(Process_List,
282 1,
283 &birth,
284 &y,
285 &height);
286 drawing_insert_square( Drawing, y, height);
287
288 //g_critical("y : %u, height : %u", y, height);
289
290 birth.tv_sec = 14000;
291 birth.tv_nsec = 55500;
292
293 processlist_add(Process_List,
294 156,
295 &birth,
296 &y);
297 processlist_get_process_pixels(Process_List,
298 156,
299 &birth,
300 &y,
301 &height);
302 drawing_insert_square( Drawing, y, height);
303
304 //g_critical("y : %u, height : %u", y, height);
305
306 birth.tv_sec = 12000;
307 birth.tv_nsec = 55700;
308
309 processlist_add(Process_List,
310 10,
311 &birth,
312 &height);
313 processlist_get_process_pixels(Process_List,
314 10,
315 &birth,
316 &y,
317 &height);
318 drawing_insert_square( Drawing, y, height);
319
320 //g_critical("y : %u, height : %u", y, height);
321
322 //drawing_insert_square( Drawing, height, 5);
323
324 for(i=0; i<10; i++)
325 {
326 birth.tv_sec = i*12000;
327 birth.tv_nsec = i*55700;
328
329 processlist_add(Process_List,
330 i,
331 &birth,
332 &height);
333 processlist_get_process_pixels(Process_List,
334 i,
335 &birth,
336 &y,
337 &height);
338 drawing_insert_square( Drawing, y, height);
339
340 // g_critical("y : %u, height : %u", y, height);
341
342 }
343 //g_critical("height : %u", height);
344
345 birth.tv_sec = 12000;
346 birth.tv_nsec = 55600;
347
348 processlist_add(Process_List,
349 10,
350 &birth,
351 &y);
352 processlist_get_process_pixels(Process_List,
353 10,
354 &birth,
355 &y,
356 &height);
357 drawing_insert_square( Drawing, y, height);
358
359 //g_critical("y : %u, height : %u", y, height);
360
361 processlist_add(Process_List,
362 10000,
363 &birth,
364 &height);
365 processlist_get_process_pixels(Process_List,
366 10000,
367 &birth,
368 &y,
369 &height);
370 drawing_insert_square( Drawing, y, height);
371
372 //g_critical("y : %u, height : %u", y, height);
373
374 //drawing_insert_square( Drawing, height, 5);
375 //g_critical("height : %u", height);
376
377
378 processlist_get_process_pixels(Process_List,
379 10000,
380 &birth,
381 &y, &height);
382 processlist_remove( Process_List,
383 10000,
384 &birth);
385
386 drawing_remove_square( Drawing, y, height);
387
388 if(got_RowRef =
389 (GtkTreeRowReference*)g_hash_table_lookup(
390 Process_List->Process_Hash,
391 &Process_Info))
392 {
393 g_critical("key found");
394 g_critical("position in the list : %s",
395 gtk_tree_path_to_string (
396 gtk_tree_row_reference_get_path(
397 (GtkTreeRowReference*)got_RowRef)
398 ));
399
400 }
401
402 Process_List->Test_Process_Sent = TRUE;
403
404 }
405 #endif//NOTUSE
406
407
408 /**
409 * Event Viewer's constructor hook
410 *
411 * This constructor is given as a parameter to the menuitem and toolbar button
412 * registration. It creates the list.
413 * @param pmParentWindow A pointer to the parent window.
414 * @return The widget created.
415 */
416 GtkWidget *
417 h_guicontrolflow(MainWindow *pmParentWindow, LttvTracesetSelector * s, char * key)
418 {
419 g_info("h_guicontrolflow, %p, %p, %s", pmParentWindow, s, key);
420 ControlFlowData *Control_Flow_Data = guicontrolflow() ;
421
422 Control_Flow_Data->Parent_Window = pmParentWindow;
423 TimeWindow *time_window = guicontrolflow_get_time_window(Control_Flow_Data);
424 time_window->start_time.tv_sec = 0;
425 time_window->start_time.tv_nsec = 0;
426 time_window->time_width.tv_sec = 0;
427 time_window->time_width.tv_nsec = 0;
428
429 LttTime *current_time = guicontrolflow_get_current_time(Control_Flow_Data);
430 current_time->tv_sec = 0;
431 current_time->tv_nsec = 0;
432
433 //g_critical("time width1 : %u",time_window->time_width);
434
435 get_time_window(pmParentWindow,
436 time_window);
437 get_current_time(pmParentWindow,
438 current_time);
439
440 //g_critical("time width2 : %u",time_window->time_width);
441 // Unreg done in the GuiControlFlow_Destructor
442 reg_update_time_window(update_time_window_hook, Control_Flow_Data,
443 pmParentWindow);
444 reg_update_current_time(update_current_time_hook, Control_Flow_Data,
445 pmParentWindow);
446 return guicontrolflow_get_widget(Control_Flow_Data) ;
447
448 }
449
450 int event_selected_hook(void *hook_data, void *call_data)
451 {
452 ControlFlowData *Control_Flow_Data = (ControlFlowData*) hook_data;
453 guint *Event_Number = (guint*) call_data;
454
455 g_critical("DEBUG : event selected by main window : %u", *Event_Number);
456
457 // Control_Flow_Data->Currently_Selected_Event = *Event_Number;
458 // Control_Flow_Data->Selected_Event = TRUE ;
459
460 // tree_v_set_cursor(Control_Flow_Data);
461
462 }
463
464 /* Hook called before drawing. Gets the initial context at the beginning of the
465 * drawing interval and copy it to the context in Event_Request.
466 */
467 int draw_before_hook(void *hook_data, void *call_data)
468 {
469 EventRequest *Event_Request = (EventRequest*)hook_data;
470 //EventsContext Events_Context = (EventsContext*)call_data;
471
472 //Event_Request->Events_Context = Events_Context;
473
474 return 0;
475 }
476
477 /*
478 * The draw event hook is called by the reading API to have a
479 * particular event drawn on the screen.
480 * @param hook_data ControlFlowData structure of the viewer.
481 * @param call_data Event context.
482 *
483 * This function basically draw lines and icons. Two types of lines are drawn :
484 * one small (3 pixels?) representing the state of the process and the second
485 * type is thicker (10 pixels?) representing on which CPU a process is running
486 * (and this only in running state).
487 *
488 * Extremums of the lines :
489 * x_min : time of the last event context for this process kept in memory.
490 * x_max : time of the current event.
491 * y : middle of the process in the process list. The process is found in the
492 * list, therefore is it's position in pixels.
493 *
494 * The choice of lines'color is defined by the context of the last event for this
495 * process.
496 */
497 int draw_event_hook(void *hook_data, void *call_data)
498 {
499 EventRequest *Event_Request = (EventRequest*)hook_data;
500 ControlFlowData *control_flow_data = Event_Request->Control_Flow_Data;
501 //static int i=0;
502
503 //i++;
504 //g_critical("%i", i);
505 LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
506
507 LttvTracefileState *tfs = (LttvTracefileState *)call_data;
508
509 LttEvent *e;
510 e = tfc->e;
511
512 /* Temp dump */
513 #ifdef DONTSHOW
514 GString *string = g_string_new("");;
515 gboolean field_names = TRUE, state = TRUE;
516
517 lttv_event_to_string(e, tfc->tf, string, TRUE, field_names, tfs);
518 g_string_append_printf(string,"\n");
519
520 if(state) {
521 g_string_append_printf(string, " %s",
522 g_quark_to_string(tfs->process->state->s));
523 }
524
525 g_info("%s",string->str);
526
527 g_string_free(string, TRUE);
528
529 /* End of text dump */
530 #endif //DONTSHOW
531 /* Add process to process list (if not present) and get drawing "y" from
532 * process position */
533 guint pid = tfs->process->pid;
534 LttTime birth = tfs->process->creation_time;
535 gchar *name = strdup("name");
536 guint y = 0, height = 0, pl_height = 0;
537 HashedProcessData *Hashed_Process_Data = NULL;
538
539 ProcessList *process_list =
540 guicontrolflow_get_process_list(Event_Request->Control_Flow_Data);
541
542 if(processlist_get_process_pixels(process_list,
543 pid,
544 &birth,
545 &y,
546 &height,
547 &Hashed_Process_Data) == 1)
548 {
549 /* Process not present */
550 processlist_add(process_list,
551 pid,
552 &birth,
553 name,
554 &pl_height,
555 &Hashed_Process_Data);
556 g_free(name);
557 drawing_insert_square( Event_Request->Control_Flow_Data->Drawing, y, height);
558 }
559
560 /* Find pixels corresponding to time of the event. If the time does
561 * not fit in the window, show a warning, not supposed to happend. */
562 guint x = 0;
563 guint width = control_flow_data->Drawing->Drawing_Area_V->allocation.width;
564
565 LttTime time = ltt_event_time(e);
566
567 LttTime window_end = ltt_time_add(control_flow_data->Time_Window.time_width,
568 control_flow_data->Time_Window.start_time);
569
570
571 convert_time_to_pixels(
572 control_flow_data->Time_Window.start_time,
573 window_end,
574 time,
575 width,
576 &x);
577
578 assert(x <= width);
579
580 /* Finally, draw what represents the event. */
581
582 GdkColor color = { 0, 0xffff, 0x0000, 0x0000 };
583 PropertiesArc prop_arc;
584 prop_arc.color = &color;
585 prop_arc.size = 10;
586 prop_arc.filled = TRUE;
587 prop_arc.position = OVER;
588
589 DrawContext *draw_context = Hashed_Process_Data->draw_context;
590 draw_context->Current->modify_over->x = x;
591 draw_context->Current->modify_over->y = y;
592 draw_context->drawable = control_flow_data->Drawing->Pixmap;
593 draw_context->pango_layout = control_flow_data->Drawing->pango_layout;
594 GtkWidget *widget = control_flow_data->Drawing->Drawing_Area_V;
595 //draw_context->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
596 draw_context->gc = widget->style->black_gc;
597
598 //draw_arc((void*)&prop_arc, (void*)draw_context);
599 //test_draw_item(control_flow_data->Drawing, control_flow_data->Drawing->Pixmap);
600
601 GdkColor colorfg = { 0, 0x0000, 0x0000, 0x0000 };
602 GdkColor colorbg = { 0, 0xffff, 0x0000, 0xffff };
603 PropertiesText prop_text;
604 prop_text.foreground = &colorfg;
605 prop_text.background = &colorbg;
606 prop_text.size = 10;
607 prop_text.position = OVER;
608
609 /* Print status of the process : U, WF, WC, E, W, R */
610 if(tfs->process->state->s == LTTV_STATE_UNNAMED)
611 prop_text.Text = "U";
612 else if(tfs->process->state->s == LTTV_STATE_WAIT_FORK)
613 prop_text.Text = "WF";
614 else if(tfs->process->state->s == LTTV_STATE_WAIT_CPU)
615 prop_text.Text = "WC";
616 else if(tfs->process->state->s == LTTV_STATE_EXIT)
617 prop_text.Text = "E";
618 else if(tfs->process->state->s == LTTV_STATE_WAIT)
619 prop_text.Text = "W";
620 else if(tfs->process->state->s == LTTV_STATE_RUN)
621 prop_text.Text = "R";
622 else
623 prop_text.Text = "U";
624
625 draw_text((void*)&prop_text, (void*)draw_context);
626
627 return 0;
628 }
629
630
631 int draw_after_hook(void *hook_data, void *call_data)
632 {
633 EventRequest *Event_Request = (EventRequest*)hook_data;
634
635 g_free(Event_Request);
636 return 0;
637 }
638
639
640
641
642 void update_time_window_hook(void *hook_data, void *call_data)
643 {
644 ControlFlowData *control_flow_data = (ControlFlowData*) hook_data;
645 TimeWindow *Old_Time_Window =
646 guicontrolflow_get_time_window(control_flow_data);
647 TimeWindow *New_Time_Window = ((TimeWindow*)call_data);
648
649 /* Two cases : zoom in/out or scrolling */
650
651 /* In order to make sure we can reuse the old drawing, the scale must
652 * be the same and the new time interval being partly located in the
653 * currently shown time interval. (reuse is only for scrolling)
654 */
655
656 g_info("Old time window HOOK : %u, %u to %u, %u",
657 Old_Time_Window->start_time.tv_sec,
658 Old_Time_Window->start_time.tv_nsec,
659 Old_Time_Window->time_width.tv_sec,
660 Old_Time_Window->time_width.tv_nsec);
661
662 g_info("New time window HOOK : %u, %u to %u, %u",
663 New_Time_Window->start_time.tv_sec,
664 New_Time_Window->start_time.tv_nsec,
665 New_Time_Window->time_width.tv_sec,
666 New_Time_Window->time_width.tv_nsec);
667
668 if( New_Time_Window->time_width.tv_sec == Old_Time_Window->time_width.tv_sec
669 && New_Time_Window->time_width.tv_nsec == Old_Time_Window->time_width.tv_nsec)
670 {
671 /* Same scale (scrolling) */
672 g_info("scrolling");
673 LttTime *ns = &New_Time_Window->start_time;
674 LttTime *os = &Old_Time_Window->start_time;
675 LttTime old_end = ltt_time_add(Old_Time_Window->start_time,
676 Old_Time_Window->time_width);
677 LttTime new_end = ltt_time_add(New_Time_Window->start_time,
678 New_Time_Window->time_width);
679 //if(ns<os+w<ns+w)
680 //if(ns<os+w && os+w<ns+w)
681 //if(ns<old_end && os<ns)
682 if(ltt_time_compare(*ns, old_end) == -1
683 && ltt_time_compare(*os, *ns) == -1)
684 {
685 g_info("scrolling near right");
686 /* Scroll right, keep right part of the screen */
687 guint x = 0;
688 guint width = control_flow_data->Drawing->Drawing_Area_V->allocation.width;
689 convert_time_to_pixels(
690 *os,
691 old_end,
692 *ns,
693 width,
694 &x);
695
696 /* Copy old data to new location */
697 gdk_draw_drawable (control_flow_data->Drawing->Pixmap,
698 control_flow_data->Drawing->Drawing_Area_V->style->white_gc,
699 control_flow_data->Drawing->Pixmap,
700 x, 0,
701 0, 0,
702 -1, -1);
703
704 convert_time_to_pixels(
705 *ns,
706 new_end,
707 old_end,
708 width,
709 &x);
710
711 *Old_Time_Window = *New_Time_Window;
712 /* Clear the data request background, but not SAFETY */
713 gdk_draw_rectangle (control_flow_data->Drawing->Pixmap,
714 control_flow_data->Drawing->Drawing_Area_V->style->white_gc,
715 TRUE,
716 x+SAFETY, 0,
717 control_flow_data->Drawing->width - x, // do not overlap
718 control_flow_data->Drawing->height+SAFETY);
719 /* Get new data for the rest. */
720 drawing_data_request(control_flow_data->Drawing,
721 &control_flow_data->Drawing->Pixmap,
722 x, 0,
723 control_flow_data->Drawing->width - x,
724 control_flow_data->Drawing->height);
725
726 drawing_refresh(control_flow_data->Drawing,
727 0, 0,
728 control_flow_data->Drawing->width,
729 control_flow_data->Drawing->height);
730
731
732 } else {
733 //if(ns<os<ns+w)
734 //if(ns<os && os<ns+w)
735 //if(ns<os && os<new_end)
736 if(ltt_time_compare(*ns,*os) == -1
737 && ltt_time_compare(*os,new_end) == -1)
738 {
739 g_info("scrolling near left");
740 /* Scroll left, keep left part of the screen */
741 guint x = 0;
742 guint width = control_flow_data->Drawing->Drawing_Area_V->allocation.width;
743 convert_time_to_pixels(
744 *ns,
745 new_end,
746 *os,
747 width,
748 &x);
749
750 /* Copy old data to new location */
751 gdk_draw_drawable (control_flow_data->Drawing->Pixmap,
752 control_flow_data->Drawing->Drawing_Area_V->style->white_gc,
753 control_flow_data->Drawing->Pixmap,
754 0, 0,
755 x, 0,
756 -1, -1);
757
758 *Old_Time_Window = *New_Time_Window;
759
760 /* Clean the data request background */
761 gdk_draw_rectangle (control_flow_data->Drawing->Pixmap,
762 control_flow_data->Drawing->Drawing_Area_V->style->white_gc,
763 TRUE,
764 0, 0,
765 x, // do not overlap
766 control_flow_data->Drawing->height+SAFETY);
767 /* Get new data for the rest. */
768 drawing_data_request(control_flow_data->Drawing,
769 &control_flow_data->Drawing->Pixmap,
770 0, 0,
771 x,
772 control_flow_data->Drawing->height);
773
774 drawing_refresh(control_flow_data->Drawing,
775 0, 0,
776 control_flow_data->Drawing->width,
777 control_flow_data->Drawing->height);
778
779 } else {
780 g_info("scrolling far");
781 /* Cannot reuse any part of the screen : far jump */
782 *Old_Time_Window = *New_Time_Window;
783
784
785 gdk_draw_rectangle (control_flow_data->Drawing->Pixmap,
786 control_flow_data->Drawing->Drawing_Area_V->style->white_gc,
787 TRUE,
788 0, 0,
789 control_flow_data->Drawing->width+SAFETY, // do not overlap
790 control_flow_data->Drawing->height+SAFETY);
791
792 drawing_data_request(control_flow_data->Drawing,
793 &control_flow_data->Drawing->Pixmap,
794 0, 0,
795 control_flow_data->Drawing->width,
796 control_flow_data->Drawing->height);
797
798 drawing_refresh(control_flow_data->Drawing,
799 0, 0,
800 control_flow_data->Drawing->width,
801 control_flow_data->Drawing->height);
802 }
803 }
804 } else {
805 /* Different scale (zoom) */
806 g_info("zoom");
807
808 *Old_Time_Window = *New_Time_Window;
809
810 gdk_draw_rectangle (control_flow_data->Drawing->Pixmap,
811 control_flow_data->Drawing->Drawing_Area_V->style->white_gc,
812 TRUE,
813 0, 0,
814 control_flow_data->Drawing->width+SAFETY, // do not overlap
815 control_flow_data->Drawing->height+SAFETY);
816
817
818 drawing_data_request(control_flow_data->Drawing,
819 &control_flow_data->Drawing->Pixmap,
820 0, 0,
821 control_flow_data->Drawing->width,
822 control_flow_data->Drawing->height);
823
824 drawing_refresh(control_flow_data->Drawing,
825 0, 0,
826 control_flow_data->Drawing->width,
827 control_flow_data->Drawing->height);
828 }
829
830
831 }
832
833 void update_current_time_hook(void *hook_data, void *call_data)
834 {
835 ControlFlowData *Control_Flow_Data = (ControlFlowData*) hook_data;
836 LttTime* Current_Time =
837 guicontrolflow_get_current_time(Control_Flow_Data);
838 *Current_Time = *((LttTime*)call_data);
839 g_info("New Current time HOOK : %u, %u", Current_Time->tv_sec,
840 Current_Time->tv_nsec);
841
842 /* If current time is inside time interval, just move the highlight
843 * bar */
844
845 /* Else, we have to change the time interval. We have to tell it
846 * to the main window. */
847 /* The time interval change will take care of placing the current
848 * time at the center of the visible area */
849
850 }
851
This page took 0.047305 seconds and 5 git commands to generate.