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

move icns to FlGui.cpp

parent e2813fe5
Branches
Tags
No related merge requests found
...@@ -15,6 +15,7 @@ typedef unsigned long intptr_t; ...@@ -15,6 +15,7 @@ typedef unsigned long intptr_t;
#include <FL/Fl_Tooltip.H> #include <FL/Fl_Tooltip.H>
#include <FL/Fl_Shared_Image.H> #include <FL/Fl_Shared_Image.H>
#include <FL/Fl_File_Icon.H> #include <FL/Fl_File_Icon.H>
#include <FL/fl_draw.H>
#include "FlGui.h" #include "FlGui.h"
#include "drawContextFltk.h" #include "drawContextFltk.h"
#include "graphicWindow.h" #include "graphicWindow.h"
...@@ -80,6 +81,126 @@ static void simple_top_box_draw(int x, int y, int w, int h, Fl_Color c) ...@@ -80,6 +81,126 @@ static void simple_top_box_draw(int x, int y, int w, int h, Fl_Color c)
//fl_color(FL_LIGHT2); fl_line(x, y+1, x + w, y+1); //fl_color(FL_LIGHT2); fl_line(x, y+1, x + w, y+1);
} }
// Icons for the satus bar
#define vv(x,y) fl_vertex(x,y)
#define bl fl_begin_loop()
#define el fl_end_loop()
static void gmsh_play(Fl_Color c)
{
fl_color(c);
bl; vv(-0.3,0.8); vv(0.5,0.0); vv(-0.3,-0.8); el;
}
static void gmsh_pause(Fl_Color c)
{
fl_color(c);
bl; vv(-0.8,-0.8); vv(-0.3,-0.8); vv(-0.3,0.8); vv(-0.8,0.8); el;
bl; vv(0.0,-0.8); vv(0.5,-0.8); vv(0.5,0.8); vv(0.0,0.8); el;
}
static void gmsh_rewind(Fl_Color c)
{
fl_color(c);
bl; vv(-0.8,-0.8); vv(-0.3,-0.8); vv(-0.3,0.8); vv(-0.8,0.8); el;
bl; vv(-0.3,0.0); vv(0.5,-0.8); vv(0.5,0.8); el;
}
static void gmsh_forward(Fl_Color c)
{
fl_color(c);
bl; vv(0.0,0.8); vv(0.8,0.0); vv(0.0,-0.8); el;
bl; vv(-0.8,0.8); vv(-0.3,0.8); vv(-0.3,-0.8); vv(-0.8,-0.8); el;
}
static void gmsh_back(Fl_Color c)
{
fl_rotate(180);
gmsh_forward(c);
}
static void gmsh_ortho(Fl_Color c)
{
fl_color(c);
bl; vv(-0.8,0.8); vv(0.3,0.8); vv(0.3,-0.3); vv(-0.8,-0.3); el;
bl; vv(-0.3,0.3); vv(0.8,0.3); vv(0.8,-0.8); vv(-0.3,-0.8); el;
fl_begin_line(); vv(-0.8,0.8); vv(-0.3,0.3); fl_end_line();
fl_begin_line(); vv(0.3,0.8); vv(0.8,0.3); fl_end_line();
fl_begin_line(); vv(0.3,-0.3); vv(0.8,-0.8); fl_end_line();
fl_begin_line(); vv(-0.8,-0.3); vv(-0.3,-0.8); fl_end_line();
}
static void gmsh_rotate(Fl_Color c)
{
fl_color(c);
fl_begin_line(); fl_arc(0.0, -0.1, 0.7, 0.0, 270.0); fl_end_line();
fl_begin_polygon(); vv(0.5,0.6); vv(-0.1,0.9); vv(-0.1,0.3); fl_end_polygon();
}
static void gmsh_models(Fl_Color c)
{
fl_color(c);
bl; vv(-0.8,-0.7); vv(0.8,-0.7); el;
bl; vv(-0.8,-0.2); vv(0.8,-0.2); el;
bl; vv(-0.8,0.3); vv(0.8,0.3); el;
bl; vv(-0.8,0.8); vv(0.8,0.8); el;
}
static void gmsh_clscale(Fl_Color c)
{
fl_color(c);
bl; vv(-0.8,0.8); vv(-0.1,0.8); vv(-0.8,0.1); el;
bl; vv(-0.2,0.2); vv(0.9,0.2); vv(-0.2,-0.9); el;
}
static void gmsh_gear(Fl_Color c)
{
fl_color(c);
double w = 0.12;
double h1 = 0.5;
#if defined(WIN32)
double h2 = 1.0;
#else
double h2 = 1.05;
#endif
fl_line_style(FL_SOLID, 3);
fl_begin_line();
fl_circle(0, 0, 0.5);
fl_end_line();
fl_line_style(FL_SOLID);
for(int i = 0; i < 8; i++){
fl_rotate(45);
fl_begin_polygon();
fl_vertex(h1, -w);
fl_vertex(h2, -w);
fl_vertex(h2, w);
fl_vertex(h1, w);
fl_end_polygon();
}
}
static void gmsh_graph(Fl_Color c)
{
fl_color(c);
fl_begin_line(); vv(-0.8,-0.8); vv(-0.8,0.8); vv(0.8,0.8); fl_end_line();
fl_begin_line(); vv(-0.8,0.3); vv(-0.2,-0.2); vv(0.3,0.1); vv(0.8,-0.4); fl_end_line();
}
static void gmsh_search(Fl_Color col)
{
double eps = 0.2;
fl_color(col);
fl_begin_polygon();
vv(-.4-eps, .13+eps); vv(-1.0-eps, .73+eps); vv(-.73-eps, 1.0+eps); vv(-.13-eps, .4+eps);
fl_end_polygon();
fl_line_style(FL_SOLID, 2, 0);
fl_begin_loop(); fl_circle(.2-eps, -.2+eps, .6); fl_end_loop();
}
#undef vv
#undef bl
#undef el
FlGui::FlGui(int argc, char **argv) FlGui::FlGui(int argc, char **argv)
{ {
// set X display // set X display
...@@ -114,6 +235,20 @@ FlGui::FlGui(int argc, char **argv) ...@@ -114,6 +235,20 @@ FlGui::FlGui(int argc, char **argv)
// register image formats not in core fltk library (jpeg/png) // register image formats not in core fltk library (jpeg/png)
fl_register_images(); fl_register_images();
// add our own icons
fl_add_symbol("gmsh_rewind", gmsh_rewind, 1);
fl_add_symbol("gmsh_back", gmsh_back, 1);
fl_add_symbol("gmsh_play", gmsh_play, 1);
fl_add_symbol("gmsh_pause", gmsh_pause, 1);
fl_add_symbol("gmsh_forward", gmsh_forward, 1);
fl_add_symbol("gmsh_ortho", gmsh_ortho, 1);
fl_add_symbol("gmsh_rotate", gmsh_rotate, 1);
fl_add_symbol("gmsh_models", gmsh_models, 1);
fl_add_symbol("gmsh_clscale", gmsh_clscale, 1);
fl_add_symbol("gmsh_gear", gmsh_gear, 1);
fl_add_symbol("gmsh_graph", gmsh_graph, 1);
fl_add_symbol("gmsh_search", gmsh_search, 1);
// load default system icons (for file browser) // load default system icons (for file browser)
Fl_File_Icon::load_system_icons(); Fl_File_Icon::load_system_icons();
......
...@@ -17,7 +17,6 @@ typedef unsigned long intptr_t; ...@@ -17,7 +17,6 @@ typedef unsigned long intptr_t;
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
#include <FL/fl_ask.H> #include <FL/fl_ask.H>
#include <FL/filename.H> #include <FL/filename.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Tree.H> #include <FL/Fl_Tree.H>
#include "FlGui.h" #include "FlGui.h"
#include "mainWindow.h" #include "mainWindow.h"
...@@ -2034,115 +2033,6 @@ static Fl_Menu_Item sysbar_table[] = { ...@@ -2034,115 +2033,6 @@ static Fl_Menu_Item sysbar_table[] = {
#endif #endif
// Icons for the satus bar
#define vv(x,y) fl_vertex(x,y)
#define bl fl_begin_loop()
#define el fl_end_loop()
static void gmsh_play(Fl_Color c)
{
fl_color(c);
bl; vv(-0.3,0.8); vv(0.5,0.0); vv(-0.3,-0.8); el;
}
static void gmsh_pause(Fl_Color c)
{
fl_color(c);
bl; vv(-0.8,-0.8); vv(-0.3,-0.8); vv(-0.3,0.8); vv(-0.8,0.8); el;
bl; vv(0.0,-0.8); vv(0.5,-0.8); vv(0.5,0.8); vv(0.0,0.8); el;
}
static void gmsh_rewind(Fl_Color c)
{
fl_color(c);
bl; vv(-0.8,-0.8); vv(-0.3,-0.8); vv(-0.3,0.8); vv(-0.8,0.8); el;
bl; vv(-0.3,0.0); vv(0.5,-0.8); vv(0.5,0.8); el;
}
static void gmsh_forward(Fl_Color c)
{
fl_color(c);
bl; vv(0.0,0.8); vv(0.8,0.0); vv(0.0,-0.8); el;
bl; vv(-0.8,0.8); vv(-0.3,0.8); vv(-0.3,-0.8); vv(-0.8,-0.8); el;
}
static void gmsh_back(Fl_Color c)
{
fl_rotate(180);
gmsh_forward(c);
}
static void gmsh_ortho(Fl_Color c)
{
fl_color(c);
bl; vv(-0.8,0.8); vv(0.3,0.8); vv(0.3,-0.3); vv(-0.8,-0.3); el;
bl; vv(-0.3,0.3); vv(0.8,0.3); vv(0.8,-0.8); vv(-0.3,-0.8); el;
fl_begin_line(); vv(-0.8,0.8); vv(-0.3,0.3); fl_end_line();
fl_begin_line(); vv(0.3,0.8); vv(0.8,0.3); fl_end_line();
fl_begin_line(); vv(0.3,-0.3); vv(0.8,-0.8); fl_end_line();
fl_begin_line(); vv(-0.8,-0.3); vv(-0.3,-0.8); fl_end_line();
}
static void gmsh_rotate(Fl_Color c)
{
fl_color(c);
fl_begin_line(); fl_arc(0.0, -0.1, 0.7, 0.0, 270.0); fl_end_line();
fl_begin_polygon(); vv(0.5,0.6); vv(-0.1,0.9); vv(-0.1,0.3); fl_end_polygon();
}
static void gmsh_models(Fl_Color c)
{
fl_color(c);
bl; vv(-0.8,-0.7); vv(0.8,-0.7); el;
bl; vv(-0.8,-0.2); vv(0.8,-0.2); el;
bl; vv(-0.8,0.3); vv(0.8,0.3); el;
bl; vv(-0.8,0.8); vv(0.8,0.8); el;
}
static void gmsh_clscale(Fl_Color c)
{
fl_color(c);
bl; vv(-0.8,0.8); vv(-0.1,0.8); vv(-0.8,0.1); el;
bl; vv(-0.2,0.2); vv(0.9,0.2); vv(-0.2,-0.9); el;
}
static void gmsh_gear(Fl_Color c)
{
fl_color(c);
double w = 0.12;
double h1 = 0.5;
#if defined(WIN32)
double h2 = 1.0;
#else
double h2 = 1.05;
#endif
fl_line_style(FL_SOLID, 3);
fl_begin_line();
fl_circle(0, 0, 0.5);
fl_end_line();
fl_line_style(FL_SOLID);
for(int i = 0; i < 8; i++){
fl_rotate(45);
fl_begin_polygon();
fl_vertex(h1, -w);
fl_vertex(h2, -w);
fl_vertex(h2, w);
fl_vertex(h1, w);
fl_end_polygon();
}
}
static void gmsh_graph(Fl_Color c)
{
fl_color(c);
fl_begin_line(); vv(-0.8,-0.8); vv(-0.8,0.8); vv(0.8,0.8); fl_end_line();
fl_begin_line(); vv(-0.8,0.3); vv(-0.2,-0.2); vv(0.3,0.1); vv(0.8,-0.4); fl_end_line();
}
#undef vv
#undef bl
#undef el
static graphicWindow *getGraphicWindow(Fl_Widget *w) static graphicWindow *getGraphicWindow(Fl_Widget *w)
{ {
if(!w || !w->parent()) return FlGui::instance()->graph[0]; if(!w || !w->parent()) return FlGui::instance()->graph[0];
...@@ -2558,22 +2448,6 @@ class mainWindowSpecialResize : public mainWindow { ...@@ -2558,22 +2448,6 @@ class mainWindowSpecialResize : public mainWindow {
graphicWindow::graphicWindow(bool main, int numTiles, bool detachedMenu) graphicWindow::graphicWindow(bool main, int numTiles, bool detachedMenu)
: _autoScrollMessages(true) : _autoScrollMessages(true)
{ {
static bool first = true;
if(first){
fl_add_symbol("gmsh_rewind", gmsh_rewind, 1);
fl_add_symbol("gmsh_back", gmsh_back, 1);
fl_add_symbol("gmsh_play", gmsh_play, 1);
fl_add_symbol("gmsh_pause", gmsh_pause, 1);
fl_add_symbol("gmsh_forward", gmsh_forward, 1);
fl_add_symbol("gmsh_ortho", gmsh_ortho, 1);
fl_add_symbol("gmsh_rotate", gmsh_rotate, 1);
fl_add_symbol("gmsh_models", gmsh_models, 1);
fl_add_symbol("gmsh_clscale", gmsh_clscale, 1);
fl_add_symbol("gmsh_gear", gmsh_gear, 1);
fl_add_symbol("gmsh_graph", gmsh_graph, 1);
first = false;
}
int mh = main ? BH : 0; // menu bar height int mh = main ? BH : 0; // menu bar height
#if defined(__APPLE__) #if defined(__APPLE__)
if(CTX::instance()->systemMenuBar) mh = 0; if(CTX::instance()->systemMenuBar) mh = 0;
......
...@@ -335,7 +335,7 @@ helpWindow::helpWindow() ...@@ -335,7 +335,7 @@ helpWindow::helpWindow()
o->box(FL_DOWN_BOX); o->box(FL_DOWN_BOX);
o->color(FL_BACKGROUND2_COLOR); o->color(FL_BACKGROUND2_COLOR);
search = new Fl_Input search = new Fl_Input
(3 * WB + 2 * BW + 25, WB + 2, BW - 27, BH - 4, "@search"); (3 * WB + 2 * BW + 25, WB + 2, BW - 27, BH - 4, "@gmsh_search");
search->box(FL_FLAT_BOX); search->box(FL_FLAT_BOX);
search->callback(help_options_cb); search->callback(help_options_cb);
search->when(FL_WHEN_CHANGED); search->when(FL_WHEN_CHANGED);
......
?: new single-window GUI, with dynamically customizable widget tree; faster ?: new single-window GUI, with dynamically customizable widget tree; faster
STEP/BRep import; arbitrary size image export; faster 2D Delaunay/Frontal STEP/BRep import; arbitrary size image export; faster 2D Delaunay/Frontal
algorithms; minor bug fixes. algorithms; full option viewer/editor; minor bug fixes.
2.6.1 (July 15, 2012): minor improvements and bug fixes. 2.6.1 (July 15, 2012): minor improvements and bug fixes.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment