23#define WIN32_LEAN_AND_MEAN
36#include <wine/unicode.h>
53static const WCHAR wszMainWndClass[] = {
'W',
'O',
'R',
'D',
'P',
'A',
'D',
'T',
'O',
'P',0};
57const WCHAR wszPreviewWndClass[] = {
'P',
'r',
't',
'P',
'r',
'e',
'v',
'i',
'e',
'w',0};
100 static const WCHAR files_rtf[] = {
'*',
'.',
'r',
't',
'f',
'\0'};
101 static const WCHAR files_txt[] = {
'*',
'.',
't',
'x',
't',
'\0'};
102 static const WCHAR files_all[] = {
'*',
'.',
'*',
'\0'};
145 params.lpszCaption = lpCaption;
148 params.dwContextHelpId = 0;
161 button.idCommand = nCommand;
204 if(!
ret || (
cb != written))
218 if(*
pos ==
'\\' || *
pos ==
'/')
230 static const WCHAR wszSeparator[] = {
' ',
'-',
' '};
247 memcpy(wszCaption +
length, wszSeparator,
sizeof(wszSeparator));
265 while(*endptr ==
' ')
269 return *endptr ==
'\0';
292 return *endptr ==
'\0';
337 if(
lstrcmpW(sizeBuffer, wszNewFontSize))
373 static const unsigned choices[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72};
396 for(
i = 0;
i <
sizeof(choices)/
sizeof(choices[0]);
i++)
503 static const WCHAR richTextFont[] = {
'T',
'i',
'm',
'e',
's',
' ',
'N',
'e',
'w',
' ',
504 'R',
'o',
'm',
'a',
'n',0};
505 static const WCHAR plainTextFont[] = {
'C',
'o',
'u',
'r',
'i',
'e',
'r',
' ',
'N',
'e',
'w',0};
518 font = plainTextFont;
574 cf.lStructSize =
sizeof(
cf);
589 cf.rgbColors =
fmt.crTextColor;
596 fmt.yHeight =
cf.iPointSize * 2;
602 if(
cf.lpLogFont->lfUnderline)
604 if(
cf.lpLogFont->lfStrikeOut)
607 fmt.crTextColor =
cf.rgbColors;
670 barState[formatIndex] |= (1 << bandId);
672 barState[formatIndex] &= ~(1 << bandId);
692 rbbinfo.
fStyle &= ~RBBS_BREAK;
783 if(readOut >= 2 && (
BYTE)fileStart[0] == 0xff && (
BYTE)fileStart[1] == 0xfe)
787 }
else if(readOut >= 5)
789 static const char header[] =
"{\\rtf";
790 static const BYTE STG_magic[] = { 0xd0,0xcf,0x11,0xe0 };
794 else if (!
memcmp(STG_magic, fileStart,
sizeof(STG_magic)))
815 if (szOpenFileName[0])
864 static const BYTE unicode[] = {0xff,0xfe};
868 if(writeOut !=
sizeof(unicode))
914 static const WCHAR wszDefExt[] = {
'r',
't',
'f',
'\0'};
998 static const WCHAR wszDefExt[] = {
'r',
't',
'f',
'\0'};
1136 psp[0].pfnCallback =
NULL;
1138 for(
i = 1;
i <
sizeof(psp)/
sizeof(psp[0]);
i++)
1142 U(psp[
i]).pszTemplate =
U(psp[0]).pszTemplate;
1146 psp[
i].pfnCallback = psp[0].pfnCallback;
1150 psh.
dwSize =
sizeof(psh);
1155 psh.
nPages =
sizeof(psp)/
sizeof(psp[0]);
1156 U3(psh).ppsp = ppsp;
1160 U2(psh).nStartPage = 1;
1162 U2(psh).nStartPage = 0;
1254 if(custom_data->
endPos == -1) {
1255 custom_data->
endPos = sel.cpMin;
1263 if (sel.cpMin != sel.cpMax &&
1268 if (ft.chrgText.cpMin == sel.cpMin && ft.chrgText.cpMax == sel.cpMax) {
1276 ft.chrg.cpMin = sel.cpMin;
1277 if (sel.cpMin != sel.cpMax)
1292 if (ft.chrg.cpMax > ft.chrg.cpMin)
1297 custom_data->
endPos = -1;
1316 static WCHAR selBuffer[128];
1317 static WCHAR replaceBuffer[128];
1394 static const WCHAR fmt[] = {
'%',
'.',
'2',
'f',
' ',
'%',
's',
'\0'};
1731 float next_number = -1;
1732 int next_number_in_twips = -1;
1736 for(
i = 0;
i < item_count;
i++)
1741 if (insert_number <= next_number_in_twips)
1744 if (insert_number != next_number_in_twips)
1807 HWND hToolBarWnd, hFormatBarWnd, hReBarWnd, hFontListWnd, hSizeListWnd, hRulerWnd;
1811 int nStdBitmaps = 0;
1814 static const WCHAR wszRichEditDll[] = {
'R',
'I',
'C',
'H',
'E',
'D',
'2',
'0',
'.',
'D',
'L',
'L',
'\0'};
1815 static const WCHAR wszRichEditText[] = {
'R',
'i',
'c',
'h',
'E',
'd',
'i',
't',
' ',
't',
'e',
'x',
't',
'\0'};
1823 rbi.
cbSize =
sizeof(rbi);
1892 IDC_FORMATBAR, 8,
hInstance,
IDB_FORMATBAR,
NULL, 0, 16, 16, 16, 16,
sizeof(
TBBUTTON));
1975 fmt.cbSize =
sizeof(
fmt);
2031 }
else if (pHdr->
hwndFrom == hwndSizeList)
2049 sprintf(
buf,
"selection = %d..%d, line count=%ld",
2062 0x00000000L,0x00000080L,0x00008000L,0x00008080L,
2063 0x00800000L,0x00800080L,0x00808000L,0x00808080L,
2064 0x00c0c0c0L,0x000000ffL,0x0000ff00L,0x0000ffffL,
2065 0x00ff0000L,0x00ff00ffL,0x00ffff00L,0x00FFFFFFL
2197 fmt.cbSize =
sizeof(
fmt);
2212 fmt.dwEffects ^= effects;
2241 fmt.cbSize =
sizeof(
fmt);
2248 fmt.dwEffects &= ~CFE_AUTOCOLOR;
2310 cf.cbSize =
sizeof(
cf);
2492 int nAlignment = -1;
2549 int nStatusSize = 0;
2555 int rebarHeight = 0;
2672 static const WCHAR wszAccelTable[] = {
'M',
'A',
'I',
'N',
'A',
'C',
'C',
'E',
'L',
2673 'T',
'A',
'B',
'L',
'E',
'\0'};
basic_ostream< _CharT, _Traits > &_STLP_CALL endl(basic_ostream< _CharT, _Traits > &__os)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
void redraw_ruler(HWND hRulerWnd)
void print_quick(HWND hMainWnd, LPWSTR wszFileName)
LRESULT CALLBACK ruler_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
void get_default_printer_opts(void)
void target_device(HWND hMainWnd, DWORD wordWrap)
void dialog_printsetup(HWND hMainWnd)
void init_preview(HWND hMainWnd, LPWSTR wszFileName)
BOOL preview_isactive(void)
void dialog_print(HWND hMainWnd, LPWSTR wszFileName)
LRESULT preview_command(HWND hWnd, WPARAM wParam)
void close_preview(HWND hMainWnd)
int reg_formatindex(WPARAM format)
void registry_set_filelist(LPCWSTR newFile, HWND hMainWnd)
void registry_read_formatopts_all(DWORD barState[], DWORD wordWrap[])
void registry_set_formatopts_all(DWORD barState[], DWORD wordWrap[])
void registry_read_winrect(RECT *rc)
void registry_read_maximized(DWORD *bMaximized)
void registry_read_options(void)
void registry_set_options(HWND hMainWnd)
void registry_read_filelist(HWND hMainWnd)
static void dialog_about(void)
static void DoOpenFile(LPCWSTR szOpenFileName)
static void DoLoadStrings(void)
static BOOL is_bar_visible(int bandId)
static void set_toolbar_state(int bandId, BOOL show)
static const WCHAR wszMainWndClass[]
static BOOL validate_endptr(LPCWSTR endptr, UNIT *punit)
static void dialog_choose_font(void)
static HMENU hColorPopupMenu
static void populate_font_list(HWND hListWnd)
static void set_statusbar_state(BOOL show)
static void clear_formatting(void)
static void ShowOpenError(DWORD Code)
static LRESULT OnCreate(HWND hWnd)
static void number_with_units(LPWSTR buffer, int number)
static void update_size_list(void)
static void set_bar_states(void)
static int CALLBACK enum_font_proc(const LOGFONTW *lpelfe, const TEXTMETRICW *lpntme, DWORD FontType, LPARAM lParam)
static void append_current_units(LPWSTR buffer)
static LRESULT OnSize(HWND hWnd, WPARAM wParam, LPARAM lParam)
static INT_PTR CALLBACK newfile_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static int fileformat_number(WPARAM format)
static void update_window(void)
static WCHAR wszFileName[MAX_PATH]
static void AddButton(HWND hwndToolBar, int nImage, int nCommand)
static WCHAR wszDefaultFileName[MAX_STRING_LEN]
static BOOL prompt_save_changes(void)
static WCHAR units_ptW[MAX_STRING_LEN]
static void set_font(LPCWSTR wszFaceName)
static INT_PTR CALLBACK tabstops_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static WCHAR wszFilter[MAX_STRING_LEN *4+6 *3+5]
static UINT ID_FINDMSGSTRING
static void preview_exit(HWND hMainWnd)
static BOOL get_comboexlist_selection(HWND hComboEx, LPWSTR wszBuffer, UINT bufferLength)
static WCHAR units_inchW[MAX_STRING_LEN]
static WCHAR wszSaveChanges[MAX_STRING_LEN]
static void set_fileformat(WPARAM format)
static INT_PTR CALLBACK datetime_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static void dialog_viewproperties(void)
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hOldInstance, LPSTR szCmdParagraph, int nCmdShow)
static BOOL number_from_string(LPCWSTR string, float *num, UNIT *punit)
static void update_font_list(void)
static LRESULT OnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
static void add_size(HWND hSizeListWnd, unsigned size)
static void on_sizelist_modified(HWND hwndSizeList, LPWSTR wszNewFontSize)
static INT_PTR CALLBACK paraformat_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
const WCHAR wszPreviewWndClass[]
static void ShowWriteError(DWORD Code)
static void set_default_font(void)
static LRESULT OnUser(HWND hWnd)
static void dialog_find(LPFINDREPLACEW fr, BOOL replace)
static void AddSeparator(HWND hwndToolBar)
static void store_bar_state(int bandId, BOOL show)
static LRESULT OnInitPopupMenu(HWND hWnd, WPARAM wParam)
static const WCHAR stringFormat[]
static WCHAR units_inW[MAX_STRING_LEN]
static void DialogOpenFile(void)
static DWORD CALLBACK stream_out(DWORD_PTR cookie, LPBYTE buffer, LONG cb, LONG *pcb)
static void add_font(LPCWSTR fontName, DWORD fontType, HWND hListWnd, const NEWTEXTMETRICEXW *ntmc)
static BOOL DoSaveFile(LPCWSTR wszSaveFileName, WPARAM format)
static WPARAM fileformat_flags(int format)
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static void on_fontlist_modified(LPWSTR wszNewFaceName)
static int MessageBoxWithResStringW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType)
static DWORD CALLBACK stream_in(DWORD_PTR cookie, LPBYTE buffer, LONG cb, LONG *pcb)
static void populate_size_list(HWND hSizeListWnd)
LPWSTR file_basename(LPWSTR path)
static const COLORREF textcolors[]
static LRESULT handle_findmsg(LPFINDREPLACEW pFr)
static INT_PTR CALLBACK formatopts_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static void set_size(float size)
static int units_to_twips(UNIT unit, float number)
LRESULT CALLBACK preview_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
static LRESULT OnNotify(HWND hWnd, LPARAM lParam)
static const WCHAR wszAppTitle[]
static WCHAR units_cmW[MAX_STRING_LEN]
static void HandleCommandLine(LPWSTR cmdline)
static BOOL DialogSaveFile(void)
static void set_caption(LPCWSTR wszNewFileName)
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
HWND WINAPI CreateStatusWindowW(LONG style, LPCWSTR text, HWND parent, UINT wid)
HWND WINAPI CreateToolbarEx(HWND hwnd, DWORD style, UINT wID, INT nBitmaps, HINSTANCE hBMInst, UINT_PTR wBMID, LPCTBBUTTON lpButtons, INT iNumButtons, INT dxButton, INT dyButton, INT dxBitmap, INT dyBitmap, UINT uStructSize)
#define OFN_OVERWRITEPROMPT
#define CF_INITTOLOGFONTSTRUCT
#define OFN_FILEMUSTEXIST
#define OFN_PATHMUSTEXIST
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
HWND WINAPI FindTextW(LPFINDREPLACEW pfr)
HWND WINAPI ReplaceTextW(LPFINDREPLACEW pfr)
BOOL WINAPI ChooseFontW(LPCHOOSEFONTW lpChFont)
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
#define ERROR_ACCESS_DENIED
BOOL WINAPI SetEndOfFile(HANDLE hFile)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
LPWSTR WINAPI GetCommandLineW(VOID)
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
LANGID WINAPI GetUserDefaultUILanguage(void)
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
void WINAPI DragFinish(HDROP h)
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
static const WCHAR Message[]
#define wrap(journal, var)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum const GLvoid GLbitfield fontStyle
GLenum const GLfloat * params
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLenum const GLvoid * fontName
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
_Check_return_ double __cdecl wcstod(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr)
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
UCHAR ab[sizeof("Hello World!") -1]
static unsigned int number
static HMODULE MODULEINFO DWORD cb
static float(__cdecl *square_half_float)(float x
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
unsigned __int3264 UINT_PTR
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
#define STRING_TEXT_FILES_TXT
#define LOCALE_USER_DEFAULT
HRESULT setup_richedit_olecallback(HWND hEditorWnd)
#define WS_OVERLAPPEDWINDOW
png_const_structrp png_const_inforp int * unit
struct _PROPSHEETPAGEW PROPSHEETPAGEW
#define PSH_PROPSHEETPAGE
struct _PROPSHEETPAGEW * LPPROPSHEETPAGEW
const PROPSHEETPAGEW * LPCPROPSHEETPAGEW
#define REBARBANDINFOW_V6_SIZE
#define ICC_USEREX_CLASSES
#define CBEM_GETCOMBOCONTROL
#define CCS_NOPARENTALIGN
#define TB_COMMANDTOINDEX
#define IDB_STD_SMALL_COLOR
#define CBEM_GETEDITCONTROL
INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *doMore)
static const WCHAR RICHEDIT_CLASS20W[]
#define EM_GETTEXTLENGTHEX
struct _paraformat PARAFORMAT
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
void WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv)
WCHAR lfFaceName[LF_FACESIZE]
WCHAR szText[CBEMAXSTRLEN]