@@ -45,6 +45,25 @@ std::vector<std::string> OSTreeTUI::parseVisibleCommitMap(cpplibostree::OSTreeRe
45
45
return visibleCommitViewMap;
46
46
}
47
47
48
+ // / tempoorary place holder from FTXUI window example:
49
+ // / https://arthursonzogni.github.io/FTXUI/examples_2component_2window_8cpp-example.html
50
+ ftxui::Component DummyWindowContent () {
51
+ using namespace ftxui ;
52
+ class Impl : public ComponentBase {
53
+ private:
54
+ bool checked[3 ] = {false , false , false };
55
+ float slider = 50 ;
56
+ public:
57
+ Impl () {
58
+ Add (Container::Vertical ({
59
+ Checkbox (" Check me" , &checked[0 ]),
60
+ Slider (" Slider" , &slider, 0 .f , 100 .f ),
61
+ }));
62
+ }
63
+ };
64
+ return Make<Impl>();
65
+ }
66
+
48
67
int OSTreeTUI::main (const std::string& repo, const std::vector<std::string>& startupBranches, bool showTooltips) {
49
68
using namespace ftxui ;
50
69
@@ -158,14 +177,28 @@ int OSTreeTUI::main(const std::string& repo, const std::vector<std::string>& sta
158
177
* > Snappy Windows should be an abstracted element, similar to windows, but snapping back to their
159
178
* place after being dropped.
160
179
*/
161
- Component logRenderer = Scroller (&selectedCommit, CommitRender::COMMIT_DETAIL_LEVEL, Renderer ([&] {
162
- visibleCommitViewMap = parseVisibleCommitMap (ostreeRepo, visibleBranches);
163
- selectedCommit = std::min (selectedCommit, visibleCommitViewMap.size () - 1 );
164
- return CommitRender::commitRender (ostreeRepo, visibleCommitViewMap, visibleBranches, branchColorMap, selectedCommit);
165
- }));
180
+ Components windows;
181
+ for (int i{0 }; i < 20 ; i++) {
182
+ windows.push_back (Window ({
183
+ .inner = DummyWindowContent (),
184
+ .title = " Commit " + std::to_string (i),
185
+ .left = 20 ,
186
+ .top = i * 5 ,
187
+ .width = 20 ,
188
+ .height = 5 ,
189
+ }));
190
+ }
191
+
192
+ Component commitTree = Container::Stacked (windows);
193
+
194
+ // Component logRenderer = Scroller(&selectedCommit, CommitRender::COMMIT_DETAIL_LEVEL, Renderer([&] {
195
+ // visibleCommitViewMap = parseVisibleCommitMap(ostreeRepo, visibleBranches);
196
+ // selectedCommit = std::min(selectedCommit, visibleCommitViewMap.size() - 1);
197
+ // return CommitRender::commitRender(ostreeRepo, visibleCommitViewMap, visibleBranches, branchColorMap, selectedCommit);
198
+ // }));
166
199
167
200
// window specific shortcuts
168
- logRenderer = CatchEvent (logRenderer , [&](Event event) {
201
+ commitTree = CatchEvent (commitTree , [&](Event event) {
169
202
// switch through commits
170
203
if (event == Event::ArrowUp || event == Event::Character (' k' ) || (event.is_mouse () && event.mouse ().button == Mouse::WheelUp)) {
171
204
return prev_commit ();
@@ -184,10 +217,10 @@ int OSTreeTUI::main(const std::string& repo, const std::vector<std::string>& sta
184
217
int logSize{45 };
185
218
int footerSize{1 };
186
219
Component container{managerRenderer};
187
- container = ResizableSplitLeft (logRenderer , container, &logSize);
220
+ container = ResizableSplitLeft (commitTree , container, &logSize);
188
221
container = ResizableSplitBottom (footerRenderer, container, &footerSize);
189
222
190
- logRenderer ->TakeFocus ();
223
+ commitTree ->TakeFocus ();
191
224
192
225
// add application shortcuts
193
226
Component mainContainer = CatchEvent (container | border, [&](const Event& event) {
0 commit comments