Some TODO resolution in the Windows backend.
This commit is contained in:
parent
4444b79c30
commit
9e0ff2e000
|
@ -4,6 +4,7 @@
|
||||||
// notes:
|
// notes:
|
||||||
// - FOS_SUPPORTSTREAMABLEITEMS doesn't seem to be supported on windows vista, or at least not with the flags we use
|
// - FOS_SUPPORTSTREAMABLEITEMS doesn't seem to be supported on windows vista, or at least not with the flags we use
|
||||||
// - even with FOS_NOVALIDATE the dialogs will reject invalid filenames (at least on Vista, anyway)
|
// - even with FOS_NOVALIDATE the dialogs will reject invalid filenames (at least on Vista, anyway)
|
||||||
|
// - lack of FOS_NOREADONLYRETURN doesn't seem to matter on Windows 7
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// - http://blogs.msdn.com/b/wpfsdk/archive/2006/10/26/uncommon-dialogs--font-chooser-and-color-picker-dialogs.aspx
|
// - http://blogs.msdn.com/b/wpfsdk/archive/2006/10/26/uncommon-dialogs--font-chooser-and-color-picker-dialogs.aspx
|
||||||
|
@ -35,6 +36,8 @@ char *commonItemDialog(HWND parent, REFCLSID clsid, REFIID iid, FILEOPENDIALOGOP
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
opts |= optsadd;
|
opts |= optsadd;
|
||||||
|
// the other platforms don't check read-only; we won't either
|
||||||
|
opts &= ~FOS_NOREADONLYRETURN;
|
||||||
hr = d->SetOptions(opts);
|
hr = d->SetOptions(opts);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
logHRESULT(L"error setting options", hr);
|
logHRESULT(L"error setting options", hr);
|
||||||
|
@ -81,7 +84,6 @@ char *uiSaveFile(uiWindow *parent)
|
||||||
{
|
{
|
||||||
return commonItemDialog(windowHWND(parent),
|
return commonItemDialog(windowHWND(parent),
|
||||||
CLSID_FileSaveDialog, IID_IFileSaveDialog,
|
CLSID_FileSaveDialog, IID_IFileSaveDialog,
|
||||||
// TODO strip FOS_NOREADONLYRETURN?
|
|
||||||
FOS_OVERWRITEPROMPT | FOS_NOCHANGEDIR | FOS_ALLNONSTORAGEITEMS | FOS_NOVALIDATE | FOS_SHAREAWARE | FOS_NOTESTFILECREATE | FOS_NODEREFERENCELINKS | FOS_FORCESHOWHIDDEN | FOS_DEFAULTNOMINIMODE);
|
FOS_OVERWRITEPROMPT | FOS_NOCHANGEDIR | FOS_ALLNONSTORAGEITEMS | FOS_NOVALIDATE | FOS_SHAREAWARE | FOS_NOTESTFILECREATE | FOS_NODEREFERENCELINKS | FOS_FORCESHOWHIDDEN | FOS_DEFAULTNOMINIMODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
// 16 may 2015
|
// 16 may 2015
|
||||||
#include "uipriv_windows.hpp"
|
#include "uipriv_windows.hpp"
|
||||||
|
|
||||||
// TODO
|
// You don't add controls directly to a tab control on Windows; instead you make them siblings and swap between them on a TCN_SELCHANGING/TCN_SELCHANGE notification pair.
|
||||||
// - write comment here about how tabs and parents work
|
// In addition, you use dialogs because they can be textured properly; other controls cannot. (Things will look wrong if the tab background in the current theme is fancy if you just use the tab background by itself; see http://stackoverflow.com/questions/30087540/why-are-my-programss-tab-controls-rendering-their-background-in-a-blocky-way-b.)
|
||||||
// - make sure parent Z-orders are always above tab Z-orders
|
|
||||||
// - commit show/hide/enable/disable
|
|
||||||
|
|
||||||
struct uiTab {
|
struct uiTab {
|
||||||
uiWindowsControl c;
|
uiWindowsControl c;
|
||||||
|
@ -200,7 +198,6 @@ void uiTabInsertAt(uiTab *t, const char *name, uintmax_t n, uiControl *child)
|
||||||
page = newTabPage(child);
|
page = newTabPage(child);
|
||||||
uiWindowsEnsureSetParentHWND(page->hwnd, t->hwnd);
|
uiWindowsEnsureSetParentHWND(page->hwnd, t->hwnd);
|
||||||
t->pages->insert(t->pages->begin() + n, page);
|
t->pages->insert(t->pages->begin() + n, page);
|
||||||
// TODO adjust tabpage.cpp to set the sole control ID
|
|
||||||
tabArrangePages(t);
|
tabArrangePages(t);
|
||||||
|
|
||||||
ZeroMemory(&item, sizeof (TCITEMW));
|
ZeroMemory(&item, sizeof (TCITEMW));
|
||||||
|
|
|
@ -91,7 +91,10 @@ struct tabPage *newTabPage(uiControl *child)
|
||||||
logLastError(L"error creating tab page");
|
logLastError(L"error creating tab page");
|
||||||
|
|
||||||
tp->child = child;
|
tp->child = child;
|
||||||
uiWindowsEnsureSetParentHWND((HWND) uiControlHandle(tp->child), tp->hwnd);
|
if (tp->child != NULL) {
|
||||||
|
uiWindowsEnsureSetParentHWND((HWND) uiControlHandle(tp->child), tp->hwnd);
|
||||||
|
uiWindowsControlAssignSoleControlIDZOrder(uiWindowsControl(tp->child));
|
||||||
|
}
|
||||||
|
|
||||||
hr = EnableThemeDialogTexture(tp->hwnd, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB);
|
hr = EnableThemeDialogTexture(tp->hwnd, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
|
@ -109,7 +112,7 @@ void tabPageDestroy(struct tabPage *tp)
|
||||||
// don't destroy the child with the page
|
// don't destroy the child with the page
|
||||||
if (tp->child != NULL)
|
if (tp->child != NULL)
|
||||||
uiWindowsControlSetParentHWND(uiWindowsControl(tp->child), NULL);
|
uiWindowsControlSetParentHWND(uiWindowsControl(tp->child), NULL);
|
||||||
// TODO call EndDialog() instead?
|
// don't call EndDialog(); that's for the DialogBox() family of functions instead of CreateDialog()
|
||||||
uiWindowsEnsureDestroyWindow(tp->hwnd);
|
uiWindowsEnsureDestroyWindow(tp->hwnd);
|
||||||
uiFree(tp);
|
uiFree(tp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ enum {
|
||||||
msgNOTIFY,
|
msgNOTIFY,
|
||||||
msgHSCROLL,
|
msgHSCROLL,
|
||||||
msgQueued,
|
msgQueued,
|
||||||
// TODO convert to a function like with container
|
// TODO convert to a function like with container?
|
||||||
msgD2DScratchPaint,
|
msgD2DScratchPaint,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,7 @@ WCHAR *utf16dup(const WCHAR *orig)
|
||||||
|
|
||||||
len = wcslen(orig);
|
len = wcslen(orig);
|
||||||
out = (WCHAR *) uiAlloc((len + 1) * sizeof (WCHAR), "WCHAR[]");
|
out = (WCHAR *) uiAlloc((len + 1) * sizeof (WCHAR), "WCHAR[]");
|
||||||
// TODO safer version
|
wcscpy_s(out, len + 1, orig);
|
||||||
wcscpy(out, orig);
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +116,7 @@ WCHAR *debugvstrf(const WCHAR *format, va_list ap)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's shove these utility routines here too.
|
// Let's shove these utility routines here too.
|
||||||
|
// Prerequisite: lfonly is UTF-8.
|
||||||
char *LFtoCRLF(const char *lfonly)
|
char *LFtoCRLF(const char *lfonly)
|
||||||
{
|
{
|
||||||
char *crlf;
|
char *crlf;
|
||||||
|
@ -135,16 +135,19 @@ char *LFtoCRLF(const char *lfonly)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prerequisite: s is UTF-8.
|
||||||
void CRLFtoLF(char *s)
|
void CRLFtoLF(char *s)
|
||||||
{
|
{
|
||||||
char *t = s;
|
char *t = s;
|
||||||
|
|
||||||
for (; *s; s++) {
|
for (; *s != '\0'; s++) {
|
||||||
// be sure to preserve \rs that are genuinely there
|
// be sure to preserve \rs that are genuinely there
|
||||||
if (*s == '\r' && *(s + 1) == '\n')
|
if (*s == '\r' && *(s + 1) == '\n')
|
||||||
continue;
|
continue;
|
||||||
*t++ = *s;
|
*t++ = *s;
|
||||||
}
|
}
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
// TODO null pad t to s?
|
// pad out the rest of t, just to be safe
|
||||||
|
while (t != s)
|
||||||
|
*t++ = '\0';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue