Subversion Repositories Kolibri OS

Rev

Rev 6176 | Rev 6264 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #define MEMSIZE 0x2EE80
  2.  
  3. #include "../lib/font.h"
  4. #include "../lib/gui.h"
  5.  
  6. #define PANELH 30
  7.  
  8. void main()
  9. {  
  10.         proc_info Form;
  11.         int i, y, btn;
  12.         char line[256], title[4196];
  13.         if (!param) strcpy(#param, DEFAULT_FONT);
  14.         label.init(#param);
  15.         strcpy(#title, "Font preview: ");
  16.         strcat(#title, #param);
  17.         loop()
  18.         {
  19.           switch(WaitEvent())
  20.       {
  21.                 case evButton:
  22.                         btn = GetButtonID();
  23.                         if (btn==1) ExitProcess();
  24.                         if (btn==2) label.bold ^=1;
  25.                         if (btn==3) label.italic ^=1;
  26.                         if (btn==4) label.smooth ^=1;
  27.                         goto _DRAW_WINDOW_CONTENT;
  28.                 case evReDraw:
  29.                         system.color.get();
  30.                         DefineAndDrawWindow(215,100,500,320,0x74,0xFFFFFF,#title);
  31.                         GetProcessInfo(#Form, SelfInfo);
  32.                         if (Form.status_window>2) break;
  33.                         _DRAW_WINDOW_CONTENT:
  34.                         DrawBar(0, 0, Form.cwidth, PANELH, system.color.work);
  35.                         CheckBox(10, 8, 2, "Bold",  label.bold);
  36.                         CheckBox(83, 8, 3, "Italic",  label.italic);
  37.                         CheckBox(170, 8, 4, "Smooth",  label.smooth);
  38.                         label.raw_size = free(label.raw);
  39.                         if (!label.font)
  40.                         {
  41.                                 DrawBar(0, PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff);
  42.                                 WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded.");
  43.                         }
  44.                         else for (i=10, y=5; i<22; i++, y+=label.height;) //not flexible, need to calculate font count and max line length
  45.                         {
  46.                                 sprintf(#line," §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i);
  47.                                 label.write_buf(10,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, i, #line);
  48.                         }
  49.                         if (label.smooth) label.apply_smooth();
  50.                         label.show_buf(0, PANELH);
  51.           }
  52.         }
  53. }
  54.