1// This file is part of SmallBASIC
2//
3// Copyright(C) 2001-2019 Chris Warren-Smith.
4//
5// This program is distributed under the terms of the GPL v2.0 or later
6// Download the GNU Public License (GPL) from www.gnu.org
7//
8
9#ifndef FLTK_UTILS_H
10#define FLTK_UTILS_H
11
12#include <stdint.h>
13#include "common/pproc.h"
14#include "common/fs_socket_client.h"
15#include <FL/Fl.H>
16
17#define DAMAGE_HIGHLIGHT FL_DAMAGE_USER1
18#define DAMAGE_PUSHED FL_DAMAGE_USER2
19#define SCROLL_W 15
20#define SCROLL_H 15
21#define SCROLL_X SCROLL_W - 2
22#define HSCROLL_W 80
23#define DEF_FONT_SIZE 12
24#define TAB_BORDER 4
25#define TTY_ROWS 1000
26#define MENU_HEIGHT 24
27#define NUM_RECENT_ITEMS 9
28#define STATUS_HEIGHT (MENU_HEIGHT + 2)
29#define LINE_NUMBER_WIDTH 40
30
31// currently missing from Enumerations.H
32#define FL_Multiply 0xffaa
33#define FL_AddKey 0xffab
34#define FL_SubtractKey 0xffad
35#define FL_DivideKey 0xffaf
36
37#define C_LINKAGE_BEGIN extern "C" {
38#define C_LINKAGE_END }
39
40#ifndef MAX
41#define MAX(a,b) ((a<b) ? (b) : (a))
42#endif
43#ifndef MIN
44#define MIN(a,b) ((a>b) ? (b) : (a))
45#endif
46
47#if defined(__MINGW32__)
48#define makedir(f) mkdir(f)
49#else
50#define makedir(f) mkdir(f, 0700)
51#endif
52
53Fl_Color get_color(const char *name, Fl_Color def);
54Fl_Color get_color(int argb);
55Fl_Font get_font(const char *name);
56void getHomeDir(char *fileName, size_t size, bool appendSlash = true);
57bool cacheLink(dev_file_t *df, char *localFile, size_t size);
58void vsncat(char *buffer, size_t size, ...);
59void launchExec(const char *file);
60void setAppName(const char *path);
61
62#endif
63