[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus data/ccl/stratagus.ccl doc/ChangeLog....
From: |
Martin Renold |
Subject: |
[Stratagus-CVS] stratagus data/ccl/stratagus.ccl doc/ChangeLog.... |
Date: |
Wed, 13 Aug 2003 10:55:46 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Martin Renold <address@hidden> 03/08/13 10:55:45
Modified files:
data/ccl : stratagus.ccl
doc : ChangeLog.html
src/editor : editloop.c
src/include : cursor.h ui.h
src/ui : ccl_ui.c mouse.c ui.c
src/video : X11.c cursor.c sdl.c
Log message:
fixed middle-mouse scrolling
Patches:
Index: stratagus/data/ccl/stratagus.ccl
diff -u stratagus/data/ccl/stratagus.ccl:1.6
stratagus/data/ccl/stratagus.ccl:1.7
--- stratagus/data/ccl/stratagus.ccl:1.6 Sat Aug 2 09:38:17 2003
+++ stratagus/data/ccl/stratagus.ccl Wed Aug 13 10:55:44 2003
@@ -26,7 +26,7 @@
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
;;
-;; $Id: stratagus.ccl,v 1.6 2003/08/02 13:38:17 grumbel Exp $
+;; $Id: stratagus.ccl,v 1.7 2003/08/13 14:55:44 martinxyz Exp $
(cond ((equal? *scheme* 'guile)
(load "guile.ccl"))
@@ -43,6 +43,10 @@
;;-----------------------------------------------------------------------------
;; Edit the next sections to get your look and feel.
+;; Note, some of those values are overridden by user preferences,
+;; see ~/.stratagus/preferences1.ccl
+;; and ~/.stratagus/gamename/preferences2.ccl
+
;; Set the game contrast,brightness,saturation.
(set-contrast! 100) (set-brightness! 0) (set-saturation! 100)
@@ -323,8 +327,16 @@
(set-key-scroll-speed! 1)
;; Set mouse scroll speed in frames (1=each frame,2 each second,...)
+;; This is when the mouse cursor hits the border.
(set-mouse-scroll-speed! 1)
+;; While middle-mouse is pressed:
+;; Pixels to move per scrolled mouse pixel, negative = reversed
+(set-mouse-scroll-speed-default! 4)
+
+;; Same if Control is pressed
+(set-mouse-scroll-speed-control! 15)
+
;; Change next, for the wanted double-click delay (in ms).
(set-double-click-delay! 300)
@@ -334,10 +346,6 @@
;; Edit this to enable/disable the display of the command keys in buttons.
(set-show-command-key! #t)
;(set-show-command-key! #f)
-
-;; Edit this reverse middle mouse button map move direction.
-(set-reverse-map-move! #f)
-;(set-reverse-map-move! #t)
;; Uncomment next, to reveal the complete map.
;(reveal-map)
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.510 stratagus/doc/ChangeLog.html:1.511
--- stratagus/doc/ChangeLog.html:1.510 Sat Aug 9 16:32:51 2003
+++ stratagus/doc/ChangeLog.html Wed Aug 13 10:55:45 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.510 2003/08/09 20:32:51 n0body Exp $
+---- $Id: ChangeLog.html,v 1.511 2003/08/13 14:55:45 martinxyz Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,7 @@
<li>Future 1.19 Release<p>
<ul>
<li>++
+ <li>Fixed middle-mouse scrolling, speed now configurable (from Martin
Renold).
<li>Removed global unit types for tankers, generalized gold mining (from
Crestez Dan Leonard).
<li>Removed unit-attack-peon and unit-attack-peasant (from Crestez Dan
Leonard).
<li>Fixed minor mac compilation bug (from zratchet).
Index: stratagus/src/editor/editloop.c
diff -u stratagus/src/editor/editloop.c:1.125
stratagus/src/editor/editloop.c:1.126
--- stratagus/src/editor/editloop.c:1.125 Fri Aug 8 06:16:43 2003
+++ stratagus/src/editor/editloop.c Wed Aug 13 10:55:45 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: editloop.c,v 1.125 2003/08/08 10:16:43 martinxyz Exp $
+// $Id: editloop.c,v 1.126 2003/08/13 14:55:45 martinxyz Exp $
//@{
@@ -1460,9 +1460,10 @@
int yo;
// FIXME: Support with CTRL for faster scrolling.
+ // FIXME: code duplication, see ../ui/mouse.c
xo = TheUI.MouseViewport->MapX;
yo = TheUI.MouseViewport->MapY;
- if (TheUI.ReverseMouseMove) {
+ if (TheUI.MouseScrollSpeedDefault < 0) {
if (x < CursorStartX) {
xo++;
} else if (x > CursorStartX) {
@@ -1485,8 +1486,8 @@
yo++;
}
}
- TheUI.WarpX = CursorStartX;
- TheUI.WarpY = CursorStartY;
+ TheUI.MouseWarpX = CursorStartX;
+ TheUI.MouseWarpY = CursorStartY;
ViewportSetViewpoint(TheUI.MouseViewport, xo, yo);
return;
}
Index: stratagus/src/include/cursor.h
diff -u stratagus/src/include/cursor.h:1.33 stratagus/src/include/cursor.h:1.34
--- stratagus/src/include/cursor.h:1.33 Fri Aug 8 06:16:44 2003
+++ stratagus/src/include/cursor.h Wed Aug 13 10:55:45 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: cursor.h,v 1.33 2003/08/08 10:16:44 martinxyz Exp $
+// $Id: cursor.h,v 1.34 2003/08/13 14:55:45 martinxyz Exp $
#ifndef __CURSOR_H__
#define __CURSOR_H__
@@ -193,6 +193,8 @@
extern int CursorStartY; /// rectangle started on screen Y
extern int CursorStartScrMapX; /// the same in screen map coordinate system
extern int CursorStartScrMapY; /// the same in screen map coordinate system
+extern int SubScrollX; /// pixels the mouse moved while scrolling
+extern int SubScrollY; /// pixels the mouse moved while scrolling
/*----------------------------------------------------------------------------
-- Functions
Index: stratagus/src/include/ui.h
diff -u stratagus/src/include/ui.h:1.63 stratagus/src/include/ui.h:1.64
--- stratagus/src/include/ui.h:1.63 Fri Aug 8 06:16:44 2003
+++ stratagus/src/include/ui.h Wed Aug 13 10:55:45 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.h,v 1.63 2003/08/08 10:16:44 martinxyz Exp $
+// $Id: ui.h,v 1.64 2003/08/13 14:55:45 martinxyz Exp $
#ifndef __UI_H__
#define __UI_H__
@@ -159,11 +159,13 @@
int MouseScroll; /// Enable mouse scrolling
int KeyScroll; /// Enable keyboard scrolling
- /// Middle mouse button map move with reversed directions
- char ReverseMouseMove;
+ /// Middle-Mouse Scroll Speed (screenpixels per mousepixel)
+ int MouseScrollSpeedDefault;
+ /// Middle-Mouse Scroll Speed with Control pressed
+ int MouseScrollSpeedControl;
- int WarpX; /// Cursor warp X position
- int WarpY; /// Cursor warp Y position
+ int MouseWarpX; /// Cursor warp X
position
+ int MouseWarpY; /// Cursor warp Y
position
int MouseAdjust; /// Mouse speed adjust
int MouseScale; /// Mouse speed scale
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.119 stratagus/src/ui/ccl_ui.c:1.120
--- stratagus/src/ui/ccl_ui.c:1.119 Sat Aug 9 15:44:04 2003
+++ stratagus/src/ui/ccl_ui.c Wed Aug 13 10:55:45 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ui.c,v 1.119 2003/08/09 19:44:04 martinxyz Exp $
+// $Id: ccl_ui.c,v 1.120 2003/08/13 14:55:45 martinxyz Exp $
//@{
@@ -628,19 +628,35 @@
}
/**
-** Enable/disable the reverse map move.
+** Set speed of middle-mouse scroll
**
-** @param flag True = turn on, false = off.
-** @return The old state of scrolling.
+** @param speed number of screen pixels per mouse pixel
+** @return The old value.
*/
-local SCM CclSetReverseMapMove(SCM flag)
+local SCM CclSetMouseScrollSpeedDefault(SCM speed)
{
int old;
- old=TheUI.ReverseMouseMove;
- TheUI.ReverseMouseMove=gh_scm2bool(flag);
+ old=TheUI.MouseScrollSpeedDefault;
+ TheUI.MouseScrollSpeedDefault=gh_scm2int(speed);
- return gh_bool2scm(old);
+ return gh_int2scm(old);
+}
+
+/**
+** Set speed of ctrl-middle-mouse scroll
+**
+** @param speed number of screen pixels per mouse pixel
+** @return The old value.
+*/
+local SCM CclSetMouseScrollSpeedControl(SCM speed)
+{
+ int old;
+
+ old=TheUI.MouseScrollSpeedControl;
+ TheUI.MouseScrollSpeedControl=gh_scm2int(speed);
+
+ return gh_int2scm(old);
}
/**
@@ -1258,10 +1274,11 @@
ui->MouseScroll=TheUI.MouseScroll;
ui->KeyScroll=TheUI.KeyScroll;
- ui->ReverseMouseMove=TheUI.ReverseMouseMove;
+ ui->MouseScrollSpeedDefault=TheUI.MouseScrollSpeedDefault;
+ ui->MouseScrollSpeedControl=TheUI.MouseScrollSpeedControl;
- ui->WarpX=-1;
- ui->WarpY=-1;
+ ui->MouseWarpX=-1;
+ ui->MouseWarpY=-1;
ui->MouseAdjust=TheUI.MouseAdjust;
ui->MouseScale=TheUI.MouseScale;
@@ -3576,7 +3593,8 @@
gh_new_procedure1_0("add-message", CclAddMessage);
gh_new_procedure1_0("set-color-cycle-all!",CclSetColorCycleAll);
- gh_new_procedure1_0("set-reverse-map-move!",CclSetReverseMapMove);
+
gh_new_procedure1_0("set-mouse-scroll-speed-default!",CclSetMouseScrollSpeedDefault);
+
gh_new_procedure1_0("set-mouse-scroll-speed-control!",CclSetMouseScrollSpeedControl);
gh_new_procedure1_0("set-mouse-adjust!",CclSetMouseAdjust);
gh_new_procedure1_0("set-mouse-scale!",CclSetMouseScale);
Index: stratagus/src/ui/mouse.c
diff -u stratagus/src/ui/mouse.c:1.137 stratagus/src/ui/mouse.c:1.138
--- stratagus/src/ui/mouse.c:1.137 Sun Aug 10 22:14:46 2003
+++ stratagus/src/ui/mouse.c Wed Aug 13 10:55:45 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mouse.c,v 1.137 2003/08/11 02:14:46 n0body Exp $
+// $Id: mouse.c,v 1.138 2003/08/13 14:55:45 martinxyz Exp $
//@{
@@ -582,8 +582,8 @@
CursorStartY = CursorY;
}
- TheUI.WarpX = CursorX = CursorStartX;
- TheUI.WarpY = CursorY = CursorStartY;
+ TheUI.MouseWarpX = CursorX = CursorStartX;
+ TheUI.MouseWarpY = CursorY = CursorStartY;
CursorOn = CursorOnMap;
}
@@ -608,8 +608,8 @@
CursorStartY = CursorY;
}
- CursorX = TheUI.WarpX = CursorStartX;
- CursorY = TheUI.WarpY = CursorStartY;
+ CursorX = TheUI.MouseWarpX = CursorStartX;
+ CursorY = TheUI.MouseWarpY = CursorStartY;
CursorOn = CursorOnMinimap;
}
@@ -639,36 +639,27 @@
if( GameCursor==TheUI.Scroll.Cursor ) {
int xo;
int yo;
- int scroll;
+ int speed;
if( KeyModifiers&ModifierControl ) {
- scroll=2;
+ speed=TheUI.MouseScrollSpeedControl;
} else {
- scroll=1;
+ speed=TheUI.MouseScrollSpeedDefault;
}
xo = TheUI.MouseViewport->MapX;
yo = TheUI.MouseViewport->MapY;
- if( TheUI.ReverseMouseMove ) {
- if (x < CursorStartX) {
- xo+=scroll;
- } else if (x > CursorStartX) {
- xo-=scroll;
- }
- } else {
- if (x < CursorStartX) {
- xo-=scroll;
- } else if (x > CursorStartX) {
- xo+=scroll;
- }
- if (y < CursorStartY) {
- yo-=scroll;
- } else if (y > CursorStartY) {
- yo+=scroll;
- }
- }
- TheUI.WarpX=CursorStartX;
- TheUI.WarpY=CursorStartY;
+ SubScrollX += speed * (x-CursorStartX);
+ SubScrollY += speed * (y-CursorStartY);
+
+ // only tile based scrolling is supported
+ xo += SubScrollX / TileSizeX;
+ SubScrollX = SubScrollX % TileSizeX;
+ yo += SubScrollY / TileSizeY;
+ SubScrollY = SubScrollY % TileSizeY;
+
+ TheUI.MouseWarpX=CursorStartX;
+ TheUI.MouseWarpY=CursorStartY;
ViewportSetViewpoint(TheUI.MouseViewport, xo, yo);
return;
}
@@ -1462,6 +1453,8 @@
} else if( MouseButtons&MiddleButton ) {// enter move map mode
CursorStartX=CursorX;
CursorStartY=CursorY;
+ SubScrollX=0;
+ SubScrollY=0;
GameCursor=TheUI.Scroll.Cursor;
DebugLevel3("Cursor middle down %d,%d\n" _C_ CursorX _C_ CursorY);
MustRedraw|=RedrawCursor;
Index: stratagus/src/ui/ui.c
diff -u stratagus/src/ui/ui.c:1.71 stratagus/src/ui/ui.c:1.72
--- stratagus/src/ui/ui.c:1.71 Sat Aug 9 16:08:39 2003
+++ stratagus/src/ui/ui.c Wed Aug 13 10:55:45 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.c,v 1.71 2003/08/09 20:08:39 martinxyz Exp $
+// $Id: ui.c,v 1.72 2003/08/13 14:55:45 martinxyz Exp $
//@{
@@ -505,7 +505,7 @@
int i;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: ui $Id: ui.c,v 1.71 2003/08/09 20:08:39
martinxyz Exp $\n\n");
+ fprintf(file,";;; MODULE: ui $Id: ui.c,v 1.72 2003/08/13 14:55:45
martinxyz Exp $\n\n");
// Contrast, Brightness, Saturation
fprintf(file,"(set-contrast! %d)\n",TheUI.Contrast);
@@ -516,8 +516,8 @@
fprintf(file,"(set-mouse-scroll-speed! %d)\n",SpeedMouseScroll);
fprintf(file,"(set-key-scroll! %s)\n",TheUI.KeyScroll ? "#t" : "#f");
fprintf(file,"(set-key-scroll-speed! %d)\n",SpeedKeyScroll);
- fprintf(file,"(set-reverse-map-move! %s)\n\n",
- TheUI.ReverseMouseMove ? "#t" : "#f");
+ fprintf(file,"(set-mouse-scroll-speed-default!
%d)\n",TheUI.MouseScrollSpeedDefault);
+ fprintf(file,"(set-mouse-scroll-speed-control!
%d)\n",TheUI.MouseScrollSpeedControl);
fprintf(file,"(set-mouse-adjust! %d)\n",TheUI.MouseAdjust);
fprintf(file,"(set-mouse-scale! %d)\n\n",TheUI.MouseScale);
Index: stratagus/src/video/X11.c
diff -u stratagus/src/video/X11.c:1.74 stratagus/src/video/X11.c:1.75
--- stratagus/src/video/X11.c:1.74 Fri Jul 11 10:35:34 2003
+++ stratagus/src/video/X11.c Wed Aug 13 10:55:45 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: X11.c,v 1.74 2003/07/11 14:35:34 n0body Exp $
+// $Id: X11.c,v 1.75 2003/08/13 14:55:45 martinxyz Exp $
//@{
@@ -825,14 +825,14 @@
_C_ event.xbutton.x _C_ event.xbutton.y);
InputMouseMove(callbacks, X11GetTicks(),
event.xbutton.x,event.xbutton.y);
- if ( (TheUI.WarpX != -1 || TheUI.WarpY != -1)
- && (event.xbutton.x!=TheUI.WarpX
- || event.xbutton.y!=TheUI.WarpY)
+ if ( (TheUI.MouseWarpX != -1 || TheUI.MouseWarpY != -1)
+ && (event.xbutton.x!=TheUI.MouseWarpX
+ || event.xbutton.y!=TheUI.MouseWarpY)
) {
- xw = TheUI.WarpX;
- yw = TheUI.WarpY;
- TheUI.WarpX = -1;
- TheUI.WarpY = -1;
+ xw = TheUI.MouseWarpX;
+ yw = TheUI.MouseWarpY;
+ TheUI.MouseWarpX = -1;
+ TheUI.MouseWarpY = -1;
XWarpPointer(TheDisplay,TheMainWindow,TheMainWindow,0,0
,0,0,xw,yw);
Index: stratagus/src/video/cursor.c
diff -u stratagus/src/video/cursor.c:1.62 stratagus/src/video/cursor.c:1.63
--- stratagus/src/video/cursor.c:1.62 Sun Aug 10 13:54:54 2003
+++ stratagus/src/video/cursor.c Wed Aug 13 10:55:45 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: cursor.c,v 1.62 2003/08/10 17:54:54 martinxyz Exp $
+// $Id: cursor.c,v 1.63 2003/08/13 14:55:45 martinxyz Exp $
//@{
@@ -87,6 +87,9 @@
global int CursorStartX; /// rectangle started on screen X
global int CursorStartY; /// rectangle started on screen Y
+global int SubScrollX; /// pixels the mouse moved while scrolling
+global int SubScrollY; /// pixels the mouse moved while scrolling
+
/// X position of starting point of selection rectangle, in screen pixels.
global int CursorStartScrMapX;
/// Y position of starting point of selection rectangle, in screen pixels.
@@ -1112,7 +1115,7 @@
int i;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: cursors $Id: cursor.c,v 1.62 2003/08/10 17:54:54
martinxyz Exp $\n\n");
+ fprintf(file,";;; MODULE: cursors $Id: cursor.c,v 1.63 2003/08/13 14:55:45
martinxyz Exp $\n\n");
for( i=0; Cursors[i].OType; ++i ) {
fprintf(file,"(define-cursor '%s '%s\n",
Index: stratagus/src/video/sdl.c
diff -u stratagus/src/video/sdl.c:1.95 stratagus/src/video/sdl.c:1.96
--- stratagus/src/video/sdl.c:1.95 Fri Jul 11 10:35:34 2003
+++ stratagus/src/video/sdl.c Wed Aug 13 10:55:45 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: sdl.c,v 1.95 2003/07/11 14:35:34 n0body Exp $
+// $Id: sdl.c,v 1.96 2003/08/13 14:55:45 martinxyz Exp $
//@{
@@ -543,16 +543,16 @@
InputMouseMove(callbacks, SDL_GetTicks(),
event->motion.x, event->motion.y);
// FIXME: Same bug fix from X11
- if ((TheUI.WarpX != -1 || TheUI.WarpY != -1)
- && (event->motion.x != TheUI.WarpX
- || event->motion.y != TheUI.WarpY)) {
+ if ((TheUI.MouseWarpX != -1 || TheUI.MouseWarpY != -1)
+ && (event->motion.x != TheUI.MouseWarpX
+ || event->motion.y != TheUI.MouseWarpY)) {
int xw;
int yw;
- xw = TheUI.WarpX;
- yw = TheUI.WarpY;
- TheUI.WarpX = -1;
- TheUI.WarpY = -1;
+ xw = TheUI.MouseWarpX;
+ yw = TheUI.MouseWarpY;
+ TheUI.MouseWarpX = -1;
+ TheUI.MouseWarpY = -1;
SDL_WarpMouse(xw, yw);
}
MustRedraw |= RedrawCursor;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus data/ccl/stratagus.ccl doc/ChangeLog....,
Martin Renold <=