Add "Edit/Delete".

Clean up menus.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4141 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2005-03-20 01:49:46 +00:00
parent 921dabf5b8
commit 665a2c1b7d
2 changed files with 30 additions and 17 deletions

View File

@ -927,7 +927,7 @@ extern Fl_Menu_Item Main_Menu[];
// Calculate new bounding box of selected widgets: // Calculate new bounding box of selected widgets:
void Fl_Window_Type::fix_overlay() { void Fl_Window_Type::fix_overlay() {
Main_Menu[36].label("Hide O&verlays"); Main_Menu[37].label("Hide O&verlays");
overlays_invisible = 0; overlays_invisible = 0;
recalc = 1; recalc = 1;
((Overlay_Window *)(this->o))->redraw_overlay(); ((Overlay_Window *)(this->o))->redraw_overlay();
@ -942,8 +942,8 @@ void redraw_overlays() {
void toggle_overlays(Fl_Widget *,void *) { void toggle_overlays(Fl_Widget *,void *) {
overlays_invisible = !overlays_invisible; overlays_invisible = !overlays_invisible;
if (overlays_invisible) Main_Menu[36].label("Show O&verlays"); if (overlays_invisible) Main_Menu[37].label("Show O&verlays");
else Main_Menu[36].label("Hide O&verlays"); else Main_Menu[37].label("Hide O&verlays");
for (Fl_Type *o=Fl_Type::first; o; o=o->next) for (Fl_Type *o=Fl_Type::first; o; o=o->next)
if (o->is_window()) { if (o->is_window()) {

View File

@ -468,6 +468,18 @@ void cut_cb(Fl_Widget *, void *) {
if (p) select_only(p); if (p) select_only(p);
} }
void delete_cb(Fl_Widget *, void *) {
if (!Fl_Type::current) {
fl_beep();
return;
}
ipasteoffset = 0;
Fl_Type *p = Fl_Type::current->parent;
while (p && p->selected) p = p->parent;
delete_all(1);
if (p) select_only(p);
}
extern int force_parent; extern int force_parent;
void paste_cb(Fl_Widget*, void*) { void paste_cb(Fl_Widget*, void*) {
@ -584,7 +596,7 @@ Fl_Menu_Item Main_Menu[] = {
{0}, {0},
{"&Insert...", FL_CTRL+'i', open_cb, (void*)1, FL_MENU_DIVIDER}, {"&Insert...", FL_CTRL+'i', open_cb, (void*)1, FL_MENU_DIVIDER},
{"&Save", FL_CTRL+'s', save_cb, 0}, {"&Save", FL_CTRL+'s', save_cb, 0},
{"Save &As...", FL_CTRL+FL_SHIFT+'s', save_cb, (void*)1, FL_MENU_DIVIDER}, {"Save &As...", FL_CTRL+FL_SHIFT+'s', save_cb, (void*)1},
{"Write &Code...", FL_CTRL+FL_SHIFT+'c', write_cb, 0}, {"Write &Code...", FL_CTRL+FL_SHIFT+'c', write_cb, 0},
{"&Write Strings...", FL_CTRL+FL_SHIFT+'w', write_strings_cb, 0, FL_MENU_DIVIDER}, {"&Write Strings...", FL_CTRL+FL_SHIFT+'w', write_strings_cb, 0, FL_MENU_DIVIDER},
{"&Quit", FL_CTRL+'q', exit_cb}, {"&Quit", FL_CTRL+'q', exit_cb},
@ -593,11 +605,12 @@ Fl_Menu_Item Main_Menu[] = {
{"&Undo", FL_CTRL+'z', nyi}, {"&Undo", FL_CTRL+'z', nyi},
{"C&ut", FL_CTRL+'x', cut_cb}, {"C&ut", FL_CTRL+'x', cut_cb},
{"&Copy", FL_CTRL+'c', copy_cb}, {"&Copy", FL_CTRL+'c', copy_cb},
{"&Duplicate", FL_CTRL+'d', duplicate_cb}, {"&Delete", FL_Delete, delete_cb},
{"&Paste", FL_CTRL+'v', paste_cb, 0, FL_MENU_DIVIDER}, {"Dup&licate", FL_CTRL+'d', duplicate_cb},
{"&Paste", FL_CTRL+'v', paste_cb},
{"Select &All", FL_CTRL+'a', select_all_cb}, {"Select &All", FL_CTRL+'a', select_all_cb},
{"Select &None", FL_CTRL+FL_SHIFT+'a', select_none_cb, 0, FL_MENU_DIVIDER}, {"Select &None", FL_CTRL+FL_SHIFT+'a', select_none_cb, 0, FL_MENU_DIVIDER},
{"&Open...", FL_F+1, openwidget_cb}, {"&Show Widget Panel...", FL_F+1, openwidget_cb},
{"&Sort",0,sort_cb}, {"&Sort",0,sort_cb},
{"&Earlier", FL_F+2, earlier_cb}, {"&Earlier", FL_F+2, earlier_cb},
{"&Later", FL_F+3, later_cb}, {"&Later", FL_F+3, later_cb},
@ -608,9 +621,9 @@ Fl_Menu_Item Main_Menu[] = {
//{"Deactivate", 0, nyi}, //{"Deactivate", 0, nyi},
//{"Activate", 0, nyi, 0, FL_MENU_DIVIDER}, //{"Activate", 0, nyi, 0, FL_MENU_DIVIDER},
{"Hide O&verlays",FL_CTRL+FL_SHIFT+'o',toggle_overlays}, {"Hide O&verlays",FL_CTRL+FL_SHIFT+'o',toggle_overlays},
{"Show Widget &Bin",FL_ALT+'b',toggle_widgetbin_cb, 0, FL_MENU_DIVIDER}, {"Show Widget &Bin...",FL_ALT+'b',toggle_widgetbin_cb, 0, FL_MENU_DIVIDER},
{"Pro&ject Settings...",FL_CTRL+'p',show_project_cb}, {"Pro&ject Settings...",FL_ALT+'p',show_project_cb},
{"&GUI Settings...",FL_CTRL+FL_SHIFT+'p',show_settings_cb}, {"GU&I Settings...",FL_ALT+FL_SHIFT+'p',show_settings_cb},
{0}, {0},
{"&New", 0, 0, (void *)New_Menu, FL_SUBMENU_POINTER}, {"&New", 0, 0, (void *)New_Menu, FL_SUBMENU_POINTER},
{"&Layout",0,0,0,FL_SUBMENU}, {"&Layout",0,0,0,FL_SUBMENU},
@ -635,12 +648,12 @@ Fl_Menu_Item Main_Menu[] = {
{"&Horizontal",0,(Fl_Callback *)align_widget_cb,(void*)40}, {"&Horizontal",0,(Fl_Callback *)align_widget_cb,(void*)40},
{"&Vertical",0,(Fl_Callback *)align_widget_cb,(void*)41}, {"&Vertical",0,(Fl_Callback *)align_widget_cb,(void*)41},
{0}, {0},
{"&Widget Size",0,0,0,FL_SUBMENU|FL_MENU_DIVIDER}, {"&Set Widget Size",0,0,0,FL_SUBMENU|FL_MENU_DIVIDER},
{"&Tiny",0,(Fl_Callback *)widget_size_cb,(void*)8,FL_MENU_RADIO,FL_NORMAL_LABEL,FL_HELVETICA,8}, {"&Tiny",FL_ALT+'1',(Fl_Callback *)widget_size_cb,(void*)8,FL_MENU_RADIO,FL_NORMAL_LABEL,FL_HELVETICA,8},
{"&Small",0,(Fl_Callback *)widget_size_cb,(void*)11,FL_MENU_RADIO,FL_NORMAL_LABEL,FL_HELVETICA,11}, {"&Small",FL_ALT+'2',(Fl_Callback *)widget_size_cb,(void*)11,FL_MENU_RADIO,FL_NORMAL_LABEL,FL_HELVETICA,11},
{"&Normal",0,(Fl_Callback *)widget_size_cb,(void*)14,FL_MENU_RADIO|FL_MENU_VALUE}, {"&Normal",FL_ALT+'3',(Fl_Callback *)widget_size_cb,(void*)14,FL_MENU_RADIO|FL_MENU_VALUE},
{0}, {0},
{"&Grid...",FL_CTRL+'g',show_grid_cb}, {"&Grid...",FL_ALT+'g',show_grid_cb},
{0}, {0},
{"&Shell",0,0,0,FL_SUBMENU}, {"&Shell",0,0,0,FL_SUBMENU},
{"Execute &Command...",FL_ALT+'x',(Fl_Callback *)show_shell_window}, {"Execute &Command...",FL_ALT+'x',(Fl_Callback *)show_shell_window},
@ -686,10 +699,10 @@ void toggle_widgetbin_cb(Fl_Widget *, void *) {
if (widgetbin_panel->visible()) { if (widgetbin_panel->visible()) {
widgetbin_panel->hide(); widgetbin_panel->hide();
Main_Menu[37].label("Show Widget &Bin"); Main_Menu[38].label("Show Widget &Bin...");
} else { } else {
widgetbin_panel->show(); widgetbin_panel->show();
Main_Menu[37].label("Hide Widget &Bin"); Main_Menu[38].label("Hide Widget &Bin");
} }
} }