Glyphs.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. try
  46. {
  47. CopyDataModule(this, ScaledModule);
  48. // Not all these are accessed by field name, but we copy all for consistency
  49. ExplorerImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(ExplorerImages->Name)));
  50. SessionImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(SessionImages->Name)));
  51. QueueImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(QueueImages->Name)));
  52. LogImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(LogImages->Name)));
  53. ButtonImages = DebugNotNull(dynamic_cast<TImageList *>(FindComponent(ButtonImages->Name)));
  54. DialogImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(DialogImages->Name)));
  55. }
  56. __finally
  57. {
  58. delete ScaledModule;
  59. }
  60. }
  61. }
  62. //---------------------------------------------------------------------------