Licence.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Common.h>
  5. #include <TextsWin.h>
  6. #include <VCLCommon.h>
  7. #include "WinInterface.h"
  8. #include "Licence.h"
  9. #include "Tools.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma resource "*.dfm"
  13. //---------------------------------------------------------------------------
  14. AnsiString LicenceStr[2] = { "LICENCE", "LICENCE_PUTTY" };
  15. //---------------------------------------------------------------------------
  16. void __fastcall DoLicenceDialog(TLicence Licence)
  17. {
  18. TLicenceDialog *LicenceDialog = NULL;
  19. try
  20. {
  21. LicenceDialog = new TLicenceDialog(Application);
  22. LicenceDialog->Licence = Licence;
  23. LicenceDialog->ShowModal();
  24. }
  25. __finally
  26. {
  27. delete LicenceDialog;
  28. }
  29. }
  30. //---------------------------------------------------------------------------
  31. void __fastcall DoLicenceDialog(const AnsiString LicenceText)
  32. {
  33. TLicenceDialog *LicenceDialog = NULL;
  34. try
  35. {
  36. LicenceDialog = new TLicenceDialog(Application);
  37. LicenceDialog->LicenceText = LicenceText;
  38. LicenceDialog->ShowModal();
  39. }
  40. __finally
  41. {
  42. delete LicenceDialog;
  43. }
  44. }
  45. //---------------------------------------------------------------------------
  46. __fastcall TLicenceDialog::TLicenceDialog(TComponent* Owner)
  47. : TForm(Owner)
  48. {
  49. FLicence = lcNoLicence;
  50. UseSystemSettings(this);
  51. }
  52. //---------------------------------------------------------------------------
  53. void __fastcall TLicenceDialog::SetLicence(TLicence value)
  54. {
  55. if (FLicence != value)
  56. {
  57. FLicence = value;
  58. TStrings * LicenceList = new TStringList();
  59. try
  60. {
  61. LicenceList->Text = ReadResource(LicenceStr[FLicence]);
  62. assert(LicenceList->Count > 0);
  63. Caption = FMTLOAD(LICENCE_CAPTION, (LicenceList->Strings[0]));
  64. LicenceList->Delete(0);
  65. LicenceText = LicenceList->Text;
  66. }
  67. __finally
  68. {
  69. delete LicenceList;
  70. }
  71. }
  72. }
  73. //---------------------------------------------------------------------------
  74. void __fastcall TLicenceDialog::SetLicenceText(AnsiString value)
  75. {
  76. LicenceMemo->Lines->Text = value;
  77. }
  78. //---------------------------------------------------------------------------
  79. AnsiString __fastcall TLicenceDialog::GetLicenceText()
  80. {
  81. return LicenceMemo->Lines->Text;
  82. }