Update sources for version 1.1

This commit is contained in:
No Time To Play 2024-02-05 08:56:34 +00:00
parent e1029071e4
commit 0efe3cc72a
2 changed files with 24 additions and 5 deletions

View File

@ -38,8 +38,10 @@ struct MainWindow {
Fl_Button *cmd_next;
Fl_Text_Editor *editor;
Fl_Output *status1;
Fl_Output *status2;
Fl_Output *status3;
MainWindow() {
window = new Fl_Window(WIN_W, WIN_H, window_title);
@ -72,9 +74,12 @@ struct MainWindow {
status1 = new Fl_Output(
4, WIN_H-ROW_H+4, WIN_W/2-8, BOX_H, "");
status1->value(empty_status);
status2 = new Fl_Output(
WIN_W/2+4, WIN_H-ROW_H+4, WIN_W/2-8, BOX_H, "");
WIN_W/2+4, WIN_H-ROW_H+4, WIN_W/4-8, BOX_H, "");
status3 = new Fl_Output(
WIN_W*3/4+4, WIN_H-ROW_H+4, WIN_W/4-8, BOX_H, "");
status1->value(empty_status);
window->resizable(editor);
window->end();
@ -90,7 +95,7 @@ struct MainWindow {
inline void show_about(Fl_Widget *w, void *data) {
fl_message_title("About ToyEd Native");
fl_message("A toy text editor\nv1.0.1 (23 Jan 2024)\nBoost License");
fl_message("A toy text editor\nv1.1 (5 Feb 2024)\nBoost License");
}
inline void show_credits(Fl_Widget *w, void *data) {
@ -102,4 +107,9 @@ inline void show_website(Fl_Widget *w, void *data) {
fl_open_uri("https://ctrl-c.club/~nttp/toys/toyed/native.html");
}
inline void scheme_base(Fl_Widget *w, void *data) { Fl::scheme("base"); }
inline void scheme_gtk(Fl_Widget *w, void *data) { Fl::scheme("gtk+"); }
inline void scheme_plastic(Fl_Widget *w, void *data) { Fl::scheme("plastic"); }
inline void scheme_gleam(Fl_Widget *w, void *data) { Fl::scheme("gleam"); }
#endif

View File

@ -27,7 +27,7 @@ std::string search_term;
void on_mod(int pos, int nIns, int nDel, int nSt, const char* del, void* d) {
if (nIns > 0 || nDel > 0) {
modified = true;
top.status1->value("(modified)");
top.status3->value("(modified)");
}
}
@ -41,7 +41,7 @@ void do_new(Fl_Widget *w, void *data) {
file_name = "";
buffer.remove(0, buffer.length());
top.status1->value(empty_status);
top.status2->value("");
top.status3->value("");
modified = false;
}
@ -54,6 +54,7 @@ void load_file(const char *name, bool change=true) {
top.status2->value(fl_filename_name(name));
}
top.status1->value("Opened");
top.status3->value("");
modified = false;
break;
case 1: fl_alert("Error opening file."); break;
@ -94,6 +95,7 @@ void save_file(const char *name, bool change=true) {
top.status2->value(fl_filename_name(name));
}
top.status1->value("Saved");
top.status3->value("");
modified = false;
break;
case 1: fl_alert("Error opening file."); break;
@ -397,6 +399,13 @@ const Fl_Menu_Item menu_items[] = {
{ " &Full screen", FL_F + 11, toggle_full_screen, 0,
FL_MENU_TOGGLE },
{ 0 },
{ "&Scheme", 0, 0, 0, FL_SUBMENU },
{ " &Base", 0, scheme_base, 0, FL_MENU_RADIO },
{ " &Gtk+", 0, scheme_gtk, 0, FL_MENU_RADIO },
{ " &Plastic", 0, scheme_plastic, 0, FL_MENU_RADIO },
{ " Glea&m", 0, scheme_gleam, 0,
FL_MENU_RADIO | FL_MENU_VALUE },
{ 0 },
{ "&Help", 0, 0, 0, FL_SUBMENU },
{ " &About", FL_F + 1, show_about },
{ " &Credits ", 0, show_credits },