Changeset 671
- Timestamp:
- May 16, 2011, 2:37:31 AM (11 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/automap.cpp
r670 r671 164 164 old_dy = -1000; 165 165 166 automap_window = wm-> new_window(0, 0,w * AUTOTILE_WIDTH,167 h * AUTOTILE_HEIGHT , NULL, "Map");166 automap_window = wm->CreateWindow(vec2i(0), vec2i(w * AUTOTILE_WIDTH, 167 h * AUTOTILE_HEIGHT), NULL, "Map"); 168 168 automap_window->m_surf->Bar(vec2i(17, 1), vec2i(17 + 8 * 6 + 3, 6), 169 169 wm->medium_color()); -
abuse/trunk/src/console.cpp
r668 r671 52 52 if (!con_win) 53 53 { 54 con_win=wm->new_window(lastx,lasty,screen_w(),screen_h(),NULL,name); 54 con_win=wm->CreateWindow(vec2i(lastx, lasty), 55 vec2i(screen_w(), screen_h()), NULL, name); 55 56 redraw(); 56 57 con_win->m_surf->SetClip(vec2i(con_win->x1(), con_win->y1()), -
abuse/trunk/src/dev.cpp
r670 r671 169 169 SPEC_IMAGE, 1))->copy(); 170 170 171 quitw = wm-> new_window(xres / 2 + 40, yres / 2, 80, -1,171 quitw = wm->CreateWindow(vec2i(xres / 2 + 40, yres / 2), vec2i(80, -1), 172 172 new button(10, wm->font()->Size().y + 4, ID_QUIT_OK, ok_image, 173 173 new button(38, wm->font()->Size().y + 4, ID_CANCEL, cancel_image, … … 325 325 return; 326 326 327 ambw = wm-> new_window(prop->getd("ambient x", -1),328 prop->getd("ambient y", -1), -1, -1,329 new amb_cont(0, 0, NULL), "ambient");327 ambw = wm->CreateWindow(vec2i(prop->getd("ambient x", -1), 328 prop->getd("ambient y", -1)), 329 vec2i(-1), new amb_cont(0, 0, NULL), "ambient"); 330 330 } 331 331 … … 593 593 5,(visual_object **)dev_mode_pict,dev_mode_ids,DEV_MODES, 594 594 pal,pal,NULL); 595 tbw=wm-> new_window(prop->getd("toolbar x",-1),596 prop->getd("toolbar y",-1),-1,-1,tp);595 tbw=wm->CreateWindow(vec2i(prop->getd("toolbar x", -1), 596 prop->getd("toolbar y", -1)), vec2i(-1), tp); 597 597 tp->set_x(setx,tbw->m_surf); 598 598 } … … 634 634 fb->push(); 635 635 636 show_menu = wm-> new_window(prop->getd("layer x", -1),637 prop->getd("layer y", -1), -1, -1,638 fb, symbol_str(symbol_str("SHOW?")));636 show_menu = wm->CreateWindow(vec2i(prop->getd("layer x", -1), 637 prop->getd("layer y", -1)), vec2i(-1), 638 fb, symbol_str(symbol_str("SHOW?"))); 639 639 } 640 640 … … 673 673 } 674 674 675 omenu = wm-> new_window(prop->getd("objects x", 0),676 prop->getd("objects y", 0), -1, -1,677 new pick_list(0, 0, DEV_CREATE,678 yres / wm->font()->Size().y / 2,679 listable_objs, total_listable, 0,680 NULL, cache.img(window_texture)));675 omenu = wm->CreateWindow(vec2i(prop->getd("objects x", 0), 676 prop->getd("objects y", 0)), vec2i(-1), 677 new pick_list(0, 0, DEV_CREATE, 678 yres / wm->font()->Size().y / 2, 679 listable_objs, total_listable, 0, 680 NULL, cache.img(window_texture))); 681 681 } 682 682 … … 714 714 pwin_list[i] = pal_wins[i]->name; 715 715 716 pmenu = wm-> new_window(prop->getd("pal x",0),717 prop->getd("pal y",-1), -1,-1,718 new pick_list(0, 0, DEV_PALETTE,719 yres / wm->font()->Size().y / 2,720 pwin_list, total_pals, 0, NULL,721 cache.img(window_texture)));716 pmenu = wm->CreateWindow(vec2i(prop->getd("pal x", 0), 717 prop->getd("pal y", -1)), vec2i(-1), 718 new pick_list(0, 0, DEV_PALETTE, 719 yres / wm->font()->Size().y / 2, 720 pwin_list, total_pals, 0, NULL, 721 cache.img(window_texture))); 722 722 } 723 723 … … 744 744 f_tp->reverse(); 745 745 746 forew = wm->new_window(prop->getd("fore x", -30), prop->getd("fore y", 0), 747 -1, -1, f_tp,symbol_str("l_fg")); 746 forew = wm->CreateWindow(vec2i(prop->getd("fore x", -30), 747 prop->getd("fore y", 0)), 748 vec2i(-1), f_tp,symbol_str("l_fg")); 748 749 } 749 750 … … 752 753 /* if (!music_window) 753 754 { 754 music_window=wm-> new_window(-1,30,0,0,755 music_window=wm->CreateWindow(vec2i(-1, 30), vec2i(0, 0), 755 756 new pick_list(0,0,DEV_MUSIC_PICKLIST,10,song_list,total_songs,0,NULL)); 756 757 wm->fnt->put_string(music_window->m_surf,0,1,"songs"); … … 781 782 tile_picker *f_tp = new tile_picker(0, 0, DEV_BG_PICKER, SPEC_BACKTILE, 782 783 bg_scale, maxh, bg_w, NULL); 783 forew = wm->new_window(prop->getd("back x", -30), prop->getd("back y", 0), 784 -1, -1, f_tp,symbol_str("l_bg")); 784 forew = wm->CreateWindow(vec2i(prop->getd("back x", -30), 785 prop->getd("back y", 0)), 786 vec2i(-1), f_tp,symbol_str("l_bg")); 785 787 } 786 788 … … 801 803 int bw = cache.img(dev_forward)->Size().x; 802 804 /* FIXME: previous code had 1,1 instead of 0,0 -- investigate */ 803 search_window = wm->new_window(prop->getd("searchw x", -30), 804 prop->getd("searchw y", 0), -1, -1, 805 search_window = wm->CreateWindow(vec2i(prop->getd("searchw x", -30), 806 prop->getd("searchw y", 0)), 807 vec2i(-1), 805 808 new text_field(0, 0, ID_SEARCH_TEXT, "object name>", 806 809 "***************************", … … 1333 1336 int bh = 16 + 6, bw = 20 + 6, th = wm->font()->Size().y + 4; 1334 1337 1335 lightw = wm-> new_window(prop->getd("light create x", 0),1336 prop->getd("light create y", 0), -1, -1,1338 lightw = wm->CreateWindow(vec2i(prop->getd("light create x", 0), 1339 prop->getd("light create y", 0)), vec2i(-1), 1337 1340 new button_box(0, 0, DEV_LIGHT_BUTTON_BOX, 1, 1338 1341 new button(bw * 0, bh * 0, DEV_LIGHT0, cache.img(light_buttons[0]), … … 1390 1393 wh+=th; 1391 1394 } 1392 aiw=wm->new_window(prop->getd("ai x",0), 1393 prop->getd("ai y",0), 1394 -1,-1, 1395 aiw=wm->CreateWindow(vec2i(prop->getd("ai x",0), prop->getd("ai y",0)), 1396 vec2i(-1), 1395 1397 new button(wl,owh-20,DEV_AI_OK,cache.img(dev_ok),first),"ai"); 1396 1398 … … 1398 1400 else 1399 1401 { 1400 aiw=wm->new_window(prop->getd("ai x",0), 1401 prop->getd("ai y",0), 1402 -1,-1, 1402 aiw=wm->CreateWindow(vec2i(prop->getd("ai x", 0), prop->getd("ai y", 0)), 1403 vec2i(-1), 1403 1404 new button(wl,wh-20,DEV_AI_OK,cache.img(dev_ok), 1404 1405 new text_field(wl,wh+th*0, DEV_AI_XVEL, symbol_str("ai_xvel"),"#####",(double)o->xvel(), … … 1573 1574 if (area_win) close_area_win(0); 1574 1575 int wl=0,wh=0,th=wm->font()->Size().y+12,bw=cache.img(dev_ok)->Size().x+10; 1575 area_win=wm->new_window(prop->getd("area_box x",0), 1576 prop->getd("area_box y",0), 1577 -1,-1, 1578 1576 area_win=wm->CreateWindow(vec2i(prop->getd("area_box x", 0), 1577 prop->getd("area_box y", 0)), vec2i(-1), 1579 1578 new button(wl+bw*0,wh-8,DEV_AREA_OK,cache.img(dev_ok), 1580 1579 new button(wl+bw*1,wh-8,DEV_AREA_DELETE,cache.img(dev_del), … … 1894 1893 int bw=20+6,bh=16+6; 1895 1894 1896 oedit=wm->new_window(prop->getd("oedit x",0), 1897 prop->getd("oedit y",0), 1898 -1,-1,new button_box(0,0,ID_NULL,1, 1899 new button(bw*0,0,DEV_OEDIT_OK,cache.img(dev_ok), 1900 new button(bw*1,0,DEV_OEDIT_MOVE,cache.img(dev_move), 1901 new button(bw*2,0,DEV_OEDIT_FRONT,cache.img(dev_front), 1902 new button(bw*3,0,DEV_OEDIT_BACK,cache.img(dev_back), 1903 new button(bw*4,0,DEV_OEDIT_COPY,cache.img(dev_copy), 1904 new button(bw*0,bh*1,DEV_OEDIT_DELETE,cache.img(dev_del), 1905 NULL)))))), 1906 new button(bw*5,bh*0,DEV_OEDIT_AI,cache.img(dev_ai), 1907 1908 new button_box(bw*1,bh*1,DEV_OEDIT_CHAR_BOX,0, 1909 new button(bw*1,bh*1,DEV_OEDIT_LEFT,cache.img(dev_char_left), 1910 new button(bw*2,bh*1,DEV_OEDIT_RIGHT,cache.img(dev_char_right),NULL)), 1911 1912 new button(bw*3,bh*1,DEV_OBJECTS_DELETE,cache.img(dev_objects), 1913 new button(bw*4,bh*1,DEV_LIGHTS_DELETE,cache.img(dev_lights),NULL))))), 1914 symbol_str("l_EDIT")); 1895 oedit=wm->CreateWindow(vec2i(prop->getd("oedit x", 0), 1896 prop->getd("oedit y", 0)), vec2i(-1), 1897 new button_box(0,0,ID_NULL,1, 1898 new button(bw*0,0,DEV_OEDIT_OK,cache.img(dev_ok), 1899 new button(bw*1,0,DEV_OEDIT_MOVE,cache.img(dev_move), 1900 new button(bw*2,0,DEV_OEDIT_FRONT,cache.img(dev_front), 1901 new button(bw*3,0,DEV_OEDIT_BACK,cache.img(dev_back), 1902 new button(bw*4,0,DEV_OEDIT_COPY,cache.img(dev_copy), 1903 new button(bw*0,bh*1,DEV_OEDIT_DELETE,cache.img(dev_del), 1904 NULL)))))), 1905 new button(bw*5,bh*0,DEV_OEDIT_AI,cache.img(dev_ai), 1906 1907 new button_box(bw*1,bh*1,DEV_OEDIT_CHAR_BOX,0, 1908 new button(bw*1,bh*1,DEV_OEDIT_LEFT,cache.img(dev_char_left), 1909 new button(bw*2,bh*1,DEV_OEDIT_RIGHT,cache.img(dev_char_right),NULL)), 1910 new button(bw*3,bh*1,DEV_OBJECTS_DELETE,cache.img(dev_objects), 1911 new button(bw*4,bh*1,DEV_LIGHTS_DELETE,cache.img(dev_lights),NULL))))), 1912 symbol_str("l_EDIT")); 1915 1913 1916 1914 … … 1931 1929 edit_light->known=1; 1932 1930 } 1933 ledit=wm->new_window(prop->getd("ledit x",0), 1934 prop->getd("ledit y",0), 1935 -1,-1, 1931 ledit=wm->CreateWindow(vec2i(prop->getd("ledit x", 0), 1932 prop->getd("ledit y", 0)), vec2i(-1), 1936 1933 new button_box(0,0,ID_NULL,1, 1937 1934 new button(bw*0,0,DEV_LEDIT_OK,cache.img(dev_ok), … … 2100 2097 if (!mess_win) 2101 2098 { 2102 mess_win=wm-> new_window(xres/2,yres/2,-1,-1,2099 mess_win=wm->CreateWindow(vec2i(xres / 2, yres / 2), vec2i(-1), 2103 2100 new button(10,20,ID_LEVEL_NEW_OK,symbol_str("YES"), 2104 2101 new button(40,20,ID_CANCEL,symbol_str("NO"), … … 2119 2116 { 2120 2117 int h=wm->font()->Size().y+8; 2121 mess_win=wm-> new_window(xres/2,yres/2,-1,-1,2118 mess_win=wm->CreateWindow(vec2i(xres / 2, yres / 2), vec2i(-1), 2122 2119 new text_field(0,h*0,ID_MESS_STR1,symbol_str("width_"),"****", 2123 2120 current_level ? current_level->foreground_width() : 100, … … 2171 2168 { 2172 2169 int h=wm->font()->Size().y+8; 2173 mess_win=wm-> new_window(xres/2,yres/2,-1,-1,2170 mess_win=wm->CreateWindow(vec2i(xres / 2, yres / 2), vec2i(-1), 2174 2171 new text_field(0,h*0,ID_RECORD_DEMO_FILENAME, 2175 2172 "demo filename","*******************", … … 2191 2188 { 2192 2189 int h=wm->font()->Size().y+8; 2193 mess_win=wm-> new_window(xres/2,yres/2,-1,-1,2190 mess_win=wm->CreateWindow(vec2i(xres / 2, yres / 2), vec2i(-1), 2194 2191 new text_field(0,h*0,ID_PLAY_DEMO_FILENAME, 2195 2192 "demo filename","*******************", … … 2212 2209 { 2213 2210 int h=wm->font()->Size().y+8; 2214 mess_win=wm-> new_window(xres/2,yres/2,-1,-1,2211 mess_win=wm->CreateWindow(vec2i(xres / 2, yres / 2), vec2i(-1), 2215 2212 new text_field(0,h*0,ID_MESS_STR1,symbol_str("x_mul"),"****",bg_xmul, 2216 2213 new text_field(0,h*1,ID_MESS_STR2,symbol_str("x_div"),"****",bg_xdiv, … … 2233 2230 int h=wm->font()->Size().y+8; 2234 2231 2235 warn_win=wm->new_window(xres/2-40,yres/2-40,-1,-1, 2232 warn_win=wm->CreateWindow(vec2i(xres / 2 - 40, yres / 2 - 40), 2233 vec2i(-1), 2236 2234 new info_field(0,0,ID_NULL, 2237 2235 symbol_str("back_loss"), … … 2277 2275 { 2278 2276 int h=wm->font()->Size().y+8; 2279 mess_win=wm-> new_window(xres/2,yres/2,-1,-1,2277 mess_win=wm->CreateWindow(vec2i(xres / 2, yres / 2), vec2i(-1), 2280 2278 new text_field(0,h*0,ID_MESS_STR1,symbol_str("ap_width"),"****",2, 2281 2279 new text_field(0,h*1,ID_MESS_STR2,symbol_str("ap_height"),"****",2, … … 2958 2956 { 2959 2957 if (me) close_window(); 2960 me=wm->new_window(x,y,w*f_wid/scale,h*f_hi/scale,NULL,name); 2958 me=wm->CreateWindow(vec2i(x, y), vec2i(w * f_wid / scale, 2959 h * f_hi / scale), NULL, name); 2961 2960 draw(); 2962 2961 } -
abuse/trunk/src/game.cpp
r670 r671 118 118 no_space_msg, NULL); 119 119 button *b = new button(0, 0, ID_QUIT_OK, "Quit", inf); 120 Jwindow *no_space = wm-> new_window(0, 0, -1, -1, b, "ERROR");120 Jwindow *no_space = wm->CreateWindow(vec2i(0), vec2i(-1), b, "ERROR"); 121 121 122 122 Event ev; … … 1654 1654 if(!joy_win) 1655 1655 { 1656 joy_win = wm-> new_window(80, 50, -1, -1,1656 joy_win = wm->CreateWindow(vec2i(80, 50), vec2i(-1), 1657 1657 new button(70, 9, JOY_OK, "OK", 1658 1658 new info_field(0, 30, DEV_NULL, -
abuse/trunk/src/gamma.cpp
r668 r671 148 148 gp->set_pos(dg / 4); 149 149 150 Jwindow *gw = wm->new_window(xres / 2 - 190, yres / 2 - 90, -1, -1, gp); 150 Jwindow *gw = wm->CreateWindow(vec2i(xres / 2 - 190, 151 yres / 2 - 90), vec2i(-1), gp); 151 152 152 153 Event ev; -
abuse/trunk/src/imlib/filesel.cpp
r668 r671 134 134 int wh2 = 5 + wm->font()->Size().y + 5; 135 135 int wh3 = wh2 + wm->font()->Size().y + 12; 136 Jwindow *j=wm-> new_window(0,0,-1,-1,136 Jwindow *j=wm->CreateWindow(vec2i(0), vec2i(-1), 137 137 new info_field(5, 5, 0, prompt, 138 138 new text_field(0, wh2, filename_id, -
abuse/trunk/src/imlib/guistat.cpp
r668 r671 113 113 int mx = first->stat_win->x1() + 1; 114 114 int my = first->stat_win->y1() + wm->font()->Size().y / 2; 115 first->stat_win=wm-> new_window(wx, wy, len3, h1*2+h2, NULL, "status");115 first->stat_win=wm->CreateWindow(vec2i(wx, wy), vec2i(len3, h1*2+h2), NULL, "status"); 116 116 wm->font()->PutString(first->stat_win->m_surf, vec2i(mx, my), first->name, wm->black()); 117 117 wm->font()->PutString(first->stat_win->m_surf, vec2i(mx, my), first->name, wm->bright_color()); -
abuse/trunk/src/imlib/jwindow.cpp
r670 r671 44 44 } 45 45 46 // true if a window lies in this area47 int WindowManager::window_in_area(int x1, int y1, int x2, int y2)48 {49 for (Jwindow *f=m_first; f; f=f->next)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 return 1;52 return 0;53 }54 55 46 void WindowManager::grab_focus(Jwindow *j) 56 47 { m_grab=j; } … … 72 63 { 73 64 p->hide(); 74 m_surf->AddDirty(p->m_pos, p->m_pos + vec2i(p->l, p->h));65 m_surf->AddDirty(p->m_pos, p->m_pos + p->m_size); 75 66 } 76 67 } … … 94 85 for (k = m_first; k->next != j; k = k->next) 95 86 k->m_surf->AddDirty(j->m_pos - k->m_pos, 96 j->m_pos + vec2i(j->l, j->h) - k->m_pos);87 j->m_pos - k->m_pos + j->m_size); 97 88 k->m_surf->AddDirty(j->m_pos - k->m_pos, 98 j->m_pos + vec2i(j->l, j->h) - k->m_pos);89 j->m_pos - k->m_pos + j->m_size); 99 90 k->next = j->next; 100 91 } 101 m_surf->AddDirty(j->m_pos, j->m_pos + vec2i(j->l, j->h));92 m_surf->AddDirty(j->m_pos, j->m_pos + j->m_size); 102 93 j->hide(); 103 94 } … … 108 99 { 109 100 j->show(); 110 j->m_surf->AddDirty(vec2i(0), vec2i(j->l, j->h));101 j->m_surf->AddDirty(vec2i(0), j->m_size); 111 102 } 112 103 } … … 126 117 for (ev.window=NULL,j=m_first; j; j=j->next) 127 118 if (!j->is_hidden() && ev.mouse_move >= j->m_pos 128 && ev.mouse_move < j->m_pos + vec2i(j->l, j->h))119 && ev.mouse_move < j->m_pos + j->m_size) 129 120 ev.window=j; 130 121 … … 137 128 if ((ev.type==EV_MOUSE_BUTTON && ev.mouse_button==1 && ev.window && 138 129 ev.mouse_move >= ev.window->m_pos && 139 ev.mouse_move < ev.window->m_pos + vec2i(ev.window-> l, ev.window->y1())))130 ev.mouse_move < ev.window->m_pos + vec2i(ev.window->m_size.x, ev.window->y1()))) 140 131 { 141 132 if (ev.mouse_move.x-ev.window->m_pos.x < 11) closew=1; … … 183 174 for (p=m_first; p!=j; p=p->next) 184 175 p->m_surf->AddDirty(j->x-p->x,j->y-p->y,j->x+j->l-p->x,j->y+j->h-p->y); */ 185 j->m_surf->AddDirty(vec2i(0), vec2i(j->l, j->h));176 j->m_surf->AddDirty(vec2i(0), j->m_size); 186 177 flush_screen(); 187 178 } … … 223 214 } 224 215 225 void Jwindow:: resize(int L, int H)226 { 227 m_surf->SetSize(vec2i(L,H));228 l=L; h=H;216 void Jwindow::Resize(vec2i size) 217 { 218 m_surf->SetSize(size); 219 m_size = size; 229 220 } 230 221 … … 232 223 { 233 224 Jwindow *p; 234 m_surf->AddDirty(j->m_pos, j->m_pos + vec2i(j->l, j->h));225 m_surf->AddDirty(j->m_pos, j->m_pos + j->m_size); 235 226 for (p=m_first; p!=j; p=p->next) 236 227 p->m_surf->AddDirty(j->m_pos - p->m_pos, 237 j->m_pos - p->m_pos + vec2i(j->l, j->h));238 j-> resize(l,h);228 j->m_pos - p->m_pos + j->m_size); 229 j->Resize(vec2i(l,h)); 239 230 if (!frame_suppress) 240 231 j->redraw(); … … 243 234 void WindowManager::move_window(Jwindow *j, int x, int y) 244 235 { 245 m_surf->AddDirty(j->m_pos, j->m_pos + vec2i(j->l, j->h));236 m_surf->AddDirty(j->m_pos, j->m_pos + j->m_size); 246 237 for(Jwindow *p = m_first; p != j; p = p->next) 247 238 p->m_surf->AddDirty(j->m_pos - p->m_pos, 248 j->m_pos - p->m_pos + vec2i(j->l, j->h));239 j->m_pos - p->m_pos + j->m_size); 249 240 j->m_pos.x = x; 250 241 j->m_pos.y = y; 251 j->m_surf->AddDirty(vec2i(0), vec2i(j->l, j->h));242 j->m_surf->AddDirty(vec2i(0), j->m_size); 252 243 } 253 244 … … 302 293 for(search = m_first; search->next != win; search = search->next) 303 294 search->m_surf->AddDirty(win->m_pos - search->m_pos, 304 win->m_pos - search->m_pos 305 + vec2i(win->l, win->h)); 295 win->m_pos - search->m_pos + win->m_size); 306 296 search->m_surf->AddDirty(win->m_pos - search->m_pos, 307 win->m_pos - search->m_pos 308 + vec2i(win->l, win->h)); 297 win->m_pos - search->m_pos + win->m_size); 309 298 search->next = win->next; 310 299 } 311 300 312 m_surf->AddDirty(win->m_pos, win->m_pos + vec2i(win->l, win->h));313 } 314 315 Jwindow * WindowManager:: new_window(int x, int y, int l, int h,316 ifield * fields, char const *name)317 { 318 if( x > m_surf->Size().x - 4)319 x = m_surf->Size().x - 25;320 if( y > m_surf->Size().y - 4)321 y = m_surf->Size().y - 10;322 323 Jwindow * j = new Jwindow (vec2i(x, y), l, h, fields, name);301 m_surf->AddDirty(win->m_pos, win->m_pos + win->m_size); 302 } 303 304 Jwindow * WindowManager::CreateWindow(vec2i pos, vec2i size, 305 ifield * fields, char const *name) 306 { 307 if(pos.x > m_surf->Size().x - 4) 308 pos.x = m_surf->Size().x - 25; 309 if(pos.y > m_surf->Size().y - 4) 310 pos.y = m_surf->Size().y - 10; 311 312 Jwindow * j = new Jwindow(pos, size, fields, name); 324 313 j->show(); 325 314 … … 342 331 for (Jwindow *p = m_first; p; p = p->next) 343 332 if (!p->is_hidden()) 344 m_surf->DeleteDirty(p->m_pos, p->m_pos + vec2i(p->l, p->h));333 m_surf->DeleteDirty(p->m_pos, p->m_pos + p->m_size); 345 334 update_dirty(m_surf); 346 335 … … 360 349 } 361 350 362 // m_surf->DeleteDirty(p->m_pos, p->m_pos + vec2i(p->l, p->h));351 // m_surf->DeleteDirty(p->m_pos, p->m_pos + p->m_size); 363 352 for (Jwindow *q = p->next; q; q = q->next) 364 353 if (!q->is_hidden()) 365 354 p->m_surf->DeleteDirty(q->m_pos - p->m_pos, 366 q->m_pos - p->m_pos + vec2i(q->l, q->h));355 q->m_pos - p->m_pos + q->m_size); 367 356 update_dirty(p->m_surf, p->m_pos.x, p->m_pos.y); 368 357 if (has_mouse()) … … 393 382 } 394 383 395 Jwindow::Jwindow(vec2i pos, int L, int H, ifield *f, char const *name) 396 { 397 l = 0; 398 h = 0; 384 Jwindow::Jwindow(vec2i pos, vec2i size, ifield *f, char const *name) 385 { 386 m_size = 0; 399 387 _hidden = false; 400 388 _moveable = true; … … 407 395 reconfigure(); /* FIXME: TODO */ 408 396 409 l = L >= 0 ? L + left_border() : l - L;410 h = H >= 0 ? H + top_border() : h - H;411 m_pos.x = pos.x >= 0 ? pos.x : xres - l+ pos.x - left_border() - right_border() - 1;412 m_pos.y = pos.y >= 0 ? pos.y : yres - h+ pos.y - top_border() - bottom_border() - 1;397 m_size.x = size.x >= 0 ? size.x + left_border() : m_size.x - size.x; 398 m_size.y = size.y >= 0 ? size.y + top_border() : m_size.y - size.y; 399 m_pos.x = pos.x >= 0 ? pos.x : xres - m_size.x + pos.x - left_border() - right_border() - 1; 400 m_pos.y = pos.y >= 0 ? pos.y : yres - m_size.y + pos.y - top_border() - bottom_border() - 1; 413 401 414 402 backg = wm->medium_color(); 415 403 416 _x2 = l - 1; 417 _y2 = h - 1; 418 l += right_border(); 419 h += bottom_border(); 420 421 if(L == -1) 422 if(l < 15 + left_border() + right_border()) 423 l = 15 + left_border() + right_border(); 424 if(H == -1) 425 if(h < top_border() + bottom_border()) 426 h = top_border() + bottom_border(); 427 m_surf = new image(vec2i(l, h), NULL, 2); 404 _x2 = m_size.x - 1; 405 _y2 = m_size.y - 1; 406 m_size += vec2i(right_border(), bottom_border()); 407 408 if(size.x == -1) 409 m_size.x = Max(m_size.x, 15 + left_border() + right_border()); 410 if(size.y == -1) 411 m_size.y = Max(m_size.y, top_border() + bottom_border()); 412 m_surf = new image(m_size, NULL, 2); 428 413 m_surf->clear(backg); 429 414 // Keep this from getting destroyed when image list is cleared … … 456 441 int x1, y1, x2, y2; 457 442 ifield *i; 458 l = 2; 459 h = 2; 443 m_size = vec2i(2); 460 444 for(i = inm->m_first; i; i = i->next) 461 445 { 462 446 i->set_owner(this); 463 447 i->area(x1, y1, x2, y2); 464 if ((int)y2 > (int)h) 465 h = y2; 466 if ((int)x2 > (int)l) 467 l = x2; 448 m_size = Max(m_size, vec2i(x2, y2)); 468 449 } 469 450 } … … 485 466 if (right_border() >= 1) 486 467 { 487 m_surf->WidgetBar(vec2i(0, 0), vec2i(l - 1, h -1), hi, med, low);468 m_surf->WidgetBar(vec2i(0, 0), m_size - vec2i(1), hi, med, low); 488 469 if (right_border() >= 3) 489 470 m_surf->WidgetBar(vec2i(right_border() - 1, top_border() - 1), 490 vec2i(l - left_border(), h -bottom_border()),471 m_size - vec2i(left_border(), bottom_border()), 491 472 low, med, hi); 492 473 … … 505 486 if (right_border() >= 1) 506 487 { 507 m_surf->WidgetBar(vec2i(0, 0), vec2i(l - 1, h -1), hi, med, low);488 m_surf->WidgetBar(vec2i(0, 0), m_size - vec2i(1), hi, med, low); 508 489 if (right_border() >= 3) 509 490 m_surf->WidgetBar(vec2i(right_border() - 1, jw_top + 4), 510 vec2i(l - left_border(), h -bottom_border()),491 m_size - vec2i(left_border(), bottom_border()), 511 492 low, med, hi); 512 493 else -
abuse/trunk/src/imlib/jwindow.h
r665 r671 91 91 public: 92 92 Jwindow *next; 93 int l, h,backg;93 int backg; 94 94 InputManager *inm; 95 95 void *local_info; // pointer to info block for local system (may support windows) 96 96 97 97 Jwindow(char const *name = NULL); 98 Jwindow(vec2i pos, int L, int H, ifield *f, char const *name = NULL);98 Jwindow(vec2i pos, vec2i size, ifield *f, char const *name = NULL); 99 99 ~Jwindow(); 100 100 101 101 virtual void redraw(); 102 void resize(int L, int H);102 void Resize(vec2i size); 103 103 void clear(int color = 0) { m_surf->Bar(vec2i(x1(), y1()), 104 104 vec2i(x2(), y2()), color); } … … 114 114 int y2() { return _y2; } 115 115 void clip_in() { m_surf->SetClip(vec2i(x1(), y1()), vec2i(x2() + 1, y2() + 1)); } 116 void clip_out() { m_surf->SetClip(vec2i(0), vec2i(l, h)); }116 void clip_out() { m_surf->SetClip(vec2i(0), m_size); } 117 117 char *read(int id) { return inm->get(id)->read(); } 118 118 void local_close(); … … 123 123 static int bottom_border(); 124 124 125 vec2i m_pos ;125 vec2i m_pos, m_size; 126 126 image *m_surf; 127 127 … … 159 159 JCFont *fnt, *wframe_fnt; 160 160 161 Jwindow * new_window(int x, int y, int l, int h,162 ifield *fields = NULL, char const *Name = NULL);161 Jwindow *CreateWindow(vec2i pos, vec2i size, 162 ifield *fields = NULL, char const *Name = NULL); 163 163 164 void set_frame_font(JCFont *fnt) { wframe_fnt = fnt; }165 164 JCFont *frame_font() { return wframe_fnt; } 166 165 void close_window(Jwindow *j); … … 181 180 void hide_window(Jwindow *j); 182 181 void show_window(Jwindow *j); 183 void set_frame_suppress(int x) { frame_suppress=x; }184 182 void grab_focus(Jwindow *j); 185 183 void release_focus(); 186 int window_in_area(int x1, int y1, int x2, int y2); // true if a window lies in this area187 184 188 185 private: -
abuse/trunk/src/imlib/pmenu.cpp
r668 r671 35 35 int h = Jwindow::top_border() + Jwindow::bottom_border(); 36 36 37 bar =wm->new_window(X, Y, w, 0, NULL);37 bar = wm->CreateWindow(vec2i(X, Y), vec2i(w, 0), NULL); 38 38 bar->freeze(); // can't drag this window 39 39 bar->m_surf->WidgetBar(vec2i(0, 0), vec2i(w - 1, h - 1), … … 195 195 if (h+y+parent->m_pos.y>=cbb.y) 196 196 { 197 if (parent->m_pos.y+parent-> h+wm->font()->Size().y>=cbb.y)197 if (parent->m_pos.y+parent->m_size.y+wm->font()->Size().y>=cbb.y) 198 198 y=-h; 199 199 else y=y-h+wm->font()->Size().y+5; … … 201 201 202 202 203 win=wm-> new_window(parent->m_pos.x+x,parent->m_pos.y+y,204 w - Jwindow::left_border() - Jwindow::right_border(),205 h - Jwindow::top_border() - Jwindow::bottom_border(),206 203 win=wm->CreateWindow(parent->m_pos + vec2i(x, y), 204 vec2i(w - Jwindow::left_border() - Jwindow::right_border(), 205 h - Jwindow::top_border() - Jwindow::bottom_border()), 206 NULL); 207 207 win->freeze(); 208 208 win->m_surf->WidgetBar(vec2i(0, 0), vec2i(w - 1, h - 1), -
abuse/trunk/src/innet.cpp
r668 r671 562 562 563 563 564 Jwindow *j=wm-> new_window(0,yres/2,-1,-1,new info_field(0, 0, 0, symbol_str("resync"),564 Jwindow *j=wm->CreateWindow(vec2i(0, yres / 2), vec2i(-1), new info_field(0, 0, 0, symbol_str("resync"), 565 565 new button(0, wm->font()->Size().y + 5, ID_NET_DISCONNECT, 566 566 symbol_str("slack"),NULL)),symbol_str("hold!")) … … 667 667 if (total_retry==12000) // 2 minutes and nothing 668 668 { 669 abort=wm-> new_window(0,yres/2,-1,wm->font()->Size().y*4,669 abort=wm->CreateWindow(vec2i(0, yres / 2), vec2i(-1, wm->font()->Size().y*4), 670 670 new info_field(0, 0, 0, symbol_str("waiting"), 671 671 new button(0, wm->font()->Size().y + 5, ID_NET_DISCONNECT, -
abuse/trunk/src/loadgame.cpp
r668 r671 87 87 buts[i]->next=buts[i+1]; 88 88 89 return wm-> new_window(mx,yres/2-(Jwindow::top_border()+maxih*5)/2,-1,-1,buts[0]);89 return wm->CreateWindow(vec2i(mx, yres / 2 - (Jwindow::top_border() + maxih * 5) / 2), vec2i(-1), buts[0]); 90 90 } 91 91 … … 232 232 */ 233 233 234 234 // Create thumbnail window 5 pixels to the right of the list window 235 235 Jwindow *l_win=create_num_window(0,total_saved,MAX_SAVE_LINES,thumbnails); 236 Jwindow *preview=wm-> new_window(l_win->m_pos.x+l_win->l+5,l_win->m_pos.y,max_w,max_h,NULL,title);236 Jwindow *preview=wm->CreateWindow(l_win->m_pos + vec2i(l_win->m_size.x + 5, 0), vec2i(max_w, max_h), NULL, title); 237 237 238 238 preview->m_surf->PutImage(first, vec2i(preview->x1(), preview->y1())); -
abuse/trunk/src/net/gserver.cpp
r668 r671 71 71 char msg[100]; 72 72 sprintf(msg,symbol_str("min_wait"),main_net_cfg->min_players-total_players()); 73 stat =wm->new_window(100,50,-1,-1,new info_field(0, 0, ID_NULL,msg,73 stat = wm->CreateWindow(vec2i(100, 50), vec2i(-1), new info_field(0, 0, ID_NULL, msg, 74 74 new button(0, wm->font()->Size().y * 2, ID_CANCEL,symbol_str("cancel_button"),NULL) )); 75 75 wm->flush_screen(); -
abuse/trunk/src/netcfg.cpp
r668 r671 57 57 void net_configuration::cfg_error(char const *msg) 58 58 { 59 Jwindow *j=wm-> new_window(-1,0,-1,-1,new info_field(0, 0, 0, msg,59 Jwindow *j=wm->CreateWindow(vec2i(-1, 0), vec2i(-1), new info_field(0, 0, 0, msg, 60 60 new button(0, 30,CFG_ERR_OK,symbol_str("ok_button"),NULL)),symbol_str("input_error")); 61 61 Event ev; -
abuse/trunk/src/profile.cpp
r668 r671 60 60 61 61 62 prof_win=wm->new_window(prop->getd("profile x",-1), 63 prop->getd("profile y",-1), 64 20 * console_font->Size().x, 65 (prof_height + 1) * console_font->Size().y, 66 NULL, 67 "PROFILE"); 62 prof_win=wm->CreateWindow(vec2i(prop->getd("profile x", -1), 63 prop->getd("profile y", -1)), 64 vec2i(20, prof_height + 1) * console_font->Size(), 65 NULL, "PROFILE"); 68 66 } 69 67 -
abuse/trunk/src/ui/volumewindow.cpp
r659 r671 42 42 //reconfigure(); 43 43 bg = cache.reg(ff, "vcontrol", SPEC_IMAGE, 1); 44 l = cache.img(bg)->Size().x; 45 h = cache.img(bg)->Size().y; 46 m_surf = new image(cache.img(bg)->Size(), NULL, 2); 44 m_size = cache.img(bg)->Size(); 45 m_surf = new image(m_size, NULL, 2); 47 46 redraw(); 48 47 }
Note: See TracChangeset
for help on using the changeset viewer.