| 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 | |
| 19 | #include <lttv/hook.h> |
| 20 | #include <lttv/common.h> |
| 21 | #include <lttv/state.h> |
| 22 | |
| 23 | |
| 24 | #include "Event_Hooks.h" |
| 25 | #include "CFV.h" |
| 26 | #include "Process_List.h" |
| 27 | #include "Drawing.h" |
| 28 | #include "CFV-private.h" |
| 29 | |
| 30 | |
| 31 | #define MAX_PATH_LEN 256 |
| 32 | |
| 33 | //FIXME : remove this include when tests finished. |
| 34 | #include <string.h> |
| 35 | |
| 36 | void test_draw_item(Drawing_t *Drawing, |
| 37 | GdkPixmap *Pixmap) |
| 38 | { |
| 39 | PropertiesIcon properties_icon; |
| 40 | DrawContext draw_context; |
| 41 | |
| 42 | DrawInfo current, previous; |
| 43 | ItemInfo over, middle, under, modify_over, modify_middle, modify_under; |
| 44 | |
| 45 | int i=0,j=0; |
| 46 | |
| 47 | //for(i=0; i<1024;i=i+15) |
| 48 | { |
| 49 | // for(j=0;j<768;j=j+15) |
| 50 | { |
| 51 | over.x = i; |
| 52 | over.y = j; |
| 53 | |
| 54 | current.modify_over = &over; |
| 55 | |
| 56 | draw_context.drawable = Pixmap; |
| 57 | draw_context.gc = Drawing->Drawing_Area_V->style->black_gc; |
| 58 | |
| 59 | draw_context.Current = ¤t; |
| 60 | draw_context.Previous = NULL; |
| 61 | |
| 62 | properties_icon.icon_name = g_new(char, MAX_PATH_LEN); |
| 63 | strncpy(properties_icon.icon_name, |
| 64 | "/home/compudj/local/share/LinuxTraceToolkit/pixmaps/mini-display.xpm", |
| 65 | MAX_PATH_LEN); |
| 66 | properties_icon.width = -1; |
| 67 | properties_icon.height = -1; |
| 68 | properties_icon.position = OVER; |
| 69 | draw_icon(&properties_icon, &draw_context); |
| 70 | g_free(properties_icon.icon_name); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | } |
| 75 | |
| 76 | #ifdef NOTUSE |
| 77 | /* NOTE : no drawing data should be sent there, since the drawing widget |
| 78 | * has not been initialized */ |
| 79 | void send_test_drawing(ProcessList *Process_List, |
| 80 | Drawing_t *Drawing, |
| 81 | GdkPixmap *Pixmap, |
| 82 | gint x, gint y, // y not used here? |
| 83 | gint width, |
| 84 | gint height) // height won't be used here ? |
| 85 | { |
| 86 | int i,j; |
| 87 | ProcessInfo Process_Info = {10000, 12000, 55600}; |
| 88 | //ProcessInfo Process_Info = {156, 14000, 55500}; |
| 89 | GtkTreeRowReference *got_RowRef; |
| 90 | PangoContext *context; |
| 91 | PangoLayout *layout; |
| 92 | PangoFontDescription *FontDesc;// = pango_font_description_new(); |
| 93 | gint Font_Size; |
| 94 | |
| 95 | //icon |
| 96 | //GdkBitmap *mask = g_new(GdkBitmap, 1); |
| 97 | //GdkPixmap *icon_pixmap = g_new(GdkPixmap, 1); |
| 98 | GdkGC * gc; |
| 99 | // rectangle |
| 100 | GdkColor color = { 0, 0xffff, 0x0000, 0x0000 }; |
| 101 | |
| 102 | gc = gdk_gc_new(Pixmap); |
| 103 | /* Sent text data */ |
| 104 | layout = gtk_widget_create_pango_layout(Drawing->Drawing_Area_V, |
| 105 | NULL); |
| 106 | context = pango_layout_get_context(layout); |
| 107 | FontDesc = pango_context_get_font_description(context); |
| 108 | Font_Size = pango_font_description_get_size(FontDesc); |
| 109 | pango_font_description_set_size(FontDesc, Font_Size-3*PANGO_SCALE); |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | LttTime birth; |
| 115 | birth.tv_sec = 12000; |
| 116 | birth.tv_nsec = 55500; |
| 117 | g_info("we have : x : %u, y : %u, width : %u, height : %u", x, y, width, height); |
| 118 | processlist_get_process_pixels(Process_List, |
| 119 | 1, |
| 120 | &birth, |
| 121 | &y, |
| 122 | &height); |
| 123 | |
| 124 | g_info("we draw : x : %u, y : %u, width : %u, height : %u", x, y, width, height); |
| 125 | drawing_draw_line( |
| 126 | Drawing, Pixmap, x, |
| 127 | y+(height/2), x + width, y+(height/2), |
| 128 | Drawing->Drawing_Area_V->style->black_gc); |
| 129 | |
| 130 | pango_layout_set_text(layout, "Test", -1); |
| 131 | gdk_draw_layout(Pixmap, Drawing->Drawing_Area_V->style->black_gc, |
| 132 | 0, y+height, layout); |
| 133 | |
| 134 | birth.tv_sec = 14000; |
| 135 | birth.tv_nsec = 55500; |
| 136 | |
| 137 | processlist_get_process_pixels(Process_List, |
| 138 | 156, |
| 139 | &birth, |
| 140 | &y, |
| 141 | &height); |
| 142 | |
| 143 | |
| 144 | drawing_draw_line( |
| 145 | Drawing, Pixmap, x, |
| 146 | y+(height/2), x + width, y+(height/2), |
| 147 | Drawing->Drawing_Area_V->style->black_gc); |
| 148 | |
| 149 | g_info("y : %u, height : %u", y, height); |
| 150 | |
| 151 | |
| 152 | |
| 153 | birth.tv_sec = 12000; |
| 154 | birth.tv_nsec = 55700; |
| 155 | |
| 156 | processlist_get_process_pixels(Process_List, |
| 157 | 10, |
| 158 | &birth, |
| 159 | &y, |
| 160 | &height); |
| 161 | |
| 162 | /* Draw rectangle (background color) */ |
| 163 | gdk_gc_copy(gc, Drawing->Drawing_Area_V->style->black_gc); |
| 164 | gdk_gc_set_rgb_fg_color(gc, &color); |
| 165 | gdk_draw_rectangle(Pixmap, gc, |
| 166 | TRUE, |
| 167 | x, y, width, height); |
| 168 | |
| 169 | drawing_draw_line( |
| 170 | Drawing, Pixmap, x, |
| 171 | y+(height/2), x + width, y+(height/2), |
| 172 | Drawing->Drawing_Area_V->style->black_gc); |
| 173 | |
| 174 | |
| 175 | /* Draw arc */ |
| 176 | gdk_draw_arc(Pixmap, Drawing->Drawing_Area_V->style->black_gc, |
| 177 | TRUE, 100, y, height/2, height/2, 0, 360*64); |
| 178 | |
| 179 | g_info("y : %u, height : %u", y, height); |
| 180 | |
| 181 | for(i=0; i<10; i++) |
| 182 | { |
| 183 | birth.tv_sec = i*12000; |
| 184 | birth.tv_nsec = i*55700; |
| 185 | |
| 186 | processlist_get_process_pixels(Process_List, |
| 187 | i, |
| 188 | &birth, |
| 189 | &y, |
| 190 | &height); |
| 191 | |
| 192 | |
| 193 | drawing_draw_line( |
| 194 | Drawing, Pixmap, x, |
| 195 | y+(height/2), x + width, y+(height/2), |
| 196 | Drawing->Drawing_Area_V->style->black_gc); |
| 197 | |
| 198 | g_critical("y : %u, height : %u", y, height); |
| 199 | |
| 200 | } |
| 201 | |
| 202 | birth.tv_sec = 12000; |
| 203 | birth.tv_nsec = 55600; |
| 204 | |
| 205 | processlist_get_process_pixels(Process_List, |
| 206 | 10, |
| 207 | &birth, |
| 208 | &y, |
| 209 | &height); |
| 210 | |
| 211 | |
| 212 | drawing_draw_line( |
| 213 | Drawing, Pixmap, x, |
| 214 | y+(height/2), x + width, y+(height/2), |
| 215 | Drawing->Drawing_Area_V->style->black_gc); |
| 216 | |
| 217 | g_info("y : %u, height : %u", y, height); |
| 218 | |
| 219 | |
| 220 | /* IMPORTANT : This action uses the cpu heavily! */ |
| 221 | //icon_pixmap = gdk_pixmap_create_from_xpm(Pixmap, &mask, NULL, |
| 222 | // "/home/compudj/local/share/LinuxTraceToolkit/pixmaps/move_message.xpm"); |
| 223 | // "/home/compudj/local/share/LinuxTraceToolkit/pixmaps/mini-display.xpm"); |
| 224 | |
| 225 | // gdk_gc_set_clip_mask(Drawing->Drawing_Area_V->style->black_gc, mask); |
| 226 | |
| 227 | // for(i=x;i<x+width;i=i+15) |
| 228 | // { |
| 229 | // for(j=0;j<height*20;j=j+15) |
| 230 | // { |
| 231 | |
| 232 | /* Draw icon */ |
| 233 | //gdk_gc_copy(gc, Drawing->Drawing_Area_V->style->black_gc); |
| 234 | // gdk_gc_set_clip_origin(Drawing->Drawing_Area_V->style->black_gc, i, j); |
| 235 | // gdk_draw_drawable(Pixmap, |
| 236 | // Drawing->Drawing_Area_V->style->black_gc, |
| 237 | // icon_pixmap, |
| 238 | // 0, 0, i, j, -1, -1); |
| 239 | |
| 240 | // } |
| 241 | // } |
| 242 | |
| 243 | test_draw_item(Drawing,Pixmap); |
| 244 | |
| 245 | //gdk_gc_set_clip_origin(Drawing->Drawing_Area_V->style->black_gc, 0, 0); |
| 246 | //gdk_gc_set_clip_mask(Drawing->Drawing_Area_V->style->black_gc, NULL); |
| 247 | |
| 248 | //g_free(icon_pixmap); |
| 249 | //g_free(mask); |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | pango_font_description_set_size(FontDesc, Font_Size); |
| 257 | g_object_unref(layout); |
| 258 | g_free(gc); |
| 259 | } |
| 260 | |
| 261 | void send_test_process(ProcessList *Process_List, Drawing_t *Drawing) |
| 262 | { |
| 263 | guint height, y; |
| 264 | int i; |
| 265 | ProcessInfo Process_Info = {10000, 12000, 55600}; |
| 266 | //ProcessInfo Process_Info = {156, 14000, 55500}; |
| 267 | GtkTreeRowReference *got_RowRef; |
| 268 | |
| 269 | LttTime birth; |
| 270 | |
| 271 | if(Process_List->Test_Process_Sent) return; |
| 272 | |
| 273 | birth.tv_sec = 12000; |
| 274 | birth.tv_nsec = 55500; |
| 275 | |
| 276 | processlist_add(Process_List, |
| 277 | 1, |
| 278 | &birth, |
| 279 | &y); |
| 280 | processlist_get_process_pixels(Process_List, |
| 281 | 1, |
| 282 | &birth, |
| 283 | &y, |
| 284 | &height); |
| 285 | drawing_insert_square( Drawing, y, height); |
| 286 | |
| 287 | //g_critical("y : %u, height : %u", y, height); |
| 288 | |
| 289 | birth.tv_sec = 14000; |
| 290 | birth.tv_nsec = 55500; |
| 291 | |
| 292 | processlist_add(Process_List, |
| 293 | 156, |
| 294 | &birth, |
| 295 | &y); |
| 296 | processlist_get_process_pixels(Process_List, |
| 297 | 156, |
| 298 | &birth, |
| 299 | &y, |
| 300 | &height); |
| 301 | drawing_insert_square( Drawing, y, height); |
| 302 | |
| 303 | //g_critical("y : %u, height : %u", y, height); |
| 304 | |
| 305 | birth.tv_sec = 12000; |
| 306 | birth.tv_nsec = 55700; |
| 307 | |
| 308 | processlist_add(Process_List, |
| 309 | 10, |
| 310 | &birth, |
| 311 | &height); |
| 312 | processlist_get_process_pixels(Process_List, |
| 313 | 10, |
| 314 | &birth, |
| 315 | &y, |
| 316 | &height); |
| 317 | drawing_insert_square( Drawing, y, height); |
| 318 | |
| 319 | //g_critical("y : %u, height : %u", y, height); |
| 320 | |
| 321 | //drawing_insert_square( Drawing, height, 5); |
| 322 | |
| 323 | for(i=0; i<10; i++) |
| 324 | { |
| 325 | birth.tv_sec = i*12000; |
| 326 | birth.tv_nsec = i*55700; |
| 327 | |
| 328 | processlist_add(Process_List, |
| 329 | i, |
| 330 | &birth, |
| 331 | &height); |
| 332 | processlist_get_process_pixels(Process_List, |
| 333 | i, |
| 334 | &birth, |
| 335 | &y, |
| 336 | &height); |
| 337 | drawing_insert_square( Drawing, y, height); |
| 338 | |
| 339 | // g_critical("y : %u, height : %u", y, height); |
| 340 | |
| 341 | } |
| 342 | //g_critical("height : %u", height); |
| 343 | |
| 344 | birth.tv_sec = 12000; |
| 345 | birth.tv_nsec = 55600; |
| 346 | |
| 347 | processlist_add(Process_List, |
| 348 | 10, |
| 349 | &birth, |
| 350 | &y); |
| 351 | processlist_get_process_pixels(Process_List, |
| 352 | 10, |
| 353 | &birth, |
| 354 | &y, |
| 355 | &height); |
| 356 | drawing_insert_square( Drawing, y, height); |
| 357 | |
| 358 | //g_critical("y : %u, height : %u", y, height); |
| 359 | |
| 360 | processlist_add(Process_List, |
| 361 | 10000, |
| 362 | &birth, |
| 363 | &height); |
| 364 | processlist_get_process_pixels(Process_List, |
| 365 | 10000, |
| 366 | &birth, |
| 367 | &y, |
| 368 | &height); |
| 369 | drawing_insert_square( Drawing, y, height); |
| 370 | |
| 371 | //g_critical("y : %u, height : %u", y, height); |
| 372 | |
| 373 | //drawing_insert_square( Drawing, height, 5); |
| 374 | //g_critical("height : %u", height); |
| 375 | |
| 376 | |
| 377 | processlist_get_process_pixels(Process_List, |
| 378 | 10000, |
| 379 | &birth, |
| 380 | &y, &height); |
| 381 | processlist_remove( Process_List, |
| 382 | 10000, |
| 383 | &birth); |
| 384 | |
| 385 | drawing_remove_square( Drawing, y, height); |
| 386 | |
| 387 | if(got_RowRef = |
| 388 | (GtkTreeRowReference*)g_hash_table_lookup( |
| 389 | Process_List->Process_Hash, |
| 390 | &Process_Info)) |
| 391 | { |
| 392 | g_critical("key found"); |
| 393 | g_critical("position in the list : %s", |
| 394 | gtk_tree_path_to_string ( |
| 395 | gtk_tree_row_reference_get_path( |
| 396 | (GtkTreeRowReference*)got_RowRef) |
| 397 | )); |
| 398 | |
| 399 | } |
| 400 | |
| 401 | Process_List->Test_Process_Sent = TRUE; |
| 402 | |
| 403 | } |
| 404 | #endif//NOTUSE |
| 405 | |
| 406 | |
| 407 | /** |
| 408 | * Event Viewer's constructor hook |
| 409 | * |
| 410 | * This constructor is given as a parameter to the menuitem and toolbar button |
| 411 | * registration. It creates the list. |
| 412 | * @param pmParentWindow A pointer to the parent window. |
| 413 | * @return The widget created. |
| 414 | */ |
| 415 | GtkWidget * |
| 416 | h_guicontrolflow(MainWindow *pmParentWindow, LttvTracesetSelector * s, char * key) |
| 417 | { |
| 418 | g_info("h_guicontrolflow, %p, %p, %s", pmParentWindow, s, key); |
| 419 | ControlFlowData *Control_Flow_Data = guicontrolflow() ; |
| 420 | |
| 421 | Control_Flow_Data->Parent_Window = pmParentWindow; |
| 422 | TimeWindow *time_window = guicontrolflow_get_time_window(Control_Flow_Data); |
| 423 | time_window->start_time.tv_sec = 0; |
| 424 | time_window->start_time.tv_nsec = 0; |
| 425 | time_window->time_width.tv_sec = 0; |
| 426 | time_window->time_width.tv_nsec = 0; |
| 427 | |
| 428 | LttTime *current_time = guicontrolflow_get_current_time(Control_Flow_Data); |
| 429 | current_time->tv_sec = 0; |
| 430 | current_time->tv_nsec = 0; |
| 431 | |
| 432 | //g_critical("time width1 : %u",time_window->time_width); |
| 433 | |
| 434 | get_time_window(pmParentWindow, |
| 435 | time_window); |
| 436 | get_current_time(pmParentWindow, |
| 437 | current_time); |
| 438 | |
| 439 | //g_critical("time width2 : %u",time_window->time_width); |
| 440 | // Unreg done in the GuiControlFlow_Destructor |
| 441 | reg_update_time_window(update_time_window_hook, Control_Flow_Data, |
| 442 | pmParentWindow); |
| 443 | reg_update_current_time(update_current_time_hook, Control_Flow_Data, |
| 444 | pmParentWindow); |
| 445 | return guicontrolflow_get_widget(Control_Flow_Data) ; |
| 446 | |
| 447 | } |
| 448 | |
| 449 | int event_selected_hook(void *hook_data, void *call_data) |
| 450 | { |
| 451 | ControlFlowData *Control_Flow_Data = (ControlFlowData*) hook_data; |
| 452 | guint *Event_Number = (guint*) call_data; |
| 453 | |
| 454 | g_critical("DEBUG : event selected by main window : %u", *Event_Number); |
| 455 | |
| 456 | // Control_Flow_Data->Currently_Selected_Event = *Event_Number; |
| 457 | // Control_Flow_Data->Selected_Event = TRUE ; |
| 458 | |
| 459 | // tree_v_set_cursor(Control_Flow_Data); |
| 460 | |
| 461 | } |
| 462 | |
| 463 | /* Hook called before drawing. Gets the initial context at the beginning of the |
| 464 | * drawing interval and copy it to the context in Event_Request. |
| 465 | */ |
| 466 | int draw_before_hook(void *hook_data, void *call_data) |
| 467 | { |
| 468 | EventRequest *Event_Request = (EventRequest*)hook_data; |
| 469 | //EventsContext Events_Context = (EventsContext*)call_data; |
| 470 | |
| 471 | //Event_Request->Events_Context = Events_Context; |
| 472 | |
| 473 | return 0; |
| 474 | } |
| 475 | |
| 476 | /* |
| 477 | * The draw event hook is called by the reading API to have a |
| 478 | * particular event drawn on the screen. |
| 479 | * @param hook_data ControlFlowData structure of the viewer. |
| 480 | * @param call_data Event context. |
| 481 | * |
| 482 | * This function basically draw lines and icons. Two types of lines are drawn : |
| 483 | * one small (3 pixels?) representing the state of the process and the second |
| 484 | * type is thicker (10 pixels?) representing on which CPU a process is running |
| 485 | * (and this only in running state). |
| 486 | * |
| 487 | * Extremums of the lines : |
| 488 | * x_min : time of the last event context for this process kept in memory. |
| 489 | * x_max : time of the current event. |
| 490 | * y : middle of the process in the process list. The process is found in the |
| 491 | * list, therefore is it's position in pixels. |
| 492 | * |
| 493 | * The choice of lines'color is defined by the context of the last event for this |
| 494 | * process. |
| 495 | */ |
| 496 | int draw_event_hook(void *hook_data, void *call_data) |
| 497 | { |
| 498 | EventRequest *Event_Request = (EventRequest*)hook_data; |
| 499 | ControlFlowData *control_flow_data = Event_Request->Control_Flow_Data; |
| 500 | //static int i=0; |
| 501 | |
| 502 | //i++; |
| 503 | //g_critical("%i", i); |
| 504 | LttvTracefileContext *tfc = (LttvTracefileContext *)call_data; |
| 505 | |
| 506 | LttvTracefileState *tfs = (LttvTracefileState *)call_data; |
| 507 | |
| 508 | LttEvent *e; |
| 509 | e = tfc->e; |
| 510 | |
| 511 | /* Temp dump */ |
| 512 | #ifdef DONTSHOW |
| 513 | GString *string = g_string_new("");; |
| 514 | gboolean field_names = TRUE, state = TRUE; |
| 515 | |
| 516 | lttv_event_to_string(e, tfc->tf, string, TRUE, field_names, tfs); |
| 517 | g_string_append_printf(string,"\n"); |
| 518 | |
| 519 | if(state) { |
| 520 | g_string_append_printf(string, " %s", |
| 521 | g_quark_to_string(tfs->process->state->s)); |
| 522 | } |
| 523 | |
| 524 | g_info("%s",string->str); |
| 525 | |
| 526 | g_string_free(string, TRUE); |
| 527 | |
| 528 | /* End of text dump */ |
| 529 | #endif //DONTSHOW |
| 530 | /* Add process to process list (if not present) and get drawing "y" from |
| 531 | * process position */ |
| 532 | guint pid = tfs->process->pid; |
| 533 | LttTime birth = tfs->process->creation_time; |
| 534 | guint y = 0, height = 0, pl_height = 0; |
| 535 | HashedProcessData *Hashed_Process_Data = NULL; |
| 536 | |
| 537 | ProcessList *process_list = |
| 538 | guicontrolflow_get_process_list(Event_Request->Control_Flow_Data); |
| 539 | |
| 540 | if(processlist_get_process_pixels(process_list, |
| 541 | pid, |
| 542 | &birth, |
| 543 | &y, |
| 544 | &height, |
| 545 | &Hashed_Process_Data) == 1) |
| 546 | { |
| 547 | /* Process not present */ |
| 548 | processlist_add(process_list, |
| 549 | pid, |
| 550 | &birth, |
| 551 | &pl_height, |
| 552 | &Hashed_Process_Data); |
| 553 | drawing_insert_square( Event_Request->Control_Flow_Data->Drawing, y, height); |
| 554 | } |
| 555 | |
| 556 | /* Find pixels corresponding to time of the event. If the time does |
| 557 | * not fit in the window, show a warning, not supposed to happend. */ |
| 558 | guint x = 0; |
| 559 | guint width = control_flow_data->Drawing->Drawing_Area_V->allocation.width; |
| 560 | |
| 561 | LttTime time = ltt_event_time(e); |
| 562 | |
| 563 | LttTime window_end = ltt_time_add(control_flow_data->Time_Window.time_width, |
| 564 | control_flow_data->Time_Window.start_time); |
| 565 | |
| 566 | |
| 567 | convert_time_to_pixels( |
| 568 | control_flow_data->Time_Window.start_time, |
| 569 | window_end, |
| 570 | time, |
| 571 | width, |
| 572 | &x); |
| 573 | |
| 574 | assert(x <= width); |
| 575 | |
| 576 | /* Finally, draw what represents the event. */ |
| 577 | |
| 578 | GdkColor color = { 0, 0xffff, 0x0000, 0x0000 }; |
| 579 | PropertiesArc prop_arc; |
| 580 | prop_arc.color = &color; |
| 581 | prop_arc.size = 10; |
| 582 | prop_arc.filled = TRUE; |
| 583 | prop_arc.position = OVER; |
| 584 | DrawContext *draw_context = Hashed_Process_Data->draw_context; |
| 585 | draw_context->Current->modify_over->x = x; |
| 586 | draw_context->Current->modify_over->y = y; |
| 587 | draw_context->drawable = control_flow_data->Drawing->Pixmap; |
| 588 | GtkWidget *widget = control_flow_data->Drawing->Drawing_Area_V; |
| 589 | //draw_context->gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)]; |
| 590 | draw_context->gc = widget->style->black_gc; |
| 591 | |
| 592 | draw_arc((void*)&prop_arc, (void*)draw_context); |
| 593 | //test_draw_item(control_flow_data->Drawing, control_flow_data->Drawing->Pixmap); |
| 594 | return 0; |
| 595 | } |
| 596 | |
| 597 | |
| 598 | int draw_after_hook(void *hook_data, void *call_data) |
| 599 | { |
| 600 | EventRequest *Event_Request = (EventRequest*)hook_data; |
| 601 | |
| 602 | g_free(Event_Request); |
| 603 | return 0; |
| 604 | } |
| 605 | |
| 606 | |
| 607 | |
| 608 | |
| 609 | void update_time_window_hook(void *hook_data, void *call_data) |
| 610 | { |
| 611 | ControlFlowData *Control_Flow_Data = (ControlFlowData*) hook_data; |
| 612 | TimeWindow* Time_Window = |
| 613 | guicontrolflow_get_time_window(Control_Flow_Data); |
| 614 | TimeWindow *New_Time_Window = ((TimeWindow*)call_data); |
| 615 | |
| 616 | // As the time interval change will mostly be used for |
| 617 | // zoom in and out, it's not useful to keep old drawing |
| 618 | // sections, as scale will be changed. |
| 619 | |
| 620 | |
| 621 | *Time_Window = *New_Time_Window; |
| 622 | g_info("New time window HOOK : %u, %u to %u, %u", |
| 623 | Time_Window->start_time.tv_sec, |
| 624 | Time_Window->start_time.tv_nsec, |
| 625 | Time_Window->time_width.tv_sec, |
| 626 | Time_Window->time_width.tv_nsec); |
| 627 | |
| 628 | drawing_data_request(Control_Flow_Data->Drawing, |
| 629 | &Control_Flow_Data->Drawing->Pixmap, |
| 630 | 0, 0, |
| 631 | Control_Flow_Data->Drawing->width, |
| 632 | Control_Flow_Data->Drawing->height); |
| 633 | |
| 634 | drawing_refresh(Control_Flow_Data->Drawing, |
| 635 | 0, 0, |
| 636 | Control_Flow_Data->Drawing->width, |
| 637 | Control_Flow_Data->Drawing->height); |
| 638 | |
| 639 | } |
| 640 | |
| 641 | void update_current_time_hook(void *hook_data, void *call_data) |
| 642 | { |
| 643 | ControlFlowData *Control_Flow_Data = (ControlFlowData*) hook_data; |
| 644 | LttTime* Current_Time = |
| 645 | guicontrolflow_get_current_time(Control_Flow_Data); |
| 646 | *Current_Time = *((LttTime*)call_data); |
| 647 | g_info("New Current time HOOK : %u, %u", Current_Time->tv_sec, |
| 648 | Current_Time->tv_nsec); |
| 649 | |
| 650 | /* If current time is inside time interval, just move the highlight |
| 651 | * bar */ |
| 652 | |
| 653 | /* Else, we have to change the time interval. We have to tell it |
| 654 | * to the main window. */ |
| 655 | /* The time interval change will take care of placing the current |
| 656 | * time at the center of the visible area */ |
| 657 | |
| 658 | } |
| 659 | |