Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
30 
31 #include <string>
32 #include <cmath>
33 #include <vector>
34 #include <map>
35 
36 #include "ardour/types.h"
37 
38 #include <gdkmm/types.h>
39 #include <gtkmm/menushell.h>
40 
41 #include "canvas/types.h"
42 
43 namespace PBD {
44  class Controllable;
45  class Controllable;
46  class ScopedConnectionList;
47 }
48 
49 namespace Gtk {
50  class Window;
51  class ComboBoxText;
52  class Adjustment;
53 }
54 
55 namespace ArdourCanvas {
56  class Item;
57 }
58 
59 namespace ARDOUR {
60  class Auditioner;
61  class Session;
62  class Trigger;
63 }
64 
65 namespace ARDOUR_UI_UTILS {
66 
69 
71 
72 unsigned char* xpm2rgb (const char** xpm, uint32_t& w, uint32_t& h);
73 unsigned char* xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h);
74 
75 ArdourCanvas::Points* get_canvas_points (std::string who, uint32_t npoints);
76 
77 Pango::FontDescription sanitized_font (std::string const&);
78 Pango::FontDescription ardour_font (std::string const&);
79 Pango::FontDescription get_font_for_style (std::string widgetname);
80 
82 
83 bool relay_key_press (GdkEventKey* ev, Gtk::Window* win);
85 bool emulate_key_event (unsigned int);
86 
87 Glib::RefPtr<Gdk::Pixbuf> get_xpm (std::string);
88 std::vector<std::string> get_icon_sets ();
89 void get_color_themes (std::map<std::string,std::string>&);
90 std::string get_icon_path (const char*, std::string icon_set = std::string(), bool is_image = true);
91 Glib::RefPtr<Gdk::Pixbuf> get_icon (const char*, std::string icon_set = std::string());
92 static std::map<std::string, Glib::RefPtr<Gdk::Pixbuf> > xpm_map;
93 const char* const *get_xpm_data (std::string path);
94 std::string longest (std::vector<std::string>&);
95 bool key_is_legal_for_numeric_entry (guint keyval);
96 
98 
100 
101 std::string escape_underscores (std::string const &);
102 
104 Gdk::Color unique_random_color (std::list<Gdk::Color> &);
105 
106 std::string rate_as_string (float r);
107 std::string samples_as_time_string (ARDOUR::samplecnt_t s, float r, bool show_samples = false);
108 
109 std::string midi_channels_as_string (std::bitset<16>);
110 
112 
113 bool overwrite_file_dialog (Gtk::Window& parent, std::string title, std::string text);
115 
117 
118 void copy_patch_changes (std::shared_ptr<ARDOUR::Auditioner>, std::shared_ptr<ARDOUR::Trigger>);
119 
120 bool convert_drop_to_paths (std::vector<std::string>&, const Gtk::SelectionData&);
121 
122 void format_position (ARDOUR::Session*, Temporal::timepos_t const& pos, char* buf, size_t bufsize, bool onoff = true);
123 
124 } // namespace
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