Ardour  8.12
gtk2_ardour/utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2006 Taybin Rutkin <taybin@taybin.com>
3  * Copyright (C) 2005-2009 Nick Mainsbridge <mainsbridge@gmail.com>
4  * Copyright (C) 2005-2016 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
6  * Copyright (C) 2006 Doug McLain <doug@nostar.net>
7  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
8  * Copyright (C) 2009 David Robillard <d@drobilla.net>
9  * Copyright (C) 2009 Sampo Savolainen <v2@iki.fi>
10  * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
11  * Copyright (C) 2015 AndrĂ© Nusser <andre.nusser@googlemail.com>
12  * Copyright (C) 2015 Tim Mayberry <mojofunk@gmail.com>
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, write to the Free Software Foundation, Inc.,
26  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27  */
28 
29 #ifndef __ardour_gtk_utils_h__
30 #define __ardour_gtk_utils_h__
31 
32 #include <string>
33 #include <cmath>
34 #include <vector>
35 #include <map>
36 
37 #include "ardour/types.h"
38 
39 #include <gdkmm/types.h>
40 #include <gtkmm/menushell.h>
41 
42 #include "canvas/types.h"
43 
44 namespace PBD {
45  class Controllable;
46  class Controllable;
47  class ScopedConnectionList;
48 }
49 
50 namespace Gtk {
51  class Window;
52  class ComboBoxText;
53  class Adjustment;
54 }
55 
56 namespace ArdourCanvas {
57  class Item;
58 }
59 
60 namespace ARDOUR {
61  class Auditioner;
62  class Session;
63  class Trigger;
64 }
65 
66 namespace ARDOUR_UI_UTILS {
67 
70 
72 
73 unsigned char* xpm2rgb (const char** xpm, uint32_t& w, uint32_t& h);
74 unsigned char* xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h);
75 
76 ArdourCanvas::Points* get_canvas_points (std::string who, uint32_t npoints);
77 
78 Pango::FontDescription sanitized_font (std::string const&);
79 Pango::FontDescription ardour_font (std::string const&);
80 Pango::FontDescription get_font_for_style (std::string widgetname);
81 
83 
84 bool relay_key_press (GdkEventKey* ev, Gtk::Window* win);
86 bool emulate_key_event (unsigned int);
87 
88 Glib::RefPtr<Gdk::Pixbuf> get_xpm (std::string);
89 std::vector<std::string> get_icon_sets ();
90 void get_color_themes (std::map<std::string,std::string>&);
91 std::string get_icon_path (const char*, std::string icon_set = std::string(), bool is_image = true);
92 Glib::RefPtr<Gdk::Pixbuf> get_icon (const char*, std::string icon_set = std::string());
93 static std::map<std::string, Glib::RefPtr<Gdk::Pixbuf> > xpm_map;
94 const char* const *get_xpm_data (std::string path);
95 std::string longest (std::vector<std::string>&);
96 bool key_is_legal_for_numeric_entry (guint keyval);
97 
99 
101 
102 std::string escape_underscores (std::string const &);
103 
105 Gdk::Color unique_random_color (std::list<Gdk::Color> &);
106 
107 std::string rate_as_string (float r);
108 std::string samples_as_time_string (ARDOUR::samplecnt_t s, float r, bool show_samples = false);
109 
110 std::string midi_channels_as_string (std::bitset<16>);
111 
113 
114 bool overwrite_file_dialog (Gtk::Window& parent, std::string title, std::string text);
116 
118 
119 void copy_patch_changes (std::shared_ptr<ARDOUR::Auditioner>, std::shared_ptr<ARDOUR::Trigger>);
120 
121 bool convert_drop_to_paths (std::vector<std::string>&, const Gtk::SelectionData&);
122 
123 void format_position (ARDOUR::Session*, Temporal::timepos_t const& pos, char* buf, size_t bufsize, bool onoff = true);
124 
125 } // namespace
126 #endif /* __ardour_gtk_utils_h__ */
Definition: Window.h:41
GtkImageIconSetData icon_set
Definition: gtkimage.h:4
gint just_hide_it(GdkEventAny *, Gtk::Window *)
void resize_window_to_proportion_of_monitor(Gtk::Window *, int, int)
bool relay_key_press(GdkEventKey *ev, Gtk::Window *win)
Glib::RefPtr< Gdk::Pixbuf > get_xpm(std::string)
void add_item_with_sensitivity(Gtk::Menu_Helpers::MenuList &, Gtk::Menu_Helpers::MenuElem, bool)
std::string escape_underscores(std::string const &)
void get_color_themes(std::map< std::string, std::string > &)
unsigned char * xpm2rgba(const char **xpm, uint32_t &w, uint32_t &h)
void decorate(Gtk::Window &w, Gdk::WMDecoration d)
bool key_is_legal_for_numeric_entry(guint keyval)
int guess_default_ui_scale()
std::string midi_channels_as_string(std::bitset< 16 >)
Gdk::Color round_robin_palette_color()
const char *const * get_xpm_data(std::string path)
bool key_press_focus_accelerator_handler(Gtk::Window &window, GdkEventKey *ev)
unsigned char * xpm2rgb(const char **xpm, uint32_t &w, uint32_t &h)
std::string samples_as_time_string(ARDOUR::samplecnt_t s, float r, bool show_samples=false)
std::vector< std::string > get_icon_sets()
bool engine_is_running()
void copy_patch_changes(std::shared_ptr< ARDOUR::Auditioner >, std::shared_ptr< ARDOUR::Trigger >)
bool running_from_source_tree()
bool windows_overlap(Gtk::Window *a, Gtk::Window *b)
std::string longest(std::vector< std::string > &)
Pango::FontDescription ardour_font(std::string const &)
static std::map< std::string, Glib::RefPtr< Gdk::Pixbuf > > xpm_map
void inhibit_screensaver(bool)
std::string get_icon_path(const char *, std::string icon_set=std::string(), bool is_image=true)
bool overwrite_file_dialog(Gtk::Window &parent, std::string title, std::string text)
void format_position(ARDOUR::Session *, Temporal::timepos_t const &pos, char *buf, size_t bufsize, bool onoff=true)
Pango::FontDescription get_font_for_style(std::string widgetname)
bool convert_drop_to_paths(std::vector< std::string > &, const Gtk::SelectionData &)
Pango::FontDescription sanitized_font(std::string const &)
ArdourCanvas::Points * get_canvas_points(std::string who, uint32_t npoints)
Glib::RefPtr< Gdk::Pixbuf > get_icon(const char *, std::string icon_set=std::string())
bool emulate_key_event(unsigned int)
std::string rate_as_string(float r)
Gdk::Color unique_random_color(std::list< Gdk::Color > &)
Temporal::samplecnt_t samplecnt_t
std::vector< Duple > Points
std::shared_ptr< PBD::Controllable > Controllable
Definition: console1.h:80
Definition: ardour_ui.h:188
Definition: axis_view.h:42