refactor solution to move dlangui into a separate library project

This commit is contained in:
Vadim Lopatin 2014-03-05 13:11:36 +04:00
parent a41841b2bc
commit b506c6f285
5 changed files with 297 additions and 24 deletions

View File

@ -1,7 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{002A2DE9-8BB6-484D-9802-7E4AD4084715}") = "dlangui", "dlangui.visualdproj", "{C86D169D-B8C0-4947-8B9D-84F656A87F4C}"
Project("{002A2DE9-8BB6-484D-9802-7E4AD4084715}") = "dlangui", "dlanguilib.visualdproj", "{5FF17402-9997-4D0E-8068-6D84B8769D98}"
EndProject
Project("{002A2DE9-8BB6-484D-9802-7E4AD4084715}") = "example1", "examples\example1\example1.visualdproj", "{68C78CC1-6176-4C60-B4B6-520475C26D23}"
ProjectSection(ProjectDependencies) = postProject
{5FF17402-9997-4D0E-8068-6D84B8769D98} = {5FF17402-9997-4D0E-8068-6D84B8769D98}
EndProjectSection
EndProject
Project("{002A2DE9-8BB6-484D-9802-7E4AD4084715}") = "example2", "examples\example2\example2.visualdproj", "{4B9651D1-BF43-47BD-9FA4-B1DAF9E7197D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -9,10 +16,18 @@ Global
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C86D169D-B8C0-4947-8B9D-84F656A87F4C}.Debug|Win32.ActiveCfg = Debug|Win32
{C86D169D-B8C0-4947-8B9D-84F656A87F4C}.Debug|Win32.Build.0 = Debug|Win32
{C86D169D-B8C0-4947-8B9D-84F656A87F4C}.Release|Win32.ActiveCfg = Release|Win32
{C86D169D-B8C0-4947-8B9D-84F656A87F4C}.Release|Win32.Build.0 = Release|Win32
{5FF17402-9997-4D0E-8068-6D84B8769D98}.Debug|Win32.ActiveCfg = Debug|Win32
{5FF17402-9997-4D0E-8068-6D84B8769D98}.Debug|Win32.Build.0 = Debug|Win32
{5FF17402-9997-4D0E-8068-6D84B8769D98}.Release|Win32.ActiveCfg = Release|Win32
{5FF17402-9997-4D0E-8068-6D84B8769D98}.Release|Win32.Build.0 = Release|Win32
{68C78CC1-6176-4C60-B4B6-520475C26D23}.Debug|Win32.ActiveCfg = Debug|Win32
{68C78CC1-6176-4C60-B4B6-520475C26D23}.Debug|Win32.Build.0 = Debug|Win32
{68C78CC1-6176-4C60-B4B6-520475C26D23}.Release|Win32.ActiveCfg = Release|Win32
{68C78CC1-6176-4C60-B4B6-520475C26D23}.Release|Win32.Build.0 = Release|Win32
{4B9651D1-BF43-47BD-9FA4-B1DAF9E7197D}.Debug|Win32.ActiveCfg = Debug|Win32
{4B9651D1-BF43-47BD-9FA4-B1DAF9E7197D}.Debug|Win32.Build.0 = Debug|Win32
{4B9651D1-BF43-47BD-9FA4-B1DAF9E7197D}.Release|Win32.ActiveCfg = Release|Win32
{4B9651D1-BF43-47BD-9FA4-B1DAF9E7197D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,9 +1,9 @@
<DProject>
<ProjectGuid>{C86D169D-B8C0-4947-8B9D-84F656A87F4C}</ProjectGuid>
<ProjectGuid>{5FF17402-9997-4D0E-8068-6D84B8769D98}</ProjectGuid>
<Config name="Debug" platform="Win32">
<obj>0</obj>
<link>0</link>
<lib>0</lib>
<lib>1</lib>
<subsystem>2</subsystem>
<multiobj>0</multiobj>
<singleFileCompilation>0</singleFileCompilation>
@ -42,7 +42,7 @@
<pic>0</pic>
<cov>0</cov>
<nofloat>0</nofloat>
<Dversion>2.043</Dversion>
<Dversion>2</Dversion>
<ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
@ -69,7 +69,7 @@
<versionids>Unicode</versionids>
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>0</createImplib>
<createImplib>1</createImplib>
<defaultlibname />
<debuglibname />
<moduleDepsFile />
@ -83,11 +83,11 @@
<cv2pdbOptions />
<objfiles />
<linkswitches />
<libfiles>ole32.lib kernel32.lib user32.lib comctl32.lib comdlg32.lib</libfiles>
<libpaths>3rdparty/libpng/lib</libpaths>
<libfiles />
<libpaths />
<deffile />
<resfile />
<exefile>$(OutDir)\$(ProjectName).exe</exefile>
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
<useStdLibPath>1</useStdLibPath>
<additionalOptions />
<preBuildCommand />
@ -97,8 +97,8 @@
<Config name="Release" platform="Win32">
<obj>0</obj>
<link>0</link>
<lib>0</lib>
<subsystem>2</subsystem>
<lib>1</lib>
<subsystem>0</subsystem>
<multiobj>0</multiobj>
<singleFileCompilation>0</singleFileCompilation>
<oneobj>0</oneobj>
@ -160,7 +160,7 @@
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids />
<versionids>Unicode</versionids>
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>0</createImplib>
@ -177,11 +177,11 @@
<cv2pdbOptions />
<objfiles />
<linkswitches />
<libfiles>ole32.lib kernel32.lib user32.lib comctl32.lib comdlg32.lib</libfiles>
<libfiles />
<libpaths />
<deffile />
<resfile />
<exefile>$(OutDir)\$(ProjectName).exe</exefile>
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
<useStdLibPath>1</useStdLibPath>
<additionalOptions />
<preBuildCommand />
@ -198,6 +198,7 @@
<Folder name="win32">
<File path="3rdparty\win32\basetsd.d" />
<File path="3rdparty\win32\basetyps.d" />
<File path="3rdparty\win32\cderr.d" />
<File path="3rdparty\win32\cguid.d" />
<File path="3rdparty\win32\commdlg.d" />
<File path="3rdparty\win32\core.d" />
@ -274,7 +275,5 @@
</Folder>
</Folder>
</Folder>
<File path="3rdparty\win32\cderr.d" />
<File path="winmain.d" />
</Folder>
</DProject>

View File

@ -0,0 +1,194 @@
<DProject>
<ProjectGuid>{68C78CC1-6176-4C60-B4B6-520475C26D23}</ProjectGuid>
<Config name="Debug" platform="Win32">
<obj>0</obj>
<link>0</link>
<lib>0</lib>
<subsystem>2</subsystem>
<multiobj>0</multiobj>
<singleFileCompilation>0</singleFileCompilation>
<oneobj>0</oneobj>
<trace>0</trace>
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<symdebug>1</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
<isX86_64>0</isX86_64>
<isLinux>0</isLinux>
<isOSX>0</isOSX>
<isWindows>0</isWindows>
<isFreeBSD>0</isFreeBSD>
<isSolaris>0</isSolaris>
<scheduler>0</scheduler>
<useDeprecated>0</useDeprecated>
<errDeprecated>0</errDeprecated>
<useAssert>0</useAssert>
<useInvariants>0</useInvariants>
<useIn>0</useIn>
<useOut>0</useOut>
<useArrayBounds>0</useArrayBounds>
<noboundscheck>0</noboundscheck>
<useSwitchError>0</useSwitchError>
<useUnitTests>0</useUnitTests>
<useInline>0</useInline>
<release>0</release>
<preservePaths>0</preservePaths>
<warnings>0</warnings>
<infowarnings>0</infowarnings>
<checkProperty>0</checkProperty>
<genStackFrame>0</genStackFrame>
<pic>0</pic>
<cov>0</cov>
<nofloat>0</nofloat>
<Dversion>2</Dversion>
<ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<program>$(DMDInstallDir)windows\bin\dmd.exe</program>
<imppath>../../src ../../3rdparty</imppath>
<fileImppath />
<outdir>$(ConfigurationName)</outdir>
<objdir>$(OutDir)</objdir>
<objname />
<libname />
<doDocComments>0</doDocComments>
<docdir />
<docname />
<modules_ddoc />
<ddocfiles />
<doHdrGeneration>0</doHdrGeneration>
<hdrdir />
<hdrname />
<doXGeneration>1</doXGeneration>
<xfilename>$(IntDir)\$(TargetName).json</xfilename>
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids>Unicode</versionids>
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>0</createImplib>
<defaultlibname />
<debuglibname />
<moduleDepsFile />
<run>0</run>
<runargs />
<runCv2pdb>1</runCv2pdb>
<pathCv2pdb>$(VisualDInstallDir)cv2pdb\cv2pdb.exe</pathCv2pdb>
<cv2pdbPre2043>0</cv2pdbPre2043>
<cv2pdbNoDemangle>0</cv2pdbNoDemangle>
<cv2pdbEnumType>0</cv2pdbEnumType>
<cv2pdbOptions />
<objfiles />
<linkswitches />
<libfiles>phobos.lib ole32.lib kernel32.lib user32.lib comctl32.lib comdlg32.lib dlangui.lib</libfiles>
<libpaths>../../Debug ../../3rdparty/win32/lib</libpaths>
<deffile />
<resfile />
<exefile>$(OutDir)\$(ProjectName).exe</exefile>
<useStdLibPath>1</useStdLibPath>
<additionalOptions />
<preBuildCommand />
<postBuildCommand />
<filesToClean>*.obj;*.cmd;*.build;*.json;*.dep</filesToClean>
</Config>
<Config name="Release" platform="Win32">
<obj>0</obj>
<link>0</link>
<lib>0</lib>
<subsystem>2</subsystem>
<multiobj>0</multiobj>
<singleFileCompilation>0</singleFileCompilation>
<oneobj>0</oneobj>
<trace>0</trace>
<quiet>0</quiet>
<verbose>0</verbose>
<vtls>0</vtls>
<symdebug>0</symdebug>
<optimize>0</optimize>
<cpu>0</cpu>
<isX86_64>0</isX86_64>
<isLinux>0</isLinux>
<isOSX>0</isOSX>
<isWindows>0</isWindows>
<isFreeBSD>0</isFreeBSD>
<isSolaris>0</isSolaris>
<scheduler>0</scheduler>
<useDeprecated>0</useDeprecated>
<errDeprecated>0</errDeprecated>
<useAssert>0</useAssert>
<useInvariants>0</useInvariants>
<useIn>0</useIn>
<useOut>0</useOut>
<useArrayBounds>0</useArrayBounds>
<noboundscheck>0</noboundscheck>
<useSwitchError>0</useSwitchError>
<useUnitTests>0</useUnitTests>
<useInline>0</useInline>
<release>1</release>
<preservePaths>0</preservePaths>
<warnings>0</warnings>
<infowarnings>0</infowarnings>
<checkProperty>0</checkProperty>
<genStackFrame>0</genStackFrame>
<pic>0</pic>
<cov>0</cov>
<nofloat>0</nofloat>
<Dversion>2.043</Dversion>
<ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>
<compiler>0</compiler>
<otherDMD>0</otherDMD>
<program>$(DMDInstallDir)windows\bin\dmd.exe</program>
<imppath />
<fileImppath />
<outdir>$(ConfigurationName)</outdir>
<objdir>$(OutDir)</objdir>
<objname />
<libname />
<doDocComments>0</doDocComments>
<docdir />
<docname />
<modules_ddoc />
<ddocfiles />
<doHdrGeneration>0</doHdrGeneration>
<hdrdir />
<hdrname />
<doXGeneration>1</doXGeneration>
<xfilename>$(IntDir)\$(TargetName).json</xfilename>
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids>Unicode</versionids>
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>0</createImplib>
<defaultlibname />
<debuglibname />
<moduleDepsFile />
<run>0</run>
<runargs />
<runCv2pdb>0</runCv2pdb>
<pathCv2pdb>$(VisualDInstallDir)cv2pdb\cv2pdb.exe</pathCv2pdb>
<cv2pdbPre2043>0</cv2pdbPre2043>
<cv2pdbNoDemangle>0</cv2pdbNoDemangle>
<cv2pdbEnumType>0</cv2pdbEnumType>
<cv2pdbOptions />
<objfiles />
<linkswitches />
<libfiles>ole32.lib kernel32.lib user32.lib comctl32.lib comdlg32.lib</libfiles>
<libpaths />
<deffile />
<resfile />
<exefile>$(OutDir)\$(ProjectName).exe</exefile>
<useStdLibPath>1</useStdLibPath>
<additionalOptions />
<preBuildCommand />
<postBuildCommand />
<filesToClean>*.obj;*.cmd;*.build;*.json;*.dep</filesToClean>
</Config>
<Folder name="example1">
<File path="winmain.d" />
</Folder>
</DProject>

View File

@ -0,0 +1,66 @@
module winmain;
pragma(lib, "dlangui.lib");
import dlangui.platforms.common.platform;
import dlangui.widgets.widget;
import dlangui.core.logger;
import dlangui.graphics.fonts;
import std.stdio;
version(Windows) {
import win32.windows;
import dlangui.platforms.windows.winapp;
/// workaround for link issue when WinMain is located in library
extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
return DLANGUIWinMain(hInstance, hPrevInstance,
lpCmdLine, nCmdShow);
}
}
class TestWidget : Widget {
public override void onDraw(DrawBuf buf) {
super.onDraw(buf);
FontRef font1;
FontRef font2;
Log.d("Testing opAssign");
font1 = font2;
Log.d("Testing copy constructor");
FontRef font3 = font2;
Log.d("On draw: getting font");
FontRef font = FontManager.instance.getFont(32, 400, false, FontFamily.SansSerif, "Arial");
Log.d("Got font, drawing text");
font.drawText(buf, _pos.left + 5, _pos.top + 5, "Text"d, 0x0000FF);
Log.d("Text is drawn successfully");
}
}
extern (C) int UIAppMain() {
Log.d("Some debug message");
Log.e("Sample error #", 22);
Window window = Platform.instance().createWindow("My Window", null);
Widget myWidget = new TestWidget();
window.mainWidget = myWidget;
window.show();
window.windowCaption = "New Window Caption";
Log.d("Before getFont");
FontRef font = FontManager.instance.getFont(32, 400, false, FontFamily.SansSerif, "Arial");
Log.d("After getFont");
assert(!font.isNull);
int[] widths;
dchar[] text = cast(dchar[])"Test string"d;
Log.d("Calling measureText");
int charsMeasured = font.measureText(text, widths, 1000);
assert(charsMeasured > 0);
int w = widths[charsMeasured - 1];
Log.d("Measured string: ", charsMeasured, " chars, width=", w);
Glyph * g = font.getCharGlyph('A');
Log.d("Char A glyph: ", g.blackBoxX, "x", g.blackBoxY);
return Platform.instance().enterMessageLoop();
}

View File

@ -112,10 +112,9 @@ class Win32Platform : Platform {
}
}
extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
extern(Windows)
int DLANGUIWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow) {
int result;
void exceptionHandler(Throwable e) {
@ -131,7 +130,7 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
catch (Throwable e) // catch any uncaught exceptions
{
MessageBox(null, toUTF16z(e.toString()), "Error",
MB_OK | MB_ICONEXCLAMATION);
MB_OK | MB_ICONEXCLAMATION);
result = 0; // failed
}