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