Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
ui.h File Reference

User Interface utils. More...

#include <stdbool.h>
#include "utils/localization.h"
#include "utils/types.h"
#include <adwaita.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
Include dependency graph for ui.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  UiColors
 Commonly used UI colors. More...
 
struct  UiTextures
 Commonly used UI textures. More...
 
struct  UiCursor
 Specification for a cursor. More...
 
struct  UiCaches
 Caches. More...
 

Macros

#define UI_MAX_CURSORS   400
 
#define UI_CACHES   (zrythm_app->ui_caches)
 
#define UI_COLORS   (&UI_CACHES->colors)
 
#define UI_COLOR_DARK_TEXT   "#323232"
 
#define UI_COLOR_BRIGHT_TEXT   "#cdcdcd"
 
#define UI_COLOR_YELLOW   "#F9CA1B"
 
#define UI_COLOR_PURPLE   "#9D3955"
 
#define UI_COLOR_BUTTON_NORMAL   "#343434"
 
#define UI_COLOR_BUTTON_HOVER   "#444444"
 
#define UI_COLOR_RECORD_CHECKED   "#ED2939"
 
#define UI_COLOR_RECORD_ACTIVE   "#FF2400"
 
#define UI_COLOR_BRIGHT_GREEN   "#1DD169"
 
#define UI_COLOR_DARKISH_GREEN   "#19664c"
 
#define UI_COLOR_DARK_ORANGE   "#D68A0C"
 
#define UI_COLOR_Z_YELLOW   "#F9CA1B"
 
#define UI_COLOR_BRIGHT_ORANGE   "#F79616"
 
#define UI_COLOR_Z_PURPLE   "#9D3955"
 
#define UI_COLOR_MATCHA   "#2eb398"
 
#define UI_COLOR_LIGHT_BLUEISH   "#1aa3ffcc"
 
#define UI_COLOR_PREFADER_SEND   "#D21E6D"
 
#define UI_COLOR_POSTFADER_SEND   "#901ed2"
 
#define UI_COLOR_SOLO_ACTIVE   UI_COLOR_MATCHA
 
#define UI_COLOR_SOLO_CHECKED   UI_COLOR_DARKISH_GREEN
 
#define UI_COLOR_HIGHLIGHT_SCALE_BG   "#662266"
 
#define UI_COLOR_HIGHLIGHT_CHORD_BG   "#BB22BB"
 
#define UI_COLOR_HIGHLIGHT_BASS_BG   UI_COLOR_LIGHT_BLUEISH
 
#define UI_COLOR_HIGHLIGHT_BOTH_BG   "#FF22FF"
 
#define UI_COLOR_HIGHLIGHT_SCALE_FG   "#F79616"
 
#define UI_COLOR_HIGHLIGHT_CHORD_FG   UI_COLOR_HIGHLIGHT_SCALE_FG
 
#define UI_COLOR_HIGHLIGHT_BASS_FG   "white"
 
#define UI_COLOR_HIGHLIGHT_BOTH_FG   "white"
 
#define UI_COLOR_FADER_FILL_END   UI_COLOR_Z_YELLOW
 
#define UI_DELETE_ICON_NAME   "z-edit-delete"
 
#define UI_RESIZE_CURSOR_SPACE   8
 Space on the edges to show resize cursors.
 
#define TARGET_ENTRY_PLUGIN_DESCR   "PLUGIN_DESCR"
 Plugin descriptor, used to instantiate plugins.
 
#define TARGET_ENTRY_SUPPORTED_FILE   "SUPPORTED_FILE"
 For SupportedFile pointers.
 
#define TARGET_ENTRY_PLUGIN   "PLUGIN"
 Plugin ID, used to move/copy plugins.
 
#define TARGET_ENTRY_FILE_PATH   "FILE_PATH"
 
#define TARGET_ENTRY_URI_LIST   "text/uri-list"
 URI list.
 
#define TARGET_ENTRY_TRACK   "TRACK"
 Track target entry.
 
#define TARGET_ENTRY_CHORD_DESCR   "CHORD_DESCR"
 Chord descriptor target entry.
 
#define TARGET_ENTRY_TL_SELECTIONS   "TL_SELECTIONS"
 
#define GET_ATOM(x)   gdk_atom_intern (x, 1)
 
#define ui_add_widget_tooltip(widget, txt)    gtk_widget_set_tooltip_text (GTK_WIDGET (widget), txt)
 
#define ui_set_hover_status_bar_signals(w, t)
 
#define ui_show_notification_idle_printf(fmt, ...)
 Shows the notification when idle.
 
#define ui_show_notification_idle(msg)    ui_show_notification_idle_printf ("%s", msg)
 
#define ui_is_widget_revealed(widget)
 
#define ui_set_pencil_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "edit-cursor", 2, 3);
 
#define ui_set_brush_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "brush-cursor", 2, 3);
 
#define ui_set_cut_clip_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "cut-cursor", 9, 7);
 
#define ui_set_eraser_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "eraser-cursor", 4, 2);
 
#define ui_set_line_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "ramp-cursor", 2, 3);
 
#define ui_set_speaker_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "audition-cursor", 10, 12);
 
#define ui_set_hand_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "move-cursor", 12, 11);
 
#define ui_set_left_resize_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "w-resize-cursor", 14, 11);
 
#define ui_set_left_stretch_cursor(widget)
 
#define ui_set_left_resize_loop_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "w-loop-cursor", 14, 11);
 
#define ui_set_right_resize_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "e-resize-cursor", 10, 11);
 
#define ui_set_right_stretch_cursor(widget)
 
#define ui_set_right_resize_loop_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "e-loop-cursor", 10, 11);
 
#define ui_set_time_select_cursor(widget)
 
#define ui_set_fade_in_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "fade-in-cursor", 3, 1);
 
#define ui_set_fade_out_cursor(widget)    ui_set_cursor_from_icon_name (GTK_WIDGET (widget), "fade-out-cursor", 3, 1);
 
#define UI_ACTIVE_WINDOW_OR_NULL
 
#define ui_show_message_printf(title, fmt, ...)
 Type can be GTK_MESSAGE_ERROR, etc.
 
#define ui_show_message_literal(title, str)    ui_show_message_full (GTK_WIDGET (UI_ACTIVE_WINDOW_OR_NULL), title, "%s", str)
 Type can be GTK_MESSAGE_ERROR, etc.
 
#define ui_show_error_message_printf(title, fmt, ...)    ui_show_message_printf (title, fmt, __VA_ARGS__);
 Wrapper to show error message so that no casting of the window is needed on the caller side.
 
#define ui_show_error_message(title, msg)   ui_show_message_literal (title, msg)
 

Enumerations

enum  UiDetail { UI_DETAIL_HIGH , UI_DETAIL_NORMAL , UI_DETAIL_LOW , UI_DETAIL_ULTRA_LOW }
 
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. More...
 
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_STARTING_AUDITIONING , 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 , UI_OVERLAY_ACTION_STARTING_PANNING ,
  UI_OVERLAY_ACTION_PANNING , NUM_UI_OVERLAY_ACTIONS
}
 Various overlay actions to be shared. More...
 
enum  UiDragMode { UI_DRAG_MODE_CURSOR , UI_DRAG_MODE_RELATIVE , UI_DRAG_MODE_RELATIVE_WITH_MULTIPLIER }
 Dragging modes for widgets that have click&drag. More...
 

Functions

void ui_set_pointer_cursor (GtkWidget *widget)
 
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.
 
gboolean ui_on_motion_set_status_bar_text_cb (GtkWidget *widget, GdkEvent *event, char *text)
 
AdwDialog * ui_show_message_full (GtkWidget *parent, const char *title, const char *format,...) G_GNUC_PRINTF(3
 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)
 Returns if rect is hit or not by the given coordinate.
 
NONNULL 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)
 Returns if the child is hit or not by the coordinates in parent.
 
GtkWidget * ui_get_hit_child (GtkWidget *parent, double x, double y, GType type)
 Returns the matching hit child, or NULL.
 
UiDetail ui_get_detail_level (void)
 
NONNULL void ui_px_to_pos_timeline (double px, Position *pos, bool has_padding)
 Converts from pixels to position.
 
signed_frame_t ui_px_to_frames_timeline (double px, bool has_padding)
 Converts from pixels to frames.
 
signed_frame_t ui_px_to_frames_editor (double px, bool has_padding)
 Converts from pixels to frames.
 
NONNULL int ui_pos_to_px_timeline (const Position *pos, int use_padding)
 Converts position to px, optionally adding the ruler padding.
 
NONNULL int ui_pos_to_px_editor (const Position *pos, bool use_padding)
 Converts position to px, optionally adding the ruler padding.
 
NONNULL void ui_px_to_pos_editor (double px, Position *pos, bool 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_gdk_rgba_to_hex (GdkRGBA *color, char *buf)
 
void ui_show_notification (const char *msg)
 Shows a notification in the revealer.
 
int ui_show_notification_idle_func (char *msg)
 Show notification from non-GTK threads.
 
void ui_setup_language_combo_row (AdwComboRow *combo_row)
 Sets up a combo box to have a selection of languages.
 
AdwComboRow * ui_gen_audio_backends_combo_row (bool with_signal)
 Generates a combo row for selecting the audio backend.
 
AdwComboRow * ui_gen_midi_backends_combo_row (bool with_signal)
 Generates a combo row for selecting the MIDI backend.
 
void ui_setup_audio_device_name_combo_row (AdwComboRow *combo_row, bool populate, bool with_signal)
 Sets up a combo row for selecting the audio device name.
 
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.
 
char * ui_get_locale_not_available_string (LocalizationLanguage lang)
 Returns the "a locale for the language you have selected..." text based on the given language.
 
void ui_show_warning_for_tempo_track_experimental_feature (void)
 
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 float transition)
 Returns the color in-between two colors.
 
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.
 
double ui_get_normalized_draggable_value (double size, double cur_val, double start_px, double cur_px, double last_px, double multiplier, UiDragMode mode)
 Gets a draggable value as a normalized value between 0 and 1.
 
void ui_get_db_value_as_string (float val, char *buf)
 Returns an appropriate string representation of the given dB value.
 
UiCachesui_caches_new (void)
 
void ui_caches_free (UiCaches *self)
 

Detailed Description

User Interface utils.

Definition in file ui.h.