window.c
changeset 2549 5587f9a38563
parent 2517 6e3832ddd0f6
child 2596 07cecb439908
equal deleted inserted replaced
2548:49c8a096033f 2549:5587f9a38563
   212 
   212 
   213 	e.event = event;
   213 	e.event = event;
   214 	w->wndproc(w, &e);
   214 	w->wndproc(w, &e);
   215 }
   215 }
   216 
   216 
   217 void SetWindowDirty(Window *w)
   217 void SetWindowDirty(const Window* w)
   218 {
   218 {
   219 	if (w == NULL)
   219 	if (w == NULL) return;
   220 		return;
       
   221 
       
   222 	SetDirtyBlocks(w->left, w->top, w->left + w->width, w->top + w->height);
   220 	SetDirtyBlocks(w->left, w->top, w->left + w->width, w->top + w->height);
   223 }
   221 }
   224 
   222 
   225 void DeleteWindow(Window *w)
   223 void DeleteWindow(Window *w)
   226 {
   224 {
  1400 			if (vp) {
  1398 			if (vp) {
  1401 				x -= vp->left;
  1399 				x -= vp->left;
  1402 				y -= vp->top;
  1400 				y -= vp->top;
  1403 				//here allows scrolling in both x and y axis
  1401 				//here allows scrolling in both x and y axis
  1404 #define scrollspeed 3
  1402 #define scrollspeed 3
  1405 				if (x-15<0) { WP(w,vp_d).scrollpos_x += (x-15) * scrollspeed << vp->zoom; }
  1403 				if (x - 15 < 0) {
  1406 				else if (15-(vp->width-x) > 0) { WP(w,vp_d).scrollpos_x += (15-(vp->width-x))*scrollspeed << vp->zoom; }
  1404 					WP(w, vp_d).scrollpos_x += (x - 15) * scrollspeed << vp->zoom;
  1407 				if (y-15<0) { WP(w,vp_d).scrollpos_y += (y-15)*scrollspeed << vp->zoom; }
  1405 				} else if (15 - (vp->width - x) > 0) {
  1408 				else if (15-(vp->height-y) > 0) { WP(w,vp_d).scrollpos_y += (15-(vp->height-y))*scrollspeed << vp->zoom; }
  1406 					WP(w, vp_d).scrollpos_x += (15 - (vp->width - x)) * scrollspeed << vp->zoom;
       
  1407 				}
       
  1408 				if (y - 15 < 0) {
       
  1409 					WP(w, vp_d).scrollpos_y += (y - 15) * scrollspeed << vp->zoom;
       
  1410 				} else if (15 - (vp->height - y) > 0) {
       
  1411 					WP(w,vp_d).scrollpos_y += (15 - (vp->height - y)) * scrollspeed << vp->zoom;
       
  1412 				}
  1409 #undef scrollspeed
  1413 #undef scrollspeed
  1410 			}
  1414 			}
  1411 		}
  1415 		}
  1412 		return;
  1416 		return;
  1413 	}
  1417 	}
  1432 			if (_thd.place_mode != 0 &&
  1436 			if (_thd.place_mode != 0 &&
  1433 					// query button and place sign button work in pause mode
  1437 					// query button and place sign button work in pause mode
  1434 					_cursor.sprite != SPR_CURSOR_QUERY &&
  1438 					_cursor.sprite != SPR_CURSOR_QUERY &&
  1435 					_cursor.sprite != SPR_CURSOR_SIGN &&
  1439 					_cursor.sprite != SPR_CURSOR_SIGN &&
  1436 					_pause != 0 &&
  1440 					_pause != 0 &&
  1437 					!_cheats.build_in_pause.value)
  1441 					!_cheats.build_in_pause.value) {
  1438 						return;
  1442 				return;
       
  1443 			}
  1439 
  1444 
  1440 			if (_thd.place_mode == 0) {
  1445 			if (_thd.place_mode == 0) {
  1441 				HandleViewportClicked(vp, x, y);
  1446 				HandleViewportClicked(vp, x, y);
  1442 			} else {
  1447 			} else {
  1443 				PlaceObject();
  1448 				PlaceObject();