diff --git a/Common/Context.h b/Common/Context.h index 68baa663ce2cb35200b10ed6efe5179076c26147..34b1c0165e6b60f4a583cb23ab8a7b17e1626e35 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -234,6 +234,8 @@ class CTX { int smooth, animCycle, animStep, combineTime, combineRemoveOrig; int fileFormat, plugins, forceNodeData; double animDelay; + std::string graphPointCommand; + double graphPointX, graphPointY; }post; // solver options struct{ diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 42d4fc2041d8fffc45e11a53cc4ab30066d57158..f1bbd1370e604420f747fc94aede7cfe8578ae4c 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -209,6 +209,10 @@ StringXString SolverOptions_String[] = { } ; StringXString PostProcessingOptions_String[] = { + { F|O, "GraphPointCommand" , opt_post_graph_point_command, "" , + "Command parsed when double-clicking on a graph data point " + "(e.g. Merge Sprintf('file_%g.pos', PostProcessing.GraphPointX);)" }, + { 0, 0 , 0 , "" , 0 } } ; @@ -1252,12 +1256,16 @@ StringXNumber PostProcessingOptions_Number[] = { { F|O, "ForceNodeData" , opt_post_force_node_data , 0. , "Try to force saving datasets as NodeData" }, - { F|O, "Format" , opt_post_file_format , 10. , "Default file format for post-processing views (0=ASCII view, 1=binary " "view, 2=parsed view, 3=STL triangulation, 4=raw text, 5=Gmsh mesh, 6=MED file, " "10=automatic)" }, + { F|O, "GraphPointX" , opt_post_graph_point_x , 0. , + "Abscissa of last selected graph point" }, + { F|O, "GraphPointY" , opt_post_graph_point_y , 0. , + "Ordinate of last selected graph point" }, + { F|O, "HorizontalScales" , opt_post_horizontal_scales , 1. , "Display value scales horizontally" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 47c16223b150c1f33e15dcb7efb3e192fb96c8d1..f791414b2080f80395f894ff7a6f06b6ad5aac3c 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1490,6 +1490,13 @@ std::string opt_solver_octave_interpreter(OPT_ARGS_STR) return CTX::instance()->solver.octaveInterpreter; } +std::string opt_post_graph_point_command(OPT_ARGS_STR) +{ + if(action & GMSH_SET) + CTX::instance()->post.graphPointCommand = val; + return CTX::instance()->post.graphPointCommand; +} + #if defined(HAVE_FLTK) int _gui_action_valid(int action, int num) { @@ -6383,6 +6390,20 @@ double opt_post_force_node_data(OPT_ARGS_NUM) return CTX::instance()->post.forceNodeData; } +double opt_post_graph_point_x(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX::instance()->post.graphPointX = val; + return CTX::instance()->post.graphPointX; +} + +double opt_post_graph_point_y(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX::instance()->post.graphPointY = val; + return CTX::instance()->post.graphPointY; +} + double opt_view_nb_timestep(OPT_ARGS_NUM) { #if defined(HAVE_POST) diff --git a/Common/Options.h b/Common/Options.h index 13825736a997e6009efdbaddc1895e93368f17c7..1848f9554bcaa8bdb916b44385bda3fdf6402028 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -88,6 +88,7 @@ std::string opt_solver_remote_login8(OPT_ARGS_STR); std::string opt_solver_remote_login9(OPT_ARGS_STR); std::string opt_solver_octave_interpreter(OPT_ARGS_STR); std::string opt_solver_python_interpreter(OPT_ARGS_STR); +std::string opt_post_graph_point_command(OPT_ARGS_STR); std::string opt_view_name(OPT_ARGS_STR); std::string opt_view_format(OPT_ARGS_STR); std::string opt_view_filename(OPT_ARGS_STR); @@ -529,6 +530,8 @@ double opt_post_plugins(OPT_ARGS_NUM); double opt_post_nb_views(OPT_ARGS_NUM); double opt_post_file_format(OPT_ARGS_NUM); double opt_post_force_node_data(OPT_ARGS_NUM); +double opt_post_graph_point_x(OPT_ARGS_NUM); +double opt_post_graph_point_y(OPT_ARGS_NUM); double opt_view_nb_timestep(OPT_ARGS_NUM); double opt_view_nb_non_empty_timestep(OPT_ARGS_NUM); double opt_view_timestep(OPT_ARGS_NUM); diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp index 90ee2139e9843d4e15ea7653dbf27e487f702d09..80e22c0c71f70e57f3a873bc5cace2b09a3b481b 100644 --- a/Fltk/openglWindow.cpp +++ b/Fltk/openglWindow.cpp @@ -17,6 +17,7 @@ #include "MElement.h" #include "Numeric.h" #include "FlGui.h" +#include "OpenFile.h" #include "drawContext.h" #include "Context.h" #include "Trackball.h" @@ -344,7 +345,23 @@ int openglWindow::handle(int event) case FL_PUSH: if(Fl::event_clicks() == 1 && !selectionMode){ // double-click and not in selection mode - status_options_cb(0, (void*)"quick_access"); + std::vector<GVertex*> vertices; + std::vector<GEdge*> edges; + std::vector<GFace*> faces; + std::vector<GRegion*> regions; + std::vector<MElement*> elements; + std::vector<SPoint2> points; + _select(ENT_ALL, false, false, Fl::event_x(), Fl::event_y(), 5, 5, + vertices, edges, faces, regions, elements, points); + if(points.size()){ // double-click on graph point + CTX::instance()->post.graphPointX = points[0].x(); + CTX::instance()->post.graphPointY = points[0].y(); + if(CTX::instance()->post.graphPointCommand.size()) + ParseString(CTX::instance()->post.graphPointCommand); + } + else{ // popup quick access menu + status_options_cb(0, (void*)"quick_access"); + } Fl::event_clicks(-1); return 1; }