2021-12-08 17:52:15 +03:00
|
|
|
//
|
|
|
|
// FLUID main entry for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2024-03-03 00:58:52 +03:00
|
|
|
// Copyright 1998-2024 by Bill Spitzak and others.
|
2021-12-08 17:52:15 +03:00
|
|
|
//
|
|
|
|
// 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_FLUID_H
|
|
|
|
#define _FLUID_FLUID_H
|
|
|
|
|
2023-10-22 20:30:37 +03:00
|
|
|
#include "fluid_filename.h"
|
2021-12-08 17:52:15 +03:00
|
|
|
#include <FL/Fl_Preferences.H>
|
|
|
|
#include <FL/Fl_Menu_Item.H>
|
2023-10-22 20:30:37 +03:00
|
|
|
#include "../src/Fl_String.H"
|
2021-12-08 17:52:15 +03:00
|
|
|
|
|
|
|
#define BROWSERWIDTH 300
|
|
|
|
#define BROWSERHEIGHT 500
|
|
|
|
#define WINWIDTH 300
|
|
|
|
#define MENUHEIGHT 25
|
|
|
|
#define WINHEIGHT (BROWSERHEIGHT+MENUHEIGHT)
|
|
|
|
|
2023-09-26 17:01:03 +03:00
|
|
|
// ---- types
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
class Fl_Double_Window;
|
|
|
|
class Fl_Window;
|
|
|
|
class Fl_Menu_Bar;
|
|
|
|
class Fl_Type;
|
|
|
|
class Fl_Choice;
|
|
|
|
class Fl_Button;
|
2023-07-12 00:13:46 +03:00
|
|
|
class Fl_Check_Button;
|
2021-12-08 17:52:15 +03:00
|
|
|
|
2023-09-26 17:01:03 +03:00
|
|
|
/**
|
|
|
|
Indicate the storage location for tools like layout suites and shell macros.
|
|
|
|
\see class Fd_Shell_Command, class Fd_Layout_Suite
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
FD_STORE_INTERNAL, ///< stored inside FLUID app
|
|
|
|
FD_STORE_USER, ///< suite is stored in the user wide FLUID settings
|
|
|
|
FD_STORE_PROJECT, ///< suite is stored within the current .fl project file
|
|
|
|
FD_STORE_FILE ///< store suite in external file
|
|
|
|
} Fd_Tool_Store;
|
|
|
|
|
|
|
|
// ---- global variables
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
extern Fl_Preferences fluid_prefs;
|
|
|
|
extern Fl_Menu_Item Main_Menu[];
|
|
|
|
extern Fl_Menu_Bar *main_menubar;
|
|
|
|
extern Fl_Window *main_window;
|
|
|
|
|
|
|
|
extern int show_guides;
|
2023-07-12 00:13:46 +03:00
|
|
|
extern int show_restricted;
|
2023-11-01 19:22:31 +03:00
|
|
|
extern int show_ghosted_outline;
|
2021-12-08 17:52:15 +03:00
|
|
|
extern int show_comments;
|
|
|
|
|
|
|
|
extern int G_use_external_editor;
|
|
|
|
extern int G_debug;
|
|
|
|
extern char G_external_editor_command[512];
|
|
|
|
|
|
|
|
extern int reading_file;
|
|
|
|
|
|
|
|
// File history info...
|
|
|
|
extern char absolute_history[10][FL_PATH_MAX];
|
|
|
|
extern char relative_history[10][FL_PATH_MAX];
|
|
|
|
extern void load_history();
|
|
|
|
extern void update_history(const char *);
|
|
|
|
|
|
|
|
extern Fl_Menu_Item *save_item;
|
|
|
|
extern Fl_Menu_Item *history_item;
|
|
|
|
extern Fl_Menu_Item *widgetbin_item;
|
2024-04-17 18:51:32 +03:00
|
|
|
extern Fl_Menu_Item *codeview_item;
|
2021-12-08 22:52:33 +03:00
|
|
|
extern Fl_Menu_Item *overlay_item;
|
2023-03-18 19:33:27 +03:00
|
|
|
extern Fl_Button *overlay_button;
|
|
|
|
extern Fl_Menu_Item *guides_item;
|
2023-07-12 00:13:46 +03:00
|
|
|
extern Fl_Menu_Item *restricted_item;
|
|
|
|
extern Fl_Check_Button *guides_button;
|
2021-12-08 17:52:15 +03:00
|
|
|
|
|
|
|
extern int modflag;
|
|
|
|
|
|
|
|
extern int update_file; // fluid -u
|
|
|
|
extern int compile_file; // fluid -c
|
|
|
|
extern int compile_strings; // fluic -cs
|
|
|
|
extern int batch_mode;
|
|
|
|
|
|
|
|
extern int pasteoffset;
|
|
|
|
|
2023-09-26 17:01:03 +03:00
|
|
|
extern Fl_String g_code_filename_arg;
|
|
|
|
extern Fl_String g_header_filename_arg;
|
|
|
|
extern Fl_String g_launch_path;
|
|
|
|
|
2024-04-17 18:51:32 +03:00
|
|
|
extern Fl_String g_autodoc_path;
|
|
|
|
|
2023-09-26 17:01:03 +03:00
|
|
|
// ---- project class declaration
|
2022-11-26 03:35:50 +03:00
|
|
|
|
2024-03-03 00:58:52 +03:00
|
|
|
/**
|
|
|
|
Enumeration of available internationalization types.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
FD_I18N_NONE = 0, ///< No i18n, all strings are litearals
|
|
|
|
FD_I18N_GNU, ///< GNU gettext internationalization
|
|
|
|
FD_I18N_POSIX ///< Posix catgets internationalization
|
|
|
|
} Fd_I18n_Type;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Data and settings for a FLUID project file.
|
|
|
|
*/
|
2023-01-01 22:05:42 +03:00
|
|
|
class Fluid_Project {
|
2022-11-26 03:35:50 +03:00
|
|
|
public:
|
2023-01-01 22:05:42 +03:00
|
|
|
Fluid_Project();
|
|
|
|
~Fluid_Project();
|
2022-11-26 03:35:50 +03:00
|
|
|
void reset();
|
2023-03-19 22:04:01 +03:00
|
|
|
void update_settings_dialog();
|
2022-11-26 03:35:50 +03:00
|
|
|
|
2023-09-05 16:11:09 +03:00
|
|
|
Fl_String projectfile_path() const;
|
|
|
|
Fl_String projectfile_name() const;
|
|
|
|
Fl_String codefile_path() const;
|
|
|
|
Fl_String codefile_name() const;
|
|
|
|
Fl_String headerfile_path() const;
|
|
|
|
Fl_String headerfile_name() const;
|
|
|
|
Fl_String stringsfile_path() const;
|
|
|
|
Fl_String stringsfile_name() const;
|
|
|
|
Fl_String basename() const;
|
|
|
|
|
2024-03-03 00:58:52 +03:00
|
|
|
/// One of the available internationalization types.
|
|
|
|
Fd_I18n_Type i18n_type;
|
|
|
|
/// Include file for GNU i18n, writes an #include statement into the source
|
|
|
|
/// file. This is usually `<libintl.h>` or `"gettext.h"` for GNU gettext.
|
2023-07-15 00:42:09 +03:00
|
|
|
Fl_String i18n_gnu_include;
|
2024-03-03 00:58:52 +03:00
|
|
|
// Optional name of a macro for conditional i18n compilation.
|
2023-07-15 00:42:09 +03:00
|
|
|
Fl_String i18n_gnu_conditional;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// For the gettext/intl.h options, this is the function that translates text
|
|
|
|
/// at runtime. This is usually "gettext" or "_".
|
2023-07-15 00:42:09 +03:00
|
|
|
Fl_String i18n_gnu_function;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// For the gettext/intl.h options, this is the function that marks the translation
|
|
|
|
/// of text at initialisation time. This is usually "gettext_noop" or "N_".
|
2023-07-15 00:42:09 +03:00
|
|
|
Fl_String i18n_gnu_static_function;
|
|
|
|
|
2024-03-03 00:58:52 +03:00
|
|
|
/// Include file for Posix i18n, write a #include statement into the source
|
|
|
|
/// file. This is usually `<nl_types.h>` for Posix catgets.
|
2023-07-15 00:42:09 +03:00
|
|
|
Fl_String i18n_pos_include;
|
2024-03-03 00:58:52 +03:00
|
|
|
// Optional name of a macro for conditional i18n compilation.
|
2023-07-15 00:42:09 +03:00
|
|
|
Fl_String i18n_pos_conditional;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// Name of the nl_catd database
|
2023-07-15 00:42:09 +03:00
|
|
|
Fl_String i18n_pos_file;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// Message set ID for the catalog.
|
2023-07-15 00:42:09 +03:00
|
|
|
Fl_String i18n_pos_set;
|
|
|
|
|
2024-03-03 00:58:52 +03:00
|
|
|
/// If set, generate code to include the header file form the c++ file
|
2022-11-26 03:35:50 +03:00
|
|
|
int include_H_from_C;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// If set, handle keyboard shortcut Ctrl on macOS using Cmd instead
|
2022-11-26 03:35:50 +03:00
|
|
|
int use_FL_COMMAND;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// Clear if UTF-8 characters in statics texts are written as escape sequences
|
2022-11-26 03:35:50 +03:00
|
|
|
int utf8_in_src;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// If set, <FL/Fl.H> will not be included from the header code before anything else
|
2022-11-26 03:35:50 +03:00
|
|
|
int avoid_early_includes;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// If set, command line overrides header file name in .fl file.
|
2022-11-26 21:09:12 +03:00
|
|
|
int header_file_set;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// If set, command line overrides source code file name in .fl file.
|
2022-11-26 21:09:12 +03:00
|
|
|
int code_file_set;
|
2023-10-26 01:38:58 +03:00
|
|
|
int write_mergeback_data;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// Hold the default extension for header files, or the entire filename if set via command line.
|
2023-02-23 17:42:05 +03:00
|
|
|
Fl_String header_file_name;
|
2024-03-03 00:58:52 +03:00
|
|
|
/// Hold the default extension for source code files, or the entire filename if set via command line.
|
2023-02-23 17:42:05 +03:00
|
|
|
Fl_String code_file_name;
|
2022-11-26 03:35:50 +03:00
|
|
|
};
|
|
|
|
|
2023-01-01 22:05:42 +03:00
|
|
|
extern Fluid_Project g_project;
|
2022-11-26 03:35:50 +03:00
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
// ---- public functions
|
|
|
|
|
2024-04-17 18:51:32 +03:00
|
|
|
extern bool new_project(bool user_must_confirm = true);
|
2023-09-26 17:01:03 +03:00
|
|
|
extern void enter_project_dir();
|
|
|
|
extern void leave_project_dir();
|
2021-12-08 17:52:15 +03:00
|
|
|
extern void set_filename(const char *c);
|
2021-12-10 03:22:15 +03:00
|
|
|
extern void set_modflag(int mf, int mfc=-1);
|
2021-12-08 17:52:15 +03:00
|
|
|
|
2023-09-26 17:01:03 +03:00
|
|
|
extern const Fl_String &get_tmpdir();
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
// ---- public callback functions
|
|
|
|
|
|
|
|
extern void save_cb(Fl_Widget *, void *v);
|
|
|
|
extern void save_template_cb(Fl_Widget *, void *);
|
|
|
|
extern void revert_cb(Fl_Widget *,void *);
|
|
|
|
extern void exit_cb(Fl_Widget *,void *);
|
|
|
|
|
2023-10-23 12:46:41 +03:00
|
|
|
extern int write_code_files(bool dont_show_completion_dialog=false);
|
2021-12-08 17:52:15 +03:00
|
|
|
extern void write_strings_cb(Fl_Widget *, void *);
|
|
|
|
extern void align_widget_cb(Fl_Widget *, long);
|
|
|
|
extern void toggle_widgetbin_cb(Fl_Widget *, void *);
|
|
|
|
|
2023-08-29 03:20:45 +03:00
|
|
|
extern char position_window(Fl_Window *w, const char *prefsName, int Visible, int X, int Y, int W=0, int H=0);
|
|
|
|
|
2023-03-18 19:33:27 +03:00
|
|
|
inline int fd_min(int a, int b) { return (a < b ? a : b); }
|
2023-07-12 00:13:46 +03:00
|
|
|
inline int fd_max(int a, int b) { return (a > b ? a : b); }
|
2023-03-18 19:33:27 +03:00
|
|
|
inline int fd_min(int a, int b, int c) { return fd_min(a, fd_min(b, c)); }
|
|
|
|
|
2021-12-08 17:52:15 +03:00
|
|
|
#endif // _FLUID_FLUID_H
|