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