Separate FLUID user documentation, screen shot automation (#936)

* CMake integration, no autotiools
* alignment panel is now correctly renamed to setting panel
* source view is now correctly renamed to code view
* Merge FLTK FLUID docs into FLUID user manual.
* Add two simple entry tutorials
* Remove FLUID chapter form FLTK docs.
* GitHub action to generate HTML and PDF docs and
  make the available as artefacts
This commit is contained in:
Matthias Melcher
2024-04-17 17:51:32 +02:00
committed by GitHub
parent b4cf1a9824
commit fd791a068e
122 changed files with 7954 additions and 3050 deletions

84
.github/workflows/build_fluid_docs.yml vendored Normal file
View File

@@ -0,0 +1,84 @@
#
# This script builds the FLUID User Handbook as html directory and pdf
# document on a Linux machine.
#
name: 'Build FLUID User Handbook'
# This job must be called explicitly form the 'Actions' tab in GitHub
on: [workflow_dispatch]
permissions:
contents: read
jobs:
build-html:
runs-on: ubuntu-latest
## This can also run on macOS, but BasicTeX will not generate the pdf document
# runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
run: |
sudo apt-get update -y
sudo apt-get install -y libwayland-dev wayland-protocols libdbus-1-dev libxkbcommon-dev libpango1.0-dev libgtk-3-dev
sudo apt-get install -y doxygen
sudo apt-get install -y doxygen-latex
sudo apt-get install -y xvfb
sudo apt-get install -y x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps
## Use the following line when 1.10.0 becomes available on Ubuntu. On 4/14/24 it's 1.9.2
# sudo apt-get install -y doxygen=1.10.0
## xvfb creates a headless X server for us, so we can render snapshot with FLUID
## We need at least Doxygen on macOS. BasicTeX is not enough though.
# brew install doxygen
# brew install --cask basictex
# eval "$(/usr/libexec/path_helper)"
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cmake $GITHUB_WORKSPACE \
-D CMAKE_BUILD_TYPE=Debug \
-D CMAKE_CXX_STANDARD=11 \
-D CMAKE_CXX_EXTENSIONS=OFF \
-D CMAKE_C_FLAGS_INIT="-Wall -Wunused" \
-D CMAKE_CXX_FLAGS_INIT="-Wall -Wunused -Wsuggest-override" \
-D FLTK_BUILD_FLTK_OPTIONS=OFF \
-D FLTK_BUILD_FLUID=ON \
-D FLTK_BUILD_GL=OFF \
-D FLTK_BUILD_TEST=OFF \
-D FLTK_BUILD_FLUID_DOCS=ON
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
run: |
Xvfb :19 -screen 0 1024x768x16 &
export DISPLAY=:19
cmake --build . --config Debug --target fluid_docs
cmake --build . --config Debug --target fluid_pdf
- name: Store html docs as an artifact
uses: actions/upload-artifact@v4
with:
name: fluid-html
path: build/fluid/documentation/html
retention-days: 3
overwrite: true
- name: Store pdf docs as an artifact
uses: actions/upload-artifact@v4
with:
name: fluid-pdf
path: build/fluid/documentation/fluid.pdf
retention-days: 3
overwrite: true

View File

@@ -459,6 +459,8 @@ endif()
if(DOXYGEN_FOUND)
option(FLTK_BUILD_HTML_DOCS "build html docs" ON)
option(FLTK_INSTALL_HTML_DOCS "install html docs" OFF)
option(FLTK_BUILD_FLUID_DOCS "build FLUID docs" OFF)
option(FLTK_INSTALL_FLUID_DOCS "install FLUID docs" OFF)
option(FLTK_INCLUDE_DRIVER_DOCS "include driver (developer) docs" OFF)
mark_as_advanced(FLTK_INCLUDE_DRIVER_DOCS)
@@ -473,6 +475,10 @@ if(FLTK_BUILD_HTML_DOCS OR FLTK_BUILD_PDF_DOCS)
add_subdirectory(documentation)
endif(FLTK_BUILD_HTML_DOCS OR FLTK_BUILD_PDF_DOCS)
if(FLTK_BUILD_FLUID_DOCS)
add_subdirectory(fluid/documentation)
endif(FLTK_BUILD_FLUID_DOCS)
#######################################################################
# Include optional Cairo support
#######################################################################

View File

@@ -325,6 +325,12 @@ FLTK_BUILD_PDF_DOCS - default ON
You can safely leave these two options ON if you want to save build time
because the docs are not built automatically.
FLTK_BUILD_FLUID_DOCS - default OFF
If this option is ON, the FLUID user documentation will be built. If
FLTK_BUILD_PDF_DOCS is ON, the FLUID documentation will be generated
in PDF forma. To generate the screen shots used in the handbook,
the CMake build mode must be set to "Debug".
FLTK_INCLUDE_DRIVER_DOCS - default OFF
This option adds driver documentation to HTML and PDF docs (if ON). This
option is marked as "advanced" since it is only useful for FLTK developers
@@ -332,9 +338,10 @@ FLTK_INCLUDE_DRIVER_DOCS - default OFF
options above is ON as well.
FLTK_INSTALL_HTML_DOCS - default OFF
FLTK_INSTALL_FLUID_DOCS - default OFF
FLTK_INSTALL_PDF_DOCS - default OFF
If these options are ON then the HTML and/or PDF docs are installed
when the 'install' target is executed, e.g. with `make install'. You
If these options are ON then the HTML, FLUID, and/or PDF docs are installed
when the 'install' target is executed, e.g. with `make install'. You
need to select above options FLTK_BUILD_*_DOCS as well.

View File

@@ -52,7 +52,7 @@ if(GENERATE_DOCS)
# find git revision
# FIXME: This must also work with tarballs where git is not available.
# For now we just ignore errors and set GIT_REVISION = "unkown".
# For now we just ignore errors and set GIT_REVISION = "unknown".
# In the future tarball/zip generation should create a file
# that contains the git revision.

View File

@@ -794,7 +794,6 @@ INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src/index.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/events.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/subclassing.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/opengl.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/fluid.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/fltk-options.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/advanced.dox \
@CMAKE_CURRENT_SOURCE_DIR@/src/unicode.dox \

View File

@@ -36,7 +36,6 @@ HTMLFILES = \
$(SRC_DOCDIR)/events.dox \
$(SRC_DOCDIR)/subclassing.dox \
$(SRC_DOCDIR)/opengl.dox \
$(SRC_DOCDIR)/fluid.dox \
$(SRC_DOCDIR)/fltk-options.dox \
$(SRC_DOCDIR)/advanced.dox \
$(SRC_DOCDIR)/unicode.dox \

View File

@@ -252,7 +252,7 @@ and shows OpenGL text.
\subsection examples_CubeView CubeView
\par
\c CubeView shows how to create a UI containing OpenGL with Fluid.
\c CubeView shows how to create a UI containing OpenGL with FLUID.
\subsection examples_cursor cursor
@@ -577,7 +577,7 @@ come in handy. They remember any kind of data between program launches.
\subsection examples_radio radio
\par
The \c radio tool was created entirely with <i>fluid</i>. It
The \c radio tool was created entirely with <i>FLUID</i>. It
shows some of the available button types and tests radio
button behavior.
@@ -658,7 +658,7 @@ The \c table demo shows the features of the Fl_Table widget.
\subsection examples_tabs tabs
\par
The \c tabs tool was created with <i>fluid</i>. It tests
The \c tabs tool was created with <i>FLUID</i>. It tests
correct hiding and redisplaying of tabs, navigation across tabs,
resize behavior, and no unneeded redrawing of invisible widgets.
@@ -733,13 +733,13 @@ font draws each of the Unicode code points ranging between U+0020 and U+FFFF.
while the focus stays in the original window.
\subsection examples_fluid fluid
\subsection examples_fluid FLUID
\par
\c fluid is not only a big test program, but also a very
useful visual UI designer. Many parts of \c fluid were
created using \c fluid. See the \link fluid Fluid Tutorial \endlink
for more details.
\c FLUID is not only a big test program, but also a very
useful visual UI designer. Many parts of \c FLUID were
created using \c FLUID. Check out the FLUID User Manual and
the tutorials that come with it at https://www.fltk.org/documentation.php .

View File

@@ -41,8 +41,8 @@ tool called fltk-options.
`fltk-options` is a hybrid app that is part of FLTK and can be installed on
the target system. It includes an up-to-date man page.
\image html fluid-edit-global-fltk-settings.png "fltk-options Application"
\image latex fluid-edit-global-fltk-settings.png "fltk-options Application" width=10cm
\image html fltk-options.png "fltk-options Application"
\image latex fltk-options.png "fltk-options Application" width=10cm
When fltk-options is called without any command-line arguments, it opens in
interactive mode and provides a user interface to view and alter all
@@ -67,9 +67,9 @@ A full list of options can be found in the manual at Fl::Fl_Option.
<table summary="navigation bar" width="100%" border="0">
<tr>
<td width="45%" align="LEFT">
<a class="el" href="fluid.html">
<a class="el" href="opengl.html">
[Prev]
Programming with FLUID
Using OpenGL
</a>
</td>
<td width="10%" align="CENTER">

View File

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

View File

@@ -67,11 +67,6 @@
\subpage opengl
\subpage fluid
- \ref fluid_widget_attributes
- \ref fluid_selecting_moving
- \ref fluid_images
\subpage fltk-options
\subpage advanced

View File

@@ -142,6 +142,17 @@ the toolkit, which was already in use by several people, Bill
came up with "FLTK", including a bogus excuse that it
stands for "The Fast Light Toolkit".
\section intro_fluid FLUID
FLTK comes bundled with FLUID. FLUID, short for Fast Light User Interface
Designer, is a graphical editor capable of generating C++ source code and
header files ready for compilation. These files ultimately create the graphical
user interface for an application.
The FLUID User Handbook is available at https://www.fltk.org/documentation.php .
It can also be compiled from the FLTK source repository using the `fluid_docs`
target in the CMake build environment.
\section intro_cmake Building and Installing FLTK with CMake
Starting with version 1.4, the recommended FLTK building system

View File

@@ -164,9 +164,7 @@ loading functions by doing:
Your main program can now create one of your windows by doing
<tt>new MyWindow(...)</tt>.
You can also use your new window class in
\ref fluid "FLUID"
by:
You can also use your new window class in FLUID by:
-# Putting your class definition in a \p MyWindow.H file.
-# Creating a Fl_Box widget in FLUID.
@@ -670,8 +668,8 @@ Link with libGLEW.so (with X11 or Wayland), libglew32.a (with MinGW) or glew32.l
<a class="el" href="index.html">[Index]</a>
</td>
<td width="45%" align="RIGHT">
<a class="el" href="fluid.html">
Programming with FLUID
<a class="el" href="fltk-options.html">
FLTK Runtime Options
[Next]
</a>
</td>

View File

@@ -968,7 +968,7 @@ internally in the same way.
\subsection osissues_mac_files Mac File System Specifics
\par Resource Forks
\par Resource Forks (OS X pre 10.6)
FLTK does not access the resource fork of an application.
However, a minimal resource fork must be created for OS X

View File

@@ -31,7 +31,6 @@ This manual is organized into the following chapters and appendices:
\li \ref events
\li \ref subclassing
\li \ref opengl
\li \ref fluid
\li \ref fltk-options
\li \ref advanced
\li \ref unicode

View File

@@ -40,9 +40,7 @@ The constructor should have the following arguments:
MyClass(int x, int y, int w, int h, const char *label = 0);
\endcode
This will allow the class to be used in
\ref fluid "FLUID"
without problems.
This will allow the class to be used in FLUID without problems.
The constructor must call the constructor for the base class and
pass the same arguments:

View File

@@ -37,7 +37,8 @@ set(CPPFILES
Fluid_Image.cxx
about_panel.cxx
align_widget.cxx
alignment_panel.cxx
settings_panel.cxx
autodoc.cxx
code.cxx
custom_widgets.cxx
factory.cxx
@@ -47,7 +48,7 @@ set(CPPFILES
mergeback.cxx
pixmaps.cxx
shell_command.cxx
sourceview_panel.cxx
codeview_panel.cxx
template_panel.cxx
undo.cxx
widget_browser.cxx
@@ -71,19 +72,19 @@ set(HEADERFILES
StyleParse.h
about_panel.h
align_widget.h
alignment_panel.h
settings_panel.h
autodoc.h
code.h
comments.h
custom_widgets.h
factory.h
file.h
fluid.h
function_panel.h
mergeback.h
print_panel.h
pixmaps.h
shell_command.h
sourceview_panel.h
codeview_panel.h
template_panel.h
undo.h
widget_browser.h

View File

@@ -72,7 +72,7 @@ public:
/**
A widget derived from CodeEditor with highlighting for code blocks.
This widget is used by the SourceView system to show the design's
This widget is used by the codeview system to show the design's
source and header code. The secondary highlighting show the text
part that corresponds to the selected widget(s).
*/

View File

@@ -17,7 +17,7 @@
#include "Fd_Snap_Action.h"
#include "Fl_Group_Type.h"
#include "alignment_panel.h"
#include "settings_panel.h"
#include "shell_command.h" // get and set Fl_String preferences
#include "file.h"

View File

@@ -1279,7 +1279,7 @@ void Fl_Data_Type::write_code1(Fd_Code_Writer& f) {
int nData = -1;
int uncompressedDataSize = 0;
// path should be set correctly already
if (filename_ && !f.write_sourceview) {
if (filename_ && !f.write_codeview) {
enter_project_dir();
FILE *f = fl_fopen(filename_, "rb");
leave_project_dir();
@@ -1395,8 +1395,8 @@ void Fl_Data_Type::write_code1(Fd_Code_Writer& f) {
}
}
// if we are in interactive mode, we pop up a warning dialog
// giving the error: (batch_mode && !write_sourceview) ???
if (message && !f.write_sourceview) {
// giving the error: (batch_mode && !write_codeview) ???
if (message && !f.write_codeview) {
if (batch_mode)
fprintf(stderr, "FLUID ERROR: %s %s\n", message, fn);
else
@@ -1535,9 +1535,11 @@ BREAK2:
*/
void Fl_DeclBlock_Type::write_code1(Fd_Code_Writer& f) {
const char* c = name();
if (public_)
f.write_h("%s\n", c);
f.write_c("%s\n", c);
if (c && *c) {
if (public_)
f.write_h("%s\n", c);
f.write_c("%s\n", c);
}
}
/**
@@ -1545,9 +1547,11 @@ void Fl_DeclBlock_Type::write_code1(Fd_Code_Writer& f) {
*/
void Fl_DeclBlock_Type::write_code2(Fd_Code_Writer& f) {
const char* c = after;
if (public_)
f.write_h("%s\n", c);
f.write_c("%s\n", c);
if (c && *c) {
if (public_)
f.write_h("%s\n", c);
f.write_c("%s\n", c);
}
}
// ---- Fl_Comment_Type declaration

View File

@@ -696,8 +696,8 @@ void Fl_Type::move_before(Fl_Type* g) {
// write a widget and all its children:
void Fl_Type::write(Fd_Project_Writer &f) {
if (f.write_sourceview()) proj1_start = (int)ftell(f.file()) + 1;
if (f.write_sourceview()) proj2_start = (int)ftell(f.file()) + 1;
if (f.write_codeview()) proj1_start = (int)ftell(f.file()) + 1;
if (f.write_codeview()) proj2_start = (int)ftell(f.file()) + 1;
f.write_indent(level);
f.write_word(type_name());
@@ -712,9 +712,9 @@ void Fl_Type::write(Fd_Project_Writer &f) {
write_properties(f);
if (parent) parent->write_parent_properties(f, this, true);
f.write_close(level);
if (f.write_sourceview()) proj1_end = (int)ftell(f.file());
if (f.write_codeview()) proj1_end = (int)ftell(f.file());
if (!is_parent()) {
if (f.write_sourceview()) proj2_end = (int)ftell(f.file());
if (f.write_codeview()) proj2_end = (int)ftell(f.file());
return;
}
// now do children:
@@ -722,9 +722,9 @@ void Fl_Type::write(Fd_Project_Writer &f) {
Fl_Type *child;
for (child = next; child && child->level > level; child = child->next)
if (child->level == level+1) child->write(f);
if (f.write_sourceview()) proj2_start = (int)ftell(f.file()) + 1;
if (f.write_codeview()) proj2_start = (int)ftell(f.file()) + 1;
f.write_close(level);
if (f.write_sourceview()) proj2_end = (int)ftell(f.file());
if (f.write_codeview()) proj2_end = (int)ftell(f.file());
}
void Fl_Type::write_properties(Fd_Project_Writer &f) {
@@ -1092,7 +1092,7 @@ Fl_Type *Fl_Type::find_by_uid(unsigned short uid) {
return NULL;
}
/** Find a type node by using the sourceview text positions.
/** Find a type node by using the codeview text positions.
\param[in] text_type 0=source file, 1=header, 2=.fl project file
\param[in] crsr cursor position in text

View File

@@ -146,7 +146,7 @@ public: // things that should not be public:
Fl_Type *factory;
const char *callback_name(Fd_Code_Writer& f);
// text positions of this type in code, header, and project file (see SourceView)
// text positions of this type in code, header, and project file (see codeview)
int code_static_start, code_static_end;
int code1_start, code1_end;
int code2_start, code2_end;

View File

@@ -24,7 +24,7 @@
#include "file.h"
#include "code.h"
#include "Fluid_Image.h"
#include "alignment_panel.h"
#include "settings_panel.h"
#include "widget_panel.h"
#include "undo.h"
#include "mergeback.h"
@@ -383,7 +383,7 @@ void name_public_cb(Fl_Choice* i, void* v) {
/* Treating UNDO for text widget.
Goal: we want to continuously update the UI while the user is typing text
(changing the label, in this case). Source View does deferred updates, and
(changing the label, in this case). Code View does deferred updates, and
the widget browser and widget panel update on every keystroke. At the same
time, we want to limit undo actions to few and logical units.
@@ -2727,7 +2727,7 @@ void Fl_Widget_Type::open() {
extern void redraw_overlays();
extern void check_redraw_corresponding_parent(Fl_Type*);
extern void redraw_browser();
extern void update_sourceview_position();
extern void update_codeview_position();
// Called when ui changes what objects are selected:
// p is selected object, null for all deletions (we must throw away
@@ -2761,8 +2761,8 @@ void selection_changed(Fl_Type *p) {
redraw_overlays();
// load the panel with the new settings:
load_panel();
// update the source viewer to show the code for the selected object
update_sourceview_position();
// update the code viewer to show the code for the selected object
update_codeview_position();
}
////////////////////////////////////////////////////////////////

View File

@@ -127,5 +127,6 @@ public:
void redraw();
};
extern Fl_Window *the_panel;
#endif // _FLUID_FL_WIDGET_TYPE_H

View File

@@ -25,7 +25,7 @@
#include "fluid.h"
#include "widget_browser.h"
#include "undo.h"
#include "alignment_panel.h"
#include "settings_panel.h"
#include "file.h"
#include "code.h"
#include "widget_panel.h"

View File

@@ -31,7 +31,8 @@ CPPFILES = \
Fluid_Image.cxx \
about_panel.cxx \
align_widget.cxx \
alignment_panel.cxx \
settings_panel.cxx \
autodoc.cxx \
code.cxx \
custom_widgets.cxx \
factory.cxx \
@@ -42,7 +43,7 @@ CPPFILES = \
mergeback.cxx \
pixmaps.cxx \
shell_command.cxx \
sourceview_panel.cxx \
codeview_panel.cxx \
template_panel.cxx \
undo.cxx \
widget_browser.cxx \
@@ -141,9 +142,9 @@ uninstall-osx:
rebuild: fluid$(EXEEXT)
echo 'Rebuilding fluid (.fl) and .cxx/.h files from .fl files ...'
./fluid$(EXEEXT) -u -c about_panel.fl
./fluid$(EXEEXT) -u -c alignment_panel.fl
./fluid$(EXEEXT) -u -c settings_panel.fl
./fluid$(EXEEXT) -u -c function_panel.fl
./fluid$(EXEEXT) -u -c print_panel.fl
./fluid$(EXEEXT) -u -c sourceview_panel.fl
./fluid$(EXEEXT) -u -c codeview_panel.fl
./fluid$(EXEEXT) -u -c template_panel.fl
./fluid$(EXEEXT) -u -c widget_panel.fl

602
fluid/autodoc.cxx Normal file

File diff suppressed because it is too large Load Diff

59
fluid/autodoc.h Normal file
View File

@@ -0,0 +1,59 @@
//
// Widget snapshot header-only file for the Fast Light Tool Kit (FLTK).
//
// Copyright 2023-2024 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
/**
\file autodoc.h
\brief tools to take snapshots of UI elements for documentation purposes
*/
#ifndef fl_screenshot_H
#define fl_screenshot_H
#include "../src/Fl_String.H"
#include <FL/Fl_Export.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Rect.H>
/** Class to initialize a Rect by providing the margin around a rect. */
class Fl_Margin : public Fl_Rect {
public:
Fl_Margin(int dx, int dy, int dr, int db);
};
int fl_snapshot(const char *filename, Fl_Widget **w,
const Fl_Rect &frame = Fl_Margin(4, 4, 4, 4),
const Fl_Rect &blend = Fl_Margin(4, 4, 4, 4),
double scale=1.0);
int fl_snapshot(const char *filename, Fl_Widget *w1, Fl_Widget *w2,
const Fl_Rect &frame = Fl_Margin(4, 4, 4, 4),
const Fl_Rect &blend = Fl_Margin(4, 4, 4, 4),
double scale=1.0);
int fl_snapshot(const char *filename, Fl_Widget *w,
const Fl_Rect &frame = Fl_Margin(4, 4, 4, 4),
const Fl_Rect &blend = Fl_Margin(4, 4, 4, 4),
double scale=1.0);
extern const int FL_SNAP_TO_WINDOW;
extern Fl_Widget *FL_SNAP_AREA_CLEAR;
extern void run_autodoc(const Fl_String &target_dir);
#endif

View File

@@ -414,7 +414,7 @@ void Fd_Code_Writer::write_cstring(const char *s, int length) {
}
// if we are rendering to the source code preview window, and the text is
// longer than four lines, we only render a placeholder.
if (write_sourceview && ((s==NULL) || (length>300))) {
if (write_codeview && ((s==NULL) || (length>300))) {
if (length>=0)
crc_printf("\" ... %d bytes of text... \"", length);
else
@@ -523,7 +523,7 @@ void Fd_Code_Writer::write_cdata(const char *s, int length) {
varused = 1;
return;
}
if (write_sourceview) {
if (write_codeview) {
if (length>=0)
crc_printf("{ /* ... %d bytes of binary data... */ }", length);
else
@@ -707,11 +707,11 @@ Fl_Type* Fd_Code_Writer::write_code(Fl_Type* p) {
// write all code that comes before the children code
// (but don't write the last comment until the very end)
if (!(p==Fl_Type::last && p->is_a(ID_Comment))) {
if (write_sourceview) p->code1_start = (int)ftell(code_file);
if (write_sourceview) p->header1_start = (int)ftell(header_file);
if (write_codeview) p->code1_start = (int)ftell(code_file);
if (write_codeview) p->header1_start = (int)ftell(header_file);
p->write_code1(*this);
if (write_sourceview) p->code1_end = (int)ftell(code_file);
if (write_sourceview) p->header1_end = (int)ftell(header_file);
if (write_codeview) p->code1_end = (int)ftell(code_file);
if (write_codeview) p->header1_end = (int)ftell(header_file);
}
// recursively write the code of all children
Fl_Type* q;
@@ -730,11 +730,11 @@ Fl_Type* Fd_Code_Writer::write_code(Fl_Type* p) {
}
// write all code that come after the children
if (write_sourceview) p->code2_start = (int)ftell(code_file);
if (write_sourceview) p->header2_start = (int)ftell(header_file);
if (write_codeview) p->code2_start = (int)ftell(code_file);
if (write_codeview) p->header2_start = (int)ftell(header_file);
p->write_code2(*this);
if (write_sourceview) p->code2_end = (int)ftell(code_file);
if (write_sourceview) p->header2_end = (int)ftell(header_file);
if (write_codeview) p->code2_end = (int)ftell(code_file);
if (write_codeview) p->header2_end = (int)ftell(header_file);
for (q = p->next; q && q->level > p->level;) {
if (is_class_member(q) || is_comment_before_class_member(q)) {
@@ -752,11 +752,11 @@ Fl_Type* Fd_Code_Writer::write_code(Fl_Type* p) {
} else {
for (q = p->next; q && q->level > p->level;) q = write_code(q);
// write all code that come after the children
if (write_sourceview) p->code2_start = (int)ftell(code_file);
if (write_sourceview) p->header2_start = (int)ftell(header_file);
if (write_codeview) p->code2_start = (int)ftell(code_file);
if (write_codeview) p->header2_start = (int)ftell(header_file);
p->write_code2(*this);
if (write_sourceview) p->code2_end = (int)ftell(code_file);
if (write_sourceview) p->header2_end = (int)ftell(header_file);
if (write_codeview) p->code2_end = (int)ftell(code_file);
if (write_codeview) p->header2_end = (int)ftell(header_file);
}
return q;
}
@@ -772,8 +772,8 @@ Fl_Type* Fd_Code_Writer::write_code(Fl_Type* p) {
\param[in] t filename of the header file
\return 0 if the operation failed, 1 if it was successful
*/
int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview) {
write_sourceview = to_sourceview;
int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_codeview) {
write_codeview = to_codeview;
delete id_root; id_root = 0;
indentation = 0;
current_class = 0L;
@@ -791,7 +791,7 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview)
header_file = f;
}
// Remember the last code file location for MergeBack
if (s && g_project.write_mergeback_data && !to_sourceview) {
if (s && g_project.write_mergeback_data && !to_codeview) {
Fl_String proj_filename = g_project.projectfile_path() + g_project.projectfile_name();
int i, n = proj_filename.size();
for (i=0; i<n; i++) if (proj_filename[i]=='\\') proj_filename[i] = '/';
@@ -803,13 +803,13 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview)
// a copyright notice. We print that before anything else in the file!
Fl_Type* first_type = Fl_Type::first;
if (first_type && first_type->is_a(ID_Comment)) {
if (write_sourceview) {
if (write_codeview) {
first_type->code1_start = first_type->code2_start = (int)ftell(code_file);
first_type->header1_start = first_type->header2_start = (int)ftell(header_file);
}
// it is ok to write non-recursive code here, because comments have no children or code2 blocks
first_type->write_code1(*this);
if (write_sourceview) {
if (write_codeview) {
first_type->code1_end = first_type->code2_end = (int)ftell(code_file);
first_type->header1_end = first_type->header2_end = (int)ftell(header_file);
}
@@ -835,7 +835,7 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview)
write_h_once("#include <FL/Fl.H>");
}
if (t && g_project.include_H_from_C) {
if (to_sourceview) {
if (to_codeview) {
write_c("#include \"CodeView.h\"\n");
} else if (g_project.header_file_name[0] == '.' && strchr(g_project.header_file_name.c_str(), '/') == NULL) {
write_c("#include \"%s\"\n", fl_filename_name(t));
@@ -896,17 +896,17 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview)
}
for (Fl_Type* p = first_type; p;) {
// write all static data for this & all children first
if (write_sourceview) p->header_static_start = (int)ftell(header_file);
if (write_sourceview) p->code_static_start = (int)ftell(code_file);
if (write_codeview) p->header_static_start = (int)ftell(header_file);
if (write_codeview) p->code_static_start = (int)ftell(code_file);
p->write_static(*this);
if (write_sourceview) p->code_static_end = (int)ftell(code_file);
if (write_sourceview) p->header_static_end = (int)ftell(header_file);
if (write_codeview) p->code_static_end = (int)ftell(code_file);
if (write_codeview) p->header_static_end = (int)ftell(header_file);
for (Fl_Type* q = p->next; q && q->level > p->level; q = q->next) {
if (write_sourceview) q->header_static_start = (int)ftell(header_file);
if (write_sourceview) q->code_static_start = (int)ftell(code_file);
if (write_codeview) q->header_static_start = (int)ftell(header_file);
if (write_codeview) q->code_static_start = (int)ftell(code_file);
q->write_static(*this);
if (write_sourceview) q->code_static_end = (int)ftell(code_file);
if (write_sourceview) q->header_static_end = (int)ftell(header_file);
if (write_codeview) q->code_static_end = (int)ftell(code_file);
if (write_codeview) q->header_static_end = (int)ftell(header_file);
}
// then write the nested code:
p = write_code(p);
@@ -918,12 +918,12 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview)
Fl_Type* last_type = Fl_Type::last;
if (last_type && (last_type != Fl_Type::first) && last_type->is_a(ID_Comment)) {
if (write_sourceview) {
if (write_codeview) {
last_type->code1_start = last_type->code2_start = (int)ftell(code_file);
last_type->header1_start = last_type->header2_start = (int)ftell(header_file);
}
last_type->write_code1(*this);
if (write_sourceview) {
if (write_codeview) {
last_type->code1_end = last_type->code2_end = (int)ftell(code_file);
last_type->header1_end = last_type->header2_end = (int)ftell(header_file);
}
@@ -973,7 +973,7 @@ Fd_Code_Writer::Fd_Code_Writer()
block_buffer_(NULL),
block_buffer_size_(0),
indentation(0),
write_sourceview(false),
write_codeview(false),
varused_test(0),
varused(0)
{

View File

@@ -68,7 +68,7 @@ public:
int indentation;
/// set if we write abbreviated file for the source code previewer
/// (disables binary data blocks, for example)
bool write_sourceview;
bool write_codeview;
/// silly thing to prevent declaring unused variables:
/// When this symbol is on, all attempts to write code don't write
/// anything, but set a variable if it looks like the variable "o" is used:
@@ -100,7 +100,7 @@ public:
void write_hc(const char *, int, const char*, const char*);
void write_c_indented(const char *textlines, int inIndent, char inTrailwWith);
Fl_Type* write_code(Fl_Type* p);
int write_code(const char *cfile, const char *hfile, bool to_sourceview=false);
int write_code(const char *cfile, const char *hfile, bool to_codeview=false);
void write_public(int state); // writes pubic:/private: as needed
void tag(int type, unsigned short uid);

548
fluid/codeview_panel.cxx Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

58
fluid/codeview_panel.h Normal file
View File

@@ -0,0 +1,58 @@
//
// Code dialogs for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2023 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
// generated by Fast Light User Interface Designer (fluid) version 1.0400
#ifndef codeview_panel_h
#define codeview_panel_h
#include <FL/Fl.H>
extern int cv_code_choice;
void update_codeview_position();
void update_codeview_position_cb(class Fl_Tabs*, void*);
void update_codeview_cb(class Fl_Button*, void*);
void update_codeview_timer(void*);
void codeview_defer_update();
void codeview_toggle_visibility();
#include <FL/Fl_Double_Window.H>
extern void toggle_codeview_cb(Fl_Double_Window*, void*);
extern Fl_Double_Window *codeview_panel;
#include <FL/Fl_Tabs.H>
extern Fl_Tabs *cv_tab;
#include <FL/Fl_Group.H>
extern Fl_Group *cv_source_tab;
#include "CodeEditor.h"
extern CodeViewer *cv_source;
extern CodeViewer *cv_header;
extern TextViewer *cv_strings;
extern TextViewer *cv_project;
extern Fl_Group *cv_find_row;
#include <FL/Fl_Button.H>
extern Fl_Button *cv_find_text_case;
#include <FL/Fl_Input.H>
extern Fl_Input *cv_find_text;
#include <FL/Fl_Box.H>
extern Fl_Group *cv_settings_row;
#include <FL/Fl_Light_Button.H>
extern Fl_Light_Button *cv_autorefresh;
extern Fl_Light_Button *cv_autoposition;
#include <FL/Fl_Choice.H>
extern Fl_Choice *cv_code_choice_w;
extern void toggle_codeview_b_cb(Fl_Button*, void*);
Fl_Double_Window* make_codeview();
extern Fl_Menu_Item menu_cv_code_choice_w[];
#endif
//

View File

@@ -55,7 +55,7 @@ int Widget_Bin_Button::handle(int inEvent)
// fake a drag outside of the widget
Fl::e_x = x()-1;
Fl_Button::handle(inEvent);
// fake a buttton release
// fake a button release
Fl_Button::handle(FL_RELEASE);
// make it into a dnd event
const char *type_name = (const char*)user_data();

Some files were not shown because too many files have changed in this diff Show More