diff --git a/Common/Options.cpp b/Common/Options.cpp index e6e946e9384fb378ec46a8e9086db48498de2b6e..68a5c3bd50a53bf6db07db51e2cd770b5049f929 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.161 2004-05-30 06:24:01 geuzaine Exp $ +// $Id: Options.cpp,v 1.162 2004-06-01 22:16:24 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -2225,8 +2225,18 @@ double opt_general_orthographic(OPT_ARGS_NUM) CTX.ortho = (int)val; #if defined(HAVE_FLTK) if(WID && (action & GMSH_GUI)) { - WID->gen_butt[10]->value(CTX.ortho); - WID->gen_butt[11]->value(!CTX.ortho); + if(CTX.ortho){ + WID->gen_butt[10]->value(1); + WID->gen_butt[11]->value(0); + WID->persp_bmp->label(WID->g_status_butt[4]); + + } + else{ + WID->gen_butt[10]->value(0); + WID->gen_butt[11]->value(1); + WID->ortho_bmp->label(WID->g_status_butt[4]); + } + WID->g_status_butt[4]->redraw(); } #endif return CTX.ortho; diff --git a/Fltk/Bitmaps.h b/Fltk/Bitmaps.h index 3e966b83c463493383d523d9172f07d1ffaa8215..b3bca55c977086898bba9bab4f52922e7cdb4676 100644 --- a/Fltk/Bitmaps.h +++ b/Fltk/Bitmaps.h @@ -124,11 +124,27 @@ static char stop_bits[] = { 0xfe,0xaa,0xfe,0xaa,0xfe,0xaa,0xfe,0xee,0xfe,0x00,0xfe}; // 'Rewind button' bitmap + #define rewind_width 12 #define rewind_height 13 static char rewind_bits[] = { 0x00,0xf0,0x0e,0xf6,0x0a,0xf5,0x8a,0xf4,0x4a,0xf4,0x2a,0xf4,0x1a,0xf4,0x2a, 0xf4,0x4a,0xf4,0x8a,0xf4,0x0a,0xf5,0x0e,0xf6,0x00,0xf0}; +// 'Orthographic projection' bitmap +#define ortho_width 13 +#define ortho_height 13 +static unsigned char ortho_bits[] = { + 0x00, 0x00, 0xf0, 0x0f, 0x18, 0x0c, 0x14, 0x0a, 0xfe, 0x09, 0x12, 0x09, + 0x12, 0x09, 0x12, 0x09, 0xf2, 0x0f, 0x0a, 0x05, 0x06, 0x03, 0xfe, 0x01, + 0x00, 0x00 }; + +// 'Perspective projection' bitmap +#define persp_width 13 +#define persp_height 13 +static unsigned char persp_bits[] = { + 0x00, 0x00, 0xf0, 0x0f, 0x10, 0x0c, 0x18, 0x0a, 0x18, 0x09, 0x94, 0x08, + 0x7c, 0x08, 0x54, 0x08, 0xf4, 0x0f, 0x44, 0x03, 0xfc, 0x00, 0x00, 0x00, + 0x00, 0x00 }; #endif diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 5dc28409847ed5cdbc62a209bcce4f330c4c73c3..bb1d8d9e47bbf129de66a9291d5b8f6cb7864a86 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.244 2004-05-30 06:24:01 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.245 2004-06-01 22:16:24 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -285,6 +285,11 @@ void status_xyz1p_cb(CALLBACK_ARGS) Draw(); break; case 4: + opt_general_orthographic(0, GMSH_SET | GMSH_GUI, + !opt_general_orthographic(0, GMSH_GET, 0)); + Draw(); + break; + case 5: Print_Options(0, GMSH_FULLRC, false, NULL); WID->create_message_window(); break; @@ -861,7 +866,7 @@ void general_options_ok_cb(CALLBACK_ARGS) if(sessionrc && !opt_general_session_save(0, GMSH_GET, 0)) Print_Options(0, GMSH_SESSIONRC, true, CTX.sessionrc_filename); opt_general_options_save(0, GMSH_SET, WID->gen_butt[9]->value()); - opt_general_orthographic(0, GMSH_SET, WID->gen_butt[10]->value()); + opt_general_orthographic(0, GMSH_SET | GMSH_GUI, WID->gen_butt[10]->value()); opt_general_tooltips(0, GMSH_SET, WID->gen_butt[13]->value()); opt_general_confirm_overwrite(0, GMSH_SET, WID->gen_butt[14]->value()); opt_general_rotation_center_cg(0, GMSH_SET, WID->gen_butt[15]->value()); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 8f7ecceb101bf9113245ff6c011aba4a703bbf43..1ebe131b99b351ed31b66ba0ffe3bf64aa3d4288 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.310 2004-06-01 17:26:11 geuzaine Exp $ +// $Id: GUI.cpp,v 1.311 2004-06-01 22:16:24 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -88,7 +88,7 @@ Fl_Menu_Item m_menubar_table[] = { {"M&essage console...", FL_SHIFT+'l', (Fl_Callback *)message_cb, 0}, {0}, {"&Help", 0, 0, 0, FL_SUBMENU}, - {"&Current options...", 0, (Fl_Callback *)status_xyz1p_cb, (void*)4}, + {"&Current options...", 0, (Fl_Callback *)status_xyz1p_cb, (void*)5}, {"S&hortcuts...", 0, (Fl_Callback *)help_short_cb, 0}, {"C&ommand line options...", 0, (Fl_Callback *)help_command_line_cb, 0, FL_MENU_DIVIDER}, {"On&line documentation", 0, (Fl_Callback *)help_online_cb, 0, FL_MENU_DIVIDER}, @@ -118,7 +118,7 @@ Fl_Menu_Item m_sys_menubar_table[] = { {"Message Console...", FL_SHIFT+'l', (Fl_Callback *)message_cb, 0}, {0}, {"Help",0,0,0,FL_SUBMENU}, - {"Current Options...", 0, (Fl_Callback *)status_xyz1p_cb, (void*)4}, + {"Current Options...", 0, (Fl_Callback *)status_xyz1p_cb, (void*)5}, {"Shortcuts...", 0, (Fl_Callback *)help_short_cb, 0}, {"Command Line Options...", 0, (Fl_Callback *)help_command_line_cb, 0, FL_MENU_DIVIDER}, {"Online Documentation", 0, (Fl_Callback *)help_online_cb, 0, FL_MENU_DIVIDER}, @@ -1119,38 +1119,52 @@ void GUI::create_graphic_window(int argc, char **argv) x += sw; g_status_butt[0]->callback(status_xyz1p_cb, (void *)0); g_status_butt[0]->tooltip("Set X view (Y=Z=0)"); + g_status_butt[1] = new Fl_Button(x, glheight + 2, sw, sh - 4, "Y"); x += sw; g_status_butt[1]->callback(status_xyz1p_cb, (void *)1); g_status_butt[1]->tooltip("Set Y view (X=Z=0)"); + g_status_butt[2] = new Fl_Button(x, glheight + 2, sw, sh - 4, "Z"); x += sw; g_status_butt[2]->callback(status_xyz1p_cb, (void *)2); g_status_butt[2]->tooltip("Set Z view (X=Y=0)"); + g_status_butt[3] = new Fl_Button(x, glheight + 2, 2 * fontsize, sh - 4, "1:1"); x += 2 * fontsize; g_status_butt[3]->callback(status_xyz1p_cb, (void *)3); g_status_butt[3]->tooltip("Set unit scale"); - g_status_butt[4] = new Fl_Button(x, glheight + 2, sw, sh - 4, "?"); + + g_status_butt[4] = new Fl_Button(x, glheight + 2, sw, sh - 4); x += sw; g_status_butt[4]->callback(status_xyz1p_cb, (void *)4); - g_status_butt[4]->tooltip("Show current options"); - g_status_butt[5] = new Fl_Button(x, glheight + 2, sw, sh - 4); + g_status_butt[4]->tooltip("Set orthographic/perspective projection"); + ortho_bmp = new Fl_Bitmap(ortho_bits, ortho_width, ortho_height); + persp_bmp = new Fl_Bitmap(persp_bits, persp_width, persp_height); + + g_status_butt[5] = new Fl_Button(x, glheight + 2, sw, sh - 4, "?"); x += sw; - g_status_butt[5]->callback(status_rewind_cb); - rewind_bmp = new Fl_Bitmap(rewind_bits, rewind_width, rewind_height); - rewind_bmp->label(g_status_butt[5]); - g_status_butt[5]->deactivate(); - g_status_butt[5]->tooltip("Rewind animation"); + g_status_butt[5]->callback(status_xyz1p_cb, (void *)5); + g_status_butt[5]->tooltip("Show current options"); + g_status_butt[6] = new Fl_Button(x, glheight + 2, sw, sh - 4); x += sw; - g_status_butt[6]->callback(status_play_cb); - g_status_butt[6]->tooltip("Play/pause animation"); + g_status_butt[6]->callback(status_rewind_cb); + rewind_bmp = new Fl_Bitmap(rewind_bits, rewind_width, rewind_height); + rewind_bmp->label(g_status_butt[6]); + g_status_butt[6]->deactivate(); + g_status_butt[6]->tooltip("Rewind animation"); + + g_status_butt[7] = new Fl_Button(x, glheight + 2, sw, sh - 4); + x += sw; + g_status_butt[7]->callback(status_play_cb); + g_status_butt[7]->tooltip("Play/pause animation"); start_bmp = new Fl_Bitmap(start_bits, start_width, start_height); - start_bmp->label(g_status_butt[6]); + start_bmp->label(g_status_butt[7]); stop_bmp = new Fl_Bitmap(stop_bits, stop_width, stop_height); - g_status_butt[6]->deactivate(); - for(i = 0; i < 7; i++) { + g_status_butt[7]->deactivate(); + + for(i = 0; i < 8; i++) { g_status_butt[i]->box(FL_FLAT_BOX); g_status_butt[i]->selection_color(FL_WHITE); g_status_butt[i]->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); @@ -1201,12 +1215,12 @@ void GUI::set_title(char *str) void GUI::set_anim_buttons(int mode) { if(mode) { - g_status_butt[6]->callback(status_play_cb); - start_bmp->label(g_status_butt[6]); + g_status_butt[7]->callback(status_play_cb); + start_bmp->label(g_status_butt[7]); } else { - g_status_butt[6]->callback(status_pause_cb); - stop_bmp->label(g_status_butt[6]); + g_status_butt[7]->callback(status_pause_cb); + stop_bmp->label(g_status_butt[7]); } } @@ -1225,12 +1239,12 @@ void GUI::check_anim_buttons() } } if(!play) { - g_status_butt[5]->deactivate(); g_status_butt[6]->deactivate(); + g_status_butt[7]->deactivate(); } else { - g_status_butt[5]->activate(); g_status_butt[6]->activate(); + g_status_butt[7]->activate(); } } diff --git a/Fltk/GUI.h b/Fltk/GUI.h index 1013d26571e3db0eca28aa796025e969a30e8745..02d5d2ce132cf1f77f148d25309942a3b9ececc8 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -126,6 +126,8 @@ class GUI{ public: + Fl_Bitmap *ortho_bmp, *persp_bmp; + // menu window Fl_Window *m_window ; #if defined(__APPLE__) && defined(HAVE_FL_SYS_MENU_BAR) @@ -143,7 +145,7 @@ public: // graphic window Fl_Window *g_window ; Opengl_Window *g_opengl_window ; - Fl_Button *g_status_butt[7] ; + Fl_Button *g_status_butt[8] ; Fl_Box *g_status_label[3] ; // Option window