quickwin 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +2 -1
- package/README.md +2 -1
- package/examples/PdfCanvas.js +3 -3
- package/examples/PdfCanvas.tsx +3 -3
- package/examples/pdf_preview2.js +34 -19
- package/examples/pdf_preview2.ts +34 -20
- package/examples/pdf_viewer.js +959 -219
- package/examples/pdf_viewer.tsx +29 -19
- package/examples/test_gallery.js +925 -198
- package/examples/test_react_lazy.js +908 -181
- package/examples/test_react_listbox.js +908 -181
- package/examples/test_root_window.js +908 -181
- package/examples/test_tab.js +908 -181
- package/lib/ffi-bind.js +85 -0
- package/lib/ffi-bind.ts +170 -0
- package/lib/ffi-struct.js +224 -0
- package/lib/ffi-struct.ts +239 -0
- package/lib/react-qw/components/DateTimePicker.js +21 -15
- package/lib/react-qw/components/Link.js +4 -6
- package/lib/react-qw/components/ListView.js +84 -40
- package/lib/react-qw/components/PathPicker.js +40 -24
- package/lib/react-qw/components/Tab.js +21 -10
- package/lib/react-qw/components/Tooltip.js +27 -15
- package/lib/react-qw/components/TreeView.js +23 -33
- package/lib/react-qw/nmhdr.js +26 -0
- package/lib/react-qw/nmhdr.ts +32 -0
- package/lib/text-measure.js +14 -26
- package/lib/text-measure.ts +14 -26
- package/lib/win-common-structs.js +39 -0
- package/lib/win-common-structs.ts +41 -0
- package/package.json +1 -1
- package/quickwin.d.ts +6 -2
- package/qwin-nowasm-x86.exe +0 -0
- package/qwin-nowasm.exe +0 -0
- package/qwin-x86.exe +0 -0
- package/qwin.exe +0 -0
- package/test/run.js +2 -0
- package/test/run.ts +2 -0
- package/test/test_ffi.js +12 -8
- package/test/test_ffi.ts +12 -12
- package/test/test_ffi_bind.js +42 -0
- package/test/test_ffi_bind.ts +46 -0
- package/test/test_ffi_struct.js +201 -0
- package/test/test_ffi_struct.ts +223 -0
- package/test/test_react_complex.js +911 -184
- package/test/test_react_counter.js +908 -181
- package/test/test_react_flex.js +908 -181
- package/test/test_react_hidden.js +910 -183
- package/test/test_react_listview_link.js +908 -181
- package/test/test_react_render.js +908 -181
package/examples/pdf_viewer.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import type { Document, Page, Pixmap } from '../vendor/mupdf-wasm/mupdf.js'
|
|
|
7
7
|
import { useState } from 'react'
|
|
8
8
|
import { render, Button, Input, ScrollView } from '../lib/react-qw/index.js'
|
|
9
9
|
import { PdfCanvas } from './PdfCanvas.js'
|
|
10
|
+
import { OPENFILENAMEW } from '../lib/win-common-structs.js'
|
|
10
11
|
|
|
11
12
|
type MuPdf = typeof import('../vendor/mupdf-wasm/mupdf.js')
|
|
12
13
|
|
|
@@ -46,28 +47,37 @@ function wideToStr(buf: ArrayBuffer): string {
|
|
|
46
47
|
return String.fromCharCode(...chars)
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
function setPtr(dv: DataView, off: number, ptr: number): void {
|
|
50
|
-
dv.setUint32(off, ptr & 0xFFFFFFFF, true)
|
|
51
|
-
dv.setUint32(off + 4, Math.floor(ptr / 0x100000000), true)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
50
|
function openPdfFileDialog(owner: number): string | null {
|
|
55
|
-
const structBuf = new ArrayBuffer(152)
|
|
56
|
-
const sv = new DataView(structBuf)
|
|
57
51
|
const fileBuf = new ArrayBuffer(260 * 2)
|
|
58
52
|
const filterWide = strToWide('PDF Files\0*.pdf\0All Files\0*.*\0\0')
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
53
|
+
const ofn: ArrayBuffer & { __keep?: ArrayBuffer[] } = OPENFILENAMEW.write({
|
|
54
|
+
lStructSize: OPENFILENAMEW.size,
|
|
55
|
+
hwndOwner: owner,
|
|
56
|
+
hInstance: 0,
|
|
57
|
+
lpstrFilter: ffi.bufferPtr(filterWide),
|
|
58
|
+
lpstrCustomFilter: 0,
|
|
59
|
+
nMaxCustFilter: 0,
|
|
60
|
+
nFilterIndex: 0,
|
|
61
|
+
lpstrFile: ffi.bufferPtr(fileBuf),
|
|
62
|
+
nMaxFile: 260,
|
|
63
|
+
lpstrFileTitle: 0,
|
|
64
|
+
nMaxFileTitle: 0,
|
|
65
|
+
lpstrInitialDir: 0,
|
|
66
|
+
lpstrTitle: 0,
|
|
67
|
+
Flags: 0x1000 | 0x0800 | 0x0004,
|
|
68
|
+
nFileOffset: 0,
|
|
69
|
+
nFileExtension: 0,
|
|
70
|
+
lpstrDefExt: 0,
|
|
71
|
+
lCustData: 0,
|
|
72
|
+
lpfnHook: 0,
|
|
73
|
+
lpTemplateName: 0,
|
|
74
|
+
pvReserved: 0,
|
|
75
|
+
dwReserved: 0,
|
|
76
|
+
FlagsEx: 0,
|
|
77
|
+
})
|
|
78
|
+
ofn.__keep = [fileBuf, filterWide]
|
|
79
|
+
|
|
80
|
+
const ret = ffi.ffiCall(GetOpenFileNameW_, [FFI_PTR], [ofn], FFI_U32)
|
|
71
81
|
if (!ret) return null
|
|
72
82
|
|
|
73
83
|
const path = wideToStr(fileBuf)
|