Skip to content

Commit 13e0f32

Browse files
committed
hideo-image: Working on a new UI.
1 parent d657c81 commit 13e0f32

3 files changed

Lines changed: 89 additions & 28 deletions

File tree

src/apps/hideo-images/app.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,9 @@ export Ui::Child app(State initial) {
1313
return Ui::reducer<Model>(
1414
initial,
1515
[](auto const& s) {
16-
return Kr::scaffold({
17-
.icon = Mdi::IMAGE,
18-
.title = "Images"s,
19-
.body = [&] {
20-
return s.isEditor
21-
? editor(s)
22-
: viewer(s);
23-
},
24-
});
16+
return s.isEditor
17+
? editorApp(s)
18+
: viewerApp(s);
2519
}
2620
);
2721
}

src/apps/hideo-images/editor.cpp

Lines changed: 85 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,9 @@ Ui::Child editorPreview(State const& state) {
6161

6262
Ui::Child editorToolbar(State const&) {
6363
return Kr::toolbar({
64+
6465
Ui::grow(NONE),
6566

66-
Ui::button(
67-
Model::bind<ToggleEditor>(),
68-
Ui::ButtonStyle::subtle(),
69-
Mdi::CANCEL,
70-
"Cancel"
71-
),
72-
73-
Ui::button(
74-
Model::bind<SaveImage>(),
75-
Ui::ButtonStyle::primary(),
76-
Mdi::FLOPPY,
77-
"Save Changes"
78-
),
7967
});
8068
}
8169

@@ -190,13 +178,92 @@ Ui::Child editorControls(State const& state) {
190178
Ui::slideIn(Ui::SlideFrom::BOTTOM);
191179
}
192180

193-
Ui::Child editor(State const& state) {
181+
Ui::Child editorProperties(State const& s) {
194182
return Ui::vflow(
195-
editorToolbar(state),
196-
histogram(state.hist) | Ui::pinSize(64),
197-
editorPreview(state) | Ui::grow(),
198-
editorControls(state)
183+
histogram(s.hist) | Ui::pinSize(64),
184+
Kr::separator(),
185+
Ui::vscroll(
186+
Ui::vflow(
187+
Kr::titleRow("Composition"s),
188+
Kr::sliderRow(0, Ui::SINK<f64>, "Rotation"s),
189+
Kr::separator(),
190+
191+
Kr::titleRow("Light"s),
192+
Kr::sliderRow(0, Ui::SINK<f64>, "Brightness"s),
193+
Kr::sliderRow(0, Ui::SINK<f64>, "Exposure"s),
194+
Kr::sliderRow(0, Ui::SINK<f64>, "Gamma"s),
195+
Kr::sliderRow(0, Ui::SINK<f64>, "Contrast"s),
196+
Kr::sliderRow(0, Ui::SINK<f64>, "Shadow"s),
197+
Kr::sliderRow(0, Ui::SINK<f64>, "Highlights"s),
198+
Kr::sliderRow(0, Ui::SINK<f64>, "Bloom"s),
199+
Kr::separator(),
200+
201+
Kr::titleRow("Color"s),
202+
Kr::sliderRow(0, Ui::SINK<f64>, "Temparature"s),
203+
Kr::sliderRow(0, Ui::SINK<f64>, "Tint"s),
204+
Kr::sliderRow(0, Ui::SINK<f64>, "Vibrance"s),
205+
Kr::sliderRow(0, Ui::SINK<f64>, "Saturation"s),
206+
Kr::sliderRow(0, Ui::SINK<f64>, "Sepia"s),
207+
Kr::separator(),
208+
209+
Kr::titleRow("Effects"s),
210+
Kr::sliderRow(0, Ui::SINK<f64>, "Clarity"s),
211+
Kr::sliderRow(0, Ui::SINK<f64>, "Noise"s),
212+
Kr::sliderRow(0, Ui::SINK<f64>, "Vignette"s),
213+
Kr::separator(),
214+
215+
Kr::titleRow("Curves"s),
216+
Kr::separator(),
217+
218+
Kr::titleRow("Filters"s)
219+
)
220+
) | Ui::grow()
199221
);
200222
}
201223

224+
Ui::Child editorApp(State const& s) {
225+
return Kr::scaffold({
226+
.icon = Mdi::IMAGE,
227+
.title = "Images"s,
228+
.startTools = [&] -> Ui::Children {
229+
return {
230+
Ui::button(
231+
Model::bind<ToggleEditor>(),
232+
Ui::ButtonStyle::subtle(),
233+
Mdi::UNDO
234+
),
235+
236+
Ui::button(
237+
Model::bind<ToggleEditor>(),
238+
Ui::ButtonStyle::subtle(),
239+
Mdi::REDO
240+
),
241+
};
242+
},
243+
.endTools = [&] -> Ui::Children {
244+
return {
245+
Ui::button(
246+
Model::bind<ToggleEditor>(),
247+
Ui::ButtonStyle::subtle(),
248+
Mdi::CANCEL,
249+
"Cancel"
250+
),
251+
252+
Ui::button(
253+
Model::bind<SaveImage>(),
254+
Ui::ButtonStyle::primary(),
255+
Mdi::FLOPPY,
256+
"Save Changes"
257+
),
258+
};
259+
},
260+
.body = [&] {
261+
return Ui::hflow(
262+
editorPreview(s) | Ui::grow(),
263+
editorProperties(s) | Kr::resizable(Kr::ResizeHandle::START, {320}, NONE)
264+
);
265+
},
266+
});
267+
}
268+
202269
} // namespace Hideo::Images

src/apps/hideo-images/viewer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Ui::Child viewerControls(State const&) {
4848
Ui::center();
4949
}
5050

51-
export Ui::Child viewer(State const& state) {
51+
export Ui::Child viewerApp(State const& state) {
5252
return Ui::vflow(
5353
viewerToolbar(state),
5454
viewerPreview(state) | Ui::grow(),

0 commit comments

Comments
 (0)