wxMaxima
Loading...
Searching...
No Matches
DiffFrame.h
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2// Copyright (C) 2026 Gemini CLI
3//
4// This program is free software; you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation; either version 2 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14//
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18//
19// SPDX-License-Identifier: GPL-2.0+
20
21#ifndef DIFFFRAME_H
22#define DIFFFRAME_H
23
24#include "Worksheet.h"
25#include <wx/wx.h>
26#include <wx/srchctrl.h>
27#include <vector>
28#include <memory>
29
30class DiffFrame : public wxFrame
31{
32public:
33 DiffFrame(wxWindow *parent, const wxArrayString &files, Configuration *config);
34 virtual ~DiffFrame();
35
36private:
37 void OnScroll(wxScrollWinEvent &event);
38 void OnToggleHorizontalSync(wxCommandEvent &event);
39 void OnToggleVerticalSync(wxCommandEvent &event);
40 void OnSearch(wxCommandEvent &event);
41 void OnSearchCancel(wxCommandEvent &event);
42 void OnDiffNext(wxCommandEvent &event);
43 void OnDiffPrev(wxCommandEvent &event);
44
48 int CurrentScrollY(size_t idx) const;
52 void SyncScrollFrom(int src_idx, int y_new_src);
53
54 std::vector<Worksheet *> m_worksheets;
55 std::vector<std::unique_ptr<Configuration>> m_worksheetConfigurations;
56 Configuration *m_configuration;
57 wxSearchCtrl *m_searchCtrl = nullptr;
58 wxRadioButton *m_searchDownRadio = nullptr;
59 wxRadioButton *m_searchUpRadio = nullptr;
60 int m_currentDiffIdx = -1;
61 bool m_syncing = false;
62 bool m_syncHorizontal = true;
63 bool m_syncVertical = true;
64 bool m_searchDown = true;
65
66 void LoadFiles(const wxArrayString &files);
67 void AlignCells();
68
69 struct DiffEntry {
70 GroupCell *cells[3]; // 0, 1, 2
71 };
72 std::vector<DiffEntry> m_diffEntries;
73 std::vector<int> m_lastScrollY;
74
80 wxTimer m_resizeTimer;
81 void RelayoutWorksheets();
86 int m_lastLayoutWidth = -1;
87};
88
89#endif // DIFFFRAME_H
This file defines the class Worksheet.
The configuration storage for the current worksheet.
Definition: Configuration.h:87
Definition: DiffFrame.h:31
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:87