Browse files

Removed String from the windows scaffold. Builds but does not link.

  • Loading branch information...
1 parent 5fe6c52 commit e2f3418b45d57411e15cc403a2377e3f025d9f36 @LindseyB LindseyB committed Apr 12, 2010
View
2 core/string.d
@@ -475,6 +475,8 @@ string formatv(string format, Variadic vars) {
dvalue = var.to!(double);
formatDouble = true;
break;
+ default:
+ break;
}
string result = "";
View
6 networking/ftp.d
@@ -444,9 +444,7 @@ protected:
case Code.NLI: //530
throw new Exception("Login Incorrect");
- close();
//raiseSignal(Signal.LoginIncorrect);
- break;
case Code.RFAPFI: //350
_busy.up();
@@ -459,8 +457,6 @@ protected:
case Code.RANTFUA:
throw new Exception("File does not exist on server");
-
- break;
default:
break;
}
@@ -497,7 +493,7 @@ protected:
{
throw new Exception("File does not exist on local machine");
}
- check = _dskt.write(f,f.length);
+ check = _dskt.write(f,cast(uint)f.length);
f.close();
break;
case DataMode.PrintFile:
View
4 platform/win/gui/osbutton.d
@@ -27,10 +27,6 @@ import graphics.graphics;
class OSButton : Button, WinWidget {
- this(int x, int y, int width, int height, String value) {
- super(x,y,width,height,value);
- }
-
this(int x, int y, int width, int height, string value) {
super(x,y,width,height,value);
}
View
6 platform/win/platform/application.d
@@ -47,6 +47,10 @@ class ApplicationController {
void exitCode(uint value) {
_exitCode = value;
}
+
+ uint exitCode() {
+ return _exitCode;
+ }
void start() {
}
@@ -202,7 +206,7 @@ private:
if (chr == ' ' || chr == '\t' || chr == '\n' || chr == '\0') {
if (last != i) {
- String token = new String(Unicode.toUtf8(cmdlne[last..i]));
+ string token = Unicode.toUtf8(cmdlne[last..i]);
args.add(token);
}
View
16 platform/win/platform/vars/window.d
@@ -18,6 +18,7 @@ import binding.win32.winuser;
import core.definitions;
import core.string;
+import core.unicode;
import gui.window;
@@ -70,7 +71,7 @@ struct WindowPlatformVars {
HWND parenthWnd;
void* userData;
- String oldTitle;
+ string oldTitle;
Window windowClass;
@@ -105,11 +106,12 @@ struct WindowPlatformVars {
if (pleaseStop) {
return;
}
-
- oldTitle.appendChar('\0');
+
+ wstring oldTitleW = Unicode.toUtf16(oldTitle.dup);
+ oldTitleW ~='\0';
while(hWnd is null) {
- hWnd = CreateWindowExW(iexstyle, "djehutyApp\0"w.ptr,oldTitle.ptr, cast(DWORD)(istyle | WS_CLIPSIBLINGS),
+ hWnd = CreateWindowExW(iexstyle, "djehutyApp\0"w.ptr,oldTitleW.ptr, cast(DWORD)(istyle | WS_CLIPSIBLINGS),
oldX, oldY, oldWidth, oldHeight, null,
cast(HMENU) null, null, cast(void*)userData);
}
@@ -198,8 +200,10 @@ struct WindowPlatformVars {
return;
}
- oldTitle.appendChar('\0');
- hWnd = CreateWindowExW(0, "djehutyApp\0"w.ptr,oldTitle.ptr, istyle ,
+ wstring oldTitleW = Unicode.toUtf16(oldTitle.dup);
+ oldTitleW ~='\0';
+
+ hWnd = CreateWindowExW(0, "djehutyApp\0"w.ptr,oldTitleW.ptr, istyle ,
oldX, oldY, oldWidth, oldHeight, null,
cast(HMENU) null, null, cast(void*)userData);
View
4 platform/win/scaffold/console.d
@@ -289,7 +289,7 @@ void ConsoleShowCaret()
SetConsoleCursorInfo(hStdout, &ccinfo);
}
-void ConsolePutString(dchar[] chrs)
+void ConsolePutString(char[] chrs)
{
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -301,7 +301,7 @@ void ConsolePutString(dchar[] chrs)
// print line by line
- String str = new String(Unicode.toUtf8(chrs));
+ string str = chrs.dup;
//wstring str = Unicode.toUtf16(chrs);
View
130 platform/win/scaffold/directory.d
@@ -24,16 +24,30 @@ import core.unicode;
import io.console;
import io.file;
-bool DirectoryOpen(ref DirectoryPlatformVars dirVars, ref String path) {
+bool DirectoryOpen(ref DirectoryPlatformVars dirVars, ref string path) {
+ return false;
+}
+
+bool DirectoryCreate(ref DirectoryPlatformVars dirVars, ref string path) {
+ wchar[] dirPath = Unicode.toUtf16(path);
+
+ if (DirectoryFileIsDir(path)) {
+ return false;
+ }
+
+ if(CreateDirectoryW(dirPath.ptr,null) != 0){
+ return true;
+ }
+
return false;
}
bool DirectoryClose(ref DirectoryPlatformVars dirVars) {
return false;
}
-String DirectoryGetBinary() {
- static String cached;
+string DirectoryGetBinary() {
+ static string cached;
// %PROGRAMFILES%
@@ -47,14 +61,14 @@ String DirectoryGetBinary() {
str = _SanitizeWindowsPath(str[0..ret]);
- cached = new String(Unicode.toUtf8(str)) ~ "/" ~ Djehuty.app.name;
+ cached = Unicode.toUtf8(str) ~ "/" ~ Djehuty.app.name;
}
return cached;
}
-String DirectoryGetAppData() {
- static String cached;
+string DirectoryGetAppData() {
+ static string cached;
// %PROGRAMFILES%
@@ -68,14 +82,14 @@ String DirectoryGetAppData() {
str = _SanitizeWindowsPath(str[0..ret]);
- cached = new String(Unicode.toUtf8(str)) ~ "/" ~ Djehuty.app.name;
+ cached = Unicode.toUtf8(str) ~ "/" ~ Djehuty.app.name;
}
return cached;
}
-String DirectoryGetTempData() {
- static String cached;
+string DirectoryGetTempData() {
+ static string cached;
if (cached is null) {
int ret = GetTempPathW(0, null);
@@ -86,14 +100,14 @@ String DirectoryGetTempData() {
ret = GetTempPathW(ret, str.ptr);
str = _SanitizeWindowsPath(str[0..ret]);
- cached = new String(Unicode.toUtf8(str)) ~ "/dpj" ~ new String(GetCurrentProcessId());
+ cached = Unicode.toUtf8(str) ~ "/dpj" ~ toStr(GetCurrentProcessId());
}
return cached;
}
-String DirectoryGetUserData() {
- static String cached;
+string DirectoryGetUserData() {
+ static string cached;
// %APPDATA%
@@ -107,13 +121,13 @@ String DirectoryGetUserData() {
str = _SanitizeWindowsPath(str[0..ret]);
- cached = new String(Unicode.toUtf8(str)) ~ "/" ~ Djehuty.app.name;
+ cached = Unicode.toUtf8(str) ~ "/" ~ Djehuty.app.name;
}
return cached;
}
-String DirectoryGetApp() {
+string DirectoryGetApp() {
int size = 512;
int ret = 0;
@@ -132,39 +146,39 @@ String DirectoryGetApp() {
dir = _SanitizeWindowsPath(dir);
dir = _TruncateFileName(dir);
- return new String(Unicode.toUtf8(dir));
+ return Unicode.toUtf8(dir);
}
-String DirectoryGetCWD() {
+string DirectoryGetCWD() {
int size = GetCurrentDirectoryW(0, null);
wchar[] cwd = new wchar[size];
GetCurrentDirectoryW(size, cwd.ptr);
cwd = cwd[0..$-1];
cwd = _SanitizeWindowsPath(cwd);
- return new String(Unicode.toUtf8(cwd));
+ return Unicode.toUtf8(cwd);
}
-bool DirectoryFileIsDir(String path) {
- wchar[] strArr = _ConvertFrameworkPath(path.array);
+bool DirectoryFileIsDir(string path) {
+ wchar[] strArr = _ConvertFrameworkPath(Unicode.toUtf16(path));
strArr ~= '\0';
DWORD ret = GetFileAttributesW(strArr.ptr);
return (ret & FILE_ATTRIBUTE_DIRECTORY) > 0;
}
-bool DirectoryRename(ref String path, String newName) {
- String old = new String(path);
- old.appendChar('\0');
+bool DirectoryRename(ref string path, string newName) {
+ string old = path.dup;
+ old ~= '\0';
- String str;
+ string str;
foreach_reverse(int i, chr; path) {
if (chr == '/') {
// truncate
- str = new String(path[0..i]);
+ str = path[0..i];
break;
}
}
@@ -173,50 +187,50 @@ bool DirectoryRename(ref String path, String newName) {
return false;
}
- str.appendChar('/');
- str.append(newName);
- str.appendChar('\0');
+ str ~= '/';
+ str ~= newName;
+ str ~= '\0';
- wchar[] strArr = _ConvertFrameworkPath(str.array);
- wchar[] oldArr = _ConvertFrameworkPath(old.array);
+ wchar[] strArr = _ConvertFrameworkPath(Unicode.toUtf16(str));
+ wchar[] oldArr = _ConvertFrameworkPath(Unicode.toUtf16(old));
MoveFileW(oldArr.ptr, strArr.ptr);
return true;
}
-bool DirectoryMove(ref String path, String newPath) {
- String old = new String(path);
- old.appendChar('\0');
+bool DirectoryMove(ref string path, string newPath) {
+ string old = path.dup;
+ old ~= '\0';
- String str = new String(newPath);
- str.appendChar('\0');
+ string str = newPath.dup;
+ str ~= '\0';
- wchar[] strArr = _ConvertFrameworkPath(str.array);
- wchar[] oldArr = _ConvertFrameworkPath(old.array);
+ wchar[] strArr = _ConvertFrameworkPath(Unicode.toUtf16(str));
+ wchar[] oldArr = _ConvertFrameworkPath(Unicode.toUtf16(old));
MoveFileW(oldArr.ptr, strArr.ptr);
return true;
}
-bool DirectoryCopy(ref String path, String newPath) {
- String old = new String(path);
- old.appendChar('\0');
+bool DirectoryCopy(ref string path, string newPath) {
+ string old = path.dup;
+ old ~= '\0';
- String str = new String(newPath);
- str.appendChar('\0');
+ string str = newPath.dup;
+ str ~= '\0';
- wchar[] strArr = _ConvertFrameworkPath(str.array);
- wchar[] oldArr = _ConvertFrameworkPath(old.array);
+ wchar[] strArr = _ConvertFrameworkPath(Unicode.toUtf16(str));
+ wchar[] oldArr = _ConvertFrameworkPath(Unicode.toUtf16(old));
Console.putln("!!",oldArr, strArr);
CopyFileW(oldArr.ptr, strArr.ptr, 0);
return true;
}
-String[] _ReturnSharedFolders(wchar[] serverName) {
+string[] _ReturnSharedFolders(wchar[] serverName) {
// Read all drives on this server
- String[] ret;
+ string[] ret;
/*
SHARE_INFO_0* bufptr;
@@ -241,8 +255,8 @@ String[] _ReturnSharedFolders(wchar[] serverName) {
return ret;
}
-String[] _ReturnNetworkComputers() {
- String[] ret;
+string[] _ReturnNetworkComputers() {
+ string[] ret;
/*
HANDLE enumWorkgroupHandle;
@@ -389,17 +403,17 @@ wchar[] _ConvertFrameworkPath(wchar[] tmp) {
return tmp;
}
-String[] DirectoryList(ref DirectoryPlatformVars dirVars, String path) {
+string[] DirectoryList(ref DirectoryPlatformVars dirVars, string path) {
// trim trailing slash
if (path.length > 0 && path[path.length - 1] == '/' || path[path.length - 1] == '\\') {
- path = path.subString(0, path.length-1);
+ path = path[0..path.length-1];
}
- String newpath = new String(path);
- newpath = new String(Unicode.toUtf8(_ConvertFrameworkPath(newpath.array)));
+ string newpath = path.dup;
+ newpath = Unicode.toUtf8(_ConvertFrameworkPath(Unicode.toUtf16(newpath)));
- String[] list;
+ string[] list;
if (newpath == "") {
// root directory listing
@@ -411,7 +425,7 @@ String[] DirectoryList(ref DirectoryPlatformVars dirVars, String path) {
while(logicaldrives != 0) {
if ((logicaldrives & 1) == 1) {
- list ~= new String(curDrive);
+ list ~= curDrive;
}
if (curDrive[0] == 'z') { break; }
@@ -420,7 +434,7 @@ String[] DirectoryList(ref DirectoryPlatformVars dirVars, String path) {
logicaldrives >>= 1;
}
- list ~= new String("network");
+ list ~= "network";
return list;
}
/*else if (path.length >= 8 && path[0..8] == "/network") {
@@ -446,9 +460,9 @@ String[] DirectoryList(ref DirectoryPlatformVars dirVars, String path) {
WIN32_FIND_DATAW ffd;
- String pn = new String(newpath);
- pn.append("/*");
- pn.appendChar('\0');
+ wstring pn = Unicode.toUtf16(newpath);
+ pn ~= "/*";
+ pn ~= '\0';
HANDLE h = FindFirstFileW(pn.ptr, &ffd);
bool cont = true;
@@ -466,7 +480,7 @@ String[] DirectoryList(ref DirectoryPlatformVars dirVars, String path) {
// Add to list
if (ffd.cFileName[0..len] != "." && ffd.cFileName[0..len] != "..") {
- list ~= new String(Unicode.toUtf8(ffd.cFileName[0..len]));
+ list ~= Unicode.toUtf8(ffd.cFileName[0..len]);
}
// Retrieve next item in the directory
View
71 platform/win/scaffold/file.d
@@ -20,101 +20,104 @@ import core.stream;
import core.string;
import core.main;
import core.definitions;
+import core.unicode;
import io.console;
import io.directory;
import io.file;
// OPERATIONS //
-bool FileMove(ref FilePlatformVars fileVars, String oldFullPath, String newFullPath) {
- String oldPath = new String(oldFullPath);
- oldPath.appendChar('\0');
+bool FileMove(ref FilePlatformVars fileVars, string oldFullPath, string newFullPath) {
+ wstring oldPath = Unicode.toUtf16(oldFullPath);
+ oldPath ~= '\0';
- String newPath = new String(newFullPath);
- newPath.appendChar('\0');
+ wstring newPath = Unicode.toUtf16(newFullPath);
+ newPath ~= '\0';
MoveFileW(oldPath.ptr, newPath.ptr);
return true;
}
-bool FileCopy(ref FilePlatformVars fileVars, String oldFullPath, String newFullPath) {
- String oldPath = new String(oldFullPath);
- oldPath.appendChar('\0');
+bool FileCopy(ref FilePlatformVars fileVars, string oldFullPath, string newFullPath) {
+ wstring oldPath = Unicode.toUtf16(oldFullPath);
+ oldPath ~= '\0';
- String newPath = new String(newFullPath);
- newPath.appendChar('\0');
+ wstring newPath = Unicode.toUtf16(newFullPath);
+ newPath ~= '\0';
CopyFileW(oldPath.ptr, newPath.ptr, 0);
return true;
}
-bool FileRename(ref FilePlatformVars fileVars, ref String path, ref String newName) {
- String old = new String(path);
- old.appendChar('\0');
+bool FileRename(ref FilePlatformVars fileVars, ref string path, ref string newName) {
+ wstring old = Unicode.toUtf16(path);
+ old ~= '\0';
- String str;
+ string str;
foreach_reverse(int i, chr; path)
{
if (chr == '/')
{
// truncate
- str = new String(path[0..i]);
+ str = path[0..i];
break;
}
}
if (str is null) { return false; }
- str.append(newName);
- str.appendChar('\0');
+ str ~= newName;
+ str ~= '\0';
+
+ wstring strw = Unicode.toUtf16(str);
- MoveFileW(old.ptr, str.ptr);
+ MoveFileW(old.ptr, strw.ptr);
return true;
}
-bool FileMove(ref String from, ref Directory to) {
- String old = new String(from);
- old.appendChar('\0');
+bool FileMove(ref string from, ref Directory to) {
+ wstring old = Unicode.toUtf16(from);
+ old ~= '\0';
- String fn;
+ string fn;
foreach_reverse(int i, chr; from)
{
if (chr == '/')
{
// truncate (include the slash)
- fn = new String(from[i..from.length]);
+ fn = from[i..from.length];
break;
}
}
if (fn is null) { return false; }
- String str = new String(to.path);
- str.append(fn);
- str.appendChar('\0');
+ wstring str = Unicode.toUtf16(to.path);
+ str ~= Unicode.toUtf16(fn);
+ str ~= '\0';
MoveFileW(old.ptr, str.ptr);
return true;
}
// FILE //
-bool FileOpen(ref FilePlatformVars fileVars, ref String filename) {
- String newString = new String(filename);
- newString.appendChar('\0');
- wchar[] foo = _ConvertFrameworkPath(newString.array);
+bool FileOpen(ref FilePlatformVars fileVars, ref string filename) {
+ wstring newString = Unicode.toUtf16(filename);
+ newString ~= '\0';
+ wchar[] foo = _ConvertFrameworkPath(newString);
fileVars.f = CreateFileW( foo.ptr, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, null,OPEN_ALWAYS,0,null);
return (fileVars.f !is null);
}
-bool FileCreate(ref FilePlatformVars fileVars, ref String filename) {
- String newString = new String(filename);
- newString.appendChar('\0');
- wchar[] foo = _ConvertFrameworkPath(newString.array);
+bool FileCreate(ref FilePlatformVars fileVars, ref string filename) {
+ wstring newString = Unicode.toUtf16(filename);
+ newString ~= '\0';
+ wchar[] foo = _ConvertFrameworkPath(newString);
fileVars.f = CreateFileW( foo.ptr, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, null,CREATE_ALWAYS,0,null);
return (fileVars.f !is null);
View
88 platform/win/scaffold/graphics.d
@@ -22,7 +22,6 @@ import platform.vars.region;
import Gdiplus = binding.win32.gdiplus;
-import core.tostring;
import core.string;
import core.color;
import core.main;
@@ -108,15 +107,6 @@ void strokePie(ViewPlatformVars* viewVars, int x, int y, int width, int height,
}
// Text
-void drawText(ViewPlatformVars* viewVars, int x, int y, String str) {
- str = new String(str);
- str.appendChar('\0');
-
- Gdiplus.RectF rect = Gdiplus.RectF(x, y, 0.0f, 0.0f);
- Gdiplus.GdipDrawString(viewVars.g, str.ptr, str.array.length-1, viewVars.curFont, &rect, null, viewVars.curTextBrush);
- //TextOutW(viewVars.dc, x, y, str.ptr, str.length-1);
-}
-
void drawText(ViewPlatformVars* viewVars, int x, int y, string str) {
wstring utf16 = Unicode.toUtf16(str ~ '\0');
@@ -125,15 +115,6 @@ void drawText(ViewPlatformVars* viewVars, int x, int y, string str) {
//TextOutW(viewVars.dc, x, y, utf16.ptr, utf16.length-1);
}
-void drawText(ViewPlatformVars* viewVars, int x, int y, String str, uint length) {
- str = new String(str);
- str.appendChar('\0');
-
- Gdiplus.RectF rect = Gdiplus.RectF(x, y, 0.0f, 0.0f);
- Gdiplus.GdipDrawString(viewVars.g, str.ptr, length, viewVars.curFont, &rect, null, viewVars.curTextBrush);
- //TextOutW(viewVars.dc, x, y, str.ptr, length);
-}
-
void drawText(ViewPlatformVars* viewVars, int x, int y, string str, uint length) {
wstring utf16 = Unicode.toUtf16(str ~ '\0');
@@ -143,45 +124,17 @@ void drawText(ViewPlatformVars* viewVars, int x, int y, string str, uint length)
}
// Clipped Text
-void drawClippedText(ViewPlatformVars* viewVars, int x, int y, Rect region, String str) {
- ExtTextOutW(viewVars.dc, x,y, ETO_CLIPPED, cast(RECT*)&region, str.ptr, str.length, null);
-}
-
void drawClippedText(ViewPlatformVars* viewVars, int x, int y, Rect region, string str) {
wstring utf16 = Unicode.toUtf16(str);
ExtTextOutW(viewVars.dc, x,y, ETO_CLIPPED, cast(RECT*)&region, utf16.ptr, utf16.length, null);
}
-void drawClippedText(ViewPlatformVars* viewVars, int x, int y, Rect region, String str, uint length) {
- ExtTextOutW(viewVars.dc, x,y, ETO_CLIPPED, cast(RECT*)&region, str.ptr, length, null);
-}
-
void drawClippedText(ViewPlatformVars* viewVars, int x, int y, Rect region, string str, uint length) {
wstring utf16 = Unicode.toUtf16(str);
ExtTextOutW(viewVars.dc, x,y, ETO_CLIPPED, cast(RECT*)&region, utf16.ptr, length, null);
}
// Text Measurement
-void measureText(ViewPlatformVars* viewVars, String str, out Size sz) {
- //GetTextExtentPoint32W(viewVars.dc, str.ptr, str.length, cast(SIZE*)&sz);
- Gdiplus.RectF rect = Gdiplus.RectF(0.0f, 0.0f, 0.0f, 0.0f);
- Gdiplus.RectF result;
- Gdiplus.GdipMeasureString(viewVars.g, str.ptr, str.array.length-1,
- viewVars.curFont, &rect, null, &result, null, null);
- sz.x = cast(uint)result.Width;
- sz.y = cast(uint)result.Height;
-}
-
-void measureText(ViewPlatformVars* viewVars, String str, uint length, out Size sz) {
- //GetTextExtentPoint32W(viewVars.dc, str.ptr, length, cast(SIZE*)&sz);
- Gdiplus.RectF rect = Gdiplus.RectF(0.0f, 0.0f, 0.0f, 0.0f);
- Gdiplus.RectF result;
- Gdiplus.GdipMeasureString(viewVars.g, str.ptr, length,
- viewVars.curFont, &rect, null, &result, null, null);
- sz.x = cast(uint)result.Width;
- sz.y = cast(uint)result.Height;
-}
-
void measureText(ViewPlatformVars* viewVars, string str, out Size sz) {
wstring utf16 = Unicode.toUtf16(str) ~ cast(wchar)'\0';
//GetTextExtentPoint32W(viewVars.dc, utf16.ptr, utf16.length, cast(SIZE*)&sz) ;
@@ -238,7 +191,6 @@ void setAntialias(ViewPlatformVars* viewVars, bool value) {
// Fonts
-import std.stdio;
void createFont(FontPlatformVars* font, string fontname, int fontsize, int weight, bool italic, bool underline, bool strikethru) {
// Create family
wstring utf16 = Unicode.toUtf16(fontname) ~ cast(wchar)'\0';
@@ -268,46 +220,6 @@ void createFont(FontPlatformVars* font, string fontname, int fontsize, int weigh
// Create font
Gdiplus.GdipCreateFont(font.family, fontsize, style, Gdiplus.Unit.UnitPoint, &font.handle);
-
-// HDC dcz = GetDC(cast(HWND)0);
-// font.fontHandle = CreateFontW(-MulDiv(fontsize, GetDeviceCaps(dcz, 90), 72),0,0,0, weight, italic, underline, strikethru, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH, utf16.ptr);
-// ReleaseDC(cast(HWND)0, dcz);
-}
-
-void createFont(FontPlatformVars* font, String fontname, int fontsize, int weight, bool italic, bool underline, bool strikethru) {
- // Create family
- fontname = new String(fontname);
- fontname.appendChar('\0');
- Gdiplus.GdipCreateFontFamilyFromName(fontname.ptr, null, &font.family);
-
- Gdiplus.FontStyle style;
- bool bold = false;
- if (weight > 600) {
- bold = true;
- }
-
- if (bold) {
- style |= Gdiplus.FontStyle.FontStyleBold;
- }
-
- if (italic) {
- style |= Gdiplus.FontStyle.FontStyleItalic;
- }
-
- if (underline) {
- style |= Gdiplus.FontStyle.FontStyleUnderline;
- }
-
- if (strikethru) {
- style |= Gdiplus.FontStyle.FontStyleStrikeout;
- }
-
- // Create font
- Gdiplus.GdipCreateFont(font.family, fontsize, style, Gdiplus.Unit.UnitPoint, &font.handle);
-
-// HDC dcz = GetDC(cast(HWND)0);
-// font.fontHandle = CreateFontW(-MulDiv(fontsize, GetDeviceCaps(dcz, 90), 72),0,0,0, weight, italic, underline, strikethru, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH, fontname.ptr);
-// ReleaseDC(cast(HWND)0, dcz);
}
void setFont(ViewPlatformVars* viewVars, FontPlatformVars* font) {
View
17 platform/win/scaffold/menu.d
@@ -26,6 +26,7 @@ import platform.vars.window;
import core.string;
import core.main;
import core.definitions;
+import core.unicode;
import io.console;
@@ -42,8 +43,8 @@ void MenuDestroy(MenuPlatformVars* menuVars) {
menuVars.hMenu = null;
}
-void MenuAppend(void* identifier, MenuPlatformVars* mnuVars, MenuPlatformVars* toAppendVars, String text, bool hasSubitems) {
- String s;
+void MenuAppend(void* identifier, MenuPlatformVars* mnuVars, MenuPlatformVars* toAppendVars, string text, bool hasSubitems) {
+ wstring s;
if (text == "") {
if (hasSubitems) {
AppendMenuW(mnuVars.hMenu,MF_SEPARATOR,cast(UINT_PTR)toAppendVars.hMenu,"\0"w.ptr);
@@ -53,8 +54,8 @@ void MenuAppend(void* identifier, MenuPlatformVars* mnuVars, MenuPlatformVars* t
}
}
else {
- s = new String(text);
- s.appendChar('\0');
+ s = Unicode.toUtf16(text);
+ s ~= '\0';
if (hasSubitems) {
AppendMenuW(mnuVars.hMenu,MF_POPUP,cast(UINT_PTR)toAppendVars.hMenu,s.ptr);
}
@@ -64,8 +65,8 @@ void MenuAppend(void* identifier, MenuPlatformVars* mnuVars, MenuPlatformVars* t
}
}
-void MenuUpdate(void* identifier, MenuPlatformVars* mnuVars, MenuPlatformVars* toUpdateVars, String text, uint position, bool hasSubitems) {
- String s;
+void MenuUpdate(void* identifier, MenuPlatformVars* mnuVars, MenuPlatformVars* toUpdateVars, string text, uint position, bool hasSubitems) {
+ wstring s;
if (text.trim() == "") {
if (hasSubitems) {
ModifyMenuW(mnuVars.hMenu,position,MF_BYPOSITION | MF_SEPARATOR,cast(UINT_PTR)toUpdateVars.hMenu,"\0"w.ptr);
@@ -75,8 +76,8 @@ void MenuUpdate(void* identifier, MenuPlatformVars* mnuVars, MenuPlatformVars* t
}
}
else {
- s = new String(text);
- s.appendChar('\0');
+ s = Unicode.toUtf16(text);
+ s ~= '\0';
if (hasSubitems) {
ModifyMenuW(mnuVars.hMenu,position,MF_BYPOSITION | MF_POPUP,cast(UINT_PTR)toUpdateVars.hMenu,s.ptr);
}
View
9 platform/win/scaffold/socket.d
@@ -20,6 +20,7 @@ import platform.vars.socket;
import core.string;
import core.main;
import core.definitions;
+import core.unicode;
import io.console;
@@ -47,7 +48,7 @@ INT GetAddrInfoW(
// SOCKET
-bool SocketOpen(ref SocketPlatformVars sockVars, ref String hostname, ref ushort port)
+bool SocketOpen(ref SocketPlatformVars sockVars, ref string hostname, ref ushort port)
{
WSADATA wsaData;
int iResult;
@@ -78,10 +79,10 @@ bool SocketOpen(ref SocketPlatformVars sockVars, ref String hostname, ref ushort
//OutputDebugStringA("getaddr start\n");
- String portstr = new String(port);
+ wstring portstr = Unicode.toUtf16(toStr(port));
- String hname = new String(hostname);
- hname.appendChar('\0');
+ wstring hname = Unicode.toUtf16(hostname);
+ hname ~= '\0';
iResult = GetAddrInfoW(hname.ptr, portstr.ptr, &hints, &result);
View
11 platform/win/scaffold/system.d
@@ -20,6 +20,7 @@ import scaffold.directory;
import core.definitions;
import core.string;
import core.locale;
+import core.unicode;
import platform.vars.library;
@@ -129,8 +130,8 @@ ulong SystemGetAvailableMemory() {
return stats.ullAvailPhys;
}
-bool SystemLoadLibrary(ref LibraryPlatformVars vars, String libraryPath) {
- wchar[] path = _ConvertFrameworkPath(libraryPath.array ~ "\0");
+bool SystemLoadLibrary(ref LibraryPlatformVars vars, string libraryPath) {
+ wchar[] path = _ConvertFrameworkPath(Unicode.toUtf16(libraryPath ~ "\0"));
vars.hmodule = LoadLibraryW(path.ptr);
return vars.hmodule !is null;
@@ -143,13 +144,13 @@ void SystemFreeLibrary(ref LibraryPlatformVars vars) {
vars.hmodule = null;
}
-void* SystemLoadLibraryProc(ref LibraryPlatformVars vars, String procName) {
+void* SystemLoadLibraryProc(ref LibraryPlatformVars vars, string procName) {
if (vars.hmodule is null) {
return null;
}
- String pn = new String(procName);
- pn.appendChar('\0');
+ wstring pn = Unicode.toUtf16(procName);
+ pn ~= '\0';
return cast(void*)GetProcAddressW(vars.hmodule, pn.ptr);
}
View
1 platform/win/scaffold/time.d
@@ -17,7 +17,6 @@ import platform.win.common;
import core.date;
import core.definitions;
import core.string;
-import core.tostring;
// Timing
View
5 platform/win/scaffold/window.d
@@ -31,6 +31,7 @@ import core.color;
import core.string;
import core.main;
import core.definitions;
+import core.unicode;
import gui.window;
@@ -322,8 +323,8 @@ void WindowSetVisible(ref Window window, WindowPlatformVars* windowVars, bool bS
}
void WindowSetTitle(ref Window window, WindowPlatformVars* windowVars) {
- String s = new String(window.text);
- s.appendChar('\0');
+ wstring s = Unicode.toUtf16(window.text);
+ s ~= '\0';
SetWindowTextW(windowVars.hWnd, cast(wchar*)s.ptr);
}
View
6,174 specs/test.d
0 additions, 6,174 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit e2f3418

Please sign in to comment.