Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: what are the zoom callback functions? #1696

Closed
lpaulsen93 opened this issue Nov 22, 2017 · 6 comments
Closed

Question: what are the zoom callback functions? #1696

lpaulsen93 opened this issue Nov 22, 2017 · 6 comments
Labels

Comments

@lpaulsen93
Copy link
Contributor

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?

@elextr
Copy link
Member

elextr commented Nov 22, 2017

The wheel gets handled in Scintilla directly IIUC and keybindings here which just calls the functions you found.

@lpaulsen93
Copy link
Contributor Author

@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.

@lpaulsen93
Copy link
Contributor Author

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.

@elextr
Copy link
Member

elextr commented Nov 23, 2017

Are you sure about the keybindings?

Yes

@b4n
Copy link
Member

b4n commented Nov 24, 2017

@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.

@b4n b4n closed this as completed Nov 24, 2017
@lpaulsen93
Copy link
Contributor Author

@elextr @b4n Thanks for the answers (Anyway strange that the dialog did not pop up when using keybindings).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants