Repository: idea4good/GuiLitePreviewer
Branch: master
Commit: 22e7a00a4e54
Files: 15
Total size: 26.7 KB
Directory structure:
gitextract_w5wha8h5/
├── .github/
│ └── FUNDING.yml
├── .gitignore
├── .vscode/
│ ├── launch.json
│ ├── settings.json
│ └── tasks.json
├── LICENSE
├── README.md
├── README_zh.md
├── UIcode.cpp
├── media/
│ └── main.js
├── package.json
├── src/
│ ├── extension.ts
│ └── preview.html
├── tsconfig.json
└── tslint.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/FUNDING.yml
================================================
custom: https://idea4good.github.io/
================================================
FILE: .gitignore
================================================
.DS_Store
npm-debug.log
Thumbs.db
/node_modules/
/out/
================================================
FILE: .vscode/launch.json
================================================
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "npm: watch"
}
]
}
================================================
FILE: .vscode/settings.json
================================================
{
"editor.insertSpaces": false
}
================================================
FILE: .vscode/tasks.json
================================================
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
# GuiLite Previewer - WYSIWYG extension for GuiLite
- [GuiLite](https://github.com/idea4good/GuiLite) is the smalles/simplest/stablest GUI library for all platforms, it has only 5,000 line C++ code.
- GuiLite Previewer is a Visual Studio Code extension, could extract GUI information from C++ code and preview GUI at preview page(What you see is what you get)
- No need for drag-and-drop widgets, everything (e.g. code/design/build/debug) could be done by coding
- No need for special GUI editor(e.g. Android Studio, Qt designer)
- No need for Extensible Markup Language(e.g. xml, xaml)
## Demo

## Quick start
1. Open VS Code
2. Click Extensions
3. Search "GuiLite" and install
## How to build/debug GuiLite Previewer?
1. Download npm, and install
2. Run in Windows command line: `cd GuiLitePreviwer` ⚠️and make sure you're in **GuiLitePreviwer** folder⚠️
3. Run in Windows command line: `npm install`
4. Run in Windows command line: `code .` which will open the project in VS Code window
5. In VS Code window you just opened, Press `F5` to build/debug the extension
6. You will get an new VS Code window with the extension you build above
7. In the new VS Code window, open your source code(e.g. test.cpp)
8. `ctrl + shift + p`, and input `GuiLite: preview layout`
9. You will see your GUI layout in preview page
================================================
FILE: README_zh.md
================================================
# GuiLite Previewer - 所见即所得的GuiLite开发插件
- [GuiLite](https://gitee.com/idea4good/GuiLite)是最轻量,最简单,最稳定的GUI库,它只有5千行C++代码
- GuiLite Previewer是一个Visual Studio Code插件,它可以自动提取源代码的GUI布局信息,并实时显示在“预览”页面上(所见即所得)
- **不需要**“拖拽”控件,仅通过敲代码,就可以完成所有工作(例如:代码,UI编辑,编译,运行,调试)
- **不需要**使用庞大的GUI编辑工具(或IDE,例如:Android Studio, Qt designer)
- **不需要**使用可扩展标记语言(例如:xml, xaml)
## Demo

## 如何编译/使用GuiLite Previewer?
1. Download npm, and install
2. Run in Windows command line: `cd GuiLitePreviwer` ⚠️and make sure you're in **GuiLitePreviwer** folder⚠️
3. Run in Windows command line: `npm install`
4. Run in Windows command line: `code .` which will open the project in VS Code window
5. In VS Code window you just opened, Press `F5` to build/debug the extension
6. You will get an new VS Code window with the extension you build above
7. In the new VS Code window, open your source code(e.g. test.cpp)
8. `ctrl + shift + p`, and input `GuiLite: preview layout`
9. You will see your GUI layout in preview page
================================================
FILE: UIcode.cpp
================================================
WND_TREE s_main_widgets[] =
{
{ &s_edit, ID_EDIT, "Input", 275, 10, 100, 50},
{ &s_label_1, ID_LABEL_1, "label 1", 150, 100, 100, 50},
{ &s_label_2, ID_LABEL_2, "label 2", 150, 170, 100, 50},
{ &s_label_3, ID_LABEL_3, "label 3", 150, 240, 100, 50},
{ &s_button, ID_BUTTON, "Dialog", 400, 100, 100, 50},
{ &s_spin_box, ID_SPIN_BOX,"spinBox", 400, 170, 100, 50},
{ &s_list_box, ID_LIST_BOX,"listBox", 400, 240, 100, 50},
{NULL, 0 , 0, 0, 0, 0, 0}
};
================================================
FILE: media/main.js
================================================
// This script will be run within the webview itself
// It cannot access the main VS Code APIs directly.
(function () {
const vscode = acquireVsCodeApi();
const oldState = vscode.getState();
const counter = document.getElementById('lines-of-code-counter');
console.log(oldState);
let currentCount = (oldState && oldState.count) || 0;
counter.textContent = currentCount;
setInterval(() => {
counter.textContent = currentCount++;
// Update state
vscode.setState({ count: currentCount });
// Alert the extension when the cat introduces a bug
if (Math.random() < Math.min(0.001 * currentCount, 0.05)) {
// Send a message back to the extension
vscode.postMessage({
command: 'alert',
text: '🐛 on line ' + currentCount
});
}
}, 100);
// Handle messages sent from the extension to the webview
window.addEventListener('message', event => {
const message = event.data; // The json data that the extension sent
switch (message.command) {
case 'refactor':
currentCount = Math.ceil(currentCount * 0.5);
counter.textContent = currentCount;
break;
}
});
}());
================================================
FILE: package.json
================================================
{
"name": "guilite-previewer",
"description": "GuiLitePreviewer - Preview layout for GuiLite Appp code",
"version": "0.0.1",
"publisher": "vscode-samples",
"engines": {
"vscode": "^1.32.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:guiLite.preview",
"onCommand:guiLite.doThing",
"onWebviewPanel:preview"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "guiLite.preview",
"title": "Preview layout",
"category": "GuiLite"
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"lint": "tslint -p ./",
"watch": "tsc -w -p ./"
},
"dependencies": {},
"devDependencies": {
"@types/node": "^10.5.2",
"tslint": "^5.16.0",
"typescript": "^3.4.5",
"@types/vscode": "^1.32.0"
}
}
================================================
FILE: src/extension.ts
================================================
import * as path from 'path';
import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand('guiLite.preview', () => {
let editor = vscode.window.activeTextEditor;
if(!editor){
vscode.window.showErrorMessage("Can not preview, because no document is open");
return;
}
PreviewPanel.createOrShow(context.extensionPath);
})
);
context.subscriptions.push(
vscode.commands.registerCommand('guiLite.doThing', () => {
if (PreviewPanel.currentPanel) {
PreviewPanel.currentPanel.doRefactor();
}
})
);
if (vscode.window.registerWebviewPanelSerializer) {
// Make sure we register a serializer in activation event
vscode.window.registerWebviewPanelSerializer(PreviewPanel.viewType, {
async deserializeWebviewPanel(webviewPanel: vscode.WebviewPanel, state: any) {
console.log(`Got state: ${state}`);
PreviewPanel.revive(webviewPanel, context.extensionPath);
}
});
}
}
/**
* Manages GuiLite preview webview panels
*/
class PreviewPanel {
/**
* Track the currently panel. Only allow a single panel to exist at a time.
*/
public static currentPanel: PreviewPanel | undefined;
public static readonly viewType = 'preview';
private readonly _panel: vscode.WebviewPanel;
private readonly _extensionPath: string;
private _disposables: vscode.Disposable[] = [];
public static createOrShow(extensionPath: string) {
const column = vscode.window.activeTextEditor
? vscode.window.activeTextEditor.viewColumn
: undefined;
// If we already have a panel, show it.
if (PreviewPanel.currentPanel) {
PreviewPanel.currentPanel._panel.reveal(column);
return;
}
// Otherwise, create a new panel.
const panel = vscode.window.createWebviewPanel(
PreviewPanel.viewType,
'GuiLite preview',
column || vscode.ViewColumn.One,
{
// Enable javascript in the webview
enableScripts: true,
// And restrict the webview to only loading content from our extension's `media` directory.
localResourceRoots: [vscode.Uri.file(path.join(extensionPath, 'media'))]
}
);
PreviewPanel.currentPanel = new PreviewPanel(panel, extensionPath);
}
public static revive(panel: vscode.WebviewPanel, extensionPath: string) {
PreviewPanel.currentPanel = new PreviewPanel(panel, extensionPath);
}
private constructor(panel: vscode.WebviewPanel, extensionPath: string) {
this._panel = panel;
this._extensionPath = extensionPath;
// Set the webview's initial html content
this._update();
// Listen for when the panel is disposed
// This happens when the user closes the panel or when the panel is closed programatically
this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
// Update the content based on view changes
this._panel.onDidChangeViewState(
e => {
if (this._panel.visible) {
this._update();
}
},
null,
this._disposables
);
// Handle messages from the webview
this._panel.webview.onDidReceiveMessage(
message => {
switch (message.command) {
case 'refresh':
if (this._panel.visible) {
this._update();
}
return;
default:
vscode.window.showErrorMessage(message.text);
return;
}
},
null,
this._disposables
);
}
public doRefactor() {
// Send a message to the webview webview.
// You can send any JSON serializable data.
this._panel.webview.postMessage({ command: 'refactor' });
}
public dispose() {
PreviewPanel.currentPanel = undefined;
// Clean up our resources
this._panel.dispose();
while (this._disposables.length) {
const x = this._disposables.pop();
if (x) {
x.dispose();
}
}
}
private _update() {
let uri = require('vscode').window.activeTextEditor.document.uri;
// assuming the file was saved, let's open it in a view column
vscode.workspace.openTextDocument(uri).then(doc=>{
let sourceCode = doc.getText();
switch (this._panel.viewColumn) {
case vscode.ViewColumn.One:
default:
this._panel.title = 'GuiLite Preview';
this._panel.webview.html = this._getHtmlForWebview(sourceCode);
}
});
}
private _getHtmlForWebview(sourceCode: string) {
return `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8;">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GuiLite preview</title>
</head>
<body>
<h1 id="source-code" visible="false">${sourceCode}</h1>
<canvas id="screen" width="1024" height="768"></canvas>
</body>
<script type="text/javascript">
function draw_single_widget(context, str, rect){
console.log(rect);
context.fillStyle = "#1A1D34";
context.fillRect(rect[0], rect[1], rect[2], rect[3]);
context.fillStyle = "#FFFFFF";
context.font = "20px Arial";
context.textAlign = "center"
context.textBaseline = "middle";
context.fillText(str, rect[0] + rect[2]/2, rect[1] + rect[3]/2);
}
function draw_widgets(context, widgets){
for( var i = 0; i < widgets.length; i++){
widget_name = widgets[i].match(/".*"/g);
if(widget_name.length != 1){
console.log('Invalid widget_name' + ':' + widget_name.toString());
}else{
widget_name = widget_name[0].replace(/"/g,'');//remove "
}
widget_without_name = widgets[i].replace(/".*"/g, '');//Remove widget name for rect
var rect = widget_without_name.match(/[^A-Za-z_]\\d+/g);
rect = rect.map(Number);
console.log(widget_name.toString() + ': ' + rect.toString());
draw_single_widget(context, widget_name, rect)
}
}
function search_widgets(tree){
var widgets = tree.match(/{ *&[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*/g);
console.log(widgets.length.toString() + ':' + widgets.toString());
return widgets;
}
function search_trees(source){
var trees = source.match(/WND_TREE[\\s\\S]*};$/mg);
console.log(trees.length.toString() + ':' + trees.toString());
return trees;
}
function start_timer(){
const vscode = acquireVsCodeApi();
setInterval(() => {
vscode.postMessage({
command: 'refresh',
text: 'webview'
})
}, 500);
}
document.getElementById("source-code").style.display = "none";
const canvas = document.getElementById('screen');
const context = canvas.getContext('2d');
context.fillStyle = "#000000";
context.fillRect(0, 0, 1024, 768);
var source_code = document.getElementById('source-code').textContent;
var trees = search_trees(source_code);
for( var i = 0; i < trees.length; i++){
var widgets = search_widgets(trees[i]);
draw_widgets(context, widgets);
}
start_timer();
</script>
</html>`;
}
}
================================================
FILE: src/preview.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<title>GuiLite preview</title>
</head>
<body>
<canvas id="screen" width="1024" height="768"></canvas>
</body>
<script type="text/javascript">
function draw_single_widget(context, str, rect){
console.log(rect);
context.fillStyle = "#1A1D34";
context.fillRect(rect[0], rect[1], rect[2], rect[3]);
context.fillStyle = "#FFFFFF";
context.font = "20px Arial";
context.textAlign = "center"
context.textBaseline = "middle";
context.fillText(str, rect[0] + rect[2]/2, rect[1] + rect[3]/2);
}
function draw_widgets(context, widgets){
for( var i = 0; i < widgets.length; i++){
widget_name = widgets[i].match(/".*"/g);
if(widget_name.length != 1){
console.log('Invalid widget_name' + ':' + widget_name.toString());
}else{
widget_name = widget_name[0].replace(/"/g,'');//remove "
}
widget_without_name = widgets[i].replace(/".*"/g, '');//Remove widget name for rect
var rect = widget_without_name.match(/[^A-Za-z_]\d+/g);
rect = rect.map(Number);
console.log(widget_name.toString() + ': ' + rect.toString());
draw_single_widget(context, widget_name, rect)
}
}
function search_widgets(tree){
var widgets = tree.match(/{ *&[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*/g);
console.log(widgets.length.toString() + ':' + widgets.toString());
return widgets;
}
function search_trees(source){
var trees = source.match(/WND_TREE[\s\S]*};$/mg);
console.log(trees.length.toString() + ':' + trees.toString());
return trees;
}
const canvas = document.getElementById('screen');
const context = canvas.getContext('2d');
context.fillStyle = "#000000";
context.fillRect(0, 0, 1024, 768);
var source_code = `static c_my_dialog s_my_dialog;
static c_button s_exit_button;
WND_TREE s_dialog_widgets[] =
{
{ &s_exit_button, ID_EXIT_BUTTON, "Exit", 100, 100, 100, 50},
{NULL, 0 , 0, 0, 0, 0, 0}
};
WND_TREE s_main_widgets[] =
{
{ &s_edit, ID_EDIT, "Input", 275, 10, 100, 50},
{ &s_label_1, ID_LABEL_1, "label 1", 150, 100, 100, 50},
{ &s_label_2, ID_LABEL_2, "label 2", 150, 170, 100, 50},
{ &s_label_3, ID_LABEL_3, "label 3", 150, 240, 100, 50},
{ &s_button, ID_BUTTON, "Dialog", 400, 100, 100, 50},
{ &s_spin_box, ID_SPIN_BOX,"spinBox", 400, 170, 100, 50},
{ &s_list_box, ID_LIST_BOX,"listBox", 400, 240, 100, 50},
{ &s_my_dialog, ID_DIALOG, "Dialog", 200, 100, 280, 312, s_dialog_widgets},
{NULL, 0 , 0, 0, 0, 0, 0}
};
int captureUiOfHelloWidgets()
{
return s_display->snap_shot("snap_short.bmp");
}`;
var trees = search_trees(source_code);
for( var i = 0; i < trees.length; i++){
var widgets = search_widgets(trees[i]);
draw_widgets(context, widgets);
}
</script>
</html>
================================================
FILE: tsconfig.json
================================================
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"lib": ["es6"],
"sourceMap": true,
"strict": true,
"rootDir": "src"
},
"exclude": ["node_modules", ".vscode-test"]
}
================================================
FILE: tslint.json
================================================
{
"rules": {
"indent": [true, "tabs"],
"semicolon": [true, "always"]
}
}
gitextract_w5wha8h5/ ├── .github/ │ └── FUNDING.yml ├── .gitignore ├── .vscode/ │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── LICENSE ├── README.md ├── README_zh.md ├── UIcode.cpp ├── media/ │ └── main.js ├── package.json ├── src/ │ ├── extension.ts │ └── preview.html ├── tsconfig.json └── tslint.json
SYMBOL INDEX (9 symbols across 1 files)
FILE: src/extension.ts
function activate (line 4) | function activate(context: vscode.ExtensionContext) {
class PreviewPanel (line 38) | class PreviewPanel {
method createOrShow (line 50) | public static createOrShow(extensionPath: string) {
method revive (line 78) | public static revive(panel: vscode.WebviewPanel, extensionPath: string) {
method constructor (line 82) | private constructor(panel: vscode.WebviewPanel, extensionPath: string) {
method doRefactor (line 123) | public doRefactor() {
method dispose (line 129) | public dispose() {
method _update (line 143) | private _update() {
method _getHtmlForWebview (line 157) | private _getHtmlForWebview(sourceCode: string) {
Condensed preview — 15 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (30K chars).
[
{
"path": ".github/FUNDING.yml",
"chars": 37,
"preview": "custom: https://idea4good.github.io/\n"
},
{
"path": ".gitignore",
"chars": 55,
"preview": ".DS_Store\nnpm-debug.log\nThumbs.db\n/node_modules/\n/out/\n"
},
{
"path": ".vscode/launch.json",
"chars": 601,
"preview": "// A launch configuration that compiles the extension and then opens it inside a new window\n// Use IntelliSense to learn"
},
{
"path": ".vscode/settings.json",
"chars": 36,
"preview": "{\n \"editor.insertSpaces\": false\n}"
},
{
"path": ".vscode/tasks.json",
"chars": 366,
"preview": "// See https://go.microsoft.com/fwlink/?LinkId=733558\n// for the documentation about the tasks.json format\n{\n\t\"version\":"
},
{
"path": "LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 1337,
"preview": "# GuiLite Previewer - WYSIWYG extension for GuiLite \n- [GuiLite](https://github.com/idea4good/GuiLite) is the smalles/si"
},
{
"path": "README_zh.md",
"chars": 1000,
"preview": "# GuiLite Previewer - 所见即所得的GuiLite开发插件\n- [GuiLite](https://gitee.com/idea4good/GuiLite)是最轻量,最简单,最稳定的GUI库,它只有5千行C++代码\n- "
},
{
"path": "UIcode.cpp",
"chars": 461,
"preview": "WND_TREE s_main_widgets[] =\n{\n\t{ &s_edit,\t\tID_EDIT,\t\"Input\",\t275, 10, 100, 50},\n\n\t{ &s_label_1,\tID_LABEL_1,\t\"label 1\",\t"
},
{
"path": "media/main.js",
"chars": 1295,
"preview": "// This script will be run within the webview itself\n// It cannot access the main VS Code APIs directly.\n(function () {\n"
},
{
"path": "package.json",
"chars": 814,
"preview": "{\n\t\"name\": \"guilite-previewer\",\n\t\"description\": \"GuiLitePreviewer - Preview layout for GuiLite Appp code\",\n\t\"version\": \""
},
{
"path": "src/extension.ts",
"chars": 6945,
"preview": "import * as path from 'path';\nimport * as vscode from 'vscode';\n\nexport function activate(context: vscode.ExtensionConte"
},
{
"path": "src/preview.html",
"chars": 2782,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <title>GuiLite preview</title>\n</head>\n<body>\n <canvas id=\"screen\" width="
},
{
"path": "tsconfig.json",
"chars": 213,
"preview": "{\n\t\"compilerOptions\": {\n\t\t\"module\": \"commonjs\",\n\t\t\"target\": \"es6\",\n\t\t\"outDir\": \"out\",\n\t\t\"lib\": [\"es6\"],\n\t\t\"sourceMap\": t"
},
{
"path": "tslint.json",
"chars": 78,
"preview": "{\n\t\"rules\": {\n\t\t\"indent\": [true, \"tabs\"],\n\t\t\"semicolon\": [true, \"always\"]\n\t}\n}"
}
]
About this extraction
This page contains the full source code of the idea4good/GuiLitePreviewer GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 15 files (26.7 KB), approximately 7.3k tokens, and a symbol index with 9 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.