1 /* GSequencer - Advanced GTK Sequencer
2  * Copyright (C) 2005-2021 Joël Krähemann
3  *
4  * This file is part of GSequencer.
5  *
6  * GSequencer is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GSequencer is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GSequencer.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include <ags/X/editor/ags_notation_toolbar.h>
21 #include <ags/X/editor/ags_notation_toolbar_callbacks.h>
22 
23 #include <ags/X/ags_window.h>
24 #include <ags/X/ags_menu_bar.h>
25 
26 #include <ags/X/editor/ags_move_note_dialog.h>
27 #include <ags/X/editor/ags_crop_note_dialog.h>
28 #include <ags/X/editor/ags_select_note_dialog.h>
29 #include <ags/X/editor/ags_position_notation_cursor_dialog.h>
30 
31 #include <ags/i18n.h>
32 
33 void ags_notation_toolbar_class_init(AgsNotationToolbarClass *notation_toolbar);
34 void ags_notation_toolbar_connectable_interface_init(AgsConnectableInterface *connectable);
35 void ags_notation_toolbar_init(AgsNotationToolbar *notation_toolbar);
36 
37 void ags_notation_toolbar_connect(AgsConnectable *connectable);
38 void ags_notation_toolbar_disconnect(AgsConnectable *connectable);
39 
40 /**
41  * SECTION:ags_notation_toolbar
42  * @short_description: notation_toolbar
43  * @title: AgsNotationToolbar
44  * @section_id:
45  * @include: ags/X/editor/ags_notation_toolbar.h
46  *
47  * The #AgsNotationToolbar lets you choose edit tool.
48  */
49 
50 GType
ags_notation_toolbar_get_type(void)51 ags_notation_toolbar_get_type(void)
52 {
53   static volatile gsize g_define_type_id__volatile = 0;
54 
55   if(g_once_init_enter (&g_define_type_id__volatile)){
56     GType ags_type_notation_toolbar = 0;
57 
58     static const GTypeInfo ags_notation_toolbar_info = {
59       sizeof (AgsNotationToolbarClass),
60       NULL, /* base_init */
61       NULL, /* base_finalize */
62       (GClassInitFunc) ags_notation_toolbar_class_init,
63       NULL, /* class_finalize */
64       NULL, /* class_data */
65       sizeof (AgsNotationToolbar),
66       0,    /* n_preallocs */
67       (GInstanceInitFunc) ags_notation_toolbar_init,
68     };
69 
70     static const GInterfaceInfo ags_connectable_interface_info = {
71       (GInterfaceInitFunc) ags_notation_toolbar_connectable_interface_init,
72       NULL, /* interface_finalize */
73       NULL, /* interface_data */
74     };
75 
76     ags_type_notation_toolbar = g_type_register_static(GTK_TYPE_TOOLBAR,
77 						       "AgsNotationToolbar", &ags_notation_toolbar_info,
78 						       0);
79 
80     g_type_add_interface_static(ags_type_notation_toolbar,
81 				AGS_TYPE_CONNECTABLE,
82 				&ags_connectable_interface_info);
83 
84     g_once_init_leave(&g_define_type_id__volatile, ags_type_notation_toolbar);
85   }
86 
87   return g_define_type_id__volatile;
88 }
89 
90 void
ags_notation_toolbar_class_init(AgsNotationToolbarClass * notation_toolbar)91 ags_notation_toolbar_class_init(AgsNotationToolbarClass *notation_toolbar)
92 {
93   /* empty */
94 }
95 
96 void
ags_notation_toolbar_connectable_interface_init(AgsConnectableInterface * connectable)97 ags_notation_toolbar_connectable_interface_init(AgsConnectableInterface *connectable)
98 {
99   connectable->is_ready = NULL;
100   connectable->is_connected = NULL;
101   connectable->connect = ags_notation_toolbar_connect;
102   connectable->disconnect = ags_notation_toolbar_disconnect;
103 }
104 
105 void
ags_notation_toolbar_init(AgsNotationToolbar * notation_toolbar)106 ags_notation_toolbar_init(AgsNotationToolbar *notation_toolbar)
107 {
108   GtkToolItem *tool_item;
109   GtkLabel *label;
110   GtkMenu *menu;
111   GtkMenuItem *item;
112   GtkHBox *hbox;
113 
114   notation_toolbar->flags = 0;
115 
116   /* position */
117   tool_item = gtk_tool_item_new();
118   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
119 		     (GtkWidget *) tool_item,
120 		     -1);
121 
122   notation_toolbar->position = (GtkToggleToolButton *) g_object_new(GTK_TYPE_TOGGLE_TOOL_BUTTON,
123 								    "label", i18n("Position"),
124 								    "icon-name", "go-jump",
125 								    NULL);
126   gtk_container_add((GtkContainer *) tool_item,
127 		    (GtkWidget *) notation_toolbar->position);
128 
129   /* edit */
130   tool_item = gtk_tool_item_new();
131   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
132 		     (GtkWidget *) tool_item,
133 		     -1);
134 
135   notation_toolbar->edit = (GtkToggleToolButton *) g_object_new(GTK_TYPE_TOGGLE_TOOL_BUTTON,
136 								"label", i18n("Edit"),
137 								"icon-name", "format-text-direction-ltr",
138 								"active", TRUE,
139 								NULL);
140   notation_toolbar->selected_edit_mode = notation_toolbar->edit;
141   gtk_container_add((GtkContainer *) tool_item,
142 		    (GtkWidget *) notation_toolbar->edit);
143 
144   /* clear */
145   tool_item = gtk_tool_item_new();
146   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
147 		     (GtkWidget *) tool_item,
148 		     -1);
149 
150   notation_toolbar->clear = (GtkToggleToolButton *) g_object_new(GTK_TYPE_TOGGLE_TOOL_BUTTON,
151 								 "label", i18n("Clear"),
152 								 "icon-name", "edit-clear",
153 								 NULL);
154   gtk_container_add((GtkContainer *) tool_item,
155 		    (GtkWidget *) notation_toolbar->clear);
156 
157   /* select */
158   tool_item = gtk_tool_item_new();
159   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
160 		     (GtkWidget *) tool_item,
161 		     -1);
162 
163   notation_toolbar->select = (GtkToggleToolButton *) g_object_new(GTK_TYPE_TOGGLE_TOOL_BUTTON,
164 								  "label", i18n("Select"),
165 								  "icon-name", "edit-select-all",
166 								  NULL);
167   gtk_container_add((GtkContainer *) tool_item,
168 		    (GtkWidget *) notation_toolbar->select);
169 
170   /* copy */
171   tool_item = gtk_tool_item_new();
172   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
173 		     (GtkWidget *) tool_item,
174 		     -1);
175 
176   notation_toolbar->copy = (GtkToolButton *) g_object_new(GTK_TYPE_TOOL_BUTTON,
177 							  "label", i18n("Copy"),
178 							  "icon-name", "edit-copy",
179 							  NULL);
180   gtk_container_add((GtkContainer *) tool_item,
181 		    (GtkWidget *) notation_toolbar->copy);
182 
183   /* cut */
184   tool_item = gtk_tool_item_new();
185   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
186 		     (GtkWidget *) tool_item,
187 		     -1);
188 
189   notation_toolbar->cut = (GtkToolButton *) g_object_new(GTK_TYPE_TOOL_BUTTON,
190 							 "label", i18n("Cut"),
191 							 "icon-name", "edit-cut",
192 							 NULL);
193   gtk_container_add((GtkContainer *) tool_item,
194 		    (GtkWidget *) notation_toolbar->cut);
195 
196   /* paste */
197   tool_item = gtk_tool_item_new();
198   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
199 		     (GtkWidget *) tool_item,
200 		     -1);
201 
202   notation_toolbar->paste_tool = (GtkMenuToolButton *) g_object_new(GTK_TYPE_MENU_TOOL_BUTTON,
203 								    "label", i18n("Paste"),
204 								    "icon-name", "edit-paste",
205 								    NULL);
206 
207   menu = (GtkMenu *) gtk_menu_new();
208 
209   item = g_object_new(GTK_TYPE_CHECK_MENU_ITEM,
210 		      "label", i18n("match audio channel"),
211 		      "active", TRUE,
212 		      NULL);
213   gtk_menu_shell_append((GtkMenuShell *) menu,
214 			(GtkWidget *) item);
215 
216   item = g_object_new(GTK_TYPE_CHECK_MENU_ITEM,
217 		      "label", i18n("no duplicates"),
218 		      "active", TRUE,
219 		      NULL);
220   gtk_menu_shell_append((GtkMenuShell *) menu,
221 			(GtkWidget *) item);
222 
223   gtk_menu_tool_button_set_menu(notation_toolbar->paste_tool,
224 				(GtkWidget *) menu);
225   gtk_widget_show_all((GtkWidget *) menu);
226 
227   gtk_container_add((GtkContainer *) tool_item,
228 		    (GtkWidget *) notation_toolbar->paste_tool);
229 
230   /* invert */
231   tool_item = gtk_tool_item_new();
232   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
233 		     (GtkWidget *) tool_item,
234 		     -1);
235 
236   notation_toolbar->invert = (GtkButton *) g_object_new(GTK_TYPE_TOOL_BUTTON,
237 							"label", i18n("Invert"),
238 							"icon-name", "object-flip-vertical",
239 							"label", i18n("Invert"),
240 							NULL);
241   gtk_container_add((GtkContainer *) tool_item,
242 		    (GtkWidget *) notation_toolbar->invert);
243 
244   /* menu tool */
245   tool_item = gtk_tool_item_new();
246   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
247 		     (GtkWidget *) tool_item,
248 		     -1);
249 
250   notation_toolbar->menu_tool = (GtkMenuToolButton *) g_object_new(GTK_TYPE_MENU_TOOL_BUTTON,
251 								   "label", i18n("Tool"),
252 								   "icon-name", "system-run",
253 								   NULL);
254   gtk_container_add((GtkContainer *) tool_item,
255 		    (GtkWidget *) notation_toolbar->menu_tool);
256 
257   /* menu tool - tool popup */
258   notation_toolbar->tool_popup = ags_notation_toolbar_tool_popup_new(notation_toolbar);
259   gtk_menu_tool_button_set_menu(notation_toolbar->menu_tool,
260 				(GtkWidget *) notation_toolbar->tool_popup);
261 
262   /* menu tool - dialogs */
263   notation_toolbar->move_note = (GtkDialog *) ags_move_note_dialog_new(NULL);
264   notation_toolbar->crop_note = (GtkDialog *) ags_crop_note_dialog_new(NULL);
265   notation_toolbar->select_note = (GtkDialog *) ags_select_note_dialog_new(NULL);
266   notation_toolbar->position_notation_cursor = (GtkDialog *) ags_position_notation_cursor_dialog_new(NULL);
267 
268   /* zoom */
269   tool_item = gtk_tool_item_new();
270   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
271 		     (GtkWidget *) tool_item,
272 		     -1);
273 
274   hbox = gtk_hbox_new(FALSE,
275 		      0);
276   gtk_container_add((GtkContainer *) tool_item,
277 		    (GtkWidget *) hbox);
278 
279   label = (GtkLabel *) gtk_label_new(i18n("Zoom"));
280   gtk_box_pack_start(hbox,
281 		     (GtkWidget *) label,
282 		     FALSE, FALSE,
283 		     0);
284 
285   notation_toolbar->zoom_history = 2;
286   notation_toolbar->zoom = (GtkComboBoxText *) ags_zoom_combo_box_new();
287   gtk_combo_box_set_active((GtkComboBox *) notation_toolbar->zoom, 2);
288   gtk_box_pack_start(hbox,
289 		     (GtkWidget *) notation_toolbar->zoom,
290 		     FALSE, FALSE,
291 		     0);
292 
293   /* opacity */
294   tool_item = gtk_tool_item_new();
295   gtk_toolbar_insert((GtkToolbar *) notation_toolbar,
296 		     (GtkWidget *) tool_item,
297 		     -1);
298 
299   hbox = gtk_hbox_new(FALSE,
300 		      0);
301   gtk_container_add((GtkContainer *) tool_item,
302 		    (GtkWidget *) hbox);
303 
304   label = (GtkLabel *) gtk_label_new(i18n("Opacity"));
305   gtk_box_pack_start(hbox,
306 		     (GtkWidget *) label,
307 		     FALSE, FALSE,
308 		     0);
309 
310   notation_toolbar->opacity = (GtkSpinButton *) gtk_spin_button_new_with_range(0.0, 1.0, 0.001);
311   gtk_spin_button_set_value(notation_toolbar->opacity, 0.8);
312   gtk_box_pack_start(hbox,
313 		     (GtkWidget *) notation_toolbar->opacity,
314 		     FALSE, FALSE,
315 		     0);
316 }
317 
318 void
ags_notation_toolbar_connect(AgsConnectable * connectable)319 ags_notation_toolbar_connect(AgsConnectable *connectable)
320 {
321   AgsWindow *window;
322   AgsNotationToolbar *notation_toolbar;
323 
324   GList *list;
325 
326   notation_toolbar = AGS_NOTATION_TOOLBAR(connectable);
327 
328   if((AGS_NOTATION_TOOLBAR_CONNECTED & (notation_toolbar->flags)) != 0){
329     return;
330   }
331 
332   notation_toolbar->flags |= AGS_NOTATION_TOOLBAR_CONNECTED;
333 
334   window = AGS_WINDOW(gtk_widget_get_ancestor((GtkWidget *) notation_toolbar, AGS_TYPE_WINDOW));
335 
336   g_object_set(notation_toolbar->move_note,
337 	       "main-window", window,
338 	       NULL);
339   g_object_set(notation_toolbar->crop_note,
340 	       "main-window", window,
341 	       NULL);
342   g_object_set(notation_toolbar->select_note,
343 	       "main-window", window,
344 	       NULL);
345   g_object_set(notation_toolbar->position_notation_cursor,
346 	       "main-window", window,
347 	       NULL);
348 
349   /* tool */
350   g_signal_connect_after((GObject *) notation_toolbar->position, "toggled",
351 			 G_CALLBACK(ags_notation_toolbar_position_callback), (gpointer) notation_toolbar);
352 
353   g_signal_connect_after((GObject *) notation_toolbar->edit, "toggled",
354 			 G_CALLBACK(ags_notation_toolbar_edit_callback), (gpointer) notation_toolbar);
355 
356   g_signal_connect_after((GObject *) notation_toolbar->clear, "toggled",
357 			 G_CALLBACK(ags_notation_toolbar_clear_callback), (gpointer) notation_toolbar);
358 
359   g_signal_connect_after((GObject *) notation_toolbar->select, "toggled",
360 			 G_CALLBACK(ags_notation_toolbar_select_callback), (gpointer) notation_toolbar);
361 
362   /* edit */
363   g_signal_connect((GObject *) notation_toolbar->copy, "clicked",
364 		   G_CALLBACK(ags_notation_toolbar_copy_or_cut_callback), (gpointer) notation_toolbar);
365 
366   g_signal_connect((GObject *) notation_toolbar->cut, "clicked",
367 		   G_CALLBACK(ags_notation_toolbar_copy_or_cut_callback), (gpointer) notation_toolbar);
368 
369   g_signal_connect((GObject *) notation_toolbar->paste_tool, "clicked",
370 		   G_CALLBACK(ags_notation_toolbar_paste_callback), (gpointer) notation_toolbar);
371 
372   g_signal_connect((GObject *) notation_toolbar->invert, "clicked",
373 		   G_CALLBACK(ags_notation_toolbar_invert_callback), (gpointer) notation_toolbar);
374 
375   list = gtk_container_get_children((GtkContainer *) gtk_menu_tool_button_get_menu(notation_toolbar->paste_tool));
376 
377   g_signal_connect_after(list->data, "activate",
378 			 G_CALLBACK(ags_notation_toolbar_match_audio_channel_callback), notation_toolbar);
379 
380   g_signal_connect_after(list->next->data, "activate",
381 			 G_CALLBACK(ags_notation_toolbar_no_duplicates_callback), notation_toolbar);
382 
383   g_list_free(list);
384 
385   /* additional tools */
386   ags_connectable_connect(AGS_CONNECTABLE(notation_toolbar->position_notation_cursor));
387 
388   ags_connectable_connect(AGS_CONNECTABLE(notation_toolbar->crop_note));
389 
390   ags_connectable_connect(AGS_CONNECTABLE(notation_toolbar->move_note));
391 
392   ags_connectable_connect(AGS_CONNECTABLE(notation_toolbar->select_note));
393 
394   /* zoom */
395   g_signal_connect_after((GObject *) notation_toolbar->zoom, "changed",
396 			 G_CALLBACK(ags_notation_toolbar_zoom_callback), (gpointer) notation_toolbar);
397 
398   /* opacity */
399   g_signal_connect_after((GObject *) notation_toolbar->opacity, "value-changed",
400 			 G_CALLBACK(ags_notation_toolbar_opacity_callback), (gpointer) notation_toolbar);
401 }
402 
403 void
ags_notation_toolbar_disconnect(AgsConnectable * connectable)404 ags_notation_toolbar_disconnect(AgsConnectable *connectable)
405 {
406   AgsNotationToolbar *notation_toolbar;
407 
408   GList *list;
409 
410   notation_toolbar = AGS_NOTATION_TOOLBAR(connectable);
411 
412   if((AGS_NOTATION_TOOLBAR_CONNECTED & (notation_toolbar->flags)) == 0){
413     return;
414   }
415 
416   notation_toolbar->flags &= (~AGS_NOTATION_TOOLBAR_CONNECTED);
417 
418   /* tool */
419   g_object_disconnect(G_OBJECT(notation_toolbar->position),
420 		      "any_signal::toggled",
421 		      G_CALLBACK(ags_notation_toolbar_position_callback),
422 		      notation_toolbar,
423 		      NULL);
424 
425   g_object_disconnect(G_OBJECT(notation_toolbar->edit),
426 		      "any_signal::toggled",
427 		      G_CALLBACK(ags_notation_toolbar_edit_callback),
428 		      notation_toolbar,
429 		      NULL);
430 
431   g_object_disconnect(G_OBJECT(notation_toolbar->clear),
432 		      "any_signal::toggled",
433 		      G_CALLBACK(ags_notation_toolbar_clear_callback),
434 		      notation_toolbar,
435 		      NULL);
436 
437   g_object_disconnect(G_OBJECT(notation_toolbar->select),
438 		      "any_signal::toggled",
439 		      G_CALLBACK(ags_notation_toolbar_select_callback),
440 		      notation_toolbar,
441 		      NULL);
442 
443   /* edit */
444   g_object_disconnect(G_OBJECT(notation_toolbar->copy),
445 		      "any_signal::clicked",
446 		      G_CALLBACK(ags_notation_toolbar_copy_or_cut_callback),
447 		      notation_toolbar,
448 		      NULL);
449 
450   g_object_disconnect(G_OBJECT(notation_toolbar->cut),
451 		      "any_signal::clicked",
452 		      G_CALLBACK(ags_notation_toolbar_copy_or_cut_callback),
453 		      notation_toolbar,
454 		      NULL);
455 
456   g_object_disconnect(G_OBJECT(notation_toolbar->paste_tool),
457 		      "any_signal::clicked",
458 		      G_CALLBACK(ags_notation_toolbar_paste_callback),
459 		      notation_toolbar,
460 		      NULL);
461 
462   g_object_disconnect(G_OBJECT(notation_toolbar->invert),
463 		      "any_signal::clicked",
464 		      G_CALLBACK(ags_notation_toolbar_invert_callback),
465 		      notation_toolbar,
466 		      NULL);
467 
468   list = gtk_container_get_children((GtkContainer *) gtk_menu_tool_button_get_menu(notation_toolbar->paste_tool));
469 
470   g_object_disconnect(G_OBJECT(list->data),
471 		      "any_signal::activate",
472 		      G_CALLBACK(ags_notation_toolbar_match_audio_channel_callback),
473 		      notation_toolbar,
474 		      NULL);
475 
476   g_object_disconnect(G_OBJECT(list->next->data),
477 		      "any_signal::activate",
478 		      G_CALLBACK(ags_notation_toolbar_no_duplicates_callback),
479 		      notation_toolbar,
480 		      NULL);
481 
482   g_list_free(list);
483 
484   /* additional tools */
485   ags_connectable_disconnect(AGS_CONNECTABLE(notation_toolbar->position_notation_cursor));
486 
487   ags_connectable_disconnect(AGS_CONNECTABLE(notation_toolbar->crop_note));
488 
489   ags_connectable_disconnect(AGS_CONNECTABLE(notation_toolbar->move_note));
490 
491   ags_connectable_disconnect(AGS_CONNECTABLE(notation_toolbar->select_note));
492 
493   /* zoom */
494   g_object_disconnect(G_OBJECT(notation_toolbar->zoom),
495 		      "any_signal::changed",
496 		      G_CALLBACK(ags_notation_toolbar_zoom_callback),
497 		      notation_toolbar,
498 		      NULL);
499 
500 
501   /* opacity */
502   g_object_disconnect(G_OBJECT(notation_toolbar->opacity),
503 		      "any_signal::value-changed",
504 		      G_CALLBACK(ags_notation_toolbar_opacity_callback),
505 		      notation_toolbar,
506 		      NULL);
507 }
508 
509 /**
510  * ags_notation_toolbar_tool_popup_new:
511  * @notation_toolbar: the #AgsNotationToolbar
512  *
513  * Create a new #GtkMenu suitable for menu tool button.
514  *
515  * Returns: a new #GtkMenu
516  *
517  * Since: 3.0.0
518  */
519 GtkMenu*
ags_notation_toolbar_tool_popup_new(AgsNotationToolbar * notation_toolbar)520 ags_notation_toolbar_tool_popup_new(AgsNotationToolbar *notation_toolbar)
521 {
522   GtkMenu *tool_popup;
523   GtkMenuItem *item;
524 
525   GList *list, *list_start;
526 
527   tool_popup = (GtkMenu *) gtk_menu_new();
528 
529   item = (GtkMenuItem *) gtk_menu_item_new_with_label(i18n("move notes"));
530   gtk_menu_shell_append((GtkMenuShell *) tool_popup, (GtkWidget *) item);
531 
532   item = (GtkMenuItem *) gtk_menu_item_new_with_label(i18n("crop notes"));
533   gtk_menu_shell_append((GtkMenuShell *) tool_popup, (GtkWidget *) item);
534 
535   item = (GtkMenuItem *) gtk_menu_item_new_with_label(i18n("select notes"));
536   gtk_menu_shell_append((GtkMenuShell *) tool_popup, (GtkWidget *) item);
537 
538   item = (GtkMenuItem *) gtk_menu_item_new_with_label(i18n("position cursor"));
539   gtk_menu_shell_append((GtkMenuShell *) tool_popup, (GtkWidget *) item);
540 
541   gtk_menu_shell_append((GtkMenuShell*) tool_popup,
542 			(GtkWidget*) gtk_separator_menu_item_new());
543 
544   item = (GtkMenuItem *) gtk_menu_item_new_with_label(i18n("enable all audio channels"));
545   gtk_menu_shell_append((GtkMenuShell *) tool_popup, (GtkWidget *) item);
546 
547   item = (GtkMenuItem *) gtk_menu_item_new_with_label(i18n("disable all audio channels"));
548   gtk_menu_shell_append((GtkMenuShell *) tool_popup, (GtkWidget *) item);
549 
550   /* connect */
551   list_start =
552     list = gtk_container_get_children((GtkContainer *) tool_popup);
553 
554   g_signal_connect(G_OBJECT(list->data), "activate",
555 		   G_CALLBACK(ags_notation_toolbar_tool_popup_move_note_callback), (gpointer) notation_toolbar);
556 
557   list = list->next;
558   g_signal_connect(G_OBJECT(list->data), "activate",
559 		   G_CALLBACK(ags_notation_toolbar_tool_popup_crop_note_callback), (gpointer) notation_toolbar);
560 
561   list = list->next;
562   g_signal_connect(G_OBJECT(list->data), "activate",
563 		   G_CALLBACK(ags_notation_toolbar_tool_popup_select_note_callback), (gpointer) notation_toolbar);
564 
565   list = list->next;
566   g_signal_connect(G_OBJECT(list->data), "activate",
567 		   G_CALLBACK(ags_notation_toolbar_tool_popup_position_cursor_callback), (gpointer) notation_toolbar);
568 
569   list = list->next->next;
570   g_signal_connect(G_OBJECT(list->data), "activate",
571 		   G_CALLBACK(ags_notation_toolbar_tool_popup_enable_all_lines_callback), (gpointer) notation_toolbar);
572 
573   list = list->next;
574   g_signal_connect(G_OBJECT(list->data), "activate",
575 		   G_CALLBACK(ags_notation_toolbar_tool_popup_disable_all_lines_callback), (gpointer) notation_toolbar);
576 
577   g_list_free(list_start);
578 
579   /* show */
580   gtk_widget_show_all((GtkWidget *) tool_popup);
581 
582   return(tool_popup);
583 }
584 
585 /**
586  * ags_notation_toolbar_new:
587  *
588  * Create a new #AgsNotationToolbar.
589  *
590  * Returns: a new #AgsNotationToolbar
591  *
592  * Since: 3.0.0
593  */
594 AgsNotationToolbar*
ags_notation_toolbar_new()595 ags_notation_toolbar_new()
596 {
597   AgsNotationToolbar *notation_toolbar;
598 
599   notation_toolbar = (AgsNotationToolbar *) g_object_new(AGS_TYPE_NOTATION_TOOLBAR,
600 							 NULL);
601 
602   return(notation_toolbar);
603 }
604