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