diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 398abc5cd4c9b2a8b79b92067aa140b9ef6312f7..fe91805e8b6ae5762aba2b956287ce1d55741f1f 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.305 2004-12-22 16:43:59 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.306 2004-12-23 03:19:58 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -771,6 +771,28 @@ test: patindex = file_chooser_get_filter(); } +void file_rename_cb(CALLBACK_ARGS) +{ +test: + if(file_chooser(0, 1, "Rename current project file", "*", 0, CTX.filename)) { + char *name = file_chooser_get_name(1); + if(CTX.confirm_overwrite) { + struct stat buf; + if(!stat(name, &buf)) + if(fl_ask("%s already exists.\nDo you want to replace it?", name)) + goto save; + else + goto test; + } + save: + if(rename(CTX.filename, name) == -1) + Msg(GERROR, "Unable to rename file '%s'", CTX.filename); + else + OpenProblem(name); + Draw(); + } +} + void file_quit_cb(CALLBACK_ARGS) { Exit(0); @@ -1485,6 +1507,7 @@ void help_short_cb(CALLBACK_ARGS) Msg(DIRECT, " Shift+p show general post-processing options"); Msg(DIRECT, " Alt+Shift+p hide/show mesh points"); Msg(DIRECT, " "XX"+q quit"); + Msg(DIRECT, " "XX"+r rename current project file"); Msg(DIRECT, " Alt+s hide/show geometry surfaces"); Msg(DIRECT, " Alt+Shift+s hide/show mesh surfaces"); Msg(DIRECT, " "XX"+s save mesh in default format"); diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h index 8a8d63c6d219b15835a896ca50e4bd0f75798ec5..8aa71bb1078c6bc5a0152d11ba47c184713a5a6b 100644 --- a/Fltk/Callbacks.h +++ b/Fltk/Callbacks.h @@ -46,6 +46,7 @@ void status_cancel_cb(CALLBACK_ARGS) ; void file_new_cb(CALLBACK_ARGS) ; void file_open_cb(CALLBACK_ARGS) ; void file_merge_cb(CALLBACK_ARGS) ; +void file_rename_cb(CALLBACK_ARGS) ; void file_save_as_cb(CALLBACK_ARGS) ; void file_save_as_auto_cb(CALLBACK_ARGS) ; void file_save_as_geo_cb(CALLBACK_ARGS) ; diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 69d50865f116e40e99907e5f09822fffb51e0154..c261ae68f649af7d7a80f655c86bb082e5c7341a 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.387 2004-12-07 04:52:25 geuzaine Exp $ +// $Id: GUI.cpp,v 1.388 2004-12-23 03:19:58 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -81,6 +81,7 @@ Fl_Menu_Item m_menubar_table[] = { {"&New...", FL_CTRL+'n', (Fl_Callback *)file_new_cb, 0}, {"&Open...", FL_CTRL+'o', (Fl_Callback *)file_open_cb, 0}, {"M&erge...", FL_CTRL+'m', (Fl_Callback *)file_merge_cb, 0, FL_MENU_DIVIDER}, + {"&Rename...", FL_CTRL+'r', (Fl_Callback *)file_rename_cb, 0, FL_MENU_DIVIDER}, {"Sa&ve mesh", FL_CTRL+'s', (Fl_Callback *)mesh_save_cb, 0}, {"Save &as...", FL_CTRL+FL_SHIFT+'s', (Fl_Callback *)file_save_as_cb, 0, FL_MENU_DIVIDER}, {"&Quit", FL_CTRL+'q', (Fl_Callback *)file_quit_cb, 0}, @@ -114,6 +115,7 @@ Fl_Menu_Item m_sys_menubar_table[] = { {"New...", FL_CTRL+'n', (Fl_Callback *)file_new_cb, 0}, {"Open...", FL_CTRL+'o', (Fl_Callback *)file_open_cb, 0}, {"Merge...", FL_CTRL+'m', (Fl_Callback *)file_merge_cb, 0, FL_MENU_DIVIDER}, + {"Rename...", FL_CTRL+'r', (Fl_Callback *)file_rename_cb, 0, FL_MENU_DIVIDER}, {"Save Mesh", FL_CTRL+'s', (Fl_Callback *)mesh_save_cb, 0}, {"Save As...", FL_CTRL+FL_SHIFT+'s', (Fl_Callback *)file_save_as_cb, 0}, {0}, diff --git a/doc/VERSIONS b/doc/VERSIONS index 247507fed0db3f315b0a30b7cb8dd78b8fde7050..b457ec1a3a1569a37a88d8ae46953d3621e04102 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,4 +1,6 @@ -$Id: VERSIONS,v 1.277 2004-12-22 23:10:19 geuzaine Exp $ +$Id: VERSIONS,v 1.278 2004-12-23 03:19:58 geuzaine Exp $ + +New since 1.57: new File->Rename menu; New in 1.57: generalized displacement maps to display arbitrary view types; the arrows representing a vector field can now also be colored diff --git a/doc/texinfo/shortcuts.texi b/doc/texinfo/shortcuts.texi index d458347a79c04ae1d0ac0f23f52c8363084bf349..515f5867e79b5f3027aa5466619393038045e5c1 100644 --- a/doc/texinfo/shortcuts.texi +++ b/doc/texinfo/shortcuts.texi @@ -125,6 +125,9 @@ hide/show mesh points @item Ctrl+q quit +@item Ctrl+r +rename current project file + @item Alt+s hide/show geometry surfaces