mirror of
https://github.com/fltk/fltk.git
synced 2026-06-02 23:56:55 +08:00
* interactive layout alignment rewritten * interface for new alignment rules * new alignment dialog box * user defined layout rules added * layout rules can be stored in projects, settings, and external files * Valgrind verification
This commit is contained in:
@@ -208,6 +208,7 @@ public:
|
|||||||
|
|
||||||
// Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
|
// Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
|
||||||
Fl_Gl_Window* as_gl_window() FL_OVERRIDE { return this; }
|
Fl_Gl_Window* as_gl_window() FL_OVERRIDE { return this; }
|
||||||
|
Fl_Gl_Window const* as_gl_window() const FL_OVERRIDE { return this; }
|
||||||
|
|
||||||
float pixels_per_unit();
|
float pixels_per_unit();
|
||||||
/** Gives the window width in OpenGL pixels.
|
/** Gives the window width in OpenGL pixels.
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ public:
|
|||||||
|
|
||||||
// Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
|
// Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
|
||||||
Fl_Group* as_group() FL_OVERRIDE { return this; }
|
Fl_Group* as_group() FL_OVERRIDE { return this; }
|
||||||
|
Fl_Group const* as_group() const FL_OVERRIDE { return this; }
|
||||||
|
|
||||||
// back compatibility functions:
|
// back compatibility functions:
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -317,6 +317,10 @@ struct FL_EXPORT Fl_Menu_Item {
|
|||||||
before FLTK 1.4.0.
|
before FLTK 1.4.0.
|
||||||
*/
|
*/
|
||||||
int value() const {return (flags & FL_MENU_VALUE) ? 1 : 0;}
|
int value() const {return (flags & FL_MENU_VALUE) ? 1 : 0;}
|
||||||
|
|
||||||
|
/** Sets the current value of the check or radio item. */
|
||||||
|
void value(int v) { v ? set() : clear(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Turns the check or radio item "on" for the menu item. Note that this
|
Turns the check or radio item "on" for the menu item. Note that this
|
||||||
does not turn off any adjacent radio items like setonly() does.
|
does not turn off any adjacent radio items like setonly() does.
|
||||||
@@ -326,7 +330,7 @@ struct FL_EXPORT Fl_Menu_Item {
|
|||||||
/** Turns the check or radio item "off" for the menu item. */
|
/** Turns the check or radio item "off" for the menu item. */
|
||||||
void clear() {flags &= ~FL_MENU_VALUE;}
|
void clear() {flags &= ~FL_MENU_VALUE;}
|
||||||
|
|
||||||
void setonly();
|
void setonly(Fl_Menu_Item const* first = NULL);
|
||||||
|
|
||||||
/** Gets the visibility of an item. */
|
/** Gets the visibility of an item. */
|
||||||
int visible() const {return !(flags&FL_MENU_INVISIBLE);}
|
int visible() const {return !(flags&FL_MENU_INVISIBLE);}
|
||||||
|
|||||||
+5
-2
@@ -1091,7 +1091,8 @@ public:
|
|||||||
\note This method is provided to avoid dynamic_cast.
|
\note This method is provided to avoid dynamic_cast.
|
||||||
\see Fl_Widget::as_window(), Fl_Widget::as_gl_window()
|
\see Fl_Widget::as_window(), Fl_Widget::as_gl_window()
|
||||||
*/
|
*/
|
||||||
virtual Fl_Group* as_group() {return 0;}
|
virtual Fl_Group* as_group() { return NULL; }
|
||||||
|
virtual Fl_Group const* as_group() const { return NULL; }
|
||||||
|
|
||||||
/** Returns an Fl_Window pointer if this widget is an Fl_Window.
|
/** Returns an Fl_Window pointer if this widget is an Fl_Window.
|
||||||
|
|
||||||
@@ -1106,6 +1107,7 @@ public:
|
|||||||
\see Fl_Widget::as_group(), Fl_Widget::as_gl_window()
|
\see Fl_Widget::as_group(), Fl_Widget::as_gl_window()
|
||||||
*/
|
*/
|
||||||
virtual Fl_Window* as_window() { return 0; }
|
virtual Fl_Window* as_window() { return 0; }
|
||||||
|
virtual Fl_Window const* as_window() const { return NULL; }
|
||||||
|
|
||||||
/** Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.
|
/** Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.
|
||||||
|
|
||||||
@@ -1117,7 +1119,8 @@ public:
|
|||||||
\note This method is provided to avoid dynamic_cast.
|
\note This method is provided to avoid dynamic_cast.
|
||||||
\see Fl_Widget::as_group(), Fl_Widget::as_window()
|
\see Fl_Widget::as_group(), Fl_Widget::as_window()
|
||||||
*/
|
*/
|
||||||
virtual class Fl_Gl_Window* as_gl_window() {return 0;}
|
virtual class Fl_Gl_Window* as_gl_window() { return NULL; }
|
||||||
|
virtual class Fl_Gl_Window const* as_gl_window() const { return NULL; }
|
||||||
|
|
||||||
/** Returns non zero if MAC_USE_ACCENTS_MENU flag is set, 0 otherwise.
|
/** Returns non zero if MAC_USE_ACCENTS_MENU flag is set, 0 otherwise.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -560,6 +560,7 @@ public:
|
|||||||
|
|
||||||
// Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
|
// Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
|
||||||
Fl_Window* as_window() FL_OVERRIDE { return this; }
|
Fl_Window* as_window() FL_OVERRIDE { return this; }
|
||||||
|
Fl_Window const* as_window() const FL_OVERRIDE { return this; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return non-null if this is an Fl_Overlay_Window object.
|
Return non-null if this is an Fl_Overlay_Window object.
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
set (CPPFILES
|
set (CPPFILES
|
||||||
CodeEditor.cxx
|
CodeEditor.cxx
|
||||||
StyleParse.cxx
|
StyleParse.cxx
|
||||||
|
Fd_Snap_Action.cxx
|
||||||
Fl_Function_Type.cxx
|
Fl_Function_Type.cxx
|
||||||
Fl_Group_Type.cxx
|
Fl_Group_Type.cxx
|
||||||
Fl_Menu_Type.cxx
|
Fl_Menu_Type.cxx
|
||||||
@@ -45,6 +46,7 @@ set (CPPFILES
|
|||||||
|
|
||||||
set (HEADERFILES
|
set (HEADERFILES
|
||||||
CodeEditor.h
|
CodeEditor.h
|
||||||
|
Fd_Snap_Action.h
|
||||||
Fl_Function_Type.h
|
Fl_Function_Type.h
|
||||||
Fl_Group_Type.h
|
Fl_Group_Type.h
|
||||||
Fl_Menu_Type.h
|
Fl_Menu_Type.h
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,168 @@
|
|||||||
|
//
|
||||||
|
// Snap action header file for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 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
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef _FLUID_FD_SNAP_ACTION_H
|
||||||
|
#define _FLUID_FD_SNAP_ACTION_H
|
||||||
|
|
||||||
|
#include "Fl_Window_Type.h"
|
||||||
|
|
||||||
|
struct Fl_Menu_Item;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
FD_STORE_INTERNAL,
|
||||||
|
FD_STORE_USER,
|
||||||
|
FD_STORE_PROJECT,
|
||||||
|
FD_STORE_FILE,
|
||||||
|
};
|
||||||
|
|
||||||
|
class Fd_Layout_Preset {
|
||||||
|
public:
|
||||||
|
int left_window_margin;
|
||||||
|
int right_window_margin;
|
||||||
|
int top_window_margin;
|
||||||
|
int bottom_window_margin;
|
||||||
|
int window_grid_x;
|
||||||
|
int window_grid_y;
|
||||||
|
|
||||||
|
int left_group_margin;
|
||||||
|
int right_group_margin;
|
||||||
|
int top_group_margin;
|
||||||
|
int bottom_group_margin;
|
||||||
|
int group_grid_x;
|
||||||
|
int group_grid_y;
|
||||||
|
|
||||||
|
int top_tabs_margin;
|
||||||
|
int bottom_tabs_margin;
|
||||||
|
|
||||||
|
int widget_min_w;
|
||||||
|
int widget_inc_w;
|
||||||
|
int widget_gap_x;
|
||||||
|
int widget_min_h;
|
||||||
|
int widget_inc_h;
|
||||||
|
int widget_gap_y;
|
||||||
|
|
||||||
|
int labelfont;
|
||||||
|
int labelsize;
|
||||||
|
int textfont;
|
||||||
|
int textsize;
|
||||||
|
|
||||||
|
void write(Fl_Preferences &prefs);
|
||||||
|
void read(Fl_Preferences &prefs);
|
||||||
|
void write(Fd_Project_Writer*);
|
||||||
|
void read(Fd_Project_Reader*);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern Fd_Layout_Preset *layout;
|
||||||
|
|
||||||
|
class Fd_Layout_Suite {
|
||||||
|
public:
|
||||||
|
char *name_;
|
||||||
|
char *menu_label;
|
||||||
|
Fd_Layout_Preset *layout[3]; // application, dialog, toolbox;
|
||||||
|
int storage_;
|
||||||
|
void write(Fl_Preferences &prefs);
|
||||||
|
void read(Fl_Preferences &prefs);
|
||||||
|
void write(Fd_Project_Writer*);
|
||||||
|
void read(Fd_Project_Reader*);
|
||||||
|
void update_label();
|
||||||
|
void storage(int s) { storage_ = s; update_label(); }
|
||||||
|
void name(const char *n);
|
||||||
|
void init();
|
||||||
|
~Fd_Layout_Suite();
|
||||||
|
public:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class Fd_Layout_List {
|
||||||
|
public:
|
||||||
|
Fl_Menu_Item *main_menu_;
|
||||||
|
Fl_Menu_Item *choice_menu_;
|
||||||
|
Fd_Layout_Suite *list_;
|
||||||
|
int list_size_;
|
||||||
|
int list_capacity_;
|
||||||
|
bool list_is_static_;
|
||||||
|
int current_suite_;
|
||||||
|
int current_preset_;
|
||||||
|
char *filename_;
|
||||||
|
public:
|
||||||
|
Fd_Layout_List();
|
||||||
|
~Fd_Layout_List();
|
||||||
|
void update_dialogs();
|
||||||
|
void update_menu_labels();
|
||||||
|
int current_suite() const { return current_suite_; }
|
||||||
|
void current_suite(int ix);
|
||||||
|
void current_suite(Fl_String);
|
||||||
|
int current_preset() const { return current_preset_; }
|
||||||
|
void current_preset(int ix);
|
||||||
|
Fd_Layout_Suite &operator[](int ix) { return list_[ix]; }
|
||||||
|
int add(const char *name);
|
||||||
|
void rename(const char *name);
|
||||||
|
void capacity(int);
|
||||||
|
|
||||||
|
int load(const char *filename);
|
||||||
|
int save(const char *filename);
|
||||||
|
void write(Fl_Preferences &prefs, int storage);
|
||||||
|
void read(Fl_Preferences &prefs, int storage);
|
||||||
|
void write(Fd_Project_Writer*);
|
||||||
|
void read(Fd_Project_Reader*);
|
||||||
|
int add(Fd_Layout_Suite*);
|
||||||
|
void remove(int index);
|
||||||
|
void remove_all(int storage);
|
||||||
|
Fd_Layout_Preset *at(int);
|
||||||
|
int size();
|
||||||
|
};
|
||||||
|
|
||||||
|
extern Fd_Layout_List g_layout_list;
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Structure holding all the data to perform interactive alignment operations.
|
||||||
|
*/
|
||||||
|
typedef struct Fd_Snap_Data {
|
||||||
|
int dx, dy; ///< distance of the mouse from its initial PUSH event
|
||||||
|
int bx, by, br, bt; ///< bounding box of the original push event or current bounding box when drawing
|
||||||
|
int drag; ///< drag event mask
|
||||||
|
int x_dist, y_dist; ///< current closest snapping distance in x and y
|
||||||
|
int dx_out, dy_out; ///< current closest snapping point as a delta
|
||||||
|
Fl_Widget_Type *wgt; ///< first selected widget
|
||||||
|
Fl_Window_Type *win; ///< window that handles the drag action
|
||||||
|
int ex_out, ey_out; ///< chosen snap position
|
||||||
|
} Fd_Snap_Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Find points of interest when moving the bounding box of all selected widgets.
|
||||||
|
*/
|
||||||
|
class Fd_Snap_Action {
|
||||||
|
protected:
|
||||||
|
int check_x_(Fd_Snap_Data &d, int x_ref, int x_snap);
|
||||||
|
int check_y_(Fd_Snap_Data &d, int y_ref, int y_snap);
|
||||||
|
void check_x_y_(Fd_Snap_Data &d, int x_ref, int x_snap, int y_ref, int y_snap);
|
||||||
|
void clr() { ex = dx = 0x7fff; }
|
||||||
|
public:
|
||||||
|
int ex, ey, dx, dy, type, mask;
|
||||||
|
Fd_Snap_Action() : ex(0x7fff), ey(0x7fff), dx(128), dy(128), type(0), mask(0) { }
|
||||||
|
virtual void check(Fd_Snap_Data &d) = 0;
|
||||||
|
virtual void draw(Fd_Snap_Data &d) { }
|
||||||
|
virtual bool matches(Fd_Snap_Data &d);
|
||||||
|
public:
|
||||||
|
static int eex, eey;
|
||||||
|
static Fd_Snap_Action *list[];
|
||||||
|
static void check_all(Fd_Snap_Data &d);
|
||||||
|
static void draw_all(Fd_Snap_Data &d);
|
||||||
|
static void get_resize_stepsize(int &x_step, int &y_step);
|
||||||
|
static void get_move_stepsize(int &x_step, int &y_step);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _FLUID_FD_SNAP_ACTION_H
|
||||||
@@ -137,11 +137,6 @@ public:
|
|||||||
|
|
||||||
class Fl_Tabs_Type : public Fl_Group_Type {
|
class Fl_Tabs_Type : public Fl_Group_Type {
|
||||||
public:
|
public:
|
||||||
void ideal_spacing(int &x, int &y) FL_OVERRIDE {
|
|
||||||
x = 10;
|
|
||||||
fl_font(o->labelfont(), o->labelsize());
|
|
||||||
y = fl_height() + o->labelsize() - 6;
|
|
||||||
}
|
|
||||||
const char *type_name() FL_OVERRIDE {return tabs_type_name;}
|
const char *type_name() FL_OVERRIDE {return tabs_type_name;}
|
||||||
const char *alt_type_name() FL_OVERRIDE {return "fltk::TabGroup";}
|
const char *alt_type_name() FL_OVERRIDE {return "fltk::TabGroup";}
|
||||||
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {
|
Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {
|
||||||
@@ -152,6 +147,7 @@ public:
|
|||||||
void remove_child(Fl_Type*) FL_OVERRIDE;
|
void remove_child(Fl_Type*) FL_OVERRIDE;
|
||||||
int pixmapID() FL_OVERRIDE { return 13; }
|
int pixmapID() FL_OVERRIDE { return 13; }
|
||||||
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
|
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
|
||||||
|
int is_tabs() const FL_OVERRIDE {return 1;}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ---- Fl_Scroll_Type ------------------------------------------------- MARK: -
|
// ---- Fl_Scroll_Type ------------------------------------------------- MARK: -
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ Fl_Type *Fl_Menu_Item_Type::make(Strategy strategy) {
|
|||||||
}
|
}
|
||||||
if (!o) {
|
if (!o) {
|
||||||
o = new Fl_Button(0,0,100,20); // create template widget
|
o = new Fl_Button(0,0,100,20); // create template widget
|
||||||
o->labelsize(Fl_Widget_Type::default_size);
|
o->labelsize(layout->labelsize);
|
||||||
|
o->labelfont(layout->labelfont);
|
||||||
}
|
}
|
||||||
|
|
||||||
Fl_Menu_Item_Type* t = submenuflag ? new Fl_Submenu_Type() : new Fl_Menu_Item_Type();
|
Fl_Menu_Item_Type* t = submenuflag ? new Fl_Submenu_Type() : new Fl_Menu_Item_Type();
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ copied or otherwise examined.
|
|||||||
#include "Fl_Type.h"
|
#include "Fl_Type.h"
|
||||||
|
|
||||||
#include "fluid.h"
|
#include "fluid.h"
|
||||||
|
#include "Fd_Snap_Action.h"
|
||||||
#include "Fl_Function_Type.h"
|
#include "Fl_Function_Type.h"
|
||||||
#include "Fl_Widget_Type.h"
|
#include "Fl_Widget_Type.h"
|
||||||
#include "Fl_Window_Type.h"
|
#include "Fl_Window_Type.h"
|
||||||
@@ -193,6 +194,8 @@ void delete_all(int selected_only) {
|
|||||||
shell_settings_write();
|
shell_settings_write();
|
||||||
widget_browser->hposition(0);
|
widget_browser->hposition(0);
|
||||||
widget_browser->vposition(0);
|
widget_browser->vposition(0);
|
||||||
|
g_layout_list.remove_all(FD_STORE_PROJECT);
|
||||||
|
g_layout_list.update_dialogs();
|
||||||
}
|
}
|
||||||
selection_changed(0);
|
selection_changed(0);
|
||||||
widget_browser->redraw();
|
widget_browser->redraw();
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ public:
|
|||||||
virtual int is_menu_item() const {return 0;}
|
virtual int is_menu_item() const {return 0;}
|
||||||
virtual int is_menu_button() const {return 0;}
|
virtual int is_menu_button() const {return 0;}
|
||||||
virtual int is_group() const {return 0;}
|
virtual int is_group() const {return 0;}
|
||||||
|
virtual int is_tabs() const {return 0;}
|
||||||
virtual int is_flex() const {return 0;}
|
virtual int is_flex() const {return 0;}
|
||||||
virtual int is_window() const {return 0;}
|
virtual int is_window() const {return 0;}
|
||||||
virtual int is_code() const {return 0;}
|
virtual int is_code() const {return 0;}
|
||||||
|
|||||||
+29
-28
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Widget type code for the Fast Light Tool Kit (FLTK).
|
// Widget type code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
// Copyright 1998-2023 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// 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
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
@@ -49,8 +49,6 @@
|
|||||||
// instance, sets the widget pointers, and makes all the display
|
// instance, sets the widget pointers, and makes all the display
|
||||||
// update correctly...
|
// update correctly...
|
||||||
|
|
||||||
int Fl_Widget_Type::default_size = FL_NORMAL_SIZE;
|
|
||||||
|
|
||||||
int Fl_Widget_Type::is_widget() const {return 1;}
|
int Fl_Widget_Type::is_widget() const {return 1;}
|
||||||
int Fl_Widget_Type::is_public() const {return public_;}
|
int Fl_Widget_Type::is_public() const {return public_;}
|
||||||
|
|
||||||
@@ -82,17 +80,6 @@ Fl_Widget_Type::ideal_size(int &w, int &h) {
|
|||||||
if (h < 15) h = 15;
|
if (h < 15) h = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the ideal widget spacing...
|
|
||||||
void
|
|
||||||
Fl_Widget_Type::ideal_spacing(int &x, int &y) {
|
|
||||||
if (o->labelsize() < 10)
|
|
||||||
x = y = 0;
|
|
||||||
else if (o->labelsize() < 14)
|
|
||||||
x = y = 5;
|
|
||||||
else
|
|
||||||
x = y = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Make a new Widget node.
|
Make a new Widget node.
|
||||||
\param[in] strategy is kAddAsLastChild or kAddAfterCurrent
|
\param[in] strategy is kAddAsLastChild or kAddAfterCurrent
|
||||||
@@ -146,16 +133,6 @@ Fl_Type *Fl_Widget_Type::make(Strategy strategy) {
|
|||||||
W = H = B;
|
W = H = B;
|
||||||
}
|
}
|
||||||
|
|
||||||
// satisfy the grid requirements (otherwise it edits really strangely):
|
|
||||||
if (gridx>1) {
|
|
||||||
X = (X/gridx)*gridx;
|
|
||||||
W = ((W-1)/gridx+1)*gridx;
|
|
||||||
}
|
|
||||||
if (gridy>1) {
|
|
||||||
Y = (Y/gridy)*gridy;
|
|
||||||
H = ((H-1)/gridy+1)*gridy;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct the Fl_Type:
|
// Construct the Fl_Type:
|
||||||
Fl_Widget_Type *t = _make();
|
Fl_Widget_Type *t = _make();
|
||||||
if (!o) o = widget(0,0,100,100); // create template widget
|
if (!o) o = widget(0,0,100,100); // create template widget
|
||||||
@@ -1366,6 +1343,7 @@ void labelfont_cb(Fl_Choice* i, void *v) {
|
|||||||
} else {
|
} else {
|
||||||
int mod = 0;
|
int mod = 0;
|
||||||
int n = i->value();
|
int n = i->value();
|
||||||
|
if (n <= 0) n = layout->labelfont;
|
||||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||||
if (o->selected && o->is_widget()) {
|
if (o->selected && o->is_widget()) {
|
||||||
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
||||||
@@ -1385,7 +1363,7 @@ void labelsize_cb(Fl_Value_Input* i, void *v) {
|
|||||||
} else {
|
} else {
|
||||||
int mod = 0;
|
int mod = 0;
|
||||||
n = int(i->value());
|
n = int(i->value());
|
||||||
if (n <= 0) n = Fl_Widget_Type::default_size;
|
if (n <= 0) n = layout->labelsize;
|
||||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||||
if (o->selected && o->is_widget()) {
|
if (o->selected && o->is_widget()) {
|
||||||
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
||||||
@@ -1842,6 +1820,7 @@ void textfont_cb(Fl_Choice* i, void* v) {
|
|||||||
} else {
|
} else {
|
||||||
int mod = 0;
|
int mod = 0;
|
||||||
n = (Fl_Font)i->value();
|
n = (Fl_Font)i->value();
|
||||||
|
if (n <= 0) n = layout->textfont;
|
||||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||||
if (o->selected && o->is_widget()) {
|
if (o->selected && o->is_widget()) {
|
||||||
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
||||||
@@ -1862,7 +1841,7 @@ void textsize_cb(Fl_Value_Input* i, void* v) {
|
|||||||
} else {
|
} else {
|
||||||
int mod = 0;
|
int mod = 0;
|
||||||
s = int(i->value());
|
s = int(i->value());
|
||||||
if (s <= 0) s = Fl_Widget_Type::default_size;
|
if (s <= 0) s = layout->textsize;
|
||||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||||
if (o->selected && o->is_widget()) {
|
if (o->selected && o->is_widget()) {
|
||||||
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
Fl_Widget_Type* q = (Fl_Widget_Type*)o;
|
||||||
@@ -2635,11 +2614,33 @@ static void load_panel() {
|
|||||||
the_panel->hide();
|
the_panel->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern Fl_Window *widgetbin_panel;
|
||||||
|
|
||||||
// This is called when user double-clicks an item, open or update the panel:
|
// This is called when user double-clicks an item, open or update the panel:
|
||||||
void Fl_Widget_Type::open() {
|
void Fl_Widget_Type::open() {
|
||||||
if (!the_panel) the_panel = make_widget_panel();
|
bool adjust_position = false;
|
||||||
|
if (!the_panel) {
|
||||||
|
the_panel = make_widget_panel();
|
||||||
|
adjust_position = true;
|
||||||
|
}
|
||||||
load_panel();
|
load_panel();
|
||||||
if (numselected) the_panel->show();
|
if (numselected) {
|
||||||
|
the_panel->show();
|
||||||
|
if (adjust_position) {
|
||||||
|
if (widgetbin_panel && widgetbin_panel->visible()) {
|
||||||
|
if ( (the_panel->x()+the_panel->w() > widgetbin_panel->x())
|
||||||
|
&& (the_panel->x() < widgetbin_panel->x()+widgetbin_panel->w())
|
||||||
|
&& (the_panel->y()+the_panel->h() > widgetbin_panel->y())
|
||||||
|
&& (the_panel->y() < widgetbin_panel->y()+widgetbin_panel->h()) )
|
||||||
|
{
|
||||||
|
if (widgetbin_panel->y()+widgetbin_panel->h()+the_panel->h() > Fl::h())
|
||||||
|
the_panel->position(the_panel->x(), widgetbin_panel->y()-the_panel->h()-30);
|
||||||
|
else
|
||||||
|
the_panel->position(the_panel->x(), widgetbin_panel->y()+widgetbin_panel->h()+30);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void redraw_overlays();
|
extern void redraw_overlays();
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ protected:
|
|||||||
Fl_Widget *live_widget;
|
Fl_Widget *live_widget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int default_size;
|
|
||||||
|
|
||||||
const char *xclass; // junk string, used for shortcut
|
const char *xclass; // junk string, used for shortcut
|
||||||
Fl_Widget *o;
|
Fl_Widget *o;
|
||||||
int public_;
|
int public_;
|
||||||
@@ -111,7 +109,6 @@ public:
|
|||||||
void copy_properties() FL_OVERRIDE;
|
void copy_properties() FL_OVERRIDE;
|
||||||
|
|
||||||
virtual void ideal_size(int &w, int &h);
|
virtual void ideal_size(int &w, int &h);
|
||||||
virtual void ideal_spacing(int &x, int &y);
|
|
||||||
|
|
||||||
~Fl_Widget_Type();
|
~Fl_Widget_Type();
|
||||||
void redraw();
|
void redraw();
|
||||||
|
|||||||
+83
-524
File diff suppressed because it is too large
Load Diff
+11
-2
@@ -5,7 +5,7 @@
|
|||||||
// This should have the widget pointer in it, but it is still in the
|
// This should have the widget pointer in it, but it is still in the
|
||||||
// Fl_Type base class.
|
// Fl_Type base class.
|
||||||
//
|
//
|
||||||
// Copyright 1998-2010 by Bill Spitzak and others.
|
// Copyright 1998-2023 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// 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
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
@@ -28,10 +28,20 @@ class Fl_Widget_Class_Type;
|
|||||||
extern Fl_Menu_Item window_type_menu[];
|
extern Fl_Menu_Item window_type_menu[];
|
||||||
extern Fl_Widget_Class_Type *current_widget_class;
|
extern Fl_Widget_Class_Type *current_widget_class;
|
||||||
void toggle_overlays(Fl_Widget *,void *);
|
void toggle_overlays(Fl_Widget *,void *);
|
||||||
|
void toggle_guides(Fl_Widget *,void *);
|
||||||
void show_project_cb(Fl_Widget *, void *);
|
void show_project_cb(Fl_Widget *, void *);
|
||||||
void show_grid_cb(Fl_Widget *, void *);
|
void show_grid_cb(Fl_Widget *, void *);
|
||||||
void show_settings_cb(Fl_Widget *, void *);
|
void show_settings_cb(Fl_Widget *, void *);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
FD_LEFT = 1, // user drags the left side of the selection box
|
||||||
|
FD_RIGHT = 2,
|
||||||
|
FD_BOTTOM = 4,
|
||||||
|
FD_TOP = 8,
|
||||||
|
FD_DRAG = 16, // user drags the entire selection
|
||||||
|
FD_BOX = 32 // user creates a new selection box
|
||||||
|
};
|
||||||
|
|
||||||
class Fl_Window_Type : public Fl_Widget_Type {
|
class Fl_Window_Type : public Fl_Widget_Type {
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -45,7 +55,6 @@ protected:
|
|||||||
int dx,dy;
|
int dx,dy;
|
||||||
int drag; // which parts of bbox are being moved
|
int drag; // which parts of bbox are being moved
|
||||||
int numselected; // number of children selected
|
int numselected; // number of children selected
|
||||||
enum {LEFT=1,RIGHT=2,BOTTOM=4,TOP=8,DRAG=16,BOX=32};
|
|
||||||
void draw_overlay();
|
void draw_overlay();
|
||||||
void newdx();
|
void newdx();
|
||||||
void newposition(Fl_Widget_Type *,int &x,int &y,int &w,int &h);
|
void newposition(Fl_Widget_Type *,int &x,int &y,int &w,int &h);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ include ../makeinclude
|
|||||||
CPPFILES = \
|
CPPFILES = \
|
||||||
CodeEditor.cxx \
|
CodeEditor.cxx \
|
||||||
StyleParse.cxx \
|
StyleParse.cxx \
|
||||||
|
Fd_Snap_Action.cxx \
|
||||||
Fl_Function_Type.cxx \
|
Fl_Function_Type.cxx \
|
||||||
Fl_Group_Type.cxx \
|
Fl_Group_Type.cxx \
|
||||||
Fl_Menu_Type.cxx \
|
Fl_Menu_Type.cxx \
|
||||||
|
|||||||
@@ -477,31 +477,3 @@ void align_widget_cb(Fl_Widget*, long how)
|
|||||||
if (changed)
|
if (changed)
|
||||||
set_modflag(1);
|
set_modflag(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set sizes of selected widgets...
|
|
||||||
void widget_size_cb(Fl_Widget *, long size) {
|
|
||||||
// Update any selected widgets...
|
|
||||||
int changed = 0;
|
|
||||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
|
||||||
if (o->selected && o->is_widget()) {
|
|
||||||
if (!changed) {
|
|
||||||
changed = 1;
|
|
||||||
undo_checkpoint();
|
|
||||||
}
|
|
||||||
|
|
||||||
Fl_Widget *w = ((Fl_Widget_Type *)o)->o;
|
|
||||||
w->labelsize((Fl_Font)size);
|
|
||||||
Fl_Font f;
|
|
||||||
int s = (int)size;
|
|
||||||
Fl_Color c;
|
|
||||||
((Fl_Widget_Type *)o)->textstuff(2, f, s, c);
|
|
||||||
|
|
||||||
w->redraw();
|
|
||||||
// since this may be a major change, the whole window should be redrawn
|
|
||||||
if (w->window()) w->window()->redraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (changed)
|
|
||||||
set_modflag(1);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -20,6 +20,5 @@
|
|||||||
class Fl_Widget;
|
class Fl_Widget;
|
||||||
|
|
||||||
void align_widget_cb(Fl_Widget *, long);
|
void align_widget_cb(Fl_Widget *, long);
|
||||||
void widget_size_cb(Fl_Widget *, long);
|
|
||||||
|
|
||||||
#endif // _FLUID_ALIGN_WIDGET_H
|
#endif // _FLUID_ALIGN_WIDGET_H
|
||||||
|
|||||||
+650
-93
File diff suppressed because it is too large
Load Diff
+490
-95
File diff suppressed because it is too large
Load Diff
+19
-10
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Setting and shell dialogs for the Fast Light Tool Kit (FLTK).
|
// Setting and shell dialogs for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 1998-2020 by Bill Spitzak and others.
|
// Copyright 1998-2023 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// 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
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
@@ -21,10 +21,12 @@
|
|||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include "fluid.h"
|
#include "fluid.h"
|
||||||
#include "widget_browser.h"
|
#include "widget_browser.h"
|
||||||
|
#include "Fd_Snap_Action.h"
|
||||||
#include "shell_command.h"
|
#include "shell_command.h"
|
||||||
#include <FL/Fl_Text_Buffer.H>
|
#include <FL/Fl_Text_Buffer.H>
|
||||||
#include <FL/Fl_Text_Display.H>
|
#include <FL/Fl_Text_Display.H>
|
||||||
#include <FL/filename.H>
|
#include <FL/filename.H>
|
||||||
|
#include <FL/fl_string_functions.h>
|
||||||
#include <FL/Fl_Scheme_Choice.H>
|
#include <FL/Fl_Scheme_Choice.H>
|
||||||
/**
|
/**
|
||||||
// initialize the scheme from preferences
|
// initialize the scheme from preferences
|
||||||
@@ -95,14 +97,21 @@ extern Fl_Simple_Terminal *shell_run_terminal;
|
|||||||
extern Fl_Return_Button *shell_run_button;
|
extern Fl_Return_Button *shell_run_button;
|
||||||
Fl_Double_Window* make_shell_window();
|
Fl_Double_Window* make_shell_window();
|
||||||
extern Fl_Double_Window *grid_window;
|
extern Fl_Double_Window *grid_window;
|
||||||
extern void grid_cb(Fl_Int_Input*, long);
|
extern Fl_Choice *layout_choice;
|
||||||
extern Fl_Int_Input *horizontal_input;
|
#include <FL/Fl_Menu_Button.H>
|
||||||
extern Fl_Int_Input *vertical_input;
|
extern Fl_Menu_Button *w_layout_menu;
|
||||||
extern Fl_Int_Input *snap_input;
|
#include <FL/Fl_Native_File_Chooser.H>
|
||||||
extern void guides_cb(Fl_Check_Button*, long);
|
extern void propagate_load(Fl_Group*, void*);
|
||||||
extern Fl_Check_Button *guides_toggle;
|
extern void edit_layout_preset_cb(Fl_Button*, long);
|
||||||
#include <FL/Fl_Round_Button.H>
|
extern Fl_Button *preset_choice[3];
|
||||||
extern void default_widget_size_cb(Fl_Round_Button*, long);
|
#include <FL/Fl_Value_Input.H>
|
||||||
extern Fl_Round_Button *def_widget_size[6];
|
extern Fl_Menu_Item fontmenu[];
|
||||||
Fl_Double_Window* make_layout_window();
|
Fl_Double_Window* make_layout_window();
|
||||||
|
extern Fl_Menu_Item menu_layout_choice[];
|
||||||
|
extern Fl_Menu_Item menu_w_layout_menu[];
|
||||||
|
#define w_layout_menu_rename (menu_w_layout_menu+0)
|
||||||
|
extern Fl_Menu_Item *w_layout_menu_storage[4];
|
||||||
|
#define w_layout_menu_load (menu_w_layout_menu+5)
|
||||||
|
#define w_layout_menu_save (menu_w_layout_menu+6)
|
||||||
|
#define w_layout_menu_delete (menu_w_layout_menu+7)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+6
-3
@@ -27,6 +27,7 @@
|
|||||||
#include "fluid.h"
|
#include "fluid.h"
|
||||||
#include "Fl_Window_Type.h"
|
#include "Fl_Window_Type.h"
|
||||||
#include "Fl_Group_Type.h"
|
#include "Fl_Group_Type.h"
|
||||||
|
#include "Fd_Snap_Action.h"
|
||||||
#include "pixmaps.h"
|
#include "pixmaps.h"
|
||||||
#include "undo.h"
|
#include "undo.h"
|
||||||
|
|
||||||
@@ -1064,12 +1065,14 @@ Fl_Type *add_new_widget_from_user(Fl_Type *inPrototype, Strategy strategy) {
|
|||||||
Fl_Widget_Type *wt = (Fl_Widget_Type *)t;
|
Fl_Widget_Type *wt = (Fl_Widget_Type *)t;
|
||||||
|
|
||||||
// Set font sizes...
|
// Set font sizes...
|
||||||
wt->o->labelsize(Fl_Widget_Type::default_size);
|
wt->o->labelsize(layout->labelsize);
|
||||||
|
wt->o->labelfont(layout->labelfont);
|
||||||
|
|
||||||
Fl_Font f;
|
Fl_Font f = layout->textfont;
|
||||||
int s = Fl_Widget_Type::default_size;
|
int s = layout->textsize;
|
||||||
Fl_Color c;
|
Fl_Color c;
|
||||||
|
|
||||||
|
wt->textstuff(1, f, s, c);
|
||||||
wt->textstuff(2, f, s, c);
|
wt->textstuff(2, f, s, c);
|
||||||
|
|
||||||
// Resize and/or reposition new widget...
|
// Resize and/or reposition new widget...
|
||||||
|
|||||||
+20
-2
@@ -159,6 +159,10 @@ int Fd_Project_Reader::close_read() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *Fd_Project_Reader::filename_name() {
|
||||||
|
return fl_filename_name(fname);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert an ASCII sequence form the \.fl file that starts with a \\ into a single character.
|
Convert an ASCII sequence form the \.fl file that starts with a \\ into a single character.
|
||||||
Conversion includes the common C style \\ characters like \\n, \\x## hex
|
Conversion includes the common C style \\ characters like \\n, \\x## hex
|
||||||
@@ -309,7 +313,12 @@ void Fd_Project_Reader::read_children(Fl_Type *p, int paste, Strategy strategy,
|
|||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(c, "snap") || !strcmp(c, "gridx") || !strcmp(c, "gridy")) {
|
if (!strcmp(c, "snap")) {
|
||||||
|
g_layout_list.read(this);
|
||||||
|
goto CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(c, "gridx") || !strcmp(c, "gridy")) {
|
||||||
// grid settings are now global
|
// grid settings are now global
|
||||||
read_word();
|
read_word();
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
@@ -523,6 +532,15 @@ const char *Fd_Project_Reader::read_word(int wantbrace) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Fd_Project_Reader::read_int() {
|
||||||
|
const char *word = read_word();
|
||||||
|
if (word) {
|
||||||
|
return atoi(word);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int Fd_Project_Reader::read_fdesign_line(const char*& name, const char*& value) {
|
int Fd_Project_Reader::read_fdesign_line(const char*& name, const char*& value) {
|
||||||
int length = 0;
|
int length = 0;
|
||||||
int x;
|
int x;
|
||||||
@@ -791,7 +809,7 @@ int Fd_Project_Writer::write_project(const char *filename, int selected_only) {
|
|||||||
if (!selected_only) {
|
if (!selected_only) {
|
||||||
write_string("\nheader_name"); write_word(g_project.header_file_name.c_str());
|
write_string("\nheader_name"); write_word(g_project.header_file_name.c_str());
|
||||||
write_string("\ncode_name"); write_word(g_project.code_file_name.c_str());
|
write_string("\ncode_name"); write_word(g_project.code_file_name.c_str());
|
||||||
|
g_layout_list.write(this);
|
||||||
#if 0
|
#if 0
|
||||||
// https://github.com/fltk/fltk/issues/328
|
// https://github.com/fltk/fltk/issues/328
|
||||||
// Project wide settings require a redesign.
|
// Project wide settings require a redesign.
|
||||||
|
|||||||
@@ -46,11 +46,13 @@ public:
|
|||||||
~Fd_Project_Reader();
|
~Fd_Project_Reader();
|
||||||
int open_read(const char *s);
|
int open_read(const char *s);
|
||||||
int close_read();
|
int close_read();
|
||||||
|
const char *filename_name();
|
||||||
int read_quoted();
|
int read_quoted();
|
||||||
void read_children(Fl_Type *p, int paste, Strategy strategy, char skip_options=0);
|
void read_children(Fl_Type *p, int paste, Strategy strategy, char skip_options=0);
|
||||||
int read_project(const char *, int merge, Strategy strategy=kAddAsLastChild);
|
int read_project(const char *, int merge, Strategy strategy=kAddAsLastChild);
|
||||||
void read_error(const char *format, ...);
|
void read_error(const char *format, ...);
|
||||||
const char *read_word(int wantbrace = 0);
|
const char *read_word(int wantbrace = 0);
|
||||||
|
int read_int();
|
||||||
int read_fdesign_line(const char*& name, const char*& value);
|
int read_fdesign_line(const char*& name, const char*& value);
|
||||||
void read_fdesign();
|
void read_fdesign();
|
||||||
};
|
};
|
||||||
|
|||||||
+18
-32
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// FLUID main entry for the Fast Light Tool Kit (FLTK).
|
// FLUID main entry for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 1998-2022 by Bill Spitzak and others.
|
// Copyright 1998-2023 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// 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
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
@@ -74,15 +74,6 @@ Fl_Window *main_window;
|
|||||||
/// Fluid application preferences, allways accessible, will be flushed when app closes.
|
/// Fluid application preferences, allways accessible, will be flushed when app closes.
|
||||||
Fl_Preferences fluid_prefs(Fl_Preferences::USER_L, "fltk.org", "fluid");
|
Fl_Preferences fluid_prefs(Fl_Preferences::USER_L, "fltk.org", "fluid");
|
||||||
|
|
||||||
/// Align widget position and size when designing, saved in app preferences and project file.
|
|
||||||
int gridx = 5;
|
|
||||||
|
|
||||||
/// Align widget position and size when designing, saved in app preferences and project file.
|
|
||||||
int gridy = 5;
|
|
||||||
|
|
||||||
/// Activate snapping to grid, saved in app preferences and project file.
|
|
||||||
int snap = 1;
|
|
||||||
|
|
||||||
/// Show guides in the design window when positioning widgets, saved in app preferences.
|
/// Show guides in the design window when positioning widgets, saved in app preferences.
|
||||||
int show_guides = 1;
|
int show_guides = 1;
|
||||||
|
|
||||||
@@ -132,6 +123,9 @@ Fl_Menu_Item *sourceview_item = NULL;
|
|||||||
/// Menuitem to show or hide the editing overlay, label will change if overlay visibility changes.
|
/// Menuitem to show or hide the editing overlay, label will change if overlay visibility changes.
|
||||||
Fl_Menu_Item *overlay_item = NULL;
|
Fl_Menu_Item *overlay_item = NULL;
|
||||||
|
|
||||||
|
/// Menuitem to show or hide the editing guides, label will change if overlay visibility changes.
|
||||||
|
Fl_Menu_Item *guides_item = NULL;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// Filename of the current .fl design file
|
/// Filename of the current .fl design file
|
||||||
@@ -285,7 +279,6 @@ void Fluid_Project::reset() {
|
|||||||
code_file_set = 0;
|
code_file_set = 0;
|
||||||
header_file_name = ".h";
|
header_file_name = ".h";
|
||||||
code_file_name = ".cxx";
|
code_file_name = ".cxx";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Sourceview definition
|
// ---- Sourceview definition
|
||||||
@@ -693,6 +686,8 @@ void exit_cb(Fl_Widget *,void *) {
|
|||||||
if (help_dialog)
|
if (help_dialog)
|
||||||
delete help_dialog;
|
delete help_dialog;
|
||||||
|
|
||||||
|
g_layout_list.write(fluid_prefs, FD_STORE_USER);
|
||||||
|
|
||||||
undo_clear();
|
undo_clear();
|
||||||
|
|
||||||
// Destroy tree
|
// Destroy tree
|
||||||
@@ -1144,10 +1139,6 @@ void delete_cb(Fl_Widget *, void *) {
|
|||||||
void paste_cb(Fl_Widget*, void*) {
|
void paste_cb(Fl_Widget*, void*) {
|
||||||
//if (ipasteoffset) force_parent = 1;
|
//if (ipasteoffset) force_parent = 1;
|
||||||
pasteoffset = ipasteoffset;
|
pasteoffset = ipasteoffset;
|
||||||
// TODO: make the paste offset more predictable, if any at all.
|
|
||||||
// TODO: Don't use the grid if the user switched it off.
|
|
||||||
if (gridx>1) pasteoffset = ((pasteoffset-1)/gridx+1)*gridx;
|
|
||||||
if (gridy>1) pasteoffset = ((pasteoffset-1)/gridy+1)*gridy;
|
|
||||||
undo_checkpoint();
|
undo_checkpoint();
|
||||||
undo_suspend();
|
undo_suspend();
|
||||||
Strategy strategy = kAddAfterCurrent;
|
Strategy strategy = kAddAfterCurrent;
|
||||||
@@ -1370,6 +1361,9 @@ void print_menu_cb(Fl_Widget *, void *) {
|
|||||||
|
|
||||||
// ---- Main menu bar
|
// ---- Main menu bar
|
||||||
|
|
||||||
|
extern void select_layout_preset_cb(Fl_Widget *, void *user_data);
|
||||||
|
extern void layout_suite_marker(Fl_Widget *, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This is the main Fluid menu.
|
This is the main Fluid menu.
|
||||||
|
|
||||||
@@ -1428,6 +1422,7 @@ Fl_Menu_Item Main_Menu[] = {
|
|||||||
{"&Group", FL_F+7, group_cb},
|
{"&Group", FL_F+7, group_cb},
|
||||||
{"Ung&roup", FL_F+8, ungroup_cb,0, FL_MENU_DIVIDER},
|
{"Ung&roup", FL_F+8, ungroup_cb,0, FL_MENU_DIVIDER},
|
||||||
{"Hide O&verlays",FL_COMMAND+FL_SHIFT+'o',toggle_overlays},
|
{"Hide O&verlays",FL_COMMAND+FL_SHIFT+'o',toggle_overlays},
|
||||||
|
{"Hide Guides",FL_COMMAND+FL_SHIFT+'g',toggle_guides},
|
||||||
{"Show Widget &Bin...",FL_ALT+'b',toggle_widgetbin_cb},
|
{"Show Widget &Bin...",FL_ALT+'b',toggle_widgetbin_cb},
|
||||||
{"Show Source Code...",FL_ALT+FL_SHIFT+'s', (Fl_Callback*)toggle_sourceview_cb, 0, FL_MENU_DIVIDER},
|
{"Show Source Code...",FL_ALT+FL_SHIFT+'s', (Fl_Callback*)toggle_sourceview_cb, 0, FL_MENU_DIVIDER},
|
||||||
{"Pro&ject Settings...",FL_ALT+'p',show_project_cb},
|
{"Pro&ject Settings...",FL_ALT+'p',show_project_cb},
|
||||||
@@ -1452,19 +1447,15 @@ Fl_Menu_Item Main_Menu[] = {
|
|||||||
{"&Height",0,(Fl_Callback *)align_widget_cb,(void*)31},
|
{"&Height",0,(Fl_Callback *)align_widget_cb,(void*)31},
|
||||||
{"&Both",0,(Fl_Callback *)align_widget_cb,(void*)32},
|
{"&Both",0,(Fl_Callback *)align_widget_cb,(void*)32},
|
||||||
{0},
|
{0},
|
||||||
{"&Center In Group",0,0,0,FL_SUBMENU},
|
{"&Center In Group",0,0,0,FL_SUBMENU|FL_MENU_DIVIDER},
|
||||||
{"&Horizontal",0,(Fl_Callback *)align_widget_cb,(void*)40},
|
{"&Horizontal",0,(Fl_Callback *)align_widget_cb,(void*)40},
|
||||||
{"&Vertical",0,(Fl_Callback *)align_widget_cb,(void*)41},
|
{"&Vertical",0,(Fl_Callback *)align_widget_cb,(void*)41},
|
||||||
{0},
|
{0},
|
||||||
{"Set &Widget Size",0,0,0,FL_SUBMENU|FL_MENU_DIVIDER},
|
{"&Grid and Size Settings...",FL_COMMAND+'g',show_grid_cb, NULL, FL_MENU_DIVIDER},
|
||||||
{"&Tiny",FL_ALT+'1',(Fl_Callback *)widget_size_cb,(void*)8,0,FL_NORMAL_LABEL,FL_HELVETICA,8},
|
{"Presets", 0, layout_suite_marker, (void*)g_layout_list.main_menu_, FL_SUBMENU_POINTER },
|
||||||
{"&Small",FL_ALT+'2',(Fl_Callback *)widget_size_cb,(void*)11,0,FL_NORMAL_LABEL,FL_HELVETICA,11},
|
{"Application", 0, select_layout_preset_cb, (void*)0, FL_MENU_RADIO|FL_MENU_VALUE },
|
||||||
{"&Normal",FL_ALT+'3',(Fl_Callback *)widget_size_cb,(void*)14,0,FL_NORMAL_LABEL,FL_HELVETICA,14},
|
{"Dialog", 0, select_layout_preset_cb, (void*)1, FL_MENU_RADIO },
|
||||||
{"&Medium",FL_ALT+'4',(Fl_Callback *)widget_size_cb,(void*)18,0,FL_NORMAL_LABEL,FL_HELVETICA,18},
|
{"Toolbox", 0, select_layout_preset_cb, (void*)2, FL_MENU_RADIO },
|
||||||
{"&Large",FL_ALT+'5',(Fl_Callback *)widget_size_cb,(void*)24,0,FL_NORMAL_LABEL,FL_HELVETICA,24},
|
|
||||||
{"&Huge",FL_ALT+'6',(Fl_Callback *)widget_size_cb,(void*)32,0,FL_NORMAL_LABEL,FL_HELVETICA,32},
|
|
||||||
{0},
|
|
||||||
{"&Grid and Size Settings...",FL_COMMAND+'g',show_grid_cb},
|
|
||||||
{0},
|
{0},
|
||||||
{"&Shell",0,0,0,FL_SUBMENU},
|
{"&Shell",0,0,0,FL_SUBMENU},
|
||||||
{"Execute &Command...",FL_ALT+'x',(Fl_Callback *)show_shell_window},
|
{"Execute &Command...",FL_ALT+'x',(Fl_Callback *)show_shell_window},
|
||||||
@@ -1618,11 +1609,7 @@ void toggle_sourceview_b_cb(Fl_Button*, void *) {
|
|||||||
*/
|
*/
|
||||||
void make_main_window() {
|
void make_main_window() {
|
||||||
if (!batch_mode) {
|
if (!batch_mode) {
|
||||||
fluid_prefs.get("snap", snap, 1);
|
|
||||||
fluid_prefs.get("gridx", gridx, 5);
|
|
||||||
fluid_prefs.get("gridy", gridy, 5);
|
|
||||||
fluid_prefs.get("show_guides", show_guides, 0);
|
fluid_prefs.get("show_guides", show_guides, 0);
|
||||||
fluid_prefs.get("widget_size", Fl_Widget_Type::default_size, 14);
|
|
||||||
fluid_prefs.get("show_comments", show_comments, 1);
|
fluid_prefs.get("show_comments", show_comments, 1);
|
||||||
shell_prefs_get();
|
shell_prefs_get();
|
||||||
make_layout_window();
|
make_layout_window();
|
||||||
@@ -1646,6 +1633,7 @@ void make_main_window() {
|
|||||||
widgetbin_item = (Fl_Menu_Item*)main_menubar->find_item(toggle_widgetbin_cb);
|
widgetbin_item = (Fl_Menu_Item*)main_menubar->find_item(toggle_widgetbin_cb);
|
||||||
sourceview_item = (Fl_Menu_Item*)main_menubar->find_item((Fl_Callback*)toggle_sourceview_cb);
|
sourceview_item = (Fl_Menu_Item*)main_menubar->find_item((Fl_Callback*)toggle_sourceview_cb);
|
||||||
overlay_item = (Fl_Menu_Item*)main_menubar->find_item((Fl_Callback*)toggle_overlays);
|
overlay_item = (Fl_Menu_Item*)main_menubar->find_item((Fl_Callback*)toggle_overlays);
|
||||||
|
guides_item = (Fl_Menu_Item*)main_menubar->find_item((Fl_Callback*)toggle_guides);
|
||||||
main_menubar->global();
|
main_menubar->global();
|
||||||
fill_in_New_Menu();
|
fill_in_New_Menu();
|
||||||
main_window->end();
|
main_window->end();
|
||||||
@@ -2091,6 +2079,7 @@ int main(int argc,char **argv) {
|
|||||||
main_window->show(argc,argv);
|
main_window->show(argc,argv);
|
||||||
toggle_widgetbin_cb(0,0);
|
toggle_widgetbin_cb(0,0);
|
||||||
toggle_sourceview_cb(0,0);
|
toggle_sourceview_cb(0,0);
|
||||||
|
g_layout_list.read(fluid_prefs, FD_STORE_USER);
|
||||||
if (!c && openlast_button->value() && absolute_history[0][0]) {
|
if (!c && openlast_button->value() && absolute_history[0][0]) {
|
||||||
// Open previous file when no file specified...
|
// Open previous file when no file specified...
|
||||||
open_history_cb(0, absolute_history[0]);
|
open_history_cb(0, absolute_history[0]);
|
||||||
@@ -2137,13 +2126,10 @@ int main(int argc,char **argv) {
|
|||||||
// Set (but do not start) timer callback for external editor updates
|
// Set (but do not start) timer callback for external editor updates
|
||||||
ExternalCodeEditor::set_update_timer_callback(external_editor_timer);
|
ExternalCodeEditor::set_update_timer_callback(external_editor_timer);
|
||||||
|
|
||||||
grid_cb(horizontal_input, 0); // Makes sure that windows get snap params...
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Fl::run();
|
Fl::run();
|
||||||
#else
|
#else
|
||||||
while (!quit_flag) Fl::wait();
|
while (!quit_flag) Fl::wait();
|
||||||
|
|
||||||
if (quit_flag) exit_cb(0,0);
|
if (quit_flag) exit_cb(0,0);
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
|||||||
+8
-5
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// FLUID main entry for the Fast Light Tool Kit (FLTK).
|
// FLUID main entry for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
// Copyright 1998-2023 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// 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
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
@@ -42,9 +42,6 @@ extern Fl_Menu_Item Main_Menu[];
|
|||||||
extern Fl_Menu_Bar *main_menubar;
|
extern Fl_Menu_Bar *main_menubar;
|
||||||
extern Fl_Window *main_window;
|
extern Fl_Window *main_window;
|
||||||
|
|
||||||
extern int gridx;
|
|
||||||
extern int gridy;
|
|
||||||
extern int snap;
|
|
||||||
extern int show_guides;
|
extern int show_guides;
|
||||||
extern int show_comments;
|
extern int show_comments;
|
||||||
|
|
||||||
@@ -65,6 +62,9 @@ extern Fl_Menu_Item *history_item;
|
|||||||
extern Fl_Menu_Item *widgetbin_item;
|
extern Fl_Menu_Item *widgetbin_item;
|
||||||
extern Fl_Menu_Item *sourceview_item;
|
extern Fl_Menu_Item *sourceview_item;
|
||||||
extern Fl_Menu_Item *overlay_item;
|
extern Fl_Menu_Item *overlay_item;
|
||||||
|
extern Fl_Button *overlay_button;
|
||||||
|
extern Fl_Menu_Item *guides_item;
|
||||||
|
extern Fl_Button *guides_button;
|
||||||
|
|
||||||
extern int modflag;
|
extern int modflag;
|
||||||
|
|
||||||
@@ -76,6 +76,7 @@ extern int compile_file; // fluid -c
|
|||||||
extern int compile_strings; // fluic -cs
|
extern int compile_strings; // fluic -cs
|
||||||
extern int batch_mode;
|
extern int batch_mode;
|
||||||
|
|
||||||
|
extern int pasteoffset;
|
||||||
extern int pasteoffset;
|
extern int pasteoffset;
|
||||||
|
|
||||||
// ---- project settings
|
// ---- project settings
|
||||||
@@ -133,7 +134,9 @@ extern void new_from_template_cb(Fl_Widget *w, void *v);
|
|||||||
extern int write_code_files();
|
extern int write_code_files();
|
||||||
extern void write_strings_cb(Fl_Widget *, void *);
|
extern void write_strings_cb(Fl_Widget *, void *);
|
||||||
extern void align_widget_cb(Fl_Widget *, long);
|
extern void align_widget_cb(Fl_Widget *, long);
|
||||||
extern void widget_size_cb(Fl_Widget *, long);
|
|
||||||
extern void toggle_widgetbin_cb(Fl_Widget *, void *);
|
extern void toggle_widgetbin_cb(Fl_Widget *, void *);
|
||||||
|
|
||||||
|
inline int fd_min(int a, int b) { return (a < b ? a : b); }
|
||||||
|
inline int fd_min(int a, int b, int c) { return fd_min(a, fd_min(b, c)); }
|
||||||
|
|
||||||
#endif // _FLUID_FLUID_H
|
#endif // _FLUID_FLUID_H
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Widget Browser code for the Fast Light Tool Kit (FLTK).
|
// Widget Browser code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
// Copyright 1998-2023 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// 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
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
|||||||
+22
-14
@@ -113,6 +113,10 @@ Fl_Box *w_when_box=(Fl_Box *)0;
|
|||||||
|
|
||||||
Fl_Button *wLiveMode=(Fl_Button *)0;
|
Fl_Button *wLiveMode=(Fl_Button *)0;
|
||||||
|
|
||||||
|
Fl_Button *overlay_button=(Fl_Button *)0;
|
||||||
|
|
||||||
|
Fl_Button *guides_button=(Fl_Button *)0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a panel that can be used with all known widgets
|
Create a panel that can be used with all known widgets
|
||||||
*/
|
*/
|
||||||
@@ -969,7 +973,7 @@ access the Widget pointer and \'v\' to access the user value.");
|
|||||||
} // Fl_Menu_Button* o
|
} // Fl_Menu_Button* o
|
||||||
o->end();
|
o->end();
|
||||||
} // Fl_Group* o
|
} // Fl_Group* o
|
||||||
{ Fl_Group* o = new Fl_Group(95, 335, 310, 20, "Type:");
|
{ Fl_Group* o = new Fl_Group(95, 332, 310, 26, "Type:");
|
||||||
o->labelfont(1);
|
o->labelfont(1);
|
||||||
o->labelsize(11);
|
o->labelsize(11);
|
||||||
o->callback((Fl_Callback*)propagate_load);
|
o->callback((Fl_Callback*)propagate_load);
|
||||||
@@ -999,26 +1003,30 @@ access the Widget pointer and \'v\' to access the user value.");
|
|||||||
} // Fl_Tabs* o
|
} // Fl_Tabs* o
|
||||||
{ Fl_Group* o = new Fl_Group(10, 370, 400, 20);
|
{ Fl_Group* o = new Fl_Group(10, 370, 400, 20);
|
||||||
o->labelsize(11);
|
o->labelsize(11);
|
||||||
{ // Hidden resizable box
|
{ wLiveMode = new Fl_Button(10, 370, 80, 20, "Live &Resize");
|
||||||
Fl_Box* o = new Fl_Box(10, 370, 75, 20);
|
|
||||||
o->labelsize(11);
|
|
||||||
o->hide();
|
|
||||||
Fl_Group::current()->resizable(o);
|
|
||||||
} // Fl_Box* o
|
|
||||||
{ wLiveMode = new Fl_Button(155, 370, 80, 20, "Live &Resize");
|
|
||||||
wLiveMode->tooltip("Create a live duplicate of the selected widgets to test resizing and menu beh\
|
wLiveMode->tooltip("Create a live duplicate of the selected widgets to test resizing and menu beh\
|
||||||
avior.");
|
avior.");
|
||||||
wLiveMode->type(1);
|
wLiveMode->type(1);
|
||||||
wLiveMode->labelsize(11);
|
wLiveMode->labelsize(11);
|
||||||
wLiveMode->callback((Fl_Callback*)live_mode_cb);
|
wLiveMode->callback((Fl_Callback*)live_mode_cb);
|
||||||
} // Fl_Button* wLiveMode
|
} // Fl_Button* wLiveMode
|
||||||
{ Fl_Button* o = new Fl_Button(240, 370, 100, 20, "Hide &Overlays");
|
{ overlay_button = new Fl_Button(94, 370, 80, 20, "Hide &Overlays");
|
||||||
o->tooltip("Hide the widget overlay box.");
|
overlay_button->tooltip("Hide the widget overlay box.");
|
||||||
|
overlay_button->labelsize(11);
|
||||||
|
overlay_button->callback((Fl_Callback*)overlay_cb);
|
||||||
|
} // Fl_Button* overlay_button
|
||||||
|
{ guides_button = new Fl_Button(178, 370, 80, 20, "Hide &Guides");
|
||||||
|
guides_button->tooltip("Hide alignment guides.");
|
||||||
|
guides_button->labelsize(11);
|
||||||
|
guides_button->callback((Fl_Callback*)guides_cb);
|
||||||
|
} // Fl_Button* guides_button
|
||||||
|
{ // Hidden resizable box
|
||||||
|
Fl_Box* o = new Fl_Box(258, 370, 72, 20);
|
||||||
o->labelsize(11);
|
o->labelsize(11);
|
||||||
o->labelcolor((Fl_Color)1);
|
o->hide();
|
||||||
o->callback((Fl_Callback*)overlay_cb);
|
Fl_Group::current()->resizable(o);
|
||||||
} // Fl_Button* o
|
} // Fl_Box* o
|
||||||
{ Fl_Return_Button* o = new Fl_Return_Button(345, 370, 65, 20, "Close");
|
{ Fl_Return_Button* o = new Fl_Return_Button(330, 370, 80, 20, "Close");
|
||||||
o->labelsize(11);
|
o->labelsize(11);
|
||||||
o->callback((Fl_Callback*)ok_cb);
|
o->callback((Fl_Callback*)ok_cb);
|
||||||
} // Fl_Return_Button* o
|
} // Fl_Return_Button* o
|
||||||
|
|||||||
+16
-11
@@ -30,7 +30,7 @@ Function {make_widget_panel()} {
|
|||||||
comment {Create a panel that can be used with all known widgets} open
|
comment {Create a panel that can be used with all known widgets} open
|
||||||
} {
|
} {
|
||||||
Fl_Window {} {
|
Fl_Window {} {
|
||||||
comment {Use a Double Window to avoid flickering.} open
|
comment {Use a Double Window to avoid flickering.} open selected
|
||||||
xywh {566 244 420 400} type Double labelsize 11 align 80 resizable hotspot
|
xywh {566 244 420 400} type Double labelsize 11 align 80 resizable hotspot
|
||||||
code0 {o->size_range(o->w(), o->h());} size_range {420 400 0 0} visible
|
code0 {o->size_range(o->w(), o->h());} size_range {420 400 0 0} visible
|
||||||
} {
|
} {
|
||||||
@@ -40,7 +40,7 @@ Function {make_widget_panel()} {
|
|||||||
} {
|
} {
|
||||||
Fl_Group {} {
|
Fl_Group {} {
|
||||||
label GUI
|
label GUI
|
||||||
callback propagate_load open selected
|
callback propagate_load open
|
||||||
xywh {10 30 400 330} labelsize 11 when 0 resizable
|
xywh {10 30 400 330} labelsize 11 when 0 resizable
|
||||||
} {
|
} {
|
||||||
Fl_Group {} {
|
Fl_Group {} {
|
||||||
@@ -784,7 +784,7 @@ wCallback->do_callback(wCallback, v);} open
|
|||||||
Fl_Group {} {
|
Fl_Group {} {
|
||||||
label {Type:}
|
label {Type:}
|
||||||
callback propagate_load open
|
callback propagate_load open
|
||||||
xywh {95 335 310 20} labelfont 1 labelsize 11 align 4
|
xywh {95 332 310 26} labelfont 1 labelsize 11 align 4
|
||||||
} {
|
} {
|
||||||
Fl_Input_Choice {} {
|
Fl_Input_Choice {} {
|
||||||
callback user_data_type_cb open
|
callback user_data_type_cb open
|
||||||
@@ -809,24 +809,29 @@ wCallback->do_callback(wCallback, v);} open
|
|||||||
Fl_Group {} {open
|
Fl_Group {} {open
|
||||||
xywh {10 370 400 20} labelsize 11
|
xywh {10 370 400 20} labelsize 11
|
||||||
} {
|
} {
|
||||||
Fl_Box {} {
|
|
||||||
comment {Hidden resizable box}
|
|
||||||
xywh {10 370 75 20} labelsize 11 hide resizable
|
|
||||||
}
|
|
||||||
Fl_Button wLiveMode {
|
Fl_Button wLiveMode {
|
||||||
label {Live &Resize}
|
label {Live &Resize}
|
||||||
callback live_mode_cb
|
callback live_mode_cb
|
||||||
tooltip {Create a live duplicate of the selected widgets to test resizing and menu behavior.} xywh {155 370 80 20} type Toggle labelsize 11
|
tooltip {Create a live duplicate of the selected widgets to test resizing and menu behavior.} xywh {10 370 80 20} type Toggle labelsize 11
|
||||||
}
|
}
|
||||||
Fl_Button {} {
|
Fl_Button overlay_button {
|
||||||
label {Hide &Overlays}
|
label {Hide &Overlays}
|
||||||
callback overlay_cb
|
callback overlay_cb
|
||||||
tooltip {Hide the widget overlay box.} xywh {240 370 100 20} labelsize 11 labelcolor 1
|
tooltip {Hide the widget overlay box.} xywh {94 370 80 20} labelsize 11
|
||||||
|
}
|
||||||
|
Fl_Button guides_button {
|
||||||
|
label {Hide &Guides}
|
||||||
|
callback guides_cb
|
||||||
|
tooltip {Hide alignment guides.} xywh {178 370 80 20} labelsize 11
|
||||||
|
}
|
||||||
|
Fl_Box {} {
|
||||||
|
comment {Hidden resizable box}
|
||||||
|
xywh {258 370 72 20} labelsize 11 hide resizable
|
||||||
}
|
}
|
||||||
Fl_Return_Button {} {
|
Fl_Return_Button {} {
|
||||||
label Close
|
label Close
|
||||||
callback ok_cb
|
callback ok_cb
|
||||||
xywh {345 370 65 20} labelsize 11
|
xywh {330 370 80 20} labelsize 11
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,6 +135,9 @@ extern Fl_Box *w_when_box;
|
|||||||
extern void live_mode_cb(Fl_Button*, void*);
|
extern void live_mode_cb(Fl_Button*, void*);
|
||||||
extern Fl_Button *wLiveMode;
|
extern Fl_Button *wLiveMode;
|
||||||
extern void overlay_cb(Fl_Button*, void*);
|
extern void overlay_cb(Fl_Button*, void*);
|
||||||
|
extern Fl_Button *overlay_button;
|
||||||
|
extern void guides_cb(Fl_Button*, void*);
|
||||||
|
extern Fl_Button *guides_button;
|
||||||
#include <FL/Fl_Return_Button.H>
|
#include <FL/Fl_Return_Button.H>
|
||||||
extern void ok_cb(Fl_Return_Button*, void*);
|
extern void ok_cb(Fl_Return_Button*, void*);
|
||||||
Fl_Double_Window* make_widget_panel();
|
Fl_Double_Window* make_widget_panel();
|
||||||
|
|||||||
+6
-4
@@ -359,10 +359,11 @@ void Fl_Menu_::setonly(Fl_Menu_Item* item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Turns the radio item "on" for the menu item and turns "off" adjacent radio items set.
|
/** Turns the radio item "on" for the menu item and turns "off" adjacent radio items set.
|
||||||
\deprecated This method is dangerous if radio items are first in the menu.
|
\note This method is dangerous if radio items are first in the menu.
|
||||||
Use Fl_Menu_::setonly(Fl_Menu_Item*) instead.
|
Make sure that \p first is set ciorrectly or use Fl_Menu_::setonly(Fl_Menu_Item*) instead.
|
||||||
|
\param[in] first start of menu array or NULL (default) if the radio group is not the first item
|
||||||
*/
|
*/
|
||||||
void Fl_Menu_Item::setonly() {
|
void Fl_Menu_Item::setonly(Fl_Menu_Item const* first) {
|
||||||
flags |= FL_MENU_RADIO | FL_MENU_VALUE;
|
flags |= FL_MENU_RADIO | FL_MENU_VALUE;
|
||||||
Fl_Menu_Item* j;
|
Fl_Menu_Item* j;
|
||||||
for (j = this; ; ) { // go down
|
for (j = this; ; ) { // go down
|
||||||
@@ -371,9 +372,10 @@ void Fl_Menu_Item::setonly() {
|
|||||||
if (!j->text || !j->radio()) break; // stop after group
|
if (!j->text || !j->radio()) break; // stop after group
|
||||||
j->clear();
|
j->clear();
|
||||||
}
|
}
|
||||||
for (j = this-1; ; j--) { // go up
|
if (this != first) for (j = this-1; ; j--) { // go up
|
||||||
if (!j->text || (j->flags&FL_MENU_DIVIDER) || !j->radio()) break;
|
if (!j->text || (j->flags&FL_MENU_DIVIDER) || !j->radio()) break;
|
||||||
j->clear();
|
j->clear();
|
||||||
|
if (j == first) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -43,14 +43,16 @@ static char* underline_at;
|
|||||||
*/
|
*/
|
||||||
static const char* expand_text_(const char* from, char*& buf, int maxbuf, double maxw, int& n,
|
static const char* expand_text_(const char* from, char*& buf, int maxbuf, double maxw, int& n,
|
||||||
double &width, int wrap, int draw_symbols) {
|
double &width, int wrap, int draw_symbols) {
|
||||||
char* e = buf+(maxbuf-4);
|
|
||||||
underline_at = 0;
|
underline_at = 0;
|
||||||
double w = 0;
|
double w = 0;
|
||||||
static int l_local_buff = 500;
|
static int l_local_buff = 500;
|
||||||
static char *local_buf = (char*)malloc(l_local_buff); // initial buffer allocation
|
static char *local_buf = (char*)malloc(l_local_buff); // initial buffer allocation
|
||||||
|
char* e;
|
||||||
if (maxbuf == 0) {
|
if (maxbuf == 0) {
|
||||||
buf = local_buf;
|
buf = local_buf;
|
||||||
e = buf + l_local_buff - 4;
|
e = buf + l_local_buff - 4;
|
||||||
|
} else {
|
||||||
|
e = buf+(maxbuf-4);
|
||||||
}
|
}
|
||||||
char* o = buf;
|
char* o = buf;
|
||||||
char* word_end = o;
|
char* word_end = o;
|
||||||
|
|||||||
@@ -655,6 +655,43 @@ static void draw_redo(Fl_Color c) {
|
|||||||
fl_scale(-1.0, 1.0);
|
fl_scale(-1.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void draw_open_box(Fl_Color col) {
|
||||||
|
fl_color(col);
|
||||||
|
BCP;
|
||||||
|
vv(-1.0, -1.0); vv(-0.4, -1.0); vv(-0.4, -0.75); vv(-0.75, -0.75);
|
||||||
|
vv(-0.75, 0.75); vv(0.75, 0.75); vv(0.75, 0.4); vv(1.0, 0.4); vv(1.0, 1.0);
|
||||||
|
vv(-1.0, 1.0);
|
||||||
|
ECP;
|
||||||
|
set_outline_color(col);
|
||||||
|
BC;
|
||||||
|
vv(-1.0, -1.0); vv(-0.4, -1.0); vv(-0.4, -0.75); vv(-0.75, -0.75);
|
||||||
|
vv(-0.75, 0.75); vv(0.75, 0.75); vv(0.75, 0.4); vv(1.0, 0.4); vv(1.0, 1.0);
|
||||||
|
vv(-1.0, 1.0);
|
||||||
|
EC;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void draw_import(Fl_Color col)
|
||||||
|
{
|
||||||
|
fl_push_matrix();
|
||||||
|
fl_scale(-1.0, 1.0);
|
||||||
|
draw_open_box(col);
|
||||||
|
fl_scale(-1.0, 1.0);
|
||||||
|
fl_translate(-0.8, -0.3);
|
||||||
|
fl_rotate(45.0+90);
|
||||||
|
draw_round_arrow(col, 3);
|
||||||
|
fl_pop_matrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void draw_export(Fl_Color col)
|
||||||
|
{
|
||||||
|
draw_open_box(col);
|
||||||
|
fl_push_matrix();
|
||||||
|
fl_translate(0.7, 0.1);
|
||||||
|
fl_rotate(225.0);
|
||||||
|
draw_round_arrow(col, 3);
|
||||||
|
fl_pop_matrix();
|
||||||
|
}
|
||||||
|
|
||||||
static void fl_init_symbols(void) {
|
static void fl_init_symbols(void) {
|
||||||
static char beenhere;
|
static char beenhere;
|
||||||
if (beenhere) return;
|
if (beenhere) return;
|
||||||
@@ -702,5 +739,8 @@ static void fl_init_symbols(void) {
|
|||||||
fl_add_symbol("undo", draw_undo, 1);
|
fl_add_symbol("undo", draw_undo, 1);
|
||||||
fl_add_symbol("redo", draw_redo, 1);
|
fl_add_symbol("redo", draw_redo, 1);
|
||||||
|
|
||||||
|
fl_add_symbol("import", draw_import, 1);
|
||||||
|
fl_add_symbol("export", draw_export, 1);
|
||||||
|
|
||||||
// fl_add_symbol("file", draw_file, 1);
|
// fl_add_symbol("file", draw_file, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -28,7 +28,7 @@ int N = 0;
|
|||||||
#define W 70
|
#define W 70
|
||||||
#define H 70
|
#define H 70
|
||||||
#define ROWS 6
|
#define ROWS 6
|
||||||
#define COLS 6
|
#define COLS 7
|
||||||
|
|
||||||
Fl_Double_Window *window;
|
Fl_Double_Window *window;
|
||||||
Fl_Value_Slider *orientation;
|
Fl_Value_Slider *orientation;
|
||||||
@@ -119,6 +119,8 @@ bt("@refresh");
|
|||||||
bt("@reload");
|
bt("@reload");
|
||||||
bt("@undo");
|
bt("@undo");
|
||||||
bt("@redo");
|
bt("@redo");
|
||||||
|
bt("@import");
|
||||||
|
bt("@export");
|
||||||
|
|
||||||
orientation = new Fl_Value_Slider(
|
orientation = new Fl_Value_Slider(
|
||||||
(int)(window->w()*.05+.5), window->h()-40,
|
(int)(window->w()*.05+.5), window->h()-40,
|
||||||
|
|||||||
Reference in New Issue
Block a user