Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translated content into Chinese #3

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5317a23
update configure
Flatigers Oct 14, 2022
2200f87
update README.md
Flatigers Oct 14, 2022
80bb414
update Home.md on 22/10/15
Flatigers Oct 14, 2022
cf0382e
update Home.md on 22/10/15
Flatigers Oct 14, 2022
40901a9
Update once tem...
Flatigers Oct 15, 2022
5f5ce66
Update Setup Chapter 01
Flatigers Oct 15, 2022
45e3df2
Update some chapters
Flatigers Oct 16, 2022
8d9e17d
Update
Flatigers Oct 16, 2022
c204009
Improving styles, Update Chapter1, Chapter2, Section 2.1
Flatigers Feb 25, 2023
4b3db7f
Improving styles, Update Section 2.2, Chapter 3, Chapter 4, Chapter 5
Flatigers Feb 27, 2023
853d834
Improving styles, Update Section 2.2, Chapter 3, Chapter 4, Chapter 5
Flatigers Feb 27, 2023
55d1d19
Merge branch 'main' of github.com:Flatigers/fltk-book-zh into main
Flatigers Feb 27, 2023
f13a93b
Improving styles, Update Section 2.2, Chapter 3, Chapter 4, Chapter 5
Flatigers Feb 27, 2023
8f95541
Create CNAME
Flatigers Mar 1, 2023
b96c603
Delete CNAME
Flatigers Mar 1, 2023
2ca0478
Create CNAME
Flatigers Mar 1, 2023
1f17272
Update Section5.1, 5.2, 5.3, 5.4
Flatigers Mar 2, 2023
96b5af5
Update Section5.1, 5.2, 5.3, 5.4
Flatigers Mar 2, 2023
250a47e
Update Section5.1, 5.2, 5.3, 5.4
Flatigers Mar 2, 2023
8df86c2
Update Section5.1, 5.2, 5.3, 5.4
Flatigers Mar 2, 2023
e4509f5
Fix errors, Updated Chapter 5 in all
Flatigers Mar 4, 2023
3113ce8
Update Chapter6, 7, 8
Flatigers Mar 5, 2023
cc114d7
Update Chapter8, Section 8.1, 8.2, Chapter9
Flatigers Mar 8, 2023
fabe5a0
Update Chapter10 all, chapter11, basically completed
Flatigers Mar 9, 2023
2ff97d2
[doc] Update Events.md
Sokiy Jun 12, 2023
f760e29
Sync with the upstream
Flatigers Jun 18, 2023
5ac4ad4
Sync with the upstream
Flatigers Jun 18, 2023
d36c315
Sync with the upstream
Flatigers Jun 18, 2023
5ac9f23
Merge branch 'main' of github.com:Flatigers/fltk-book-zh into main
Flatigers Jun 18, 2023
5d67f55
synced
Flatigers Jun 27, 2023
b7b8cb4
synced
Flatigers Jun 27, 2023
6ab0813
Merge pull request #1 from Sokiy/patch-1
Flatigers Jul 5, 2023
7129482
Update Windows.md
KimdowEin Mar 7, 2024
989f416
Update Home.md
KimdowEin Mar 7, 2024
e8c81fe
Merge pull request #2 from KimdowEin/patch-2
Flatigers Apr 6, 2024
07fb877
Merge pull request #3 from KimdowEin/patch-3
Flatigers Apr 6, 2024
2cb7b70
Sync
Flatigers Apr 6, 2024
ba69f23
Sync
Flatigers Apr 6, 2024
fa23302
sync: sync with source repo
Flatigers May 7, 2024
d179f6f
update docs
Flatigers May 7, 2024
c8c5fba
update docs
Flatigers May 7, 2024
451e6f0
Merge branch 'main' of github.com:Flatigers/fltk-book-zh into main
Flatigers May 7, 2024
47631a7
Merge branch 'main' of github.com:Flatigers/fltk-book-zh into main
Flatigers May 7, 2024
7df7061
Merge branch 'main' of github.com:Flatigers/fltk-book-zh into main
Flatigers May 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@

.vscode
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"Codegeex.EnableExtension": false
}
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fltk.flatig.vip
36 changes: 27 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
# fltk-book

This is an mdbook for fltk-rs. It can be accessed online using the following link:
**翻译已基本完成**


这是一本为 fltk-rs 而写的 mdbook,你正在阅读的是它的中文翻译版。

你可以通过以下链接在线访问它:

https://flatig.vip/fltk-book-zh

你可以通过以下链接在线访问它的英文原版:

https://fltk-rs.github.io/fltk-book

You can print and save as pdf to read at your convenience.
你可以打印并保存为 pdf文件 以便阅读。

通过以下途径为本书做出贡献:

1. 运行 `cargo install mdbook`

2. Fork 这个仓库并 clone 到本地

3. 修改文件

To contribute:
4. 运行 `mdbook build`

1- You need to `cargo install mdbook`
5. 运行 `mdbook serve` 并通过浏览器访问临时网页,检查一切是否正常

2- Fork this repo and clone your fork.
6. Push 你的更改并提交一个 pull request

3- modify files.
## 更新日志

4- run `mdbook build`.
- 2023/6/28
同步原书修改

5- check things are correct by running `mdbook serve` and checking the output in your browser.
- 2023/6/18

6- Push your changes and open a pull request.
同步原书内容,修改部分错误
17 changes: 12 additions & 5 deletions book.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
[book]
authors = ["Mohammed Alyousef"]
language = "en"
multilingual = false
authors = ["Mohammed Alyousef", "Flatig L"]
language = "zh-CN"
src = "src"
title = "fltk book"

[rust]
edition = "2018"
edition = "2021"

[build]
build-dir = "docs"
build-dir = "docs"

[output.html]
git-repository-url = "https://github.com/Flatigers/fltk-book-zh"
edit-url-template = "https://github.com/Flatigers/fltk-book-zh/edit/main/{path}"

[output.html.fold]
enable = true
level = 1
11 changes: 11 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

mdbook clean
echo "cleaned"
mdbook build
echo "builded"
cp ./CNAME ./docs/CNAME
echo "CNAME builded"

git add .
echo "git added"
91 changes: 63 additions & 28 deletions docs/404.html

Large diffs are not rendered by default.

349 changes: 349 additions & 0 deletions docs/Accessibility.html

Large diffs are not rendered by default.

151 changes: 93 additions & 58 deletions docs/Animations.html

Large diffs are not rendered by default.

179 changes: 107 additions & 72 deletions docs/Browsers.html

Large diffs are not rendered by default.

233 changes: 149 additions & 84 deletions docs/Buttons.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fltk.flatig.vip
147 changes: 90 additions & 57 deletions docs/Colors.html

Large diffs are not rendered by default.

424 changes: 277 additions & 147 deletions docs/Cross-Compiling.html

Large diffs are not rendered by default.

213 changes: 132 additions & 81 deletions docs/Custom-Widgets.html

Large diffs are not rendered by default.

310 changes: 167 additions & 143 deletions docs/Dialogs.html

Large diffs are not rendered by default.

137 changes: 86 additions & 51 deletions docs/Drag-&-Drop.html

Large diffs are not rendered by default.

146 changes: 91 additions & 55 deletions docs/Drawing.html

Large diffs are not rendered by default.

320 changes: 172 additions & 148 deletions docs/Events.html

Large diffs are not rendered by default.

155 changes: 95 additions & 60 deletions docs/FAQ.html

Large diffs are not rendered by default.

236 changes: 133 additions & 103 deletions docs/Fluid.html

Large diffs are not rendered by default.

150 changes: 93 additions & 57 deletions docs/Fonts.html

Large diffs are not rendered by default.

137 changes: 86 additions & 51 deletions docs/FrameTypes.html

Large diffs are not rendered by default.

377 changes: 377 additions & 0 deletions docs/GlutWindow.html

Large diffs are not rendered by default.

163 changes: 98 additions & 65 deletions docs/Group-widgets.html

Large diffs are not rendered by default.

203 changes: 124 additions & 79 deletions docs/Home.html

Large diffs are not rendered by default.

149 changes: 92 additions & 57 deletions docs/Images.html

Large diffs are not rendered by default.

145 changes: 90 additions & 55 deletions docs/Input-&-Output.html

Large diffs are not rendered by default.

166 changes: 102 additions & 64 deletions docs/Labels.html

Large diffs are not rendered by default.

214 changes: 123 additions & 91 deletions docs/Layouts.html

Large diffs are not rendered by default.

434 changes: 241 additions & 193 deletions docs/Menus.html

Large diffs are not rendered by default.

238 changes: 144 additions & 94 deletions docs/Setup.html

Large diffs are not rendered by default.

153 changes: 94 additions & 59 deletions docs/State-Management.html

Large diffs are not rendered by default.

104 changes: 71 additions & 33 deletions docs/Style.html

Large diffs are not rendered by default.

176 changes: 105 additions & 71 deletions docs/Styling.html

Large diffs are not rendered by default.

121 changes: 79 additions & 42 deletions docs/Tables.html

Large diffs are not rendered by default.

173 changes: 106 additions & 67 deletions docs/Text.html

Large diffs are not rendered by default.

146 changes: 94 additions & 52 deletions docs/The-App-struct.html

Large diffs are not rendered by default.

221 changes: 127 additions & 94 deletions docs/Trees.html

Large diffs are not rendered by default.

272 changes: 231 additions & 41 deletions docs/Valuators.html

Large diffs are not rendered by default.

160 changes: 98 additions & 62 deletions docs/Widgets.html

Large diffs are not rendered by default.

185 changes: 119 additions & 66 deletions docs/Windows.html

Large diffs are not rendered by default.

84 changes: 51 additions & 33 deletions docs/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
window.onunload = function () { };

// Global variable, shared between modules
function playground_text(playground) {
function playground_text(playground, hidden = true) {
let code_block = playground.querySelector("code");

if (window.ace && code_block.classList.contains("editable")) {
let editor = window.ace.edit(code_block);
return editor.getValue();
} else {
} else if (hidden) {
return code_block.textContent;
} else {
return code_block.innerText;
}
}

Expand Down Expand Up @@ -66,7 +68,7 @@ function playground_text(playground) {
}

// updates the visibility of play button based on `no_run` class and
// used crates vs ones available on http://play.rust-lang.org
// used crates vs ones available on https://play.rust-lang.org
function update_play_button(pre_block, playground_crates) {
var play_button = pre_block.querySelector(".play-button");

Expand Down Expand Up @@ -166,7 +168,6 @@ function playground_text(playground) {
.filter(function (node) {return node.classList.contains("editable"); })
.forEach(function (block) { block.classList.remove('language-rust'); });

Array
code_nodes
.filter(function (node) {return !node.classList.contains("editable"); })
.forEach(function (block) { hljs.highlightBlock(block); });
Expand All @@ -178,7 +179,7 @@ function playground_text(playground) {
// even if highlighting doesn't apply
code_nodes.forEach(function (block) { block.classList.add('hljs'); });

Array.from(document.querySelectorAll("code.language-rust")).forEach(function (block) {
Array.from(document.querySelectorAll("code.hljs")).forEach(function (block) {

var lines = Array.from(block.querySelectorAll('.boring'));
// If no lines were hidden, return
Expand Down Expand Up @@ -300,6 +301,13 @@ function playground_text(playground) {
themePopup.querySelector("button#" + get_theme()).focus();
}

function updateThemeSelected() {
themePopup.querySelectorAll('.theme-selected').forEach(function (el) {
el.classList.remove('theme-selected');
});
themePopup.querySelector("button#" + get_theme()).classList.add('theme-selected');
}

function hideThemes() {
themePopup.style.display = 'none';
themeToggleButton.setAttribute('aria-expanded', false);
Expand Down Expand Up @@ -338,7 +346,7 @@ function playground_text(playground) {
}

setTimeout(function () {
themeColorMetaTag.content = getComputedStyle(document.body).backgroundColor;
themeColorMetaTag.content = getComputedStyle(document.documentElement).backgroundColor;
}, 1);

if (window.ace && window.editors) {
Expand All @@ -355,6 +363,7 @@ function playground_text(playground) {

html.classList.remove(previousTheme);
html.classList.add(theme);
updateThemeSelected();
}

// Set theme
Expand Down Expand Up @@ -432,16 +441,16 @@ function playground_text(playground) {
})();

(function sidebar() {
var html = document.querySelector("html");
var body = document.querySelector("body");
var sidebar = document.getElementById("sidebar");
var sidebarLinks = document.querySelectorAll('#sidebar a');
var sidebarToggleButton = document.getElementById("sidebar-toggle");
var sidebarResizeHandle = document.getElementById("sidebar-resize-handle");
var firstContact = null;

function showSidebar() {
html.classList.remove('sidebar-hidden')
html.classList.add('sidebar-visible');
body.classList.remove('sidebar-hidden')
body.classList.add('sidebar-visible');
Array.from(sidebarLinks).forEach(function (link) {
link.setAttribute('tabIndex', 0);
});
Expand All @@ -462,8 +471,8 @@ function playground_text(playground) {
});

function hideSidebar() {
html.classList.remove('sidebar-visible')
html.classList.add('sidebar-hidden');
body.classList.remove('sidebar-visible')
body.classList.add('sidebar-hidden');
Array.from(sidebarLinks).forEach(function (link) {
link.setAttribute('tabIndex', -1);
});
Expand All @@ -474,14 +483,14 @@ function playground_text(playground) {

// Toggle sidebar
sidebarToggleButton.addEventListener('click', function sidebarToggle() {
if (html.classList.contains("sidebar-hidden")) {
if (body.classList.contains("sidebar-hidden")) {
var current_width = parseInt(
document.documentElement.style.getPropertyValue('--sidebar-width'), 10);
if (current_width < 150) {
document.documentElement.style.setProperty('--sidebar-width', '150px');
}
showSidebar();
} else if (html.classList.contains("sidebar-visible")) {
} else if (body.classList.contains("sidebar-visible")) {
hideSidebar();
} else {
if (getComputedStyle(sidebar)['transform'] === 'none') {
Expand All @@ -497,14 +506,14 @@ function playground_text(playground) {
function initResize(e) {
window.addEventListener('mousemove', resize, false);
window.addEventListener('mouseup', stopResize, false);
html.classList.add('sidebar-resizing');
body.classList.add('sidebar-resizing');
}
function resize(e) {
var pos = (e.clientX - sidebar.offsetLeft);
if (pos < 20) {
hideSidebar();
} else {
if (html.classList.contains("sidebar-hidden")) {
if (body.classList.contains("sidebar-hidden")) {
showSidebar();
}
pos = Math.min(pos, window.innerWidth - 100);
Expand All @@ -513,7 +522,7 @@ function playground_text(playground) {
}
//on mouseup remove windows functions mousemove & mouseup
function stopResize(e) {
html.classList.remove('sidebar-resizing');
body.classList.remove('sidebar-resizing');
window.removeEventListener('mousemove', resize, false);
window.removeEventListener('mouseup', stopResize, false);
}
Expand Down Expand Up @@ -542,33 +551,41 @@ function playground_text(playground) {
firstContact = null;
}
}, { passive: true });

// Scroll sidebar to current active section
var activeSection = document.getElementById("sidebar").querySelector(".active");
if (activeSection) {
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
activeSection.scrollIntoView({ block: 'center' });
}
})();

(function chapterNavigation() {
document.addEventListener('keydown', function (e) {
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return; }
if (window.search && window.search.hasFocus()) { return; }
var html = document.querySelector('html');

function next() {
var nextButton = document.querySelector('.nav-chapters.next');
if (nextButton) {
window.location.href = nextButton.href;
}
}
function prev() {
var previousButton = document.querySelector('.nav-chapters.previous');
if (previousButton) {
window.location.href = previousButton.href;
}
}
switch (e.key) {
case 'ArrowRight':
e.preventDefault();
var nextButton = document.querySelector('.nav-chapters.next');
if (nextButton) {
window.location.href = nextButton.href;
if (html.dir == 'rtl') {
prev();
} else {
next();
}
break;
case 'ArrowLeft':
e.preventDefault();
var previousButton = document.querySelector('.nav-chapters.previous');
if (previousButton) {
window.location.href = previousButton.href;
if (html.dir == 'rtl') {
next();
} else {
prev();
}
break;
}
Expand All @@ -592,7 +609,7 @@ function playground_text(playground) {
text: function (trigger) {
hideTooltip(trigger);
let playground = trigger.closest("pre");
return playground_text(playground);
return playground_text(playground, false);
}
});

Expand Down Expand Up @@ -667,13 +684,14 @@ function playground_text(playground) {
}, { passive: true });
})();
(function controllBorder() {
menu.classList.remove('bordered');
document.addEventListener('scroll', function () {
function updateBorder() {
if (menu.offsetTop === 0) {
menu.classList.remove('bordered');
} else {
menu.classList.add('bordered');
}
}, { passive: true });
}
updateBorder();
document.addEventListener('scroll', updateBorder, { passive: true });
})();
})();
Loading