Fluid: Formatting changes.

This commit is contained in:
Matthias Melcher 2026-01-05 22:58:40 +01:00
parent 89aa5726f8
commit 71cee83f77
2 changed files with 323 additions and 227 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,8 +14,6 @@
// https://www.fltk.org/bugs.php
//
// Type for creating all subclasses of Fl_Widget
#ifndef FLUID_NODES_WIDGET_NODE_H
#define FLUID_NODES_WIDGET_NODE_H
@ -33,26 +31,35 @@ extern Node* current_node; // one of the selected ones
extern Widget_Node* current_widget; // one of the selected ones
extern std::string subclassname(Node* l);
extern int is_name(const char *c);
extern int is_name(const char* c);
void selection_changed(Node* new_current);
Node *sort(Node *parent);
Node* sort(Node* parent);
/**
Base class for all widget nodes including menu items.
*/
class Widget_Node : public Node
{
typedef Node super;
virtual Fl_Widget *widget(int,int,int,int) = 0;
virtual Widget_Node *_make() = 0; // virtual constructor
virtual Fl_Widget* widget(int,int,int,int) = 0;
virtual Widget_Node* _make() = 0; // virtual constructor
void setlabel(const char *) override;
/// Additional code blocks that can be inserted in the generated code
std::string extra_code_[NUM_EXTRA_CODE];
/// User can call the ctor for a class that is derived from the node class
std::string subclass_;
/// Keep a copy the tooltip here, also always updates the widget's tooltip
std::string tooltip_;
/// Image name or file name.
std::string image_name_;
/// Name or file name of deactivated image
std::string inactive_name_;
/// Set's a widget's hotspot, or adds a divider to a menu item
uchar hotspot_ = 0;
bool menu_headline_ { false };
/// On menu items, set the "headline" flag
bool menu_headline_ = false;
protected:
@ -69,40 +76,60 @@ protected:
void write_block_close(fld::io::Code_Writer& f);
void write_code2(fld::io::Code_Writer& f) override;
void write_color(fld::io::Code_Writer& f, const char*, Fl_Color);
Fl_Widget *live_widget;
/// Pointer to widget representing this node in live mode.
Fl_Widget* live_widget;
public:
Fl_Widget *o = nullptr;
int public_ = 1;
int bind_image_ = 0;
int compress_image_ = 1;
int bind_deimage_ = 0;
int compress_deimage_ = 1;
int scale_image_w_ = 0, scale_image_h_ = 0;
int scale_deimage_w_ = 0, scale_deimage_h_ = 0;
Image_Asset *image = nullptr;
/// Pointer to widget for interactive editing.
Fl_Widget* o = nullptr;
/// Widget access mode, 0=private, 1=public, 2=protected
int public_ = 1;
// ---- Image stuff
/// Set the bind image flag for the active image
int bind_image_ = 0;
/// Compress the active image when inlining into source code
int compress_image_ = 1;
/// Scale the active image, great for hires screens
int scale_image_w_ = 0, scale_image_h_ = 0;
/// Pointer to the shared image data of the active image
Image_Asset* image = nullptr;
/// Set the bind image flag for the inactive image
int bind_deimage_ = 0;
/// Compress the inactive image when inlining into source code
int compress_deimage_ = 1;
/// Scale the inactive image
int scale_deimage_w_ = 0, scale_deimage_h_ = 0;
/// Pointer to the shared image data of the inactive image
Image_Asset* inactive = nullptr;
void setimage(Image_Asset *);
Image_Asset *inactive = nullptr;
std::string image_name() const { return image_name_; }
void image_name(const std::string& name);
void setinactive(Image_Asset *);
std::string inactive_name() const { return inactive_name_; }
void inactive_name(const std::string& name);
Widget_Node() = default;
Node *make(Strategy strategy) override;
~Widget_Node() override;
Node* make(Strategy strategy) override;
void open() override;
std::string extra_code(int n) const { return extra_code_[n]; }
const std::string& extra_code(int n) const { return extra_code_[n]; }
void extra_code(int n, const std::string& code);
std::string subclass() const { return subclass_; }
void subclass(const std::string& name);
std::string tooltip() const { return tooltip_; }
void tooltip(const std::string& text);
std::string image_name() const { return image_name_; }
void image_name(const std::string& name);
std::string inactive_name() const { return inactive_name_; }
void inactive_name(const std::string& name);
// Note: hotspot is misused by menu items to indicate a divider
uchar hotspot() const {return hotspot_;}
void hotspot(uchar v) {hotspot_ = v;}
uchar hotspot() const { return hotspot_; }
void hotspot(uchar v) { hotspot_ = v; }
uchar resizable() const;
void resizable(uchar v);
@ -110,7 +137,7 @@ public:
void menu_headline(bool v) { menu_headline_ = v; }
virtual int textstuff(int what, Fl_Font &, int &, Fl_Color &);
virtual Fl_Menu_Item *subtypes();
virtual Fl_Menu_Item* subtypes();
Type type() const override { return Type::Widget_; }
bool is_a(Type inType) const override { return (inType==Type::Widget_) ? true : super::is_a(inType); }
@ -122,17 +149,16 @@ public:
void read_property(fld::io::Project_Reader &f, const char *) override;
int read_fdesign(const char*, const char*) override;
Fl_Widget *enter_live_mode(int top=0) override;
Fl_Widget *propagate_live_mode(Fl_Group* grp);
Fl_Widget* enter_live_mode(int top=0) override;
Fl_Widget* propagate_live_mode(Fl_Group* grp);
void leave_live_mode() override;
void copy_properties() override;
virtual void ideal_size(int &w, int &h);
~Widget_Node();
void redraw();
};
extern Fl_Window *the_panel;
extern Fl_Window* the_panel;
#endif // FLUID_NODES_WIDGET_NODE_H