diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 17387790e5b7b1d192dfd55183c22936f49d948a..9f7b189fb92128d62717dcb6d57f24ea51d68b17 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.387 2005-12-18 21:10:54 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.388 2005-12-18 22:13:26 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -450,8 +450,13 @@ void status_xyz1p_cb(CALLBACK_ARGS) Draw(); } else if(!strcmp(str, "p")){ // toggle projection mode - opt_general_orthographic(0, GMSH_SET | GMSH_GUI, - !opt_general_orthographic(0, GMSH_GET, 0)); + if(!Fl::event_state(FL_SHIFT)){ + opt_general_orthographic(0, GMSH_SET | GMSH_GUI, + !opt_general_orthographic(0, GMSH_GET, 0)); + } + else{ + perspective_editor(); + } Draw(); } else if(!strcmp(str, "?")){ // display options @@ -1640,6 +1645,7 @@ void help_short_cb(CALLBACK_ARGS) Msg(DIRECT, " "); Msg(DIRECT, " Alt+Shift+a Hide/show small axes"); Msg(DIRECT, " Alt+Shift+l Hide/show surface mesh edges"); + Msg(DIRECT, " Alt+Shift+o Adjust projection parameters"); Msg(DIRECT, " Alt+Shift+p Hide/show mesh points"); Msg(DIRECT, " Alt+Shift+s Hide/show mesh surfaces"); Msg(DIRECT, " Alt+Shift+v Hide/show mesh volumes"); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 3dd3e9cbd0933a8d3ffd5a56be94e39a1aa571fc..3434d7718492bb8689bac9071e6a310cac5cfc5c 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.473 2005-12-18 21:10:54 geuzaine Exp $ +// $Id: GUI.cpp,v 1.474 2005-12-18 22:13:26 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -628,12 +628,6 @@ int GUI::global_shortcuts(int event) redraw_opengl(); return 1; } - else if(Fl::test_shortcut(FL_ALT + 'o')) { - opt_general_orthographic(0, GMSH_SET | GMSH_GUI, - !opt_general_orthographic(0, GMSH_GET, 0)); - redraw_opengl(); - return 1; - } else if(Fl::test_shortcut(FL_ALT + 'c')) { opt_general_color_scheme(0, GMSH_SET | GMSH_GUI, opt_general_color_scheme(0, GMSH_GET, 0) + 1); @@ -673,6 +667,11 @@ int GUI::global_shortcuts(int event) status_xyz1p_cb(0, (void *)"z"); return 1; } + else if(Fl::test_shortcut(FL_ALT + 'o') || + Fl::test_shortcut(FL_ALT + FL_SHIFT + 'o')) { + status_xyz1p_cb(0, (void *)"p"); + return 1; + } else if(Fl::test_shortcut(FL_ALT + 'a')) { opt_general_axes(0, GMSH_SET | GMSH_GUI, opt_general_axes(0, GMSH_GET, 0) + 1); @@ -1363,7 +1362,7 @@ void GUI::create_graphic_window() g_status_butt[8] = new Fl_Button(x, glheight + 2, sw, sh - 4); x += sw; g_status_butt[8]->callback(status_xyz1p_cb, (void *)"p"); - g_status_butt[8]->tooltip("Toggle projection mode (Alt+o)"); + g_status_butt[8]->tooltip("Toggle projection mode (Alt+o or Alt+Shift+o)"); ortho_bmp = new Fl_Bitmap(ortho_bits, ortho_width, ortho_height); ortho_bmp->label(g_status_butt[8]); diff --git a/Fltk/GUI_Extras.cpp b/Fltk/GUI_Extras.cpp index e2ff798754b283380eb2d0f4229a27826aff262c..d7f052f37bfe481a491362378f2d703035577fe7 100644 --- a/Fltk/GUI_Extras.cpp +++ b/Fltk/GUI_Extras.cpp @@ -1,4 +1,4 @@ -// $Id: GUI_Extras.cpp,v 1.12 2005-12-14 13:53:09 geuzaine Exp $ +// $Id: GUI_Extras.cpp,v 1.13 2005-12-18 22:13:26 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -27,10 +27,12 @@ #include "CreateFile.h" #include "Options.h" #include "Context.h" +#include "Draw.h" #include <FL/Fl_Button.H> #include <FL/Fl_Return_Button.H> #include <FL/Fl_Value_Slider.H> +#include <FL/Fl_Menu_Window.H> #include <errno.h> extern Context_T CTX; @@ -163,6 +165,55 @@ int arrow_editor(char *title, double &a, double &b, double &c) return 0; } +// Perspective editor (aka z-clipping planes factor slider) + +static void persp_change_factor(Fl_Widget* w, void* data){ + opt_general_clip_factor(0, GMSH_SET|GMSH_GUI, ((Fl_Slider*)w)->value()); + Draw(); +} + +class Release_Slider : public Fl_Slider { + int handle(int event){ + switch (event) { + case FL_RELEASE: + if(window()) + window()->hide(); + return 1; + default: + return Fl_Slider::handle(event); + } + }; +public: + Release_Slider(int x,int y,int w,int h,const char *l=0) + : Fl_Slider(x, y, w, h, l) {} +}; + +int perspective_editor() +{ + struct _editor{ + Fl_Menu_Window *window; + Release_Slider *sa; + }; + static _editor *editor = NULL; + + if(!editor){ + editor = new _editor; + editor->window = new Fl_Menu_Window(20, 100); + editor->sa = new Release_Slider(0, 0, 20, 100); + editor->sa->type(FL_VERT_NICE_SLIDER); + editor->sa->minimum(12); + editor->sa->maximum(0.75); + editor->sa->callback(persp_change_factor); + editor->window->border(0); + editor->window->end(); + } + + editor->window->hotspot(editor->window); + editor->sa->value(CTX.clip_factor); + editor->window->show(); + return 0; +} + // jpeg dialog int jpeg_dialog(char *name, int TeX) diff --git a/Fltk/GUI_Extras.h b/Fltk/GUI_Extras.h index 6fafea95ab3392d300b12d4110a0f7ff6beaa5ff..0cb151459cc3590c15d7f34a98fd84271f86be80 100644 --- a/Fltk/GUI_Extras.h +++ b/Fltk/GUI_Extras.h @@ -27,6 +27,7 @@ int file_chooser_get_filter(); void file_chooser_get_position(int *x, int *y); int arrow_editor(char *title, double &a, double &b, double &c); +int perspective_editor(); int jpeg_dialog(char *filename, int TeX); int gif_dialog(char *filename); diff --git a/doc/VERSIONS b/doc/VERSIONS index daa77c616606c5e3be0df21287901fa936e91eac..e6dca4d142ce68d18ee9e4adb538f1e9a4f5ba11 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,7 +1,7 @@ -$Id: VERSIONS,v 1.348 2005-12-16 17:37:44 geuzaine Exp $ +$Id: VERSIONS,v 1.349 2005-12-18 22:13:26 geuzaine Exp $ New since 1.61: new option to draw color gradients in the background; -various small bug fixes. +enhanced perspective projection mode; various small bug fixes. New in 1.61: added support for second order (curved) elements in post-processor; new version (1.4) of post-processing file formats; new diff --git a/doc/texinfo/shortcuts.texi b/doc/texinfo/shortcuts.texi index f758550a073769939bc4658763b33f2a3dee7713..bbb1fc52ec5119c2affcb0d92be58796670ca836 100644 --- a/doc/texinfo/shortcuts.texi +++ b/doc/texinfo/shortcuts.texi @@ -133,6 +133,8 @@ Set Z view Hide/show small axes @item Alt+Shift+l Hide/show surface mesh edges +@item Alt+Shift+o +Adjust projection parameters @item Alt+Shift+p Hide/show mesh points @item Alt+Shift+s