Utilities module
Various utilities.
Files
- file resources.h
Classes
- struct SupportedFile
- Metadata for a supported file.
- struct CairoCaches
- Caches for cairo.
- struct MPMCQueue
- Multiple Producer Multiple Consumer lock-free queue.
- struct Stack
- Stack implementation.
- struct UiColors
- Commonly used UI colors.
- struct UiCursor
- Specification for a cursor.
- struct UiCaches
- Caches.
- struct ZrythmObject
- Base object for debugging.
Enums
- enum ZFileType { FILE_TYPE_MIDI, FILE_TYPE_MP3, FILE_TYPE_FLAC, FILE_TYPE_OGG, FILE_TYPE_WAV, FILE_TYPE_DIR, FILE_TYPE_PARENT_DIR, FILE_TYPE_OTHER, NUM_FILE_TYPES }
- File type.
- enum ZGtkFill { Z_GTK_NO_FILL, Z_GTK_FILL }
- For readability, instead of using 0s and 1s.
- enum AudioValueFormat { AUDIO_VALUE_AMPLITUDE, AUDIO_VALUE_DBFS, AUDIO_VALUE_FADER }
- enum UiCursorState { UI_CURSOR_STATE_DEFAULT, UI_CURSOR_STATE_RESIZE_L, UI_CURSOR_STATE_REPEAT_L, UI_CURSOR_STATE_RESIZE_R, UI_CURSOR_STATE_REPEAT_R, UI_CURSOR_STATE_RESIZE_UP }
- Various cursor states to be shared.
- enum UiOverlayAction { UI_OVERLAY_ACTION_NONE, UI_OVERLAY_ACTION_CREATING_RESIZING_R, UI_OVERLAY_ACTION_CREATING_MOVING, UI_OVERLAY_ACTION_RESIZING_L, UI_OVERLAY_ACTION_RESIZING_L_LOOP, UI_OVERLAY_ACTION_RESIZING_L_FADE, UI_OVERLAY_ACTION_RESIZING_R, UI_OVERLAY_ACTION_RESIZING_R_LOOP, UI_OVERLAY_ACTION_RESIZING_R_FADE, UI_OVERLAY_ACTION_RESIZING_UP, UI_OVERLAY_ACTION_RESIZING_UP_FADE_IN, UI_OVERLAY_ACTION_RESIZING_UP_FADE_OUT, UI_OVERLAY_ACTION_STRETCHING_L, UI_OVERLAY_ACTION_STRETCHING_R, UI_OVERLAY_ACTION_AUDITIONING, UI_OVERLAY_ACTION_AUTOFILLING, UI_OVERLAY_ACTION_ERASING, UI_OVERLAY_ACTION_STARTING_ERASING, UI_OVERLAY_ACTION_STARTING_MOVING, UI_OVERLAY_ACTION_STARTING_MOVING_COPY, UI_OVERLAY_ACTION_STARTING_MOVING_LINK, UI_OVERLAY_ACTION_MOVING, UI_OVERLAY_ACTION_MOVING_COPY, UI_OVERLAY_ACTION_MOVING_LINK, UI_OVERLAY_ACTION_STARTING_CHANGING_CURVE, UI_OVERLAY_ACTION_CHANGING_CURVE, UI_OVERLAY_ACTION_STARTING_SELECTION, UI_OVERLAY_ACTION_SELECTING, UI_OVERLAY_ACTION_STARTING_DELETE_SELECTION, UI_OVERLAY_ACTION_DELETE_SELECTING, UI_OVERLAY_ACTION_STARTING_RAMP, UI_OVERLAY_ACTION_RAMPING, UI_OVERLAY_ACTION_CUTTING, UI_OVERLAY_ACTION_RENAMING, NUM_UI_OVERLAY_ACTIONS }
- Various overlay actions to be shared.
- enum UiDragMode { UI_DRAG_MODE_CURSOR, UI_DRAG_MODE_RELATIVE, UI_DRAG_MODE_RELATIVE_WITH_MULTIPLIER }
- Dragging modes for widgets that have click&drag.
Typedefs
- using ZFileType = enum ZFileType
- File type.
- using SupportedFile = struct SupportedFile
- Metadata for a supported file.
- using CairoCaches = struct CairoCaches
- Caches for cairo.
- using MPMCQueue = struct MPMCQueue
- Multiple Producer Multiple Consumer lock-free queue.
- using Stack = struct Stack
- Stack implementation.
- using midi_byte_t = uint8_t
- MIDI byte.
- using nframes_t = uint32_t
- Frame count.
- using sample_rate_t = uint32_t
- Sample rate.
- using midi_time_t = uint32_t
- MIDI time in global frames.
- using channels_t = unsigned int
- Number of channels.
- using sample_t = float
- The sample type.
- using bpm_t = float
- The BPM type.
- using GenericFloatGetter = float(*)(void*object)
- Getter prototype for float values.
- using GenericFloatSetter = void(*)(void*object, float val)
- Setter prototype for float values.
- using GenericStringSetter = void(*)(void*object, const char*val)
- Setter prototype for float values.
- using UiColors = struct UiColors
- Commonly used UI colors.
- using UiCursor = struct UiCursor
- Specification for a cursor.
- using UiCaches = struct UiCaches
- Caches.
- using UiCursorState = enum UiCursorState
- Various cursor states to be shared.
- using UiOverlayAction = enum UiOverlayAction
- Various overlay actions to be shared.
- using UiDragMode = enum UiDragMode
- Dragging modes for widgets that have click&drag.
- using ZrythmObject = struct ZrythmObject
- Base object for debugging.
Functions
- auto supported_file_new_from_path(const char* path) -> SupportedFile*
- Creates a new SupportedFile from the given absolute path.
- auto supported_file_type_get_description(ZFileType type) -> char*
- Returns a human readable description of the given file type.
- auto supported_file_clone(SupportedFile* src) -> SupportedFile*
- Clones the given SupportedFile.
- auto supported_file_type_is_supported(ZFileType type) -> int
- Returns if the given type is supported.
- auto supported_file_type_is_audio(ZFileType type) -> int
- Returns if the SupportedFile is an audio file.
- auto supported_file_type_is_midi(ZFileType type) -> int
- Returns if the SupportedFile is a midi file.
- auto supported_file_type_get_ext(ZFileType type) -> const char*
- Returns the most common extension for the given filetype.
- auto supported_file_get_type(const char* file) -> ZFileType
- Returns the file type of the given file path.
- void supported_file_free(SupportedFile* self)
- Frees the instance and all its members.
- auto audio_write_raw_file(float* buff, long frames_already_written, long nframes, uint32_t samplerate, unsigned int channels, const char* filename) -> int
- Writes the buffer as a raw file to the given path.
- auto audio_get_num_cores(void) -> int
- Returns the number of CPU cores.
- auto _backtrace_get(const char* exe_path, const char* prefix, int max_lines, bool with_lines) -> char*
- Returns the backtrace with max_lines number of lines and a string prefix.
- static void z_cairo_rounded_rectangle(cairo_t* cr, double x, double y, double width, double height, double aspect, double corner_radius)
- void _z_cairo_get_text_extents_for_widget(GtkWidget* widget, PangoLayout* layout, const char* text, int* width, int* height)
- Gets the width of the given text in pixels for the given widget.
- void z_cairo_draw_text_full(cairo_t* cr, GtkWidget* widget, PangoLayout* layout, const char* text, int start_x, int start_y)
- Draws the given text using the given font starting at the given position.
- static void z_cairo_diamond(cairo_t* cr, double x, double y, double width, double height)
- Draws a diamond shape.
- auto z_cairo_get_surface_from_icon_name(const char* icon_name, int size, int scale) -> cairo_surface_t*
- Returns a surface for the icon name.
- auto z_cairo_create_pango_layout_from_string(GtkWidget* widget, const char* font, PangoEllipsizeMode ellipsize_mode, int ellipsize_padding) -> PangoLayout*
- Creates a PangoLayout to be cached in widgets based on the given settings.
- auto z_cairo_create_pango_layout_from_description(GtkWidget* widget, PangoFontDescription* descr, PangoEllipsizeMode ellipsize_mode, int ellipsize_padding) -> PangoLayout*
- Creates a PangoLayout to be cached in widgets based on the given settings.
- auto z_cairo_create_default_pango_layout(GtkWidget* widget) -> PangoLayout*
- Creates a PangoLayout with default settings.
- void z_cairo_reset_caches(cairo_t** cr_cache, cairo_surface_t** surface_cache, int width, int height, cairo_t* new_cr)
- Resets a surface and cairo_t with a new surface and cairo_t based on the given rectangle and cairo_t.
- void color_brighten(GdkRGBA* src, double val)
- Brightens the color by the given amount.
- void color_brighten_default(GdkRGBA* src)
- Brightens the color by the default amount.
- void color_darken(GdkRGBA* src, double val)
- Darkens the color by the given amount.
- void color_darken_default(GdkRGBA* src)
- Darkens the color by the default amount.
- auto color_is_same(GdkRGBA* src, GdkRGBA* dest) -> bool
- Returns whether the color is the same.
- auto color_is_bright(GdkRGBA* src) -> bool
- Returns if the color is bright or not.
- auto color_is_very_bright(GdkRGBA* src) -> bool
- Returns if the color is very bright or not.
- auto datetime_get_current_as_string(void) -> char*
- Returns the current datetime as a string.
- auto datetime_get_for_filename(void) -> char*
- Get the current datetime to be used in filenames, eg, for the log file.
- auto env_get_string(const char* key, const char* def) -> char*
- Returns a newly allocated string.
- auto env_get_int(const char* key, int def) -> int
- Returns an int for the given environment variable if it exists and is valid, otherwise returns the default int.
- auto utils_get_uint_from_bitfield_val(unsigned int bitfield) -> unsigned int
- From https:/
/ graphics.stanford.edu/ ~seander/ bithacks.html#ZerosOnRightLinear. - void z_gtk_container_remove_all_children(GtkContainer* container)
- auto z_gtk_message_dialog_get_label(GtkMessageDialog* self, const int secondary) -> GtkLabel*
- Returns the primary or secondary label of the given GtkMessageDialog.
- void z_gtk_configure_simple_combo_box(GtkComboBox* cb, GtkTreeModel* model)
- Configures a simple value-text combo box using the given model.
- auto z_gtk_button_new_with_icon(const char* name) -> GtkButton*
- Creates a button with the given icon name.
- auto z_gtk_toggle_button_new_with_icon(const char* name) -> GtkToggleButton*
- Creates a toggle button with the given icon name.
- auto z_gtk_button_new_with_resource(IconType icon_type, const char* name) -> GtkButton*
- Creates a button with the given resource name as icon.
- auto z_gtk_toggle_button_new_with_resource(IconType icon_type, const char* name) -> GtkToggleButton*
- Creates a toggle button with the given resource name as icon.
- auto z_gtk_create_menu_item_full(const gchar* label_name, const gchar* icon_name, IconType resource_icon_type, const gchar* resource, bool is_toggle, const char* action_name) -> GtkMenuItem*
- Creates a menu item.
- auto z_gtk_get_single_selection_pointer(GtkTreeView* tv, int column) -> void*
- Returns a pointer stored at the given selection.
- auto z_gtk_get_label_from_menu_item(GtkMenuItem* mi) -> GtkLabel*
- Returns the label from a given GtkMenuItem.
- void z_gtk_set_tooltip_for_actionable(GtkActionable* actionable, const char* tooltip)
- Sets the tooltip and finds the accel keys and appends them to the tooltip in small text.
- void z_gtk_tool_button_set_icon_size(GtkToolButton* toolbutton, GtkIconSize icon_size)
- Changes the size of the icon inside tool buttons.
- void z_gtk_widget_add_style_class(GtkWidget* widget, const gchar* class_name)
- Adds the given style class to the widget.
- void z_gtk_widget_remove_style_class(GtkWidget* widget, const gchar* class_name)
- Removes the given style class from the widget.
- static auto z_gtk_widget_get_device(GtkWidget* widget) -> GdkDevice*
- Gets the GdkDevice for a GtkWidget.
- static void z_gtk_warp_cursor_to(GtkWidget* widget, int x, int y)
- Wraps the cursor to the given global coordinates.
- static void z_gtk_widget_get_mask(GtkWidget* widget, GdkModifierType* mask)
- Sets the GdkModifierType given for the widget.
- static auto z_gtk_keyval_is_alt(const guint keyval) -> int
- Returns if the keyval is an Alt key.
- static auto z_gtk_keyval_is_ctrl(const guint keyval) -> int
- Returns if the keyval is a Control key.
- static auto z_gtk_keyval_is_arrow(const guint keyval) -> int
- Returns if the keyval is an arrow key.
- static auto z_gtk_keyval_is_shift(const guint keyval) -> int
- Returns if the keyval is a Shift key.
- static auto z_gtk_container_get_single_child(GtkContainer* container) -> GtkWidget*
- Returns the single child of a container.
- auto z_gtk_container_get_nth_child(GtkContainer* container, int index) -> GtkWidget*
- Returns the nth child of a container.
- void z_gtk_combo_box_set_ellipsize_mode(GtkComboBox* self, PangoEllipsizeMode ellipsize)
- Sets the ellipsize mode of each text cell renderer in the combo box.
- void z_gtk_setup_foldable_notebook(GtkNotebook* notebook)
- Makes the given notebook foldable.
- void z_gtk_widget_set_margin(GtkWidget* widget, int margin)
- Sets the margin on all 4 sides on the widget.
- auto z_gtk_activate_dir_link_func(GtkLabel* label, char* uri, void* data) -> bool
- Callback to use for simple directory links.
- auto io_get_dir(const char* filename) -> char*
- Gets directory part of filename.
- void io_mkdir(const char* dir)
- Makes directory if doesn't exist.
- auto io_touch_file(const char* filename) -> FILE*
- Creates the file if doesn't exist.
- auto io_file_strip_ext(const char* filename) -> char*
- Strips extensions from given filename.
- auto io_file_get_ext(const char* file) -> const char*
- Returns file extension or NULL.
- auto io_path_get_basename_without_ext(const char* filename) -> char*
- Strips path from given filename.
- auto io_remove(const char* path) -> int
- Removes the given file.
- auto io_rmdir(const char* path, bool force) -> int
- Removes a dir, optionally forcing deletion.
- auto io_get_files_in_dir_ending_in(const char* dir, const int recursive, const char* end_string) -> char**
- Returns a list of the files in the given directory.
- auto io_get_next_available_filepath(const char* filepath) -> char*
- Returns a newly allocated path that is either a copy of the original path if the path does not exist, or the original path appended with (n), where n is a number.
- void io_open_directory(const char* path)
- Opens the given directory using the default program.
- void io_escape_dir_name(char* dest, const char* dir)
- Returns a clone of the given string after removing forbidden characters.
- void log_init_writer_idle(Log* self, unsigned int secs)
- Initializes logging to a file.
- auto log_idle_cb(Log* self) -> int
- Idle callback.
- auto log_get_last_n_lines(Log* self, int n) -> char*
- Returns the last n lines as a newly allocated string.
- void log_init_with_file(Log* self, const char* filepath)
- Initializes logging to a file.
- auto log_new(void) -> Log*
- Creates the logger and sets the writer func.
- void log_free(Log* self)
- Stops logging and frees any allocated memory.
- void _free_later(void* object, void(*)(void*) dfunc, const char* file, const char* func, int line)
- Frees the object after a while.
- auto object_utils_new(void) -> ObjectUtils*
- Inits the subsystems for the object utils in this file.
- auto resources_get_icon(IconType icon_type, const char* filename) -> GtkWidget*
- Creates a GtkImage of from the given information and returns it as a GtkWidget.
- void resources_set_class_template(GtkWidgetClass* klass, const char* filename)
- Sets class template from resource.
- auto stack_new(int length) -> Stack*
- Creates a new stack of the given size.
- auto stack_pop_last(Stack* s) -> void*
- Pops the last element and moves everything back.
- auto string_is_ascii(const char* string) -> int
- Returns if the string is ASCII.
- auto string_array_contains_substr(char** str_array, int num_str, const char* substr) -> char*
- Returns the matched string if the string array contains the given substring.
- auto string_contains_substr(const char* str, const char* substr) -> bool
- Returns if the given string contains the given substring.
- void string_to_upper(const char* in, char* out)
- Converts the given string to uppercase in out.
- auto string_is_equal(const char* str1, const char* str2) -> bool
- Returns if the two strings are exactly equal.
- auto string_is_equal_ignore_case(const char* str1, const char* str2) -> bool
- Returns if the two strings are equal ignoring case.
- auto string_convert_to_filename(const char* str) -> char*
- Returns a newly allocated string that is a filename version of the given string.
- auto string_get_substr_before_suffix(const char* str, const char* suffix) -> char*
- Removes the suffix starting from suffix from full_str and returns a newly allocated string.
- auto string_remove_until_after_first_match(const char* str, const char* match) -> char*
- Removes everything up to and including the first match of match from the start of the string and returns a newly allocated string.
- auto string_get_regex_group(const char* str, const char* regex, int group) -> char*
- Gets the string in the given regex group.
- auto string_get_regex_group_as_int(const char* str, const char* regex, int group, int def) -> int
- Gets the string in the given regex group as an integer.
- auto string_get_int_after_last_space(const char* str, char* str_without_num) -> int
- Returns the integer found at the end of a string like "My String 3" -> 3, or -1 if no number is found.
- auto string_array_sort_and_remove_duplicates(char** str_arr) -> char**
- TODO Sorts the given string array and removes duplicates.
- auto system_run_cmd(const char* cmd, long ms_timer) -> int
- Runs the given command in the background, waits for it to finish and returns its exit code.
- auto system_get_cmd_output(char** argv, long ms_timer, bool always_wait) -> char*
- Runs the command and returns the output, or NULL.
- auto system_run_cmd_w_args(const char** args, int ms_to_wait, char** out_stdout, char** out_stderr, bool warn_if_fail) -> int
- Runs the given command in the background, waits for it to finish and returns its exit code.
- auto ui_get_state_mask(GtkGesture* gesture) -> GdkModifierType
- Used in handlers to get the state mask.
- void ui_set_cursor_from_icon_name(GtkWidget* widget, const char* name, int offset_x, int offset_y)
- Sets cursor from icon name.
- void ui_set_cursor_from_name(GtkWidget* widget, const char* name)
- Sets cursor from standard cursor name.
- void ui_show_message_full(GtkWindow* parent_window, GtkMessageType type, const char* message)
- Shows a popup message of the given type with the given message.
- auto ui_is_point_in_rect_hit(GdkRectangle* rect, const bool check_x, const bool check_y, double x, double y, double x_padding, double y_padding) -> bool
- Returns if rect is hit or not by the given coordinate.
- auto ui_is_child_hit(GtkWidget* parent, GtkWidget* child, const int check_x, const int check_y, const double x, const double y, const double x_padding, const double y_padding) -> int
- Returns if the child is hit or not by the coordinates in parent.
- auto ui_get_hit_child(GtkContainer* parent, double x, double y, GType type) -> GtkWidget*
- Returns the matching hit child, or NULL.
- void ui_px_to_pos_timeline(double px, Position* pos, int has_padding)
- Converts from pixels to position.
- auto ui_px_to_frames_timeline(double px, int has_padding) -> long
- Converts from pixels to frames.
- auto ui_px_to_frames_editor(double px, int has_padding) -> long
- Converts from pixels to frames.
- auto ui_pos_to_px_timeline(Position* pos, int use_padding) -> int
- Converts position to px, optionally adding the ruler padding.
- auto ui_pos_to_px_editor(Position* pos, int use_padding) -> int
- Converts position to px, optionally adding the ruler padding.
- void ui_px_to_pos_editor(double px, Position* pos, int has_padding)
- Converts from pixels to position.
- void ui_rgb_to_hex(double red, double green, double blue, char* buf)
- Converts RGB to hex string.
- void ui_show_notification(const char* msg)
- Shows a notification in the revealer.
- auto ui_show_notification_idle_func(char* msg) -> int
- Show notification from non-GTK threads.
- void ui_get_modifier_type_from_gesture(GtkGestureSingle* gesture, GdkModifierType* state_mask)
- Returns the modifier type (state mask) from the given gesture.
- void ui_setup_language_combo_box(GtkComboBox* language)
- Sets up a combo box to have a selection of languages.
- void ui_setup_audio_backends_combo_box(GtkComboBox* cb)
- Sets up an audio backends combo box.
- void ui_setup_midi_backends_combo_box(GtkComboBox* cb)
- Sets up a MIDI backends combo box.
- void ui_setup_pan_algo_combo_box(GtkComboBox* cb)
- Sets up a pan algorithm combo box.
- void ui_setup_pan_law_combo_box(GtkComboBox* cb)
- Sets up a pan law combo box.
- void ui_setup_buffer_size_combo_box(GtkComboBox* cb)
- Sets up a pan law combo box.
- void ui_setup_samplerate_combo_box(GtkComboBox* cb)
- Sets up a pan law combo box.
- void ui_setup_device_name_combo_box(GtkComboBoxText* cb)
- Sets up a pan law combo box.
- void ui_setup_vst_paths_entry(GtkEntry* entry)
- Sets up the VST paths entry.
- void ui_update_vst_paths_from_entry(GtkEntry* entry)
- Updates the the VST paths in the gsettings from the text in the entry.
- auto ui_get_locale_not_available_string(LocalizationLanguage lang) -> char*
- Returns the "a locale for the language you have selected..." text based on the given language.
- void ui_get_contrast_color(GdkRGBA* src, GdkRGBA* dest)
- Returns the contrasting color (variation of black or white) based on if the given color is dark enough or not.
- void ui_get_mid_color(GdkRGBA* dest, const GdkRGBA* c1, const GdkRGBA* c2, const double transition)
- Returns the color in-between two colors.
- auto ui_rectangle_overlap(GdkRectangle* rect1, GdkRectangle* rect2) -> bool
- Returns if the 2 rectangles overlay.
- void ui_get_arranger_object_color(GdkRGBA* color, const bool is_hovered, const bool is_selected, const bool is_transient, const bool is_muted)
- Gets the color the widget should be.
- auto ui_get_normalized_draggable_value(double size, double cur_val, double start_px, double cur_px, double last_px, double multiplier, UiDragMode mode) -> double
- Gets a draggable value as a normalized value between 0 and 1.
- void yaml_cyaml_log_func(cyaml_log_t level, void* ctxt, const char* format, va_list args)
- Custom logging function for libcyaml.
Variables
- const typedef char*(* GenericStringGetter
- Getter prototype for strings.
- Log* zlog
- Global variable, available to all files.
- static const char* ui_overlay_strings
- Various overlay actions to be shared.
Defines
- #define STRIP_SIZE
- Number of plugin slots per channel.
- #define Z_CAIRO_FONT
- Default font for drawing pango text.
- #define Z_CAIRO_TEXT_PADDING
- Padding to leave from the top/left edges when drawing text.
- #define z_cairo_draw_text(cr, widget, layout, text)
- Draw text with default padding.
- #define file_exists(file)
- Returns 1 if the file/dir exists.
- #define io_get_files_in_dir(dir)
- Returns a list of the files in the given directory.
- #define free_later(obj, func)
- Calls _free_later after doing the casting so the caller doesn't have to.
- #define object_new(type)
- Allocates memory for an object of type type.
- #define object_set_to_zero(ptr)
- Zero's out the struct pointed to by ptr.
- #define object_zero_and_free(ptr)
- Zero's out a struct pointed to by ptr and frees the object.
- #define g_object_unref_and_null(ptr)
- Frees memory, sets the pointer to NULL and zero's out the struct.
- #define g_free_and_null(ptr)
- Frees memory and sets the pointer to NULL.
- #define object_free_w_func_and_null(_func, _obj)
- Call the function _func to free _obj and set _obj to NULL.
- #define UI_RESIZE_CURSOR_SPACE
- Space on the edges to show resize cursors.
- #define TARGET_ENTRY_PLUGIN_DESCR
- Plugin descriptor, used to instantiate plugins.
- #define TARGET_ENTRY_SUPPORTED_FILE
- For SupportedFile pointers.
- #define TARGET_ENTRY_PLUGIN
- Plugin ID, used to move/copy plugins.
- #define TARGET_ENTRY_URI_LIST
- URI list.
- #define TARGET_ENTRY_TRACK
- Track target entry.
- #define TARGET_ENTRY_CHORD_DESCR
- Chord descriptor target entry.
- #define ui_show_notification_idle(msg)
- Shows the notification when idle.
- #define ui_show_error_message(win, msg)
- Wrapper to show error message so that no casting of the window is needed on the caller side.
- #define YAML_FIELD_MAPPING_EMBEDDED(owner, member, schema)
- Mapping embedded inside the struct.
- #define YAML_FIELD_MAPPING_PTR(owner, member, schema)
- Mapping pointer to a struct.
- #define YAML_FIELD_MAPPING_PTR_OPTIONAL(owner, member, schema)
- Mapping pointer to a struct.
- #define YAML_FIELD_FIXED_SIZE_PTR_ARRAY_VAR_COUNT(owner, member, schema)
- Fixed-width array of pointers with variable count.
- #define YAML_FIELD_FIXED_SIZE_PTR_ARRAY(owner, member, schema, size)
- Fixed-width array of pointers with fixed count.
- #define YAML_FIELD_DYN_PTR_ARRAY_VAR_COUNT(owner, member, schema)
- Dynamic-width (reallocated) array of pointers with variable count.
- #define YAML_FIELD_DYN_ARRAY_VAR_COUNT(owner, member, schema)
- Dynamic-width (reallocated) array of structs with variable count.
- #define YAML_FIELD_DYN_PTR_ARRAY_VAR_COUNT_OPT(owner, member, schema)
- Dynamic-width (reallocated) array of pointers with variable count, nullable.
- #define YAML_FIELD_DYN_ARRAY_VAR_COUNT_PRIMITIVES(owner, member, schema)
- Dynamic-width (reallocated) array of primitives with variable count.
- #define YAML_FIELD_SEQUENCE_FIXED(owner, member, schema, size)
- Fixed sequence of pointers.
- #define YAML_VALUE_PTR(cc, fields_schema)
- Schema to be used as a pointer.
- #define YAML_VALUE_PTR_NULLABLE(cc, fields_schema)
- Schema to be used as a pointer that can be NULL.
- #define YAML_VALUE_DEFAULT(cc, fields_schema)
- Schema to be used for arrays of structs directly (not as pointers).
- #define SERIALIZE_INC(camelcase, lowercase)
- Serializes to XML.
Enum documentation
enum ZFileType
#include <audio/supported_file.h>
File type.
Enumerators | |
---|---|
FILE_TYPE_MIDI | |
FILE_TYPE_MP3 | |
FILE_TYPE_FLAC | |
FILE_TYPE_OGG | |
FILE_TYPE_WAV | |
FILE_TYPE_DIR | |
FILE_TYPE_PARENT_DIR |
Special entry ".." for the parent dir. |
FILE_TYPE_OTHER | |
NUM_FILE_TYPES |
enum ZGtkFill
#include <utils/gtk.h>
For readability, instead of using 0s and 1s.
enum AudioValueFormat
#include <utils/types.h>
Enumerators | |
---|---|
AUDIO_VALUE_AMPLITUDE |
0 to 2, amplitude. |
AUDIO_VALUE_DBFS |
dbFS. |
AUDIO_VALUE_FADER |
0 to 1, suitable for drawing. |
enum UiCursorState
#include <utils/ui.h>
Various cursor states to be shared.
enum UiOverlayAction
#include <utils/ui.h>
Various overlay actions to be shared.
enum UiDragMode
#include <utils/ui.h>
Dragging modes for widgets that have click&drag.
Enumerators | |
---|---|
UI_DRAG_MODE_CURSOR |
Value is wherever the cursor is. |
UI_DRAG_MODE_RELATIVE |
Value is changed based on the offset. |
UI_DRAG_MODE_RELATIVE_WITH_MULTIPLIER |
Value is changed based on the offset, times a multiplier. |
Typedef documentation
typedef enum ZFileType ZFileType
#include <audio/supported_file.h>
File type.
typedef struct SupportedFile SupportedFile
#include <audio/supported_file.h>
Metadata for a supported file.
typedef struct CairoCaches CairoCaches
#include <utils/cairo.h>
Caches for cairo.
typedef struct MPMCQueue MPMCQueue
#include <utils/mpmc_queue.h>
Multiple Producer Multiple Consumer lock-free queue.
See https:/
typedef struct Stack Stack
#include <utils/stack.h>
Stack implementation.
typedef uint8_t midi_byte_t
#include <utils/types.h>
MIDI byte.
typedef uint32_t nframes_t
#include <utils/types.h>
Frame count.
typedef uint32_t sample_rate_t
#include <utils/types.h>
Sample rate.
typedef uint32_t midi_time_t
#include <utils/types.h>
MIDI time in global frames.
typedef unsigned int channels_t
#include <utils/types.h>
Number of channels.
typedef float sample_t
#include <utils/types.h>
The sample type.
typedef float bpm_t
#include <utils/types.h>
The BPM type.
typedef float(*GenericFloatGetter)(void*object)
#include <utils/types.h>
Getter prototype for float values.
typedef void(*GenericFloatSetter)(void*object, float val)
#include <utils/types.h>
Setter prototype for float values.
typedef void(*GenericStringSetter)(void*object, const char*val)
#include <utils/types.h>
Setter prototype for float values.
typedef struct UiColors UiColors
#include <utils/ui.h>
Commonly used UI colors.
typedef struct UiCursor UiCursor
#include <utils/ui.h>
Specification for a cursor.
Used for caching.
typedef struct UiCaches UiCaches
#include <utils/ui.h>
Caches.
typedef enum UiCursorState UiCursorState
#include <utils/ui.h>
Various cursor states to be shared.
typedef enum UiOverlayAction UiOverlayAction
#include <utils/ui.h>
Various overlay actions to be shared.
typedef enum UiDragMode UiDragMode
#include <utils/ui.h>
Dragging modes for widgets that have click&drag.
Function documentation
SupportedFile* supported_file_new_from_path(const char* path)
#include <audio/supported_file.h>
Creates a new SupportedFile from the given absolute path.
char* supported_file_type_get_description(ZFileType type)
#include <audio/supported_file.h>
Returns a human readable description of the given file type.
Example: wav -> "Wave file".
SupportedFile* supported_file_clone(SupportedFile* src)
#include <audio/supported_file.h>
Clones the given SupportedFile.
int supported_file_type_is_supported(ZFileType type)
#include <audio/supported_file.h>
Returns if the given type is supported.
int supported_file_type_is_audio(ZFileType type)
#include <audio/supported_file.h>
Returns if the SupportedFile is an audio file.
int supported_file_type_is_midi(ZFileType type)
#include <audio/supported_file.h>
Returns if the SupportedFile is a midi file.
const char* supported_file_type_get_ext(ZFileType type)
#include <audio/supported_file.h>
Returns the most common extension for the given filetype.
ZFileType supported_file_get_type(const char* file)
#include <audio/supported_file.h>
Returns the file type of the given file path.
void supported_file_free(SupportedFile* self)
#include <audio/supported_file.h>
Frees the instance and all its members.
int audio_write_raw_file(float* buff,
long frames_already_written,
long nframes,
uint32_t samplerate,
unsigned int channels,
const char* filename)
#include <utils/audio.h>
Writes the buffer as a raw file to the given path.
Parameters | |
---|---|
buff | |
frames_already_written | Frames already written. If this is non-zero and the file exists, it will append to the existing file. |
nframes | |
samplerate | The samplerate of buff. |
channels | |
filename | |
Returns | Non-zero if fail. |
int audio_get_num_cores(void)
#include <utils/audio.h>
Returns the number of CPU cores.
char* _backtrace_get(const char* exe_path,
const char* prefix,
int max_lines,
bool with_lines)
#include <utils/backtrace.h>
Returns the backtrace with max_lines number of lines and a string prefix.
Parameters | |
---|---|
exe_path | Executable path for running addr2line. |
prefix | |
max_lines | |
with_lines | Whether to show line numbers. This is very slow. |
static void z_cairo_rounded_rectangle(cairo_t* cr,
double x,
double y,
double width,
double height,
double aspect,
double corner_radius)
#include <utils/cairo.h>
Parameters | |
---|---|
cr | |
x | |
y | |
width | |
height | |
aspect | Aspect ratio. |
corner_radius | Corner curvature radius. |
void _z_cairo_get_text_extents_for_widget(GtkWidget* widget,
PangoLayout* layout,
const char* text,
int* width,
int* height)
#include <utils/cairo.h>
Gets the width of the given text in pixels for the given widget.
Parameters | |
---|---|
widget | The widget to derive a PangoLayout from. |
layout | |
text | The text to draw. |
width | The width to fill in. |
height | The height to fill in. |
void z_cairo_draw_text_full(cairo_t* cr,
GtkWidget* widget,
PangoLayout* layout,
const char* text,
int start_x,
int start_y)
#include <utils/cairo.h>
Draws the given text using the given font starting at the given position.
static void z_cairo_diamond(cairo_t* cr,
double x,
double y,
double width,
double height)
#include <utils/cairo.h>
Draws a diamond shape.
cairo_surface_t* z_cairo_get_surface_from_icon_name(const char* icon_name,
int size,
int scale)
#include <utils/cairo.h>
Returns a surface for the icon name.
PangoLayout* z_cairo_create_pango_layout_from_string(GtkWidget* widget,
const char* font,
PangoEllipsizeMode ellipsize_mode,
int ellipsize_padding)
#include <utils/cairo.h>
Creates a PangoLayout to be cached in widgets based on the given settings.
PangoLayout* z_cairo_create_pango_layout_from_description(GtkWidget* widget,
PangoFontDescription* descr,
PangoEllipsizeMode ellipsize_mode,
int ellipsize_padding)
#include <utils/cairo.h>
Creates a PangoLayout to be cached in widgets based on the given settings.
PangoLayout* z_cairo_create_default_pango_layout(GtkWidget* widget)
#include <utils/cairo.h>
Creates a PangoLayout with default settings.
void z_cairo_reset_caches(cairo_t** cr_cache,
cairo_surface_t** surface_cache,
int width,
int height,
cairo_t* new_cr)
#include <utils/cairo.h>
Resets a surface and cairo_t with a new surface and cairo_t based on the given rectangle and cairo_t.
Parameters | |
---|---|
cr_cache | |
surface_cache | |
width | New surface width. |
height | New surface height. |
new_cr |
To be used inside draw calls of widgets that use caching.
void color_brighten(GdkRGBA* src,
double val)
#include <utils/color.h>
Brightens the color by the given amount.
void color_brighten_default(GdkRGBA* src)
#include <utils/color.h>
Brightens the color by the default amount.
void color_darken(GdkRGBA* src,
double val)
#include <utils/color.h>
Darkens the color by the given amount.
void color_darken_default(GdkRGBA* src)
#include <utils/color.h>
Darkens the color by the default amount.
bool color_is_same(GdkRGBA* src,
GdkRGBA* dest)
#include <utils/color.h>
Returns whether the color is the same.
bool color_is_bright(GdkRGBA* src)
#include <utils/color.h>
Returns if the color is bright or not.
bool color_is_very_bright(GdkRGBA* src)
#include <utils/color.h>
Returns if the color is very bright or not.
char* datetime_get_current_as_string(void)
#include <utils/datetime.h>
Returns the current datetime as a string.
Must be free()'d by caller.
char* datetime_get_for_filename(void)
#include <utils/datetime.h>
Get the current datetime to be used in filenames, eg, for the log file.
char* env_get_string(const char* key,
const char* def)
#include <utils/env.h>
Returns a newly allocated string.
Parameters | |
---|---|
key | |
def | Default value to return if not found. |
int env_get_int(const char* key,
int def)
#include <utils/env.h>
Returns an int for the given environment variable if it exists and is valid, otherwise returns the default int.
Parameters | |
---|---|
key | |
def | Default value to return if not found. |
unsigned int utils_get_uint_from_bitfield_val(unsigned int bitfield)
#include <utils/general.h>
From https:/
void z_gtk_container_remove_all_children(GtkContainer* container)
#include <utils/gtk.h>
GtkLabel* z_gtk_message_dialog_get_label(GtkMessageDialog* self,
const int secondary)
#include <utils/gtk.h>
Returns the primary or secondary label of the given GtkMessageDialog.
Parameters | |
---|---|
self | |
secondary | 0 for primary, 1 for secondary. |
void z_gtk_configure_simple_combo_box(GtkComboBox* cb,
GtkTreeModel* model)
#include <utils/gtk.h>
Configures a simple value-text combo box using the given model.
GtkButton* z_gtk_button_new_with_icon(const char* name)
#include <utils/gtk.h>
Creates a button with the given icon name.
GtkToggleButton* z_gtk_toggle_button_new_with_icon(const char* name)
#include <utils/gtk.h>
Creates a toggle button with the given icon name.
GtkButton* z_gtk_button_new_with_resource(IconType icon_type,
const char* name)
#include <utils/gtk.h>
Creates a button with the given resource name as icon.
GtkToggleButton* z_gtk_toggle_button_new_with_resource(IconType icon_type,
const char* name)
#include <utils/gtk.h>
Creates a toggle button with the given resource name as icon.
GtkMenuItem* z_gtk_create_menu_item_full(const gchar* label_name,
const gchar* icon_name,
IconType resource_icon_type,
const gchar* resource,
bool is_toggle,
const char* action_name)
#include <utils/gtk.h>
Creates a menu item.
void* z_gtk_get_single_selection_pointer(GtkTreeView* tv,
int column)
#include <utils/gtk.h>
Returns a pointer stored at the given selection.
GtkLabel* z_gtk_get_label_from_menu_item(GtkMenuItem* mi)
#include <utils/gtk.h>
Returns the label from a given GtkMenuItem.
The menu item must have a box with an optional icon and a label inside.
void z_gtk_set_tooltip_for_actionable(GtkActionable* actionable,
const char* tooltip)
#include <utils/gtk.h>
Sets the tooltip and finds the accel keys and appends them to the tooltip in small text.
void z_gtk_tool_button_set_icon_size(GtkToolButton* toolbutton,
GtkIconSize icon_size)
#include <utils/gtk.h>
Changes the size of the icon inside tool buttons.
void z_gtk_widget_add_style_class(GtkWidget* widget,
const gchar* class_name)
#include <utils/gtk.h>
Adds the given style class to the widget.
void z_gtk_widget_remove_style_class(GtkWidget* widget,
const gchar* class_name)
#include <utils/gtk.h>
Removes the given style class from the widget.
static GdkDevice* z_gtk_widget_get_device(GtkWidget* widget)
#include <utils/gtk.h>
Gets the GdkDevice for a GtkWidget.
static void z_gtk_warp_cursor_to(GtkWidget* widget,
int x,
int y)
#include <utils/gtk.h>
Wraps the cursor to the given global coordinates.
static void z_gtk_widget_get_mask(GtkWidget* widget,
GdkModifierType* mask)
#include <utils/gtk.h>
Sets the GdkModifierType given for the widget.
Used in eg. drag_motion events to check if Ctrl is held.
static int z_gtk_keyval_is_alt(const guint keyval)
#include <utils/gtk.h>
Returns if the keyval is an Alt key.
static int z_gtk_keyval_is_ctrl(const guint keyval)
#include <utils/gtk.h>
Returns if the keyval is a Control key.
static int z_gtk_keyval_is_arrow(const guint keyval)
#include <utils/gtk.h>
Returns if the keyval is an arrow key.
static int z_gtk_keyval_is_shift(const guint keyval)
#include <utils/gtk.h>
Returns if the keyval is a Shift key.
static GtkWidget* z_gtk_container_get_single_child(GtkContainer* container)
#include <utils/gtk.h>
Returns the single child of a container.
GtkWidget* z_gtk_container_get_nth_child(GtkContainer* container,
int index)
#include <utils/gtk.h>
Returns the nth child of a container.
void z_gtk_combo_box_set_ellipsize_mode(GtkComboBox* self,
PangoEllipsizeMode ellipsize)
#include <utils/gtk.h>
Sets the ellipsize mode of each text cell renderer in the combo box.
void z_gtk_setup_foldable_notebook(GtkNotebook* notebook)
#include <utils/gtk.h>
Makes the given notebook foldable.
The pages of the notebook must all be wrapped in GtkBox's.
void z_gtk_widget_set_margin(GtkWidget* widget,
int margin)
#include <utils/gtk.h>
Sets the margin on all 4 sides on the widget.
bool z_gtk_activate_dir_link_func(GtkLabel* label,
char* uri,
void* data)
#include <utils/gtk.h>
Callback to use for simple directory links.
char* io_get_dir(const char* filename)
Gets directory part of filename.
Parameters | |
---|---|
filename | Filename containing directory. |
MUST be freed.
char* io_path_get_basename_without_ext(const char* filename)
Strips path from given filename.
MUST be freed.
int io_rmdir(const char* path, bool force)
Removes a dir, optionally forcing deletion.
For safety reasons, this only accepts an absolute path with length greater than 20 if forced.
char** io_get_files_in_dir_ending_in(const char* dir, const int recursive, const char* end_string)
Returns a list of the files in the given directory.
Parameters | |
---|---|
dir | The directory to look for. |
recursive | |
end_string | |
Returns | a NULL terminated array of strings that must be free'd with g_strfreev(). |
char* io_get_next_available_filepath(const char* filepath)
Returns a newly allocated path that is either a copy of the original path if the path does not exist, or the original path appended with (n), where n is a number.
Example: "myfile" -> "myfile (1)"
void log_init_writer_idle(Log* self, unsigned int secs)
Initializes logging to a file.
Parameters | |
---|---|
self | |
secs | Number of timeout seconds. |
This must be called from the GTK thread.
char* log_get_last_n_lines(Log* self, int n)
Returns the last n lines as a newly allocated string.
Parameters | |
---|---|
self | |
n | Number of lines. |
void log_init_with_file(Log* self, const char* filepath)
Initializes logging to a file.
Parameters | |
---|---|
self | |
filepath | If non-NULL, the given file will be used, otherwise the default file will be created. |
This can be called from any thread.
void _free_later(void* object, void(*)(void*) dfunc, const char* file, const char* func, int line)
Frees the object after a while.
This is useful when the object will be in use for a while, for example in the current processing cycle.
GtkWidget* resources_get_icon(IconType icon_type,
const char* filename)
#include <utils/resources.h>
Creates a GtkImage of from the given information and returns it as a GtkWidget.
Returns | a GtkImage. |
---|
void resources_set_class_template(GtkWidgetClass* klass,
const char* filename)
#include <utils/resources.h>
Sets class template from resource.
Filename is part after .../ui/
Stack* stack_new(int length)
#include <utils/stack.h>
Creates a new stack of the given size.
Parameters | |
---|---|
length | Stack size. If -1, the stack will have unlimited size. |
void* stack_pop_last(Stack* s)
#include <utils/stack.h>
Pops the last element and moves everything back.
int string_is_ascii(const char* string)
#include <utils/string.h>
Returns if the string is ASCII.
char* string_array_contains_substr(char** str_array,
int num_str,
const char* substr)
#include <utils/string.h>
Returns the matched string if the string array contains the given substring.
bool string_contains_substr(const char* str,
const char* substr)
#include <utils/string.h>
Returns if the given string contains the given substring.
void string_to_upper(const char* in,
char* out)
#include <utils/string.h>
Converts the given string to uppercase in out.
Assumes out is already allocated to as many chars as in.
bool string_is_equal(const char* str1,
const char* str2)
#include <utils/string.h>
Returns if the two strings are exactly equal.
bool string_is_equal_ignore_case(const char* str1,
const char* str2)
#include <utils/string.h>
Returns if the two strings are equal ignoring case.
char* string_convert_to_filename(const char* str)
#include <utils/string.h>
Returns a newly allocated string that is a filename version of the given string.
Example: "MIDI ZRegion #1" -> "MIDI_Region_1".
char* string_get_substr_before_suffix(const char* str,
const char* suffix)
#include <utils/string.h>
Removes the suffix starting from suffix from full_str and returns a newly allocated string.
char* string_remove_until_after_first_match(const char* str,
const char* match)
#include <utils/string.h>
Removes everything up to and including the first match of match from the start of the string and returns a newly allocated string.
char* string_get_regex_group(const char* str,
const char* regex,
int group)
#include <utils/string.h>
Gets the string in the given regex group.
Returns | The string, or NULL. |
---|
int string_get_regex_group_as_int(const char* str,
const char* regex,
int group,
int def)
#include <utils/string.h>
Gets the string in the given regex group as an integer.
Parameters | |
---|---|
str | |
regex | |
group | |
def | Default. |
Returns | The int, or default. |
int string_get_int_after_last_space(const char* str,
char* str_without_num)
#include <utils/string.h>
Returns the integer found at the end of a string like "My String 3" -> 3, or -1 if no number is found.
Parameters | |
---|---|
str | |
str_without_num | A buffer to save the string without the number (including the space). |
See https:/
char** string_array_sort_and_remove_duplicates(char** str_arr)
#include <utils/string.h>
TODO Sorts the given string array and removes duplicates.
Parameters | |
---|---|
str_arr | A NULL-terminated array of strings. |
Returns | A NULL-terminated array with the string addresses of the source array. |
int system_run_cmd(const char* cmd,
long ms_timer)
#include <utils/system.h>
Runs the given command in the background, waits for it to finish and returns its exit code.
Parameters | |
---|---|
cmd | |
ms_timer | A timer in ms to kill the process, or negative to not wait. |
char* system_get_cmd_output(char** argv,
long ms_timer,
bool always_wait)
#include <utils/system.h>
Runs the command and returns the output, or NULL.
Parameters | |
---|---|
argv | |
ms_timer | A timer in ms to kill the process, or negative to not wait. |
always_wait |
This assumes that the process will exit within a few milliseconds from when the first output is printed, unless always_wait is true, in which case the process will only be reaped after the waiting time.
int system_run_cmd_w_args(const char** args,
int ms_to_wait,
char** out_stdout,
char** out_stderr,
bool warn_if_fail)
#include <utils/system.h>
Runs the given command in the background, waits for it to finish and returns its exit code.
Parameters | |
---|---|
args | NULL-terminated array of args. |
ms_to_wait | |
out_stdout out | A pointer to save the newly allocated stdout output (if non-NULL). |
out_stderr out | A pointer to save the newly allocated stderr output (if non-NULL). |
warn_if_fail |
GdkModifierType ui_get_state_mask(GtkGesture* gesture)
#include <utils/ui.h>
Used in handlers to get the state mask.
void ui_set_cursor_from_icon_name(GtkWidget* widget,
const char* name,
int offset_x,
int offset_y)
#include <utils/ui.h>
Sets cursor from icon name.
void ui_set_cursor_from_name(GtkWidget* widget,
const char* name)
#include <utils/ui.h>
Sets cursor from standard cursor name.
void ui_show_message_full(GtkWindow* parent_window,
GtkMessageType type,
const char* message)
#include <utils/ui.h>
Shows a popup message of the given type with the given message.
bool ui_is_point_in_rect_hit(GdkRectangle* rect,
const bool check_x,
const bool check_y,
double x,
double y,
double x_padding,
double y_padding)
#include <utils/ui.h>
Returns if rect is hit or not by the given coordinate.
Parameters | |
---|---|
rect | |
check_x | Check x-axis for match. |
check_y | Check y-axis for match. |
x | x in parent space. |
y | y in parent space. |
x_padding | Padding to add to the x of the object when checking if hit. The bigger the padding the more space the child will have to get hit. |
y_padding | Padding to add to the y of the object when checking if hit. The bigger the padding the more space the child will have to get hit. |
int ui_is_child_hit(GtkWidget* parent,
GtkWidget* child,
const int check_x,
const int check_y,
const double x,
const double y,
const double x_padding,
const double y_padding)
#include <utils/ui.h>
Returns if the child is hit or not by the coordinates in parent.
Parameters | |
---|---|
parent | |
child | |
check_x | Check x-axis for match. |
check_y | Check y-axis for match. |
x | x in parent space. |
y | y in parent space. |
x_padding | Padding to add to the x of the object when checking if hit. The bigger the padding the more space the child will have to get hit. |
y_padding | Padding to add to the y of the object when checking if hit. The bigger the padding the more space the child will have to get hit. |
GtkWidget* ui_get_hit_child(GtkContainer* parent,
double x,
double y,
GType type)
#include <utils/ui.h>
Returns the matching hit child, or NULL.
type to look for
void ui_px_to_pos_timeline(double px,
Position* pos,
int has_padding)
#include <utils/ui.h>
Converts from pixels to position.
Parameters | |
---|---|
px | |
pos | |
has_padding | Whether the given px contain padding. |
long ui_px_to_frames_timeline(double px,
int has_padding)
#include <utils/ui.h>
Converts from pixels to frames.
Parameters | |
---|---|
px | |
has_padding | Whether then given px contains padding. |
Returns the frames.
long ui_px_to_frames_editor(double px,
int has_padding)
#include <utils/ui.h>
Converts from pixels to frames.
Parameters | |
---|---|
px | |
has_padding | Whether then given px contains padding. |
Returns the frames.
int ui_pos_to_px_timeline(Position* pos,
int use_padding)
#include <utils/ui.h>
Converts position to px, optionally adding the ruler padding.
int ui_pos_to_px_editor(Position* pos,
int use_padding)
#include <utils/ui.h>
Converts position to px, optionally adding the ruler padding.
void ui_px_to_pos_editor(double px,
Position* pos,
int has_padding)
#include <utils/ui.h>
Converts from pixels to position.
Parameters | |
---|---|
px | |
pos | |
has_padding | Whether px contains padding. |
void ui_rgb_to_hex(double red,
double green,
double blue,
char* buf)
#include <utils/ui.h>
Converts RGB to hex string.
void ui_show_notification(const char* msg)
#include <utils/ui.h>
Shows a notification in the revealer.
int ui_show_notification_idle_func(char* msg)
#include <utils/ui.h>
Show notification from non-GTK threads.
This should be used internally. Use the ui_show_notification_idle macro instead.
void ui_get_modifier_type_from_gesture(GtkGestureSingle* gesture,
GdkModifierType* state_mask)
#include <utils/ui.h>
Returns the modifier type (state mask) from the given gesture.
return value
void ui_setup_language_combo_box(GtkComboBox* language)
#include <utils/ui.h>
Sets up a combo box to have a selection of languages.
void ui_setup_audio_backends_combo_box(GtkComboBox* cb)
#include <utils/ui.h>
Sets up an audio backends combo box.
void ui_setup_midi_backends_combo_box(GtkComboBox* cb)
#include <utils/ui.h>
Sets up a MIDI backends combo box.
void ui_setup_pan_algo_combo_box(GtkComboBox* cb)
#include <utils/ui.h>
Sets up a pan algorithm combo box.
void ui_setup_pan_law_combo_box(GtkComboBox* cb)
#include <utils/ui.h>
Sets up a pan law combo box.
void ui_setup_buffer_size_combo_box(GtkComboBox* cb)
#include <utils/ui.h>
Sets up a pan law combo box.
void ui_setup_samplerate_combo_box(GtkComboBox* cb)
#include <utils/ui.h>
Sets up a pan law combo box.
void ui_setup_device_name_combo_box(GtkComboBoxText* cb)
#include <utils/ui.h>
Sets up a pan law combo box.
void ui_setup_vst_paths_entry(GtkEntry* entry)
#include <utils/ui.h>
Sets up the VST paths entry.
void ui_update_vst_paths_from_entry(GtkEntry* entry)
#include <utils/ui.h>
Updates the the VST paths in the gsettings from the text in the entry.
char* ui_get_locale_not_available_string(LocalizationLanguage lang)
#include <utils/ui.h>
Returns the "a locale for the language you have selected..." text based on the given language.
Must be free'd by caller.
void ui_get_contrast_color(GdkRGBA* src,
GdkRGBA* dest)
#include <utils/ui.h>
Returns the contrasting color (variation of black or white) based on if the given color is dark enough or not.
Parameters | |
---|---|
src | The source color. |
dest | The desination color to write to. |
void ui_get_mid_color(GdkRGBA* dest,
const GdkRGBA* c1,
const GdkRGBA* c2,
const double transition)
#include <utils/ui.h>
Returns the color in-between two colors.
Parameters | |
---|---|
dest | |
c1 | |
c2 | |
transition | How far to transition (0.5 for half). |
bool ui_rectangle_overlap(GdkRectangle* rect1,
GdkRectangle* rect2)
#include <utils/ui.h>
Returns if the 2 rectangles overlay.
void ui_get_arranger_object_color(GdkRGBA* color,
const bool is_hovered,
const bool is_selected,
const bool is_transient,
const bool is_muted)
#include <utils/ui.h>
Gets the color the widget should be.
Parameters | |
---|---|
color | The original color. |
is_hovered | |
is_selected | Whether the widget is supposed to be selected or not. |
is_transient | |
is_muted |
double ui_get_normalized_draggable_value(double size,
double cur_val,
double start_px,
double cur_px,
double last_px,
double multiplier,
UiDragMode mode)
#include <utils/ui.h>
Gets a draggable value as a normalized value between 0 and 1.
Parameters | |
---|---|
size | Widget size (either width or height). |
cur_val | |
start_px | Px at start of drag. |
cur_px | Current px. |
last_px | Px during last call. |
multiplier | |
mode |
void yaml_cyaml_log_func(cyaml_log_t level,
void* ctxt,
const char* format,
va_list args)
#include <utils/yaml.h>
Custom logging function for libcyaml.
Variable documentation
const typedef char*(* GenericStringGetter
#include <utils/types.h>
Getter prototype for strings.
static const char* ui_overlay_strings
#include <utils/ui.h>
Various overlay actions to be shared.
Define documentation
#define STRIP_SIZE
#include <utils/audio.h>
Number of plugin slots per channel.
#define Z_CAIRO_FONT
#include <utils/cairo.h>
Default font for drawing pango text.
#define Z_CAIRO_TEXT_PADDING
#include <utils/cairo.h>
Padding to leave from the top/left edges when drawing text.
#define z_cairo_draw_text(cr,
widget,
layout,
text)
#include <utils/cairo.h>
Draw text with default padding.
#define file_exists(file)
#include <utils/file.h>
Returns 1 if the file/dir exists.
#define io_get_files_in_dir(dir)
Returns a list of the files in the given directory.
Returns | a NULL terminated array of strings that must be free'd with g_strfreev(). |
---|
#define UI_RESIZE_CURSOR_SPACE
#include <utils/ui.h>
Space on the edges to show resize cursors.
#define TARGET_ENTRY_PLUGIN_DESCR
#include <utils/ui.h>
Plugin descriptor, used to instantiate plugins.
#define TARGET_ENTRY_SUPPORTED_FILE
#include <utils/ui.h>
For SupportedFile pointers.
#define TARGET_ENTRY_PLUGIN
#include <utils/ui.h>
Plugin ID, used to move/copy plugins.
#define TARGET_ENTRY_URI_LIST
#include <utils/ui.h>
URI list.
#define TARGET_ENTRY_TRACK
#include <utils/ui.h>
Track target entry.
This is just the identifier. The TracklistSelections will be used.
#define TARGET_ENTRY_CHORD_DESCR
#include <utils/ui.h>
Chord descriptor target entry.
#define ui_show_notification_idle(msg)
#include <utils/ui.h>
Shows the notification when idle.
This should be called from threads other than GTK main thread.
#define ui_show_error_message(win,
msg)
#include <utils/ui.h>
Wrapper to show error message so that no casting of the window is needed on the caller side.
#define YAML_FIELD_MAPPING_EMBEDDED(owner,
member,
schema)
#include <utils/yaml.h>
Mapping embedded inside the struct.
#define YAML_FIELD_MAPPING_PTR(owner,
member,
schema)
#include <utils/yaml.h>
Mapping pointer to a struct.
#define YAML_FIELD_MAPPING_PTR_OPTIONAL(owner,
member,
schema)
#include <utils/yaml.h>
Mapping pointer to a struct.
#define YAML_FIELD_FIXED_SIZE_PTR_ARRAY_VAR_COUNT(owner,
member,
schema)
#include <utils/yaml.h>
Fixed-width array of pointers with variable count.
@ MyStruct * my_structs[MAX_STRUCTS]; int num_my_structs;
@
#define YAML_FIELD_FIXED_SIZE_PTR_ARRAY(owner,
member,
schema,
size)
#include <utils/yaml.h>
Fixed-width array of pointers with fixed count.
@ MyStruct * my_structs[MAX_STRUCTS_CONST];
@
#define YAML_FIELD_DYN_PTR_ARRAY_VAR_COUNT(owner,
member,
schema)
#include <utils/yaml.h>
Dynamic-width (reallocated) array of pointers with variable count.
@ AutomationTrack ** ats; int num_ats; int ats_size;
@
#define YAML_FIELD_DYN_ARRAY_VAR_COUNT(owner,
member,
schema)
#include <utils/yaml.h>
Dynamic-width (reallocated) array of structs with variable count.
@ RegionIdentifier * ids; int num_ids; int ids_size;
@
#define YAML_FIELD_DYN_PTR_ARRAY_VAR_COUNT_OPT(owner,
member,
schema)
#include <utils/yaml.h>
Dynamic-width (reallocated) array of pointers with variable count, nullable.
@ AutomationTrack ** ats; int num_ats; int ats_size;
@
#define YAML_FIELD_DYN_ARRAY_VAR_COUNT_PRIMITIVES(owner,
member,
schema)
#include <utils/yaml.h>
Dynamic-width (reallocated) array of primitives with variable count.
@ int * ids; int num_ids; int ids_size;
@
#define YAML_FIELD_SEQUENCE_FIXED(owner,
member,
schema,
size)
#include <utils/yaml.h>
Fixed sequence of pointers.
#define YAML_VALUE_PTR(cc,
fields_schema)
#include <utils/yaml.h>
Schema to be used as a pointer.
#define YAML_VALUE_PTR_NULLABLE(cc,
fields_schema)
#include <utils/yaml.h>
Schema to be used as a pointer that can be NULL.
#define YAML_VALUE_DEFAULT(cc,
fields_schema)
#include <utils/yaml.h>
Schema to be used for arrays of structs directly (not as pointers).
For every other case, use the PTR above.
#define SERIALIZE_INC(camelcase,
lowercase)
#include <utils/yaml.h>
Serializes to XML.
MUST be free'd.