184 vp->virtual_top = 0;//pt.y; |
184 vp->virtual_top = 0;//pt.y; |
185 } |
185 } |
186 |
186 |
187 static Point _vp_move_offs; |
187 static Point _vp_move_offs; |
188 |
188 |
189 static void DoSetViewportPosition(Window* const *wz, int left, int top, int width, int height) |
189 static void DoSetViewportPosition(WindowList::Iterator vit, int left, int top, int width, int height) |
190 { |
190 { |
191 |
191 //Window *w = (*wit).w; |
192 for (; wz != _last_z_window; wz++) { |
192 |
193 const Window *w = *wz; |
193 for (WindowList::Iterator wit = vit; wit != Window::s_list.m_list.end(); wit++) { |
|
194 const Window *w = (*wit).w; |
194 |
195 |
195 if (left + width > w->left && |
196 if (left + width > w->left && |
196 w->left + w->width > left && |
197 w->left + w->width > left && |
197 top + height > w->top && |
198 top + height > w->top && |
198 w->top + w->height > top) { |
199 w->top + w->height > top) { |
199 |
200 |
200 if (left < w->left) { |
201 if (left < w->left) { |
201 DoSetViewportPosition(wz, left, top, w->left - left, height); |
202 DoSetViewportPosition(wit, left, top, w->left - left, height); |
202 DoSetViewportPosition(wz, left + (w->left - left), top, width - (w->left - left), height); |
203 DoSetViewportPosition(wit, left + (w->left - left), top, width - (w->left - left), height); |
203 return; |
204 return; |
204 } |
205 } |
205 |
206 |
206 if (left + width > w->left + w->width) { |
207 if (left + width > w->left + w->width) { |
207 DoSetViewportPosition(wz, left, top, (w->left + w->width - left), height); |
208 DoSetViewportPosition(wit, left, top, (w->left + w->width - left), height); |
208 DoSetViewportPosition(wz, left + (w->left + w->width - left), top, width - (w->left + w->width - left) , height); |
209 DoSetViewportPosition(wit, left + (w->left + w->width - left), top, width - (w->left + w->width - left) , height); |
209 return; |
210 return; |
210 } |
211 } |
211 |
212 |
212 if (top < w->top) { |
213 if (top < w->top) { |
213 DoSetViewportPosition(wz, left, top, width, (w->top - top)); |
214 DoSetViewportPosition(wit, left, top, width, (w->top - top)); |
214 DoSetViewportPosition(wz, left, top + (w->top - top), width, height - (w->top - top)); |
215 DoSetViewportPosition(wit, left, top + (w->top - top), width, height - (w->top - top)); |
215 return; |
216 return; |
216 } |
217 } |
217 |
218 |
218 if (top + height > w->top + w->height) { |
219 if (top + height > w->top + w->height) { |
219 DoSetViewportPosition(wz, left, top, width, (w->top + w->height - top)); |
220 DoSetViewportPosition(wit, left, top, width, (w->top + w->height - top)); |
220 DoSetViewportPosition(wz, left, top + (w->top + w->height - top), width , height - (w->top + w->height - top)); |
221 DoSetViewportPosition(wit, left, top + (w->top + w->height - top), width , height - (w->top + w->height - top)); |
221 return; |
222 return; |
222 } |
223 } |
223 |
224 |
224 return; |
225 return; |
225 } |
226 } |
1805 |
1807 |
1806 |
1808 |
1807 bool ScrollMainWindowTo(int x, int y) |
1809 bool ScrollMainWindowTo(int x, int y) |
1808 { |
1810 { |
1809 Window *w; |
1811 Window *w; |
1810 bool res = ScrollWindowTo(x, y, FindWindowById(WC_MAIN_WINDOW, 0)); |
1812 bool res = ScrollWindowTo(x, y, Window::FindById(WC_MAIN_WINDOW, 0)); |
1811 |
1813 |
1812 /* If a user scrolls to a tile (via what way what so ever) and already is on |
1814 /* If a user scrolls to a tile (via what way what so ever) and already is on |
1813 * that tile (e.g.: pressed twice), move the smallmap to that location, |
1815 * that tile (e.g.: pressed twice), move the smallmap to that location, |
1814 * so you directly see where you are on the smallmap. */ |
1816 * so you directly see where you are on the smallmap. */ |
1815 |
1817 |
1816 if (res) return res; |
1818 if (res) return res; |
1817 |
1819 |
1818 w = FindWindowById(WC_SMALLMAP, 0); |
1820 w = Window::FindById(WC_SMALLMAP, 0); |
1819 if (w == NULL) return res; |
1821 if (w == NULL) return res; |
1820 |
1822 |
1821 SmallMapCenterOnCurrentPos(w); |
1823 SmallMapCenterOnCurrentPos(w); |
1822 |
1824 |
1823 return res; |
1825 return res; |