1 /* Copyright (c) 2006 by Arkkra Enterprises */
2 /* All rights reserved */
7 // Header file for the main Mupmate window, containing toolbar and editor.
9 #include <FL/Fl_Widget.H>
10 #include <FL/Fl_Double_Window.H>
11 #include <FL/Fl_Menu_Bar.H>
12 #include <FL/Fl_Menu_Item.H>
13 #include <FL/Fl_Text_Buffer.H>
14 #include <FL/Fl_Text_Editor.H>
24 //---------- class to show Mup license and get user's agreement
26 class License : public Fl_Double_Window {
28 License(Main * m_p, const char * magic);
32 static void IAgree_cb(Fl_Widget *, void * data);
33 static void Cancel_cb(Fl_Widget *, void * data);
34 static void Continue_cb(Fl_Widget *, void * data);
43 Fl_Text_Display * text_p; // The text of the license
44 Fl_Return_Button * i_agree_p;
47 // Name of file that tells us if user has agreed to license
48 const char * magic_file_name;
56 // Class for main window, with editor and toolbar
58 class Main : public Fl_Double_Window {
63 Main(const char * title);
67 static void modify_cb(int, int, int, int, const char *, void * data);
68 static void font_change_cb(void * data, Fl_Font font, unsigned char size);
69 static void atclose_cb(Fl_Widget *, void * data);
71 // We don't want Escape to cause main window to close,
72 // and need to handle Paste ungraying specially.
73 // This event handler takes care of those things.
74 static int handle_events(int);
76 // Show user hints the first time they bring up Mupmate
79 // Reset state information when user opens a new file.
80 void begin_new_file();
82 // Pointers to the classes for each toolbar menu item widgets
85 Config * configmenu_p;
89 // Clean up all windows
90 static void clean_exit(int exitval = 0);
93 // called when input text is modified
96 // Sets font/size of editor
97 void font_change(Fl_Font font, unsigned char size);
99 // Make window manager close like Exit
103 static void blinker(void *);
105 // Ponters to the top level widgets
106 Fl_Menu_Bar * toolbar_p;
107 Fl_Text_Editor * editor_p;
109 // For font/size change notification
110 Font_change_registration * font_change_reg_p;
112 // True if there is a selected area in editor window
115 // True if something in clipboard
118 // For knowing when to gray out Undo menu item
120 bool undo_active_on_next_change;
123 // Current cursor on/off state, for blinker
126 // We currently only have one main window, but code is
127 // general to allow multiple windows. We keep a linked list
128 // of all the windows.
129 static Main * list_p;