2 Copyright (C) 2011-2013 Paul Davis
3 Author: Carl Hetherington <cth@carlh.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "canvas/debug.h"
27 PBD::DebugBits PBD::DEBUG::CanvasItems = PBD::new_debug_bit ("canvasitems");
28 PBD::DebugBits PBD::DEBUG::CanvasItemsDirtied = PBD::new_debug_bit ("canvasitemsdirtied");
29 PBD::DebugBits PBD::DEBUG::CanvasEvents = PBD::new_debug_bit ("canvasevents");
30 PBD::DebugBits PBD::DEBUG::CanvasRender = PBD::new_debug_bit ("canvasrender");
31 PBD::DebugBits PBD::DEBUG::CanvasEnterLeave = PBD::new_debug_bit ("canvasenterleave");
32 PBD::DebugBits PBD::DEBUG::WaveView = PBD::new_debug_bit ("waveview");
34 struct timeval ArdourCanvas::epoch;
35 map<string, struct timeval> ArdourCanvas::last_time;
36 int ArdourCanvas::render_count;
37 int ArdourCanvas::render_depth;
38 int ArdourCanvas::dump_depth;
41 ArdourCanvas::set_epoch ()
43 gettimeofday (&epoch, 0);
47 ArdourCanvas::checkpoint (string group, string message)
50 gettimeofday (&now, 0);
52 now.tv_sec -= epoch.tv_sec;
53 now.tv_usec -= epoch.tv_usec;
54 if (now.tv_usec < 0) {
59 map<string, struct timeval>::iterator last = last_time.find (group);
61 if (last != last_time.end ()) {
63 time_t seconds = now.tv_sec - last->second.tv_sec;
64 suseconds_t useconds = now.tv_usec - last->second.tv_usec;
69 cout << (now.tv_sec + ((double) now.tv_usec / 1e6)) << " [" << (seconds + ((double) useconds / 1e6)) << "]: " << message << "\n";
72 cout << message << "\n";
75 last_time[group] = now;
79 ArdourCanvas::event_type_string (int event_type)
90 case GDK_MOTION_NOTIFY:
91 return "motion_notify";
92 case GDK_BUTTON_PRESS:
93 return "button_press";
94 case GDK_2BUTTON_PRESS:
95 return "2button_press";
96 case GDK_3BUTTON_PRESS:
97 return "3button_press";
98 case GDK_BUTTON_RELEASE:
99 return "button_release";
102 case GDK_KEY_RELEASE:
103 return "key_release";
104 case GDK_ENTER_NOTIFY:
105 return "enter_notify";
106 case GDK_LEAVE_NOTIFY:
107 return "leave_notify";
108 case GDK_FOCUS_CHANGE:
109 return "focus_change";
116 case GDK_PROPERTY_NOTIFY:
117 return "property_notify";
118 case GDK_SELECTION_CLEAR:
119 return "selection_clear";
120 case GDK_SELECTION_REQUEST:
121 return "selection_request";
122 case GDK_SELECTION_NOTIFY:
123 return "selection_notify";
124 case GDK_PROXIMITY_IN:
125 return "proximity_in";
126 case GDK_PROXIMITY_OUT:
127 return "proximity_out";
132 case GDK_DRAG_MOTION:
133 return "drag_motion";
134 case GDK_DRAG_STATUS:
135 return "drag_status";
138 case GDK_DROP_FINISHED:
139 return "drop_finished";
140 case GDK_CLIENT_EVENT:
141 return "client_event";
142 case GDK_VISIBILITY_NOTIFY:
143 return "visibility_notify";
148 case GDK_WINDOW_STATE:
149 return "window_state";
152 case GDK_OWNER_CHANGE:
153 return "owner_change";
154 case GDK_GRAB_BROKEN:
155 return "grab_broken";