mirror of
https://github.com/fltk/fltk.git
synced 2026-05-25 09:17:49 +08:00
Fluid: update documentation scripts
TeX and pdf generation untested at this point
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
set(DOCS)
|
set(DOCS)
|
||||||
|
set(GIT_REVISION "")
|
||||||
set(YEAR "")
|
set(YEAR "")
|
||||||
set(CURRENT_DATE "")
|
set(CURRENT_DATE "")
|
||||||
|
|
||||||
@@ -26,19 +27,16 @@ if(FLTK_BUILD_FLUID_DOCS OR FLTK_BUILD_PDF_DOCS)
|
|||||||
|
|
||||||
# create required variables
|
# create required variables
|
||||||
|
|
||||||
execute_process(COMMAND date "+%Y"
|
string(TIMESTAMP YEAR "%Y" UTC)
|
||||||
OUTPUT_VARIABLE YEAR
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
)
|
|
||||||
|
|
||||||
# note: current locale is used for abbreviated month
|
# note: current locale is used for abbreviated month
|
||||||
execute_process(COMMAND date "+%b %d, %Y"
|
string(TIMESTAMP CURRENT_DATE "%b %d, %Y" UTC)
|
||||||
OUTPUT_VARIABLE CURRENT_DATE
|
string(TIMESTAMP PDF_DATE "D:%Y%m%d%H%M%SZ" UTC)
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
string(TIMESTAMP TODAY "%B %d, %Y" UTC)
|
||||||
)
|
string(REPLACE " 0" " " TODAY "${TODAY}")
|
||||||
|
|
||||||
# Find "short" doxygen version if it was built from Git
|
# Find "short" doxygen version if it was built from Git
|
||||||
# Note: this is still needed in CMake 3.12.0 but later CMake versions
|
# Note: this is still needed in CMake 3.15 but later CMake versions
|
||||||
# (notably 3.25) remove the Git revision in 'DOXYGEN_VERSION'.
|
# (notably 3.25) remove the Git revision in 'DOXYGEN_VERSION'.
|
||||||
# Todo: Find the "first good" CMake version and remove this redundant
|
# Todo: Find the "first good" CMake version and remove this redundant
|
||||||
# code once we require this as our minimal version and replace the
|
# code once we require this as our minimal version and replace the
|
||||||
@@ -144,6 +142,8 @@ if(FLTK_BUILD_PDF_DOCS AND FLTK_BUILD_FLUID_DOCS)
|
|||||||
|
|
||||||
# convert Doxybook to current doxygen version
|
# convert Doxybook to current doxygen version
|
||||||
|
|
||||||
|
set(DOXY_VERSION "${DOXYGEN_VERSION_SHORT}") #
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
@@ -164,6 +164,12 @@ if(FLTK_BUILD_PDF_DOCS AND FLTK_BUILD_FLUID_DOCS)
|
|||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/make_pdf.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/make_pdf
|
||||||
|
@ONLY
|
||||||
|
)
|
||||||
|
|
||||||
# generate fluid.pdf
|
# generate fluid.pdf
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
@@ -173,7 +179,7 @@ if(FLTK_BUILD_PDF_DOCS AND FLTK_BUILD_FLUID_DOCS)
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/fluid-title.tex
|
${CMAKE_CURRENT_BINARY_DIR}/fluid-title.tex
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/fluid-book.tex
|
${CMAKE_CURRENT_BINARY_DIR}/fluid-book.tex
|
||||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE}
|
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE}
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/make_pdf
|
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/make_pdf
|
||||||
COMMAND cp -f latex/refman.pdf fluid.pdf
|
COMMAND cp -f latex/refman.pdf fluid.pdf
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${DOXYFILE}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/fluid-title.tex
|
${CMAKE_CURRENT_BINARY_DIR}/fluid-title.tex
|
||||||
|
|||||||
@@ -26,10 +26,15 @@
|
|||||||
#
|
#
|
||||||
# Used in: Makefile and CMakeLists.txt
|
# Used in: Makefile and CMakeLists.txt
|
||||||
|
|
||||||
|
run_pdflatex() {
|
||||||
|
pdflatex --interaction=nonstopmode \
|
||||||
|
"\pdfinfo{/CreationDate(@PDF_DATE@)/ModDate(@PDF_DATE@)}\input{refman.tex}"
|
||||||
|
}
|
||||||
|
|
||||||
( cd latex
|
( cd latex
|
||||||
pdflatex --interaction=nonstopmode refman.tex
|
run_pdflatex
|
||||||
makeindex refman.idx
|
makeindex refman.idx
|
||||||
pdflatex --interaction=nonstopmode refman.tex
|
run_pdflatex
|
||||||
latex_count=5
|
latex_count=5
|
||||||
while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log \
|
while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log \
|
||||||
&& [ $latex_count -gt 0 ]
|
&& [ $latex_count -gt 0 ]
|
||||||
@@ -23,9 +23,9 @@ Permission is granted to reproduce this manual or any portion for any purpose,}\
|
|||||||
{\small
|
{\small
|
||||||
provided this copyright and permission notice are preserved.}\\
|
provided this copyright and permission notice are preserved.}\\
|
||||||
\vspace*{1.5cm}
|
\vspace*{1.5cm}
|
||||||
{\large Generated by Doxygen @DOXYGEN_VERSION_SHORT@}\\
|
{\large Generated by Doxygen @DOXYGEN_VERSION@}\\
|
||||||
\vspace*{0.5cm}
|
\vspace*{0.5cm}
|
||||||
\today{}\\
|
@TODAY@\\
|
||||||
\vspace*{0.5cm}
|
\vspace*{0.5cm}
|
||||||
{\small Git revision @FLTK_GIT_REVISION@}\\
|
{\small Git revision @FLTK_GIT_REVISION@}\\
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|||||||
@@ -10,29 +10,29 @@
|
|||||||
This feature allows developers to edit the C++ source files generated by Fluid and
|
This feature allows developers to edit the C++ source files generated by Fluid and
|
||||||
then merge those changes back into the corresponding Fluid project file (.fl). This
|
then merge those changes back into the corresponding Fluid project file (.fl). This
|
||||||
can streamline the development process by reducing the need to switch between Fluid
|
can streamline the development process by reducing the need to switch between Fluid
|
||||||
and your code editor for minor adjustments.
|
and your code editor for minor adjustments.
|
||||||
|
|
||||||
**Important Note:** MergeBack is currently experimental and may not handle all
|
\note MergeBack is currently experimental and may not handle all
|
||||||
scenarios perfectly. It's advisable to back up your project files before using this
|
scenarios perfectly. It's advisable to back up your project files before using this
|
||||||
feature to prevent potential data loss.
|
feature to prevent potential data loss.
|
||||||
|
|
||||||
**Enabling MergeBack:**
|
<H2>Enabling MergeBack</H2>
|
||||||
|
|
||||||
1. **Open Your Project in Fluid:**
|
1. **Open Your Project in Fluid:**
|
||||||
- Launch Fluid and load your existing `.fl` project file.
|
- Launch Fluid and load your existing `.fl` project file.
|
||||||
|
|
||||||
2. **Enable MergeBack:**
|
2. **Enable MergeBack:**
|
||||||
- Navigate to the **Settings Panel**.
|
- Navigate to the **Settings Panel**.
|
||||||
- In the **Project Settings**, locate and enable the **MergeBack** option.
|
- In the **Project Settings**, locate and enable the **MergeBack** option.
|
||||||
|
|
||||||
Once enabled, Fluid assigns a unique ID to each node in your project.
|
Once enabled, Fluid assigns a unique ID to each node in your project.
|
||||||
Additionally, user-editable code sections in the generated source files will
|
Additionally, user-editable code sections in the generated source files will
|
||||||
be marked with special divider lines, indicating areas that can be edited
|
be marked with special divider lines, indicating areas that can be edited
|
||||||
and later merged back.
|
and later merged back.
|
||||||
|
|
||||||
**Understanding the Code Markers:**
|
<H2>Understanding the Code Markers:</H2>
|
||||||
|
|
||||||
In the generated `.cxx` files, editable sections are demarcated as follows:
|
In the generated `.cxx` files, editable sections are demarcated as follows:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
static void cb_script_panel(Fl_Double_Window*, void*) {
|
static void cb_script_panel(Fl_Double_Window*, void*) {
|
||||||
@@ -42,43 +42,39 @@
|
|||||||
//fl ▲ ----------=~-~~=-=--=~-----------~-==--~=~-~~--~=-~=~- ▲ fl//
|
//fl ▲ ----------=~-~~=-=--=~-----------~-==--~=~-~~--~=-~=~- ▲ fl//
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The lines beginning with `//fl ▼` and `//fl ▲` are markers that Fluid
|
The lines beginning with `//fl ▼` and `//fl ▲` are markers that Fluid
|
||||||
uses to identify editable sections. These markers contain encoded information
|
uses to identify editable sections. These markers contain encoded information
|
||||||
about the code block, including a CRC32 checksum and a unique node ID. Fluid
|
about the code block, including a CRC32 checksum and a unique node ID. Fluid
|
||||||
uses this information during the merge process to detect changes and associate
|
uses this information during the merge process to detect changes and associate
|
||||||
them with the correct nodes in your project.
|
them with the correct nodes in your project.
|
||||||
|
|
||||||
**Editing and Merging Back:**
|
<H2>Editing and Merging Back</H2>
|
||||||
|
|
||||||
1. **Edit the Source Code:**
|
1. **Edit the Source Code:**
|
||||||
- Open the generated `.cxx` file in your preferred code editor.
|
- Open the generated `.cxx` file in your preferred code editor.
|
||||||
- Make your desired changes within the marked sections.
|
- Make your desired changes within the marked sections.
|
||||||
|
|
||||||
2. **Merge Changes Back into Fluid:**
|
2. **Merge Changes Back into Fluid:**
|
||||||
- After saving your edits, return to Fluid.
|
- After saving your edits, return to Fluid.
|
||||||
- Select **File > MergeBack** from the main menu or press `Ctrl+Shift+M`.
|
- Select **File > MergeBack** from the main menu or press `Ctrl+Shift+M`.
|
||||||
- Fluid will analyze the `.cxx` file, detect changes within the marked
|
- Fluid will analyze the `.cxx` file, detect changes within the marked
|
||||||
sections, and offer to merge them back into the `.fl` project file.
|
sections, and offer to merge them back into the `.fl` project file.
|
||||||
|
|
||||||
**Things to Keep in Mind:**
|
<H2>Things to Keep in Mind</H2>
|
||||||
|
|
||||||
- **Scope of MergeBack:** Currently, MergeBack supports merging changes
|
- **Scope of MergeBack:** Currently, MergeBack supports merging changes
|
||||||
made to code blocks and widget callbacks. Other modifications might
|
made to code blocks and widget callbacks. Other modifications might
|
||||||
not be recognized or merged correctly.
|
not be recognized or merged correctly.
|
||||||
|
- **Conflict Detection:** Fluid calculates checksums (CRC32) for the
|
||||||
|
code blocks to detect changes. If discrepancies are found, Fluid
|
||||||
|
will prompt you with options to merge or cancel the changes.
|
||||||
|
- **Undo Functionality:** In case of unintended merges, Fluid provides
|
||||||
|
an undo feature to revert the project to its previous state.
|
||||||
|
|
||||||
- **Conflict Detection:** Fluid calculates checksums (CRC32) for the
|
<H2>Caution</H2>
|
||||||
code blocks to detect changes. If discrepancies are found, Fluid
|
|
||||||
will prompt you with options to merge or cancel the changes.
|
|
||||||
|
|
||||||
- **Undo Functionality:** In case of unintended merges, Fluid provides
|
Given the experimental nature of MergeBack, unexpected
|
||||||
an undo feature to revert the project to its previous state.
|
behaviors may occur. Always ensure you have backups of your project
|
||||||
|
files before using this feature.
|
||||||
**Caution:** Given the experimental nature of MergeBack, unexpected
|
|
||||||
behaviors may occur. Always ensure you have backups of your project
|
|
||||||
files before using this feature.
|
|
||||||
|
|
||||||
\note The MergeBack feature is still under development. It's recommended
|
|
||||||
to use it cautiously and provide feedback to the FLTK development
|
|
||||||
team to help improve its functionality and reliability.
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user