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

Nicer plugin windows

parent fa966461
Branches
Tags
No related merge requests found
...@@ -167,7 +167,7 @@ StringXNumber GeneralOptions_Number[] = { ...@@ -167,7 +167,7 @@ StringXNumber GeneralOptions_Number[] = {
"Use trackball rotation mode" }, "Use trackball rotation mode" },
{ F|O, "ZoomFactor" , opt_general_zoom_factor , 1.1 , { F|O, "ZoomFactor" , opt_general_zoom_factor , 1.1 ,
"'Speed' of the middle mouse button zoom" }, "'Speed' of the middle mouse button zoom" },
{ F|O, "DefaultPlugins" , opt_general_default_plugins , 0. , { F|O, "DefaultPlugins" , opt_general_default_plugins , 1. ,
"Load default plugins on startup" }, "Load default plugins on startup" },
{ F, "Clip0" , opt_general_clip0 , 0. , { F, "Clip0" , opt_general_clip0 , 0. ,
"Enable clip plane 0" }, "Enable clip plane 0" },
......
// $Id: GUI.cpp,v 1.96 2001-07-31 09:56:52 geuzaine Exp $ // $Id: GUI.cpp,v 1.97 2001-07-31 11:13:16 geuzaine Exp $
// To make the interface as visually consistent as possible, please: // To make the interface as visually consistent as possible, please:
// - use the BH, BW, WB, IW values for button heights/widths, window borders, etc. // - use the BH, BW, WB, IW values for button heights/widths, window borders, etc.
...@@ -638,11 +638,11 @@ void GUI::create_menu_window(int argc, char **argv){ ...@@ -638,11 +638,11 @@ void GUI::create_menu_window(int argc, char **argv){
(Fl_Callback *)view_save_ascii_cb, (void*)i, 0) ; (Fl_Callback *)view_save_ascii_cb, (void*)i, 0) ;
m_popup_butt[i]->add("Save as/Binary View...", 0, m_popup_butt[i]->add("Save as/Binary View...", 0,
(Fl_Callback *)view_save_binary_cb, (void*)i, 0) ; (Fl_Callback *)view_save_binary_cb, (void*)i, 0) ;
add_post_plugins ( m_popup_butt[i] , i);
m_popup_butt[i]->add("Apply as Background Mesh", 0, m_popup_butt[i]->add("Apply as Background Mesh", 0,
(Fl_Callback *)view_applybgmesh_cb, (void*)i, FL_MENU_DIVIDER); (Fl_Callback *)view_applybgmesh_cb, (void*)i, FL_MENU_DIVIDER);
m_popup_butt[i]->add("Options...", 0, m_popup_butt[i]->add("Options...", 0,
(Fl_Callback *)view_options_cb, (void*)i, 0); (Fl_Callback *)view_options_cb, (void*)i, 0);
add_post_plugins ( m_popup_butt[i] , i);
m_popup_butt[i]->textsize(CTX.fontsize); m_popup_butt[i]->textsize(CTX.fontsize);
m_popup_butt[i]->hide(); m_popup_butt[i]->hide();
} }
...@@ -1692,27 +1692,38 @@ void GUI::set_statistics(){ ...@@ -1692,27 +1692,38 @@ void GUI::set_statistics(){
PluginDialogBox * GUI::create_plugin_window(GMSH_Plugin *p, int iView){ PluginDialogBox * GUI::create_plugin_window(GMSH_Plugin *p, int iView){
char buffer[1024],namep[1024],copyright[256],author[256],help[1024]; char buffer[1024],namep[1024],copyright[256],author[256],help[1024];
PluginDialogBox *pdb = new PluginDialogBox; // get plugin info
int n = p->getNbOptions(); int n = p->getNbOptions();
p->getName(namep); p->getName(namep);
p->getInfos(author,copyright,help); p->getInfos(author,copyright,help);
std::pair<int,GMSH_Plugin*> *pair = new std::pair<int,GMSH_Plugin*>(iView,p);
// create window
int width = 20*CTX.fontsize; int width = 20*CTX.fontsize;
int height = (n+2)*BH ; int height = (n+2)*BH + 5*WB;
Fl_Window *pl_window = new Fl_Window(width,height);
pdb->main_window = pl_window; PluginDialogBox *pdb = new PluginDialogBox;
pl_window->box(WINDOW_BOX); pdb->main_window = new Fl_Window(width,height);
pdb->main_window->box(WINDOW_BOX);
sprintf(buffer,"%s Plugin",namep); sprintf(buffer,"%s Plugin",namep);
char *nbuffer = new char[strlen(buffer)+1]; char *nbuffer = new char[strlen(buffer)+1];
strcpy(nbuffer,buffer); strcpy(nbuffer,buffer);
pl_window->label(nbuffer); pdb->main_window->label(nbuffer);
if(n > 20)Msg(GERROR,"Plugin has too much parameters");
for(int i=0;i<n;i++)
{ {
Fl_Tabs *o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-1*BH);
{
Fl_Group *g = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Options");
g->labelsize(CTX.fontsize);
if(n > 20)Msg(GERROR, "Plugin has too many parameters");
for(int i=0;i<n;i++){
StringXNumber *sxn; StringXNumber *sxn;
sxn = p->GetOption(i); sxn = p->GetOption(i);
pdb->view_value[i] = new Fl_Value_Input(2*WB, 2*WB+(i)*BH, IW, BH, sxn->str); pdb->view_value[i] = new Fl_Value_Input(2*WB, 2*WB+(i+1)*BH, IW, BH, sxn->str);
pdb->view_value[i]->labelsize(CTX.fontsize); pdb->view_value[i]->labelsize(CTX.fontsize);
pdb->view_value[i]->textsize(CTX.fontsize); pdb->view_value[i]->textsize(CTX.fontsize);
pdb->view_value[i]->type(FL_HORIZONTAL); pdb->view_value[i]->type(FL_HORIZONTAL);
...@@ -1720,20 +1731,40 @@ PluginDialogBox * GUI::create_plugin_window(GMSH_Plugin *p, int iView){ ...@@ -1720,20 +1731,40 @@ PluginDialogBox * GUI::create_plugin_window(GMSH_Plugin *p, int iView){
pdb->view_value[i]->value(sxn->def); pdb->view_value[i]->value(sxn->def);
} }
g->end();
}
{
Fl_Group *g = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "About");
g->labelsize(CTX.fontsize);
Fl_Browser *o = new Fl_Browser(2*WB, 2*WB+1*BH, width-4*WB, height-5*WB-2*BH);
o->add("");
o->add(namep);
o->add("");
o->add(help);
o->add("");
o->add(author);
o->add(copyright);
o->textsize(CTX.fontsize);
g->end();
}
o->end();
}
Fl_Button* cancel = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Close"); Fl_Button* cancel = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Close");
cancel->labelsize(CTX.fontsize);
cancel->callback(cancel_cb, (void*)pdb->main_window);
Fl_Button* ok = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Run"); Fl_Button* ok = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Run");
ok->labelsize(CTX.fontsize); ok->labelsize(CTX.fontsize);
std::pair<int,GMSH_Plugin*> *pair =
new std::pair<int,GMSH_Plugin*>(iView,p);
ok->callback(view_plugin_cb, (void*)pair); ok->callback(view_plugin_cb, (void*)pair);
cancel->labelsize(CTX.fontsize);
cancel->callback(cancel_cb, (void*)pl_window);
if(CTX.center_windows) if(CTX.center_windows)
pl_window->position(m_window->x()+m_window->w()/2-width/2, pdb->main_window->position(m_window->x()+m_window->w()/2-width/2,
m_window->y()+9*BH-height/2); m_window->y()+9*BH-height/2);
pl_window->end(); pdb->main_window->end();
return pdb; return pdb;
} }
......
// $Id: CutMap.cpp,v 1.10 2001-07-31 10:28:50 geuzaine Exp $ // $Id: CutMap.cpp,v 1.11 2001-07-31 11:13:16 geuzaine Exp $
#include "CutMap.h" #include "CutMap.h"
#include "List.h" #include "List.h"
...@@ -32,8 +32,7 @@ void GMSH_CutMapPlugin::getInfos(char *author, char *copyright, char *help_text) ...@@ -32,8 +32,7 @@ void GMSH_CutMapPlugin::getInfos(char *author, char *copyright, char *help_text)
{ {
strcpy(author, "J.-F. Remacle (remacle@scorec.rpi.edu)"); strcpy(author, "J.-F. Remacle (remacle@scorec.rpi.edu)");
strcpy(copyright, "DGR (www.multiphysics.com)"); strcpy(copyright, "DGR (www.multiphysics.com)");
strcpy(help_text, strcpy(help_text, "This Plugins extracts the isovalue surface of value 'Value'");
"This Plugins extracts the isovalue surface of value 'Value'\n");
} }
int GMSH_CutMapPlugin::getNbOptions() const int GMSH_CutMapPlugin::getNbOptions() const
......
// $Id: CutPlane.cpp,v 1.8 2001-07-31 10:24:56 geuzaine Exp $ // $Id: CutPlane.cpp,v 1.9 2001-07-31 11:13:16 geuzaine Exp $
#include "CutPlane.h" #include "CutPlane.h"
#include "List.h" #include "List.h"
...@@ -37,7 +37,7 @@ void GMSH_CutPlanePlugin::getInfos(char *author, char *copyright, char *help_tex ...@@ -37,7 +37,7 @@ void GMSH_CutPlanePlugin::getInfos(char *author, char *copyright, char *help_tex
{ {
strcpy(author,"J.-F. Remacle (remacle@scorec.rpi.edu)"); strcpy(author,"J.-F. Remacle (remacle@scorec.rpi.edu)");
strcpy(copyright,"DGR (www.multiphysics.com)"); strcpy(copyright,"DGR (www.multiphysics.com)");
strcpy(help_text,"This Plugins cuts a view \n with a plane a x + b y + c z + d = 0\n"); strcpy(help_text,"This Plugins cuts a view with a plane a x + b y + c z + d = 0");
} }
int GMSH_CutPlanePlugin::getNbOptions() const int GMSH_CutPlanePlugin::getNbOptions() const
......
// $Id: CutSphere.cpp,v 1.7 2001-07-31 10:24:56 geuzaine Exp $ // $Id: CutSphere.cpp,v 1.8 2001-07-31 11:13:16 geuzaine Exp $
#include <string.h> #include <string.h>
#include "CutSphere.h" #include "CutSphere.h"
...@@ -38,9 +38,8 @@ void GMSH_CutSpherePlugin::getInfos(char *author, char *copyright, char *help_te ...@@ -38,9 +38,8 @@ void GMSH_CutSpherePlugin::getInfos(char *author, char *copyright, char *help_te
{ {
strcpy(author,"J.-F. Remacle (remacle@scorec.rpi.edu)"); strcpy(author,"J.-F. Remacle (remacle@scorec.rpi.edu)");
strcpy(copyright,"DGR (www.multiphysics.com)"); strcpy(copyright,"DGR (www.multiphysics.com)");
strcpy(help_text, strcpy(help_text, "This Plugins cuts a view with the sphere "
"This Plugins cuts a view\n" " (x-xc)^2 + (y-yc)^2 + (z-zc)^2 = r^20");
"with the sphere (x-xc)^2 + (y-yc)^2 + (z-zc)^2 = r^20\n");
} }
int GMSH_CutSpherePlugin::getNbOptions() const int GMSH_CutSpherePlugin::getNbOptions() const
......
$Id: VERSIONS,v 1.37 2001-07-31 08:01:25 geuzaine Exp $ $Id: VERSIONS,v 1.38 2001-07-31 11:13:16 geuzaine Exp $
New in 1.22: Fixed (yet another) bug for 2D mesh in the mean plane; New in 1.22: Fixed (yet another) bug for 2D mesh in the mean plane;
fixed surface coherence bug in extruded meshes; new double logarithmic fixed surface coherence bug in extruded meshes; new double logarithmic
post-processing scale, saturate value and smoothed normals option for post-processing scale, saturate value and smoothed normals option for
post-processing views; post-processing views; plugins are now enabled by default on Windows,
Linux, SGI and DEC;
New in 1.21: Fixed more memory leaks; added -opt command line option New in 1.21: Fixed more memory leaks; added -opt command line option
to parse definitions directly from the command line; fixed missing to parse definitions directly from the command line; fixed missing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment