mirror of
https://github.com/fltk/fltk.git
synced 2026-02-05 15:59:50 +08:00
Fix trailing whitespace and convert a few tabs to spaces
... according to CMP
This commit is contained in:
@@ -33,7 +33,7 @@ _README.macOS.md - Building FLTK under Apple macOS_
|
||||
## Introduction
|
||||
|
||||
FLTK supports macOS version 10.3 Panther and above. At the time of writing (Feb. 2022),
|
||||
FLTK compiles and runs fine on the most recent macOS 12 Monterey for both Intel
|
||||
FLTK compiles and runs fine on the most recent macOS 12 Monterey for both Intel
|
||||
processors and Apple Silicon.
|
||||
|
||||
FLTK 1.5 supports the following build environments on the macOS
|
||||
@@ -174,8 +174,8 @@ See README.CMake.txt
|
||||
<a name="build_cmake_make"></a>
|
||||
## How to Build FLTK Using _CMake_ and _make_
|
||||
|
||||
This option is best for users who like to develop their apps without using
|
||||
Apple's Xcode IDE. Users should be comfortable with using `bash` or `tcsh` in
|
||||
This option is best for users who like to develop their apps without using
|
||||
Apple's Xcode IDE. Users should be comfortable with using `bash` or `tcsh` in
|
||||
a terminal window.
|
||||
|
||||
This option requires neither administrator rights, nor an Apple ID.
|
||||
@@ -243,7 +243,7 @@ self-explanatory. Some more details can be found in
|
||||
<a name="bcm_build"></a>
|
||||
### Building FLTK (CMake, make)
|
||||
|
||||
Now this is easy if all the previous steps were successful. Stay in the root
|
||||
Now this is easy if all the previous steps were successful. Stay in the root
|
||||
directory of your FLTK source code tree and type:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -202,9 +202,9 @@ worker thread to re-use or update \p userdata.
|
||||
|
||||
\warning
|
||||
The Fl::awake(void* message) call has been deprecated because the API was not
|
||||
sufficient to ensure the deliver of all message or the order of messages. The
|
||||
sufficient to ensure the deliver of all message or the order of messages. The
|
||||
cal still exists for back compatibility, but should be repleaced with a call
|
||||
to Fl::awake(), Fl::awake(handler, user_data),
|
||||
to Fl::awake(), Fl::awake(handler, user_data),
|
||||
or Fl::awake_once(handler, user_data).
|
||||
|
||||
\section advanced_multithreading_lockless FLTK multithreaded "lockless programming"
|
||||
|
||||
@@ -455,20 +455,20 @@ SRCS = CubeMain.cxx CubeView.cxx CubeViewUI.cxx
|
||||
.SUFFIXES: .o .cxx
|
||||
|
||||
%.o: %.cxx
|
||||
$(CXX) $(CXXFLAGS) $(DEBUG) -c $<
|
||||
$(CXX) $(CXXFLAGS) $(DEBUG) -c $<
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(LINK) -o $(TARGET) $(OBJS) $(LDSTATIC)
|
||||
$(LINK) -o $(TARGET) $(OBJS) $(LDSTATIC)
|
||||
|
||||
CubeMain.o: CubeMain.cxx CubeViewUI.h
|
||||
CubeView.o: CubeView.cxx CubeView.h CubeViewUI.h
|
||||
CubeViewUI.o: CubeViewUI.cxx CubeView.h
|
||||
|
||||
clean:
|
||||
rm -f *.o 2> /dev/null
|
||||
rm -f $(TARGET) 2> /dev/null
|
||||
rm -f *.o 2> /dev/null
|
||||
rm -f $(TARGET) 2> /dev/null
|
||||
|
||||
\endcode
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public: // Member Variables
|
||||
app::History history;
|
||||
/// Command line arguments
|
||||
app::Args args;
|
||||
/// List of available layouts
|
||||
/// List of available layouts
|
||||
app::Layout_List layout_list;
|
||||
/// Set, if Fluid runs in batch mode, and no user interface is activated.
|
||||
int batch_mode { 0 }; // fluid + any code generators (-u, -c, -cs)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// https://www.fltk.org/bugs.php
|
||||
//
|
||||
|
||||
#include <errno.h> // strerror(errno)
|
||||
#include <errno.h> // strerror(errno)
|
||||
#include "Project.h"
|
||||
|
||||
#include "io/String_Writer.h"
|
||||
|
||||
@@ -44,23 +44,23 @@
|
||||
|
||||
/**
|
||||
\brief A map of all image assets.
|
||||
\todo This is a global variable, but should be associated
|
||||
\todo This is a global variable, but should be associated
|
||||
with a project instead.
|
||||
*/
|
||||
static std::map<std::string, Image_Asset*> image_asset_map;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Write the contents of the image file as binary source code.
|
||||
|
||||
Write the contents of the image file as C++ code, so the image is available in
|
||||
Write the contents of the image file as C++ code, so the image is available in
|
||||
the target app in the original binary format, for example:
|
||||
```
|
||||
{ 1, 2, 3, ...}
|
||||
```
|
||||
\param f Write code to this C++ source code file
|
||||
\param fmt short name of file contents for error message
|
||||
\return 0 if the file could not be opened or read
|
||||
\return 0 if the file could not be opened or read
|
||||
*/
|
||||
size_t Image_Asset::write_static_binary(fld::io::Code_Writer& f, const char* fmt) {
|
||||
size_t nData = 0;
|
||||
@@ -86,7 +86,7 @@ size_t Image_Asset::write_static_binary(fld::io::Code_Writer& f, const char* fmt
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Write the contents of the image file as text with escaped special characters.
|
||||
|
||||
This function is only useful for writing out image formats that are ASCII text
|
||||
@@ -94,7 +94,7 @@ size_t Image_Asset::write_static_binary(fld::io::Code_Writer& f, const char* fmt
|
||||
|
||||
\param f Write code to this C++ source code file
|
||||
\param fmt short name of file contents for error message
|
||||
\return 0 if the file could not be opened or read
|
||||
\return 0 if the file could not be opened or read
|
||||
*/
|
||||
size_t Image_Asset::write_static_text(fld::io::Code_Writer& f, const char* fmt) {
|
||||
size_t nData = 0;
|
||||
@@ -120,18 +120,18 @@ size_t Image_Asset::write_static_text(fld::io::Code_Writer& f, const char* fmt)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Write the contents of the image file as uncompressed RGB.
|
||||
|
||||
Write source code that generates the uncompressed RGB image data at compile
|
||||
time, and an initializer that creates the image at run time.
|
||||
|
||||
\todo If the ld() value is not 0 and not d()*w(), the image data is not
|
||||
\todo If the ld() value is not 0 and not d()*w(), the image data is not
|
||||
written correctly. There is no check if the data is actually in RGB format.
|
||||
|
||||
\param f Write code to this C++ source code file
|
||||
\param fmt short name of file contents for error message
|
||||
\return 0 if the file could not be opened or read
|
||||
\return 0 if the file could not be opened or read
|
||||
*/
|
||||
void Image_Asset::write_static_rgb(fld::io::Code_Writer& f, const char* idata_name) {
|
||||
// Write image data...
|
||||
@@ -306,15 +306,15 @@ void Image_Asset::write_file_error(fld::io::Code_Writer& f, const char *fmt) {
|
||||
The generated code loads the image if it hasn't been loaded yet, and then
|
||||
returns a pointer to the image.
|
||||
|
||||
\code
|
||||
\code
|
||||
static Fl_Image *'initializer_function_'() {
|
||||
static Fl_Image *image = 0L;
|
||||
if (!image)
|
||||
image = new 'type_name'('product of format and remaining args');
|
||||
return image;
|
||||
}
|
||||
\endcode
|
||||
|
||||
\endcode
|
||||
|
||||
\param f Write the C++ code to this file.
|
||||
\param image_class Name of the Fl_Image class, for example Fl_GIF_Image.
|
||||
\param format Format string for additional parameters for the constructor.
|
||||
@@ -341,7 +341,7 @@ void Image_Asset::write_initializer(fld::io::Code_Writer& f, const char *image_c
|
||||
|
||||
The generated code will call the image initializer function and assign
|
||||
the resulting image to the widget.
|
||||
|
||||
|
||||
\param f Write the C++ code to this file.
|
||||
\param bind If true, use bind_image() instead of image().
|
||||
\param var Name of the Fl_Widget or Fl_Menu_Item to attach the image to.
|
||||
@@ -349,16 +349,16 @@ void Image_Asset::write_initializer(fld::io::Code_Writer& f, const char *image_c
|
||||
*/
|
||||
void Image_Asset::write_code(fld::io::Code_Writer& f, int bind, const char *var, int inactive) {
|
||||
if (image_) {
|
||||
f.write_c("%s%s->%s%s( %s() );\n",
|
||||
f.indent(),
|
||||
var,
|
||||
bind ? "bind_" : "",
|
||||
inactive ? "deimage" : "image",
|
||||
f.write_c("%s%s->%s%s( %s() );\n",
|
||||
f.indent(),
|
||||
var,
|
||||
bind ? "bind_" : "",
|
||||
inactive ? "deimage" : "image",
|
||||
initializer_function_.c_str());
|
||||
if (is_animated_gif_)
|
||||
f.write_c("%s((Fl_Anim_GIF_Image*)(%s()))->canvas(%s, Fl_Anim_GIF_Image::DONT_RESIZE_CANVAS);\n",
|
||||
f.indent(),
|
||||
initializer_function_.c_str(),
|
||||
f.write_c("%s((Fl_Anim_GIF_Image*)(%s()))->canvas(%s, Fl_Anim_GIF_Image::DONT_RESIZE_CANVAS);\n",
|
||||
f.indent(),
|
||||
initializer_function_.c_str(),
|
||||
var);
|
||||
}
|
||||
}
|
||||
@@ -485,8 +485,8 @@ void Image_Asset::dec_ref() {
|
||||
\brief Destructor for the Image_Asset class.
|
||||
|
||||
This destructor removes the image asset from the global image asset map
|
||||
and releases the associated shared image if it exists. It ensures that
|
||||
any resources associated with the Image_Asset are properly cleaned up
|
||||
and releases the associated shared image if it exists. It ensures that
|
||||
any resources associated with the Image_Asset are properly cleaned up
|
||||
when the object is destroyed.
|
||||
*/
|
||||
Image_Asset::~Image_Asset() {
|
||||
|
||||
@@ -67,7 +67,7 @@ void menu_file_save_cb(Fl_Widget *, void *arg) { Fluid.save_project_file(arg); }
|
||||
static void menu_file_print_cb(Fl_Widget *, void *arg) { Fluid.print_snapshots(); }
|
||||
void menu_file_open_history_cb(Fl_Widget *, void *v) { Fluid.open_project_file(std::string((const char*)v)); }
|
||||
static void menu_layout_sync_resize_cb(Fl_Menu_ *m, void*) {
|
||||
if (m->mvalue()->value()) Fluid.proj.tree.allow_layout = 1; else Fluid.proj.tree.allow_layout = 0;
|
||||
if (m->mvalue()->value()) Fluid.proj.tree.allow_layout = 1; else Fluid.proj.tree.allow_layout = 0;
|
||||
}
|
||||
static void menu_file_revert_cb(Fl_Widget *, void *) { Fluid.revert_project(); }
|
||||
void exit_cb(Fl_Widget *,void *) { Fluid.quit(); }
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//
|
||||
// https://www.fltk.org/bugs.php
|
||||
//
|
||||
#include <errno.h> // strerror(errno)
|
||||
#include <errno.h> // strerror(errno)
|
||||
#include "app/templates.h"
|
||||
|
||||
#include "Fluid.h"
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
# Introduction to Mergeback #
|
||||
|
||||
Fluid has introduced an experimental feature called **MergeBack** in version 1.5.
|
||||
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
|
||||
Fluid has introduced an experimental feature called **MergeBack** in version 1.5.
|
||||
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
|
||||
can streamline the development process by reducing the need to switch between Fluid
|
||||
and your code editor for minor adjustments.
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
- Navigate to the **Settings Panel**.
|
||||
- In the **Project Settings**, locate and enable the **MergeBack** option.
|
||||
|
||||
Once enabled, Fluid assigns a unique ID to each node in your project.
|
||||
Additionally, user-editable code sections in the generated source files will
|
||||
be marked with special divider lines, indicating areas that can be edited
|
||||
Once enabled, Fluid assigns a unique ID to each node in your project.
|
||||
Additionally, user-editable code sections in the generated source files will
|
||||
be marked with special divider lines, indicating areas that can be edited
|
||||
and later merged back.
|
||||
|
||||
<H2>Understanding the Code Markers:</H2>
|
||||
@@ -43,10 +43,10 @@
|
||||
}
|
||||
```
|
||||
|
||||
The lines beginning with `//fl ▼` and `//fl ▲` are markers that Fluid
|
||||
uses to identify editable sections. These markers contain encoded information
|
||||
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
|
||||
The lines beginning with `//fl ▼` and `//fl ▲` are markers that Fluid
|
||||
uses to identify editable sections. These markers contain encoded information
|
||||
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
|
||||
them with the correct nodes in your project.
|
||||
|
||||
<H2>Editing and Merging Back</H2>
|
||||
@@ -76,5 +76,5 @@
|
||||
|
||||
Given the experimental nature of MergeBack, unexpected
|
||||
behaviors may occur. Always ensure you have backups of your project
|
||||
files before using this feature.
|
||||
files before using this feature.
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
/**
|
||||
|
||||
|
||||
|
||||
\todo Verify the text
|
||||
|
||||
Type classes for most of the fltk widgets. Most of the work
|
||||
|
||||
@@ -1063,13 +1063,13 @@ static void cb_wp_gui_margins(Fl_Group* o, void* v) {
|
||||
}
|
||||
|
||||
static void cb_Left(Fl_Value_Input* o, void* v) {
|
||||
flex_margin_cb(o, v,
|
||||
flex_margin_cb(o, v,
|
||||
[](Fl_Flex *w, Fl_Value_Input* i) -> void
|
||||
{
|
||||
int v;
|
||||
w->margin(&v, nullptr, nullptr, nullptr);
|
||||
i->value((double)v);
|
||||
},
|
||||
},
|
||||
[](Fl_Flex *w, int new_value) -> int
|
||||
{
|
||||
int l, t, r, b;
|
||||
@@ -1107,7 +1107,7 @@ static void cb_Top(Fl_Value_Input* o, void* v) {
|
||||
}
|
||||
|
||||
static void cb_Right(Fl_Value_Input* o, void* v) {
|
||||
flex_margin_cb(o, v,
|
||||
flex_margin_cb(o, v,
|
||||
[](Fl_Flex *w, Fl_Value_Input* i) -> void
|
||||
{
|
||||
int v;
|
||||
@@ -1129,7 +1129,7 @@ static void cb_Right(Fl_Value_Input* o, void* v) {
|
||||
}
|
||||
|
||||
static void cb_Bottom(Fl_Value_Input* o, void* v) {
|
||||
flex_margin_cb(o, v,
|
||||
flex_margin_cb(o, v,
|
||||
[](Fl_Flex *w, Fl_Value_Input* i) -> void
|
||||
{
|
||||
int v;
|
||||
@@ -1151,12 +1151,12 @@ static void cb_Bottom(Fl_Value_Input* o, void* v) {
|
||||
}
|
||||
|
||||
static void cb_Gap(Fl_Value_Input* o, void* v) {
|
||||
flex_margin_cb(o, v,
|
||||
flex_margin_cb(o, v,
|
||||
[](Fl_Flex *w, Fl_Value_Input* o) -> void
|
||||
{
|
||||
int v = w->gap();
|
||||
o->value((double)v);
|
||||
},
|
||||
},
|
||||
[](Fl_Flex *w, int new_value) -> int
|
||||
{
|
||||
int g = w->gap();
|
||||
@@ -1575,8 +1575,8 @@ static void cb_6(Fl_Menu_Button* o, void* v) {
|
||||
if (d == c) return;
|
||||
c = d;
|
||||
labelcolor_common(c);
|
||||
w_labelcolor->color(c);
|
||||
w_labelcolor->labelcolor(fl_contrast(FL_BLACK,c));
|
||||
w_labelcolor->color(c);
|
||||
w_labelcolor->labelcolor(fl_contrast(FL_BLACK,c));
|
||||
w_labelcolor->redraw();
|
||||
}
|
||||
}
|
||||
@@ -1586,7 +1586,7 @@ Fl_Group *wp_style_box=(Fl_Group *)0;
|
||||
static void cb_7(Fl_Choice* o, void* v) {
|
||||
if (v == LOAD) {
|
||||
if (current_widget->is_a(Type::Menu_Item)) {o->deactivate(); return;} else o->activate();
|
||||
int n = current_widget->o->box();
|
||||
int n = current_widget->o->box();
|
||||
if (!n) n = ZERO_ENTRY;
|
||||
for (int j = 0; j < 72 /*int(sizeof(boxmenu)/sizeof(*boxmenu))*/; j++)
|
||||
if (boxmenu[j].argument() == n) {o->value(j); break;}
|
||||
@@ -1927,7 +1927,7 @@ Fl_Group *wp_cpp_class=(Fl_Group *)0;
|
||||
static void cb_e(Fl_Input* o, void* v) {
|
||||
if (v == LOAD) {
|
||||
if (current_widget->is_a(Type::Menu_Item)) {
|
||||
o->deactivate();
|
||||
o->deactivate();
|
||||
} else {
|
||||
o->activate();
|
||||
o->value(current_widget->subclass());
|
||||
|
||||
@@ -1204,13 +1204,13 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11
|
||||
} {
|
||||
Fl_Value_Input {} {
|
||||
label {Left:}
|
||||
callback {flex_margin_cb(o, v,
|
||||
callback {flex_margin_cb(o, v,
|
||||
[](Fl_Flex *w, Fl_Value_Input* i) -> void
|
||||
{
|
||||
int v;
|
||||
w->margin(&v, nullptr, nullptr, nullptr);
|
||||
i->value((double)v);
|
||||
},
|
||||
},
|
||||
[](Fl_Flex *w, int new_value) -> int
|
||||
{
|
||||
int l, t, r, b;
|
||||
@@ -1250,7 +1250,7 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11
|
||||
}
|
||||
Fl_Value_Input {} {
|
||||
label {Right:}
|
||||
callback {flex_margin_cb(o, v,
|
||||
callback {flex_margin_cb(o, v,
|
||||
[](Fl_Flex *w, Fl_Value_Input* i) -> void
|
||||
{
|
||||
int v;
|
||||
@@ -1273,7 +1273,7 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11
|
||||
}
|
||||
Fl_Value_Input {} {
|
||||
label {Bottom:}
|
||||
callback {flex_margin_cb(o, v,
|
||||
callback {flex_margin_cb(o, v,
|
||||
[](Fl_Flex *w, Fl_Value_Input* i) -> void
|
||||
{
|
||||
int v;
|
||||
@@ -1296,12 +1296,12 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11
|
||||
}
|
||||
Fl_Value_Input {} {
|
||||
label {Gap:}
|
||||
callback {flex_margin_cb(o, v,
|
||||
callback {flex_margin_cb(o, v,
|
||||
[](Fl_Flex *w, Fl_Value_Input* o) -> void
|
||||
{
|
||||
int v = w->gap();
|
||||
o->value((double)v);
|
||||
},
|
||||
},
|
||||
[](Fl_Flex *w, int new_value) -> int
|
||||
{
|
||||
int g = w->gap();
|
||||
@@ -1769,8 +1769,8 @@ if (v != LOAD) {
|
||||
if (d == c) return;
|
||||
c = d;
|
||||
labelcolor_common(c);
|
||||
w_labelcolor->color(c);
|
||||
w_labelcolor->labelcolor(fl_contrast(FL_BLACK,c));
|
||||
w_labelcolor->color(c);
|
||||
w_labelcolor->labelcolor(fl_contrast(FL_BLACK,c));
|
||||
w_labelcolor->redraw();
|
||||
}} open
|
||||
xywh {386 40 18 20}
|
||||
@@ -1786,7 +1786,7 @@ if (v != LOAD) {
|
||||
Fl_Choice {} {
|
||||
callback {if (v == LOAD) {
|
||||
if (current_widget->is_a(Type::Menu_Item)) {o->deactivate(); return;} else o->activate();
|
||||
int n = current_widget->o->box();
|
||||
int n = current_widget->o->box();
|
||||
if (!n) n = ZERO_ENTRY;
|
||||
for (int j = 0; j < 72 /*int(sizeof(boxmenu)/sizeof(*boxmenu))*/; j++)
|
||||
if (boxmenu[j].argument() == n) {o->value(j); break;}
|
||||
@@ -2169,7 +2169,7 @@ if (v == LOAD) {
|
||||
user_data 4
|
||||
callback {if (v == LOAD) {
|
||||
if (current_widget->is_a(Type::Menu_Item)) {
|
||||
o->deactivate();
|
||||
o->deactivate();
|
||||
} else {
|
||||
o->activate();
|
||||
o->value(current_widget->subclass());
|
||||
|
||||
@@ -63,7 +63,7 @@ void I18n::read(io::Project_Reader &f, const char *key) {
|
||||
gnu_conditional = f.read_word();
|
||||
} else if (type == fld::I18n_Type::POSIX) {
|
||||
posix_conditional = f.read_word();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ int merge_back(Project &proj, const std::string &s, const std::string &p, Mergeb
|
||||
}
|
||||
|
||||
/** Allocate and initialize MergeBack class. */
|
||||
Mergeback::Mergeback(Project &proj)
|
||||
Mergeback::Mergeback(Project &proj)
|
||||
: proj_(proj),
|
||||
code(nullptr),
|
||||
line_no(0),
|
||||
@@ -608,13 +608,13 @@ int Mergeback::merge_back(const std::string &s, const std::string &p, Task task)
|
||||
/**
|
||||
\brief Merges back code files with the project file.
|
||||
|
||||
This function flushes text widgets, checks if the project filename and
|
||||
mergeback data are available, and then attempts to merge back the code
|
||||
files with the project file. If MergeBack is not enabled, it displays
|
||||
This function flushes text widgets, checks if the project filename and
|
||||
mergeback data are available, and then attempts to merge back the code
|
||||
files with the project file. If MergeBack is not enabled, it displays
|
||||
a message to the user. It handles both batch and interactive modes.
|
||||
|
||||
\return int - Returns 1 if the project filename is not available,
|
||||
0 if MergeBack is not enabled,
|
||||
\return int - Returns 1 if the project filename is not available,
|
||||
0 if MergeBack is not enabled,
|
||||
or the result of the merge_back function.
|
||||
*/
|
||||
int mergeback_code_files(Project &proj)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace proj {
|
||||
class Undo
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
enum class OnceType {
|
||||
ALWAYS = 0,
|
||||
WINDOW_RESIZE
|
||||
|
||||
@@ -47,19 +47,19 @@ class Formula_Input : public Fl_Input
|
||||
int eval_var(uchar *&s) const;
|
||||
int eval(uchar *&s, int prio) const;
|
||||
int eval(const char *s) const;
|
||||
|
||||
|
||||
public:
|
||||
Formula_Input(int x, int y, int w, int h, const char *l = nullptr);
|
||||
|
||||
/** Return the text in the widget text field. */
|
||||
const char *text() const { return Fl_Input::value(); }
|
||||
|
||||
|
||||
/** Set the text in the text field */
|
||||
void text(const char *v) { Fl_Input::value(v); }
|
||||
|
||||
|
||||
int value() const;
|
||||
void value(int v);
|
||||
|
||||
|
||||
/** Set the general callback for this widget. */
|
||||
void callback(Fl_Callback *cb) { user_callback_ = cb; }
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
FLTK triggers an `FL_BEFORE_MENU` event for this widget right before
|
||||
displaying the menu. This event provides an opportunity to update menu
|
||||
item states and activation.
|
||||
|
||||
|
||||
\par Example Use of Fl_Input_Choice
|
||||
\code
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -173,7 +173,7 @@ static void tooltip_hide_timeout(void*) {
|
||||
\return always 1, so this call can finish the FL_BEFORE_TOOLTIP event handling.
|
||||
|
||||
\see void Fl_Widget::tooltip(const char *text).
|
||||
|
||||
|
||||
\see `test/color_chooser.cxx` for a usage example.
|
||||
*/
|
||||
int Fl_Tooltip::override_text(const char *new_text) {
|
||||
|
||||
@@ -77,7 +77,7 @@ bool Fl_System_Driverawake_pending_ = false;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Adds an awake handler for use in awake().
|
||||
|
||||
\internal Adds an awake handler for use in awake().
|
||||
@@ -103,7 +103,7 @@ int Fl_System_Driver::push_awake_handler(Fl_Awake_Handler func, void *data, bool
|
||||
}
|
||||
|
||||
// If we want to add the handler only once, go through the list of existing
|
||||
// handlers and remove any handler with the same function pointer
|
||||
// handlers and remove any handler with the same function pointer
|
||||
// and data pointer.
|
||||
if (once) {
|
||||
int src = awake_ring_tail_;
|
||||
@@ -144,9 +144,9 @@ int Fl_System_Driver::push_awake_handler(Fl_Awake_Handler func, void *data, bool
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Gets the last stored awake handler for use in awake().
|
||||
\internal Used in the main event loop when an Awake message is received.
|
||||
\internal Used in the main event loop when an Awake message is received.
|
||||
*/
|
||||
int Fl_System_Driver::pop_awake_handler(Fl_Awake_Handler &func, void *&data)
|
||||
{
|
||||
@@ -168,7 +168,7 @@ int Fl_System_Driver::pop_awake_handler(Fl_Awake_Handler &func, void *&data)
|
||||
|
||||
/**
|
||||
\brief Checks if the awake ring buffer is empty.
|
||||
\internal Used in the main event loop when an Awake message is received.
|
||||
\internal Used in the main event loop when an Awake message is received.
|
||||
*/
|
||||
bool Fl_System_Driver::awake_ring_empty() {
|
||||
Fl::system_driver()->lock_ring();
|
||||
@@ -180,9 +180,9 @@ bool Fl_System_Driver::awake_ring_empty() {
|
||||
/**
|
||||
\brief Notifies the main GUI thread from a worker thread.
|
||||
|
||||
In FLTK, worker threads can update the UI, but all UI changes must be wrapped
|
||||
between Fl::lock() and Fl::unlock(). After calling Fl::unlock(), the worker
|
||||
thread should call Fl::awake() to signal the main thread that
|
||||
In FLTK, worker threads can update the UI, but all UI changes must be wrapped
|
||||
between Fl::lock() and Fl::unlock(). After calling Fl::unlock(), the worker
|
||||
thread should call Fl::awake() to signal the main thread that
|
||||
updates are pending.
|
||||
|
||||
\note Worker threads must not create, show, or hide windows.
|
||||
@@ -201,12 +201,12 @@ void Fl::awake() {
|
||||
\deprecated Use Fl::awake() or Fl::awake(Fl_Awake_Handler, void*) instead.
|
||||
|
||||
This method is deprecated. The API can not ensure that Fl::thread_message()
|
||||
returns the messages sent by Fl::awake(void *v) complete and in the correct
|
||||
returns the messages sent by Fl::awake(void *v) complete and in the correct
|
||||
order.
|
||||
|
||||
Use Fl::awake() instead if you do not need to send a specific message.
|
||||
Use Fl::awake(Fl_Awake_Handler, void*) or Fl::awake_once(Fl_Awake_Handler, void*)
|
||||
if you need to send a message to the main thread and ensure that all messages
|
||||
if you need to send a message to the main thread and ensure that all messages
|
||||
are processed in the order they were sent.
|
||||
|
||||
\see \ref advanced_multithreading
|
||||
@@ -225,16 +225,16 @@ void Fl::awake(void *v) {
|
||||
be run by the main thread, passing optional user data. The callback will be
|
||||
executed during the main thread's next event handling cycle.
|
||||
|
||||
The queue holding the list of handlers is limited to 1024 entries.
|
||||
The queue holding the list of handlers is limited to 1024 entries.
|
||||
If the queue is full, the function will return -1 and the callback will not be
|
||||
scheduled. However the main thread will still be woken up to process any
|
||||
scheduled. However the main thread will still be woken up to process any
|
||||
other pending events.
|
||||
|
||||
\note If user_data points to dynamically allocated memory, it is the
|
||||
responsibility of the caller to ensure that the memory is valid until the
|
||||
callback is executed. The callback will be executed during the main thread's
|
||||
next event handling cycle, but depending on the sytems load, this may take
|
||||
several seconds.
|
||||
next event handling cycle, but depending on the sytems load, this may take
|
||||
several seconds.
|
||||
|
||||
\return 0 if the callback was successfully scheduled
|
||||
\return -1 if the queue is full.
|
||||
@@ -273,15 +273,15 @@ int Fl::awake_once(Fl_Awake_Handler handler, void *user_data) {
|
||||
|
||||
/**
|
||||
\brief Returns the last message sent by a child thread.
|
||||
|
||||
\deprecated Use Fl::awake(Fl_Awake_Handler, void*) or
|
||||
|
||||
\deprecated Use Fl::awake(Fl_Awake_Handler, void*) or
|
||||
Fl::awake_once(Fl_Awake_Handler, void*) instead.
|
||||
|
||||
The thread_message() method returns the last message
|
||||
that was sent from a child by the Fl::awake(void*) method.
|
||||
|
||||
This method is deprecated. The API can not ensure that Fl::thread_message()
|
||||
returns the messages sent by Fl::awake(void *v) complete and in the correct
|
||||
returns the messages sent by Fl::awake(void *v) complete and in the correct
|
||||
order.
|
||||
|
||||
\see \ref advanced_multithreading
|
||||
@@ -300,14 +300,14 @@ void* Fl::thread_message() {
|
||||
The lock() method blocks the current thread until it
|
||||
can safely access FLTK widgets and data. Child threads should
|
||||
call this method prior to updating any widgets or accessing
|
||||
data. The main thread must call Fl::lock() once before any windows are shown
|
||||
data. The main thread must call Fl::lock() once before any windows are shown
|
||||
to initialize the threading support in FLTK. The initial Fl::lock() call
|
||||
will return non-zero if threading is not available on the platform.
|
||||
|
||||
Child threads enclose calls to FLTK functions between Fl::lock() and
|
||||
Child threads enclose calls to FLTK functions between Fl::lock() and
|
||||
Fl::unlock() accessing FLTK. When a child thread has finshed accessing FLTK
|
||||
and wants the main thread to update the UI, it should call Fl::awake().
|
||||
|
||||
|
||||
Child threads can never create, show, or hide windows.
|
||||
|
||||
When the wait() method is waiting
|
||||
@@ -327,10 +327,10 @@ int Fl::lock() {
|
||||
return Fl::system_driver()->lock();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
\brief Release the global UI lock set by Fl::lock().
|
||||
|
||||
The unlock() method releases the lock that was set using the lock() method.
|
||||
The unlock() method releases the lock that was set using the lock() method.
|
||||
Child threads should call this method as soon as they are finished
|
||||
accessing FLTK.
|
||||
|
||||
|
||||
@@ -2342,7 +2342,7 @@ void Fl_WinAPI_Window_Driver::makeWindow() {
|
||||
|
||||
if (!im_enabled)
|
||||
flImmAssociateContextEx((HWND)x->xid, 0, 0);
|
||||
|
||||
|
||||
if (w->fullscreen_active()) Fl::handle(FL_FULLSCREEN, w);
|
||||
}
|
||||
|
||||
|
||||
@@ -1607,7 +1607,7 @@ static int workarea_xywh[4] = { -1, -1, -1, -1 };
|
||||
|
||||
|
||||
/* Implementation note about computing work area and about handling fractional scaling.
|
||||
|
||||
|
||||
FLTK computes 2 pairs of (WxH) values for each display:
|
||||
1) (pixel_width x pixel_height) gives the size in pixel of a display. It's unchanged by
|
||||
any scaling applied by the compositor; it's assigned by function output_mode().
|
||||
@@ -1615,7 +1615,7 @@ static int workarea_xywh[4] = { -1, -1, -1, -1 };
|
||||
When the active scaling is non-fractional, these equations hold:
|
||||
pixel_width = width = wld_scale * configured-width-of-fullscreen-window
|
||||
pixel_height = height = wld_scale * configured-height-of-fullscreen-window
|
||||
|
||||
|
||||
When fractional scaling is active, buffers received from client are scaled down
|
||||
by the compositor and mapped to screen. These equations hold:
|
||||
pixel_width < width = wld_scale * configured-width-of-fullscreen-window
|
||||
@@ -1624,7 +1624,7 @@ static int workarea_xywh[4] = { -1, -1, -1, -1 };
|
||||
One way for a client to discover that fractional scaling is active on a given display
|
||||
is to ask for a fullscreen window on that display, get its configured size and compare
|
||||
it to that display's pixel size. That's what function compute_full_and_maximized_areas() does.
|
||||
|
||||
|
||||
One way for a client to discover the work area size of a display is to get the configured size
|
||||
of a maximized window on that display. FLTK didn't find a way to control in general
|
||||
on what display the compositor puts a maximized window. One procedure which works
|
||||
@@ -1634,7 +1634,7 @@ static int workarea_xywh[4] = { -1, -1, -1, -1 };
|
||||
display as the fullscreen one, giving the size of that display's work area.
|
||||
Therefore, FLTK computes an exact work area size only with MUTTER or when the system
|
||||
contains a single display. That's also done by function compute_full_and_maximized_areas().
|
||||
|
||||
|
||||
The procedure to compute the work area size also reveals which display is primary:
|
||||
that with a work area vertically smaller than the display's pixel height. This allows
|
||||
to place the primary display as FLTK display #0. Again, FLTK guarantees to identify
|
||||
|
||||
@@ -635,7 +635,7 @@ const char _usermoves[] =
|
||||
// White moves from D3 to E4 (+14).
|
||||
// Black's move? G6 H5 <-- try this in GUI mode w/o the fix below
|
||||
// Valid moves are:
|
||||
// F5 D3 - Black jumps from F5 to D3, E4 removed (-14).
|
||||
// F5 D3 - Black jumps from F5 to D3, E4 removed (-14).
|
||||
//
|
||||
// Hint for further debugging: enable the printf/fflush statements below and
|
||||
// set a breakpoint inside the `if` condition below in a debugger. Then take
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
"Background color is:\n"
|
||||
"palette no. %d = r:%d, g:%d, b:%d", color(), r, g, b);
|
||||
} else {
|
||||
::snprintf(buf, 127,
|
||||
::snprintf(buf, 127,
|
||||
"Background color is:\n"
|
||||
"r:%d, g:%d, b:%d", r, g, b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user