aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2002-12-20 11:12:21 +0000
committernyamatongwe <devnull@localhost>2002-12-20 11:12:21 +0000
commitd621dc7ff4f2b63b2cab42ef8706980c7b199f64 (patch)
treec86669def97c4bc82733852fd13dd76550482c2f
parent4c45b523f6252001fc88af9119a69bab6420e764 (diff)
downloadscintilla-mirror-d621dc7ff4f2b63b2cab42ef8706980c7b199f64.tar.gz
Fixed problem with vertical scrollbar being moved out of real range
leading to inability to scroll at times. Added moveThumb argument to ScrollTo to allow smoother manipulation of thumb on GTK+
-rw-r--r--gtk/ScintillaGTK.cxx32
1 files changed, 18 insertions, 14 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 3c87be91c..bd84e1190 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -1118,6 +1118,17 @@ void ScintillaGTK::Resize(int width, int height) {
ChangeSize();
}
+static void SetAdjustmentValue(GtkObject *object, int value) {
+ GtkAdjustment *adjustment = GTK_ADJUSTMENT(object);
+ int maxValue = static_cast<int>(
+ adjustment->upper - adjustment->page_size);
+ if (value > maxValue)
+ value = maxValue;
+ if (value < 0)
+ value = 0;
+ gtk_adjustment_set_value(adjustment, value);
+}
+
gint ScintillaGTK::PressThis(GdkEventButton *event) {
//Platform::DebugPrintf("Press %x time=%d state = %x button = %x\n",this,event->time, event->state, event->button);
// Do not use GTK+ double click events as Scintilla has its own double click detection
@@ -1169,19 +1180,15 @@ gint ScintillaGTK::PressThis(GdkEventButton *event) {
} else if (event->button == 4) {
// Wheel scrolling up (only xwin gtk does it this way)
if (ctrl)
- gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmenth), (
- (xOffset) / 2 ) - 6);
+ SetAdjustmentValue(adjustmenth, (xOffset / 2) - 6);
else
- gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmentv),
- topLine - 3);
- } else if ( event->button == 5 ) {
+ SetAdjustmentValue(adjustmentv, topLine - 3);
+ } else if (event->button == 5) {
// Wheel scrolling down (only xwin gtk does it this way)
if (ctrl)
- gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmenth), (
- (xOffset) / 2 ) + 6);
+ SetAdjustmentValue(adjustmenth, (xOffset / 2) + 6);
else
- gtk_adjustment_set_value(GTK_ADJUSTMENT(adjustmentv),
- topLine + 3);
+ SetAdjustmentValue(adjustmentv, topLine + 3);
}
return FALSE;
}
@@ -1477,13 +1484,11 @@ gint ScintillaGTK::Expose(GtkWidget *, GdkEventExpose *ose, ScintillaGTK *sciThi
}
void ScintillaGTK::ScrollSignal(GtkAdjustment *adj, ScintillaGTK *sciThis) {
- //Platform::DebugPrintf("Scrolly %g %x\n",adj->value,p);
- sciThis->ScrollTo((int)adj->value);
+ sciThis->ScrollTo(static_cast<int>(adj->value), false);
}
void ScintillaGTK::ScrollHSignal(GtkAdjustment *adj, ScintillaGTK *sciThis) {
- //Platform::DebugPrintf("Scrollyh %g %x\n",adj->value,p);
- sciThis->HorizontalScrollTo((int)adj->value * 2);
+ sciThis->HorizontalScrollTo(static_cast<int>(adj->value * 2));
}
void ScintillaGTK::SelectionReceived(GtkWidget *widget,
@@ -1739,4 +1744,3 @@ void scintilla_set_id(ScintillaObject *sci, int id) {
void scintilla_release_resources(void) {
Platform_Finalise();
}
-