diff --git a/uppsrc/CodeEditor/CodeEditor.h b/uppsrc/CodeEditor/CodeEditor.h index 4ace46e56..9c777bb52 100644 --- a/uppsrc/CodeEditor/CodeEditor.h +++ b/uppsrc/CodeEditor/CodeEditor.h @@ -525,6 +525,8 @@ public: String ReadList(WithDropChoice& e); void WriteList(WithDropChoice& e, const String& data); +INITIALIZE(RegisterSyntax) + } #endif diff --git a/uppsrc/CodeEditor/CodeEditor.upp b/uppsrc/CodeEditor/CodeEditor.upp index 3c8633156..019671db5 100644 --- a/uppsrc/CodeEditor/CodeEditor.upp +++ b/uppsrc/CodeEditor/CodeEditor.upp @@ -19,7 +19,7 @@ file CInit.cpp, CHighlight.cpp, CLogic.cpp, - CRegister.icpp, + RegisterSyntax.cpp, DiffSyntax readonly separator, DiffSyntax.h, DiffSyntax.cpp, diff --git a/uppsrc/CodeEditor/CRegister.icpp b/uppsrc/CodeEditor/RegisterSyntax.cpp similarity index 96% rename from uppsrc/CodeEditor/CRegister.icpp rename to uppsrc/CodeEditor/RegisterSyntax.cpp index 10c8f269f..f0862f8b9 100644 --- a/uppsrc/CodeEditor/CRegister.icpp +++ b/uppsrc/CodeEditor/RegisterSyntax.cpp @@ -33,7 +33,7 @@ void CreateLogSyntax(One& e) e.Create(); } -INITBLOCK +INITIALIZER(RegisterSyntax) { RegisterCSyntax("cpp", CSyntax::HIGHLIGHT_CPP, "*.c *.cpp *.cc *.cxx *.h *.hpp *.hh *.hxx *.m *.mm *.icpp *.conf", diff --git a/uppsrc/Core/Core_init.icpp b/uppsrc/Core/Core_init.icpp deleted file mode 100644 index 5b7f53fd3..000000000 --- a/uppsrc/Core/Core_init.icpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "Core.h" - -#define TFILE -#include diff --git a/uppsrc/Core/SSL/Init.icpp b/uppsrc/Core/SSL/Init.icpp new file mode 100644 index 000000000..80060ca85 --- /dev/null +++ b/uppsrc/Core/SSL/Init.icpp @@ -0,0 +1 @@ +#include "SSL.h" diff --git a/uppsrc/Core/SSL/InitExit.icpp b/uppsrc/Core/SSL/InitExit.cpp similarity index 94% rename from uppsrc/Core/SSL/InitExit.icpp rename to uppsrc/Core/SSL/InitExit.cpp index 5c6b5dd35..c0aa61cf4 100644 --- a/uppsrc/Core/SSL/InitExit.icpp +++ b/uppsrc/Core/SSL/InitExit.cpp @@ -53,7 +53,7 @@ static void *SslRealloc(void *ptr, size_t size) void TcpSocketInit(); -INITBLOCK +INITIALIZER(SSL) { LLOG("SSL init"); TcpSocketInit(); diff --git a/uppsrc/Core/SSL/P7S.icpp b/uppsrc/Core/SSL/P7S.cpp similarity index 93% rename from uppsrc/Core/SSL/P7S.icpp rename to uppsrc/Core/SSL/P7S.cpp index eba588a9d..1811f60e0 100644 --- a/uppsrc/Core/SSL/P7S.icpp +++ b/uppsrc/Core/SSL/P7S.cpp @@ -37,7 +37,8 @@ String GetP7Signature_imp(const void *data, int length, const String& cert_pem, extern String (*GetP7Signature__)(const void *data, int length, const String& cert_pem, const String& pkey_pem); -INITBLOCK { +INITIALIZER(P7S) +{ GetP7Signature__ = GetP7Signature_imp; } diff --git a/uppsrc/Core/SSL/SSL.h b/uppsrc/Core/SSL/SSL.h index 144e91de1..e4a355e36 100644 --- a/uppsrc/Core/SSL/SSL.h +++ b/uppsrc/Core/SSL/SSL.h @@ -6,6 +6,10 @@ #include namespace Upp { + +INITIALIZE(SSL); +INITIALIZE(SSLSocket); +INITIALIZE(P7S); void SslInitThread(); diff --git a/uppsrc/Core/SSL/SSL.upp b/uppsrc/Core/SSL/SSL.upp index 954bf0a1d..e840fbdd9 100644 --- a/uppsrc/Core/SSL/SSL.upp +++ b/uppsrc/Core/SSL/SSL.upp @@ -19,7 +19,8 @@ link(WIN32 MSC SO) /nodefaultlib:libc; file SSL.h, Util.cpp, - InitExit.icpp, - Socket.icpp, - P7S.icpp; + InitExit.cpp, + Socket.cpp, + P7S.cpp, + Init.icpp; diff --git a/uppsrc/Core/SSL/Socket.icpp b/uppsrc/Core/SSL/Socket.cpp similarity index 95% rename from uppsrc/Core/SSL/Socket.icpp rename to uppsrc/Core/SSL/Socket.cpp index fa312472b..99d3e6fe5 100644 --- a/uppsrc/Core/SSL/Socket.icpp +++ b/uppsrc/Core/SSL/Socket.cpp @@ -37,7 +37,7 @@ void InitCreateSSL() TcpSocket::CreateSSL = TcpSocket::CreateSSLImp; } -INITBLOCK { +INITIALIZER(SSLSocket) { InitCreateSSL(); } diff --git a/uppsrc/CtrlCore/CtrlCore.h b/uppsrc/CtrlCore/CtrlCore.h index 12cd7b4d5..b2582fc92 100644 --- a/uppsrc/CtrlCore/CtrlCore.h +++ b/uppsrc/CtrlCore/CtrlCore.h @@ -38,6 +38,8 @@ namespace Upp { +INITIALIZE(CtrlCore) + #ifdef _MULTITHREADED void EnterGuiMutex(); void LeaveGuiMutex(); diff --git a/uppsrc/CtrlCore/CtrlCore.upp b/uppsrc/CtrlCore/CtrlCore.upp index 33c646190..4bba8c44d 100644 --- a/uppsrc/CtrlCore/CtrlCore.upp +++ b/uppsrc/CtrlCore/CtrlCore.upp @@ -50,7 +50,7 @@ file CtrlTimer.cpp, CtrlClip.cpp, LocalLoop.cpp, - CtrlCore.icpp, + CtrlCoreInit.cpp, TopWindow.h, TopWindow.cpp, lay.h, diff --git a/uppsrc/CtrlCore/CtrlCore.icpp b/uppsrc/CtrlCore/CtrlCoreInit.cpp similarity index 90% rename from uppsrc/CtrlCore/CtrlCore.icpp rename to uppsrc/CtrlCore/CtrlCoreInit.cpp index e267ac89c..f88dc17fd 100644 --- a/uppsrc/CtrlCore/CtrlCore.icpp +++ b/uppsrc/CtrlCore/CtrlCoreInit.cpp @@ -1,22 +1,22 @@ -#include "CtrlCore.h" - -namespace Upp { - -#define TFILE -#include - -static Image sRenderGlyph(int cx, int x, Font font, int chr, int py, int pcy) -{ - ImageDraw iw(cx, pcy); - iw.DrawRect(0, 0, cx, pcy, White); - iw.DrawText(x, -py, WString(chr, 1), font, Black); - return iw; -} - -void SetRenderGlyph(Image (*f)(int cx, int x, Font font, int chr, int py, int pcy)); - -INITBLOCK { - SetRenderGlyph(sRenderGlyph); -} - -} +#include "CtrlCore.h" + +namespace Upp { + +#define TFILE +#include + +static Image sRenderGlyph(int cx, int x, Font font, int chr, int py, int pcy) +{ + ImageDraw iw(cx, pcy); + iw.DrawRect(0, 0, cx, pcy, White); + iw.DrawText(x, -py, WString(chr, 1), font, Black); + return iw; +} + +void SetRenderGlyph(Image (*f)(int cx, int x, Font font, int chr, int py, int pcy)); + +INITIALIZER(CtrlCore) { + SetRenderGlyph(sRenderGlyph); +} + +} diff --git a/uppsrc/CtrlLib/CtrlLib.h b/uppsrc/CtrlLib/CtrlLib.h index a1c0f88f7..8741fcacc 100644 --- a/uppsrc/CtrlLib/CtrlLib.h +++ b/uppsrc/CtrlLib/CtrlLib.h @@ -9,6 +9,8 @@ namespace Upp { +INITIALIZE(CtrlLib); + #define IMAGECLASS CtrlImg #define IMAGEFILE #include diff --git a/uppsrc/CtrlLib/CtrlLib.upp b/uppsrc/CtrlLib/CtrlLib.upp index ba00b688b..a0391fcaa 100644 --- a/uppsrc/CtrlLib/CtrlLib.upp +++ b/uppsrc/CtrlLib/CtrlLib.upp @@ -99,7 +99,7 @@ file Ctrl.iml, Ctrl.lay, CtrlLib.t charset "UTF-8", - CtrlLib.icpp, + CtrlLibInit.cpp, Lang readonly separator, Lang.h, LNGCtrl.cpp, diff --git a/uppsrc/CtrlLib/CtrlLib.icpp b/uppsrc/CtrlLib/CtrlLibInit.cpp similarity index 88% rename from uppsrc/CtrlLib/CtrlLib.icpp rename to uppsrc/CtrlLib/CtrlLibInit.cpp index fd32a1adf..ebe3fedaf 100644 --- a/uppsrc/CtrlLib/CtrlLib.icpp +++ b/uppsrc/CtrlLib/CtrlLibInit.cpp @@ -1,20 +1,18 @@ -#include "CtrlLib.h" - -namespace Upp { - -#define TFILE -#include - -void CtrlSetDefaultSkin(void (*fn1)(), void (*fn2)()); - -#if defined(GUI_WIN) || defined(PLATFORM_X11) -INITBLOCK { - CtrlSetDefaultSkin(ChStdSkin, ChHostSkin); -}; -#else -INITBLOCK { - CtrlSetDefaultSkin(ChStdSkin, ChStdSkin); -}; -#endif - -} +#include "CtrlLib.h" + +namespace Upp { + +#define TFILE +#include + +void CtrlSetDefaultSkin(void (*fn1)(), void (*fn2)()); + +INITIALIZER(CtrlLib) { +#if defined(GUI_WIN) || defined(PLATFORM_X11) + CtrlSetDefaultSkin(ChStdSkin, ChHostSkin); +#else + CtrlSetDefaultSkin(ChStdSkin, ChStdSkin); +#endif +}; + +} diff --git a/uppsrc/Oracle/OciCommon.h b/uppsrc/Oracle/OciCommon.h index 0433222b2..7ee7444ce 100644 --- a/uppsrc/Oracle/OciCommon.h +++ b/uppsrc/Oracle/OciCommon.h @@ -292,4 +292,6 @@ typedef sb4 (*OCICallbackOutBind)(dvoid *octxp, UPP::OCIBind *bindp, ub4 iter, ub1 *piecep, dvoid **indp, ub2 **rcodep); +INITIALIZE(Oracle) + #endif//__Oracle_OciCommon__ diff --git a/uppsrc/Oracle/Oracle.upp b/uppsrc/Oracle/Oracle.upp index 16c53659f..22cb87f31 100644 --- a/uppsrc/Oracle/Oracle.upp +++ b/uppsrc/Oracle/Oracle.upp @@ -8,7 +8,7 @@ link(SOLARIS SPARC) "-Wl,-R -Wl,/usr/local/bin"; file OciCommon.h, Oracle.t charset "UTF-8", - Oracle_init.icpp, + Oracle_init.cpp, OracleSchema.h, OraCommon.h, OraCommon.cpp, diff --git a/uppsrc/Oracle/Oracle_init.icpp b/uppsrc/Oracle/Oracle_init.cpp similarity index 75% rename from uppsrc/Oracle/Oracle_init.icpp rename to uppsrc/Oracle/Oracle_init.cpp index 187d2e562..f15844802 100644 --- a/uppsrc/Oracle/Oracle_init.icpp +++ b/uppsrc/Oracle/Oracle_init.cpp @@ -1,8 +1,10 @@ -#include - -namespace Upp { - -#define TFILE -#include - -} +#include + +namespace Upp { + +#define TFILE +#include + +INITIALIZER(Oracle) + +} diff --git a/uppsrc/Painter/PaintPainting.icpp b/uppsrc/Painter/PaintPainting.cpp similarity index 94% rename from uppsrc/Painter/PaintPainting.icpp rename to uppsrc/Painter/PaintPainting.cpp index fcb550396..d754e8a64 100644 --- a/uppsrc/Painter/PaintPainting.icpp +++ b/uppsrc/Painter/PaintPainting.cpp @@ -320,7 +320,7 @@ static Image sRenderGlyph(Point at, int angle, int chr, Font fnt, Color color, S return ib; } -INITBLOCK +INITIALIZER(PaintPainting) { RegisterPaintingFns__(PaintImageBufferPaintingFn, PaintImageBufferDrawingFn, sRenderGlyph); ImageAnyDrawPainter(sCP, sEP); diff --git a/uppsrc/Painter/Painter.h b/uppsrc/Painter/Painter.h index 19834b91d..0d5cc12b1 100644 --- a/uppsrc/Painter/Painter.h +++ b/uppsrc/Painter/Painter.h @@ -7,6 +7,8 @@ namespace Upp { +INITIALIZE(PaintPainting) + struct Xform2D { Pointf x, y, t; diff --git a/uppsrc/Painter/Painter.upp b/uppsrc/Painter/Painter.upp index 7f9b4f24a..ea19b0a8a 100644 --- a/uppsrc/Painter/Painter.upp +++ b/uppsrc/Painter/Painter.upp @@ -12,7 +12,8 @@ file DrawOp.cpp, Painting.h, Painting.cpp, - PaintPainting.icpp, + PaintPainting.cpp, + PainterInit.icpp, BufferPainter.h, Xform2D.cpp, Approximate.cpp, diff --git a/uppsrc/Painter/PainterInit.icpp b/uppsrc/Painter/PainterInit.icpp new file mode 100644 index 000000000..cc7c4c518 --- /dev/null +++ b/uppsrc/Painter/PainterInit.icpp @@ -0,0 +1 @@ +#include "Painter.h" diff --git a/uppsrc/PdfDraw/PdfDraw.h b/uppsrc/PdfDraw/PdfDraw.h index 354009a4e..f36a64ecc 100644 --- a/uppsrc/PdfDraw/PdfDraw.h +++ b/uppsrc/PdfDraw/PdfDraw.h @@ -7,6 +7,8 @@ namespace Upp { +INITIALIZE(PdfDraw); + class TTFReader { struct TTFStream { struct Fail {}; diff --git a/uppsrc/PdfDraw/PdfDraw.upp b/uppsrc/PdfDraw/PdfDraw.upp index 5a351737a..89e32929a 100644 --- a/uppsrc/PdfDraw/PdfDraw.upp +++ b/uppsrc/PdfDraw/PdfDraw.upp @@ -11,7 +11,8 @@ file TTFSubset.cpp, ICCColorSpace.i, PdfDraw.cpp, - PdfReport.icpp, + PdfReport.cpp, + PdfInit.icpp, Info readonly separator, Copying; diff --git a/uppsrc/PdfDraw/PdfInit.icpp b/uppsrc/PdfDraw/PdfInit.icpp new file mode 100644 index 000000000..ca3cc8ff9 --- /dev/null +++ b/uppsrc/PdfDraw/PdfInit.icpp @@ -0,0 +1,2 @@ +#include "PdfDraw.h" + diff --git a/uppsrc/PdfDraw/PdfReport.icpp b/uppsrc/PdfDraw/PdfReport.cpp similarity index 90% rename from uppsrc/PdfDraw/PdfReport.icpp rename to uppsrc/PdfDraw/PdfReport.cpp index 0b71e83c3..51ed030ed 100644 --- a/uppsrc/PdfDraw/PdfReport.icpp +++ b/uppsrc/PdfDraw/PdfReport.cpp @@ -14,7 +14,7 @@ String Pdf(const Array& report, Size sz, int margin, bool pdfa, return w.Finish(sign); } -INITBLOCK +INITIALIZER(PdfDraw) { SetDrawingToPdfFn(Pdf); } diff --git a/uppsrc/Report/Report.upp b/uppsrc/Report/Report.upp index 9d71de976..be7d43b3b 100644 --- a/uppsrc/Report/Report.upp +++ b/uppsrc/Report/Report.upp @@ -8,7 +8,6 @@ file Report.h options(BUILDER_OPTION) PCH, Report.cpp, ReportDlg.cpp, - ReportI.icpp, Report.lay, Report.t charset "UTF-8", srcdoc.tpp; diff --git a/uppsrc/Report/ReportDlg.cpp b/uppsrc/Report/ReportDlg.cpp index c0198c449..abf3c7487 100644 --- a/uppsrc/Report/ReportDlg.cpp +++ b/uppsrc/Report/ReportDlg.cpp @@ -4,6 +4,9 @@ namespace Upp { #define LLOG(x) // LOG(x) +#define TFILE +#include + void Print(Report& r, PrinterJob& pd) { Draw& w = pd; diff --git a/uppsrc/Report/ReportI.icpp b/uppsrc/Report/ReportI.icpp deleted file mode 100644 index 639cb2bb7..000000000 --- a/uppsrc/Report/ReportI.icpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "Report.h" - -namespace Upp { - -#define TFILE -#include - -} diff --git a/uppsrc/RichEdit/Editor.cpp b/uppsrc/RichEdit/Editor.cpp index a8407a665..3b5c7b460 100644 --- a/uppsrc/RichEdit/Editor.cpp +++ b/uppsrc/RichEdit/Editor.cpp @@ -2,6 +2,9 @@ namespace Upp { +#define TFILE +#include + bool FontHeight::Key(dword key, int count) { if(key == K_ENTER) { diff --git a/uppsrc/RichEdit/RichEdit.icpp b/uppsrc/RichEdit/RichEdit.icpp deleted file mode 100644 index afeee889f..000000000 --- a/uppsrc/RichEdit/RichEdit.icpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "RichEdit.h" - -namespace Upp { - -#define TFILE -#include - -} diff --git a/uppsrc/RichEdit/RichEdit.upp b/uppsrc/RichEdit/RichEdit.upp index 257a735c3..a4c196cf8 100644 --- a/uppsrc/RichEdit/RichEdit.upp +++ b/uppsrc/RichEdit/RichEdit.upp @@ -25,7 +25,6 @@ file StyleKeys.cpp, HeaderFooter.cpp, RichEdit.t charset "UTF-8", - RichEdit.icpp, RichEdit.lay, RichEdit.iml, Info readonly separator, diff --git a/uppsrc/RichText/RichImage.icpp b/uppsrc/RichText/RichImage.cpp similarity index 95% rename from uppsrc/RichText/RichImage.icpp rename to uppsrc/RichText/RichImage.cpp index c38eac693..cb4677b84 100644 --- a/uppsrc/RichText/RichImage.icpp +++ b/uppsrc/RichText/RichImage.cpp @@ -1,316 +1,318 @@ -#include "RichText.h" - -namespace Upp { - -#ifdef NEWIMAGE - -struct RichImage : public RichObjectType { - virtual String GetTypeName(const Value& v) const; - virtual Size GetPhysicalSize(const Value& data) const; - virtual Size GetPixelSize(const Value& data) const; - virtual void Paint(const Value& data, Draw& w, Size sz, void *) const; - virtual Image ToImage(const Value& data, Size sz, void *) const; - - virtual bool Accept(PasteClip& clip); - virtual Value Read(PasteClip& clip); - virtual String GetClipFmts() const; - virtual String GetClip(const Value& data, const String& fmt) const; - - typedef RichImage CLASSNAME; -}; - -String RichImage::GetTypeName(const Value& v) const -{ - return "image"; -} - -static String (*sGetImageClip)(const Image& img, const String& fmt); -static bool (*sAcceptImage)(PasteClip& clip); -static Image (*sGetImage)(PasteClip& clip); -static const char *(*sClipFmtsImage)(); - -void InitRichImage(String (*fGetImageClip)(const Image& img, const String& fmt), - bool (*fAcceptImage)(PasteClip& clip), - Image (*fGetImage)(PasteClip& clip), - const char *(*fClipFmtsImage)()) -{ - sGetImageClip = fGetImageClip; - sAcceptImage = fAcceptImage; - sGetImage = fGetImage; - sClipFmtsImage = fClipFmtsImage; -} - -bool RichImage::Accept(PasteClip& clip) -{ - return sAcceptImage ? sAcceptImage(clip) : false; -} - -Value RichImage::Read(PasteClip& clip) -{ - if(sGetImage) - return StoreImageAsString(sGetImage(clip)); - return Null; -} - -String RichImage::GetClipFmts() const -{ - if(sClipFmtsImage) - return sClipFmtsImage(); - return Null; -} - -String RichImage::GetClip(const Value& data, const String& fmt) const -{ - if(sGetImageClip) - return sGetImageClip(LoadImageFromString(data), fmt); - return Null; -} - -Size RichImage::GetPixelSize(const Value& data) const -{ - return GetImageStringSize(data); -} - -Size RichImage::GetPhysicalSize(const Value& data) const -{ - Size sz = GetImageStringDots(data); - if(sz.cx == 0 || sz.cy == 0) - sz = 600 * GetPixelSize(data) / 96; - return sz; -} - -void RichImage::Paint(const Value& data, Draw& w, Size sz, void *) const -{ - Image x = LoadImageFromString(data); -// Size outsz(min(sz.cx, 4 * x.GetWidth()), min(sz.cy, 4 * x.GetHeight())); - w.DrawImage(0, 0, sz.cx, sz.cy, x); -} - -Image RichImage::ToImage(const Value& data, Size sz, void *) const -{ - return Rescale(LoadImageFromString(data), sz); -} - -INITBLOCK { - RichObject::Register("image", &Single()); -}; - -RichObject CreateImageObject(const Image& img, int cx, int cy) -{ - RichObject o = RichObject("image", StoreImageAsString(img)); - if(cx || cy) - o.SetSize(GetRatioSize(o.GetPixelSize(), cx, cy)); - return o; -} - -struct RichPNG : public RichObjectType { - virtual String GetTypeName(const Value& v) const; - virtual Value Read(const String& s) const; - virtual String Write(const Value& v) const; - virtual Size GetPhysicalSize(const Value& data) const; - virtual Size GetPixelSize(const Value& data) const; - virtual void Paint(const Value& data, Draw& w, Size sz) const; - virtual Image ToImage(const Value& data, Size sz, void *) const; -}; - -String RichPNG::GetTypeName(const Value& v) const -{ - return IsString(v) ? "PNG" : "image"; -} - -Value RichPNG::Read(const String& s) const -{ - Image img = StreamRaster::LoadStringAny(s); - if(img) - return img; - return s; -} - -String RichPNG::Write(const Value& v) const -{ - if(IsString(v)) - return v; - return StoreImageAsString(v); -} - -Size RichPNG::GetPhysicalSize(const Value& data) const -{ - if(IsString(data)) - return Size(0, 0); - return Image(data).GetDots(); -} - -Size RichPNG::GetPixelSize(const Value& data) const -{ - if(IsString(data)) - return Size(0, 0); - return Image(data).GetDots(); -} - -void RichPNG::Paint(const Value& data, Draw& w, Size sz) const -{ - if(IsString(data)) { - w.DrawRect(sz, SColorFace()); - DrawFrame(w, sz, SColorText()); - w.DrawText(2, 2, "plugin/png missing!"); - return; - } - Image x = Image(data); - Size outsz(min(sz.cx, 4 * x.GetWidth()), min(sz.cy, 4 * x.GetHeight())); - w.DrawImage(0, 0, outsz.cx, outsz.cy, x); -} - -Image RichPNG::ToImage(const Value& data, Size sz, void *) const -{ - if(IsString(data)) { - ImageAnyDraw iw(sz); - Paint(data, iw, sz); - return iw; - } - Image x = Image(data); - Size outsz(min(sz.cx, 4 * x.GetWidth()), min(sz.cy, 4 * x.GetHeight())); - return Rescale(x, outsz); -} - -INITBLOCK { - RichObject::Register("PNG", &Single()); -}; - -struct RichRawImage : public RichObjectType { - virtual String GetTypeName(const Value& v) const; - virtual Value Read(const String& s) const; - virtual String Write(const Value& v) const; - virtual Size GetPhysicalSize(const Value& data) const; - virtual Size GetPixelSize(const Value& data) const; - virtual void Paint(const Value& data, Draw& w, Size sz, void *) const; - virtual Image ToImage(const Value& data, Size sz, void *) const; -}; - -String RichRawImage::GetTypeName(const Value& v) const -{ - return "rawimage"; -} - -Value RichRawImage::Read(const String& s) const -{ - return s; -} - -String RichRawImage::Write(const Value& v) const -{ - return v; -} - -Size RichRawImage::GetPhysicalSize(const Value& data) const -{ - String s = data; - StringStream ss(s); - One r = StreamRaster::OpenAny(ss); - if(r) - return r->GetInfo().dots; - return Size(0, 0); -} - -Size RichRawImage::GetPixelSize(const Value& data) const -{ - String s = data; - StringStream ss(s); - One r = StreamRaster::OpenAny(ss); - if(r) - return r->GetSize(); - return Size(0, 0); -} - -void RichRawImage::Paint(const Value& data, Draw& w, Size sz, void *) const -{ - String s = data; - StringStream ss(s); - One r = StreamRaster::OpenAny(ss); - if(r) { - Size isz = r->GetSize(); - if(isz.cx * isz.cy > sz.cx * sz.cy) { // conserve memory by scaling down from source - ImageEncoder m; - Rescale(m, sz, *r, r->GetSize()); - w.DrawImage(0, 0, sz.cx, sz.cy, m); - } - else - w.DrawImage(0, 0, sz.cx, sz.cy, r->GetImage()); // scale up by Draw to give e.g. PDF chance to store unscaled - } -} - -Image RichRawImage::ToImage(const Value& data, Size sz, void *) const -{ - String s = data; - StringStream ss(s); - One r = StreamRaster::OpenAny(ss); - if(r) { - Image x = r->GetImage(); - return Rescale(x, sz); - } - return Null; -} - -INITBLOCK { - RichObject::Register("rawimage", &Single()); -}; - -RichObject CreateRawImageObject(const String& s, int cx, int cy) -{ - RichObject o = RichObject("rawimage", s); - o.InitSize(cx, cy); - return o; -} - -struct RichImlImage : public RichObjectType { - virtual String GetTypeName(const Value& v) const; - virtual Size GetPhysicalSize(const Value& data) const; - virtual Size GetPixelSize(const Value& data) const; - virtual void Paint(const Value& data, Draw& w, Size sz) const; - virtual Image ToImage(const Value& data, Size sz, void *) const; - virtual bool IsText() const; - - Image Get(const Value& v) const; -}; - -Image RichImlImage::Get(const Value& v) const -{ - return GetImlImage((String)v); -} - -String RichImlImage::GetTypeName(const Value& v) const -{ - return "iml"; -} - -bool RichImlImage::IsText() const -{ - return true; -} - -Size RichImlImage::GetPhysicalSize(const Value& data) const -{ - return Get(data).GetSize(); -} - -Size RichImlImage::GetPixelSize(const Value& data) const -{ - return Get(data).GetSize(); -} - -void RichImlImage::Paint(const Value& data, Draw& w, Size sz) const -{ - w.DrawImage(0, 0, sz.cx, sz.cy, Get(data)); -} - -Image RichImlImage::ToImage(const Value& data, Size sz, void *) const -{ - return Rescale(Get(data), sz); -} - -INITBLOCK { - RichObject::Register("iml", &Single()); -}; - -#endif - -} +#include "RichText.h" + +namespace Upp { + +#ifdef NEWIMAGE + +struct RichImage : public RichObjectType { + virtual String GetTypeName(const Value& v) const; + virtual Size GetPhysicalSize(const Value& data) const; + virtual Size GetPixelSize(const Value& data) const; + virtual void Paint(const Value& data, Draw& w, Size sz, void *) const; + virtual Image ToImage(const Value& data, Size sz, void *) const; + + virtual bool Accept(PasteClip& clip); + virtual Value Read(PasteClip& clip); + virtual String GetClipFmts() const; + virtual String GetClip(const Value& data, const String& fmt) const; + + typedef RichImage CLASSNAME; +}; + +String RichImage::GetTypeName(const Value& v) const +{ + return "image"; +} + +static String (*sGetImageClip)(const Image& img, const String& fmt); +static bool (*sAcceptImage)(PasteClip& clip); +static Image (*sGetImage)(PasteClip& clip); +static const char *(*sClipFmtsImage)(); + +void InitRichImage(String (*fGetImageClip)(const Image& img, const String& fmt), + bool (*fAcceptImage)(PasteClip& clip), + Image (*fGetImage)(PasteClip& clip), + const char *(*fClipFmtsImage)()) +{ + sGetImageClip = fGetImageClip; + sAcceptImage = fAcceptImage; + sGetImage = fGetImage; + sClipFmtsImage = fClipFmtsImage; +} + +bool RichImage::Accept(PasteClip& clip) +{ + return sAcceptImage ? sAcceptImage(clip) : false; +} + +Value RichImage::Read(PasteClip& clip) +{ + if(sGetImage) + return StoreImageAsString(sGetImage(clip)); + return Null; +} + +String RichImage::GetClipFmts() const +{ + if(sClipFmtsImage) + return sClipFmtsImage(); + return Null; +} + +String RichImage::GetClip(const Value& data, const String& fmt) const +{ + if(sGetImageClip) + return sGetImageClip(LoadImageFromString(data), fmt); + return Null; +} + +Size RichImage::GetPixelSize(const Value& data) const +{ + return GetImageStringSize(data); +} + +Size RichImage::GetPhysicalSize(const Value& data) const +{ + Size sz = GetImageStringDots(data); + if(sz.cx == 0 || sz.cy == 0) + sz = 600 * GetPixelSize(data) / 96; + return sz; +} + +void RichImage::Paint(const Value& data, Draw& w, Size sz, void *) const +{ + Image x = LoadImageFromString(data); +// Size outsz(min(sz.cx, 4 * x.GetWidth()), min(sz.cy, 4 * x.GetHeight())); + w.DrawImage(0, 0, sz.cx, sz.cy, x); +} + +Image RichImage::ToImage(const Value& data, Size sz, void *) const +{ + return Rescale(LoadImageFromString(data), sz); +} + +INITBLOCK { + RichObject::Register("image", &Single()); +}; + +RichObject CreateImageObject(const Image& img, int cx, int cy) +{ + RichObject o = RichObject("image", StoreImageAsString(img)); + if(cx || cy) + o.SetSize(GetRatioSize(o.GetPixelSize(), cx, cy)); + return o; +} + +struct RichPNG : public RichObjectType { + virtual String GetTypeName(const Value& v) const; + virtual Value Read(const String& s) const; + virtual String Write(const Value& v) const; + virtual Size GetPhysicalSize(const Value& data) const; + virtual Size GetPixelSize(const Value& data) const; + virtual void Paint(const Value& data, Draw& w, Size sz) const; + virtual Image ToImage(const Value& data, Size sz, void *) const; +}; + +String RichPNG::GetTypeName(const Value& v) const +{ + return IsString(v) ? "PNG" : "image"; +} + +Value RichPNG::Read(const String& s) const +{ + Image img = StreamRaster::LoadStringAny(s); + if(img) + return img; + return s; +} + +String RichPNG::Write(const Value& v) const +{ + if(IsString(v)) + return v; + return StoreImageAsString(v); +} + +Size RichPNG::GetPhysicalSize(const Value& data) const +{ + if(IsString(data)) + return Size(0, 0); + return Image(data).GetDots(); +} + +Size RichPNG::GetPixelSize(const Value& data) const +{ + if(IsString(data)) + return Size(0, 0); + return Image(data).GetDots(); +} + +void RichPNG::Paint(const Value& data, Draw& w, Size sz) const +{ + if(IsString(data)) { + w.DrawRect(sz, SColorFace()); + DrawFrame(w, sz, SColorText()); + w.DrawText(2, 2, "plugin/png missing!"); + return; + } + Image x = Image(data); + Size outsz(min(sz.cx, 4 * x.GetWidth()), min(sz.cy, 4 * x.GetHeight())); + w.DrawImage(0, 0, outsz.cx, outsz.cy, x); +} + +Image RichPNG::ToImage(const Value& data, Size sz, void *) const +{ + if(IsString(data)) { + ImageAnyDraw iw(sz); + Paint(data, iw, sz); + return iw; + } + Image x = Image(data); + Size outsz(min(sz.cx, 4 * x.GetWidth()), min(sz.cy, 4 * x.GetHeight())); + return Rescale(x, outsz); +} + +INITBLOCK { + RichObject::Register("PNG", &Single()); +}; + +struct RichRawImage : public RichObjectType { + virtual String GetTypeName(const Value& v) const; + virtual Value Read(const String& s) const; + virtual String Write(const Value& v) const; + virtual Size GetPhysicalSize(const Value& data) const; + virtual Size GetPixelSize(const Value& data) const; + virtual void Paint(const Value& data, Draw& w, Size sz, void *) const; + virtual Image ToImage(const Value& data, Size sz, void *) const; +}; + +String RichRawImage::GetTypeName(const Value& v) const +{ + return "rawimage"; +} + +Value RichRawImage::Read(const String& s) const +{ + return s; +} + +String RichRawImage::Write(const Value& v) const +{ + return v; +} + +Size RichRawImage::GetPhysicalSize(const Value& data) const +{ + String s = data; + StringStream ss(s); + One r = StreamRaster::OpenAny(ss); + if(r) + return r->GetInfo().dots; + return Size(0, 0); +} + +Size RichRawImage::GetPixelSize(const Value& data) const +{ + String s = data; + StringStream ss(s); + One r = StreamRaster::OpenAny(ss); + if(r) + return r->GetSize(); + return Size(0, 0); +} + +void RichRawImage::Paint(const Value& data, Draw& w, Size sz, void *) const +{ + String s = data; + StringStream ss(s); + One r = StreamRaster::OpenAny(ss); + if(r) { + Size isz = r->GetSize(); + if(isz.cx * isz.cy > sz.cx * sz.cy) { // conserve memory by scaling down from source + ImageEncoder m; + Rescale(m, sz, *r, r->GetSize()); + w.DrawImage(0, 0, sz.cx, sz.cy, m); + } + else + w.DrawImage(0, 0, sz.cx, sz.cy, r->GetImage()); // scale up by Draw to give e.g. PDF chance to store unscaled + } +} + +Image RichRawImage::ToImage(const Value& data, Size sz, void *) const +{ + String s = data; + StringStream ss(s); + One r = StreamRaster::OpenAny(ss); + if(r) { + Image x = r->GetImage(); + return Rescale(x, sz); + } + return Null; +} + +INITBLOCK { + RichObject::Register("rawimage", &Single()); +}; + +RichObject CreateRawImageObject(const String& s, int cx, int cy) +{ + RichObject o = RichObject("rawimage", s); + o.InitSize(cx, cy); + return o; +} + +struct RichImlImage : public RichObjectType { + virtual String GetTypeName(const Value& v) const; + virtual Size GetPhysicalSize(const Value& data) const; + virtual Size GetPixelSize(const Value& data) const; + virtual void Paint(const Value& data, Draw& w, Size sz) const; + virtual Image ToImage(const Value& data, Size sz, void *) const; + virtual bool IsText() const; + + Image Get(const Value& v) const; +}; + +Image RichImlImage::Get(const Value& v) const +{ + return GetImlImage((String)v); +} + +String RichImlImage::GetTypeName(const Value& v) const +{ + return "iml"; +} + +bool RichImlImage::IsText() const +{ + return true; +} + +Size RichImlImage::GetPhysicalSize(const Value& data) const +{ + return Get(data).GetSize(); +} + +Size RichImlImage::GetPixelSize(const Value& data) const +{ + return Get(data).GetSize(); +} + +void RichImlImage::Paint(const Value& data, Draw& w, Size sz) const +{ + w.DrawImage(0, 0, sz.cx, sz.cy, Get(data)); +} + +Image RichImlImage::ToImage(const Value& data, Size sz, void *) const +{ + return Rescale(Get(data), sz); +} + +INITBLOCK { + RichObject::Register("iml", &Single()); +}; + +#endif + +INITIALIZER(RichImage) {} + +} diff --git a/uppsrc/RichText/RichText.h b/uppsrc/RichText/RichText.h index 09e2d56a4..20fca592a 100644 --- a/uppsrc/RichText/RichText.h +++ b/uppsrc/RichText/RichText.h @@ -6,6 +6,8 @@ namespace Upp { +INITIALIZE(RichImage) + class PasteClip; struct RichPara; class RichTable; diff --git a/uppsrc/RichText/RichText.upp b/uppsrc/RichText/RichText.upp index 687974016..6f8d7a8fb 100644 --- a/uppsrc/RichText/RichText.upp +++ b/uppsrc/RichText/RichText.upp @@ -7,7 +7,7 @@ uses file RichText.h options(BUILDER_OPTION) PCH, Object.cpp, - RichImage.icpp, + RichImage.cpp, Para.h, ParaData.cpp, ParaType.cpp, diff --git a/uppsrc/SqlCtrl/SqlCtrl.h b/uppsrc/SqlCtrl/SqlCtrl.h index 376131b16..279fe84dc 100644 --- a/uppsrc/SqlCtrl/SqlCtrl.h +++ b/uppsrc/SqlCtrl/SqlCtrl.h @@ -245,4 +245,6 @@ void SQLObjectTree(SqlSession& session APPSQLSESSION); } +INITIALIZE(SqlCtrl) + #endif diff --git a/uppsrc/SqlCtrl/SqlCtrl.upp b/uppsrc/SqlCtrl/SqlCtrl.upp index f9ef1dc12..6afa6cbbe 100644 --- a/uppsrc/SqlCtrl/SqlCtrl.upp +++ b/uppsrc/SqlCtrl/SqlCtrl.upp @@ -9,7 +9,7 @@ uses file SqlCtrl.h options(BUILDER_OPTION) PCH, SqlCtrl.t charset "UTF-8", - SqlCtrl_init.icpp, + SqlCtrl_init.cpp, SqlCtrl.cpp, SqlArray.cpp, SqlDetail.cpp, diff --git a/uppsrc/SqlCtrl/SqlCtrl_init.icpp b/uppsrc/SqlCtrl/SqlCtrl_init.cpp similarity index 75% rename from uppsrc/SqlCtrl/SqlCtrl_init.icpp rename to uppsrc/SqlCtrl/SqlCtrl_init.cpp index 5d89cb9cf..360accb65 100644 --- a/uppsrc/SqlCtrl/SqlCtrl_init.icpp +++ b/uppsrc/SqlCtrl/SqlCtrl_init.cpp @@ -1,8 +1,10 @@ -#include "SqlCtrl.h" - -namespace Upp { - -#define TFILE -#include - -} +#include "SqlCtrl.h" + +namespace Upp { + +#define TFILE +#include + +INITIALIZER(SqlCtrl) + +} diff --git a/uppsrc/ide/Browser/Browser.h b/uppsrc/ide/Browser/Browser.h index 9dd9de9e4..21b54c075 100644 --- a/uppsrc/ide/Browser/Browser.h +++ b/uppsrc/ide/Browser/Browser.h @@ -14,6 +14,8 @@ #define IMAGEFILE #include +INITIALIZE(TopicModule) + class Browser; CppBase& CodeBase(); diff --git a/uppsrc/ide/Browser/Browser.upp b/uppsrc/ide/Browser/Browser.upp index 844230c47..bbc452589 100644 --- a/uppsrc/ide/Browser/Browser.upp +++ b/uppsrc/ide/Browser/Browser.upp @@ -31,7 +31,7 @@ file TopicWin.cpp, Move.cpp, CodeRef.cpp, - TopicI.icpp, + TopicI.cpp, Topic.lay, Topic.iml, Info readonly separator, diff --git a/uppsrc/ide/Browser/TopicI.icpp b/uppsrc/ide/Browser/TopicI.cpp similarity index 92% rename from uppsrc/ide/Browser/TopicI.icpp rename to uppsrc/ide/Browser/TopicI.cpp index c467c186c..eecf301b4 100644 --- a/uppsrc/ide/Browser/TopicI.icpp +++ b/uppsrc/ide/Browser/TopicI.cpp @@ -1,30 +1,31 @@ -#include "Browser.h" - -bool IsTopicGroup(const char *path) -{ - return ToLower(GetFileExt(path)) == ".tpp" && (!IsFullPath(path) || !FileExists(path)); -} - -struct TopicModule : public IdeModule { - virtual String GetID() { return "TopicModule"; } - - virtual Image FileIcon(const char *path) { - return IsTopicGroup(path) ? TopicImg::Group() : Null; - } - virtual IdeDesigner *CreateDesigner(const char *path, byte cs) { - if(IsTopicGroup(path)) { - TopicEditor *d = new TopicEditor; - d->PersistentFindReplace(TheIde()->IsPersistentFindReplace()); - d->Open(path); - return d; - } - return NULL; - } - virtual void Serialize(Stream& s) { - TopicEditor::SerializeEditPos(s); - } -}; - -INITBLOCK { - RegisterIdeModule(Single()); -} +#include "Browser.h" + +bool IsTopicGroup(const char *path) +{ + return ToLower(GetFileExt(path)) == ".tpp" && (!IsFullPath(path) || !FileExists(path)); +} + +struct TopicModule : public IdeModule { + virtual String GetID() { return "TopicModule"; } + + virtual Image FileIcon(const char *path) { + return IsTopicGroup(path) ? TopicImg::Group() : Null; + } + virtual IdeDesigner *CreateDesigner(const char *path, byte cs) { + if(IsTopicGroup(path)) { + TopicEditor *d = new TopicEditor; + d->PersistentFindReplace(TheIde()->IsPersistentFindReplace()); + d->Open(path); + return d; + } + return NULL; + } + virtual void Serialize(Stream& s) { + TopicEditor::SerializeEditPos(s); + } +}; + +INITIALIZER(TopicModule) +{ + RegisterIdeModule(Single()); +} diff --git a/uppsrc/ide/Builders/AndroidBuilder.icpp b/uppsrc/ide/Builders/AndroidBuilder.cpp similarity index 99% rename from uppsrc/ide/Builders/AndroidBuilder.icpp rename to uppsrc/ide/Builders/AndroidBuilder.cpp index edbd029a0..7f656e983 100644 --- a/uppsrc/ide/Builders/AndroidBuilder.icpp +++ b/uppsrc/ide/Builders/AndroidBuilder.cpp @@ -874,7 +874,7 @@ Builder *CreateAndroidBuilder() return new AndroidBuilder(); } -INITBLOCK +INITIALIZER(AndroidBuilder) { Index builders = AndroidBuilder::GetBuildersNames(); for(int i = 0; i < builders.GetCount(); i++) diff --git a/uppsrc/ide/Builders/Builders.h b/uppsrc/ide/Builders/Builders.h index 3792210d2..83380e6a9 100644 --- a/uppsrc/ide/Builders/Builders.h +++ b/uppsrc/ide/Builders/Builders.h @@ -248,4 +248,10 @@ private: void DeletePCHFile(const String& pch_file); +INITIALIZE(GccBuilder) +INITIALIZE(MscBuilder) +INITIALIZE(JavaBuilder) +INITIALIZE(AndroidBuilder) +INITIALIZE(ScriptBuilder) + #endif diff --git a/uppsrc/ide/Builders/Builders.upp b/uppsrc/ide/Builders/Builders.upp index e616e78db..738202ced 100644 --- a/uppsrc/ide/Builders/Builders.upp +++ b/uppsrc/ide/Builders/Builders.upp @@ -14,11 +14,11 @@ file MakeFile.cpp, coff.h, Builders readonly separator, - GccBuilder.icpp, - MscBuilder.icpp, - JavaBuilder.icpp, - AndroidBuilder.icpp, - ScriptBuilder.icpp, + GccBuilder.cpp, + MscBuilder.cpp, + JavaBuilder.cpp, + AndroidBuilder.cpp, + ScriptBuilder.cpp, Android readonly separator, Android.h, AndroidProject.cpp, diff --git a/uppsrc/ide/Builders/GccBuilder.icpp b/uppsrc/ide/Builders/GccBuilder.cpp similarity index 99% rename from uppsrc/ide/Builders/GccBuilder.icpp rename to uppsrc/ide/Builders/GccBuilder.cpp index 4a3817aae..8ade1d301 100644 --- a/uppsrc/ide/Builders/GccBuilder.icpp +++ b/uppsrc/ide/Builders/GccBuilder.cpp @@ -583,7 +583,7 @@ Builder *CreateGccBuilder() return new GccBuilder; } -INITBLOCK +INITIALIZER(GccBuilder) { RegisterBuilder("GCC", CreateGccBuilder); RegisterBuilder("CLANG", CreateGccBuilder); diff --git a/uppsrc/ide/Builders/JavaBuilder.icpp b/uppsrc/ide/Builders/JavaBuilder.cpp similarity index 95% rename from uppsrc/ide/Builders/JavaBuilder.icpp rename to uppsrc/ide/Builders/JavaBuilder.cpp index ab196d10f..2f518a895 100644 --- a/uppsrc/ide/Builders/JavaBuilder.icpp +++ b/uppsrc/ide/Builders/JavaBuilder.cpp @@ -311,7 +311,7 @@ static Builder *CreateJavaBuilder() return new JavaBuilder; } -INITBLOCK +INITIALIZER(JavaBuilder) { RegisterBuilder("JDK", &CreateJavaBuilder); } diff --git a/uppsrc/ide/Builders/MscBuilder.icpp b/uppsrc/ide/Builders/MscBuilder.cpp similarity index 96% rename from uppsrc/ide/Builders/MscBuilder.icpp rename to uppsrc/ide/Builders/MscBuilder.cpp index 895978bfd..29cc81ef3 100644 --- a/uppsrc/ide/Builders/MscBuilder.icpp +++ b/uppsrc/ide/Builders/MscBuilder.cpp @@ -703,7 +703,7 @@ Builder *CreateMscBuilder() return new MscBuilder; } -INITBLOCK +INITIALIZER(MscBuilder) { RegisterBuilder("MSC71", CreateMscBuilder); RegisterBuilder("MSC8", CreateMscBuilder); diff --git a/uppsrc/ide/Builders/ScriptBuilder.icpp b/uppsrc/ide/Builders/ScriptBuilder.cpp similarity index 99% rename from uppsrc/ide/Builders/ScriptBuilder.icpp rename to uppsrc/ide/Builders/ScriptBuilder.cpp index b579dd00b..6760f5726 100644 --- a/uppsrc/ide/Builders/ScriptBuilder.icpp +++ b/uppsrc/ide/Builders/ScriptBuilder.cpp @@ -283,7 +283,7 @@ Builder *CreateScriptBuilder() return new ScriptBuilder; } -INITBLOCK +INITIALIZER(ScriptBuilder) { RegisterBuilder("SCRIPT", CreateScriptBuilder); } diff --git a/uppsrc/ide/Debuggers/Debuggers.h b/uppsrc/ide/Debuggers/Debuggers.h index e64b90585..4ab0526f1 100644 --- a/uppsrc/ide/Debuggers/Debuggers.h +++ b/uppsrc/ide/Debuggers/Debuggers.h @@ -224,4 +224,6 @@ struct Gdb : Debugger, ParentCtrl { #include "Pdb.h" #endif +INITIALIZE(UppSimplifiers) + #endif diff --git a/uppsrc/ide/Debuggers/Debuggers.upp b/uppsrc/ide/Debuggers/Debuggers.upp index a5aef3bd4..6b09fdefa 100644 --- a/uppsrc/ide/Debuggers/Debuggers.upp +++ b/uppsrc/ide/Debuggers/Debuggers.upp @@ -28,7 +28,7 @@ file Gdb_MI2Explore.cpp, Gdb_MI2Gdb.cpp, Gdb_MI2.cpp, - UppSimplifiers.icpp, + UppSimplifiers.cpp, PDB readonly separator, Pdb.h, cvconst.h, diff --git a/uppsrc/ide/Debuggers/UppSimplifiers.icpp b/uppsrc/ide/Debuggers/UppSimplifiers.cpp similarity index 99% rename from uppsrc/ide/Debuggers/UppSimplifiers.icpp rename to uppsrc/ide/Debuggers/UppSimplifiers.cpp index 9ff9296b1..e2b4daeca 100644 --- a/uppsrc/ide/Debuggers/UppSimplifiers.icpp +++ b/uppsrc/ide/Debuggers/UppSimplifiers.cpp @@ -654,6 +654,8 @@ static int UppValueSimplify(VarItem &varItem, int step) } +INITIALIZER(UppSimplifiers) {} + // Register the simplifiers REGISTERSIMPLIFIER("Upp::String" , UppStringSimplify); REGISTERSIMPLIFIER("Upp::Vector<" , UppVectorSimplify); diff --git a/uppsrc/ide/Designers/Designers.h b/uppsrc/ide/Designers/Designers.h index e364f9114..2d98fb661 100644 --- a/uppsrc/ide/Designers/Designers.h +++ b/uppsrc/ide/Designers/Designers.h @@ -61,4 +61,8 @@ public: bool FileIsBinary(const char *path); +INITIALIZE(Img) +INITIALIZE(Qtf) +INITIALIZE(HexView) + #endif diff --git a/uppsrc/ide/Designers/Designers.upp b/uppsrc/ide/Designers/Designers.upp index 7deb23056..377e0d399 100644 --- a/uppsrc/ide/Designers/Designers.upp +++ b/uppsrc/ide/Designers/Designers.upp @@ -6,7 +6,7 @@ uses file Designers.h, Png.cpp, - Img.icpp, - Qtf.icpp, - HexView.icpp; + Img.cpp, + Qtf.cpp, + HexView.cpp; diff --git a/uppsrc/ide/Designers/HexView.icpp b/uppsrc/ide/Designers/HexView.cpp similarity index 92% rename from uppsrc/ide/Designers/HexView.icpp rename to uppsrc/ide/Designers/HexView.cpp index 8a8eb74e1..28e4b32dc 100644 --- a/uppsrc/ide/Designers/HexView.icpp +++ b/uppsrc/ide/Designers/HexView.cpp @@ -70,6 +70,7 @@ FileHexView::~FileHexView() StoreToGlobal(*this, "FileHexView"); } -INITBLOCK { +INITIALIZER(HexView) +{ RegisterGlobalConfig("FileHexView"); } \ No newline at end of file diff --git a/uppsrc/ide/Designers/Img.icpp b/uppsrc/ide/Designers/Img.cpp similarity index 99% rename from uppsrc/ide/Designers/Img.icpp rename to uppsrc/ide/Designers/Img.cpp index 16daec5e9..d065448db 100644 --- a/uppsrc/ide/Designers/Img.icpp +++ b/uppsrc/ide/Designers/Img.cpp @@ -74,7 +74,7 @@ struct ImageViewModule : public IdeModule { } }; -INITBLOCK +INITIALIZER(Img) { RegisterIdeModule(Single()); } diff --git a/uppsrc/ide/Designers/Qtf.icpp b/uppsrc/ide/Designers/Qtf.cpp similarity index 99% rename from uppsrc/ide/Designers/Qtf.icpp rename to uppsrc/ide/Designers/Qtf.cpp index c9e609a75..6868d43ac 100644 --- a/uppsrc/ide/Designers/Qtf.icpp +++ b/uppsrc/ide/Designers/Qtf.cpp @@ -144,7 +144,7 @@ struct QtfDesModule : public IdeModule { } }; -INITBLOCK +INITIALIZER(Qtf) { RegisterIdeModule(Single()); RegisterGlobalConfig("qtfdes-ctrl"); diff --git a/uppsrc/ide/IconDes/IconDes.h b/uppsrc/ide/IconDes/IconDes.h index 3dcfaec1a..339631323 100644 --- a/uppsrc/ide/IconDes/IconDes.h +++ b/uppsrc/ide/IconDes/IconDes.h @@ -37,4 +37,6 @@ struct IdeIconEditPos : IconDes::EditPos, Moveable { IdeIconEditPos() { filetime = Null; } }; +INITIALIZE(IconDes); + #endif diff --git a/uppsrc/ide/IconDes/IconDes.upp b/uppsrc/ide/IconDes/IconDes.upp index 29cef7506..9d575db6c 100644 --- a/uppsrc/ide/IconDes/IconDes.upp +++ b/uppsrc/ide/IconDes/IconDes.upp @@ -7,7 +7,7 @@ uses file IconDes.h, IconDes.cpp, - IdeDes.icpp, + IdeDes.cpp, Info readonly separator, Copying; diff --git a/uppsrc/ide/IconDes/IdeDes.icpp b/uppsrc/ide/IconDes/IdeDes.cpp similarity index 94% rename from uppsrc/ide/IconDes/IdeDes.icpp rename to uppsrc/ide/IconDes/IdeDes.cpp index 44df03166..6e42cc327 100644 --- a/uppsrc/ide/IconDes/IdeDes.icpp +++ b/uppsrc/ide/IconDes/IdeDes.cpp @@ -114,6 +114,6 @@ void IdeIconDes::ListMenuEx(Bar& bar) bar.Add(n.GetCount(), "Copy '" + c + '\'', CtrlImg::copy(), THISBACK1(CopyId, c)); } -INITBLOCK { +INITIALIZER(IconDes) { RegisterGlobalConfig("icondes-ctrl"); } diff --git a/uppsrc/plugin/DroidFonts/DroidFonts.icpp b/uppsrc/plugin/DroidFonts/DroidFonts.cpp similarity index 94% rename from uppsrc/plugin/DroidFonts/DroidFonts.icpp rename to uppsrc/plugin/DroidFonts/DroidFonts.cpp index 86d338d8c..8cd6058b4 100644 --- a/uppsrc/plugin/DroidFonts/DroidFonts.icpp +++ b/uppsrc/plugin/DroidFonts/DroidFonts.cpp @@ -4,7 +4,7 @@ namespace Upp { -INITBLOCK { +INITIALIZER(DroidFonts) { SetMemoryFont(Font::SANSSERIF, Font_DroidSans, Font_DroidSans_length); SetMemoryFont(Font::SANSSERIF, Font_DroidSans_Bold, Font_DroidSans_Bold_length, FtBOLD); SetMemoryFont(Font::SERIF, Font_DroidSerif, Font_DroidSerif_length); diff --git a/uppsrc/plugin/DroidFonts/DroidFonts.h b/uppsrc/plugin/DroidFonts/DroidFonts.h new file mode 100644 index 000000000..55eceaf6a --- /dev/null +++ b/uppsrc/plugin/DroidFonts/DroidFonts.h @@ -0,0 +1,12 @@ +#ifndef _plugin_DroidFonts_DroidFonts_h_ +#define _plugin_DroidFonts_DroidFonts_h_ + +#include + +namespace Upp { + +INITIALIZE(DroidFonts) + +} + +#endif diff --git a/uppsrc/plugin/DroidFonts/DroidFonts.upp b/uppsrc/plugin/DroidFonts/DroidFonts.upp index ec09b060e..ac61ef815 100644 --- a/uppsrc/plugin/DroidFonts/DroidFonts.upp +++ b/uppsrc/plugin/DroidFonts/DroidFonts.upp @@ -4,7 +4,9 @@ uses plugin/FT_fontsys; file - DroidFonts.icpp, + DroidFonts.h, + DroidFonts.cpp, + DroidFontsInit.icpp, DroidFonts.brc, Info readonly separator, Copying; diff --git a/uppsrc/plugin/bmp/Bmp.cpp b/uppsrc/plugin/bmp/Bmp.cpp index 4a8f23221..ea4decf19 100644 --- a/uppsrc/plugin/bmp/Bmp.cpp +++ b/uppsrc/plugin/bmp/Bmp.cpp @@ -284,4 +284,9 @@ BMPRaster::~BMPRaster() { } +INITIALIZER(BMPRaster) +{ + StreamRaster::Register(); +} + } diff --git a/uppsrc/plugin/bmp/BmpReg.icpp b/uppsrc/plugin/bmp/BmpReg.icpp index e01f03a88..8859b2572 100644 --- a/uppsrc/plugin/bmp/BmpReg.icpp +++ b/uppsrc/plugin/bmp/BmpReg.icpp @@ -1,9 +1 @@ #include "bmp.h" - -namespace Upp { - -INITBLOCK { - StreamRaster::Register(); -} - -} diff --git a/uppsrc/plugin/bmp/bmp.h b/uppsrc/plugin/bmp/bmp.h index b1c7afbac..7c4a84e31 100644 --- a/uppsrc/plugin/bmp/bmp.h +++ b/uppsrc/plugin/bmp/bmp.h @@ -4,6 +4,8 @@ #include namespace Upp { + +INITIALIZE(BMPRaster); class BMPRaster : public StreamRaster { Size size; diff --git a/uppsrc/plugin/png/png.h b/uppsrc/plugin/png/png.h index f703201db..0fce6cf53 100644 --- a/uppsrc/plugin/png/png.h +++ b/uppsrc/plugin/png/png.h @@ -4,6 +4,8 @@ #include namespace Upp { + +INITIALIZE(PNGRaster); class PNGRaster : public StreamRaster { class Data; diff --git a/uppsrc/plugin/png/pngreg.icpp b/uppsrc/plugin/png/pngreg.icpp index cd66a3fcd..a0c29b23e 100644 --- a/uppsrc/plugin/png/pngreg.icpp +++ b/uppsrc/plugin/png/pngreg.icpp @@ -1,9 +1 @@ #include "png.h" - -namespace Upp { - -INITBLOCK { - StreamRaster::Register(); -} - -} diff --git a/uppsrc/plugin/png/pngupp.cpp b/uppsrc/plugin/png/pngupp.cpp index 085933478..0b1e39a44 100644 --- a/uppsrc/plugin/png/pngupp.cpp +++ b/uppsrc/plugin/png/pngupp.cpp @@ -514,4 +514,8 @@ void PNGEncoder::WriteLineRaw(const byte *s) data->WriteLineRaw(s); } +INITIALIZER(PNGRaster) { + StreamRaster::Register(); +} + } diff --git a/uppsrc/plugin/tif/tif.h b/uppsrc/plugin/tif/tif.h index f9946fb03..efdaaa001 100644 --- a/uppsrc/plugin/tif/tif.h +++ b/uppsrc/plugin/tif/tif.h @@ -31,6 +31,8 @@ struct tiff *TIFFFileStreamOpen(const char *filename, const char *mode); //struct tiff* TIFFWrapOpen(const char*, const char*); //int TIFFWrapGetField(::tiff* tif_data, uint32 tag, ...); +INITIALIZE(TIFRaster); + class TIFRaster : public StreamRaster { public: struct Data; diff --git a/uppsrc/plugin/tif/tifreg.icpp b/uppsrc/plugin/tif/tifreg.icpp index 15485a918..927bae38a 100644 --- a/uppsrc/plugin/tif/tifreg.icpp +++ b/uppsrc/plugin/tif/tifreg.icpp @@ -1,9 +1 @@ #include "tif.h" - -namespace Upp { - -INITBLOCK { - StreamRaster::Register(); -} - -} diff --git a/uppsrc/plugin/tif/tifupp.cpp b/uppsrc/plugin/tif/tifupp.cpp index 4d1d9dc28..1c895b77b 100644 --- a/uppsrc/plugin/tif/tifupp.cpp +++ b/uppsrc/plugin/tif/tifupp.cpp @@ -1314,4 +1314,9 @@ void TIFEncoder::WriteLineRaw(const byte *s) data->WriteLineRaw(s); } + +INITIALIZER(TIFRaster) { + StreamRaster::Register(); +} + }