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