Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

61 rinda
1.7KB

  1. /* ---------------------------------------------------------------------------|
  2. *
  3. * Distributed under the CC0 public domain license.
  4. * By Alison G. Watson. Attribution is encouraged, though not required.
  5. * See licenses/cc0.txt for more information.
  6. *
  7. * ---------------------------------------------------------------------------|
  8. *
  9. * Saved notes UI.
  10. *
  11. * ---------------------------------------------------------------------------|
  12. */
  13. #include "common.h"
  14. #include "p_player.h"
  15. #include "w_world.h"
  16. #include "gui.h"
  17. void P_CBI_TabNotes(struct gui_state *g, struct player *p)
  18. {
  19. Str(edit, sLANG "EDIT");
  20. struct gui_txt *st = G_TxtBox(g, &CBIState(g)->notebox, 48, 40, p);
  21. PrintText_str(L(edit), s_smallfnt, g->defcr, 32,2, 41,0);
  22. if(G_ChkBox(g, CBIState(g)->noteedit, 34, 37))
  23. CBIState(g)->noteedit = !CBIState(g)->noteedit;
  24. if(G_Button(g, LC(LANG "CLEAR"), 16, 50, Pre(btnclear)))
  25. G_TxtBoxRes(st);
  26. G_ScrBeg(g, &CBIState(g)->notescr, 15, 63, 280, 160, 30 * countof(p->notes), 240);
  27. for(i32 i = 0; i < countof(p->notes); i++)
  28. {
  29. if(G_ScrOcc(g, &CBIState(g)->notescr, i * 30, 30))
  30. continue;
  31. PrintTextFmt(LC(LANG "NOTE_FMT"), i + 1);
  32. PrintText(s_lmidfont, g->defcr, g->ox+2,1, i * 30 + g->oy,1);
  33. if(G_Button_HId(g, i, p->notes[i] ? p->notes[i] : LC(LANG "EMPTY"),
  34. 44, i * 30, .disabled = !CBIState(g)->noteedit,
  35. Pre(btnnote)))
  36. {
  37. i32 l = CBIState(g)->notebox.tbptr;
  38. cstr s = Cps_Expand(CBIState(g)->notebox.txtbuf, 0, l);
  39. Dalloc(p->notes[i]);
  40. p->notes[i] = Malloc(l + 1, _tag_plyr);
  41. fastmemmove(p->notes[i], s, l);
  42. P_Data_Save(p);
  43. }
  44. }
  45. G_ScrEnd(g, &CBIState(g)->notescr);
  46. }
  47. /* EOF */