1 //------------------------------------------------------------------------
2 //  Information Bar (bottom of window)
3 //------------------------------------------------------------------------
4 //
5 //  Eureka DOOM Editor
6 //
7 //  Copyright (C) 2007-2019 Andrew Apted
8 //
9 //  This program is free software; you can redistribute it and/or
10 //  modify it under the terms of the GNU General Public License
11 //  as published by the Free Software Foundation; either version 2
12 //  of the License, or (at your option) any later version.
13 //
14 //  This program is distributed in the hope that it will be useful,
15 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 //  GNU General Public License for more details.
18 //
19 //------------------------------------------------------------------------
20 
21 #ifndef __EUREKA_UI_INFOBAR_H__
22 #define __EUREKA_UI_INFOBAR_H__
23 
24 
25 class UI_InfoBar : public Fl_Group
26 {
27 public:
28 	UI_InfoBar(int X, int Y, int W, int H, const char *label = NULL);
29 	virtual ~UI_InfoBar();
30 
31 private:
32 	Fl_Menu_Button *mode;
33 	Fl_Menu_Button *scale;
34 	Fl_Menu_Button *grid_size;
35 	Fl_Menu_Button *sec_rend;
36 	Fl_Menu_Button *ratio_lock;
37 
38 	Fl_Toggle_Button *grid_snap;
39 
40 public:
41 	// FLTK virtual method for handling input events.
42 	int handle(int event);
43 
44 public:
45 	void NewEditMode(obj_type_e new_mode);
46 
47 	void SetMouse(double mx, double my);
48 
49 	void SetScale(double new_scale);
50 	void SetGrid(int new_step);
51 
52 	void UpdateSnap();
53 	void UpdateSecRend();
54 	void UpdateRatio();
55 
56 private:
57 	static const char  *scale_options_str;
58 	static const double scale_amounts[9];
59 
60 	static const char *grid_options_str;
61 	static const int   grid_amounts[12];
62 
63 	void UpdateModeColor();
64 	void UpdateSnapText();
65 
66 	static void mode_callback(Fl_Widget *, void *);
67 	static void rend_callback(Fl_Widget *, void *);
68 	static void scale_callback(Fl_Widget *, void *);
69 	static void sc_minus_callback(Fl_Widget *, void *);
70 	static void sc_plus_callback(Fl_Widget *, void *);
71 	static void grid_callback(Fl_Widget *, void *);
72 	static void snap_callback(Fl_Widget *, void *);
73 	static void ratio_callback(Fl_Widget *, void *);
74 };
75 
76 
77 //------------------------------------------------------------------------
78 
79 class UI_StatusBar : public Fl_Widget
80 {
81 private:
82 	std::string status;
83 
84 public:
85 	UI_StatusBar(int X, int Y, int W, int H, const char *label = NULL);
86 	virtual ~UI_StatusBar();
87 
88 public:
89 	// FLTK methods
90 	void draw();
91 	int handle(int event);
92 
93 	// this only used by Status_Set() and Status_Clear()
94 	void SetStatus(const char *str);
95 
96 private:
97 	void IB_ShowDrag(int cx, int cy);
98 	void IB_ShowTransform(int cx, int cy);
99 	void IB_ShowOffsets(int cx, int cy);
100 	void IB_ShowDrawLine(int cx, int cy);
101 
102 	void IB_String(int& cx, int& cy, const char *str);
103 	void IB_Number(int& cx, int& cy, const char *label, int value, int size);
104 	void IB_Coord (int& cx, int& cy, const char *label, float value);
105 	void IB_Flag  (int& cx, int& cy, bool value, const char *label_on, const char *label_off);
106 };
107 
108 #endif  /* __EUREKA_UI_INFOBAR_H__ */
109 
110 //--- editor settings ---
111 // vi:ts=4:sw=4:noexpandtab
112