X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_holmes_ui.inc;h=029b28062f7c1bd94daf27691224f354af275c40;hb=7d5ba44e3ea987adb8c846236613e8e5590ba750;hp=3f26b360c8e770e30c6592c38f0e0c64780d6543;hpb=293ea7628b51495cb55d020e33db3aa262c1085f;p=d2df-sdl.git diff --git a/src/game/g_holmes_ui.inc b/src/game/g_holmes_ui.inc index 3f26b36..029b280 100644 --- a/src/game/g_holmes_ui.inc +++ b/src/game/g_holmes_ui.inc @@ -176,8 +176,14 @@ end; procedure uiDraw (); var f: Integer; + ctl: THControl; begin - for f := 0 to High(uiTopList) do uiTopList[f].draw(); + for f := 0 to High(uiTopList) do + begin + ctl := uiTopList[f]; + ctl.draw(); + if (f <> High(uiTopList)) then darkenRect(ctl.x0, ctl.y0, ctl.width, ctl.height, 128); + end; end; @@ -740,6 +746,7 @@ procedure THTopWindow.drawControlPost (sx, sy: Integer); var r, g, b: Integer; begin + { if getFocused then begin r := 255; @@ -752,6 +759,10 @@ begin g := 127; b := 127; end; + } + r := 255; + g := 255; + b := 255; drawRect(mX, mY, mWidth, mHeight, r, g, b); if (Length(mTitle) > 0) then begin @@ -828,12 +839,13 @@ end; procedure THCtlCBListBox.appendItem (const atext: AnsiString; bv: PBoolean); begin - if (Length(atext)*8+4+10 > mWidth) then mWidth := Length(atext)*8+4+10; + if (Length(atext)*8+4+3*8+2 > mWidth) then mWidth := Length(atext)*8+4+3*8+2; SetLength(mItems, Length(mItems)+1); mItems[High(mItems)] := atext; SetLength(mChecks, Length(mChecks)+1); mChecks[High(mChecks)] := bv; if (Length(mItems)*8+4 > mHeight) then mHeight := Length(mItems)*8+4; + if (mCurIndex < 0) then mCurIndex := 0; end; @@ -847,8 +859,12 @@ begin for f := 0 to High(mItems) do begin if (mCurIndex = f) then fillRect(sx-2, sy, mWidth, 8, 0, 128, 0); - if (mChecks[f] <> nil) and (mChecks[f]^) then drawText8(sx, sy, '*', 255, 255, 255); - drawText8(sx+10, sy, mItems[f], 255, 255, 0); + if (mChecks[f] <> nil) then + begin + drawText8(sx, sy, '[ ]', 255, 255, 255); + if mChecks[f]^ then drawText8(sx+6, sy, 'x', 255, 255, 255); + drawText8(sx+3*8+2, sy, mItems[f], 255, 255, 0); + end; Inc(sy, 8); end; end; @@ -868,8 +884,11 @@ begin if (ly < 2) then ly := 2; ly := ly div 8; if (ly < 0) then ly := 0 else if (ly > High(mItems)) then ly := High(mItems); - mCurIndex := ly; - if (mChecks[ly] <> nil) then mChecks[ly]^ := not mChecks[ly]^; + if (mChecks[ly] <> nil) then + begin + mCurIndex := ly; + if (mChecks[ly] <> nil) then mChecks[ly]^ := not mChecks[ly]^; + end; end; end; end; @@ -898,14 +917,36 @@ begin SDL_SCANCODE_UP: begin result := true; - if (mCurIndex < 0) then mCurIndex := Length(mItems) - else if (mCurIndex > 0) then Dec(mCurIndex); + if (Length(mItems) > 0) then + begin + if (mCurIndex < 0) then mCurIndex := Length(mItems); + while (mCurIndex > 0) do + begin + Dec(mCurIndex); + if (mChecks[mCurIndex] <> nil) then break; + end; + end + else + begin + mCurIndex := -1; + end; end; SDL_SCANCODE_DOWN: begin result := true; - if (mCurIndex < 0) then mCurIndex := 0 - else if (mCurIndex < High(mItems)) then Inc(mCurIndex); + if (Length(mItems) > 0) then + begin + if (mCurIndex < 0) then mCurIndex := -1; + while (mCurIndex < High(mItems)) do + begin + Inc(mCurIndex); + if (mChecks[mCurIndex] <> nil) then break; + end; + end + else + begin + mCurIndex := -1; + end; end; SDL_SCANCODE_SPACE, SDL_SCANCODE_RETURN: