Subversion Repositories Kolibri OS

Rev

Rev 7506 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. //Leency & SoUrcerer, LGPL
  2.  
  3. char *text1[] = {"POP server adress:", "POP server port:", "SMTP server adress:", "SMTP server port:", '\0'};
  4.  
  5. unsigned char POP_server1[128]="pop.server.com";
  6. unsigned char POP_server_port1[7]="110";
  7. unsigned char SMTP_server1[128]="smtp.server.com";
  8. unsigned char SMTP_server_port1[7]="25";
  9. edit_box POP_server_box        = {210,230,125,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(POP_server1)-2,#POP_server1,0,0};
  10. edit_box POP_server_port_box   = {210,230,160,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(POP_server_port1)-2,#POP_server_port1,0,0};
  11. edit_box SMTP_server_box       = {210,230,195,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(SMTP_server1)-2,#SMTP_server1,0,0};
  12. edit_box SMTP_server_port_box  = {210,230,230,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(SMTP_server_port1)-2,#SMTP_server_port1,0,0};
  13.  
  14. checkbox automatic = { "Automatic configuration", true };
  15.  
  16. void UpdateEditboxFlags(dword additional_flag)
  17. {
  18.         EditBox_UpdateText(#POP_server_box, additional_flag + 0);
  19.         EditBox_UpdateText(#POP_server_port_box, additional_flag + ed_figure_only + 0);
  20.         EditBox_UpdateText(#SMTP_server_box, additional_flag + 0);
  21.         EditBox_UpdateText(#SMTP_server_port_box, additional_flag + ed_figure_only + 0);
  22. }
  23.  
  24. void SettingsDialog()
  25. {
  26.         int id;
  27.         UpdateEditboxFlags(ed_disabled);
  28.         goto _OPT_WIN;
  29.         loop() switch(WaitEvent())
  30.         {
  31.                 case evMouse:
  32.                         edit_box_mouse stdcall(#POP_server_box);
  33.                         edit_box_mouse stdcall(#POP_server_port_box);
  34.                         edit_box_mouse stdcall(#SMTP_server_box);
  35.                         edit_box_mouse stdcall(#SMTP_server_port_box);
  36.                         break;
  37.                        
  38.                 case evButton:
  39.                         id = GetButtonID();
  40.                         if (id==1) SaveAndExit();
  41.                         if (id==19) LoginBoxLoop();
  42.                         if (automatic.click(id))
  43.                         {
  44.                                 if (automatic.checked) {
  45.                                         UpdateEditboxFlags(ed_disabled);
  46.                                         POP_server_box.blur_border_color = POP_server_port_box.blur_border_color =
  47.                                          SMTP_server_box.blur_border_color = SMTP_server_port_box.blur_border_color = 0xCACACA;
  48.                                 }
  49.                                 else {
  50.                                         UpdateEditboxFlags(0);
  51.                                         POP_server_box.flags = 0b10;
  52.                                         POP_server_box.blur_border_color = POP_server_port_box.blur_border_color =
  53.                                          SMTP_server_box.blur_border_color = SMTP_server_port_box.blur_border_color = 0xFFFfff;
  54.                                 }
  55.                                 DrawOptionsWindow();
  56.                         }
  57.                         break;
  58.                        
  59.                 case evKey:
  60.                         GetKeys();;
  61.  
  62.                         if (automatic.checked==true) break;
  63.                         if (key_scancode==SCAN_CODE_TAB)
  64.                         {
  65.                                 if (POP_server_box.flags & ed_focus)       { UpdateEditboxFlags(0); POP_server_port_box.flags += ed_focus;  } else
  66.                                 if (POP_server_port_box.flags & ed_focus)  { UpdateEditboxFlags(0); SMTP_server_box.flags += ed_focus;      } else
  67.                                 if (SMTP_server_box.flags & ed_focus)      { UpdateEditboxFlags(0); SMTP_server_port_box.flags += ed_focus; } else
  68.                                 if (SMTP_server_port_box.flags & ed_focus) { UpdateEditboxFlags(0); POP_server_box.flags += ed_focus;       } else
  69.                                 { UpdateEditboxFlags(0); POP_server_box.flags = 0b10; }                            
  70.                                 DrawOptionsWindow();
  71.                         }
  72.                        
  73.                         EAX=key_ascii<<8;
  74.                         edit_box_key stdcall(#POP_server_box);
  75.                         edit_box_key stdcall(#POP_server_port_box);
  76.                         edit_box_key stdcall(#SMTP_server_box);
  77.                         edit_box_key stdcall(#SMTP_server_port_box);
  78.                         break;
  79.  
  80.                 case evReDraw: _OPT_WIN:
  81.                         if !(DefineWindow(OPTIONS_HEADER)) break;
  82.                         DrawBar(0,0, Form.cwidth, Form.cheight, sc.work);
  83.                         DrawOptionsWindow();
  84.                         break;
  85.         }
  86. }
  87.  
  88. void DrawOptionsWindow()
  89. {
  90.         #define ELEM_X 25
  91.         int i;
  92.         incn y;
  93.         y.n=0;
  94.         DrawBar(0, Form.cheight - 40, Form.cwidth, 1, sc.work_graph);
  95.         DrawBar(0, Form.cheight - 40+1, Form.cwidth, 1, LBUMP);
  96.         DrawCaptButton(Form.cwidth-79, Form.cheight-32, 70, 25, 19, sc.button, sc.button_text,"Apply");
  97.  
  98.         WriteText(ELEM_X, y.inc(20), 0x81, sc.work_text, "Network settings");
  99.         automatic.draw(ELEM_X, y.inc(65));
  100.         for (i=0; i<4; i++)     {
  101.                 WriteTextWithBg(ELEM_X+40, i*35+POP_server_box.top + 3, 0xD0, sc.work_text, text1[i], sc.work);
  102.         }
  103.         DrawEditBox(#POP_server_box);
  104.         DrawEditBox(#POP_server_port_box);
  105.         DrawEditBox(#SMTP_server_box);
  106.         DrawEditBox(#SMTP_server_port_box);
  107. }