Page 1 of 1

changing zoom with Ctrl + Mouse wheel

Posted: Tue Mar 16, 2010 9:51 am
by Cosmin3
Hi.
I'm trying to implement in my editor (which is using ScaleRichView) Ctrl+MouseWheel>>ChangingZoom. Just like in Word...
In SclRView.pas (at "TSRichViewEdit = class(TCustomControl)") I have declared a public variable: IsScrollDisabled (Boolean).
In TSRichViewEdit.HookMouseWheelEvent most of the code is running only if IsScrollDisabled is False. In essence when IsScrollDisabled is True ScaleRichView is not scrolling the text.
At ScaleRichView1 OnKeyDown event:
ScaleRichView1.IsScrollDisabled := (Shift = [ssCtrl]) and (Key = 17);
At ScaleRichView1 OnKeyUp event:
ScaleRichView1.IsScrollDisabled := False;
And at ScaleRichView1 OnMouseWheel event:

Code: Select all

   if Shift = [ssCtrl] then begin
      if WheelDelta > 0 then
         if cmbListZoom.ItemIndex < cmbListZoom.Items.count - 3 then begin
            cmbListZoom.ItemIndex := cmbListZoom.ItemIndex + 1;
            cmbListZoomChange(Self);
         end;
      if WheelDelta < 0 then
         if (cmbListZoom.ItemIndex > 0) and (cmbListZoom.ItemIndex < cmbListZoom.Items.count - 2) then begin
            cmbListZoom.ItemIndex := cmbListZoom.ItemIndex - 1;
            cmbListZoomChange(Self);
         end;
3 questions:
1. Is it ok to do it like that or is there a better way...?
2. How can I know the value of Zoom factor for PageWidth and FullPage so I can increase/decrease properly on any Zoom value?
3. Is there a way to increase/decrease Zoom in smaller "steps"..?

Thank you in advance for any help.
Best regards.

Posted: Wed Mar 17, 2010 3:28 pm
by Sergey Tkachenko
We plan to add Ctrl+MouseWheel zooming as a standard optional feature (that can be turned off). Probably will be included in the next update.

Posted: Wed Mar 17, 2010 4:14 pm
by Cosmin3
I understand.
Thank you for your reply.
Best regards.

Posted: Sat May 15, 2010 5:16 am
by proxy3d
Added the new version of SRV 3.2

Re: changing zoom with Ctrl + Mouse wheel

Posted: Thu Dec 10, 2020 7:42 pm
by jgkoehn
Greetings Sergey,
Was this added as a standard option? If so where might I find the setting? I did find other ways to do it but no point in doing a lot of extra if already there.

Re: changing zoom with Ctrl + Mouse wheel

Posted: Fri Dec 11, 2020 11:08 am
by Sergey Tkachenko
Yes, this is a standard option in ScaleRichView. It is active by default.
To disable Ctrl+mouse wheel zooming, assign SRichViewEdit.ViewProperty.MouseWheelZoom = False.

Re: changing zoom with Ctrl + Mouse wheel

Posted: Fri Dec 11, 2020 3:02 pm
by jgkoehn
Greetings Sergey,
Is it the same for TRichViewEdit or just ScaleRichView?

Re: changing zoom with Ctrl + Mouse wheel

Posted: Fri Dec 11, 2020 4:17 pm
by Sergey Tkachenko
Only in ScaleRichView.

Please note that zooming is completely different in TRichView and ScaleRichView.
In ScaleRichView, documents are always formatted in a fixed DPI, zoom affects only displaying.
In TRichView, zoom is implemented by changing document DPI, It affects both displaying and formatting. So, when you assign a new value of DocumentPixelsPerInch, you need to reformat TRichVIew (call Reformat method). For large documents, it may take some time.
So I do not think that mouse wheel zooming in TRichViewEdit is a good idea.

Re: changing zoom with Ctrl + Mouse wheel

Posted: Fri Dec 11, 2020 6:10 pm
by jgkoehn
Ah thanks yes, it can take time, more of a set once per document thing. Thanks