user defined dblclick handler

This commit is contained in:
Joachim Schoeberl 2012-08-30 13:40:17 +00:00
parent c2a3f5c149
commit d0b8d63889
10 changed files with 39 additions and 10 deletions

View File

@ -288,6 +288,7 @@ extern "C" {
namespace netgen {
// #include "../visualization/soldata.hpp"
class SolutionData;
class MouseEventHandler;
}
enum Ng_SolutionType
@ -323,6 +324,8 @@ extern "C" {
DLL_HEADER void Ng_ClearSolutionData();
// redraw
DLL_HEADER void Ng_Redraw();
///
DLL_HEADER void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler);
//
DLL_HEADER void Ng_SetVisualizationParameter (const char * name,
const char * value);

View File

@ -705,7 +705,11 @@ namespace netgen
int timerloc2 = NgProfiler::CreateTimer ("CalcSurfacesOfNode");
NgProfiler::RegionTimer regloc(timerloc);
PrintMessage (2, "Got ", GetNE(), " elements and ", GetNSE(), " surface elements");
stringstream str;
str << "Got " << GetNE() << " elements and "
<< GetNSE() << " surface elements";
cout << str.str() << endl;
// PrintMessage (2, "Got ", GetNE(), " elements and ", GetNSE(), " surface elements");
// PrintMessage (2, "Got ", GetNSE(), " surface elements");
NgProfiler::StartTimer (timerloc2);

View File

@ -157,6 +157,7 @@ namespace netgen
Array<int> par_filledlists;
#endif
MouseEventHandler * user_me_handler;
NgLock *lock;
@ -174,6 +175,10 @@ namespace netgen
virtual void DrawScene ();
virtual void MouseDblClick (int px, int py);
void SetMouseEventHandler (MouseEventHandler * handler)
{ user_me_handler = handler; }
int SelectedFace () const
{ return selface; }
void SetSelectedFace (int asf);

View File

@ -105,6 +105,14 @@ namespace netgen
multidimcomponent = mc;
}
};
class DLL_HEADER MouseEventHandler
{
public:
virtual void DblClick (int elnr) { ; }
};
}
#endif

View File

@ -20,8 +20,8 @@ Visualization
#include "../include/incvis.hpp"
#include "vispar.hpp"
#include "mvdraw.hpp"
#include "soldata.hpp"
#include "mvdraw.hpp"
#include <complex>

View File

@ -61,6 +61,8 @@ namespace netgen
minh = 0.0;
maxh = 0.0;
user_me_handler = NULL;
}
VisualSceneMesh :: ~VisualSceneMesh ()
@ -3094,6 +3096,12 @@ namespace netgen
filledlist,selelement,selface,seledge,selpoint,selpoint2,locpi);
if (user_me_handler)
{
if (selelement != -1)
user_me_handler -> DblClick (selelement-1);
}
selecttimestamp = NextTimeStamp();
if(lock)
@ -3427,7 +3435,6 @@ namespace netgen
cout << "seledge = " << seledge << endl;
}
}
}
else
{

View File

@ -141,8 +141,6 @@ public:
Array<SolData*> soldata;
int usetexture; // 0..no, 1..1D texture (standard), 2..2D-texture (complex)
int clipsolution; // 0..no, 1..scal, 2..vec
int scalfunction, scalcomp, vecfunction;
@ -192,7 +190,6 @@ public:
void SaveSolutionData (const char * filename);
static void RealVec3d (const double * values, Vec3d & v,
bool iscomplex, bool imag);
static void RealVec3d (const double * values, Vec3d & v,

View File

@ -1,6 +1,3 @@
proc meshingoptionsdialog { } {
set w .options_dlg

View File

@ -2718,6 +2718,12 @@ void Ng_SetSolutionData (Ng_SolutionData * soldata)
#endif
}
void Ng_SetMouseEventHandler (netgen::MouseEventHandler * handler)
{
vsmesh.SetMouseEventHandler (handler);
}
void Ng_ClearSolutionData ()
{
#ifdef OPENGL

View File

@ -1180,7 +1180,9 @@ namespace netgen
//Destination for messages, errors, ...
DLL_HEADER void Ng_PrintDest(const char * s)
{
(*mycout) << s << flush;
int id = 0;
MPI_Comm_rank(MPI_COMM_WORLD, &id);
if (id == 0) (*mycout) << s << flush;
}