Debian Codegraph @

fontforgeexe/gtk/show_histogram.hpp

raw symbols SCIP
1 /* Copyright (C) 2026 by Maxim Iorsh <iorsh@[email protected]>
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5
6 * Redistributions of source code must retain the above copyright notice, this
7 * list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
12
13 * The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 #pragma once
28
29 #include "dialog_base.hpp"
30 #include "show_histogram_shim.hpp"
31 #include "widgets/histogram.hpp"
32 #include "widgets/verified_entry.hpp"
33
34 namespace ff::dlg {
35
36 class ShowHistogramDlg final : public DialogBase {
37 private:
38 ShowHistogramDlg(GWindow parent, const HistogramData& data);
39
40 Gtk::Box* build_control_box();
41 Gtk::Box* build_entry_box(const Glib::ustring& label,
42 const Glib::ustring& value,
43 widgets::VerifiedEntry& entry,
44 Glib::RefPtr<Gtk::SizeGroup> label_group);
45
46 // bar_index is the actual bar X-value, not the index in the bars vector.
47 std::string get_tooltip_text(int bar_index, double average) const;
48 void on_stem_bar_click(int bar_index, bool shift_pressed);
49 void on_blues_bar_click(int bar_index, bool /*shift_pressed*/);
50
51 HistogramData data_;
52 unsigned int max_value_ = 0;
53
54 widgets::Histogram histogram_;
55 Gtk::SpinButton average_entry_;
56 widgets::VerifiedEntry primary_entry_;
57 widgets::VerifiedEntry secondary_entry_;
58
59 static bool dict_value_verifier(const Glib::ustring& text, int& start_pos,
60 int& end_pos);
61
62 public:
63 static std::optional<PrivateDictValues> show(GWindow parent,
64 const HistogramData& data);
65 };
66
67 } // namespace ff::dlg