diff -urN ../denemo-cvs/denemo/src/denemoui.xml denemo/src/denemoui.xml --- ../denemo-cvs/denemo/src/denemoui.xml 2007-10-25 18:29:41.000000000 +0100 +++ denemo/src/denemoui.xml 2007-10-28 17:27:25.000000000 +0000 @@ -51,8 +51,8 @@ - - + + diff -urN ../denemo-cvs/denemo/src/main.c denemo/src/main.c --- ../denemo-cvs/denemo/src/main.c 2007-08-22 10:50:05.000000000 +0100 +++ denemo/src/main.c 2007-10-28 09:42:34.000000000 +0000 @@ -90,6 +90,12 @@ }; static void +load_accels (gchar *name) { + gchar *filename = g_build_filename(locatedotdenemo(),name,NULL); + gtk_accel_map_load (filename); + g_free(filename); +} +static void register_stock_icon (GtkIconFactory * icon_factory, const gchar * stock_id, const gchar * file) { @@ -440,6 +446,7 @@ gtk_init (&argc, &argv); register_stock_items (); newview (); + load_accels("standard.accels"); /* audio initialization */ diff -urN ../denemo-cvs/denemo/src/staffpropdialog.c denemo/src/staffpropdialog.c --- ../denemo-cvs/denemo/src/staffpropdialog.c 2007-01-24 19:44:26.000000000 +0000 +++ denemo/src/staffpropdialog.c 2007-10-28 09:46:39.000000000 +0000 @@ -224,9 +224,9 @@ g_string_assign (staffstruct->midi_instrument, gtk_entry_get_text (GTK_ENTRY (cbdata->midientry))); - if ((n = atoi (gtk_entry_get_text (GTK_ENTRY (cbdata->aboveentry))))) + if ((n = atoi (gtk_entry_get_text (GTK_ENTRY (cbdata->aboveentry)))) >= 0) staffstruct->space_above = n; - if ((n = atoi (gtk_entry_get_text (GTK_ENTRY (cbdata->belowentry))))) + if ((n = atoi (gtk_entry_get_text (GTK_ENTRY (cbdata->belowentry)))) >= 0) staffstruct->space_below = n; if ((n = atoi (gtk_entry_get_text (GTK_ENTRY (cbdata->numlinesentry))))) staffstruct->no_of_lines = n; diff -urN ../denemo-cvs/denemo/src/view.c denemo/src/view.c --- ../denemo-cvs/denemo/src/view.c 2007-10-10 04:14:29.000000000 +0100 +++ denemo/src/view.c 2007-10-28 17:25:59.000000000 +0000 @@ -462,6 +462,163 @@ return TRUE; } +/* define accelerator + */ +static gint +capture_accel_for_action (GtkWidget * widget, GdkEventKey *event, GtkAction *action) { + const gchar * accel_path = gtk_action_get_accel_path (action); + guint modifiers; + modifiers = gtk_accelerator_get_default_mod_mask (); + gtk_accel_map_change_entry (accel_path, + event->keyval, + event->state & modifiers, TRUE); + //g_print("key val %d, state %d\n", event->keyval, event->state & modifiers); + accel_path = gtk_action_get_accel_path (action); + GtkAccelKey key; + gboolean has_accel = gtk_accel_map_lookup_entry (accel_path, &key); + gchar *accel_label = has_accel?gtk_accelerator_get_label (key.accel_key, key.accel_mods):"No shortcut"; + gtk_button_set_label(GTK_BUTTON(widget), accel_label); + return FALSE; +} + +static void +save_accels (GtkButton *button, DenemoGUI *gui) { + gchar *filename = g_build_filename(locatedotdenemo(),"standard.accels",NULL); + gtk_accel_map_save (filename); + g_free(filename); +} + +static void +accept_keypress(GtkButton *button, GtkAction *action){ + g_signal_connect (GTK_OBJECT (button), "key_press_event", + G_CALLBACK (capture_accel_for_action), action); + gtk_button_set_label(button, "Press the key combination desired"); +} + +static void +delete_accel(GtkButton *button, gchar *accel_path) { + gtk_accel_map_change_entry (accel_path, 0, 0, TRUE); + gtk_button_set_label(button, "Press OK to confirm delete of shortcut"); +} + + + +typedef struct accel_cb { + DenemoGUI *gui; + GtkAction *action; +} accel_cb; + + +/* + help_and_set_accels display the tooltip for the action passed in INFO + and allow change to the accelerator for that action. + +*/ +static gboolean help_and_set_accels (GtkWidget *widget, + GdkEventButton *event, + accel_cb *info) +{ + GtkAction *action = info->action; + DenemoGUI *gui = info->gui; + + if( event->button != 3) + return FALSE; + GtkWidget *dialog; + + GtkWidget *label; + GtkWidget *button; + const gchar * accel_path = gtk_action_get_accel_path (action); + GtkAccelKey key; + gboolean has_accel = gtk_accel_map_lookup_entry (accel_path, &key); + gchar *accel_label; + accel_label = has_accel?gtk_accelerator_get_label (key.accel_key, key.accel_mods):""; + has_accel = accel_label && *accel_label; + dialog = gtk_dialog_new_with_buttons (_("About this function"), + NULL /*GTK_WINDOW (gui->window)*/, + (GtkDialogFlags) (GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, + NULL); + gchar *tooltip; + g_object_get (action, "tooltip", &tooltip, NULL); + gboolean has_tooltip = tooltip && *tooltip; + const gchar *func_name = gtk_action_get_name(action); + + + label = gtk_label_new (""); + + gchar *format = g_strdup_printf("%s%s", + N_("Help for this menu item:\n"), + has_tooltip?tooltip:func_name); + gtk_label_set_markup (GTK_LABEL (label), format); + g_free(format); + g_free(tooltip); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, + TRUE, TRUE, 0); + gchar *shortcut=g_strdup_printf("%s %s\n%s", + has_accel?"Current shortcut: ":"", + has_accel?accel_label:"Curently no shortcut", + has_accel?"Change keyboard shortcut":"Create keyboard shortcut" ); + button = gtk_button_new_with_label(shortcut); + g_free(shortcut); + + g_signal_connect (G_OBJECT (button), "clicked", + G_CALLBACK (accept_keypress), action); + + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), button, + TRUE, TRUE, 0); + + /*********** save button *****/ + + button = gtk_button_new_with_label("Save my shortcuts"); + + g_signal_connect (G_OBJECT (button), "clicked", + G_CALLBACK (save_accels), gui); + + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), button, + TRUE, TRUE, 0); + + + + /*********** delete shortcut button *****/ + if(has_accel) { + button = gtk_button_new_with_label("Delete this shortcut"); + + g_signal_connect (G_OBJECT (button), "clicked", + G_CALLBACK (delete_accel), (gpointer)accel_path); + + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), button, + TRUE, TRUE, 0); + } + + + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); + + + + + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); + gtk_widget_show_all (dialog); + + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) + { + } else {/* cancel */ + + if(has_accel) + gtk_accel_map_change_entry (accel_path, key.accel_key, key.accel_mods , TRUE); + else + gtk_accel_map_change_entry (accel_path, 0, 0, TRUE); +/* note: gtk_action_disconnect_accelerator(action); this does not remove the accel, just makes it unusable */ + } + + gtk_widget_destroy (dialog); + return TRUE; +} + + + /* edit a rhythm pattern */ @@ -489,7 +646,7 @@ entry = gtk_entry_new (); - gtk_widget_modify_font(entry, pango_font_description_from_string ("Denemo 14")); + gtk_widget_modify_font(entry, pango_font_description_from_string ("Denemo 14"));//FIXME the point size does not change the font size g_signal_connect (GTK_OBJECT (entry), "key_press_event", G_CALLBACK (translate_rhythm), r); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), entry, @@ -515,9 +672,10 @@ RhythmElement *el; for(g=r->rsteps, i=0;g;g=g->next, i+=g_list_length(el->functions)) { el = (RhythmElement*)g->data; -#define highlight(c) ((c)+20) +#define highlight(c) ((c)+20) /* an offset of 20 built-in to the definition of the Denemo.ttf font */ gchar *fmt; fmt = g_strdup_printf("%%.%ds%c%s",i,highlight(*(pattern+i)),pattern+i+1); +#undef highlight //g_printf("format string %s\n", fmt); el->icon = music_font(g_strdup_printf(fmt, pattern));//FIXME memory leak //g_print("el->icon = %s\n", el->icon); @@ -655,137 +813,132 @@ return; } /** - * Menu entries with shortcut keys, tooltips, and callback functions + * Menu entries with no shortcut keys, tooltips, and callback functions */ GtkActionEntry menu_entries[] = { {"FileMenu", NULL, N_("_File")}, - {"New", GTK_STOCK_NEW, N_("_New"), "n", "Create a new file", + {"New", GTK_STOCK_NEW, N_("_New"), NULL, "Start a new musical score", G_CALLBACK (file_newwrapper)}, - {"OpenTemplate", GTK_STOCK_NEW, N_("New from Template"), NULL, - "Open New Score From Template", + {"OpenTemplate", GTK_STOCK_NEW, N_("New score from template"), NULL, + "Start a new score from a template file\n(currently not working)", G_CALLBACK (file_open_template_wrapper)}, - {"NewWindow", NULL, N_("New Window"), NULL, "Create a new window", + {"NewWindow", NULL, N_("New Window"), NULL, "Create a new window with an empty score in it", G_CALLBACK (createview)}, - {"Open", GTK_STOCK_OPEN, N_("_Open"), "o", "Open a file", + {"Open", GTK_STOCK_OPEN, N_("_Open"), NULL, "Open a file containing a music score for editing", G_CALLBACK (file_openwrapper)}, {"OpenNewWindow", NULL, N_("Open in New Window"), NULL, - "Open in a New Window", G_CALLBACK (openinnew)}, - {"Save", GTK_STOCK_SAVE, N_("_Save"), "s", "Save File", + "Open a file containing a music score for editing\nThe score will open in a separate window", G_CALLBACK (openinnew)}, + {"Save", GTK_STOCK_SAVE, N_("_Save"), NULL, "Save the score", G_CALLBACK (file_savewrapper)}, - {"SaveAs", GTK_STOCK_SAVE_AS, N_("Save _As"), NULL, "Save File As..", + {"SaveAs", GTK_STOCK_SAVE_AS, N_("Save _As"), NULL, "Save the score under a new name", G_CALLBACK (file_saveaswrapper)}, - {"SaveParts", NULL, N_("Save Parts"), NULL, "Save Parts", + {"SaveParts", NULL, N_("Save Parts"), NULL, "Save Parts\n(not sure what/if this does anything)", G_CALLBACK (file_savepartswrapper)}, - {"ExportPDF", NULL, N_("Export PDF"), NULL, "Export PDF...", + {"ExportPDF", NULL, N_("Export PDF"), NULL, "Export the score as a PDF document file", G_CALLBACK (export_pdf_action)}, - {"ConfigureScore", GTK_STOCK_PROPERTIES, N_("Score Configuration"), "w", - "Score Configuration", + {"ConfigureScore", GTK_STOCK_PROPERTIES, N_("Score Configuration"), NULL, + "Start up a wizard to create a new score\nThis allows you to set various properties of the score", G_CALLBACK (scorewizard)}, - {"Print", GTK_STOCK_PRINT, N_("_Print"), "p", "Print Score", + {"Print", GTK_STOCK_PRINT, N_("_Print"), NULL, "Displays the final finished score in a pdf viewer\nFrom this you can print the file using the print command of the viewer", G_CALLBACK (print)}, - {"Close", GTK_STOCK_CLOSE, N_("_Close"), NULL, "Close View", + {"Close", GTK_STOCK_CLOSE, N_("_Close"), NULL, "Close the current score\nOther windows will stay open", G_CALLBACK (closeview)}, - {"Quit", GTK_STOCK_QUIT, N_("_Quit"), "q", "Quit Denemo", + {"Quit", GTK_STOCK_QUIT, N_("_Quit"), NULL, "Quit the Denemo program", G_CALLBACK (closewrapper)}, {"EditMenu", NULL, N_("_Edit")}, - {"Undo", GTK_STOCK_UNDO, N_("_Undo"), "z", "Undo", + {"Undo", GTK_STOCK_UNDO, N_("_Undo"), NULL, "Undo", G_CALLBACK (undowrapper)}, - {"Redo", GTK_STOCK_REDO, N_("_Redo"), "y", "Redo", + {"Redo", GTK_STOCK_REDO, N_("_Redo"), NULL, "Redo", G_CALLBACK (redowrapper)}, - {"Copy", GTK_STOCK_COPY, N_("_Copy"), "c", "Copy", + {"Copy", GTK_STOCK_COPY, N_("_Copy"), NULL, "Copy", G_CALLBACK (copywrapper)}, - {"Cut", GTK_STOCK_CUT, N_("Cu_t"), "x", "Cut", + {"Cut", GTK_STOCK_CUT, N_("Cu_t"), NULL, "Cut", G_CALLBACK (cutwrapper)}, - {"Paste", GTK_STOCK_PASTE, N_("_Paste"), "v", "Paste", + {"Paste", GTK_STOCK_PASTE, N_("_Paste"), NULL, "Paste", G_CALLBACK (pastewrapper)}, - {"ScoreProperties", GTK_STOCK_PROPERTIES, N_("_Score properties"), NULL, - NULL, G_CALLBACK (score_properties_dialog)}, - {"SaveSelection", NULL, N_("Save Selection"), NULL, "Save Selection", + {"ScoreProperties", GTK_STOCK_PROPERTIES, N_("_Score properties"), NULL,"Change some of the properties of the current score\nThis will start up a dialog window", + G_CALLBACK (score_properties_dialog)}, + {"SaveSelection", NULL, N_("Save Selection"), NULL, "Save the selected music/nNot sure if this is working", G_CALLBACK (saveselwrapper)}, - {"Preferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), NULL, - "Preferences", G_CALLBACK (preferences_change)}, + {"Preferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), NULL, "Set and save your preferences for how Denemo operates on startup", + G_CALLBACK (preferences_change)}, // {"Keyboard", NULL, N_("_Keyboard"), NULL, NULL, // G_CALLBACK (configure_keyboard_dialog)}, - {"Keyboard", NULL, N_("Set Keybindings"), NULL, NULL, + {"Keyboard", NULL, N_("Set Keybindings"), NULL, "View, change and save keyboard bindings\nThese are being replaced with the shortcuts that appear next to menu items,\nwhich take precedence in case of conflicts", G_CALLBACK (configure_keyboard_dialog_OLD)}, {"LoadPlugins", NULL, N_("Load Plugins"), NULL, "Load Plugins", G_CALLBACK (load_plugin)}, {"UnloadPlugins", NULL, N_("Unload Plugins"), NULL, "Unload Plugins", G_CALLBACK (unloadplugins)}, - {"ListPlugins", NULL, N_("List Plugins"), NULL, "List Plugins", + {"ListPlugins", NULL, N_("List Plugins"), NULL, "List the loaded plugins", G_CALLBACK (list_loaded_plugins)}, {"ListAvailPlugins", NULL, N_("List Available Plugins"), NULL, - "List Available Plugins", G_CALLBACK (list_available_plugins)}, + "List the available plugins", G_CALLBACK (list_available_plugins)}, {"ViewMenu", NULL, N_("_View")}, {"EntryMenu", NULL, N_("Mo_de")}, - - - - - {"StaffMenu", NULL, N_("_Staff")}, - {"AddBefore", NULL, N_("Add _Before Current Staff..."), NULL, NULL, + {"AddBefore", NULL, N_("Add _Before Current Staff..."), NULL, "Inserts a new staff before the current staff", G_CALLBACK (newstaffbefore)}, - {"AddAfter", NULL, N_("Add _After Current Staff..."), NULL, NULL, + {"AddAfter", NULL, N_("Add _After Current Staff..."), NULL, "Inserts/Adds a new staff after the current staff", G_CALLBACK (dnm_newstaffafter)}, - {"AddInitial", NULL, N_("Add in Initial Position..."), NULL, NULL, + {"AddInitial", NULL, N_("Add in Initial Position..."), NULL, "Inserts a new staff at the top of the score", G_CALLBACK (newstaffinitial)}, - {"AddLast", NULL, N_("Add in Last Position..."), NULL, NULL, + {"AddLast", NULL, N_("Add in Last Position..."), NULL, "Inserts a new staff at the end of the score", G_CALLBACK (newstafflast)}, - {"DeleteBefore", NULL, N_("Delete Staff Before"), NULL, NULL, + {"DeleteBefore", NULL, N_("Delete Staff Before"), NULL, "Deletes the staff before the current staff", G_CALLBACK (delete_staff_before)}, - {"Delete", GTK_STOCK_DELETE, N_("_Delete Staff"), NULL, NULL, + {"Delete", GTK_STOCK_DELETE, N_("_Delete Staff"), NULL, "Deletes the current staff", G_CALLBACK (delete_staff_current)}, - {"DeleteAfter", NULL, N_("Delete Staff After"), NULL, NULL, + {"DeleteAfter", NULL, N_("Delete Staff After"), NULL, "Deletes the staff after the current staff", G_CALLBACK (delete_staff_after)}, - {"AddVoice", NULL, N_("Add _Voice to Current Staff..."), NULL, NULL, + {"AddVoice", NULL, N_("Add _Voice to Current Staff"), NULL, "Adds a new voice(part) to the current staff\nIt can be difficult at present to switch between the voices\nAlso do they print out properly?", G_CALLBACK (dnm_newstaffvoice)}, {"AddLyric", NULL, N_("Add _Lyric Staff..."), NULL, NULL, G_CALLBACK (newstafflyric)}, - {"AddFiguredBass", NULL, N_("Add Figured Bass Staff..."), NULL, NULL, + {"AddFiguredBass", NULL, N_("Add Figured Bass Staff..."), NULL, "Not known to be useful", G_CALLBACK (dnm_newstafffigured)}, - {"AddChords", NULL, N_("Add Chords to Staff..."), NULL, NULL, + {"AddChords", NULL, N_("Add Chords to Staff..."), NULL, N_("Add Chords to Staff\nNot sure what this does"), G_CALLBACK (dnm_newstaffchords)}, - {"StaffProperties", GTK_STOCK_PROPERTIES, N_("Staff _Properties"), NULL, - NULL, G_CALLBACK (staff_properties_change)}, + {"StaffProperties", GTK_STOCK_PROPERTIES, N_("Staff _Properties"), NULL,"Change the properties of the current staff", + G_CALLBACK (staff_properties_change)}, {"InsertMenu", NULL, N_("_Insert")}, {"Clef", NULL, N_("_Clef")}, - {"InitialClef", NULL, N_("_Set Clef"), NULL, NULL, + {"InitialClef", NULL, N_("_Set Clef"), NULL, "Change the initial clef of the current staff", G_CALLBACK (clef_change_initial)}, - {"InsertClef", NULL, N_("Insert Clef _Change"), NULL, NULL, + {"InsertClef", NULL, N_("Insert Clef _Change"), NULL, N_("Insert a change of clef at the cursor"), G_CALLBACK (clef_change_insert)}, {"Key", NULL, N_("_Key")}, - {"InitialKey", NULL, N_("_Initial Key"), NULL, NULL, + {"InitialKey", NULL, N_("_Initial Key"), NULL, N_("Set the initial key signature of the current staff"), G_CALLBACK (key_change_initial)}, - {"InsertKey", NULL, N_("Insert Key _Change"), NULL, NULL, + {"InsertKey", NULL, N_("Insert Key _Change"), NULL, N_("Insert a key change at the cursor position"), G_CALLBACK (key_change_insert)}, {"TimeSig", NULL, N_("_Time Signature")}, - {"InitialTimeSig", NULL, N_("_Initial Time Signature"), NULL, NULL, + {"InitialTimeSig", NULL, N_("_Initial Time Signature"), NULL, N_("Set the initial time signature of the current staff"), G_CALLBACK (timesig_change_initial)}, - {"InsertTimeSig", NULL, N_("Insert Time Signature _Change"), NULL, NULL, + {"InsertTimeSig", NULL, N_("Insert Time Signature _Change"), NULL, N_("Insert a time signature change at the cursor position"), G_CALLBACK (timesig_change_insert)}, /* {"OtherMenu", NULL, N_("_Other")}, */ - {"ChangeNotehead", NULL, N_("_Notehead"), NULL, NULL, + {"ChangeNotehead", NULL, N_("_Notehead"), NULL, N_("Change the type of notehead for the current note"), G_CALLBACK (set_notehead)}, - {"InsertStem", NULL, N_("Insert _Stem Directive"), NULL, NULL, + {"InsertStem", NULL, N_("Insert _Stem Directive"), NULL, N_("Not known to be working"), G_CALLBACK (stem_directive_insert)}, {"Lyrics", NULL, N_("_Lyrics")}, - {"InsertLyric", NULL, N_("Insert Lyric"), NULL, NULL, + {"InsertLyric", NULL, N_("Insert Lyric"), NULL, N_("See edit lyric - appears to be the same"), G_CALLBACK (lyric_insert)}, - {"EditLyric", NULL, N_("Edit _Lyric"), NULL, NULL, + {"EditLyric", NULL, N_("Edit _Lyric"), NULL, N_("Add a lyric to current note\nBeware that all previous notes must have lyrics before printing"), G_CALLBACK (lyric_insert)}, - {"EditFiguredBass", NULL, N_("Edit Figured Bass"), NULL, NULL, + {"EditFiguredBass", NULL, N_("Edit Figured Bass"), NULL, N_("Add a bass figure to the current note\nUse | sign to split the duration of a note so as to have multiple figures on one note.\nSee Lilypond docs for other notation"), G_CALLBACK (figure_insert)}, - {"EditChords", NULL, N_("Edit Chords"), NULL, NULL, + {"EditChords", NULL, N_("Edit Chords"), NULL, N_("Allows chord symbols to be added to the current note\nE.G.cis:dim7 for c-sharp diminished 7th.\nSee Lilypond docs for notation"), G_CALLBACK (fakechord_insert)}, - {"InsertDynamic", NULL, N_("Insert _Dynamic"), NULL, NULL, + {"InsertDynamic", NULL, N_("Insert _Dynamic"), NULL, N_("Inserts a dynamic marking at the cursor position"), G_CALLBACK (insert_dynamic)}, /* {"InsertLilyDirective", NULL, N_("Insert Lilypond Directive"), NULL, NULL, G_CALLBACK (lily_directive)}, */ - {"InsertBarline", NULL, N_("Insert _Barline"), NULL, NULL, + {"InsertBarline", NULL, N_("Insert _Barline"), NULL, N_("Inserts specialized barline at the cursor position\nMostly not working"), G_CALLBACK (insert_barline)}, {"NavigationMenu", NULL, N_("_Navigation")}, - {"GoToMeasure", NULL, N_("Go To _Measure..."), NULL, NULL, + {"GoToMeasure", NULL, N_("Go To _Measure..."), NULL, N_("Opens a dialog for going to a numbered measure"), G_CALLBACK (tomeasurenum)}, {"GoToBeginning", GTK_STOCK_GOTO_FIRST, N_("Go To _Beginning"), "Home", N_("Go To Beginning"), @@ -806,18 +959,19 @@ {"PlayCSound", GTK_STOCK_MEDIA_PLAY, N_("Play using _CSound..."), NULL, N_("Play using CSound..."), G_CALLBACK (dnm_csoundplayback)}, - {"Properties", GTK_STOCK_PROPERTIES, N_("Playback Pr_operties"), NULL, NULL, + {"Properties", GTK_STOCK_PROPERTIES, N_("Playback Pr_operties"), NULL, N_("Allows you to specify properties used in playing back (midi and csound)"), G_CALLBACK (playback_properties_change)}, {"HelpMenu", NULL, N_("_Help")}, - {"Help", NULL, N_("Help"), NULL, NULL, G_CALLBACK (browse_manual)}, - {"About", NULL, N_("_About"), NULL, NULL, + {"Help", NULL, N_("Help"), NULL, N_("Opens a browser on the user manual"), + G_CALLBACK (browse_manual)}, + {"About", NULL, N_("_About"), NULL, N_("Gives the version number etc of this program"), G_CALLBACK (about)}, {"Bookmarks", NULL, N_("Bookmarks")}, - {"AddBookmark", NULL, N_("Add Bookmark"), NULL, NULL, + {"AddBookmark", NULL, N_("Add Bookmark"), NULL, N_("Bookmark the current cursor position"), G_CALLBACK (addbookmark)}, - {"GotoBookMark", NULL, N_("Goto Bookmark"), NULL, NULL, + {"GotoBookMark", NULL, N_("Goto Bookmark"), NULL, N_("Go to a bookmarked point in the score"), G_CALLBACK (gotobookmark)}, - {"Stub", NULL, N_(" "), NULL, NULL, G_CALLBACK (dummy)}, + {"Stub", NULL, N_(" "), NULL, N_("Does nothing"), G_CALLBACK (dummy)}, {"OpenRecent", NULL, N_("Open Recent")}, /* Note entry */ {"InsertWholeNote", "denemo-whole-note", N_("Full note"), NULL, @@ -931,7 +1085,7 @@ break; case INPUTNORMAL: SET_MODE(INPUTNORMAL); - a = gtk_ui_manager_get_action (gui->ui_manager, "/MainMenu/EntryMenu/Replace"); + a = gtk_ui_manager_get_action (gui->ui_manager, "/MainMenu/EntryMenu/Insert"); gtk_action_activate(a); break; case INPUTBLANK: @@ -979,11 +1133,9 @@ /* always turn rhythm mode on with pitch recognition, since otherwise the cursor just bobs about uselessly, while the accidentals in the notes affect the previous note */ - GtkAction *mode = gtk_ui_manager_get_action (gui->ui_manager, gui->pitch_recognition?"/MainMenu/EntryMenu/Replace": "/MainMenu/EntryMenu/TogglePitchless"); - //g_print("PRIOR The %s action is %p is sen\n",gui->pitch_recognition?"/MainMenu/EntryMenu/Replace": "/MainMenu/EntryMenu/TogglePitchless", mode, gtk_action_get_sensitive(mode) ); + GtkAction *mode = gtk_ui_manager_get_action (gui->ui_manager, gui->pitch_recognition?"/MainMenu/EntryMenu/Insert": "/MainMenu/EntryMenu/Edit"); gtk_action_activate(mode); - // g_print("The %s action is %p \n",gui->pitch_recognition?"/MainMenu/EntryMenu/Replace": "/MainMenu/EntryMenu/TogglePitchless", mode); -mode = gtk_ui_manager_get_action (gui->ui_manager, "/MainMenu/EntryMenu/Note"); + mode = gtk_ui_manager_get_action (gui->ui_manager, "/MainMenu/EntryMenu/Note"); gtk_action_activate(mode); // g_print("Note action is %p is sensitive %x\n", mode, gtk_action_get_sensitive(mode)); } @@ -1015,12 +1167,11 @@ } gui->prefs->the_keymap = rhythm_keymap; gtk_widget_show (widget); -#if 0 - GtkAction *mode = gtk_ui_manager_get_action (gui->ui_manager, "/MainMenu/EntryMenu/Replace"); -#else + /* make sure we are in Insert and Note for rhythm toolbar */ GtkAction *mode = gtk_ui_manager_get_action (gui->ui_manager, "/MainMenu/EntryMenu/Note"); -#endif - gtk_action_activate(mode);//FIXME does not work + gtk_action_activate(mode); + mode = gtk_ui_manager_get_action (gui->ui_manager, "/MainMenu/EntryMenu/Insert"); + gtk_action_activate(mode); } } @@ -1050,9 +1201,9 @@ static GtkRadioActionEntry radio_menu_entries[] = { {"Classic", NULL, N_("Classic"), NULL, "Denemo Classic note entry mode", INPUTCLASSIC}, - {"Replace", NULL, N_("Insert"), NULL, N_("Insert notes"), + {"Insert", NULL, N_("Insert"), NULL, N_("Insert notes"), INPUTINSERT}, - {"TogglePitchless", NULL, N_("Edit"), NULL, N_("Edit notes/Enter pure rhythms"), + {"Edit", NULL, N_("Edit"), NULL, N_("Edit notes/Enter pure rhythms"), INPUTEDIT} }; @@ -1204,6 +1355,7 @@ ui_manager = gtk_ui_manager_new (); gui->ui_manager = ui_manager; + gtk_ui_manager_set_add_tearoffs (gui->ui_manager, TRUE); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); accel_group = gtk_ui_manager_get_accel_group (ui_manager); gtk_window_add_accel_group (GTK_WINDOW (gui->window), accel_group); @@ -1226,6 +1378,12 @@ gui->menubar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu"); gtk_box_pack_start (GTK_BOX (main_vbox), gui->menubar, FALSE, TRUE, 0); gtk_widget_show (gui->menubar); + menubar = gtk_ui_manager_get_widget (ui_manager, "/ObjectMenu"); + if(menubar) { + gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0); + gtk_widget_show (menubar); + } + populate_opened_recent (gui); toolbar = gtk_ui_manager_get_widget (ui_manager, "/ToolBar"); @@ -1340,7 +1498,7 @@ g_print("hiding tool bar\n"), gtk_widget_hide(widget);// I do not understand why this is visible - there is no gtk_widget_show(all) in the hierarchy widget = gtk_ui_manager_get_widget (gui->ui_manager, "/MainMenu/ViewMenu/ToggleRhythmToolbar"); g_signal_emit_by_name(widget, "activate", NULL, gui); - g_print("type is %s\n", g_type_name(G_TYPE_FROM_INSTANCE(widget))); + //g_print("type is %s\n", g_type_name(G_TYPE_FROM_INSTANCE(widget))); } // A cheap way of doing activating this toolbar, note it is called variously notation toolbar, duration toolbar and EntryToolBar FIXME if (!gui->prefs->notation_palette) @@ -1348,7 +1506,25 @@ //g_print ("Notation palette %d\n", gui->prefs->notation_palette); toggle_notation_toolbar (NULL, gui); } - g_print("Turning on the modes\n"); +GList *g = gtk_action_group_list_actions(action_group); + for(;g;g=g->next) { + GSList *h = gtk_action_get_proxies (g->data); + gchar * path = g_strdup(gtk_action_get_accel_path (g->data)); + for(;h;h=h->next) { + accel_cb *info = g_malloc0(sizeof(accel_cb)); + info->gui = gui; + info->action = g->data; + + gint type = gtk_image_menu_item_get_type (); + //g_print("%x %x path %s type is %s\n",G_TYPE_FROM_INSTANCE(h->data), type, path, g_type_name(G_TYPE_FROM_INSTANCE(h->data))); + //FIXME connect only to menuitems not toolitems??? + g_signal_connect(h->data, "button-press-event", G_CALLBACK (help_and_set_accels), info); + } +} + + + + // g_print("Turning on the modes\n"); gui->mode = INPUTINSERT | INPUTNORMAL; set_status_bar(gui);