wxTimelineCtrlWidget
Loading...
Searching...
No Matches
wxTimelineCtrl.h
Go to the documentation of this file.
1#ifndef _WX_TIMELINE_CTRL_H
2#define _WX_TIMELINE_CTRL_H
3
4#include <wx/wx.h>
5#include <wx/dcbuffer.h>
6#include <wx/dcgraph.h>
7#include <wx/vector.h>
8#include <wx/timer.h>
10#include "TimelineItem.h"
11#include <set>
12#include <utility>
13#include <algorithm>
14#include <numeric>
16
17template<typename Tval>
18Tval wxClip(Tval value, Tval min_val, Tval max_val)
19{
20 if (value < min_val) return min_val;
21 if (value > max_val) return max_val;
22 return value;
23}
24
25wxDECLARE_EVENT(wxEVT_TIMELINE_ZOOM, wxCommandEvent);
26wxDECLARE_EVENT(wxEVT_TIMELINE_SELECTION, wxCommandEvent);
27wxDECLARE_EVENT(wxEVT_TIMELINE_ITEM_DELETED, wxCommandEvent);
28
29enum
30{
31 ID_TIMELINE_DELETE = wxID_HIGHEST + 1000,
33};
34
35// --- Template Timeline Control ---
36template<typename T>
37class wxTimelineCtrl : public wxControl
38{
39public:
40 using TimelineItemVector = wxVector< TimelineItem<T> >;
41 static const int MAX_ITEMS = 65536;
42
59
60public:
62 wxTimelineCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize)
63 {
64 Init();
65 Create(parent, id, pos, size);
66 }
67
69 {
70 if (m_timerMove.IsRunning())
71 m_timerMove.Stop();
72 delete m_artProvider;
73 }
74
75 bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize)
76 {
77 if (!wxControl::Create(parent, id, pos, size, wxWANTS_CHARS | wxNO_BORDER))
78 return false;
79 SetBackgroundStyle(wxBG_STYLE_PAINT);
81 m_artProvider->SetBackgroundColour(GetBackgroundColour());
83 return true;
84 }
85
86 void Init();
87
89 {
90 if (!m_selectionRect.IsEmpty() && m_selectionRect.width > 5)
91 {
94
95 if (startTime < 0) startTime = 0;
96 if (endTime > m_totalDuration) endTime = m_totalDuration;
97 if (endTime <= startTime) endTime = startTime + m_minVisibleDuration;
98
99 int newDuration = endTime - startTime;
100
101 wxLogDebug("ZoomToSelection: startTime=%d, endTime=%d, newDuration=%d",
102 startTime, endTime, newDuration);
103
104 if (newDuration >= m_minVisibleDuration)
105 {
106 int padding = newDuration / 20;
107 if (padding < 1) padding = 1;
108
109 startTime = wxMax(0, startTime - padding);
110 endTime = wxMin(m_totalDuration, endTime + padding);
111
112 SetVisibleTimeRange(startTime, endTime);
113
115
116 wxCommandEvent event(wxEVT_TIMELINE_ZOOM, GetId());
117 event.SetEventObject(this);
118 event.SetInt(m_visibleDuration);
119 ProcessWindowEvent(event);
120
121 wxLogDebug("Zoom applied: firstVisible=%d, duration=%d",
123 }
124 }
125 }
126
127 void ZoomToTimePoint(int timePoint, int zoomLevel = -1)
128 {
129 if (zoomLevel < 0)
130 zoomLevel = m_visibleDuration / 2;
131 else
132 zoomLevel = wxClip(zoomLevel, m_minVisibleDuration, m_maxVisibleDuration);
133
134 timePoint = wxClip(timePoint, 0, m_totalDuration);
135
136 int halfZoom = zoomLevel / 2;
137 int startTime = wxMax(0, timePoint - halfZoom);
138 int endTime = wxMin(m_totalDuration, timePoint + halfZoom);
139
140 SetVisibleTimeRange(startTime, endTime);
141
142 wxLogDebug("ZoomToTimePoint: timePoint=%d, zoomLevel=%d, visible=%d-%d",
143 timePoint, zoomLevel, startTime, endTime);
144
145 wxCommandEvent event(wxEVT_TIMELINE_ZOOM, GetId());
146 event.SetEventObject(this);
147 event.SetInt(m_visibleDuration);
148 ProcessWindowEvent(event);
149 }
150
152 {
153 m_isSelecting = false;
154 m_selectionRect = wxRect();
155 m_selectedItems.clear();
157 Refresh();
158 }
159
160 // Get selected items indices
161 const wxVector<size_t>& GetSelectedItems() const
162 {
163 return m_selectedItems;
164 }
165
166 // Check if an item is selected
167 bool IsItemSelected(size_t index) const
168 {
169 return std::find(m_selectedItems.begin(), m_selectedItems.end(), index) != m_selectedItems.end();
170 }
171
172 // Toggle item selection
173 void ToggleItemSelection(size_t index)
174 {
175 auto it = std::find(m_selectedItems.begin(), m_selectedItems.end(), index);
176 if (it != m_selectedItems.end())
177 m_selectedItems.erase(it);
178 else
179 m_selectedItems.push_back(index);
180 Refresh();
181 }
182
183 // Select an item
184 void SelectItem(size_t index, bool clearPrevious = true)
185 {
186 wxLogDebug("SelectItem: index=%d, clearPrevious=%d", (int)index, clearPrevious);
187
188 if (index >= m_items.size())
189 {
190 wxLogDebug("SelectItem: index %d out of range (size=%d)", (int)index, (int)m_items.size());
191 return;
192 }
193
194 if (clearPrevious)
195 {
196 wxLogDebug("SelectItem: clearing previous selection");
197 m_selectedItems.clear();
198 }
199
200 if (!IsItemSelected(index))
201 {
202 wxLogDebug("SelectItem: adding index %d to selection", (int)index);
203 m_selectedItems.push_back(index);
204 wxLogDebug("SelectItem: selection size now %d", (int)m_selectedItems.size());
205 }
206
207 wxLogDebug("Current selection after SelectItem:");
208 for (size_t i = 0; i < m_selectedItems.size(); ++i) {
209 wxLogDebug(" Selected item %d: index=%d", (int)i, (int)m_selectedItems[i]);
210 }
211
212 Refresh();
213 }
214
215 // Remove selected items
216 void RemoveSelectedItems();
218
219 int GetZoomLevel() const
220 {
221 return m_visibleDuration;
222 }
223
224 void SetZoomLevel(int zoomLevelSeconds)
225 {
226 zoomLevelSeconds = wxClip(zoomLevelSeconds, m_minVisibleDuration, m_maxVisibleDuration);
227
228 if (zoomLevelSeconds == m_visibleDuration)
229 return;
230
231 int centerTime = m_firstVisibleTime + m_visibleDuration / 2;
232 ZoomAtPosition(m_visibleDuration - zoomLevelSeconds, centerTime);
233
234 wxCommandEvent event(wxEVT_TIMELINE_ZOOM, GetId());
235 event.SetEventObject(this);
236 event.SetInt(m_visibleDuration);
237 ProcessWindowEvent(event);
238 }
239
241 {
243
244 wxLogDebug("ShowAllTimeline: firstVisible=%d, duration=%d",
246 }
247
248 // Add an item with a specific color
249 void AddItem(T* data, const wxColour& colour = wxNullColour);
250
251 // Set color for a specific item
252 bool SetItemColor(size_t index, const wxColour& colour)
253 {
254 if (index >= m_items.size() || !colour.IsOk())
255 return false;
256
257 m_items[index].SetColour(colour);
258 Refresh();
259 return true;
260 }
261
262 // Set color for a specific item by data pointer
263 bool SetItemColor(T* data, const wxColour& colour)
264 {
265 if (!data || !colour.IsOk())
266 return false;
267
268 auto it = FindItem(data);
269 if (it != m_items.end())
270 {
271 it->SetColour(colour);
272 Refresh();
273 return true;
274 }
275 return false;
276 }
277
278 // Updates the total timeline duration based on added items
280 {
281 if (m_items.empty()) {
284 }
285 return;
286 }
287
288 int maxEndTime = 0;
289
290 for (auto& item : m_items)
291 {
292 if (item.Data)
293 {
294 int itemEndTime = item.Data->GetEndTime();
295 if (itemEndTime > maxEndTime)
296 maxEndTime = itemEndTime;
297 }
298 }
299
300 int newDuration = maxEndTime;
301
302 if (newDuration != m_totalDuration)
303 {
304 SetTotalDuration(newDuration);
305 }
306 }
307
308 void RemoveItem(T* data)
309 {
310 for (auto it = m_items.begin(); it != m_items.end(); ++it)
311 {
312 if (it->Data == data)
313 {
314 m_items.erase(it);
315 break;
316 }
317 }
318
320
322 {
324 }
325
326 TimeChanged();
327 Refresh();
328 }
329
331 {
332 m_items.clear();
333 TimeChanged();
334 Refresh();
335 }
336
337 void SwapItems(T* item1, T* item2)
338 {
339 auto it1 = FindItem(item1);
340 auto it2 = FindItem(item2);
341 if (it1 != m_items.end() && it2 != m_items.end())
342 std::swap(*it1, *it2);
343 RecalcItems();
344 Refresh();
345 }
346
347 wxColour GetItemColour(int index)
348 {
349 wxImage::HSVValue hsv(0, 1, 1);
350 double dummy;
351 hsv.hue = modf(index * 0.07, &dummy);
352
353 wxImage::RGBValue rgb = wxImage::HSVtoRGB(hsv);
354 wxColour color(rgb.red, rgb.green, rgb.blue);
355 return color.ChangeLightness(90);
356 }
357
358 // Get the color of a specific item
359 wxColour GetItemColor(size_t index) const
360 {
361 if (index < m_items.size())
362 return m_items[index].Colour;
363 return wxNullColour;
364 }
365
366 // Get the color of a specific item by data pointer
367 wxColour GetItemColor(T* data) const
368 {
369 if (!data)
370 return wxNullColour;
371
372 for (const auto& item : m_items)
373 {
374 if (item.Data == data)
375 return item.Colour;
376 }
377 return wxNullColour;
378 }
379
380 void SetStartTime(const wxDateTime& val) { m_startTime = val; }
381 wxDateTime GetStartTime() const { return m_startTime; }
382
383 void SetDefaultDuration(int seconds) { m_defaultDuration = seconds; }
384 int GetDefaultDuration() const { return m_defaultDuration; }
385
386 void SetTotalDuration(int seconds);
387 int GetTotalDuration() const { return m_totalDuration; }
388
389 void SetFirstVisibleTime(int seconds);
390
391
394
395 void SetVisibleTimeRange(int startSeconds, int endSeconds)
396 {
397 if (startSeconds >= endSeconds)
398 return;
399
400 int newDuration = endSeconds - startSeconds;
401 if (newDuration < m_minVisibleDuration)
402 newDuration = m_minVisibleDuration;
403
404 SetVisibleDuration(newDuration);
405
406 SetFirstVisibleTime(startSeconds);
407
409 RecalcItems();
410 Refresh();
411 }
412
413 void SetVisibleDuration(int seconds);
414
415 int GetVisibleDuration() const { return m_visibleDuration; }
416
417 void ZoomAtPosition(int deltaSeconds, int fixedTimePosition = -1)
418 {
419 if (fixedTimePosition < 0)
420 fixedTimePosition = m_firstVisibleTime + m_visibleDuration / 2;
421
422 double relativePos = 0.5;
423 if (fixedTimePosition >= m_firstVisibleTime && fixedTimePosition <= GetLastVisibleTime())
424 relativePos = (double)(fixedTimePosition - m_firstVisibleTime) / m_visibleDuration;
425
426 int newDuration = m_visibleDuration - deltaSeconds;
427 newDuration = wxClip(newDuration, m_minVisibleDuration, m_maxVisibleDuration);
428
429 if (newDuration == m_visibleDuration)
430 return;
431
432 int newFirstVisible = fixedTimePosition - wxRound(relativePos * newDuration);
433
434 m_visibleDuration = newDuration;
435
436 if (newFirstVisible < 0)
437 newFirstVisible = 0;
438 if (newFirstVisible + m_visibleDuration > m_totalDuration)
439 newFirstVisible = m_totalDuration - m_visibleDuration;
440
441 m_firstVisibleTime = newFirstVisible;
442
445 RecalcItems();
446 Refresh();
447
448 wxCommandEvent event(wxEVT_TIMELINE_ZOOM, GetId());
449 event.SetEventObject(this);
450 event.SetInt(m_visibleDuration);
451 ProcessWindowEvent(event);
452 }
453
454 void Zoom(int deltaSeconds)
455 {
456 if (abs(deltaSeconds) == 1)
457 SetVisibleDuration(GetVisibleDuration() + deltaSeconds);
458 else
459 {
460 ZoomAtPosition(deltaSeconds);
461 }
462 }
463
473
475 {
476 if (preset == ZOOM_ALL)
477 {
479 return;
480 }
481
482 int centerTime = m_firstVisibleTime + m_visibleDuration / 2;
483
484 SetZoomLevel(preset);
485
486 CenterOnTime(centerTime);
487 }
488
489 void CenterOnTime(int seconds)
490 {
492 }
493
494 int ScrollerTimeToCoord(int time);
495
497 {
498 return wxRound((double)time * m_rectTimelineTrack.width / m_visibleDuration);
499 }
500
501 int ScrollerCoordToTime(int coord) const;
502
503 int TimelineCoordToTime(int coord)
504 {
505 if (m_visibleDuration <= 0 || m_rectTimelineTrack.width <= 0)
506 return 0;
507
508 return (coord * m_visibleDuration) / m_rectTimelineTrack.width;
509 }
510
511 int ClampFirstVisibleTime(int first) const;
512
513protected:
514 // Drawing
515 void OnPaint(wxPaintEvent& evt);
516 void OnEraseBackground(wxEraseEvent& evt);
517 void Draw(wxDC& dc);
518 void DrawTimeline(wxDC& dc);
519 void DrawScroller(wxDC& dc);
520
521 // Mouse & Key Events
522 void SetEventHandlers();
523 void OnMouse(wxMouseEvent& evt);
524 void OnSize(wxSizeEvent& evt);
525 void OnTimer(wxTimerEvent& evt);
526 void OnKeyDown(wxKeyEvent& evt);
527
528 void OnMouseCaptureLost(wxMouseCaptureLostEvent& evt);
529
530 // Logic
531 void RecalcRects();
532 void RecalcVisibleFrame();
533 void RecalcItems();
535 void CalcArrowsState();
536 void TimeChanged();
537
538 // Elements
539 ElementType GetElementFromPos(const wxPoint& pos);
540 wxCursor GetCursorFromType(ElementType type);
542 void OnMouseDown(ElementType type, const wxPoint& pos);
543 void OnMouseUp(ElementType type, const wxPoint& pos);
544 void OnMouseDrag(ElementType type, const wxPoint& pos);
545 void OnLeaveElement(ElementType type);
546 void OnEnterElement(ElementType type);
547
548 void OnTimelineDown(const wxPoint& pos, ElementType type);
549 void OnTimelineUp(const wxPoint& pos, ElementType type);
550 void OnTimelineDrag(const wxPoint& pos, ElementType type);
551
552 void OnVisibleFrameDown(const wxPoint& pos, ElementType type);
553 void OnVisibleFrameUp(const wxPoint& pos);
554 void OnVisibleFrameDrag(const wxPoint& pos);
555
556 void OnScrollerDown(const wxPoint& pos);
557 void OnArrowDown(bool isLeft);
558 void OnArrowUp(bool isLeft);
559
560 void OnTimelineItemMove(const wxPoint& pos);
561 void OnTimelineItemChangeLeft(const wxPoint& pos);
562 void OnTimelineItemChangeRight(const wxPoint& pos);
563
564 void ShowContextMenu(const wxPoint& pos);
565 void SendItemEvent(wxEventType evtType, int index);
566
567 typename TimelineItemVector::iterator FindItem(T* data)
568 {
569 for (auto it = m_items.begin(); it != m_items.end(); ++it)
570 {
571 if (it->Data == data)
572 return it;
573 }
574 return m_items.end();
575 }
576
578
579private:
581
583
584 // Active task being dragged/hovered
585 typename TimelineItemVector::iterator m_activeTask;
586 typename TimelineItemVector::iterator m_lastTask;
587 typename TimelineItemVector::iterator m_visibleItemBegin;
588 typename TimelineItemVector::iterator m_visibleItemEnd;
589
590 // Selected items
591 wxVector<size_t> m_selectedItems;
592
596 wxPoint m_ptEndPos;
597
602
603 wxString FormatTime(int seconds) const
604 {
605 int minutes = seconds / 60;
606 int secs = seconds % 60;
607 return wxString::Format("%d:%02d", minutes, secs);
608 }
609
610 wxBitmap m_buffer;
611
612 wxTimer m_timerMove;
613
616
620
624
627
628 wxDateTime m_startTime;
629
645
647
650
652
657
661
662 // State for scroller item dragging
666
667 // Sizing constants
669 int m_GapHeight = 7;
670 int m_ArrowWidth = 14;
679
685
689
692
695
699
702
705
708};
709
710#include "wxTimelineCtrl_impl.h"
711
712#endif // _WX_TIMELINE_CTRL_H
TimelineElementState
Definition TimelineItem.h:12
Definition FloatingItemPopupWindow.h:14
Definition TimelineArtProvider.h:15
void SetBackgroundColour(const wxColour &colour)
Definition TimelineArtProvider.h:205
Definition TimelineItem.h:22
Definition wxTimelineCtrl.h:38
void SetEventHandlers()
Definition wxTimelineCtrl_impl.h:66
int m_minVisibleDuration
Definition wxTimelineCtrl.h:625
int m_moveDirection
Definition wxTimelineCtrl.h:651
wxRect m_dropIndicatorRect
Definition wxTimelineCtrl.h:706
void ToggleItemSelection(size_t index)
Definition wxTimelineCtrl.h:173
void OnTimelineItemChangeRight(const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1157
void CenterOnTime(int seconds)
Definition wxTimelineCtrl.h:489
bool m_isSelecting
Definition wxTimelineCtrl.h:598
wxVector< TimelineItem< T > > TimelineItemVector
Definition wxTimelineCtrl.h:40
void OnArrowDown(bool isLeft)
Definition wxTimelineCtrl_impl.h:1968
TimelineItem< T > m_detachedDragItemVisual
Definition wxTimelineCtrl.h:681
void SetFirstVisibleTime(int seconds)
Definition wxTimelineCtrl_impl.h:2029
int m_dragScrollerItemInitialClickTimeOffset
Definition wxTimelineCtrl.h:691
int GetLastVisibleTime() const
Definition wxTimelineCtrl.h:393
wxCursor GetCursorFromType(ElementType type)
Definition wxTimelineCtrl_impl.h:1786
wxSize m_floatingItemVisualSize
Definition wxTimelineCtrl.h:698
wxRect m_rectScroller
Definition wxTimelineCtrl.h:632
ElementType
Definition wxTimelineCtrl.h:44
@ ET_VISIBLE_FRAME
Definition wxTimelineCtrl.h:48
@ ET_MAX
Definition wxTimelineCtrl.h:57
@ ET_VISIBLE_FRAME_RIGHT
Definition wxTimelineCtrl.h:50
@ ET_NONE
Definition wxTimelineCtrl.h:45
@ ET_TIMELINE
Definition wxTimelineCtrl.h:46
@ ET_RIGHT_ARROW
Definition wxTimelineCtrl.h:52
@ ET_TIMELINE_ITEM_MAX
Definition wxTimelineCtrl.h:55
@ ET_LEFT_ARROW
Definition wxTimelineCtrl.h:51
@ ET_VISIBLE_FRAME_LEFT
Definition wxTimelineCtrl.h:49
@ ET_TIMELINE_SELECTION
Definition wxTimelineCtrl.h:56
@ ET_SCROLLER_ITEM_DRAG
Definition wxTimelineCtrl.h:53
@ ET_TIMELINE_ITEM
Definition wxTimelineCtrl.h:54
@ ET_SCROLLER
Definition wxTimelineCtrl.h:47
int ScrollerCoordToTime(int coord) const
Definition wxTimelineCtrl_impl.h:2118
void OnLeaveElement(ElementType type)
Definition wxTimelineCtrl_impl.h:946
int m_dragVisibleDuration
Definition wxTimelineCtrl.h:654
wxPoint m_selectionStart
Definition wxTimelineCtrl.h:599
wxRect m_originalPositionPlaceholderRectScroller
Definition wxTimelineCtrl.h:687
void OnVisibleFrameDrag(const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1838
void OnTimelineUp(const wxPoint &pos, ElementType type)
Definition wxTimelineCtrl_impl.h:1030
int m_hoveredScrollerItemIndex
Definition wxTimelineCtrl.h:663
int m_dragPreviewTime
Definition wxTimelineCtrl.h:655
wxBitmap m_buffer
Definition wxTimelineCtrl.h:610
wxRect m_rectLeftArrowDraw
Definition wxTimelineCtrl.h:638
wxRect m_rectTimeline
Definition wxTimelineCtrl.h:631
void OnVisibleFrameUp(const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1806
void OnTimer(wxTimerEvent &evt)
Definition wxTimelineCtrl_impl.h:1180
bool IsItemSelected(size_t index) const
Definition wxTimelineCtrl.h:167
int m_visibleDuration
Definition wxTimelineCtrl.h:621
void OnSize(wxSizeEvent &evt)
Definition wxTimelineCtrl_impl.h:345
void AddItem(T *data, const wxColour &colour=wxNullColour)
Definition wxTimelineCtrl_impl.h:2242
int m_maxVisibleDuration
Definition wxTimelineCtrl.h:626
void SetTotalDuration(int seconds)
Definition wxTimelineCtrl_impl.h:2141
void RemoveContextScrollerItem()
Definition wxTimelineCtrl_impl.h:2314
wxPoint m_cursorToDetachedVisualOffset
Definition wxTimelineCtrl.h:690
void OnVisibleFrameDown(const wxPoint &pos, ElementType type)
Definition wxTimelineCtrl_impl.h:1821
TimelineItemVector::iterator m_lastTask
Definition wxTimelineCtrl.h:586
void RemoveSelectedItems()
Definition wxTimelineCtrl_impl.h:2272
void OnMouseDown(ElementType type, const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1464
int m_contextMenuItemIndex
Definition wxTimelineCtrl.h:665
wxColour m_originalPositionPlaceholderColour
Definition wxTimelineCtrl.h:688
void AdjustMainViewToScrollerView()
Definition wxTimelineCtrl_impl.h:2207
void OnMouse(wxMouseEvent &evt)
Definition wxTimelineCtrl_impl.h:598
void OnEraseBackground(wxEraseEvent &evt)
Definition wxTimelineCtrl_impl.h:116
wxTimelineCtrl()
Definition wxTimelineCtrl.h:61
void RecalcVisibleFrame()
Definition wxTimelineCtrl_impl.h:386
bool m_mouseDown
Definition wxTimelineCtrl.h:649
int TimelineCoordToTime(int coord)
Definition wxTimelineCtrl.h:503
void SelectItem(size_t index, bool clearPrevious=true)
Definition wxTimelineCtrl.h:184
int m_colorCounter
Definition wxTimelineCtrl.h:646
wxRect m_rectScrollerTimeScale
Definition wxTimelineCtrl.h:641
wxColour GetItemColor(T *data) const
Definition wxTimelineCtrl.h:367
void OnTimelineItemChangeLeft(const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1131
void TimeChanged()
Definition wxTimelineCtrl_impl.h:1381
bool m_isDraggingFloatingItem
Definition wxTimelineCtrl.h:693
static const int MAX_ITEMS
Definition wxTimelineCtrl.h:41
wxDateTime m_startTime
Definition wxTimelineCtrl.h:628
void DrawScroller(wxDC &dc)
Definition wxTimelineCtrl_impl.h:256
int m_resizeBorder
Definition wxTimelineCtrl.h:678
int TimelineTimeToCoord(int time)
Definition wxTimelineCtrl.h:496
wxRect m_rectRightArrow
Definition wxTimelineCtrl.h:637
ElementType m_selectedElement
Definition wxTimelineCtrl.h:643
int m_minScrollerVisibleDuration
Definition wxTimelineCtrl.h:619
void DrawTimeline(wxDC &dc)
Definition wxTimelineCtrl_impl.h:141
void OnArrowUp(bool isLeft)
Definition wxTimelineCtrl_impl.h:1989
wxRect m_rectTimelineMain
Definition wxTimelineCtrl.h:639
void ClearSelection()
Definition wxTimelineCtrl.h:151
int GetTotalDuration() const
Definition wxTimelineCtrl.h:387
wxRect m_rectTimelineTrack
Definition wxTimelineCtrl.h:634
TimelineItem< T > m_floatingItemVisualData
Definition wxTimelineCtrl.h:696
wxColour GetItemColor(size_t index) const
Definition wxTimelineCtrl.h:359
void Zoom(int deltaSeconds)
Definition wxTimelineCtrl.h:454
void SetVisibleDuration(int seconds)
Definition wxTimelineCtrl_impl.h:2072
void Init()
Definition wxTimelineCtrl_impl.h:4
wxRect m_rectBackground
Definition wxTimelineCtrl.h:630
wxRect m_dropTargetOnScrollerRect
Definition wxTimelineCtrl.h:704
void SetZoomLevel(int zoomLevelSeconds)
Definition wxTimelineCtrl.h:224
int m_ArrowDrawWidth
Definition wxTimelineCtrl.h:671
wxRect m_rectScrollerTrack
Definition wxTimelineCtrl.h:633
int ClampFirstVisibleTime(int first) const
Definition wxTimelineCtrl_impl.h:2262
void SwapItems(T *item1, T *item2)
Definition wxTimelineCtrl.h:337
wxSize m_detachedDragItemSize
Definition wxTimelineCtrl.h:684
void SetDefaultDuration(int seconds)
Definition wxTimelineCtrl.h:383
void SetVisibleTimeRange(int startSeconds, int endSeconds)
Definition wxTimelineCtrl.h:395
void OnKeyDown(wxKeyEvent &evt)
Definition wxTimelineCtrl_impl.h:1262
wxRect m_rectTimelineTimeScale
Definition wxTimelineCtrl.h:642
int m_scrollerFirstVisibleTime
Definition wxTimelineCtrl.h:617
virtual ~wxTimelineCtrl()
Definition wxTimelineCtrl.h:68
void RecalcRects()
Definition wxTimelineCtrl_impl.h:354
wxPoint m_selectionEnd
Definition wxTimelineCtrl.h:600
void ZoomToTimePoint(int timePoint, int zoomLevel=-1)
Definition wxTimelineCtrl.h:127
int m_dragFirstVisibleTime
Definition wxTimelineCtrl.h:653
int m_draggedScrollerItemIndex
Definition wxTimelineCtrl.h:664
wxPoint m_detachedDragItemScreenPos
Definition wxTimelineCtrl.h:683
void OnTimelineDrag(const wxPoint &pos, ElementType type)
Definition wxTimelineCtrl_impl.h:1041
wxRect m_dropIndicatorRectScroller
Definition wxTimelineCtrl.h:707
TimelineItemVector::iterator m_visibleItemBegin
Definition wxTimelineCtrl.h:587
void Draw(wxDC &dc)
Definition wxTimelineCtrl_impl.h:119
bool SetItemColor(T *data, const wxColour &colour)
Definition wxTimelineCtrl.h:263
int m_ArrowDrawHeight
Definition wxTimelineCtrl.h:672
wxRect m_selectionRect
Definition wxTimelineCtrl.h:601
int m_TimelineVMargin
Definition wxTimelineCtrl.h:676
void CalcMaxVisibleDuration()
Definition wxTimelineCtrl_impl.h:2012
wxPoint m_cursorToFloatingWinOffset
Definition wxTimelineCtrl.h:700
void OnScrollerDown(const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1960
int GetFirstVisibleTime() const
Definition wxTimelineCtrl.h:392
int m_defaultDuration
Definition wxTimelineCtrl.h:622
void SetZoomPreset(ZoomPreset preset)
Definition wxTimelineCtrl.h:474
TimelineItemVector::iterator FindItem(T *data)
Definition wxTimelineCtrl.h:567
void RecalcItems()
Definition wxTimelineCtrl_impl.h:440
TimelineElementState m_stateLeftArrow
Definition wxTimelineCtrl.h:658
wxTimelineCtrl(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
Definition wxTimelineCtrl.h:62
int m_GapHeight
Definition wxTimelineCtrl.h:669
void SendItemEvent(wxEventType evtType, int index)
Definition wxTimelineCtrl_impl.h:2002
void ChangeLastElement(ElementType type)
Definition wxTimelineCtrl_impl.h:1457
int GetDefaultDuration() const
Definition wxTimelineCtrl.h:384
bool m_isSnapping
Definition wxTimelineCtrl.h:656
TimelineArtProvider * m_artProvider
Definition wxTimelineCtrl.h:580
bool SetItemColor(size_t index, const wxColour &colour)
Definition wxTimelineCtrl.h:252
void UpdateTotalDurationForItems()
Definition wxTimelineCtrl.h:279
wxPoint m_dragCurrentPos
Definition wxTimelineCtrl.h:594
void OnEnterElement(ElementType type)
Definition wxTimelineCtrl_impl.h:903
wxTimer m_timerMove
Definition wxTimelineCtrl.h:612
int m_scrollerVisibleDuration
Definition wxTimelineCtrl.h:618
FloatingItemPopupWindow< T > * m_pFloatingItemWin
Definition wxTimelineCtrl.h:694
bool m_showOriginalPositionPlaceholder
Definition wxTimelineCtrl.h:686
int m_clickToItemTimeOffset
Definition wxTimelineCtrl.h:701
void OnTimelineDown(const wxPoint &pos, ElementType type)
Definition wxTimelineCtrl_impl.h:990
wxRect m_rectLeftArrow
Definition wxTimelineCtrl.h:637
int m_ArrowWidth
Definition wxTimelineCtrl.h:670
void ZoomAtPosition(int deltaSeconds, int fixedTimePosition=-1)
Definition wxTimelineCtrl.h:417
bool m_showDropTargetOnScroller
Definition wxTimelineCtrl.h:703
const wxVector< size_t > & GetSelectedItems() const
Definition wxTimelineCtrl.h:161
void OnPaint(wxPaintEvent &evt)
Definition wxTimelineCtrl_impl.h:108
wxVector< size_t > m_selectedItems
Definition wxTimelineCtrl.h:591
void OnMouseUp(ElementType type, const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1635
int m_totalDuration
Definition wxTimelineCtrl.h:614
void ShowContextMenu(const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1215
int GetVisibleDuration() const
Definition wxTimelineCtrl.h:415
void OnMouseDrag(ElementType type, const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1507
wxRect m_rectVisibleFrameRight
Definition wxTimelineCtrl.h:636
ElementType m_lastElement
Definition wxTimelineCtrl.h:644
bool m_mouseCaptured
Definition wxTimelineCtrl.h:648
ElementType GetElementFromPos(const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1390
TimelineItemVector m_items
Definition wxTimelineCtrl.h:582
TimelineElementState m_stateRightArrow
Definition wxTimelineCtrl.h:659
int m_ScrollerHeight
Definition wxTimelineCtrl.h:668
bool m_isDraggingDetachedItem
Definition wxTimelineCtrl.h:680
int m_ScrollerVMargin
Definition wxTimelineCtrl.h:677
wxColour GetItemColour(int index)
Definition wxTimelineCtrl.h:347
void RemoveItem(T *data)
Definition wxTimelineCtrl.h:308
int m_detachedDragItemOriginalIndex
Definition wxTimelineCtrl.h:682
wxRect m_rectScrollerMain
Definition wxTimelineCtrl.h:640
int m_ScrollerTimeScaleHeight
Definition wxTimelineCtrl.h:673
void SetStartTime(const wxDateTime &val)
Definition wxTimelineCtrl.h:380
int m_floatingItemOriginalIndex
Definition wxTimelineCtrl.h:697
void ClearItems()
Definition wxTimelineCtrl.h:330
void ZoomToSelection()
Definition wxTimelineCtrl.h:88
int m_TimelineTimeScaleHeight
Definition wxTimelineCtrl.h:674
TimelineElementState m_stateVisibleFrame
Definition wxTimelineCtrl.h:660
wxDateTime GetStartTime() const
Definition wxTimelineCtrl.h:381
void OnMouseCaptureLost(wxMouseCaptureLostEvent &evt)
Definition wxTimelineCtrl_impl.h:980
int m_firstVisibleTime
Definition wxTimelineCtrl.h:615
wxPoint m_dragStartPos
Definition wxTimelineCtrl.h:593
bool Create(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
Definition wxTimelineCtrl.h:75
wxString FormatTime(int seconds) const
Definition wxTimelineCtrl.h:603
int GetZoomLevel() const
Definition wxTimelineCtrl.h:219
int m_totalTime
Definition wxTimelineCtrl.h:623
TimelineItemVector::iterator m_activeTask
Definition wxTimelineCtrl.h:585
void ShowAllTimeline()
Definition wxTimelineCtrl.h:240
void OnTimelineItemMove(const wxPoint &pos)
Definition wxTimelineCtrl_impl.h:1048
TimelineItemVector::iterator m_visibleItemEnd
Definition wxTimelineCtrl.h:588
int m_MinItemSize
Definition wxTimelineCtrl.h:675
wxRect m_rectRightArrowDraw
Definition wxTimelineCtrl.h:638
wxRect m_rectVisibleFrameLeft
Definition wxTimelineCtrl.h:636
wxRect m_rectVisibleFrame
Definition wxTimelineCtrl.h:635
wxPoint m_ptEndPos
Definition wxTimelineCtrl.h:596
int ScrollerTimeToCoord(int time)
Definition wxTimelineCtrl_impl.h:2129
ZoomPreset
Definition wxTimelineCtrl.h:464
@ ZOOM_MINUTES_10
Definition wxTimelineCtrl.h:470
@ ZOOM_ALL
Definition wxTimelineCtrl.h:471
@ ZOOM_MINUTES_2
Definition wxTimelineCtrl.h:468
@ ZOOM_MINUTE_1
Definition wxTimelineCtrl.h:467
@ ZOOM_SECONDS_30
Definition wxTimelineCtrl.h:466
@ ZOOM_SECONDS_10
Definition wxTimelineCtrl.h:465
@ ZOOM_MINUTES_5
Definition wxTimelineCtrl.h:469
void CalcArrowsState()
Definition wxTimelineCtrl_impl.h:1370
wxPoint m_ptStartPos
Definition wxTimelineCtrl.h:595
@ ID_TIMELINE_DELETE_SCROLLER_ITEM
Definition wxTimelineCtrl.h:32
@ ID_TIMELINE_DELETE
Definition wxTimelineCtrl.h:31
Tval wxClip(Tval value, Tval min_val, Tval max_val)
Definition wxTimelineCtrl.h:18