Glyphs.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Global.h"
  5. #include "Glyphs.h"
  6. #include "Glyphs120.h"
  7. #include "Glyphs144.h"
  8. #include "Glyphs192.h"
  9. #include "GUITools.h"
  10. //---------------------------------------------------------------------------
  11. #pragma package(smart_init)
  12. #pragma link "PngImageList"
  13. #ifndef NO_RESOURCES
  14. #pragma resource "*.dfm"
  15. #endif
  16. //---------------------------------------------------------------------------
  17. TGlyphsModule * GlyphsModule;
  18. //---------------------------------------------------------------------------
  19. __fastcall TGlyphsModule::TGlyphsModule(TComponent* Owner)
  20. : TDataModule(Owner)
  21. {
  22. int PixelsPerInch = Screen->PixelsPerInch;
  23. TDataModule * ScaledModule;
  24. if (PixelsPerInch >= 192)
  25. {
  26. ScaledModule = new TGlyphs192Module(Application);
  27. }
  28. else if (PixelsPerInch >= 144)
  29. {
  30. ScaledModule = new TGlyphs144Module(Application);
  31. }
  32. else if (PixelsPerInch >= 120)
  33. {
  34. ScaledModule = new TGlyphs120Module(Application);
  35. }
  36. else
  37. {
  38. // Do not have a separate 96 DPI module, as this module needs to
  39. // have the images loaded as they are used on design time.
  40. // Performace impact of loading 96 DPI images when they are not needed is not that big.
  41. ScaledModule = NULL;
  42. }
  43. if (ScaledModule != NULL)
  44. {
  45. CopyDataModule(this, ScaledModule);
  46. // Not all these are accessed by field name, but we copy all for consistency
  47. ExplorerImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(ExplorerImages->Name)));
  48. SessionImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(SessionImages->Name)));
  49. QueueImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(QueueImages->Name)));
  50. LogImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(LogImages->Name)));
  51. ButtonImages = NOT_NULL(dynamic_cast<TImageList *>(FindComponent(ButtonImages->Name)));
  52. DialogImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(DialogImages->Name)));
  53. }
  54. }
  55. //---------------------------------------------------------------------------