quickwin 1.2.0 → 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 +956 -215
- package/examples/pdf_viewer.tsx +29 -19
- package/examples/test_gallery.js +922 -194
- package/examples/test_react_lazy.js +905 -177
- package/examples/test_react_listbox.js +905 -177
- package/examples/test_root_window.js +905 -177
- package/examples/test_tab.js +905 -177
- package/lib/fetch.js +35 -7
- package/lib/fetch.ts +24 -4
- 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 -24
- package/lib/text-measure.ts +14 -24
- package/lib/win-common-structs.js +39 -0
- package/lib/win-common-structs.ts +41 -0
- package/main.js +46 -0
- package/package.json +2 -1
- package/quickwin.d.ts +7 -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 +3 -0
- package/test/run.ts +3 -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_net_fetch.js +62 -0
- package/test/test_net_fetch.ts +72 -0
- package/test/test_react_complex.js +908 -180
- package/test/test_react_counter.js +905 -177
- package/test/test_react_flex.js +905 -177
- package/test/test_react_hidden.js +907 -179
- package/test/test_react_listview_link.js +905 -177
- package/test/test_react_render.js +905 -177
- package/test/test_wolfssl_read.js +201 -0
- package/test/test_wolfssl_read.ts +181 -0
|
@@ -15486,57 +15486,370 @@ function calculateFlexLayout(flex, parentW, parentH, children) {
|
|
|
15486
15486
|
}
|
|
15487
15487
|
|
|
15488
15488
|
// _build/lib/text-measure.js
|
|
15489
|
+
import * as ffi2 from "ffi";
|
|
15490
|
+
import * as gui2 from "gui";
|
|
15491
|
+
|
|
15492
|
+
// _build/lib/ffi-bind.js
|
|
15489
15493
|
import * as ffi from "ffi";
|
|
15490
15494
|
import * as win from "win";
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
|
|
15495
|
+
|
|
15496
|
+
// _build/lib/text-codec.js
|
|
15497
|
+
var _labelMap = {
|
|
15498
|
+
"utf-8": "utf-8",
|
|
15499
|
+
"utf8": "utf-8",
|
|
15500
|
+
"unicode-1-1-utf-8": "utf-8",
|
|
15501
|
+
"utf-16": "utf-16le",
|
|
15502
|
+
"utf-16le": "utf-16le",
|
|
15503
|
+
"utf-16be": "utf-16be"
|
|
15504
|
+
};
|
|
15505
|
+
function _normalizeLabel(label) {
|
|
15506
|
+
if (!label)
|
|
15507
|
+
return "utf-8";
|
|
15508
|
+
const result = _labelMap[label.trim().toLowerCase()];
|
|
15509
|
+
if (result)
|
|
15510
|
+
return result;
|
|
15511
|
+
throw new RangeError(`The encoding label "${label}" is not supported`);
|
|
15512
|
+
}
|
|
15513
|
+
function _decodeUTF8(buf, fatal) {
|
|
15514
|
+
let out = "";
|
|
15515
|
+
for (let i = 0; i < buf.length; ) {
|
|
15516
|
+
const b = buf[i++];
|
|
15517
|
+
if (b < 128) {
|
|
15518
|
+
out += String.fromCharCode(b);
|
|
15519
|
+
continue;
|
|
15520
|
+
}
|
|
15521
|
+
if (b < 192) {
|
|
15522
|
+
out += fatal ? (() => {
|
|
15523
|
+
throw new TypeError("unexpected continuation byte");
|
|
15524
|
+
})() : "\uFFFD";
|
|
15525
|
+
continue;
|
|
15526
|
+
}
|
|
15527
|
+
let c, min;
|
|
15528
|
+
if (b < 224) {
|
|
15529
|
+
if (i >= buf.length) {
|
|
15530
|
+
out += fatal ? (() => {
|
|
15531
|
+
throw new TypeError("incomplete utf-8");
|
|
15532
|
+
})() : "\uFFFD";
|
|
15533
|
+
break;
|
|
15534
|
+
}
|
|
15535
|
+
const b2 = buf[i++];
|
|
15536
|
+
if ((b2 & 192) !== 128) {
|
|
15537
|
+
out += "\uFFFD";
|
|
15538
|
+
continue;
|
|
15539
|
+
}
|
|
15540
|
+
c = (b & 31) << 6 | b2 & 63;
|
|
15541
|
+
min = 128;
|
|
15542
|
+
} else if (b < 240) {
|
|
15543
|
+
if (i + 1 >= buf.length) {
|
|
15544
|
+
out += fatal ? (() => {
|
|
15545
|
+
throw new TypeError("incomplete utf-8");
|
|
15546
|
+
})() : "\uFFFD";
|
|
15547
|
+
break;
|
|
15548
|
+
}
|
|
15549
|
+
const b2 = buf[i++];
|
|
15550
|
+
const b3 = buf[i++];
|
|
15551
|
+
if ((b2 & 192) !== 128 || (b3 & 192) !== 128) {
|
|
15552
|
+
out += "\uFFFD";
|
|
15553
|
+
continue;
|
|
15554
|
+
}
|
|
15555
|
+
c = (b & 15) << 12 | (b2 & 63) << 6 | b3 & 63;
|
|
15556
|
+
min = 2048;
|
|
15557
|
+
} else if (b < 248) {
|
|
15558
|
+
if (i + 2 >= buf.length) {
|
|
15559
|
+
out += fatal ? (() => {
|
|
15560
|
+
throw new TypeError("incomplete utf-8");
|
|
15561
|
+
})() : "\uFFFD";
|
|
15562
|
+
break;
|
|
15563
|
+
}
|
|
15564
|
+
const b2 = buf[i++];
|
|
15565
|
+
const b3 = buf[i++];
|
|
15566
|
+
const b4 = buf[i++];
|
|
15567
|
+
if ((b2 & 192) !== 128 || (b3 & 192) !== 128 || (b4 & 192) !== 128) {
|
|
15568
|
+
out += "\uFFFD";
|
|
15569
|
+
continue;
|
|
15570
|
+
}
|
|
15571
|
+
c = (b & 7) << 18 | (b2 & 63) << 12 | (b3 & 63) << 6 | b4 & 63;
|
|
15572
|
+
min = 65536;
|
|
15573
|
+
} else {
|
|
15574
|
+
out += fatal ? (() => {
|
|
15575
|
+
throw new TypeError("invalid utf-8 start");
|
|
15576
|
+
})() : "\uFFFD";
|
|
15577
|
+
continue;
|
|
15578
|
+
}
|
|
15579
|
+
if (c < min || c >= 55296 && c <= 57343 || c > 1114111) {
|
|
15580
|
+
out += fatal ? (() => {
|
|
15581
|
+
throw new TypeError("invalid utf-8 codepoint");
|
|
15582
|
+
})() : "\uFFFD";
|
|
15583
|
+
continue;
|
|
15584
|
+
}
|
|
15585
|
+
if (c <= 65535)
|
|
15586
|
+
out += String.fromCharCode(c);
|
|
15587
|
+
else {
|
|
15588
|
+
c -= 65536;
|
|
15589
|
+
out += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023);
|
|
15590
|
+
}
|
|
15591
|
+
}
|
|
15592
|
+
return out;
|
|
15593
|
+
}
|
|
15594
|
+
function _decodeUTF16(buf, le, fatal) {
|
|
15595
|
+
const dv = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
15596
|
+
let out = "";
|
|
15597
|
+
for (let i = 0; i + 1 < buf.length; i += 2) {
|
|
15598
|
+
let c = dv.getUint16(i, le);
|
|
15599
|
+
if (c >= 55296 && c <= 56319) {
|
|
15600
|
+
i += 2;
|
|
15601
|
+
if (i + 1 >= buf.length) {
|
|
15602
|
+
out += fatal ? (() => {
|
|
15603
|
+
throw new TypeError("truncated surrogate pair");
|
|
15604
|
+
})() : "\uFFFD";
|
|
15605
|
+
break;
|
|
15606
|
+
}
|
|
15607
|
+
const c2 = dv.getUint16(i, le);
|
|
15608
|
+
if (c2 >= 56320 && c2 <= 57343) {
|
|
15609
|
+
out += String.fromCharCode(c, c2);
|
|
15610
|
+
} else {
|
|
15611
|
+
out += fatal ? (() => {
|
|
15612
|
+
throw new TypeError("invalid surrogate pair");
|
|
15613
|
+
})() : "\uFFFD";
|
|
15614
|
+
i -= 2;
|
|
15615
|
+
}
|
|
15616
|
+
} else if (c >= 56320 && c <= 57343) {
|
|
15617
|
+
out += fatal ? (() => {
|
|
15618
|
+
throw new TypeError("unexpected trailing surrogate");
|
|
15619
|
+
})() : "\uFFFD";
|
|
15620
|
+
} else {
|
|
15621
|
+
out += String.fromCharCode(c);
|
|
15622
|
+
}
|
|
15623
|
+
}
|
|
15624
|
+
return out;
|
|
15625
|
+
}
|
|
15626
|
+
var TextDecoderImpl = class {
|
|
15627
|
+
_encoding;
|
|
15628
|
+
_fatal;
|
|
15629
|
+
_ignoreBOM;
|
|
15630
|
+
constructor(label, options) {
|
|
15631
|
+
this._encoding = _normalizeLabel(label);
|
|
15632
|
+
this._fatal = options?.fatal ?? false;
|
|
15633
|
+
this._ignoreBOM = options?.ignoreBOM ?? false;
|
|
15634
|
+
}
|
|
15635
|
+
get encoding() {
|
|
15636
|
+
return this._encoding;
|
|
15637
|
+
}
|
|
15638
|
+
get fatal() {
|
|
15639
|
+
return this._fatal;
|
|
15640
|
+
}
|
|
15641
|
+
get ignoreBOM() {
|
|
15642
|
+
return this._ignoreBOM;
|
|
15643
|
+
}
|
|
15644
|
+
decode(buffer) {
|
|
15645
|
+
if (!buffer)
|
|
15646
|
+
return "";
|
|
15647
|
+
const arr = buffer instanceof Uint8Array ? buffer : buffer instanceof ArrayBuffer ? new Uint8Array(buffer) : new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
15648
|
+
if (this._encoding === "utf-8") {
|
|
15649
|
+
return _decodeUTF8(arr, this._fatal);
|
|
15650
|
+
}
|
|
15651
|
+
const le = this._encoding === "utf-16le";
|
|
15652
|
+
let offset = 0;
|
|
15653
|
+
if (arr.length >= 2 && !this._ignoreBOM) {
|
|
15654
|
+
const bomLo = le ? arr[0] : arr[1];
|
|
15655
|
+
const bomHi = le ? arr[1] : arr[0];
|
|
15656
|
+
const bom = bomHi << 8 | bomLo;
|
|
15657
|
+
if (bom === 65279 || bom === 65534) {
|
|
15658
|
+
offset = 2;
|
|
15659
|
+
}
|
|
15660
|
+
}
|
|
15661
|
+
return _decodeUTF16(arr.slice(offset), le, this._fatal);
|
|
15662
|
+
}
|
|
15663
|
+
};
|
|
15664
|
+
var TextEncoderImpl = class {
|
|
15665
|
+
_encoding;
|
|
15666
|
+
constructor(label) {
|
|
15667
|
+
this._encoding = _normalizeLabel(label);
|
|
15668
|
+
}
|
|
15669
|
+
get encoding() {
|
|
15670
|
+
return this._encoding;
|
|
15671
|
+
}
|
|
15672
|
+
encode(input) {
|
|
15673
|
+
if (!input)
|
|
15674
|
+
return new Uint8Array(0);
|
|
15675
|
+
if (this._encoding === "utf-8") {
|
|
15676
|
+
const bytes = [];
|
|
15677
|
+
for (let i = 0; i < input.length; i++) {
|
|
15678
|
+
let c = input.charCodeAt(i);
|
|
15679
|
+
if (c < 128) {
|
|
15680
|
+
bytes.push(c);
|
|
15681
|
+
} else if (c < 2048) {
|
|
15682
|
+
bytes.push(192 | c >> 6, 128 | c & 63);
|
|
15683
|
+
} else if (c < 55296 || c >= 57344) {
|
|
15684
|
+
bytes.push(224 | c >> 12, 128 | c >> 6 & 63, 128 | c & 63);
|
|
15685
|
+
} else {
|
|
15686
|
+
i++;
|
|
15687
|
+
const c2 = input.charCodeAt(i);
|
|
15688
|
+
c = 65536 + ((c & 1023) << 10) | c2 & 1023;
|
|
15689
|
+
bytes.push(240 | c >> 18, 128 | c >> 12 & 63, 128 | c >> 6 & 63, 128 | c & 63);
|
|
15690
|
+
}
|
|
15691
|
+
}
|
|
15692
|
+
return new Uint8Array(bytes);
|
|
15693
|
+
}
|
|
15694
|
+
const le = this._encoding === "utf-16le";
|
|
15695
|
+
const buf = new ArrayBuffer(input.length * 2);
|
|
15696
|
+
const dv = new DataView(buf);
|
|
15697
|
+
for (let i = 0; i < input.length; i++)
|
|
15698
|
+
dv.setUint16(i * 2, input.charCodeAt(i), le);
|
|
15699
|
+
return new Uint8Array(buf);
|
|
15700
|
+
}
|
|
15701
|
+
};
|
|
15702
|
+
if (typeof globalThis.TextDecoder === "undefined") {
|
|
15703
|
+
globalThis.TextDecoder = TextDecoderImpl;
|
|
15497
15704
|
}
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
|
|
15501
|
-
|
|
15502
|
-
|
|
15503
|
-
var
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15507
|
-
|
|
15508
|
-
|
|
15705
|
+
if (typeof globalThis.TextEncoder === "undefined") {
|
|
15706
|
+
globalThis.TextEncoder = TextEncoderImpl;
|
|
15707
|
+
}
|
|
15708
|
+
|
|
15709
|
+
// _build/lib/ffi-bind.js
|
|
15710
|
+
var KIND_TO_FFI = {
|
|
15711
|
+
void: ffi.FFI_TYPE_VOID,
|
|
15712
|
+
u8: ffi.FFI_TYPE_UINT8,
|
|
15713
|
+
i8: ffi.FFI_TYPE_SINT8,
|
|
15714
|
+
u16: ffi.FFI_TYPE_UINT16,
|
|
15715
|
+
i16: ffi.FFI_TYPE_SINT16,
|
|
15716
|
+
u32: ffi.FFI_TYPE_UINT32,
|
|
15717
|
+
i32: ffi.FFI_TYPE_SINT32,
|
|
15718
|
+
u64: ffi.FFI_TYPE_UINT64,
|
|
15719
|
+
i64: ffi.FFI_TYPE_SINT64,
|
|
15720
|
+
f32: ffi.FFI_TYPE_FLOAT,
|
|
15721
|
+
f64: ffi.FFI_TYPE_DOUBLE,
|
|
15722
|
+
ptr: ffi.FFI_TYPE_POINTER,
|
|
15723
|
+
wstr: ffi.FFI_TYPE_POINTER
|
|
15724
|
+
};
|
|
15725
|
+
var C_ALIAS = {
|
|
15726
|
+
int: "i32",
|
|
15727
|
+
long: "i32",
|
|
15728
|
+
short: "i16",
|
|
15729
|
+
char: "i8",
|
|
15730
|
+
float: "f32",
|
|
15731
|
+
double: "f64",
|
|
15732
|
+
DWORD: "u32",
|
|
15733
|
+
UINT: "u32",
|
|
15734
|
+
ULONG: "u32",
|
|
15735
|
+
LONG: "i32",
|
|
15736
|
+
BOOL: "i32",
|
|
15737
|
+
HRESULT: "i32",
|
|
15738
|
+
SHORT: "i16",
|
|
15739
|
+
USHORT: "u16",
|
|
15740
|
+
BYTE: "u8",
|
|
15741
|
+
LONG_PTR: "ptr",
|
|
15742
|
+
ULONG_PTR: "ptr",
|
|
15743
|
+
INT_PTR: "ptr",
|
|
15744
|
+
UINT_PTR: "ptr",
|
|
15745
|
+
DWORD_PTR: "ptr",
|
|
15746
|
+
SIZE_T: "ptr",
|
|
15747
|
+
WPARAM: "ptr",
|
|
15748
|
+
LPARAM: "ptr",
|
|
15749
|
+
HANDLE: "ptr",
|
|
15750
|
+
HWND: "ptr",
|
|
15751
|
+
HDC: "ptr",
|
|
15752
|
+
HMODULE: "ptr",
|
|
15753
|
+
HFONT: "ptr",
|
|
15754
|
+
HBRUSH: "ptr",
|
|
15755
|
+
HICON: "ptr",
|
|
15756
|
+
HBITMAP: "ptr",
|
|
15757
|
+
LPVOID: "ptr",
|
|
15758
|
+
LPCVOID: "ptr",
|
|
15759
|
+
LPCWSTR: "ptr",
|
|
15760
|
+
PCWSTR: "ptr",
|
|
15761
|
+
LPWSTR: "ptr"
|
|
15762
|
+
};
|
|
15763
|
+
function normKind(t) {
|
|
15764
|
+
const k = C_ALIAS[t] ?? t;
|
|
15765
|
+
if (!(k in KIND_TO_FFI))
|
|
15766
|
+
throw new Error(`ffi-bind: invalid kind "${t}"`);
|
|
15767
|
+
return k;
|
|
15768
|
+
}
|
|
15769
|
+
var _dllCache = /* @__PURE__ */ new Map();
|
|
15770
|
+
function loadDll(dll) {
|
|
15771
|
+
const cached = _dllCache.get(dll);
|
|
15772
|
+
if (cached !== void 0)
|
|
15773
|
+
return cached;
|
|
15774
|
+
const loaded = win.LoadLibrary(dll);
|
|
15775
|
+
if (!loaded)
|
|
15776
|
+
throw new Error(`ffi-bind: LoadLibrary("${dll}") failed`);
|
|
15777
|
+
_dllCache.set(dll, loaded);
|
|
15778
|
+
return loaded;
|
|
15779
|
+
}
|
|
15780
|
+
function parseSig(sig) {
|
|
15781
|
+
const parts = sig.split(" -> ");
|
|
15782
|
+
const ret = parts[1];
|
|
15783
|
+
if (ret === void 0 || parts.length > 2) {
|
|
15784
|
+
throw new Error(`ffi-bind: invalid signature "${sig}" (expected "arg1 arg2 -> ret")`);
|
|
15785
|
+
}
|
|
15786
|
+
const retK = normKind(ret);
|
|
15787
|
+
if (retK === "wstr")
|
|
15788
|
+
throw new Error('ffi-bind: "wstr" cannot be a return type');
|
|
15789
|
+
const tokens = (parts[0] ?? "") === "" ? [] : parts[0].split(" ");
|
|
15790
|
+
const args = tokens.map((t) => normKind(t));
|
|
15791
|
+
return { args, ret: retK };
|
|
15792
|
+
}
|
|
15793
|
+
function makeFn(proc, sig) {
|
|
15794
|
+
const { args, ret } = parseSig(sig);
|
|
15795
|
+
const argTypes = args.map((k) => KIND_TO_FFI[k]);
|
|
15796
|
+
const retType = KIND_TO_FFI[ret];
|
|
15797
|
+
return (...a) => {
|
|
15798
|
+
const vals = args.map((k, i) => k === "wstr" ? new TextEncoder("utf-16le").encode(String(a[i]) + "\0").buffer : a[i]);
|
|
15799
|
+
return ffi.ffiCall(proc, argTypes, vals, retType);
|
|
15800
|
+
};
|
|
15801
|
+
}
|
|
15802
|
+
function bindLib(dll, map) {
|
|
15803
|
+
const out = {};
|
|
15804
|
+
const h = loadDll(dll);
|
|
15805
|
+
for (const [name, sig] of Object.entries(map)) {
|
|
15806
|
+
const proc = win.GetProcAddress(h, name);
|
|
15807
|
+
if (!proc)
|
|
15808
|
+
throw new Error(`ffi-bind: proc "${name}" not found in ${dll}`);
|
|
15809
|
+
out[name] = makeFn(proc, sig);
|
|
15810
|
+
}
|
|
15811
|
+
return out;
|
|
15812
|
+
}
|
|
15813
|
+
|
|
15814
|
+
// _build/lib/text-measure.js
|
|
15815
|
+
var user32 = bindLib("user32.dll", {
|
|
15816
|
+
DrawTextW: "ptr wstr i32 ptr i32 -> i32",
|
|
15817
|
+
GetDC: "ptr -> ptr",
|
|
15818
|
+
ReleaseDC: "ptr ptr -> i32"
|
|
15819
|
+
});
|
|
15820
|
+
var gdi32 = bindLib("gdi32.dll", {
|
|
15821
|
+
SelectObject: "ptr ptr -> ptr"
|
|
15822
|
+
});
|
|
15509
15823
|
function measureText(hdc, text, maxWidth) {
|
|
15510
|
-
const textBuf = new TextEncoder("utf-16le").encode(text + "\0").buffer;
|
|
15511
15824
|
const rect = new ArrayBuffer(16);
|
|
15512
15825
|
const dv = new DataView(rect);
|
|
15513
15826
|
dv.setInt32(8, maxWidth, true);
|
|
15514
|
-
|
|
15827
|
+
user32.DrawTextW(
|
|
15515
15828
|
hdc,
|
|
15516
|
-
|
|
15829
|
+
text,
|
|
15517
15830
|
-1,
|
|
15518
15831
|
rect,
|
|
15519
15832
|
1024
|
|
15520
15833
|
/* gui.DrawTextFlag.CALCRECT */
|
|
15521
|
-
|
|
15834
|
+
);
|
|
15522
15835
|
return { width: dv.getInt32(8, true), height: dv.getInt32(12, true) };
|
|
15523
15836
|
}
|
|
15524
15837
|
function getButtonIdealSize(hwnd) {
|
|
15525
15838
|
const size = new ArrayBuffer(8);
|
|
15526
|
-
gui2.SendMessage(hwnd, 5633, 0,
|
|
15839
|
+
gui2.SendMessage(hwnd, 5633, 0, ffi2.bufferPtr(size));
|
|
15527
15840
|
const dv = new DataView(size);
|
|
15528
15841
|
return { width: dv.getInt32(0, true), height: dv.getInt32(4, true) };
|
|
15529
15842
|
}
|
|
15530
15843
|
function measureTextForHwnd(hwnd, text) {
|
|
15531
|
-
const hdc =
|
|
15844
|
+
const hdc = user32.GetDC(hwnd);
|
|
15532
15845
|
if (!hdc)
|
|
15533
15846
|
return { width: 0, height: 0 };
|
|
15534
15847
|
const hFont = gui2.SendMessage(hwnd, 49, 0, 0);
|
|
15535
|
-
const oldFont = hFont ?
|
|
15848
|
+
const oldFont = hFont ? gdi32.SelectObject(hdc, hFont) : 0;
|
|
15536
15849
|
const result = measureText(hdc, text, 0);
|
|
15537
15850
|
if (hFont)
|
|
15538
|
-
|
|
15539
|
-
|
|
15851
|
+
gdi32.SelectObject(hdc, oldFont);
|
|
15852
|
+
user32.ReleaseDC(hwnd, hdc);
|
|
15540
15853
|
const wr = gui2.GetWindowRect(hwnd);
|
|
15541
15854
|
const cr = gui2.GetClientRect(hwnd);
|
|
15542
15855
|
if (wr && cr) {
|
|
@@ -16019,15 +16332,285 @@ var ComboBox = (0, import_react4.forwardRef)(({ items, selectedIndex: controlled
|
|
|
16019
16332
|
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
|
16020
16333
|
var import_react5 = __toESM(require_react(), 1);
|
|
16021
16334
|
import * as gui6 from "gui";
|
|
16022
|
-
import * as
|
|
16023
|
-
|
|
16024
|
-
|
|
16335
|
+
import * as ffi4 from "ffi";
|
|
16336
|
+
|
|
16337
|
+
// _build/lib/ffi-struct.js
|
|
16338
|
+
import * as os2 from "os";
|
|
16339
|
+
var PTR = os2.arch === "x64" ? 8 : 4;
|
|
16340
|
+
var AS = {
|
|
16341
|
+
u8: [1, 1],
|
|
16342
|
+
i8: [1, 1],
|
|
16343
|
+
u16: [2, 2],
|
|
16344
|
+
i16: [2, 2],
|
|
16345
|
+
u32: [4, 4],
|
|
16346
|
+
i32: [4, 4],
|
|
16347
|
+
u64: [8, 8],
|
|
16348
|
+
i64: [8, 8],
|
|
16349
|
+
f32: [4, 4],
|
|
16350
|
+
f64: [8, 8],
|
|
16351
|
+
ptr: [PTR, PTR],
|
|
16352
|
+
wstr: [2, 2]
|
|
16353
|
+
// 仅定长数组元素用(wchar)
|
|
16354
|
+
};
|
|
16355
|
+
function alignUp(v, a) {
|
|
16356
|
+
return v + a - 1 & ~(a - 1);
|
|
16025
16357
|
}
|
|
16026
|
-
function
|
|
16027
|
-
|
|
16358
|
+
function parseField(f) {
|
|
16359
|
+
const arr = /^(.+)\[(\d+)\]$/.exec(f);
|
|
16360
|
+
if (arr) {
|
|
16361
|
+
const b2 = normKind(arr[1]);
|
|
16362
|
+
if (b2 === "void")
|
|
16363
|
+
throw new Error(`ffi-struct: "void" cannot be an array base`);
|
|
16364
|
+
return { base: b2, count: Number(arr[2]) };
|
|
16365
|
+
}
|
|
16366
|
+
const b = normKind(f);
|
|
16367
|
+
if (b === "void" || b === "wstr")
|
|
16368
|
+
throw new Error(`ffi-struct: invalid scalar field type "${f}"`);
|
|
16369
|
+
return { base: b, count: 1 };
|
|
16370
|
+
}
|
|
16371
|
+
function layout(def) {
|
|
16372
|
+
const fields = [];
|
|
16373
|
+
let cursor = 0;
|
|
16374
|
+
let maxAlign = 1;
|
|
16375
|
+
for (const key of Object.keys(def)) {
|
|
16376
|
+
const v = def[key];
|
|
16377
|
+
let a;
|
|
16378
|
+
let w;
|
|
16379
|
+
if (typeof v === "string") {
|
|
16380
|
+
const { base, count } = parseField(v);
|
|
16381
|
+
const [align, elem] = AS[base];
|
|
16382
|
+
a = align;
|
|
16383
|
+
w = count >= 1 ? elem * count : elem;
|
|
16384
|
+
fields.push({ name: key, base, count, offset: 0 });
|
|
16385
|
+
} else {
|
|
16386
|
+
const child = v;
|
|
16387
|
+
a = child.structAlign;
|
|
16388
|
+
w = child.size;
|
|
16389
|
+
fields.push({ name: key, base: "u8", count: 0, offset: 0, child });
|
|
16390
|
+
}
|
|
16391
|
+
const off = alignUp(cursor, a);
|
|
16392
|
+
const f = fields[fields.length - 1];
|
|
16393
|
+
f.offset = off;
|
|
16394
|
+
cursor = off + w;
|
|
16395
|
+
if (a > maxAlign)
|
|
16396
|
+
maxAlign = a;
|
|
16397
|
+
}
|
|
16398
|
+
return { fields, size: alignUp(cursor, maxAlign), structAlign: maxAlign };
|
|
16399
|
+
}
|
|
16400
|
+
var _layoutCache = /* @__PURE__ */ new WeakMap();
|
|
16401
|
+
function buildLayout(def) {
|
|
16402
|
+
let hit = _layoutCache.get(def);
|
|
16403
|
+
if (hit)
|
|
16404
|
+
return hit;
|
|
16405
|
+
hit = layout(def);
|
|
16406
|
+
_layoutCache.set(def, hit);
|
|
16407
|
+
return hit;
|
|
16408
|
+
}
|
|
16409
|
+
function readScalar(dv, off, k) {
|
|
16410
|
+
switch (k) {
|
|
16411
|
+
case "u8":
|
|
16412
|
+
return dv.getUint8(off);
|
|
16413
|
+
case "i8":
|
|
16414
|
+
return dv.getInt8(off);
|
|
16415
|
+
case "u16":
|
|
16416
|
+
return dv.getUint16(off, true);
|
|
16417
|
+
case "i16":
|
|
16418
|
+
return dv.getInt16(off, true);
|
|
16419
|
+
case "u32":
|
|
16420
|
+
return dv.getUint32(off, true);
|
|
16421
|
+
case "i32":
|
|
16422
|
+
return dv.getInt32(off, true);
|
|
16423
|
+
case "u64":
|
|
16424
|
+
return Number(dv.getBigUint64(off, true));
|
|
16425
|
+
case "i64":
|
|
16426
|
+
return Number(dv.getBigInt64(off, true));
|
|
16427
|
+
case "f32":
|
|
16428
|
+
return dv.getFloat32(off, true);
|
|
16429
|
+
case "f64":
|
|
16430
|
+
return dv.getFloat64(off, true);
|
|
16431
|
+
case "ptr":
|
|
16432
|
+
return readPtr(dv, off);
|
|
16433
|
+
case "wstr":
|
|
16434
|
+
return dv.getUint16(off, true);
|
|
16435
|
+
}
|
|
16028
16436
|
}
|
|
16437
|
+
function readPtr(dv, off) {
|
|
16438
|
+
if (PTR === 8)
|
|
16439
|
+
return Number(dv.getBigUint64(off, true));
|
|
16440
|
+
return dv.getUint32(off, true);
|
|
16441
|
+
}
|
|
16442
|
+
function writeScalar(dv, off, k, val) {
|
|
16443
|
+
switch (k) {
|
|
16444
|
+
case "u8":
|
|
16445
|
+
dv.setUint8(off, val);
|
|
16446
|
+
break;
|
|
16447
|
+
case "i8":
|
|
16448
|
+
dv.setInt8(off, val);
|
|
16449
|
+
break;
|
|
16450
|
+
case "u16":
|
|
16451
|
+
dv.setUint16(off, val, true);
|
|
16452
|
+
break;
|
|
16453
|
+
case "i16":
|
|
16454
|
+
dv.setInt16(off, val, true);
|
|
16455
|
+
break;
|
|
16456
|
+
case "u32":
|
|
16457
|
+
dv.setUint32(off, val >>> 0, true);
|
|
16458
|
+
break;
|
|
16459
|
+
case "i32":
|
|
16460
|
+
dv.setInt32(off, val | 0, true);
|
|
16461
|
+
break;
|
|
16462
|
+
case "u64":
|
|
16463
|
+
dv.setBigUint64(off, BigInt(Math.trunc(val)), true);
|
|
16464
|
+
break;
|
|
16465
|
+
case "i64":
|
|
16466
|
+
dv.setBigInt64(off, BigInt(Math.trunc(val)), true);
|
|
16467
|
+
break;
|
|
16468
|
+
case "f32":
|
|
16469
|
+
dv.setFloat32(off, val, true);
|
|
16470
|
+
break;
|
|
16471
|
+
case "f64":
|
|
16472
|
+
dv.setFloat64(off, val, true);
|
|
16473
|
+
break;
|
|
16474
|
+
case "ptr":
|
|
16475
|
+
writePtr(dv, off, val);
|
|
16476
|
+
break;
|
|
16477
|
+
case "wstr":
|
|
16478
|
+
dv.setUint16(off, val, true);
|
|
16479
|
+
break;
|
|
16480
|
+
}
|
|
16481
|
+
}
|
|
16482
|
+
function writePtr(dv, off, val) {
|
|
16483
|
+
if (PTR === 8)
|
|
16484
|
+
dv.setBigUint64(off, BigInt(Math.trunc(val)), true);
|
|
16485
|
+
else
|
|
16486
|
+
dv.setUint32(off, val >>> 0, true);
|
|
16487
|
+
}
|
|
16488
|
+
function readField(dv, base, f) {
|
|
16489
|
+
const off = base + f.offset;
|
|
16490
|
+
if (f.child)
|
|
16491
|
+
return readInto(f.child, dv.buffer, off);
|
|
16492
|
+
if (f.count > 1) {
|
|
16493
|
+
if (f.base === "wstr") {
|
|
16494
|
+
const arr = new Uint16Array(dv.buffer, dv.byteOffset + off, f.count);
|
|
16495
|
+
let end = 0;
|
|
16496
|
+
while (end < arr.length && arr[end] !== 0)
|
|
16497
|
+
end++;
|
|
16498
|
+
let s = "";
|
|
16499
|
+
for (let i = 0; i < end; i++)
|
|
16500
|
+
s += String.fromCharCode(arr[i]);
|
|
16501
|
+
return s;
|
|
16502
|
+
}
|
|
16503
|
+
const out = [];
|
|
16504
|
+
const step = AS[f.base][1];
|
|
16505
|
+
for (let i = 0; i < f.count; i++)
|
|
16506
|
+
out.push(readScalar(dv, off + i * step, f.base));
|
|
16507
|
+
return out;
|
|
16508
|
+
}
|
|
16509
|
+
return readScalar(dv, off, f.base);
|
|
16510
|
+
}
|
|
16511
|
+
function writeField(dv, base, f, v) {
|
|
16512
|
+
const off = base + f.offset;
|
|
16513
|
+
if (f.child) {
|
|
16514
|
+
writeInto(f.child, v, dv.buffer, off);
|
|
16515
|
+
return;
|
|
16516
|
+
}
|
|
16517
|
+
if (f.count > 1) {
|
|
16518
|
+
if (f.base === "wstr") {
|
|
16519
|
+
const s = String(v ?? "");
|
|
16520
|
+
const arr = new Uint16Array(dv.buffer, dv.byteOffset + off, f.count);
|
|
16521
|
+
for (let i = 0; i < arr.length; i++)
|
|
16522
|
+
arr[i] = 0;
|
|
16523
|
+
const n = Math.min(s.length, f.count - 1);
|
|
16524
|
+
for (let i = 0; i < n; i++)
|
|
16525
|
+
arr[i] = s.charCodeAt(i);
|
|
16526
|
+
return;
|
|
16527
|
+
}
|
|
16528
|
+
const step = AS[f.base][1];
|
|
16529
|
+
const list = v ?? [];
|
|
16530
|
+
for (let i = 0; i < f.count; i++)
|
|
16531
|
+
writeScalar(dv, off + i * step, f.base, list[i] ?? 0);
|
|
16532
|
+
return;
|
|
16533
|
+
}
|
|
16534
|
+
writeScalar(dv, off, f.base, Number(v));
|
|
16535
|
+
}
|
|
16536
|
+
function doSize(def) {
|
|
16537
|
+
return buildLayout(def).size;
|
|
16538
|
+
}
|
|
16539
|
+
function readInto(child, buf, offset) {
|
|
16540
|
+
const r = child;
|
|
16541
|
+
return r.read(buf, offset);
|
|
16542
|
+
}
|
|
16543
|
+
function doRead(_def, fields, buf, offset) {
|
|
16544
|
+
const out = {};
|
|
16545
|
+
const dv = new DataView(buf);
|
|
16546
|
+
for (const f of fields)
|
|
16547
|
+
out[f.name] = readField(dv, offset, f);
|
|
16548
|
+
return out;
|
|
16549
|
+
}
|
|
16550
|
+
function doWrite(def, fields, v, buf, offset = 0) {
|
|
16551
|
+
buf = buf ?? new ArrayBuffer(doSize(def));
|
|
16552
|
+
const dv = new DataView(buf);
|
|
16553
|
+
for (const f of fields)
|
|
16554
|
+
writeField(dv, offset, f, v[f.name]);
|
|
16555
|
+
return buf;
|
|
16556
|
+
}
|
|
16557
|
+
function writeInto(child, v, buf, offset) {
|
|
16558
|
+
const w = child;
|
|
16559
|
+
w.write(v, buf, offset);
|
|
16560
|
+
}
|
|
16561
|
+
function struct(def) {
|
|
16562
|
+
const { fields, size, structAlign } = buildLayout(def);
|
|
16563
|
+
return {
|
|
16564
|
+
__fields: def,
|
|
16565
|
+
size,
|
|
16566
|
+
structAlign,
|
|
16567
|
+
read: (buf, offset = 0) => doRead(def, fields, buf, offset),
|
|
16568
|
+
write: (v, buf, offset = 0) => doWrite(def, fields, v, buf, offset),
|
|
16569
|
+
offsetOf: (name) => {
|
|
16570
|
+
for (const f of fields)
|
|
16571
|
+
if (f.name === name)
|
|
16572
|
+
return f.offset;
|
|
16573
|
+
throw new Error(`ffi-struct: no field "${String(name)}"`);
|
|
16574
|
+
}
|
|
16575
|
+
};
|
|
16576
|
+
}
|
|
16577
|
+
|
|
16578
|
+
// _build/lib/react-qw/nmhdr.js
|
|
16579
|
+
import * as os3 from "os";
|
|
16580
|
+
import * as ffi3 from "ffi";
|
|
16581
|
+
var IS64 = os3.arch === "x64";
|
|
16582
|
+
var PTR_SIZE = IS64 ? 8 : 4;
|
|
16583
|
+
var NMHDR = struct({ hwndFrom: "ptr", idFrom: "ptr", code: "i32" });
|
|
16584
|
+
var NMHDR_SIZE = NMHDR.size;
|
|
16585
|
+
var NMHDR_CODE = NMHDR.offsetOf("code");
|
|
16586
|
+
function readI32At(ptr, offset) {
|
|
16587
|
+
return ffi3.readByte(ptr + offset) | ffi3.readByte(ptr + offset + 1) << 8 | ffi3.readByte(ptr + offset + 2) << 16 | ffi3.readByte(ptr + offset + 3) << 24;
|
|
16588
|
+
}
|
|
16589
|
+
function readU16At(ptr, offset) {
|
|
16590
|
+
return ffi3.readByte(ptr + offset) | ffi3.readByte(ptr + offset + 1) << 8;
|
|
16591
|
+
}
|
|
16592
|
+
function nmCode(lParam) {
|
|
16593
|
+
return readI32At(lParam, NMHDR_CODE);
|
|
16594
|
+
}
|
|
16595
|
+
|
|
16596
|
+
// _build/lib/react-qw/components/DateTimePicker.js
|
|
16597
|
+
var SYSTEMTIME = struct({
|
|
16598
|
+
wYear: "u16",
|
|
16599
|
+
wMonth: "u16",
|
|
16600
|
+
wDayOfWeek: "u16",
|
|
16601
|
+
wDay: "u16",
|
|
16602
|
+
wHour: "u16",
|
|
16603
|
+
wMinute: "u16",
|
|
16604
|
+
wSecond: "u16",
|
|
16605
|
+
wMilliseconds: "u16"
|
|
16606
|
+
});
|
|
16607
|
+
var NMDATETIMECHANGE = struct({
|
|
16608
|
+
hdr: NMHDR,
|
|
16609
|
+
dwFlags: "u32",
|
|
16610
|
+
st: SYSTEMTIME
|
|
16611
|
+
});
|
|
16029
16612
|
function bufPtr(buf) {
|
|
16030
|
-
return
|
|
16613
|
+
return ffi4.bufferPtr(buf);
|
|
16031
16614
|
}
|
|
16032
16615
|
function dateToSysTimeBuf(d) {
|
|
16033
16616
|
const buf = new ArrayBuffer(16);
|
|
@@ -16084,20 +16667,21 @@ var DateTimePicker = (0, import_react5.forwardRef)(function DateTimePicker2({ va
|
|
|
16084
16667
|
}, []);
|
|
16085
16668
|
return (0, import_jsx_runtime4.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
|
|
16086
16669
|
if (e.msg === 78) {
|
|
16087
|
-
const code =
|
|
16670
|
+
const code = nmCode(e.lParam);
|
|
16088
16671
|
if (code === -759) {
|
|
16089
|
-
const
|
|
16672
|
+
const st = NMDATETIMECHANGE.offsetOf("st");
|
|
16673
|
+
const dwFlags = readI32At(e.lParam, NMDATETIMECHANGE.offsetOf("dwFlags"));
|
|
16090
16674
|
if (dwFlags === 1) {
|
|
16091
16675
|
if (!isControlled)
|
|
16092
16676
|
setInternalDate(null);
|
|
16093
16677
|
onChangeRef.current?.(null);
|
|
16094
16678
|
} else {
|
|
16095
|
-
const year =
|
|
16096
|
-
const month =
|
|
16097
|
-
const day =
|
|
16098
|
-
const hour =
|
|
16099
|
-
const min =
|
|
16100
|
-
const sec =
|
|
16679
|
+
const year = readU16At(e.lParam, st + 0);
|
|
16680
|
+
const month = readU16At(e.lParam, st + 2);
|
|
16681
|
+
const day = readU16At(e.lParam, st + 6);
|
|
16682
|
+
const hour = readU16At(e.lParam, st + 8);
|
|
16683
|
+
const min = readU16At(e.lParam, st + 10);
|
|
16684
|
+
const sec = readU16At(e.lParam, st + 12);
|
|
16101
16685
|
const d = new Date(year, month - 1, day, hour, min, sec);
|
|
16102
16686
|
if (!isControlled)
|
|
16103
16687
|
setInternalDate(d);
|
|
@@ -16114,7 +16698,7 @@ var DateTimePicker = (0, import_react5.forwardRef)(function DateTimePicker2({ va
|
|
|
16114
16698
|
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
|
|
16115
16699
|
var import_react6 = __toESM(require_react(), 1);
|
|
16116
16700
|
import * as gui7 from "gui";
|
|
16117
|
-
import * as
|
|
16701
|
+
import * as ffi5 from "ffi";
|
|
16118
16702
|
function textToUtf16(s) {
|
|
16119
16703
|
const buf = new ArrayBuffer((s.length + 1) * 2);
|
|
16120
16704
|
const dv = new DataView(buf);
|
|
@@ -16141,7 +16725,7 @@ var Input = (0, import_react6.forwardRef)(({ value: controlledValue, defaultValu
|
|
|
16141
16725
|
if (!h || !placeholder)
|
|
16142
16726
|
return;
|
|
16143
16727
|
const buf = textToUtf16(placeholder);
|
|
16144
|
-
gui7.SendMessage(h, 5377, 1,
|
|
16728
|
+
gui7.SendMessage(h, 5377, 1, ffi5.bufferPtr(buf));
|
|
16145
16729
|
}, [placeholder]);
|
|
16146
16730
|
return (0, import_jsx_runtime5.jsx)("w", { type: "EDIT", text: displayValue, ws, style, disabled, ref: (h) => {
|
|
16147
16731
|
inputRef.current = h;
|
|
@@ -16166,15 +16750,12 @@ var Input = (0, import_react6.forwardRef)(({ value: controlledValue, defaultValu
|
|
|
16166
16750
|
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
|
|
16167
16751
|
var import_react7 = __toESM(require_react(), 1);
|
|
16168
16752
|
import * as gui8 from "gui";
|
|
16169
|
-
import * as
|
|
16170
|
-
function readI322(ptr, offset) {
|
|
16171
|
-
return ffi4.readByte(ptr + offset) | ffi4.readByte(ptr + offset + 1) << 8 | ffi4.readByte(ptr + offset + 2) << 16 | ffi4.readByte(ptr + offset + 3) << 24;
|
|
16172
|
-
}
|
|
16753
|
+
import * as ffi6 from "ffi";
|
|
16173
16754
|
function readUtf16(ptr, offset, maxWords) {
|
|
16174
16755
|
const chars = [];
|
|
16175
16756
|
for (let i = 0; i < maxWords; i++) {
|
|
16176
|
-
const lo =
|
|
16177
|
-
const hi =
|
|
16757
|
+
const lo = ffi6.readByte(ptr + offset + i * 2);
|
|
16758
|
+
const hi = ffi6.readByte(ptr + offset + i * 2 + 1);
|
|
16178
16759
|
const code = hi << 8 | lo;
|
|
16179
16760
|
if (code === 0)
|
|
16180
16761
|
break;
|
|
@@ -16196,9 +16777,9 @@ var Link = (0, import_react7.forwardRef)(function Link2({ href, children, onClic
|
|
|
16196
16777
|
}, [linkText]);
|
|
16197
16778
|
return (0, import_jsx_runtime6.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
|
|
16198
16779
|
if (e.msg === 78) {
|
|
16199
|
-
const code =
|
|
16780
|
+
const code = nmCode(e.lParam);
|
|
16200
16781
|
if (code === -2 || code === -4) {
|
|
16201
|
-
const url = readUtf16(e.lParam,
|
|
16782
|
+
const url = readUtf16(e.lParam, NMHDR_SIZE + 112, 2048);
|
|
16202
16783
|
onClickRef.current?.(url);
|
|
16203
16784
|
}
|
|
16204
16785
|
}
|
|
@@ -16259,7 +16840,7 @@ var ListBox = (0, import_react8.forwardRef)(({ items, selectedIndex: controlledI
|
|
|
16259
16840
|
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
|
|
16260
16841
|
var import_react9 = __toESM(require_react(), 1);
|
|
16261
16842
|
import * as gui10 from "gui";
|
|
16262
|
-
import * as
|
|
16843
|
+
import * as ffi7 from "ffi";
|
|
16263
16844
|
import * as win2 from "win";
|
|
16264
16845
|
function textToUtf162(s) {
|
|
16265
16846
|
const buf = new ArrayBuffer((s.length + 1) * 2);
|
|
@@ -16268,11 +16849,11 @@ function textToUtf162(s) {
|
|
|
16268
16849
|
dv.setUint16(i * 2, s.charCodeAt(i), true);
|
|
16269
16850
|
return buf;
|
|
16270
16851
|
}
|
|
16271
|
-
function
|
|
16272
|
-
return
|
|
16852
|
+
function readI32(ptr, offset) {
|
|
16853
|
+
return ffi7.readByte(ptr + offset) | ffi7.readByte(ptr + offset + 1) << 8 | ffi7.readByte(ptr + offset + 2) << 16 | ffi7.readByte(ptr + offset + 3) << 24;
|
|
16273
16854
|
}
|
|
16274
16855
|
function readU32(ptr, offset) {
|
|
16275
|
-
return
|
|
16856
|
+
return ffi7.readByte(ptr + offset) | ffi7.readByte(ptr + offset + 1) << 8 | ffi7.readByte(ptr + offset + 2) << 16 | ffi7.readByte(ptr + offset + 3) << 24 >>> 0;
|
|
16276
16857
|
}
|
|
16277
16858
|
function readU64(ptr, offset) {
|
|
16278
16859
|
const lo = readU32(ptr, offset);
|
|
@@ -16280,24 +16861,87 @@ function readU64(ptr, offset) {
|
|
|
16280
16861
|
return lo + hi * 4294967296;
|
|
16281
16862
|
}
|
|
16282
16863
|
function writeU32(ptr, offset, v) {
|
|
16283
|
-
|
|
16284
|
-
|
|
16285
|
-
|
|
16286
|
-
|
|
16864
|
+
ffi7.writeByte(ptr + offset, v & 255);
|
|
16865
|
+
ffi7.writeByte(ptr + offset + 1, v >> 8 & 255);
|
|
16866
|
+
ffi7.writeByte(ptr + offset + 2, v >> 16 & 255);
|
|
16867
|
+
ffi7.writeByte(ptr + offset + 3, v >> 24 & 255);
|
|
16287
16868
|
}
|
|
16288
16869
|
function bufPtr2(buf) {
|
|
16289
|
-
return
|
|
16870
|
+
return ffi7.bufferPtr(buf);
|
|
16290
16871
|
}
|
|
16291
16872
|
var LV_WS = 268435456 | 8388608 | 2097152 | 1048576 | 1 | 4;
|
|
16292
|
-
var
|
|
16293
|
-
|
|
16294
|
-
|
|
16295
|
-
|
|
16296
|
-
|
|
16297
|
-
|
|
16298
|
-
|
|
16299
|
-
|
|
16300
|
-
|
|
16873
|
+
var NMCUSTOMDRAW = struct({
|
|
16874
|
+
hdr: NMHDR,
|
|
16875
|
+
dwDrawStage: "u32",
|
|
16876
|
+
hdc: "ptr",
|
|
16877
|
+
rc: "i32[4]",
|
|
16878
|
+
dwItemSpec: "ptr",
|
|
16879
|
+
uItemState: "u32",
|
|
16880
|
+
lItemlParam: "ptr"
|
|
16881
|
+
});
|
|
16882
|
+
var NMLVCUSTOMDRAW = struct({
|
|
16883
|
+
hdr: NMHDR,
|
|
16884
|
+
dwDrawStage: "u32",
|
|
16885
|
+
hdc: "ptr",
|
|
16886
|
+
rc: "i32[4]",
|
|
16887
|
+
dwItemSpec: "ptr",
|
|
16888
|
+
uItemState: "u32",
|
|
16889
|
+
lItemlParam: "ptr",
|
|
16890
|
+
clrText: "u32",
|
|
16891
|
+
clrTextBk: "u32",
|
|
16892
|
+
iSubItem: "i32",
|
|
16893
|
+
dwItemType: "u32"
|
|
16894
|
+
});
|
|
16895
|
+
var NMLISTVIEW = struct({
|
|
16896
|
+
hdr: NMHDR,
|
|
16897
|
+
iItem: "i32",
|
|
16898
|
+
iSubItem: "i32",
|
|
16899
|
+
uNewState: "u32",
|
|
16900
|
+
uOldState: "u32",
|
|
16901
|
+
uChanged: "u32",
|
|
16902
|
+
ptAction: "i32[2]",
|
|
16903
|
+
lParam: "ptr"
|
|
16904
|
+
});
|
|
16905
|
+
var CD_STAGE = NMCUSTOMDRAW.offsetOf("dwDrawStage");
|
|
16906
|
+
var CD_HDC = NMCUSTOMDRAW.offsetOf("hdc");
|
|
16907
|
+
var CD_ITEM = NMCUSTOMDRAW.offsetOf("dwItemSpec");
|
|
16908
|
+
var CD_CLRTEXT = NMLVCUSTOMDRAW.offsetOf("clrText");
|
|
16909
|
+
var CD_CLRTEXTBK = NMLVCUSTOMDRAW.offsetOf("clrTextBk");
|
|
16910
|
+
var CD_SUBITEM = NMLVCUSTOMDRAW.offsetOf("iSubItem");
|
|
16911
|
+
var NMIA_ITEM = NMLISTVIEW.offsetOf("iItem");
|
|
16912
|
+
var NMIA_SUBITEM = NMLISTVIEW.offsetOf("iSubItem");
|
|
16913
|
+
var NMLV_UNEW = NMLISTVIEW.offsetOf("uNewState");
|
|
16914
|
+
var NMLV_UOLD = NMLISTVIEW.offsetOf("uOldState");
|
|
16915
|
+
var LVITEMW = struct({
|
|
16916
|
+
mask: "u32",
|
|
16917
|
+
iItem: "i32",
|
|
16918
|
+
iSubItem: "i32",
|
|
16919
|
+
state: "u32",
|
|
16920
|
+
stateMask: "u32",
|
|
16921
|
+
pszText: "ptr",
|
|
16922
|
+
cchTextMax: "i32",
|
|
16923
|
+
iImage: "i32",
|
|
16924
|
+
lParam: "ptr",
|
|
16925
|
+
iIndent: "i32",
|
|
16926
|
+
iGroupId: "i32",
|
|
16927
|
+
cColumns: "u32",
|
|
16928
|
+
puColumns: "ptr",
|
|
16929
|
+
piColFmt: "ptr",
|
|
16930
|
+
iGroup: "i32"
|
|
16931
|
+
});
|
|
16932
|
+
var LVCOLUMNW = struct({
|
|
16933
|
+
mask: "u32",
|
|
16934
|
+
fmt: "i32",
|
|
16935
|
+
cx: "i32",
|
|
16936
|
+
pszText: "ptr",
|
|
16937
|
+
cchTextMax: "i32",
|
|
16938
|
+
iSubItem: "i32",
|
|
16939
|
+
iImage: "i32",
|
|
16940
|
+
iOrder: "i32",
|
|
16941
|
+
cxMin: "i32",
|
|
16942
|
+
cxDefault: "i32",
|
|
16943
|
+
cxIdeal: "i32"
|
|
16944
|
+
});
|
|
16301
16945
|
var fontCache = /* @__PURE__ */ new Map();
|
|
16302
16946
|
var gdi322 = null;
|
|
16303
16947
|
var createFontIndirectW = null;
|
|
@@ -16341,7 +16985,7 @@ function getCellFont(hwnd, style) {
|
|
|
16341
16985
|
const dv = new DataView(lf);
|
|
16342
16986
|
const cur = gui10.SendMessage(hwnd, 49, 0, 0);
|
|
16343
16987
|
if (cur) {
|
|
16344
|
-
const got =
|
|
16988
|
+
const got = ffi7.ffiCall(getObjectW, [ffi7.FFI_TYPE_POINTER, ffi7.FFI_TYPE_SINT32, ffi7.FFI_TYPE_POINTER], [cur, 92, lf], ffi7.FFI_TYPE_SINT32);
|
|
16345
16989
|
if (!got)
|
|
16346
16990
|
return null;
|
|
16347
16991
|
} else {
|
|
@@ -16353,9 +16997,9 @@ function getCellFont(hwnd, style) {
|
|
|
16353
16997
|
dv.setUint8(20, 1);
|
|
16354
16998
|
if (style.underline)
|
|
16355
16999
|
dv.setUint8(21, 1);
|
|
16356
|
-
const h =
|
|
16357
|
-
fontCache.set(key, h
|
|
16358
|
-
return h
|
|
17000
|
+
const h = ffi7.ffiCall(createFontIndirectW, [ffi7.FFI_TYPE_POINTER], [lf], ffi7.FFI_TYPE_POINTER);
|
|
17001
|
+
fontCache.set(key, h ? h : 0);
|
|
17002
|
+
return h ? h : null;
|
|
16359
17003
|
}
|
|
16360
17004
|
function handleCustomDraw(lParam, columns, data, hwnd) {
|
|
16361
17005
|
const stage = readU32(lParam, CD_STAGE);
|
|
@@ -16364,8 +17008,8 @@ function handleCustomDraw(lParam, columns, data, hwnd) {
|
|
|
16364
17008
|
if (stage === 65537)
|
|
16365
17009
|
return 32;
|
|
16366
17010
|
if (stage === 196609) {
|
|
16367
|
-
const colIndex =
|
|
16368
|
-
const row =
|
|
17011
|
+
const colIndex = readI32(lParam, CD_SUBITEM);
|
|
17012
|
+
const row = readI32(lParam, CD_ITEM);
|
|
16369
17013
|
const style = resolveCellStyle(columns, data, row, colIndex);
|
|
16370
17014
|
if (!style)
|
|
16371
17015
|
return 0;
|
|
@@ -16375,9 +17019,9 @@ function handleCustomDraw(lParam, columns, data, hwnd) {
|
|
|
16375
17019
|
writeU32(lParam, CD_CLRTEXTBK, style.background);
|
|
16376
17020
|
const hfont = getCellFont(hwnd, style);
|
|
16377
17021
|
if (hfont && selectObjectFn) {
|
|
16378
|
-
const hdc = readU64(lParam, CD_HDC);
|
|
17022
|
+
const hdc = PTR_SIZE === 8 ? readU64(lParam, CD_HDC) : readU32(lParam, CD_HDC);
|
|
16379
17023
|
if (hdc) {
|
|
16380
|
-
|
|
17024
|
+
ffi7.ffiCall(selectObjectFn, [ffi7.FFI_TYPE_POINTER, ffi7.FFI_TYPE_POINTER], [hdc, hfont], ffi7.FFI_TYPE_POINTER);
|
|
16381
17025
|
return 2;
|
|
16382
17026
|
}
|
|
16383
17027
|
}
|
|
@@ -16410,18 +17054,24 @@ function resolveCellStyle(columns, data, row, colIndex) {
|
|
|
16410
17054
|
return style || void 0;
|
|
16411
17055
|
}
|
|
16412
17056
|
function makeLVItem(i, sub, text, image) {
|
|
16413
|
-
const b = new ArrayBuffer(84);
|
|
16414
|
-
const dv = new DataView(b);
|
|
16415
|
-
dv.setInt32(4, i, true);
|
|
16416
|
-
dv.setInt32(8, sub, true);
|
|
16417
|
-
let mask = 1;
|
|
16418
|
-
if (image !== void 0) {
|
|
16419
|
-
mask |= 2;
|
|
16420
|
-
dv.setInt32(36, image, true);
|
|
16421
|
-
}
|
|
16422
|
-
dv.setUint32(0, mask, true);
|
|
16423
17057
|
const textBuf = textToUtf162(text);
|
|
16424
|
-
|
|
17058
|
+
const b = LVITEMW.write({
|
|
17059
|
+
mask: 1 | (image !== void 0 ? 2 : 0),
|
|
17060
|
+
iItem: i,
|
|
17061
|
+
iSubItem: sub,
|
|
17062
|
+
state: 0,
|
|
17063
|
+
stateMask: 0,
|
|
17064
|
+
pszText: bufPtr2(textBuf),
|
|
17065
|
+
cchTextMax: 0,
|
|
17066
|
+
iImage: image ?? 0,
|
|
17067
|
+
lParam: 0,
|
|
17068
|
+
iIndent: 0,
|
|
17069
|
+
iGroupId: 0,
|
|
17070
|
+
cColumns: 0,
|
|
17071
|
+
puColumns: 0,
|
|
17072
|
+
piColFmt: 0,
|
|
17073
|
+
iGroup: 0
|
|
17074
|
+
});
|
|
16425
17075
|
b.__textBuf = textBuf;
|
|
16426
17076
|
return b;
|
|
16427
17077
|
}
|
|
@@ -16474,13 +17124,19 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
|
|
|
16474
17124
|
const n = columns.length;
|
|
16475
17125
|
for (let j = 0; j < n; j++) {
|
|
16476
17126
|
const titleBuf = textToUtf162(columns[j].name);
|
|
16477
|
-
const lvc =
|
|
16478
|
-
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
|
|
16483
|
-
|
|
17127
|
+
const lvc = LVCOLUMNW.write({
|
|
17128
|
+
mask: 4 | 2 | 1,
|
|
17129
|
+
fmt: alignToFmt(columns[j].align),
|
|
17130
|
+
cx: columns[j].width ?? 100,
|
|
17131
|
+
pszText: bufPtr2(titleBuf),
|
|
17132
|
+
cchTextMax: 0,
|
|
17133
|
+
iSubItem: j,
|
|
17134
|
+
iImage: 0,
|
|
17135
|
+
iOrder: 0,
|
|
17136
|
+
cxMin: 0,
|
|
17137
|
+
cxDefault: 0,
|
|
17138
|
+
cxIdeal: 0
|
|
17139
|
+
});
|
|
16484
17140
|
lvc.__titleBuf = titleBuf;
|
|
16485
17141
|
gui10.SendMessage(h, 4193, j, bufPtr2(lvc));
|
|
16486
17142
|
}
|
|
@@ -16515,19 +17171,19 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
|
|
|
16515
17171
|
}, [data, columns, getIcon]);
|
|
16516
17172
|
return (0, import_jsx_runtime8.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
|
|
16517
17173
|
if (e.msg === 78) {
|
|
16518
|
-
const code =
|
|
17174
|
+
const code = nmCode(e.lParam);
|
|
16519
17175
|
if (code === -12) {
|
|
16520
17176
|
return handleCustomDraw(e.lParam, columns, data, lvRef.current);
|
|
16521
17177
|
}
|
|
16522
17178
|
if (code === -100) {
|
|
16523
|
-
const uNewState = readU32(e.lParam,
|
|
16524
|
-
const uOldState = readU32(e.lParam,
|
|
17179
|
+
const uNewState = readU32(e.lParam, NMLV_UNEW);
|
|
17180
|
+
const uOldState = readU32(e.lParam, NMLV_UOLD);
|
|
16525
17181
|
if ((uNewState & 2) !== (uOldState & 2))
|
|
16526
17182
|
return 1;
|
|
16527
17183
|
}
|
|
16528
17184
|
if (code === -2) {
|
|
16529
|
-
const iItem =
|
|
16530
|
-
const iSubItem =
|
|
17185
|
+
const iItem = readI32(e.lParam, NMIA_ITEM);
|
|
17186
|
+
const iSubItem = readI32(e.lParam, NMIA_SUBITEM);
|
|
16531
17187
|
const col = columns[iSubItem];
|
|
16532
17188
|
const record = data[iItem];
|
|
16533
17189
|
if (col?.onCellClick && record !== void 0)
|
|
@@ -16555,7 +17211,7 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
|
|
|
16555
17211
|
const sdv = new DataView(sbuf);
|
|
16556
17212
|
sdv.setInt32(0, sp[0], true);
|
|
16557
17213
|
sdv.setInt32(4, sp[1], true);
|
|
16558
|
-
|
|
17214
|
+
ffi7.ffiCall(screenToClient, [ffi7.FFI_TYPE_POINTER, ffi7.FFI_TYPE_POINTER], [h, sbuf], ffi7.FFI_TYPE_SINT32);
|
|
16559
17215
|
const lvhi = new ArrayBuffer(24);
|
|
16560
17216
|
const lvd = new DataView(lvhi);
|
|
16561
17217
|
lvd.setInt32(0, sdv.getInt32(0, true), true);
|
|
@@ -16564,14 +17220,14 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns, d
|
|
|
16564
17220
|
lvd.setInt32(16, -1, true);
|
|
16565
17221
|
const lvhiPtr = bufPtr2(lvhi);
|
|
16566
17222
|
gui10.SendMessage(h, 4153, 0, lvhiPtr);
|
|
16567
|
-
const iItem =
|
|
16568
|
-
const iSubItem =
|
|
17223
|
+
const iItem = readI32(lvhiPtr, 12);
|
|
17224
|
+
const iSubItem = readI32(lvhiPtr, 16);
|
|
16569
17225
|
const style2 = resolveCellStyle(columns, data, iItem, iSubItem);
|
|
16570
17226
|
if (!style2 || style2.cursor === void 0)
|
|
16571
17227
|
return;
|
|
16572
|
-
const hc =
|
|
17228
|
+
const hc = ffi7.ffiCall(loadCursorW, [ffi7.FFI_TYPE_POINTER, ffi7.FFI_TYPE_POINTER], [0, style2.cursor], ffi7.FFI_TYPE_POINTER);
|
|
16573
17229
|
if (hc) {
|
|
16574
|
-
|
|
17230
|
+
ffi7.ffiCall(setCursorFn, [ffi7.FFI_TYPE_POINTER], [hc], ffi7.FFI_TYPE_POINTER);
|
|
16575
17231
|
return 1;
|
|
16576
17232
|
}
|
|
16577
17233
|
return;
|
|
@@ -16840,7 +17496,16 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
|
|
|
16840
17496
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
16841
17497
|
var import_react14 = __toESM(require_react(), 1);
|
|
16842
17498
|
import * as gui15 from "gui";
|
|
16843
|
-
import * as
|
|
17499
|
+
import * as ffi8 from "ffi";
|
|
17500
|
+
var TCITEMW = struct({
|
|
17501
|
+
mask: "u32",
|
|
17502
|
+
dwState: "u32",
|
|
17503
|
+
dwStateMask: "u32",
|
|
17504
|
+
pszText: "ptr",
|
|
17505
|
+
cchTextMax: "i32",
|
|
17506
|
+
iImage: "i32",
|
|
17507
|
+
lParam: "ptr"
|
|
17508
|
+
});
|
|
16844
17509
|
function textToUtf163(s) {
|
|
16845
17510
|
const buf = new ArrayBuffer((s.length + 1) * 2);
|
|
16846
17511
|
const dv = new DataView(buf);
|
|
@@ -16848,9 +17513,6 @@ function textToUtf163(s) {
|
|
|
16848
17513
|
dv.setUint16(i * 2, s.charCodeAt(i), true);
|
|
16849
17514
|
return buf;
|
|
16850
17515
|
}
|
|
16851
|
-
function readI324(ptr, offset) {
|
|
16852
|
-
return ffi6.readByte(ptr + offset) | ffi6.readByte(ptr + offset + 1) << 8 | ffi6.readByte(ptr + offset + 2) << 16 | ffi6.readByte(ptr + offset + 3) << 24;
|
|
16853
|
-
}
|
|
16854
17516
|
var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex, defaultSelectedIndex = 0, onChange, style }, ref) => {
|
|
16855
17517
|
const [internalIndex, setInternalIndex] = (0, import_react14.useState)(defaultSelectedIndex);
|
|
16856
17518
|
const isControlled = controlledIndex !== void 0;
|
|
@@ -16863,12 +17525,16 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
|
|
|
16863
17525
|
gui15.SendMessage(h, 4873, 0, 0);
|
|
16864
17526
|
for (let i = 0; i < tabs.length; i++) {
|
|
16865
17527
|
const titleBuf = textToUtf163(tabs[i].title);
|
|
16866
|
-
const tci =
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
17528
|
+
const tci = TCITEMW.write({
|
|
17529
|
+
mask: 1,
|
|
17530
|
+
dwState: 0,
|
|
17531
|
+
dwStateMask: 0,
|
|
17532
|
+
pszText: ffi8.bufferPtr(titleBuf),
|
|
17533
|
+
cchTextMax: tabs[i].title.length + 1,
|
|
17534
|
+
iImage: 0,
|
|
17535
|
+
lParam: 0
|
|
17536
|
+
});
|
|
17537
|
+
const tciPtr = ffi8.bufferPtr(tci);
|
|
16872
17538
|
gui15.SendMessage(h, 4926, i, tciPtr);
|
|
16873
17539
|
}
|
|
16874
17540
|
gui15.SendMessage(h, 4876, sel, 0);
|
|
@@ -16883,7 +17549,7 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
|
|
|
16883
17549
|
const h = tabHwnd.current;
|
|
16884
17550
|
if (!h)
|
|
16885
17551
|
return;
|
|
16886
|
-
const code =
|
|
17552
|
+
const code = nmCode(e.lParam);
|
|
16887
17553
|
if (code === -552 || code === -2) {
|
|
16888
17554
|
const newSel = gui15.SendMessage(h, 4875, 0, 0);
|
|
16889
17555
|
if (newSel !== sel) {
|
|
@@ -16899,13 +17565,38 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
|
|
|
16899
17565
|
// _build/lib/react-qw/components/Tooltip.js
|
|
16900
17566
|
var import_react15 = __toESM(require_react(), 1);
|
|
16901
17567
|
import * as gui16 from "gui";
|
|
16902
|
-
import * as
|
|
17568
|
+
import * as ffi9 from "ffi";
|
|
17569
|
+
var TTTOOLINFOW = struct({
|
|
17570
|
+
cbSize: "u32",
|
|
17571
|
+
uFlags: "u32",
|
|
17572
|
+
hwnd: "ptr",
|
|
17573
|
+
uId: "ptr",
|
|
17574
|
+
rect: "i32[4]",
|
|
17575
|
+
hinst: "ptr",
|
|
17576
|
+
lpszText: "ptr",
|
|
17577
|
+
lParam: "ptr",
|
|
17578
|
+
lpReserved: "ptr"
|
|
17579
|
+
// WinXP+ 追加字段(系统 sizeof 含之)
|
|
17580
|
+
});
|
|
16903
17581
|
|
|
16904
17582
|
// _build/lib/react-qw/components/TreeView.js
|
|
16905
17583
|
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
|
|
16906
17584
|
var import_react16 = __toESM(require_react(), 1);
|
|
16907
17585
|
import * as gui17 from "gui";
|
|
16908
|
-
import * as
|
|
17586
|
+
import * as ffi10 from "ffi";
|
|
17587
|
+
var TVITEM = struct({
|
|
17588
|
+
mask: "u32",
|
|
17589
|
+
hItem: "ptr",
|
|
17590
|
+
state: "u32",
|
|
17591
|
+
stateMask: "u32",
|
|
17592
|
+
pszText: "ptr",
|
|
17593
|
+
cchTextMax: "i32",
|
|
17594
|
+
iImage: "i32",
|
|
17595
|
+
iSelectedImage: "i32",
|
|
17596
|
+
cChildren: "i32",
|
|
17597
|
+
lParam: "ptr"
|
|
17598
|
+
});
|
|
17599
|
+
var TVINSERTSTRUCT = struct({ hParent: "ptr", hInsertAfter: "ptr", item: TVITEM });
|
|
16909
17600
|
function textToUtf164(s) {
|
|
16910
17601
|
const buf = new ArrayBuffer((s.length + 1) * 2);
|
|
16911
17602
|
const dv = new DataView(buf);
|
|
@@ -16913,50 +17604,33 @@ function textToUtf164(s) {
|
|
|
16913
17604
|
dv.setUint16(i * 2, s.charCodeAt(i), true);
|
|
16914
17605
|
return buf;
|
|
16915
17606
|
}
|
|
16916
|
-
function readI325(ptr, offset) {
|
|
16917
|
-
return ffi8.readByte(ptr + offset) | ffi8.readByte(ptr + offset + 1) << 8 | ffi8.readByte(ptr + offset + 2) << 16 | ffi8.readByte(ptr + offset + 3) << 24;
|
|
16918
|
-
}
|
|
16919
17607
|
function bufPtr3(buf) {
|
|
16920
|
-
return
|
|
16921
|
-
}
|
|
16922
|
-
function setPtr(dv, offset, ptr) {
|
|
16923
|
-
dv.setUint32(offset, ptr & 4294967295, true);
|
|
16924
|
-
dv.setUint32(offset + 4, Math.floor(ptr / 4294967296), true);
|
|
17608
|
+
return ffi10.bufferPtr(buf);
|
|
16925
17609
|
}
|
|
16926
17610
|
function buildTvItem(textPtr, cChildren) {
|
|
16927
17611
|
let mask = 1;
|
|
16928
17612
|
if (cChildren > 0)
|
|
16929
17613
|
mask |= 64;
|
|
16930
|
-
|
|
16931
|
-
|
|
16932
|
-
|
|
16933
|
-
|
|
16934
|
-
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
|
|
16938
|
-
|
|
16939
|
-
|
|
16940
|
-
|
|
16941
|
-
|
|
16942
|
-
return buf;
|
|
16943
|
-
}
|
|
16944
|
-
function buildTvInsertStruct(hParent, hInsertAfter, itemBuf) {
|
|
16945
|
-
const buf = new ArrayBuffer(72);
|
|
16946
|
-
const dv = new DataView(buf);
|
|
16947
|
-
setPtr(dv, 0, hParent);
|
|
16948
|
-
setPtr(dv, 8, hInsertAfter);
|
|
16949
|
-
const src = new DataView(itemBuf);
|
|
16950
|
-
for (let i = 0; i < 56; i += 4)
|
|
16951
|
-
dv.setUint32(16 + i, src.getUint32(i, true), true);
|
|
16952
|
-
return buf;
|
|
17614
|
+
return TVITEM.write({
|
|
17615
|
+
mask,
|
|
17616
|
+
hItem: 0,
|
|
17617
|
+
state: 0,
|
|
17618
|
+
stateMask: 0,
|
|
17619
|
+
pszText: textPtr,
|
|
17620
|
+
cchTextMax: 260,
|
|
17621
|
+
iImage: 0,
|
|
17622
|
+
iSelectedImage: 0,
|
|
17623
|
+
cChildren,
|
|
17624
|
+
lParam: 0
|
|
17625
|
+
});
|
|
16953
17626
|
}
|
|
16954
17627
|
function insertItems(hTree, nodes, parentHandle, hItemMap, keyMap) {
|
|
16955
17628
|
for (const node of nodes) {
|
|
16956
17629
|
const cChildren = node.children && node.children.length > 0 ? 1 : 0;
|
|
16957
17630
|
const textBuf = textToUtf164(node.label);
|
|
16958
17631
|
const itemBuf = buildTvItem(bufPtr3(textBuf), cChildren);
|
|
16959
|
-
const
|
|
17632
|
+
const item = TVITEM.read(itemBuf);
|
|
17633
|
+
const tvins = TVINSERTSTRUCT.write({ hParent: parentHandle, hInsertAfter: -65536, item });
|
|
16960
17634
|
const hItem = gui17.SendMessage(hTree, 4402, 0, bufPtr3(tvins));
|
|
16961
17635
|
hItemMap.set(hItem, node);
|
|
16962
17636
|
if (node.key)
|
|
@@ -17022,7 +17696,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
|
|
|
17022
17696
|
}, [selKey]);
|
|
17023
17697
|
return (0, import_jsx_runtime14.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
|
|
17024
17698
|
if (e.msg === 78) {
|
|
17025
|
-
const code =
|
|
17699
|
+
const code = nmCode(e.lParam);
|
|
17026
17700
|
if (code === -451) {
|
|
17027
17701
|
const h = tvRef.current;
|
|
17028
17702
|
if (!h)
|
|
@@ -17043,10 +17717,49 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data, onS
|
|
|
17043
17717
|
// _build/lib/react-qw/components/PathPicker.js
|
|
17044
17718
|
var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
|
|
17045
17719
|
var import_react17 = __toESM(require_react(), 1);
|
|
17046
|
-
import * as
|
|
17720
|
+
import * as ffi11 from "ffi";
|
|
17047
17721
|
import * as win3 from "win";
|
|
17048
|
-
|
|
17049
|
-
|
|
17722
|
+
|
|
17723
|
+
// _build/lib/win-common-structs.js
|
|
17724
|
+
var OPENFILENAMEW = struct({
|
|
17725
|
+
lStructSize: "u32",
|
|
17726
|
+
hwndOwner: "ptr",
|
|
17727
|
+
hInstance: "ptr",
|
|
17728
|
+
lpstrFilter: "ptr",
|
|
17729
|
+
lpstrCustomFilter: "ptr",
|
|
17730
|
+
nMaxCustFilter: "u32",
|
|
17731
|
+
nFilterIndex: "u32",
|
|
17732
|
+
lpstrFile: "ptr",
|
|
17733
|
+
nMaxFile: "u32",
|
|
17734
|
+
lpstrFileTitle: "ptr",
|
|
17735
|
+
nMaxFileTitle: "u32",
|
|
17736
|
+
lpstrInitialDir: "ptr",
|
|
17737
|
+
lpstrTitle: "ptr",
|
|
17738
|
+
Flags: "u32",
|
|
17739
|
+
nFileOffset: "u16",
|
|
17740
|
+
nFileExtension: "u16",
|
|
17741
|
+
lpstrDefExt: "ptr",
|
|
17742
|
+
lCustData: "ptr",
|
|
17743
|
+
lpfnHook: "ptr",
|
|
17744
|
+
lpTemplateName: "ptr",
|
|
17745
|
+
pvReserved: "ptr",
|
|
17746
|
+
dwReserved: "u32",
|
|
17747
|
+
FlagsEx: "u32"
|
|
17748
|
+
});
|
|
17749
|
+
var BROWSEINFOW = struct({
|
|
17750
|
+
hwndOwner: "ptr",
|
|
17751
|
+
pidlRoot: "ptr",
|
|
17752
|
+
pszDisplayName: "ptr",
|
|
17753
|
+
lpszTitle: "ptr",
|
|
17754
|
+
ulFlags: "u32",
|
|
17755
|
+
lpfn: "ptr",
|
|
17756
|
+
lParam: "ptr",
|
|
17757
|
+
iImage: "i32"
|
|
17758
|
+
});
|
|
17759
|
+
|
|
17760
|
+
// _build/lib/react-qw/components/PathPicker.js
|
|
17761
|
+
var FFI_PTR = ffi11.FFI_TYPE_POINTER;
|
|
17762
|
+
var FFI_U32 = ffi11.FFI_TYPE_UINT32;
|
|
17050
17763
|
var _GetOpenFileNameW = 0;
|
|
17051
17764
|
var _SHBrowseForFolderW = 0;
|
|
17052
17765
|
var _SHGetPathFromIDListW = 0;
|
|
@@ -17075,31 +17788,42 @@ function wideToStr(buf, offset = 0) {
|
|
|
17075
17788
|
const nullIdx = str.indexOf("\0");
|
|
17076
17789
|
return nullIdx >= 0 ? str.substring(0, nullIdx) : str;
|
|
17077
17790
|
}
|
|
17078
|
-
function setPtr2(dv, off, ptr) {
|
|
17079
|
-
dv.setUint32(off, ptr & 4294967295, true);
|
|
17080
|
-
dv.setUint32(off + 4, Math.floor(ptr / 4294967296), true);
|
|
17081
|
-
}
|
|
17082
17791
|
function openFileDialog(owner, filter, title, multiple) {
|
|
17083
17792
|
if (!ensureDlls())
|
|
17084
17793
|
return null;
|
|
17085
|
-
const structBuf = new ArrayBuffer(152);
|
|
17086
|
-
const sv = new DataView(structBuf);
|
|
17087
17794
|
const fileBuf = new ArrayBuffer(260 * 2);
|
|
17088
17795
|
const filterWide = strToWide(filter);
|
|
17089
17796
|
const titleWide = title ? strToWide(title) : null;
|
|
17090
|
-
sv.setUint32(0, 152, true);
|
|
17091
|
-
setPtr2(sv, 8, owner);
|
|
17092
|
-
setPtr2(sv, 24, ffi9.bufferPtr(filterWide));
|
|
17093
|
-
setPtr2(sv, 48, ffi9.bufferPtr(fileBuf));
|
|
17094
|
-
sv.setUint32(56, 260, true);
|
|
17095
17797
|
let flags = 4096 | 2048 | 8;
|
|
17096
17798
|
if (multiple)
|
|
17097
17799
|
flags |= 512;
|
|
17098
17800
|
flags |= 524288;
|
|
17099
|
-
|
|
17100
|
-
|
|
17101
|
-
|
|
17102
|
-
|
|
17801
|
+
const ofn = OPENFILENAMEW.write({
|
|
17802
|
+
lStructSize: OPENFILENAMEW.size,
|
|
17803
|
+
hwndOwner: owner,
|
|
17804
|
+
hInstance: 0,
|
|
17805
|
+
lpstrFilter: ffi11.bufferPtr(filterWide),
|
|
17806
|
+
lpstrCustomFilter: 0,
|
|
17807
|
+
nMaxCustFilter: 0,
|
|
17808
|
+
nFilterIndex: 0,
|
|
17809
|
+
lpstrFile: ffi11.bufferPtr(fileBuf),
|
|
17810
|
+
nMaxFile: 260,
|
|
17811
|
+
lpstrFileTitle: 0,
|
|
17812
|
+
nMaxFileTitle: 0,
|
|
17813
|
+
lpstrInitialDir: 0,
|
|
17814
|
+
lpstrTitle: titleWide ? ffi11.bufferPtr(titleWide) : 0,
|
|
17815
|
+
Flags: flags,
|
|
17816
|
+
nFileOffset: 0,
|
|
17817
|
+
nFileExtension: 0,
|
|
17818
|
+
lpstrDefExt: 0,
|
|
17819
|
+
lCustData: 0,
|
|
17820
|
+
lpfnHook: 0,
|
|
17821
|
+
lpTemplateName: 0,
|
|
17822
|
+
pvReserved: 0,
|
|
17823
|
+
dwReserved: 0,
|
|
17824
|
+
FlagsEx: 0
|
|
17825
|
+
});
|
|
17826
|
+
const ret = ffi11.ffiCall(_GetOpenFileNameW, [FFI_PTR], [ofn], FFI_U32);
|
|
17103
17827
|
if (!ret)
|
|
17104
17828
|
return null;
|
|
17105
17829
|
if (!multiple) {
|
|
@@ -17122,19 +17846,23 @@ function openFileDialog(owner, filter, title, multiple) {
|
|
|
17122
17846
|
function openFolderDialog(owner, title) {
|
|
17123
17847
|
if (!ensureDlls())
|
|
17124
17848
|
return null;
|
|
17125
|
-
const structBuf = new ArrayBuffer(64);
|
|
17126
|
-
const sv = new DataView(structBuf);
|
|
17127
17849
|
const titleWide = title ? strToWide(title) : null;
|
|
17128
|
-
|
|
17129
|
-
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
|
|
17850
|
+
const bi = BROWSEINFOW.write({
|
|
17851
|
+
hwndOwner: owner,
|
|
17852
|
+
pidlRoot: 0,
|
|
17853
|
+
pszDisplayName: 0,
|
|
17854
|
+
lpszTitle: titleWide ? ffi11.bufferPtr(titleWide) : 0,
|
|
17855
|
+
ulFlags: 65,
|
|
17856
|
+
lpfn: 0,
|
|
17857
|
+
lParam: 0,
|
|
17858
|
+
iImage: 0
|
|
17859
|
+
});
|
|
17860
|
+
const pidl = ffi11.ffiCall(_SHBrowseForFolderW, [FFI_PTR], [bi], FFI_PTR);
|
|
17133
17861
|
if (!pidl)
|
|
17134
17862
|
return null;
|
|
17135
17863
|
const pathBuf = new ArrayBuffer(260 * 2);
|
|
17136
|
-
const ok =
|
|
17137
|
-
|
|
17864
|
+
const ok = ffi11.ffiCall(_SHGetPathFromIDListW, [ffi11.FFI_TYPE_POINTER, FFI_PTR], [pidl, pathBuf], FFI_U32);
|
|
17865
|
+
ffi11.ffiCall(_CoTaskMemFree, [ffi11.FFI_TYPE_POINTER], [pidl], ffi11.FFI_TYPE_VOID);
|
|
17138
17866
|
return ok ? wideToStr(pathBuf) : null;
|
|
17139
17867
|
}
|
|
17140
17868
|
var PathPicker = (0, import_react17.forwardRef)((props, ref) => {
|