@@ -53,24 +53,17 @@ DiffSideBySidePanel::DiffSideBySidePanel(wxWindow* parent)
53
53
{
54
54
m_config.Load ();
55
55
56
- #ifdef __WXMSW__
57
- m_ribbonBar->SetArtProvider (new wxRibbonMetroArtProvider);
58
- #endif
59
56
EventNotifier::Get ()->Connect (
60
57
wxEVT_NOTIFY_PAGE_CLOSING, wxNotifyEventHandler (DiffSideBySidePanel::OnPageClosing), NULL , this );
61
58
62
- Connect (ID_COPY_LEFT_TO_RIGHT,
63
- wxEVT_COMMAND_MENU_SELECTED,
64
- wxCommandEventHandler (DiffSideBySidePanel::OnMenuCopyLeft2Right));
65
- Connect (ID_COPY_LEFT_TO_RIGHT_AND_MOVE,
66
- wxEVT_COMMAND_MENU_SELECTED,
67
- wxCommandEventHandler (DiffSideBySidePanel::OnMenuCopyLeft2Right));
68
- Connect (ID_COPY_RIGHT_TO_LEFT,
69
- wxEVT_COMMAND_MENU_SELECTED,
70
- wxCommandEventHandler (DiffSideBySidePanel::OnMenuCopyRight2Left));
71
- Connect (ID_COPY_RIGHT_TO_LEFT_AND_MOVE,
72
- wxEVT_COMMAND_MENU_SELECTED,
73
- wxCommandEventHandler (DiffSideBySidePanel::OnMenuCopyRight2Left));
59
+ Connect (ID_COPY_LEFT_TO_RIGHT, wxEVT_COMMAND_MENU_SELECTED,
60
+ wxCommandEventHandler (DiffSideBySidePanel::OnMenuCopyLeft2Right));
61
+ Connect (ID_COPY_LEFT_TO_RIGHT_AND_MOVE, wxEVT_COMMAND_MENU_SELECTED,
62
+ wxCommandEventHandler (DiffSideBySidePanel::OnMenuCopyLeft2Right));
63
+ Connect (ID_COPY_RIGHT_TO_LEFT, wxEVT_COMMAND_MENU_SELECTED,
64
+ wxCommandEventHandler (DiffSideBySidePanel::OnMenuCopyRight2Left));
65
+ Connect (ID_COPY_RIGHT_TO_LEFT_AND_MOVE, wxEVT_COMMAND_MENU_SELECTED,
66
+ wxCommandEventHandler (DiffSideBySidePanel::OnMenuCopyRight2Left));
74
67
CallAfter (&DiffSideBySidePanel::DoLayout);
75
68
}
76
69
@@ -97,15 +90,13 @@ void DiffSideBySidePanel::Diff()
97
90
98
91
if (!fnLeft.Exists ()) {
99
92
::wxMessageBox (wxString() << _(" Left Side File:\n " ) << fnLeft.GetFullPath() << _(" does not exist!" ),
100
- "CodeLite",
101
- wxICON_ERROR | wxCENTER | wxOK);
93
+ "CodeLite", wxICON_ERROR | wxCENTER | wxOK);
102
94
return ;
103
95
}
104
96
105
97
if (!fnRIght.Exists ()) {
106
98
::wxMessageBox (wxString() << _(" Right Side File:\n " ) << fnRIght.GetFullPath() << _(" does not exist!" ),
107
- "CodeLite",
108
- wxICON_ERROR | wxCENTER | wxOK);
99
+ "CodeLite", wxICON_ERROR | wxCENTER | wxOK);
109
100
return ;
110
101
}
111
102
@@ -117,9 +108,8 @@ void DiffSideBySidePanel::Diff()
117
108
118
109
// Prepare the diff
119
110
clDTL d;
120
- d.Diff (m_filePickerLeft->GetPath (),
121
- m_filePickerRight->GetPath (),
122
- m_config.IsSingleViewMode () ? clDTL::kOnePane : clDTL::kTwoPanes );
111
+ d.Diff (m_filePickerLeft->GetPath (), m_filePickerRight->GetPath (),
112
+ m_config.IsSingleViewMode () ? clDTL::kOnePane : clDTL::kTwoPanes );
123
113
const clDTL::LineInfoVec_t& resultLeft = d.GetResultLeft ();
124
114
const clDTL::LineInfoVec_t& resultRight = d.GetResultRight ();
125
115
m_sequences = d.GetSequences ();
@@ -190,7 +180,7 @@ void DiffSideBySidePanel::Diff()
190
180
m_stcRight->SetSavePoint ();
191
181
192
182
// Select the first diff
193
- wxRibbonButtonBarEvent dummy;
183
+ wxCommandEvent dummy;
194
184
m_cur_sequence = -1 ;
195
185
OnNextDiffSequence (dummy);
196
186
}
@@ -342,8 +332,8 @@ void DiffSideBySidePanel::OnRightStcPainted(wxStyledTextEvent& event)
342
332
}
343
333
}
344
334
345
- void DiffSideBySidePanel::SetFilesDetails (const DiffSideBySidePanel::FileInfo& leftFile,
346
- const DiffSideBySidePanel::FileInfo& rightFile)
335
+ void DiffSideBySidePanel::SetFilesDetails (
336
+ const DiffSideBySidePanel::FileInfo& leftFile, const DiffSideBySidePanel::FileInfo& rightFile)
347
337
{
348
338
// left file
349
339
m_filePickerLeft->SetPath (leftFile.filename .GetFullPath ());
@@ -359,7 +349,7 @@ void DiffSideBySidePanel::SetFilesDetails(const DiffSideBySidePanel::FileInfo& l
359
349
if (rightFile.deleteOnExit ) m_flags |= kDeleteRightOnExit ;
360
350
}
361
351
362
- void DiffSideBySidePanel::OnNextDiffSequence (wxRibbonButtonBarEvent & event)
352
+ void DiffSideBySidePanel::OnNextDiffSequence (wxCommandEvent & event)
363
353
{
364
354
m_cur_sequence++; // advance the sequence
365
355
int firstLine = m_sequences.at (m_cur_sequence).first ;
@@ -368,7 +358,7 @@ void DiffSideBySidePanel::OnNextDiffSequence(wxRibbonButtonBarEvent& event)
368
358
DoDrawSequenceMarkers (firstLine, lastLine, m_stcRight);
369
359
}
370
360
371
- void DiffSideBySidePanel::OnPrevDiffSequence (wxRibbonButtonBarEvent & event)
361
+ void DiffSideBySidePanel::OnPrevDiffSequence (wxCommandEvent & event)
372
362
{
373
363
m_cur_sequence--;
374
364
int firstLine = m_sequences.at (m_cur_sequence).first ;
@@ -377,14 +367,12 @@ void DiffSideBySidePanel::OnPrevDiffSequence(wxRibbonButtonBarEvent& event)
377
367
DoDrawSequenceMarkers (firstLine, lastLine, m_stcRight);
378
368
}
379
369
380
- void DiffSideBySidePanel::OnRefreshDiff (wxRibbonButtonBarEvent & event)
370
+ void DiffSideBySidePanel::OnRefreshDiff (wxCommandEvent & event)
381
371
{
382
372
if (m_stcLeft->IsModified () || m_stcRight->IsModified ()) {
383
373
wxStandardID res = ::PromptForYesNoDialogWithCheckbox (
384
- _ (" Refreshing the view will lose all your changes\n Do you want to continue?" ),
385
- " DiffRefreshViewDlg" ,
386
- _ (" Refresh" ),
387
- _ (" Don't refresh" ));
374
+ _ (" Refreshing the view will lose all your changes\n Do you want to continue?" ), " DiffRefreshViewDlg" ,
375
+ _ (" Refresh" ), _ (" Don't refresh" ));
388
376
if (res != wxID_YES) {
389
377
return ;
390
378
}
@@ -451,22 +439,22 @@ void DiffSideBySidePanel::OnCopyRightToLeftUI(wxUpdateUIEvent& event)
451
439
event.Enable (!IsLeftReadOnly () && !m_config.IsSingleViewMode ());
452
440
}
453
441
454
- void DiffSideBySidePanel::OnCopyLeftToRight (wxRibbonButtonBarEvent & event)
442
+ void DiffSideBySidePanel::OnCopyLeftToRight (wxCommandEvent & event)
455
443
{
456
444
bool moveToNext = m_config.GetFlags () & DiffConfig::kCopyLeftToRightAndMove ;
457
445
DoCopyCurrentSequence (m_stcLeft, m_stcRight);
458
446
if (moveToNext && CanNextDiff ()) {
459
- wxRibbonButtonBarEvent dummy;
447
+ wxCommandEvent dummy;
460
448
OnNextDiffSequence (dummy);
461
449
}
462
450
}
463
451
464
- void DiffSideBySidePanel::OnCopyRightToLeft (wxRibbonButtonBarEvent & event)
452
+ void DiffSideBySidePanel::OnCopyRightToLeft (wxCommandEvent & event)
465
453
{
466
454
bool moveToNext = m_config.GetFlags () & DiffConfig::kCopyRightToLeftAndMove ;
467
455
DoCopyCurrentSequence (m_stcRight, m_stcLeft);
468
456
if (moveToNext && CanNextDiff ()) {
469
- wxRibbonButtonBarEvent dummy;
457
+ wxCommandEvent dummy;
470
458
OnNextDiffSequence (dummy);
471
459
}
472
460
}
@@ -519,11 +507,8 @@ void DiffSideBySidePanel::DoCopyCurrentSequence(wxStyledTextCtrl* from, wxStyled
519
507
to->SetReadOnly (true );
520
508
}
521
509
522
- void DiffSideBySidePanel::DoGetPositionsToCopy (wxStyledTextCtrl* stc,
523
- int & startPos,
524
- int & endPos,
525
- int & placeHolderMarkerFirstLine,
526
- int & placeHolderMarkerLastLine)
510
+ void DiffSideBySidePanel::DoGetPositionsToCopy (
511
+ wxStyledTextCtrl* stc, int & startPos, int & endPos, int & placeHolderMarkerFirstLine, int & placeHolderMarkerLastLine)
527
512
{
528
513
startPos = wxNOT_FOUND;
529
514
endPos = wxNOT_FOUND;
@@ -565,7 +550,7 @@ void DiffSideBySidePanel::DoSave(wxStyledTextCtrl* stc, const wxFileName& fn)
565
550
EventNotifier::Get ()->PostReloadExternallyModifiedEvent (false );
566
551
}
567
552
568
- void DiffSideBySidePanel::OnSaveChanges (wxRibbonButtonBarEvent & event)
553
+ void DiffSideBySidePanel::OnSaveChanges (wxCommandEvent & event)
569
554
{
570
555
DoSave (m_stcLeft, m_filePickerLeft->GetPath ());
571
556
DoSave (m_stcRight, m_filePickerRight->GetPath ());
@@ -589,12 +574,12 @@ bool DiffSideBySidePanel::CanPrevDiff()
589
574
return !m_sequences.empty () && canPrev;
590
575
}
591
576
592
- void DiffSideBySidePanel::OnCopyFileFromRight (wxRibbonButtonBarEvent & event)
577
+ void DiffSideBySidePanel::OnCopyFileFromRight (wxCommandEvent & event)
593
578
{
594
579
DoCopyFileContent (m_stcRight, m_stcLeft);
595
580
}
596
581
597
- void DiffSideBySidePanel::OnCopyFileLeftToRight (wxRibbonButtonBarEvent & event)
582
+ void DiffSideBySidePanel::OnCopyFileLeftToRight (wxCommandEvent & event)
598
583
{
599
584
DoCopyFileContent (m_stcLeft, m_stcRight);
600
585
}
@@ -630,7 +615,7 @@ void DiffSideBySidePanel::OnPageClosing(wxNotifyEvent& event)
630
615
}
631
616
}
632
617
633
- void DiffSideBySidePanel::OnHorizontal (wxRibbonButtonBarEvent & event)
618
+ void DiffSideBySidePanel::OnHorizontal (wxCommandEvent & event)
634
619
{
635
620
m_splitter->Unsplit ();
636
621
m_splitter->SplitHorizontally (m_splitterPageLeft, m_splitterPageRight);
@@ -640,7 +625,7 @@ void DiffSideBySidePanel::OnHorizontal(wxRibbonButtonBarEvent& event)
640
625
641
626
void DiffSideBySidePanel::OnHorizontalUI (wxUpdateUIEvent& event) { event.Check (m_config.IsSplitHorizontal ()); }
642
627
643
- void DiffSideBySidePanel::OnVertical (wxRibbonButtonBarEvent & event)
628
+ void DiffSideBySidePanel::OnVertical (wxCommandEvent & event)
644
629
{
645
630
m_splitter->Unsplit ();
646
631
m_splitter->SplitVertically (m_splitterPageLeft, m_splitterPageRight);
@@ -674,37 +659,6 @@ wxString DiffSideBySidePanel::DoGetContentNoPlaceholders(wxStyledTextCtrl* stc)
674
659
return newContent;
675
660
}
676
661
677
- void DiffSideBySidePanel::OnCopyLeftToRightMenu (wxRibbonButtonBarEvent& event)
678
- {
679
- size_t flags = m_config.GetFlags ();
680
- bool copyAndMove = flags & DiffConfig::kCopyLeftToRightAndMove ;
681
-
682
- wxMenu menu;
683
- menu.Append (ID_COPY_LEFT_TO_RIGHT, _ (" Copy to the right" ), wxEmptyString, wxITEM_RADIO);
684
- menu.Check (ID_COPY_LEFT_TO_RIGHT, !copyAndMove);
685
-
686
- menu.Append (
687
- ID_COPY_LEFT_TO_RIGHT_AND_MOVE, _ (" Copy to the right and move to the next diff" ), wxEmptyString, wxITEM_RADIO);
688
- menu.Check (ID_COPY_LEFT_TO_RIGHT_AND_MOVE, copyAndMove);
689
-
690
- event.PopupMenu (&menu);
691
- }
692
-
693
- void DiffSideBySidePanel::OnCopyRightToLeftMenu (wxRibbonButtonBarEvent& event)
694
- {
695
- size_t flags = m_config.GetFlags ();
696
- bool copyAndMove = flags & DiffConfig::kCopyRightToLeftAndMove ;
697
-
698
- wxMenu menu;
699
- menu.Append (ID_COPY_RIGHT_TO_LEFT, _ (" Copy to the left" ), wxEmptyString, wxITEM_RADIO);
700
- menu.Check (ID_COPY_RIGHT_TO_LEFT, !copyAndMove);
701
-
702
- menu.Append (
703
- ID_COPY_RIGHT_TO_LEFT_AND_MOVE, _ (" Copy to the left and move to the next diff" ), wxEmptyString, wxITEM_RADIO);
704
- menu.Check (ID_COPY_RIGHT_TO_LEFT_AND_MOVE, copyAndMove);
705
- event.PopupMenu (&menu);
706
- }
707
-
708
662
void DiffSideBySidePanel::OnMenuCopyLeft2Right (wxCommandEvent& event)
709
663
{
710
664
size_t flags = m_config.GetFlags ();
@@ -733,7 +687,7 @@ void DiffSideBySidePanel::OnMenuCopyRight2Left(wxCommandEvent& event)
733
687
734
688
void DiffSideBySidePanel::OnSingleUI (wxUpdateUIEvent& event) { event.Check (m_config.IsSingleViewMode ()); }
735
689
736
- void DiffSideBySidePanel::OnSingleView (wxRibbonButtonBarEvent & event)
690
+ void DiffSideBySidePanel::OnSingleView (wxCommandEvent & event)
737
691
{
738
692
m_config.SetViewMode (DiffConfig::kViewSingle );
739
693
m_splitter->Unsplit ();
0 commit comments