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