Skip to content
Snippets Groups Projects
Commit 2ceb480b authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

pretty print messages and comments
parent 29891f06
No related branches found
No related tags found
No related merge requests found
// $Id: Callbacks.cpp,v 1.320 2004-12-31 07:55:17 geuzaine Exp $ // $Id: Callbacks.cpp,v 1.321 2004-12-31 16:19:20 geuzaine Exp $
// //
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
// //
...@@ -269,7 +269,7 @@ void file_new_cb(CALLBACK_ARGS) ...@@ -269,7 +269,7 @@ void file_new_cb(CALLBACK_ARGS)
char *name = file_chooser_get_name(1); char *name = file_chooser_get_name(1);
struct stat buf; struct stat buf;
if(!stat(name, &buf)){ if(!stat(name, &buf)){
if(fl_ask("%s already exists.\nDo you want to erase it?", name)) if(fl_ask("%s already exists.\n\nDo you want to erase it?", name))
unlink(name); unlink(name);
else else
goto test; goto test;
...@@ -494,7 +494,7 @@ void file_save_as_cb(CALLBACK_ARGS) ...@@ -494,7 +494,7 @@ void file_save_as_cb(CALLBACK_ARGS)
if(CTX.confirm_overwrite) { if(CTX.confirm_overwrite) {
struct stat buf; struct stat buf;
if(!stat(name, &buf)) if(!stat(name, &buf))
if(!fl_ask("%s already exists.\nDo you want to replace it?", name)) if(!fl_ask("%s already exists.\n\nDo you want to replace it?", name))
goto test; goto test;
} }
i = file_chooser_get_filter(); i = file_chooser_get_filter();
...@@ -517,7 +517,7 @@ void file_rename_cb(CALLBACK_ARGS) ...@@ -517,7 +517,7 @@ void file_rename_cb(CALLBACK_ARGS)
if(CTX.confirm_overwrite) { if(CTX.confirm_overwrite) {
struct stat buf; struct stat buf;
if(!stat(name, &buf)) if(!stat(name, &buf))
if(!fl_ask("%s already exists.\nDo you want to replace it?", name)) if(!fl_ask("%s already exists.\n\nDo you want to replace it?", name))
goto test; goto test;
} }
rename(CTX.filename, name); rename(CTX.filename, name);
...@@ -940,7 +940,7 @@ void message_save_cb(CALLBACK_ARGS) ...@@ -940,7 +940,7 @@ void message_save_cb(CALLBACK_ARGS)
if(CTX.confirm_overwrite) { if(CTX.confirm_overwrite) {
struct stat buf; struct stat buf;
if(!stat(name, &buf)) if(!stat(name, &buf))
if(!fl_ask("%s already exists.\nDo you want to replace it?", name)) if(!fl_ask("%s already exists.\n\nDo you want to replace it?", name))
goto test; goto test;
} }
WID->save_message(name); WID->save_message(name);
...@@ -2913,7 +2913,7 @@ void view_save_ascii_cb(CALLBACK_ARGS) ...@@ -2913,7 +2913,7 @@ void view_save_ascii_cb(CALLBACK_ARGS)
if(CTX.confirm_overwrite) { if(CTX.confirm_overwrite) {
struct stat buf; struct stat buf;
if(!stat(name, &buf)) if(!stat(name, &buf))
if(!fl_ask("%s already exists.\nDo you want to replace it?", name)) if(!fl_ask("%s already exists.\n\nDo you want to replace it?", name))
goto test; goto test;
} }
WriteView(v, name, 0, 0); WriteView(v, name, 0, 0);
...@@ -2930,7 +2930,7 @@ void view_save_binary_cb(CALLBACK_ARGS) ...@@ -2930,7 +2930,7 @@ void view_save_binary_cb(CALLBACK_ARGS)
if(CTX.confirm_overwrite) { if(CTX.confirm_overwrite) {
struct stat buf; struct stat buf;
if(!stat(name, &buf)) if(!stat(name, &buf))
if(!fl_ask("%s already exists.\nDo you want to replace it?", name)) if(!fl_ask("%s already exists.\n\nDo you want to replace it?", name))
goto test; goto test;
} }
WriteView(v, name, 1, 0); WriteView(v, name, 1, 0);
...@@ -2947,7 +2947,7 @@ void view_save_parsed_cb(CALLBACK_ARGS) ...@@ -2947,7 +2947,7 @@ void view_save_parsed_cb(CALLBACK_ARGS)
if(CTX.confirm_overwrite) { if(CTX.confirm_overwrite) {
struct stat buf; struct stat buf;
if(!stat(name, &buf)) if(!stat(name, &buf))
if(!fl_ask("%s already exists.\nDo you want to replace it?", name)) if(!fl_ask("%s already exists.\n\nDo you want to replace it?", name))
goto test; goto test;
} }
WriteView(v, name, 2, 0); WriteView(v, name, 2, 0);
......
// $Id: GUI.cpp,v 1.404 2004-12-31 07:55:17 geuzaine Exp $ // $Id: GUI.cpp,v 1.405 2004-12-31 16:19:20 geuzaine Exp $
// //
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
// //
...@@ -19,28 +19,48 @@ ...@@ -19,28 +19,48 @@
// //
// Please report all bugs and problems to <gmsh@geuz.org>. // Please report all bugs and problems to <gmsh@geuz.org>.
// To make the interface as visually consistent as possible, please: // Some GUI guidelines:
//
// 1) To make the interface as visually consistent as possible, please:
// - use the IW, BB, BH, BW and WB values // - use the IW, BB, BH, BW and WB values
// - examine what's already done before adding something new... // - examine what's already done before adding something new...
//
// Which buttons+labels should you put on a dialog window? // 2) Use the following rule for buttons on dialog windows:
// - "OK" is to agree with what is in the dialog *AND* close the dialog // - "OK" is to agree with what is in the dialog *AND* close the dialog
// - "Apply" is to apply the current values selected in the dialog, but // - "Apply" is to apply the current values selected in the dialog, but
// leave the dialog open // leave the dialog open
// - "Cancel" is to close (hide) the dialog and *NOT* apply the // - "Cancel" is to close (hide) the dialog and *NOT* apply the
// changes that might have been made in the dialog // changes that might have been made in the dialog
//
// The "Cancel" button, if present, should always be the last (-> at // The "Cancel" button, if present, should always be the last (-> at
// right) // right)
//
// Only 'title-capitalize' titles and menus (Rules: 1. Always // 3) Only 'title-capitalize' titles and menus (Rules: 1. Always
// capitalize the first and the last word. 2. Capitalize all nouns, // capitalize the first and the last word. 2. Capitalize all nouns,
// pronouns, adjectives, verbs, adverbs, and subordinate // pronouns, adjectives, verbs, adverbs, and subordinate
// conjunctions. 3. Lowercase all articles, coordinate conjunctions, // conjunctions. 3. Lowercase all articles, coordinate conjunctions,
// and prepositions, when they are other than the first or last // and prepositions, when they are other than the first or last
// word. 4. Lowercase the "to" in an infinitive.) // word. 4. Lowercase the "to" in an infinitive.) Capitalize everything
// else like normal english sentences
//
// 4) Use an ellipsis character in a menu item for
// - an action that requires further user input to complete or
// presents an alert allowing the user to cancel the action
// Examples: Find, Go To, Open, Page Setup, and Print.
// - an action that opens a settings window. Examples: Set Title,
// Preferences, and Options.
// Don't use en allipsis for:
// - an action that requires no further user input to complete and
// does not present an alert.
// - an action that opens an informational, accessory, or tool window.
// These windows can be implemented as either utility windows (as
// in the case of a color palette) or modeless windows. These windows
// provide tools that help create or manage the content in the main
// window and are frequently left open to assist in accomplishing the
// task of the main window. Examples: Info and Show Tools.
// //
// Capitalize everything else as english sentences // 5) The title of a window opened from a meny should be exactly the
// same as the label of the menu item (without the ellipsis character if
// there is one)
// Don't indent this file // Don't indent this file
// *INDENT-OFF* // *INDENT-OFF*
...@@ -75,29 +95,8 @@ ...@@ -75,29 +95,8 @@
extern Context_T CTX; extern Context_T CTX;
// Definition of the static menus // Definition of the static menus (we cannot use the 'g', 'm' 's' and
// 'p' mnemonics since they are already defined as global shortcuts)
// We shouldn't use the 'g', 'm' 's' and 'p' mnemonics since they are
// already defined as global shortcuts (for geometry, mesh, solver, post).
// From Apple's HIG: use an ellipsis character in a menu item for
// - an action that requires further user input to complete or
// presents an alert allowing the user to cancel the action
// Examples: Find, Go To, Open, Page Setup, and Print.
// - an action that opens a settings window. Examples: Set Title,
// Preferences, and Options.
// Don't use en allipsis for:
// - an action that requires no further user input to complete and
// does not present an alert.
// - an action that opens an informational, accessory, or tool window.
// These windows can be implemented as either utility windows (as
// in the case of a color palette) or modeless windows. These windows
// provide tools that help create or manage the content in the main
// window and are frequently left open to assist in accomplishing the
// task of the main window. Examples: Info and Show Tools.
//
// The window title should be exactly the same as the menu item (without
// the ellipsis character if there is one)
Fl_Menu_Item m_menubar_table[] = { Fl_Menu_Item m_menubar_table[] = {
{"&File", 0, 0, 0, FL_SUBMENU}, {"&File", 0, 0, 0, FL_SUBMENU},
...@@ -128,9 +127,8 @@ Fl_Menu_Item m_menubar_table[] = { ...@@ -128,9 +127,8 @@ Fl_Menu_Item m_menubar_table[] = {
}; };
// Alternative items for the MacOS system menu bar (removed '&' // Alternative items for the MacOS system menu bar (removed '&'
// shortcuts: they would cause spurious menu itmes to appear on the // shortcuts: they would cause spurious menu items to appear on the
// menu window; removed File->Quit; changed capitalization to match // menu window; removed File->Quit)
// Apple's guidelines)
#if defined(__APPLE__) && defined(HAVE_FLTK_1_1_5_OR_ABOVE) #if defined(__APPLE__) && defined(HAVE_FLTK_1_1_5_OR_ABOVE)
Fl_Menu_Item m_sys_menubar_table[] = { Fl_Menu_Item m_sys_menubar_table[] = {
...@@ -339,7 +337,7 @@ Context_Item menu_mesh[] = { ...@@ -339,7 +337,7 @@ Context_Item menu_mesh[] = {
{ NULL } { NULL }
}; };
// should create MAXSOLVERS items... // FIXME: should create MAXSOLVERS items...
Context_Item menu_solver[] = { Context_Item menu_solver[] = {
{ "2Solver", NULL } , { "2Solver", NULL } ,
{ "Solver 0", (Fl_Callback *)solver_cb , (void*)0} , { "Solver 0", (Fl_Callback *)solver_cb , (void*)0} ,
...@@ -1056,7 +1054,7 @@ void GUI::set_context(Context_Item * menu_asked, int flag) ...@@ -1056,7 +1054,7 @@ void GUI::set_context(Context_Item * menu_asked, int flag)
Msg(STATUS2N, menu[0].label + 1); Msg(STATUS2N, menu[0].label + 1);
// Remove all the children (m_push*, m_toggle*, m_pop*). FLTK <= // Remove all the children (m_push*, m_toggle*, m_pop*). FLTK <=
// 1.1.4 should be OK wih this. FLTK 1.1.5 may crash as it may // 1.1.4 should be OK with this. FLTK 1.1.5 may crash as it may
// access a widget's data after its callback is executed (we call // access a widget's data after its callback is executed (we call
// set_context in the button callbacks!). FLTK 1.1.6 introduced a // set_context in the button callbacks!). FLTK 1.1.6 introduced a
// fix (Fl::delete_widget) to delay the deletion until the next // fix (Fl::delete_widget) to delay the deletion until the next
...@@ -3400,8 +3398,8 @@ void GUI::save_message(char *filename) ...@@ -3400,8 +3398,8 @@ void GUI::save_message(char *filename)
void GUI::fatal_error(char *filename) void GUI::fatal_error(char *filename)
{ {
fl_alert("A fatal error has occurred, which will force Gmsh to exit " fl_alert("A fatal error has occurred which will force Gmsh to abort.\n"
"(all messages have been saved in the error log file '%s')", "The error messages have been saved in the following file:\n\n%s",
filename); filename);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment