[MonoDevelop] [patch] ctrl-up/down in source editor

Ben Motmans Ben Motmans <ben.motmans@gmail.com>
Thu, 10 Feb 2005 11:55:01 +0100


------=_Part_73_13309106.1108032901549
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Wed, 09 Feb 2005 18:53:12 -0800, Todd Berman
<todd.berman@medsphere.com> wrote:
> Couple questions. Where is StepIncrement promised to be the height of
> one line?
It doesn't, but there is no Increment for only a single line, so i
used StepIncrement / 5 to make it look like a single line

I added 2 patches now
ctrlupdown_1line.diff scrolls down/up a single line (using StepIncrement / 5)
ctrlupdown.diff scrolls down/up the same amount like clicking the
scrollbar arrows would

> Are both calls to .Change and then .ChangeValue required? Last
> time i played with this sort of stuff, just the .Change was required.
you're right, but only .ChangeValue is needed
.Change is only required if you adjust the bounds
 
> Also, can you please attach a ChangeLog that describes your changes (to
> the ChangeLog in Core/src/AddIns/DisplayBindings/SourceEditor/)
done

------=_Part_73_13309106.1108032901549
Content-Type: text/x-patch; name="ctrlupdown_1line.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="ctrlupdown_1line.diff"

Index: Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs=09=
(revision 2242)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs=09=
(working copy)
@@ -246,6 +246,24 @@
 =09=09=09
 =09=09=09return true;
 =09=09}
+
+=09=09void ScrollUp () {
+=09=09=09ParentEditor.Vadjustment.Value -=3D (ParentEditor.Vadjustment.Ste=
pIncrement / 5);
+=09=09=09if (ParentEditor.Vadjustment.Value < 0.0d)
+=09=09=09=09ParentEditor.Vadjustment.Value =3D 0.0d;
+
+=09=09=09ParentEditor.Vadjustment.ChangeValue();
+=09=09}
+
+=09=09void ScrollDown () {
+=09=09=09double maxvalue =3D ParentEditor.Vadjustment.Upper - ParentEditor=
.Vadjustment.PageSize;
+
+=09=09=09ParentEditor.Vadjustment.Value +=3D (ParentEditor.Vadjustment.Ste=
pIncrement / 5);
+=09=09=09if (ParentEditor.Vadjustment.Value > maxvalue)
+=09=09=09=09ParentEditor.Vadjustment.Value =3D maxvalue;
+
+=09=09=09ParentEditor.Vadjustment.ChangeValue();
+=09=09}
 =09=09
 =09=09protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
 =09=09{
@@ -306,6 +324,12 @@
 =09=09=09=09case Gdk.Key.l:
 =09=09=09=09=09DeleteLine ();
 =09=09=09=09=09return true;
+=09=09=09=09case Gdk.Key.Up:
+=09=09=09=09=09ScrollUp ();
+=09=09=09=09=09return true;
+=09=09=09=09case Gdk.Key.Down:
+=09=09=09=09=09ScrollDown ();
+=09=09=09=09=09return true;
 =09=09=09=09}
 =09=09=09=09break;
 =09=09=09}
Index: Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog=09(revision 2242=
)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog=09(working copy)
@@ -1,3 +1,8 @@
+2005-02-10  Ben Motmans  <ben.motmans@gmail.com>
+
+=09* Gui/SourceEditorView.cs: Added ScrollUp and ScrollDown methods
+=09for ctrl-up/down keybinds
+
 2005-02-02  John Luke  <john.luke@gmail.com>
=20
 =09* EditorBindings.glade:

------=_Part_73_13309106.1108032901549
Content-Type: text/x-patch; name="ctrlupdown.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="ctrlupdown.diff"

Index: Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs=09=
(revision 2242)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs=09=
(working copy)
@@ -246,6 +246,24 @@
 =09=09=09
 =09=09=09return true;
 =09=09}
+
+=09=09void ScrollUp () {
+=09=09=09ParentEditor.Vadjustment.Value -=3D ParentEditor.Vadjustment.Step=
Increment;
+=09=09=09if (ParentEditor.Vadjustment.Value < 0.0d)
+=09=09=09=09ParentEditor.Vadjustment.Value =3D 0.0d;
+
+=09=09=09ParentEditor.Vadjustment.ChangeValue();
+=09=09}
+
+=09=09void ScrollDown () {
+=09=09=09double maxvalue =3D ParentEditor.Vadjustment.Upper - ParentEditor=
.Vadjustment.PageSize;
+
+=09=09=09ParentEditor.Vadjustment.Value +=3D ParentEditor.Vadjustment.Step=
Increment;
+=09=09=09if (ParentEditor.Vadjustment.Value > maxvalue)
+=09=09=09=09ParentEditor.Vadjustment.Value =3D maxvalue;
+
+=09=09=09ParentEditor.Vadjustment.ChangeValue();
+=09=09}
 =09=09
 =09=09protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
 =09=09{
@@ -306,6 +324,12 @@
 =09=09=09=09case Gdk.Key.l:
 =09=09=09=09=09DeleteLine ();
 =09=09=09=09=09return true;
+=09=09=09=09case Gdk.Key.Up:
+=09=09=09=09=09ScrollUp ();
+=09=09=09=09=09return true;
+=09=09=09=09case Gdk.Key.Down:
+=09=09=09=09=09ScrollDown ();
+=09=09=09=09=09return true;
 =09=09=09=09}
 =09=09=09=09break;
 =09=09=09}
Index: Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog=09(revision 2242=
)
+++ Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog=09(working copy)
@@ -1,3 +1,8 @@
+2005-02-10  Ben Motmans  <ben.motmans@gmail.com>
+
+=09* Gui/SourceEditorView.cs: Added ScrollUp and ScrollDown methods
+=09for ctrl-up/down keybinds
+
 2005-02-02  John Luke  <john.luke@gmail.com>
=20
 =09* EditorBindings.glade:

------=_Part_73_13309106.1108032901549--