2 terminatorX - realtime audio scratching software
3 Copyright (C) 1999-2020 Alexander König
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 Description: This implements the pixmaped buttons - based on
26 #include <gdk-pixbuf/gdk-pixbuf.h>
28 #include "tX_mastergui.h"
29 #include "tX_pbutton.h"
30 #include "tX_global.h"
32 const char* tx_icons[ALL_ICONS];
36 static const char tx_css[] = "#close:hover { background-color: #FF5555; color: #FFFFFF; }";
38 void tx_icons_init(int size) {
41 tx_icons[AUDIOENGINE] = "audio-speakers-symbolic";
42 tx_icons[POWER] = "system-shutdown-symbolic";
43 tx_icons[GRAB] = "input-mouse-symbolic";
45 tx_icons[SEQUENCER] = "emblem-music-symbolic";
47 tx_icons[PLAY] = "media-playback-start-symbolic";
48 tx_icons[STOP] = "media-playback-stop-symbolic";
49 tx_icons[RECORD] = "media-record-symbolic";
50 tx_icons[MIN_AUDIO] = "audio-x-generic-symbolic";
51 tx_icons[MIN_CONTROL] = "multimedia-volume-control-symbolic";
53 tx_icons[MINIMIZE] = "window-minimize-symbolic";
54 tx_icons[MAXIMIZE] = "view-more-symbolic";
55 tx_icons[FX_UP] = "go-up-symbolic";
56 tx_icons[FX_DOWN] = "go-down-symbolic";
57 tx_icons[FX_CLOSE] = "window-close-symbolic";
58 tx_icons[ADD_ITEM] = "list-add-symbolic";
59 tx_icons[ADD_DRYWET] = "list-add-symbolic";
60 tx_icons[REMOVE_DRYWET] = "list-remove-symbolic";
62 GtkCssProvider *provider = gtk_css_provider_new();
63 gtk_css_provider_load_from_data(provider, tx_css, -1, NULL);
64 gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
67 GtkWidget *tx_pixmap_widget(tX_icon id)
69 return gtk_image_new_from_icon_name (tx_icons[id], GTK_ICON_SIZE_SMALL_TOOLBAR);
72 GtkWidget *tx_xpm_label_box(tX_icon id, const gchar *label_text, GtkWidget **labelwidget)
78 switch (globals.button_type) {
79 case BUTTON_TYPE_TEXT:
80 label = gtk_label_new(label_text);
81 gtk_widget_show(label);
82 if (labelwidget!=NULL) *labelwidget=label;
85 case BUTTON_TYPE_ICON:
86 pixmapwid=tx_pixmap_widget(id);
87 gtk_widget_show(pixmapwid);
91 box1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
92 gtk_container_set_border_width (GTK_CONTAINER (box1), 2);
93 pixmapwid=tx_pixmap_widget(id);
94 gtk_box_pack_start (GTK_BOX (box1), pixmapwid, FALSE, FALSE, 0);
95 gtk_widget_show(pixmapwid);
96 label = gtk_label_new (label_text);
97 gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
98 gtk_widget_show(label);
99 if (labelwidget!=NULL) *labelwidget=label;
104 extern GtkWidget *tx_xpm_button_new(tX_icon id, const char *label, int toggle, GtkWidget **labelwidget)
109 if (toggle) button=gtk_toggle_button_new();
110 else button=gtk_button_new();
112 box=tx_xpm_label_box(id, label, labelwidget);
113 gtk_widget_show(box);
114 gtk_container_add (GTK_CONTAINER (button), box);
119 GtkWidget* create_top_button(int icon_id) {
120 GtkWidget* button = gtk_button_new_from_icon_name(tx_icons[icon_id], GTK_ICON_SIZE_SMALL_TOOLBAR);
121 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
122 gtk_widget_set_margin_end(button, 0);
123 gtk_container_set_border_width(GTK_CONTAINER(button),0);