mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
(svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
a bit more sensibly.
This commit is contained in:
parent
45366b4372
commit
e90bc1681f
7
gui.h
7
gui.h
@ -124,13 +124,6 @@ extern const byte _fios_colors[];
|
|||||||
/* bridge_gui.c */
|
/* bridge_gui.c */
|
||||||
void ShowBuildBridgeWindow(uint start, uint end, byte type);
|
void ShowBuildBridgeWindow(uint start, uint end, byte type);
|
||||||
|
|
||||||
enum {
|
|
||||||
ZOOM_IN = 0,
|
|
||||||
ZOOM_OUT = 1,
|
|
||||||
ZOOM_NONE = 2, // hack, used to update the button status
|
|
||||||
};
|
|
||||||
|
|
||||||
bool DoZoomInOutWindow(int how, Window *w);
|
|
||||||
void ShowBuildIndustryWindow(void);
|
void ShowBuildIndustryWindow(void);
|
||||||
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WindowClass window_class, WindowNumber window_number, CharSetFilter afilter);
|
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WindowClass window_class, WindowNumber window_number, CharSetFilter afilter);
|
||||||
void ShowQuery(StringID caption, StringID message, void (*ok_cancel_callback)(bool ok_clicked), WindowClass window_class, WindowNumber window_number);
|
void ShowQuery(StringID caption, StringID message, void (*ok_cancel_callback)(bool ok_clicked), WindowClass window_class, WindowNumber window_number);
|
||||||
|
12
main_gui.c
12
main_gui.c
@ -866,7 +866,8 @@ bool DoZoomInOutWindow(int how, Window *w)
|
|||||||
assert(w);
|
assert(w);
|
||||||
vp = w->viewport;
|
vp = w->viewport;
|
||||||
|
|
||||||
if (how == ZOOM_IN) {
|
switch (how) {
|
||||||
|
case ZOOM_IN:
|
||||||
if (vp->zoom == 0) return false;
|
if (vp->zoom == 0) return false;
|
||||||
vp->zoom--;
|
vp->zoom--;
|
||||||
vp->virtual_width >>= 1;
|
vp->virtual_width >>= 1;
|
||||||
@ -874,9 +875,8 @@ bool DoZoomInOutWindow(int how, Window *w)
|
|||||||
|
|
||||||
WP(w,vp_d).scrollpos_x += vp->virtual_width >> 1;
|
WP(w,vp_d).scrollpos_x += vp->virtual_width >> 1;
|
||||||
WP(w,vp_d).scrollpos_y += vp->virtual_height >> 1;
|
WP(w,vp_d).scrollpos_y += vp->virtual_height >> 1;
|
||||||
|
break;
|
||||||
SetWindowDirty(w);
|
case ZOOM_OUT:
|
||||||
} else if (how == ZOOM_OUT) {
|
|
||||||
if (vp->zoom == 2) return false;
|
if (vp->zoom == 2) return false;
|
||||||
vp->zoom++;
|
vp->zoom++;
|
||||||
|
|
||||||
@ -885,9 +885,11 @@ bool DoZoomInOutWindow(int how, Window *w)
|
|||||||
|
|
||||||
vp->virtual_width <<= 1;
|
vp->virtual_width <<= 1;
|
||||||
vp->virtual_height <<= 1;
|
vp->virtual_height <<= 1;
|
||||||
|
break;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
|
||||||
SetWindowDirty(w);
|
SetWindowDirty(w);
|
||||||
}
|
|
||||||
|
|
||||||
// routine to disable/enable the zoom buttons. Didn't know where to place these otherwise
|
// routine to disable/enable the zoom buttons. Didn't know where to place these otherwise
|
||||||
{
|
{
|
||||||
|
10
viewport.h
10
viewport.h
@ -20,9 +20,17 @@ void AssignWindowViewport(Window *w, int x, int y,
|
|||||||
int width, int height, uint32 follow_flags, byte zoom);
|
int width, int height, uint32 follow_flags, byte zoom);
|
||||||
ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
|
ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
|
||||||
Point GetTileBelowCursor(void);
|
Point GetTileBelowCursor(void);
|
||||||
|
void UpdateViewportPosition(Window *w);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ZOOM_IN = 0,
|
||||||
|
ZOOM_OUT = 1,
|
||||||
|
ZOOM_NONE = 2, // hack, used to update the button status
|
||||||
|
};
|
||||||
|
|
||||||
|
bool DoZoomInOutWindow(int how, Window *w);
|
||||||
void ZoomInOrOutToCursorWindow(bool in, Window * w);
|
void ZoomInOrOutToCursorWindow(bool in, Window * w);
|
||||||
Point GetTileZoomCenterWindow(bool in, Window * w);
|
Point GetTileZoomCenterWindow(bool in, Window * w);
|
||||||
void UpdateViewportPosition(Window *w);
|
|
||||||
|
|
||||||
void OffsetGroundSprite(int x, int y);
|
void OffsetGroundSprite(int x, int y);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user