Skip to content

Commit 67dec6a

Browse files
committed
clang-format fix
Signed-off-by: Vlad Erium <shaamaan@gmail.com>
1 parent 4e5a67d commit 67dec6a

38 files changed

+4634
-4470
lines changed

src/imiv/external/imgui_impl_metal_imiv.mm

Lines changed: 529 additions & 374 deletions
Large diffs are not rendered by default.

src/imiv/imiv_actions.cpp

Lines changed: 377 additions & 378 deletions
Large diffs are not rendered by default.

src/imiv/imiv_actions.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,15 @@ next_sibling_image_action(RendererState& renderer_state, ViewerState& viewer,
8282
PlaceholderUiState& ui_state, int delta);
8383
void
8484
toggle_image_action(RendererState& renderer_state, ViewerState& viewer,
85-
ImageLibraryState& library,
86-
PlaceholderUiState& ui_state);
85+
ImageLibraryState& library, PlaceholderUiState& ui_state);
8786
void
8887
change_subimage_action(RendererState& renderer_state, ViewerState& viewer,
89-
ImageLibraryState& library,
90-
PlaceholderUiState& ui_state, int delta);
88+
ImageLibraryState& library, PlaceholderUiState& ui_state,
89+
int delta);
9190
void
9291
change_miplevel_action(RendererState& renderer_state, ViewerState& viewer,
93-
ImageLibraryState& library,
94-
PlaceholderUiState& ui_state, int delta);
92+
ImageLibraryState& library, PlaceholderUiState& ui_state,
93+
int delta);
9594
void
9695
queue_auto_subimage_from_zoom(ViewerState& viewer);
9796
bool

src/imiv/imiv_app.cpp

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "imiv_app.h"
66
#include "imiv_actions.h"
7+
#include "imiv_build_config.h"
78
#include "imiv_drag_drop.h"
89
#include "imiv_file_dialog.h"
910
#include "imiv_frame.h"
@@ -17,7 +18,6 @@
1718
#include "imiv_types.h"
1819
#include "imiv_ui.h"
1920
#include "imiv_viewer.h"
20-
#include "imiv_build_config.h"
2121

2222
#include <algorithm>
2323
#include <array>
@@ -77,30 +77,29 @@ namespace {
7777
}
7878

7979
ImFont* load_embedded_font_if_present(const unsigned char* data,
80-
size_t size_bytes,
81-
float size_pixels)
80+
size_t size_bytes, float size_pixels)
8281
{
8382
if (data == nullptr || size_bytes == 0)
8483
return nullptr;
8584
ImGuiIO& io = ImGui::GetIO();
8685
ImFontConfig config;
8786
config.FontDataOwnedByAtlas = false;
88-
return io.Fonts->AddFontFromMemoryTTF(
89-
const_cast<unsigned char*>(data), static_cast<int>(size_bytes),
90-
size_pixels, &config);
87+
return io.Fonts->AddFontFromMemoryTTF(const_cast<unsigned char*>(data),
88+
static_cast<int>(size_bytes),
89+
size_pixels, &config);
9190
}
9291

9392
AppFonts setup_app_fonts(bool verbose_logging)
9493
{
9594
AppFonts fonts;
96-
ImGuiIO& io = ImGui::GetIO();
95+
ImGuiIO& io = ImGui::GetIO();
9796
const char* ui_font_source = "missing";
9897
const char* mono_font_source = "missing";
9998

10099
const std::filesystem::path font_root = executable_directory_path()
101100
/ "fonts";
102-
const std::filesystem::path ui_font_path
103-
= font_root / "Droid_Sans" / "DroidSans.ttf";
101+
const std::filesystem::path ui_font_path = font_root / "Droid_Sans"
102+
/ "DroidSans.ttf";
104103
const std::filesystem::path mono_font_path
105104
= font_root / "Droid_Sans_Mono" / "DroidSansMono.ttf";
106105

@@ -110,9 +109,10 @@ namespace {
110109
16.0f);
111110
if (fonts.ui)
112111
ui_font_source = "embedded";
113-
fonts.mono = load_embedded_font_if_present(
114-
g_imiv_font_droidsansmono_ttf, g_imiv_font_droidsansmono_ttf_size,
115-
16.0f);
112+
fonts.mono
113+
= load_embedded_font_if_present(g_imiv_font_droidsansmono_ttf,
114+
g_imiv_font_droidsansmono_ttf_size,
115+
16.0f);
116116
if (fonts.mono)
117117
mono_font_source = "embedded";
118118
#endif
@@ -128,19 +128,18 @@ namespace {
128128
mono_font_source = "file";
129129
}
130130
if (!fonts.ui) {
131-
fonts.ui = io.Fonts->AddFontDefault();
131+
fonts.ui = io.Fonts->AddFontDefault();
132132
ui_font_source = "default";
133133
}
134134
if (!fonts.mono) {
135-
fonts.mono = fonts.ui;
135+
fonts.mono = fonts.ui;
136136
mono_font_source = (fonts.ui == fonts.mono && ui_font_source)
137137
? ui_font_source
138138
: "default";
139139
}
140140
io.FontDefault = fonts.ui;
141141

142-
print("imiv: fonts ui={} mono={}\n", ui_font_source,
143-
mono_font_source);
142+
print("imiv: fonts ui={} mono={}\n", ui_font_source, mono_font_source);
144143
return fonts;
145144
}
146145

@@ -242,7 +241,7 @@ namespace {
242241
}
243242

244243
BackendKind requested_backend_for_launch(const AppConfig& config,
245-
const PlaceholderUiState& ui_state)
244+
const PlaceholderUiState& ui_state)
246245
{
247246
if (config.requested_backend != BackendKind::Auto)
248247
return config.requested_backend;
@@ -255,9 +254,10 @@ namespace {
255254
backend_cli_name(active_backend));
256255
}
257256

258-
std::vector<std::string>
259-
expand_startup_input_paths(const AppConfig& config, bool verbose_logging,
260-
ImageSortMode sort_mode, bool sort_reverse)
257+
std::vector<std::string> expand_startup_input_paths(const AppConfig& config,
258+
bool verbose_logging,
259+
ImageSortMode sort_mode,
260+
bool sort_reverse)
261261
{
262262
std::vector<std::string> expanded;
263263
for (const std::string& input_path : config.input_paths) {
@@ -266,10 +266,10 @@ namespace {
266266
if (std::filesystem::is_directory(path, ec) && !ec) {
267267
std::vector<std::string> directory_paths;
268268
std::string error_message;
269-
if (!collect_directory_image_paths(input_path,
270-
sort_mode, sort_reverse,
271-
directory_paths,
272-
error_message)) {
269+
if (!collect_directory_image_paths(input_path, sort_mode,
270+
sort_reverse,
271+
directory_paths,
272+
error_message)) {
273273
print(stderr, "imiv: {}\n", error_message);
274274
continue;
275275
}
@@ -328,12 +328,11 @@ run(const AppConfig& config)
328328
= Strutil::fmt::format("failed to load preferences: {}",
329329
prefs_error);
330330
}
331-
run_config.input_paths = expand_startup_input_paths(run_config,
332-
run_config.verbose,
333-
library.sort_mode,
334-
library.sort_reverse);
335-
const BackendKind requested_backend = requested_backend_for_launch(
336-
run_config, ui_state);
331+
run_config.input_paths
332+
= expand_startup_input_paths(run_config, run_config.verbose,
333+
library.sort_mode, library.sort_reverse);
334+
const BackendKind requested_backend
335+
= requested_backend_for_launch(run_config, ui_state);
337336

338337
const bool verbose_logging = run_config.verbose;
339338
const bool verbose_validation_output
@@ -406,8 +405,9 @@ run(const AppConfig& config)
406405
}
407406

408407
const std::string window_title = build_main_window_title(active_backend);
409-
GLFWwindow* window = platform_glfw_create_main_window(
410-
active_backend, 1600, 900, window_title.c_str(), startup_error);
408+
GLFWwindow* window
409+
= platform_glfw_create_main_window(active_backend, 1600, 900,
410+
window_title.c_str(), startup_error);
411411
if (window == nullptr) {
412412
print(stderr, "imiv: {}\n", startup_error);
413413
platform_glfw_terminate();
@@ -619,16 +619,19 @@ run(const AppConfig& config)
619619
bool ocio_preflight_ok = false;
620620
switch (active_backend) {
621621
case BackendKind::Vulkan:
622-
ocio_preflight_ok = preflight_ocio_runtime_shader(
623-
ui_state, nullptr, ocio_preflight_error);
622+
ocio_preflight_ok
623+
= preflight_ocio_runtime_shader(ui_state, nullptr,
624+
ocio_preflight_error);
624625
break;
625626
case BackendKind::Metal:
626-
ocio_preflight_ok = preflight_ocio_runtime_shader_metal(
627-
ui_state, nullptr, ocio_preflight_error);
627+
ocio_preflight_ok
628+
= preflight_ocio_runtime_shader_metal(ui_state, nullptr,
629+
ocio_preflight_error);
628630
break;
629631
case BackendKind::OpenGL:
630-
ocio_preflight_ok = preflight_ocio_runtime_shader_glsl(
631-
ui_state, nullptr, ocio_preflight_error);
632+
ocio_preflight_ok
633+
= preflight_ocio_runtime_shader_glsl(ui_state, nullptr,
634+
ocio_preflight_error);
632635
break;
633636
case BackendKind::Auto:
634637
ocio_preflight_error
@@ -688,9 +691,8 @@ run(const AppConfig& config)
688691
#endif
689692

690693
#if defined(IMGUI_ENABLE_TEST_ENGINE)
691-
ViewerStateJsonWriteContext test_engine_state_ctx = { &viewer, &workspace,
692-
&ui_state,
693-
active_backend };
694+
ViewerStateJsonWriteContext test_engine_state_ctx
695+
= { &viewer, &workspace, &ui_state, active_backend };
694696
TestEngineHooks test_engine_hooks;
695697
test_engine_hooks.image_window_title = image_window_title();
696698
test_engine_hooks.screen_capture = renderer_screen_capture;
@@ -746,7 +748,7 @@ run(const AppConfig& config)
746748
,
747749
test_engine_show_windows_ptr(test_engine_runtime)
748750
#endif
749-
,
751+
,
750752
window, renderer_state);
751753
if (ui_state.style_preset != applied_style_preset) {
752754
ui_state.style_preset = static_cast<int>(
@@ -773,13 +775,12 @@ run(const AppConfig& config)
773775
ImGui::RenderPlatformWindowsDefault();
774776
renderer_finish_platform_windows(renderer_state);
775777
}
776-
process_developer_post_render_actions(developer_ui,
777-
active_image_view(workspace)
778-
!= nullptr
779-
? active_image_view(workspace)
780-
->viewer
781-
: viewer,
782-
renderer_state);
778+
process_developer_post_render_actions(
779+
developer_ui,
780+
active_image_view(workspace) != nullptr
781+
? active_image_view(workspace)->viewer
782+
: viewer,
783+
renderer_state);
783784
#if defined(IMGUI_ENABLE_TEST_ENGINE)
784785
test_engine_post_swap(test_engine_runtime);
785786
#endif
@@ -811,7 +812,8 @@ run(const AppConfig& config)
811812
print(stderr, "imiv: failed to wait for renderer idle: {}\n",
812813
prefs_save_error);
813814

814-
for (const std::unique_ptr<ImageViewWindow>& view : workspace.view_windows) {
815+
for (const std::unique_ptr<ImageViewWindow>& view :
816+
workspace.view_windows) {
815817
if (view == nullptr)
816818
continue;
817819
renderer_destroy_texture(renderer_state, view->viewer.texture);

src/imiv/imiv_app.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
namespace Imiv {
1313

1414
struct AppConfig {
15-
bool verbose = false;
16-
bool foreground_mode = false;
17-
bool rawcolor = false;
18-
bool no_autopremult = false;
19-
bool open_dialog = false;
20-
bool save_dialog = false;
21-
bool list_backends = false;
22-
bool developer_mode = false;
15+
bool verbose = false;
16+
bool foreground_mode = false;
17+
bool rawcolor = false;
18+
bool no_autopremult = false;
19+
bool open_dialog = false;
20+
bool save_dialog = false;
21+
bool list_backends = false;
22+
bool developer_mode = false;
2323
bool developer_mode_explicit = false;
2424

2525
BackendKind requested_backend = BackendKind::Auto;

src/imiv/imiv_aux_windows.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,10 @@ draw_preferences_window(PlaceholderUiState& ui, bool& show_window,
271271
ImGui::Spacing();
272272
BackendKind requested_backend = sanitize_backend_kind(
273273
ui.renderer_backend);
274-
const float spacing = ImGui::GetStyle().ItemSpacing.x;
275-
const float row_width = ImGui::GetContentRegionAvail().x;
276-
const float button_width = std::max(
277-
1.0f, (row_width - spacing * 2.0f) / 3.0f);
274+
const float spacing = ImGui::GetStyle().ItemSpacing.x;
275+
const float row_width = ImGui::GetContentRegionAvail().x;
276+
const float button_width = std::max(1.0f, (row_width - spacing * 2.0f)
277+
/ 3.0f);
278278
bool have_backend_row_rect = false;
279279
ImVec2 backend_row_min(0.0f, 0.0f);
280280
ImVec2 backend_row_max(0.0f, 0.0f);
@@ -303,7 +303,8 @@ draw_preferences_window(PlaceholderUiState& ui, bool& show_window,
303303
if (!enabled)
304304
ImGui::EndDisabled();
305305
register_layout_dump_synthetic_item("button",
306-
backend_display_name(info.build_info.kind));
306+
backend_display_name(
307+
info.build_info.kind));
307308
const ImVec2 item_min = ImGui::GetItemRectMin();
308309
const ImVec2 item_max = ImGui::GetItemRectMax();
309310
if (!have_backend_row_rect) {
@@ -334,8 +335,9 @@ draw_preferences_window(PlaceholderUiState& ui, bool& show_window,
334335
const bool requested_backend_available
335336
= requested_backend == BackendKind::Auto
336337
|| backend_kind_is_available(requested_backend);
337-
const bool invalid_requested_backend = requested_backend != BackendKind::Auto
338-
&& !requested_backend_compiled;
338+
const bool invalid_requested_backend = requested_backend
339+
!= BackendKind::Auto
340+
&& !requested_backend_compiled;
339341
const bool unavailable_requested_backend
340342
= requested_backend != BackendKind::Auto
341343
&& requested_backend_compiled && !requested_backend_available;
@@ -363,8 +365,8 @@ draw_preferences_window(PlaceholderUiState& ui, bool& show_window,
363365
ImGui::TextUnformatted(
364366
"Requested backend is not built in this binary and will be ignored when Preferences closes.");
365367
} else if (unavailable_requested_backend) {
366-
const std::string_view unavailable_reason = backend_unavailable_reason(
367-
requested_backend);
368+
const std::string_view unavailable_reason
369+
= backend_unavailable_reason(requested_backend);
368370
if (unavailable_reason.empty()) {
369371
ImGui::TextUnformatted(
370372
"Requested backend is unavailable at runtime and will be ignored when Preferences closes.");
@@ -383,8 +385,7 @@ draw_preferences_window(PlaceholderUiState& ui, bool& show_window,
383385
if (!info.build_info.compiled || info.available)
384386
continue;
385387
if (info.unavailable_reason.empty()) {
386-
ImGui::Text("%s unavailable",
387-
info.build_info.display_name);
388+
ImGui::Text("%s unavailable", info.build_info.display_name);
388389
} else {
389390
ImGui::TextWrapped("%s unavailable: %s",
390391
info.build_info.display_name,
@@ -484,7 +485,8 @@ draw_preferences_window(PlaceholderUiState& ui, bool& show_window,
484485
}
485486
ImGui::End();
486487
ImGui::PopStyleVar();
487-
const BackendKind close_backend = sanitize_backend_kind(ui.renderer_backend);
488+
const BackendKind close_backend = sanitize_backend_kind(
489+
ui.renderer_backend);
488490
if (!show_window && close_backend != BackendKind::Auto
489491
&& (!backend_kind_is_compiled(close_backend)
490492
|| !backend_kind_is_available(close_backend))) {

0 commit comments

Comments
 (0)