Changeset 659 for abuse/trunk/src/imlib/jwindow.cpp
- Timestamp:
- May 15, 2011, 6:22:25 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/imlib/jwindow.cpp
r655 r659 48 48 { 49 49 for (Jwindow *f=m_first; f; f=f->next) 50 if (f-> x<=x2 && f->y<=y2 && f->x+f->l-1>=x1 && f->y+f->h-1>=y1)50 if (f->m_pos.x<=x2 && f->m_pos.y<=y2 && f->m_pos.x+f->l-1>=x1 && f->m_pos.y+f->h-1>=y1) 51 51 return 1; 52 52 return 0; … … 72 72 { 73 73 p->hide(); 74 m_surf->AddDirty(p-> x, p->y, p->x + p->l, p->y + p->h);74 m_surf->AddDirty(p->m_pos.x, p->m_pos.y, p->m_pos.x + p->l, p->m_pos.y + p->h); 75 75 } 76 76 } … … 93 93 Jwindow *k; 94 94 for (k = m_first; k->next != j; k = k->next) 95 k->m_surf->AddDirty(j-> x - k->x, j->y - k->y,96 j-> x + j->l - k->x, j->y + j->h - k->y);97 k->m_surf->AddDirty(j-> x - k->x, j->y - k->y,98 j-> x + j->l - k->x, j->y + j->h - k->y);95 k->m_surf->AddDirty(j->m_pos.x - k->m_pos.x, j->m_pos.y - k->m_pos.y, 96 j->m_pos.x + j->l - k->m_pos.x, j->m_pos.y + j->h - k->m_pos.y); 97 k->m_surf->AddDirty(j->m_pos.x - k->m_pos.x, j->m_pos.y - k->m_pos.y, 98 j->m_pos.x + j->l - k->m_pos.x, j->m_pos.y + j->h - k->m_pos.y); 99 99 k->next = j->next; 100 100 } 101 m_surf->AddDirty(j-> x, j->y, j->x + j->l, j->y + j->h);101 m_surf->AddDirty(j->m_pos.x, j->m_pos.y, j->m_pos.x + j->l, j->m_pos.y + j->h); 102 102 j->hide(); 103 103 } … … 125 125 Jwindow *j; 126 126 for (ev.window=NULL,j=m_first; j; j=j->next) 127 if (!j->is_hidden() && ev.mouse_move .x>=j->x && ev.mouse_move.y>=j->y &&128 ev.mouse_move.x<j->x+j->l && ev.mouse_move.y<j->y+j->h)127 if (!j->is_hidden() && ev.mouse_move >= j->m_pos 128 && ev.mouse_move < j->m_pos + vec2i(j->l, j->h)) 129 129 ev.window=j; 130 130 … … 136 136 137 137 if ((ev.type==EV_MOUSE_BUTTON && ev.mouse_button==1 && ev.window && 138 ev.mouse_move .x>=ev.window->x && ev.mouse_move.y>=ev.window->y&&139 ev.mouse_move .x<ev.window->x+ev.window->l && ev.mouse_move.y<ev.window->y+ev.window->y1()))138 ev.mouse_move >= ev.window->m_pos && 139 ev.mouse_move < ev.window->m_pos + vec2i(ev.window->l, ev.window->y1()))) 140 140 { 141 if (ev.mouse_move.x-ev.window-> x<11) closew=1;141 if (ev.mouse_move.x-ev.window->m_pos.x < 11) closew=1; 142 142 else if (ev.window->is_moveable()) movew=1; 143 143 } else if (m_grab) … … 189 189 state=dragging; 190 190 drag_window=ev.window; 191 drag_mousex=ev.window-> x-ev.mouse_move.x;192 drag_mousey=ev.window-> y-ev.mouse_move.y;191 drag_mousex=ev.window->m_pos.x-ev.mouse_move.x; 192 drag_mousey=ev.window->m_pos.y-ev.mouse_move.y; 193 193 ev.type=EV_SPURIOUS; 194 194 } else if (ev.window) … … 214 214 { 215 215 for (Jwindow *j = m_first; j; j = j->next) 216 j->m_surf->AddDirty(ev.redraw.x1 - j-> x, ev.redraw.y1 - j->y,217 ev.redraw.x2 + 1 - j-> x, ev.redraw.y2 + 1 - j->y);216 j->m_surf->AddDirty(ev.redraw.x1 - j->m_pos.x, ev.redraw.y1 - j->m_pos.y, 217 ev.redraw.x2 + 1 - j->m_pos.x, ev.redraw.y2 + 1 - j->m_pos.y); 218 218 m_surf->AddDirty(ev.redraw.x1, ev.redraw.y1, ev.redraw.x2 + 1, ev.redraw.y2 + 1); 219 219 flush_screen(); … … 231 231 { 232 232 Jwindow *p; 233 m_surf->AddDirty(j-> x, j->y, j->x + j->l, j->y + j->h);233 m_surf->AddDirty(j->m_pos.x, j->m_pos.y, j->m_pos.x + j->l, j->m_pos.y + j->h); 234 234 for (p=m_first; p!=j; p=p->next) 235 p->m_surf->AddDirty(j-> x - p->x, j->y - p->y, j->x + j->l - p->x, j->y + j->h - p->y);235 p->m_surf->AddDirty(j->m_pos.x - p->m_pos.x, j->m_pos.y - p->m_pos.y, j->m_pos.x + j->l - p->m_pos.x, j->m_pos.y + j->h - p->m_pos.y); 236 236 j->resize(l,h); 237 237 if (!frame_suppress) … … 241 241 void WindowManager::move_window(Jwindow *j, int x, int y) 242 242 { 243 m_surf->AddDirty(j-> x, j->y, j->x + j->l, j->y + j->h);243 m_surf->AddDirty(j->m_pos.x, j->m_pos.y, j->m_pos.x + j->l, j->m_pos.y + j->h); 244 244 for(Jwindow *p = m_first; p != j; p = p->next) 245 p->m_surf->AddDirty(j-> x - p->x, j->y - p->y,246 j-> x + j->l - p->x, j->y + j->h - p->y);247 j-> x = x;248 j-> y = y;245 p->m_surf->AddDirty(j->m_pos.x - p->m_pos.x, j->m_pos.y - p->m_pos.y, 246 j->m_pos.x + j->l - p->m_pos.x, j->m_pos.y + j->h - p->m_pos.y); 247 j->m_pos.x = x; 248 j->m_pos.y = y; 249 249 j->m_surf->AddDirty(0, 0, j->l, j->h); 250 250 } … … 299 299 Jwindow * search; 300 300 for(search = m_first; search->next != win; search = search->next) 301 search->m_surf->AddDirty(win->x - search->x, 302 win->y - search->y, 303 win->x + win->l - search->x, 304 win->y + win->h - search->y); 305 search->m_surf->AddDirty(win->x - search->x, win->y - search->y, 306 win->x + win->l - search->x, 307 win->y + win->h - search->y); 301 search->m_surf->AddDirty(win->m_pos.x - search->m_pos.x, 302 win->m_pos.y - search->m_pos.y, 303 win->m_pos.x + win->l - search->m_pos.x, 304 win->m_pos.y + win->h - search->m_pos.y); 305 search->m_surf->AddDirty(win->m_pos.x - search->m_pos.x, 306 win->m_pos.y - search->m_pos.y, 307 win->m_pos.x + win->l - search->m_pos.x, 308 win->m_pos.y + win->h - search->m_pos.y); 308 309 search->next = win->next; 309 310 } 310 311 311 m_surf->AddDirty(win-> x, win->y, win->x + win->l, win->y + win->h);312 m_surf->AddDirty(win->m_pos.x, win->m_pos.y, win->m_pos.x + win->l, win->m_pos.y + win->h); 312 313 } 313 314 … … 320 321 y = m_surf->Size().y - 10; 321 322 322 Jwindow * j = new Jwindow ( x, y, l, h, fields, name);323 Jwindow * j = new Jwindow (vec2i(x, y), l, h, fields, name); 323 324 j->show(); 324 325 … … 328 329 void WindowManager::flush_screen() 329 330 { 330 int mx = 0, my = 0;331 vec2i m1(0, 0); 331 332 332 333 if (has_mouse()) 333 334 { 334 mx = (m_pos - m_center).x; 335 my = (m_pos - m_center).y; 336 337 m_sprite->save->PutPart(m_surf, 0, 0, mx, my, 338 mx + m_sprite->visual->Size().x - 1, 339 my + m_sprite->visual->Size().y - 1); 340 m_surf->PutImage(m_sprite->visual, vec2i(mx, my), 1); 335 m1 = m_pos - m_center; 336 vec2i m2 = m1 + m_sprite->visual->Size() - vec2i(1, 1); 337 338 m_sprite->save->PutPart(m_surf, 0, 0, m1.x, m1.y, m2.x, m2.y); 339 m_surf->PutImage(m_sprite->visual, m1, 1); 341 340 } 342 341 343 342 for (Jwindow *p = m_first; p; p = p->next) 344 343 if (!p->is_hidden()) 345 m_surf->delete_dirty(p-> x, p->y, p->x + p->l, p->y + p->h);344 m_surf->delete_dirty(p->m_pos.x, p->m_pos.y, p->m_pos.x + p->l, p->m_pos.y + p->h); 346 345 update_dirty(m_surf); 347 346 348 347 if (has_mouse()) 349 m_surf->PutImage(m_sprite->save, vec2i(mx, my));348 m_surf->PutImage(m_sprite->save, m1); 350 349 351 350 for (Jwindow *p = m_first; p; p = p->next) … … 356 355 if (has_mouse()) 357 356 { 358 m_sprite->save->PutPart(p->m_surf, 0, 0, mx - p->x, my - p->y, 359 mx - p->x + m_sprite->visual->Size().x - 1, 360 my - p->y + m_sprite->visual->Size().y - 1); 361 p->m_surf->PutImage(m_sprite->visual, 362 vec2i(mx - p->x, my - p->y), 1); 357 m_sprite->save->PutPart(p->m_surf, 0, 0, m1.x - p->m_pos.x, m1.y - p->m_pos.y, 358 m1.x - p->m_pos.x + m_sprite->visual->Size().x - 1, 359 m1.y - p->m_pos.y + m_sprite->visual->Size().y - 1); 360 p->m_surf->PutImage(m_sprite->visual, m1 - p->m_pos, 1); 363 361 } 364 362 365 // m_surf->delete_dirty(p-> x, p->y, p->x+p->l, p->y+p->h);363 // m_surf->delete_dirty(p->m_pos.x, p->m_pos.y, p->m_pos.x+p->l, p->m_pos.y+p->h); 366 364 for (Jwindow *q = p->next; q; q = q->next) 367 365 if (!q->is_hidden()) 368 p->m_surf->delete_dirty(q-> x - p->x, q->y - p->y,369 q-> x + q->l - p->x,370 q-> y + q->h - p->y);371 update_dirty(p->m_surf, p-> x, p->y);366 p->m_surf->delete_dirty(q->m_pos.x - p->m_pos.x, q->m_pos.y - p->m_pos.y, 367 q->m_pos.x + q->l - p->m_pos.x, 368 q->m_pos.y + q->h - p->m_pos.y); 369 update_dirty(p->m_surf, p->m_pos.x, p->m_pos.y); 372 370 if (has_mouse()) 373 p->m_surf->PutImage(m_sprite->save, vec2i(mx - p->x, my - p->y), 0);371 p->m_surf->PutImage(m_sprite->save, m1 - p->m_pos, 0); 374 372 } 375 373 } … … 397 395 } 398 396 399 Jwindow::Jwindow( int X, int Y, int L, int H, ifield *f, char const *name)397 Jwindow::Jwindow(vec2i pos, int L, int H, ifield *f, char const *name) 400 398 { 401 399 l = 0; … … 413 411 l = L >= 0 ? L + left_border() : l - L; 414 412 h = H >= 0 ? H + top_border() : h - H; 415 y = Y >= 0 ? Y : yres - h + Y - top_border() - bottom_border() - 1;416 x = X >= 0 ? X : xres - l + X - left_border() - right_border() - 1;413 m_pos.x = pos.x >= 0 ? pos.x : xres - l + pos.x - left_border() - right_border() - 1; 414 m_pos.y = pos.y >= 0 ? pos.y : yres - h + pos.y - top_border() - bottom_border() - 1; 417 415 418 416 backg = wm->medium_color(); … … 605 603 if (j) 606 604 { 607 ev.mouse_move.x-=j->x; 608 ev.mouse_move.y-=j->y; 609 m_cur=j; 605 ev.mouse_move -= j->m_pos; 606 m_cur = j; 610 607 } 611 608 … … 662 659 663 660 if (j) 664 { 665 ev.mouse_move.x+=j->x; 666 ev.mouse_move.y+=j->y; 667 } 661 ev.mouse_move += j->m_pos; 668 662 } 669 663 … … 759 753 { 760 754 owner = NULL; 761 x = 0; 762 y = 0; 755 m_pos = vec2i(0, 0); 763 756 next = NULL; 764 757 id = 0; … … 774 767 { 775 768 if(owner) 776 move(x - owner->x1(), y - owner->y1());769 Move(m_pos - vec2i(owner->x1(), owner->y1())); 777 770 owner = newowner; 778 771 if(owner) 779 move(x + owner->x1(), y + owner->y1());780 } 781 772 Move(m_pos + vec2i(owner->x1(), owner->y1())); 773 } 774
Note: See TracChangeset
for help on using the changeset viewer.