Ardour  9.7-336-gb784ad01ee
scale_dialog.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2026 Paul Davis <paul@linuxaudiosystems.com>
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  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #pragma once
20 
21 #include <map>
22 
23 #include "ytkmm/label.h"
24 #include "ytkmm/entry.h"
25 #include "ytkmm/spinbutton.h"
27 
28 #include "ardour/scale.h"
29 
31 
32 #include "ardour_dialog.h"
33 
34 namespace ArdourWidgets {
35  class Bracelet;
36 }
37 
38 class ScaleBox : public Gtk::VBox
39 {
40  public:
41  ScaleBox (std::string const & provider_name, bool with_remove = true);
43 
44  void set (ARDOUR::MusicalKey const *);
46 
48  void sensitize_remove (bool);
49 
50  sigc::signal<void> clear_scale;
51 
52  private:
53  static std::map<ARDOUR::MusicalModeType,std::string> type_string_map;
54  static std::map<std::string,ARDOUR::MusicalModeType> string_type_map;
55  static void fill_maps ();
56 
57  std::string provider;
59  std::unique_ptr<ARDOUR::MusicalKey> _key;
60 
61  struct StepEntry : public Gtk::Entry {
62  StepEntry (int idx) : index (idx) {}
63  int index;
64  };
65 
82 
88  bool ignore_set;
90 
92 
93  void pack_steps ();
96  void mode_changed ();
97 
100 };
101 
102 class ScaleDialog : public ArdourDialog
103 {
104  public:
105  ScaleDialog (std::string const & provider_name);
106 
107  void set (ARDOUR::MusicalKey const * key) { box.set (key); }
108  ARDOUR::MusicalKey* get() const { return box.get(); }
110  void sensitize_remove (bool yn) { box.sensitize_remove (yn); };
111 
112  protected:
114 };
ArdourWidgets::ArdourDropdown root_dropdown
Definition: scale_dialog.h:84
void twelvetone_set(ARDOUR::MusicalKey const &)
Gtk::Label scala_label
Definition: scale_dialog.h:78
void set_type(ARDOUR::MusicalModeType)
Gtk::Label name_label
Definition: scale_dialog.h:68
bool ignore_set
Definition: scale_dialog.h:88
Gtk::Label tuning_label
Definition: scale_dialog.h:71
std::unique_ptr< ARDOUR::MusicalKey > _key
Definition: scale_dialog.h:59
Gtk::SpinButton step_spinner
Definition: scale_dialog.h:74
static void fill_maps()
void set_tuning(ARDOUR::TuningSystem)
ArdourWidgets::ArdourDropdown type_dropdown
Definition: scale_dialog.h:76
Gtk::HBox type_box
Definition: scale_dialog.h:69
void fill_dropdowns(ARDOUR::TuningSystem)
void mode_changed()
ArdourWidgets::ArdourDropdown mode_dropdown
Definition: scale_dialog.h:85
bool allow_remove
Definition: scale_dialog.h:89
Gtk::FileChooserButton scala_file_button
Definition: scale_dialog.h:79
Gtk::HBox name_packer
Definition: scale_dialog.h:67
Gtk::Label steps_label
Definition: scale_dialog.h:73
void pack_steps()
Gtk::Label clear_label
Definition: scale_dialog.h:81
static std::map< ARDOUR::MusicalModeType, std::string > type_string_map
Definition: scale_dialog.h:53
Gtk::Label type_label
Definition: scale_dialog.h:70
Gtk::HBox root_mode_box
Definition: scale_dialog.h:86
Gtk::HBox steps_box
Definition: scale_dialog.h:75
Gtk::HBox scala_box
Definition: scale_dialog.h:77
ARDOUR::MusicalKey * get() const
ScaleBox(std::string const &provider_name, bool with_remove=true)
void set(ARDOUR::MusicalKey const *)
ARDOUR::MusicalKey * twelvetone_get() const
ArdourWidgets::Bracelet * bracelet
Definition: scale_dialog.h:91
static std::map< std::string, ARDOUR::MusicalModeType > string_type_map
Definition: scale_dialog.h:54
Gtk::VBox named_scale_box
Definition: scale_dialog.h:87
Gtk::VBox step_packer
Definition: scale_dialog.h:66
ARDOUR::TuningSystem _tuning
Definition: scale_dialog.h:58
void sensitize_remove(bool)
Gtk::Button clear_button
Definition: scale_dialog.h:80
std::string provider
Definition: scale_dialog.h:57
ArdourWidgets::ArdourDropdown tuning_dropdown
Definition: scale_dialog.h:83
sigc::signal< void > clear_scale
Definition: scale_dialog.h:50
Gtk::Adjustment step_adjustment
Definition: scale_dialog.h:72
void set(ARDOUR::MusicalKey const *key)
Definition: scale_dialog.h:107
void set_tuning(ARDOUR::TuningSystem ts)
Definition: scale_dialog.h:109
ScaleBox box
Definition: scale_dialog.h:110
ARDOUR::MusicalKey * get() const
Definition: scale_dialog.h:108
ScaleDialog(std::string const &provider_name)
void sensitize_remove(bool yn)
Definition: scale_dialog.h:110