diff --git a/windows/OLD_uipriv_attrstr.h b/windows/OLD_uipriv_attrstr.h index c494a59e..83c73b1f 100644 --- a/windows/OLD_uipriv_attrstr.h +++ b/windows/OLD_uipriv_attrstr.h @@ -12,14 +12,3 @@ extern WCHAR *fontCollectionFamilyName(fontCollection *fc, IDWriteFontFamily *fa extern void fontCollectionFree(fontCollection *fc); extern WCHAR *fontCollectionCorrectString(fontCollection *fc, IDWriteLocalizedStrings *names); -// fontdialog.cpp -struct fontDialogParams { - IDWriteFont *font; - double size; - WCHAR *familyName; - WCHAR *styleName; -}; -extern BOOL showFontDialog(HWND parent, struct fontDialogParams *params); -extern void loadInitialFontDialogParams(struct fontDialogParams *params); -extern void destroyFontDialogParams(struct fontDialogParams *params); -extern WCHAR *fontDialogParamsToString(struct fontDialogParams *params); diff --git a/windows/attrstr.hpp b/windows/attrstr.hpp index 828223eb..df143613 100644 --- a/windows/attrstr.hpp +++ b/windows/attrstr.hpp @@ -59,3 +59,15 @@ struct drawTextBackgroundParams { double b; double a; }; + +// fontdialog.cpp +struct fontDialogParams { + IDWriteFont *font; + double size; + WCHAR *familyName; + WCHAR *styleName; +}; +extern BOOL uiprivShowFontDialog(HWND parent, struct fontDialogParams *params); +extern void uiprivLoadInitialFontDialogParams(struct fontDialogParams *params); +extern void uiprivDestroyFontDialogParams(struct fontDialogParams *params); +extern WCHAR *uiprivFontDialogParamsToString(struct fontDialogParams *params); diff --git a/windows/OLD_fontbutton.cpp b/windows/fontbutton.cpp similarity index 90% rename from windows/OLD_fontbutton.cpp rename to windows/fontbutton.cpp index ab9fbe73..4f1ef594 100644 --- a/windows/OLD_fontbutton.cpp +++ b/windows/fontbutton.cpp @@ -1,5 +1,6 @@ // 14 april 2016 #include "uipriv_windows.hpp" +#include "attrstr.hpp" struct uiFontButton { uiWindowsControl c; @@ -15,7 +16,7 @@ static void uiFontButtonDestroy(uiControl *c) uiFontButton *b = uiFontButton(c); uiWindowsUnregisterWM_COMMANDHandler(b->hwnd); - destroyFontDialogParams(&(b->params)); + uiprivDestroyFontDialogParams(&(b->params)); uiWindowsEnsureDestroyWindow(b->hwnd); uiFreeControl(uiControl(b)); } @@ -24,9 +25,9 @@ static void updateFontButtonLabel(uiFontButton *b) { WCHAR *text; - text = fontDialogParamsToString(&(b->params)); + text = uiprivFontDialogParamsToString(&(b->params)); setWindowText(b->hwnd, text); - uiFree(text); + uiprivFree(text); // changing the text might necessitate a change in the button's size uiWindowsControlMinimumSizeChanged(uiWindowsControl(b)); @@ -41,7 +42,7 @@ static BOOL onWM_COMMAND(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult) return FALSE; parent = parentToplevel(b->hwnd); - if (showFontDialog(parent, &(b->params))) { + if (uiprivShowFontDialog(parent, &(b->params))) { updateFontButtonLabel(b); (*(b->onChanged))(b, b->onChangedData); } @@ -88,7 +89,7 @@ static void defaultOnChanged(uiFontButton *b, void *data) void uiFontButtonFont(uiFontButton *b, uiDrawFontDescriptor *desc) { - fontdescFromIDWriteFont(b->params.font, desc); + uiprivFontDescriptorFromIDWriteFont(b->params.font, desc); desc->Family = toUTF8(b->params.familyName); desc->Size = b->params.size; } @@ -111,7 +112,7 @@ uiFontButton *uiNewFontButton(void) hInstance, NULL, TRUE); - loadInitialFontDialogParams(&(b->params)); + uiprivLoadInitialFontDialogParams(&(b->params)); uiWindowsRegisterWM_COMMANDHandler(b->hwnd, onWM_COMMAND, uiControl(b)); uiFontButtonOnChanged(b, defaultOnChanged, NULL);