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(hwnd) {
|
|
15526
15839
|
const size = new ArrayBuffer(8);
|
|
15527
|
-
gui2.SendMessage(hwnd, 5633, 0,
|
|
15840
|
+
gui2.SendMessage(hwnd, 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(hwnd, text) {
|
|
15532
|
-
const hdc =
|
|
15845
|
+
const hdc = user32.GetDC(hwnd);
|
|
15533
15846
|
if (!hdc)
|
|
15534
15847
|
return { width: 0, height: 0 };
|
|
15535
15848
|
const hFont = gui2.SendMessage(hwnd, 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(hwnd, hdc);
|
|
15541
15854
|
const wr = gui2.GetWindowRect(hwnd);
|
|
15542
15855
|
const cr = gui2.GetClientRect(hwnd);
|
|
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 makeColorBlock(size, bgra) {
|
|
16266
16847
|
const n = size * size;
|
|
@@ -16281,11 +16862,11 @@ function textToUtf162(s) {
|
|
|
16281
16862
|
dv.setUint16(i * 2, s.charCodeAt(i), true);
|
|
16282
16863
|
return buf;
|
|
16283
16864
|
}
|
|
16284
|
-
function
|
|
16285
|
-
return
|
|
16865
|
+
function readI32(ptr, offset) {
|
|
16866
|
+
return ffi7.readByte(ptr + offset) | ffi7.readByte(ptr + offset + 1) << 8 | ffi7.readByte(ptr + offset + 2) << 16 | ffi7.readByte(ptr + offset + 3) << 24;
|
|
16286
16867
|
}
|
|
16287
16868
|
function readU32(ptr, offset) {
|
|
16288
|
-
return
|
|
16869
|
+
return ffi7.readByte(ptr + offset) | ffi7.readByte(ptr + offset + 1) << 8 | ffi7.readByte(ptr + offset + 2) << 16 | ffi7.readByte(ptr + offset + 3) << 24 >>> 0;
|
|
16289
16870
|
}
|
|
16290
16871
|
function readU64(ptr, offset) {
|
|
16291
16872
|
const lo = readU32(ptr, offset);
|
|
@@ -16293,24 +16874,87 @@ function readU64(ptr, offset) {
|
|
|
16293
16874
|
return lo + hi * 4294967296;
|
|
16294
16875
|
}
|
|
16295
16876
|
function writeU32(ptr, offset, v) {
|
|
16296
|
-
|
|
16297
|
-
|
|
16298
|
-
|
|
16299
|
-
|
|
16877
|
+
ffi7.writeByte(ptr + offset, v & 255);
|
|
16878
|
+
ffi7.writeByte(ptr + offset + 1, v >> 8 & 255);
|
|
16879
|
+
ffi7.writeByte(ptr + offset + 2, v >> 16 & 255);
|
|
16880
|
+
ffi7.writeByte(ptr + offset + 3, v >> 24 & 255);
|
|
16300
16881
|
}
|
|
16301
16882
|
function bufPtr2(buf) {
|
|
16302
|
-
return
|
|
16883
|
+
return ffi7.bufferPtr(buf);
|
|
16303
16884
|
}
|
|
16304
16885
|
var LV_WS = 268435456 | 8388608 | 2097152 | 1048576 | 1 | 4;
|
|
16305
|
-
var
|
|
16306
|
-
|
|
16307
|
-
|
|
16308
|
-
|
|
16309
|
-
|
|
16310
|
-
|
|
16311
|
-
|
|
16312
|
-
|
|
16313
|
-
|
|
16886
|
+
var NMCUSTOMDRAW = struct({
|
|
16887
|
+
hdr: NMHDR,
|
|
16888
|
+
dwDrawStage: "u32",
|
|
16889
|
+
hdc: "ptr",
|
|
16890
|
+
rc: "i32[4]",
|
|
16891
|
+
dwItemSpec: "ptr",
|
|
16892
|
+
uItemState: "u32",
|
|
16893
|
+
lItemlParam: "ptr"
|
|
16894
|
+
});
|
|
16895
|
+
var NMLVCUSTOMDRAW = struct({
|
|
16896
|
+
hdr: NMHDR,
|
|
16897
|
+
dwDrawStage: "u32",
|
|
16898
|
+
hdc: "ptr",
|
|
16899
|
+
rc: "i32[4]",
|
|
16900
|
+
dwItemSpec: "ptr",
|
|
16901
|
+
uItemState: "u32",
|
|
16902
|
+
lItemlParam: "ptr",
|
|
16903
|
+
clrText: "u32",
|
|
16904
|
+
clrTextBk: "u32",
|
|
16905
|
+
iSubItem: "i32",
|
|
16906
|
+
dwItemType: "u32"
|
|
16907
|
+
});
|
|
16908
|
+
var NMLISTVIEW = struct({
|
|
16909
|
+
hdr: NMHDR,
|
|
16910
|
+
iItem: "i32",
|
|
16911
|
+
iSubItem: "i32",
|
|
16912
|
+
uNewState: "u32",
|
|
16913
|
+
uOldState: "u32",
|
|
16914
|
+
uChanged: "u32",
|
|
16915
|
+
ptAction: "i32[2]",
|
|
16916
|
+
lParam: "ptr"
|
|
16917
|
+
});
|
|
16918
|
+
var CD_STAGE = NMCUSTOMDRAW.offsetOf("dwDrawStage");
|
|
16919
|
+
var CD_HDC = NMCUSTOMDRAW.offsetOf("hdc");
|
|
16920
|
+
var CD_ITEM = NMCUSTOMDRAW.offsetOf("dwItemSpec");
|
|
16921
|
+
var CD_CLRTEXT = NMLVCUSTOMDRAW.offsetOf("clrText");
|
|
16922
|
+
var CD_CLRTEXTBK = NMLVCUSTOMDRAW.offsetOf("clrTextBk");
|
|
16923
|
+
var CD_SUBITEM = NMLVCUSTOMDRAW.offsetOf("iSubItem");
|
|
16924
|
+
var NMIA_ITEM = NMLISTVIEW.offsetOf("iItem");
|
|
16925
|
+
var NMIA_SUBITEM = NMLISTVIEW.offsetOf("iSubItem");
|
|
16926
|
+
var NMLV_UNEW = NMLISTVIEW.offsetOf("uNewState");
|
|
16927
|
+
var NMLV_UOLD = NMLISTVIEW.offsetOf("uOldState");
|
|
16928
|
+
var LVITEMW = struct({
|
|
16929
|
+
mask: "u32",
|
|
16930
|
+
iItem: "i32",
|
|
16931
|
+
iSubItem: "i32",
|
|
16932
|
+
state: "u32",
|
|
16933
|
+
stateMask: "u32",
|
|
16934
|
+
pszText: "ptr",
|
|
16935
|
+
cchTextMax: "i32",
|
|
16936
|
+
iImage: "i32",
|
|
16937
|
+
lParam: "ptr",
|
|
16938
|
+
iIndent: "i32",
|
|
16939
|
+
iGroupId: "i32",
|
|
16940
|
+
cColumns: "u32",
|
|
16941
|
+
puColumns: "ptr",
|
|
16942
|
+
piColFmt: "ptr",
|
|
16943
|
+
iGroup: "i32"
|
|
16944
|
+
});
|
|
16945
|
+
var LVCOLUMNW = struct({
|
|
16946
|
+
mask: "u32",
|
|
16947
|
+
fmt: "i32",
|
|
16948
|
+
cx: "i32",
|
|
16949
|
+
pszText: "ptr",
|
|
16950
|
+
cchTextMax: "i32",
|
|
16951
|
+
iSubItem: "i32",
|
|
16952
|
+
iImage: "i32",
|
|
16953
|
+
iOrder: "i32",
|
|
16954
|
+
cxMin: "i32",
|
|
16955
|
+
cxDefault: "i32",
|
|
16956
|
+
cxIdeal: "i32"
|
|
16957
|
+
});
|
|
16314
16958
|
var fontCache = /* @__PURE__ */ new Map();
|
|
16315
16959
|
var gdi322 = null;
|
|
16316
16960
|
var createFontIndirectW = null;
|
|
@@ -16354,7 +16998,7 @@ function getCellFont(hwnd, style) {
|
|
|
16354
16998
|
const dv = new DataView(lf);
|
|
16355
16999
|
const cur = gui10.SendMessage(hwnd, 49, 0, 0);
|
|
16356
17000
|
if (cur) {
|
|
16357
|
-
const got =
|
|
17001
|
+
const got = ffi7.ffiCall(getObjectW, [ffi7.FFI_TYPE_POINTER, ffi7.FFI_TYPE_SINT32, ffi7.FFI_TYPE_POINTER], [cur, 92, lf], ffi7.FFI_TYPE_SINT32);
|
|
16358
17002
|
if (!got)
|
|
16359
17003
|
return null;
|
|
16360
17004
|
} else {
|
|
@@ -16366,9 +17010,9 @@ function getCellFont(hwnd, style) {
|
|
|
16366
17010
|
dv.setUint8(20, 1);
|
|
16367
17011
|
if (style.underline)
|
|
16368
17012
|
dv.setUint8(21, 1);
|
|
16369
|
-
const h =
|
|
16370
|
-
fontCache.set(key, h
|
|
16371
|
-
return h
|
|
17013
|
+
const h = ffi7.ffiCall(createFontIndirectW, [ffi7.FFI_TYPE_POINTER], [lf], ffi7.FFI_TYPE_POINTER);
|
|
17014
|
+
fontCache.set(key, h ? h : 0);
|
|
17015
|
+
return h ? h : null;
|
|
16372
17016
|
}
|
|
16373
17017
|
function handleCustomDraw(lParam, columns2, data2, hwnd) {
|
|
16374
17018
|
const stage = readU32(lParam, CD_STAGE);
|
|
@@ -16377,8 +17021,8 @@ function handleCustomDraw(lParam, columns2, data2, hwnd) {
|
|
|
16377
17021
|
if (stage === 65537)
|
|
16378
17022
|
return 32;
|
|
16379
17023
|
if (stage === 196609) {
|
|
16380
|
-
const colIndex =
|
|
16381
|
-
const row =
|
|
17024
|
+
const colIndex = readI32(lParam, CD_SUBITEM);
|
|
17025
|
+
const row = readI32(lParam, CD_ITEM);
|
|
16382
17026
|
const style = resolveCellStyle(columns2, data2, row, colIndex);
|
|
16383
17027
|
if (!style)
|
|
16384
17028
|
return 0;
|
|
@@ -16388,9 +17032,9 @@ function handleCustomDraw(lParam, columns2, data2, hwnd) {
|
|
|
16388
17032
|
writeU32(lParam, CD_CLRTEXTBK, style.background);
|
|
16389
17033
|
const hfont = getCellFont(hwnd, style);
|
|
16390
17034
|
if (hfont && selectObjectFn) {
|
|
16391
|
-
const hdc = readU64(lParam, CD_HDC);
|
|
17035
|
+
const hdc = PTR_SIZE === 8 ? readU64(lParam, CD_HDC) : readU32(lParam, CD_HDC);
|
|
16392
17036
|
if (hdc) {
|
|
16393
|
-
|
|
17037
|
+
ffi7.ffiCall(selectObjectFn, [ffi7.FFI_TYPE_POINTER, ffi7.FFI_TYPE_POINTER], [hdc, hfont], ffi7.FFI_TYPE_POINTER);
|
|
16394
17038
|
return 2;
|
|
16395
17039
|
}
|
|
16396
17040
|
}
|
|
@@ -16423,18 +17067,24 @@ function resolveCellStyle(columns2, data2, row, colIndex) {
|
|
|
16423
17067
|
return style || void 0;
|
|
16424
17068
|
}
|
|
16425
17069
|
function makeLVItem(i, sub, text, image) {
|
|
16426
|
-
const b = new ArrayBuffer(84);
|
|
16427
|
-
const dv = new DataView(b);
|
|
16428
|
-
dv.setInt32(4, i, true);
|
|
16429
|
-
dv.setInt32(8, sub, true);
|
|
16430
|
-
let mask = 1;
|
|
16431
|
-
if (image !== void 0) {
|
|
16432
|
-
mask |= 2;
|
|
16433
|
-
dv.setInt32(36, image, true);
|
|
16434
|
-
}
|
|
16435
|
-
dv.setUint32(0, mask, true);
|
|
16436
17070
|
const textBuf = textToUtf162(text);
|
|
16437
|
-
|
|
17071
|
+
const b = LVITEMW.write({
|
|
17072
|
+
mask: 1 | (image !== void 0 ? 2 : 0),
|
|
17073
|
+
iItem: i,
|
|
17074
|
+
iSubItem: sub,
|
|
17075
|
+
state: 0,
|
|
17076
|
+
stateMask: 0,
|
|
17077
|
+
pszText: bufPtr2(textBuf),
|
|
17078
|
+
cchTextMax: 0,
|
|
17079
|
+
iImage: image ?? 0,
|
|
17080
|
+
lParam: 0,
|
|
17081
|
+
iIndent: 0,
|
|
17082
|
+
iGroupId: 0,
|
|
17083
|
+
cColumns: 0,
|
|
17084
|
+
puColumns: 0,
|
|
17085
|
+
piColFmt: 0,
|
|
17086
|
+
iGroup: 0
|
|
17087
|
+
});
|
|
16438
17088
|
b.__textBuf = textBuf;
|
|
16439
17089
|
return b;
|
|
16440
17090
|
}
|
|
@@ -16487,13 +17137,19 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns: c
|
|
|
16487
17137
|
const n = columns2.length;
|
|
16488
17138
|
for (let j = 0; j < n; j++) {
|
|
16489
17139
|
const titleBuf = textToUtf162(columns2[j].name);
|
|
16490
|
-
const lvc =
|
|
16491
|
-
|
|
16492
|
-
|
|
16493
|
-
|
|
16494
|
-
|
|
16495
|
-
|
|
16496
|
-
|
|
17140
|
+
const lvc = LVCOLUMNW.write({
|
|
17141
|
+
mask: 4 | 2 | 1,
|
|
17142
|
+
fmt: alignToFmt(columns2[j].align),
|
|
17143
|
+
cx: columns2[j].width ?? 100,
|
|
17144
|
+
pszText: bufPtr2(titleBuf),
|
|
17145
|
+
cchTextMax: 0,
|
|
17146
|
+
iSubItem: j,
|
|
17147
|
+
iImage: 0,
|
|
17148
|
+
iOrder: 0,
|
|
17149
|
+
cxMin: 0,
|
|
17150
|
+
cxDefault: 0,
|
|
17151
|
+
cxIdeal: 0
|
|
17152
|
+
});
|
|
16497
17153
|
lvc.__titleBuf = titleBuf;
|
|
16498
17154
|
gui10.SendMessage(h, 4193, j, bufPtr2(lvc));
|
|
16499
17155
|
}
|
|
@@ -16528,19 +17184,19 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns: c
|
|
|
16528
17184
|
}, [data2, columns2, getIcon]);
|
|
16529
17185
|
return (0, import_jsx_runtime8.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
|
|
16530
17186
|
if (e.msg === 78) {
|
|
16531
|
-
const code =
|
|
17187
|
+
const code = nmCode(e.lParam);
|
|
16532
17188
|
if (code === -12) {
|
|
16533
17189
|
return handleCustomDraw(e.lParam, columns2, data2, lvRef.current);
|
|
16534
17190
|
}
|
|
16535
17191
|
if (code === -100) {
|
|
16536
|
-
const uNewState = readU32(e.lParam,
|
|
16537
|
-
const uOldState = readU32(e.lParam,
|
|
17192
|
+
const uNewState = readU32(e.lParam, NMLV_UNEW);
|
|
17193
|
+
const uOldState = readU32(e.lParam, NMLV_UOLD);
|
|
16538
17194
|
if ((uNewState & 2) !== (uOldState & 2))
|
|
16539
17195
|
return 1;
|
|
16540
17196
|
}
|
|
16541
17197
|
if (code === -2) {
|
|
16542
|
-
const iItem =
|
|
16543
|
-
const iSubItem =
|
|
17198
|
+
const iItem = readI32(e.lParam, NMIA_ITEM);
|
|
17199
|
+
const iSubItem = readI32(e.lParam, NMIA_SUBITEM);
|
|
16544
17200
|
const col = columns2[iSubItem];
|
|
16545
17201
|
const record = data2[iItem];
|
|
16546
17202
|
if (col?.onCellClick && record !== void 0)
|
|
@@ -16568,7 +17224,7 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns: c
|
|
|
16568
17224
|
const sdv = new DataView(sbuf);
|
|
16569
17225
|
sdv.setInt32(0, sp[0], true);
|
|
16570
17226
|
sdv.setInt32(4, sp[1], true);
|
|
16571
|
-
|
|
17227
|
+
ffi7.ffiCall(screenToClient, [ffi7.FFI_TYPE_POINTER, ffi7.FFI_TYPE_POINTER], [h, sbuf], ffi7.FFI_TYPE_SINT32);
|
|
16572
17228
|
const lvhi = new ArrayBuffer(24);
|
|
16573
17229
|
const lvd = new DataView(lvhi);
|
|
16574
17230
|
lvd.setInt32(0, sdv.getInt32(0, true), true);
|
|
@@ -16577,14 +17233,14 @@ var ListView = (0, import_react9.forwardRef)(function ListViewInner({ columns: c
|
|
|
16577
17233
|
lvd.setInt32(16, -1, true);
|
|
16578
17234
|
const lvhiPtr = bufPtr2(lvhi);
|
|
16579
17235
|
gui10.SendMessage(h, 4153, 0, lvhiPtr);
|
|
16580
|
-
const iItem =
|
|
16581
|
-
const iSubItem =
|
|
17236
|
+
const iItem = readI32(lvhiPtr, 12);
|
|
17237
|
+
const iSubItem = readI32(lvhiPtr, 16);
|
|
16582
17238
|
const style2 = resolveCellStyle(columns2, data2, iItem, iSubItem);
|
|
16583
17239
|
if (!style2 || style2.cursor === void 0)
|
|
16584
17240
|
return;
|
|
16585
|
-
const hc =
|
|
17241
|
+
const hc = ffi7.ffiCall(loadCursorW, [ffi7.FFI_TYPE_POINTER, ffi7.FFI_TYPE_POINTER], [0, style2.cursor], ffi7.FFI_TYPE_POINTER);
|
|
16586
17242
|
if (hc) {
|
|
16587
|
-
|
|
17243
|
+
ffi7.ffiCall(setCursorFn, [ffi7.FFI_TYPE_POINTER], [hc], ffi7.FFI_TYPE_POINTER);
|
|
16588
17244
|
return 1;
|
|
16589
17245
|
}
|
|
16590
17246
|
return;
|
|
@@ -16853,7 +17509,16 @@ var Slider = (0, import_react13.forwardRef)(({ value, onChange, min = 0, max = 1
|
|
|
16853
17509
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
16854
17510
|
var import_react14 = __toESM(require_react(), 1);
|
|
16855
17511
|
import * as gui15 from "gui";
|
|
16856
|
-
import * as
|
|
17512
|
+
import * as ffi8 from "ffi";
|
|
17513
|
+
var TCITEMW = struct({
|
|
17514
|
+
mask: "u32",
|
|
17515
|
+
dwState: "u32",
|
|
17516
|
+
dwStateMask: "u32",
|
|
17517
|
+
pszText: "ptr",
|
|
17518
|
+
cchTextMax: "i32",
|
|
17519
|
+
iImage: "i32",
|
|
17520
|
+
lParam: "ptr"
|
|
17521
|
+
});
|
|
16857
17522
|
function textToUtf163(s) {
|
|
16858
17523
|
const buf = new ArrayBuffer((s.length + 1) * 2);
|
|
16859
17524
|
const dv = new DataView(buf);
|
|
@@ -16861,9 +17526,6 @@ function textToUtf163(s) {
|
|
|
16861
17526
|
dv.setUint16(i * 2, s.charCodeAt(i), true);
|
|
16862
17527
|
return buf;
|
|
16863
17528
|
}
|
|
16864
|
-
function readI324(ptr, offset) {
|
|
16865
|
-
return ffi6.readByte(ptr + offset) | ffi6.readByte(ptr + offset + 1) << 8 | ffi6.readByte(ptr + offset + 2) << 16 | ffi6.readByte(ptr + offset + 3) << 24;
|
|
16866
|
-
}
|
|
16867
17529
|
var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex, defaultSelectedIndex = 0, onChange, style }, ref) => {
|
|
16868
17530
|
const [internalIndex, setInternalIndex] = (0, import_react14.useState)(defaultSelectedIndex);
|
|
16869
17531
|
const isControlled = controlledIndex !== void 0;
|
|
@@ -16876,12 +17538,16 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
|
|
|
16876
17538
|
gui15.SendMessage(h, 4873, 0, 0);
|
|
16877
17539
|
for (let i = 0; i < tabs.length; i++) {
|
|
16878
17540
|
const titleBuf = textToUtf163(tabs[i].title);
|
|
16879
|
-
const tci =
|
|
16880
|
-
|
|
16881
|
-
|
|
16882
|
-
|
|
16883
|
-
|
|
16884
|
-
|
|
17541
|
+
const tci = TCITEMW.write({
|
|
17542
|
+
mask: 1,
|
|
17543
|
+
dwState: 0,
|
|
17544
|
+
dwStateMask: 0,
|
|
17545
|
+
pszText: ffi8.bufferPtr(titleBuf),
|
|
17546
|
+
cchTextMax: tabs[i].title.length + 1,
|
|
17547
|
+
iImage: 0,
|
|
17548
|
+
lParam: 0
|
|
17549
|
+
});
|
|
17550
|
+
const tciPtr = ffi8.bufferPtr(tci);
|
|
16885
17551
|
gui15.SendMessage(h, 4926, i, tciPtr);
|
|
16886
17552
|
}
|
|
16887
17553
|
gui15.SendMessage(h, 4876, sel, 0);
|
|
@@ -16896,7 +17562,7 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
|
|
|
16896
17562
|
const h = tabHwnd.current;
|
|
16897
17563
|
if (!h)
|
|
16898
17564
|
return;
|
|
16899
|
-
const code =
|
|
17565
|
+
const code = nmCode(e.lParam);
|
|
16900
17566
|
if (code === -552 || code === -2) {
|
|
16901
17567
|
const newSel = gui15.SendMessage(h, 4875, 0, 0);
|
|
16902
17568
|
if (newSel !== sel) {
|
|
@@ -16912,13 +17578,38 @@ var Tab = (0, import_react14.forwardRef)(({ tabs, selectedIndex: controlledIndex
|
|
|
16912
17578
|
// _build/lib/react-qw/components/Tooltip.js
|
|
16913
17579
|
var import_react15 = __toESM(require_react(), 1);
|
|
16914
17580
|
import * as gui16 from "gui";
|
|
16915
|
-
import * as
|
|
17581
|
+
import * as ffi9 from "ffi";
|
|
17582
|
+
var TTTOOLINFOW = struct({
|
|
17583
|
+
cbSize: "u32",
|
|
17584
|
+
uFlags: "u32",
|
|
17585
|
+
hwnd: "ptr",
|
|
17586
|
+
uId: "ptr",
|
|
17587
|
+
rect: "i32[4]",
|
|
17588
|
+
hinst: "ptr",
|
|
17589
|
+
lpszText: "ptr",
|
|
17590
|
+
lParam: "ptr",
|
|
17591
|
+
lpReserved: "ptr"
|
|
17592
|
+
// WinXP+ 追加字段(系统 sizeof 含之)
|
|
17593
|
+
});
|
|
16916
17594
|
|
|
16917
17595
|
// _build/lib/react-qw/components/TreeView.js
|
|
16918
17596
|
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
|
|
16919
17597
|
var import_react16 = __toESM(require_react(), 1);
|
|
16920
17598
|
import * as gui17 from "gui";
|
|
16921
|
-
import * as
|
|
17599
|
+
import * as ffi10 from "ffi";
|
|
17600
|
+
var TVITEM = struct({
|
|
17601
|
+
mask: "u32",
|
|
17602
|
+
hItem: "ptr",
|
|
17603
|
+
state: "u32",
|
|
17604
|
+
stateMask: "u32",
|
|
17605
|
+
pszText: "ptr",
|
|
17606
|
+
cchTextMax: "i32",
|
|
17607
|
+
iImage: "i32",
|
|
17608
|
+
iSelectedImage: "i32",
|
|
17609
|
+
cChildren: "i32",
|
|
17610
|
+
lParam: "ptr"
|
|
17611
|
+
});
|
|
17612
|
+
var TVINSERTSTRUCT = struct({ hParent: "ptr", hInsertAfter: "ptr", item: TVITEM });
|
|
16922
17613
|
function textToUtf164(s) {
|
|
16923
17614
|
const buf = new ArrayBuffer((s.length + 1) * 2);
|
|
16924
17615
|
const dv = new DataView(buf);
|
|
@@ -16926,50 +17617,33 @@ function textToUtf164(s) {
|
|
|
16926
17617
|
dv.setUint16(i * 2, s.charCodeAt(i), true);
|
|
16927
17618
|
return buf;
|
|
16928
17619
|
}
|
|
16929
|
-
function readI325(ptr, offset) {
|
|
16930
|
-
return ffi8.readByte(ptr + offset) | ffi8.readByte(ptr + offset + 1) << 8 | ffi8.readByte(ptr + offset + 2) << 16 | ffi8.readByte(ptr + offset + 3) << 24;
|
|
16931
|
-
}
|
|
16932
17620
|
function bufPtr3(buf) {
|
|
16933
|
-
return
|
|
16934
|
-
}
|
|
16935
|
-
function setPtr(dv, offset, ptr) {
|
|
16936
|
-
dv.setUint32(offset, ptr & 4294967295, true);
|
|
16937
|
-
dv.setUint32(offset + 4, Math.floor(ptr / 4294967296), true);
|
|
17621
|
+
return ffi10.bufferPtr(buf);
|
|
16938
17622
|
}
|
|
16939
17623
|
function buildTvItem(textPtr, cChildren) {
|
|
16940
17624
|
let mask = 1;
|
|
16941
17625
|
if (cChildren > 0)
|
|
16942
17626
|
mask |= 64;
|
|
16943
|
-
|
|
16944
|
-
|
|
16945
|
-
|
|
16946
|
-
|
|
16947
|
-
|
|
16948
|
-
|
|
16949
|
-
|
|
16950
|
-
|
|
16951
|
-
|
|
16952
|
-
|
|
16953
|
-
|
|
16954
|
-
|
|
16955
|
-
return buf;
|
|
16956
|
-
}
|
|
16957
|
-
function buildTvInsertStruct(hParent, hInsertAfter, itemBuf) {
|
|
16958
|
-
const buf = new ArrayBuffer(72);
|
|
16959
|
-
const dv = new DataView(buf);
|
|
16960
|
-
setPtr(dv, 0, hParent);
|
|
16961
|
-
setPtr(dv, 8, hInsertAfter);
|
|
16962
|
-
const src = new DataView(itemBuf);
|
|
16963
|
-
for (let i = 0; i < 56; i += 4)
|
|
16964
|
-
dv.setUint32(16 + i, src.getUint32(i, true), true);
|
|
16965
|
-
return buf;
|
|
17627
|
+
return TVITEM.write({
|
|
17628
|
+
mask,
|
|
17629
|
+
hItem: 0,
|
|
17630
|
+
state: 0,
|
|
17631
|
+
stateMask: 0,
|
|
17632
|
+
pszText: textPtr,
|
|
17633
|
+
cchTextMax: 260,
|
|
17634
|
+
iImage: 0,
|
|
17635
|
+
iSelectedImage: 0,
|
|
17636
|
+
cChildren,
|
|
17637
|
+
lParam: 0
|
|
17638
|
+
});
|
|
16966
17639
|
}
|
|
16967
17640
|
function insertItems(hTree, nodes, parentHandle, hItemMap, keyMap) {
|
|
16968
17641
|
for (const node of nodes) {
|
|
16969
17642
|
const cChildren = node.children && node.children.length > 0 ? 1 : 0;
|
|
16970
17643
|
const textBuf = textToUtf164(node.label);
|
|
16971
17644
|
const itemBuf = buildTvItem(bufPtr3(textBuf), cChildren);
|
|
16972
|
-
const
|
|
17645
|
+
const item = TVITEM.read(itemBuf);
|
|
17646
|
+
const tvins = TVINSERTSTRUCT.write({ hParent: parentHandle, hInsertAfter: -65536, item });
|
|
16973
17647
|
const hItem = gui17.SendMessage(hTree, 4402, 0, bufPtr3(tvins));
|
|
16974
17648
|
hItemMap.set(hItem, node);
|
|
16975
17649
|
if (node.key)
|
|
@@ -17035,7 +17709,7 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data: dat
|
|
|
17035
17709
|
}, [selKey]);
|
|
17036
17710
|
return (0, import_jsx_runtime14.jsx)("w", { type: "STATIC", ws: 268435456 | 33554432, style: { ...style, flexDirection: "column", alignItems: "stretch" }, ref, onEvent: (e) => {
|
|
17037
17711
|
if (e.msg === 78) {
|
|
17038
|
-
const code =
|
|
17712
|
+
const code = nmCode(e.lParam);
|
|
17039
17713
|
if (code === -451) {
|
|
17040
17714
|
const h = tvRef.current;
|
|
17041
17715
|
if (!h)
|
|
@@ -17056,10 +17730,49 @@ var TreeView = (0, import_react16.forwardRef)(function TreeViewInner({ data: dat
|
|
|
17056
17730
|
// _build/lib/react-qw/components/PathPicker.js
|
|
17057
17731
|
var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
|
|
17058
17732
|
var import_react17 = __toESM(require_react(), 1);
|
|
17059
|
-
import * as
|
|
17733
|
+
import * as ffi11 from "ffi";
|
|
17060
17734
|
import * as win3 from "win";
|
|
17061
|
-
|
|
17062
|
-
|
|
17735
|
+
|
|
17736
|
+
// _build/lib/win-common-structs.js
|
|
17737
|
+
var OPENFILENAMEW = struct({
|
|
17738
|
+
lStructSize: "u32",
|
|
17739
|
+
hwndOwner: "ptr",
|
|
17740
|
+
hInstance: "ptr",
|
|
17741
|
+
lpstrFilter: "ptr",
|
|
17742
|
+
lpstrCustomFilter: "ptr",
|
|
17743
|
+
nMaxCustFilter: "u32",
|
|
17744
|
+
nFilterIndex: "u32",
|
|
17745
|
+
lpstrFile: "ptr",
|
|
17746
|
+
nMaxFile: "u32",
|
|
17747
|
+
lpstrFileTitle: "ptr",
|
|
17748
|
+
nMaxFileTitle: "u32",
|
|
17749
|
+
lpstrInitialDir: "ptr",
|
|
17750
|
+
lpstrTitle: "ptr",
|
|
17751
|
+
Flags: "u32",
|
|
17752
|
+
nFileOffset: "u16",
|
|
17753
|
+
nFileExtension: "u16",
|
|
17754
|
+
lpstrDefExt: "ptr",
|
|
17755
|
+
lCustData: "ptr",
|
|
17756
|
+
lpfnHook: "ptr",
|
|
17757
|
+
lpTemplateName: "ptr",
|
|
17758
|
+
pvReserved: "ptr",
|
|
17759
|
+
dwReserved: "u32",
|
|
17760
|
+
FlagsEx: "u32"
|
|
17761
|
+
});
|
|
17762
|
+
var BROWSEINFOW = struct({
|
|
17763
|
+
hwndOwner: "ptr",
|
|
17764
|
+
pidlRoot: "ptr",
|
|
17765
|
+
pszDisplayName: "ptr",
|
|
17766
|
+
lpszTitle: "ptr",
|
|
17767
|
+
ulFlags: "u32",
|
|
17768
|
+
lpfn: "ptr",
|
|
17769
|
+
lParam: "ptr",
|
|
17770
|
+
iImage: "i32"
|
|
17771
|
+
});
|
|
17772
|
+
|
|
17773
|
+
// _build/lib/react-qw/components/PathPicker.js
|
|
17774
|
+
var FFI_PTR = ffi11.FFI_TYPE_POINTER;
|
|
17775
|
+
var FFI_U32 = ffi11.FFI_TYPE_UINT32;
|
|
17063
17776
|
var _GetOpenFileNameW = 0;
|
|
17064
17777
|
var _SHBrowseForFolderW = 0;
|
|
17065
17778
|
var _SHGetPathFromIDListW = 0;
|
|
@@ -17088,31 +17801,42 @@ function wideToStr(buf, offset = 0) {
|
|
|
17088
17801
|
const nullIdx = str.indexOf("\0");
|
|
17089
17802
|
return nullIdx >= 0 ? str.substring(0, nullIdx) : str;
|
|
17090
17803
|
}
|
|
17091
|
-
function setPtr2(dv, off, ptr) {
|
|
17092
|
-
dv.setUint32(off, ptr & 4294967295, true);
|
|
17093
|
-
dv.setUint32(off + 4, Math.floor(ptr / 4294967296), true);
|
|
17094
|
-
}
|
|
17095
17804
|
function openFileDialog(owner, filter, title, multiple) {
|
|
17096
17805
|
if (!ensureDlls())
|
|
17097
17806
|
return null;
|
|
17098
|
-
const structBuf = new ArrayBuffer(152);
|
|
17099
|
-
const sv = new DataView(structBuf);
|
|
17100
17807
|
const fileBuf = new ArrayBuffer(260 * 2);
|
|
17101
17808
|
const filterWide = strToWide(filter);
|
|
17102
17809
|
const titleWide = title ? strToWide(title) : null;
|
|
17103
|
-
sv.setUint32(0, 152, true);
|
|
17104
|
-
setPtr2(sv, 8, owner);
|
|
17105
|
-
setPtr2(sv, 24, ffi9.bufferPtr(filterWide));
|
|
17106
|
-
setPtr2(sv, 48, ffi9.bufferPtr(fileBuf));
|
|
17107
|
-
sv.setUint32(56, 260, true);
|
|
17108
17810
|
let flags = 4096 | 2048 | 8;
|
|
17109
17811
|
if (multiple)
|
|
17110
17812
|
flags |= 512;
|
|
17111
17813
|
flags |= 524288;
|
|
17112
|
-
|
|
17113
|
-
|
|
17114
|
-
|
|
17115
|
-
|
|
17814
|
+
const ofn = OPENFILENAMEW.write({
|
|
17815
|
+
lStructSize: OPENFILENAMEW.size,
|
|
17816
|
+
hwndOwner: owner,
|
|
17817
|
+
hInstance: 0,
|
|
17818
|
+
lpstrFilter: ffi11.bufferPtr(filterWide),
|
|
17819
|
+
lpstrCustomFilter: 0,
|
|
17820
|
+
nMaxCustFilter: 0,
|
|
17821
|
+
nFilterIndex: 0,
|
|
17822
|
+
lpstrFile: ffi11.bufferPtr(fileBuf),
|
|
17823
|
+
nMaxFile: 260,
|
|
17824
|
+
lpstrFileTitle: 0,
|
|
17825
|
+
nMaxFileTitle: 0,
|
|
17826
|
+
lpstrInitialDir: 0,
|
|
17827
|
+
lpstrTitle: titleWide ? ffi11.bufferPtr(titleWide) : 0,
|
|
17828
|
+
Flags: flags,
|
|
17829
|
+
nFileOffset: 0,
|
|
17830
|
+
nFileExtension: 0,
|
|
17831
|
+
lpstrDefExt: 0,
|
|
17832
|
+
lCustData: 0,
|
|
17833
|
+
lpfnHook: 0,
|
|
17834
|
+
lpTemplateName: 0,
|
|
17835
|
+
pvReserved: 0,
|
|
17836
|
+
dwReserved: 0,
|
|
17837
|
+
FlagsEx: 0
|
|
17838
|
+
});
|
|
17839
|
+
const ret = ffi11.ffiCall(_GetOpenFileNameW, [FFI_PTR], [ofn], FFI_U32);
|
|
17116
17840
|
if (!ret)
|
|
17117
17841
|
return null;
|
|
17118
17842
|
if (!multiple) {
|
|
@@ -17135,19 +17859,23 @@ function openFileDialog(owner, filter, title, multiple) {
|
|
|
17135
17859
|
function openFolderDialog(owner, title) {
|
|
17136
17860
|
if (!ensureDlls())
|
|
17137
17861
|
return null;
|
|
17138
|
-
const structBuf = new ArrayBuffer(64);
|
|
17139
|
-
const sv = new DataView(structBuf);
|
|
17140
17862
|
const titleWide = title ? strToWide(title) : null;
|
|
17141
|
-
|
|
17142
|
-
|
|
17143
|
-
|
|
17144
|
-
|
|
17145
|
-
|
|
17863
|
+
const bi = BROWSEINFOW.write({
|
|
17864
|
+
hwndOwner: owner,
|
|
17865
|
+
pidlRoot: 0,
|
|
17866
|
+
pszDisplayName: 0,
|
|
17867
|
+
lpszTitle: titleWide ? ffi11.bufferPtr(titleWide) : 0,
|
|
17868
|
+
ulFlags: 65,
|
|
17869
|
+
lpfn: 0,
|
|
17870
|
+
lParam: 0,
|
|
17871
|
+
iImage: 0
|
|
17872
|
+
});
|
|
17873
|
+
const pidl = ffi11.ffiCall(_SHBrowseForFolderW, [FFI_PTR], [bi], FFI_PTR);
|
|
17146
17874
|
if (!pidl)
|
|
17147
17875
|
return null;
|
|
17148
17876
|
const pathBuf = new ArrayBuffer(260 * 2);
|
|
17149
|
-
const ok =
|
|
17150
|
-
|
|
17877
|
+
const ok = ffi11.ffiCall(_SHGetPathFromIDListW, [ffi11.FFI_TYPE_POINTER, FFI_PTR], [pidl, pathBuf], FFI_U32);
|
|
17878
|
+
ffi11.ffiCall(_CoTaskMemFree, [ffi11.FFI_TYPE_POINTER], [pidl], ffi11.FFI_TYPE_VOID);
|
|
17151
17879
|
return ok ? wideToStr(pathBuf) : null;
|
|
17152
17880
|
}
|
|
17153
17881
|
var PathPicker = (0, import_react17.forwardRef)((props, ref) => {
|