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

new box types for cleaner graphic window

parent 268a5e4d
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,22 @@ static int globalShortcut(int event) ...@@ -67,6 +67,22 @@ static int globalShortcut(int event)
return FlGui::instance()->testGlobalShortcuts(event); return FlGui::instance()->testGlobalShortcuts(event);
} }
static void simple_right_box_draw(int x, int y, int w, int h, Fl_Color c)
{
fl_color(c);
fl_rectf(x, y, w, h);
fl_color(FL_BACKGROUND_COLOR);
fl_line(x + w - 1, y, x + w - 1, y + h);
}
static void simple_top_box_draw(int x, int y, int w, int h, Fl_Color c)
{
fl_color(c);
fl_rectf(x, y, w, h);
fl_color(FL_BACKGROUND_COLOR);
fl_line(x, y, x + w, y);
}
FlGui::FlGui(int argc, char **argv) FlGui::FlGui(int argc, char **argv)
{ {
// set X display // set X display
...@@ -79,6 +95,10 @@ FlGui::FlGui(int argc, char **argv) ...@@ -79,6 +95,10 @@ FlGui::FlGui(int argc, char **argv)
Fl::foreground(200, 200, 200); Fl::foreground(200, 200, 200);
#endif #endif
// add new box types used in graphic window
Fl::set_boxtype(GMSH_SIMPLE_RIGHT_BOX, simple_right_box_draw, 1, 1, 2, 2);
Fl::set_boxtype(GMSH_SIMPLE_TOP_BOX, simple_top_box_draw, 1, 1, 2, 2);
// add global shortcuts // add global shortcuts
Fl::add_handler(globalShortcut); Fl::add_handler(globalShortcut);
...@@ -683,7 +703,7 @@ void FlGui::storeCurrentWindowsInfo() ...@@ -683,7 +703,7 @@ void FlGui::storeCurrentWindowsInfo()
CTX::instance()->glPosition[1] = graph[0]->getWindow()->y(); CTX::instance()->glPosition[1] = graph[0]->getWindow()->y();
CTX::instance()->glSize[0] = graph[0]->getGlWidth(); CTX::instance()->glSize[0] = graph[0]->getGlWidth();
CTX::instance()->glSize[1] = graph[0]->getGlHeight(); CTX::instance()->glSize[1] = graph[0]->getGlHeight();
CTX::instance()->msgSize = graph[0]->getMessageHeight(); CTX::instance()->msgSize = graph[0]->getSavedMessageHeight();
CTX::instance()->menuSize[0] = graph[0]->getMenuWidth(); CTX::instance()->menuSize[0] = graph[0]->getMenuWidth();
if(graph[0]->isMenuDetached()){ if(graph[0]->isMenuDetached()){
CTX::instance()->detachedMenu = 1; CTX::instance()->detachedMenu = 1;
...@@ -772,7 +792,7 @@ void window_cb(Fl_Widget *w, void *data) ...@@ -772,7 +792,7 @@ void window_cb(Fl_Widget *w, void *data)
#ifndef FS #ifndef FS
FlGui::instance()->graph[0]->getWindow()->resize(Fl::x(), Fl::y(), Fl::w(), Fl::h()); FlGui::instance()->graph[0]->getWindow()->resize(Fl::x(), Fl::y(), Fl::w(), Fl::h());
FlGui::instance()->graph[0]->hideMessages(); FlGui::instance()->graph[0]->hideMessages();
FlGui::instance()->graph[0]->getWindow()->redraw(); FlGui::instance()->check();
#else #else
FlGui::instance()->graph[0]->getWindow()->fullscreen(); FlGui::instance()->graph[0]->getWindow()->fullscreen();
#endif #endif
...@@ -781,7 +801,7 @@ void window_cb(Fl_Widget *w, void *data) ...@@ -781,7 +801,7 @@ void window_cb(Fl_Widget *w, void *data)
else{ else{
#ifndef FS #ifndef FS
FlGui::instance()->graph[0]->getWindow()->resize(oldx, oldy, oldw, oldh); FlGui::instance()->graph[0]->getWindow()->resize(oldx, oldy, oldw, oldh);
FlGui::instance()->graph[0]->getWindow()->redraw(); FlGui::instance()->check();
#else #else
FlGui::instance()->graph[0]->getWindow()->fullscreen_off(); FlGui::instance()->graph[0]->getWindow()->fullscreen_off();
#endif #endif
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
#include <vector> #include <vector>
#define GMSH_WINDOW_BOX FL_FLAT_BOX #define GMSH_WINDOW_BOX FL_FLAT_BOX
#define GMSH_SIMPLE_RIGHT_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+1)
#define GMSH_SIMPLE_TOP_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+2)
#define IW (10 * FL_NORMAL_SIZE) // input field width #define IW (10 * FL_NORMAL_SIZE) // input field width
#define BB (7 * FL_NORMAL_SIZE) // width of a button with internal label #define BB (7 * FL_NORMAL_SIZE) // width of a button with internal label
#define BH (2 * FL_NORMAL_SIZE + 1) // button height #define BH (2 * FL_NORMAL_SIZE + 1) // button height
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment