I would like to know which functions handle the zoom in geany. I found out that ```on_zoom_in1_activate``` and ```on_zoom_out1_activate``` handle the zoom if it is selected in the menu bar.
But what functions are called if I change the zoom factor using the keyboard or the mouse wheel?
The wheel gets handled in Scintilla directly IIUC and keybindings [here](https://github.com/geany/geany/blob/ca16aff4c5cb73ccb6b1c9db58389a33ad027e4f...) which just calls the functions you found.
@elextr: Are you sure about the keybindings? I also thought it is going to be handled there. But I changed my zoom functions like this for testing: ``` /* zoom out from menu bar and popup menu */ void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current();
g_return_if_fail(doc != NULL);
dialogs_show_msgbox(GTK_MESSAGE_INFO, "Zoom zoom"); sci_zoom_out(doc->editor->sci); } ``` The dialog only pops up if I use the menu items for zooming. If I use the keybindings then the zoom works, but the dialog does not show up. So it must take a different call path.
I guess it will be handled by a scintilla keybinding maybe. Anyway, I searched for a place to catch "zoom events" and the best place seems to be ```on_editor_notify```, at [this line](https://github.com/geany/geany/blob/master/src/editor.c#L1189).
Are you sure about the keybindings?
[Yes](https://github.com/geany/geany/blob/ca16aff4c5cb73ccb6b1c9db58389a33ad027e4f...)
@LarsGit223 I confirm @elextr's statement, and double checked and it really does work as expected (if I do anything else in the callbacks I get it when using the keybindings) -- with any bindings I set to zoom, so it's not just plain luck it's Scintilla's default or something. I'm not sure how comes you didn't see that though.
Anyway, yes, if you want to react to zoom changes, you found the right place, Scintilla's notify callback.
Closed #1696.
@elextr @b4n Thanks for the answers (Anyway strange that the dialog did not pop up when using keybindings).
github-comments@lists.geany.org