diff --git a/Fltk/Bitmaps.h b/Fltk/Bitmaps.h deleted file mode 100644 index 8f345a44d5494d03680a6707cd4c5fb340307a8c..0000000000000000000000000000000000000000 --- a/Fltk/Bitmaps.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef _BITMAPS_H_ -#define _BITMAPS_H_ - -// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA. -// -// Please report all bugs and problems to <gmsh@geuz.org>. - -// Standard Gmsh Unix icon - -#if !defined(WIN32) && !defined(__APPLE__) -#define gmsh32x32_width 32 -#define gmsh32x32_height 32 -static char gmsh32x32_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x40, 0x03, 0x00, - 0x00, 0x40, 0x03, 0x00, 0x00, 0x20, 0x07, 0x00, 0x00, 0x20, 0x07, 0x00, - 0x00, 0x10, 0x0f, 0x00, 0x00, 0x10, 0x0f, 0x00, 0x00, 0x08, 0x1f, 0x00, - 0x00, 0x08, 0x1f, 0x00, 0x00, 0x04, 0x3f, 0x00, 0x00, 0x04, 0x3f, 0x00, - 0x00, 0x02, 0x7f, 0x00, 0x00, 0x02, 0x7f, 0x00, 0x00, 0x01, 0xff, 0x00, - 0x00, 0x01, 0xff, 0x00, 0x80, 0x00, 0xff, 0x01, 0x80, 0x00, 0xff, 0x01, - 0x40, 0x00, 0xff, 0x03, 0x40, 0x00, 0xff, 0x03, 0x20, 0x00, 0xff, 0x07, - 0x20, 0x00, 0xff, 0x07, 0x10, 0x00, 0xff, 0x0f, 0x10, 0x00, 0xff, 0x0f, - 0x08, 0x00, 0xff, 0x1f, 0x08, 0x00, 0xff, 0x1f, 0x04, 0x40, 0xfd, 0x3f, - 0x04, 0xa8, 0xea, 0x3f, 0x02, 0x55, 0x55, 0x7f, 0xa2, 0xaa, 0xaa, 0x7a, - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }; -#endif - -// 'Abort' bitmap -// disabled until the mesh thread is back -/* -#define abort_width 13 -#define abort_height 13 -static char abort_bits[] = { - 0x00,0xe0,0x40,0xe0,0x40,0xe0,0x50,0xe1,0x48,0xe2,0x44,0xe4,0x44,0xe4,0x44, - 0xe4,0x04,0xe4,0x04,0xe4,0x08,0xe2,0xf0,0xe1,0x00,0xe0}; -*/ - -// 'Play button' bitmap - -#define start_width 9 -#define start_height 13 -static char start_bits[] = { - 0x00,0xfe,0x06,0xfe,0x0a,0xfe,0x12,0xfe,0x22,0xfe,0x42,0xfe,0x82,0xfe,0x42, - 0xfe,0x22,0xfe,0x12,0xfe,0x0a,0xfe,0x06,0xfe,0x00,0xfe}; - -// 'Pause button' bitmap - -#define stop_width 9 -#define stop_height 13 -static char stop_bits[] = { - 0x00,0xfe,0xee,0xfe,0xaa,0xfe,0xaa,0xfe,0xaa,0xfe,0xaa,0xfe,0xaa,0xfe,0xaa, - 0xfe,0xaa,0xfe,0xaa,0xfe,0xaa,0xfe,0xee,0xfe,0x00,0xfe}; - -// 'Rewind button' bitmap - -#define rewind_width 12 -#define rewind_height 13 -static char rewind_bits[] = { - 0x00,0xf0,0x0e,0xf6,0x0a,0xf5,0x8a,0xf4,0x4a,0xf4,0x2a,0xf4,0x1a,0xf4,0x2a, - 0xf4,0x4a,0xf4,0x8a,0xf4,0x0a,0xf5,0x0e,0xf6,0x00,0xf0}; - -// 'Orthographic projection' bitmap -#define ortho_width 13 -#define ortho_height 13 -static unsigned char ortho_bits[] = { - 0x00, 0x00, 0xf0, 0x0f, 0x18, 0x0c, 0x14, 0x0a, 0xfe, 0x09, 0x12, 0x09, - 0x12, 0x09, 0x12, 0x09, 0xf2, 0x0f, 0x0a, 0x05, 0x06, 0x03, 0xfe, 0x01, - 0x00, 0x00 }; - -// '90 degrees rotation' bitmap -#define rotate_width 12 -#define rotate_height 13 -static unsigned char rotate_bits[] = { - 0x00, 0x00, 0xf0, 0x00, 0x08, 0x01, 0x04, 0x02, 0x02, 0x04, 0x02, 0x04, - 0x02, 0x04, 0x02, 0x00, 0x24, 0x00, 0x68, 0x00, 0xf0, 0x00, 0x60, 0x00, - 0x20, 0x00 }; - -// 'Step backward button' bitmap -#define stepbackward_width 12 -#define stepbackward_height 13 -static char stepbackward_bits[] = { - 0x00,0xf0,0xc0,0xf6,0x20,0xf5,0x90,0xf4,0x48,0xf4,0x24,0xf4,0x12,0xf4,0x24, - 0xf4,0x48,0xf4,0x90,0xf4,0x20,0xf5,0xc0,0xf6,0x00,0xf0}; - -// 'Step forward button' bitmap -#define stepforward_width 12 -#define stepforward_height 13 -static char stepforward_bits[] = { - 0x00,0xf0,0x36,0xf0,0x4a,0xf0,0x92,0xf0,0x22,0xf1,0x42,0xf2,0x82,0xf4,0x42, - 0xf2,0x22,0xf1,0x92,0xf0,0x4a,0xf0,0x36,0xf0,0x00,0xf0}; - -#endif diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 43d742f2582a630e7f88f6d045995dc99c112694..857a613b5e757062a2d3f95ace339e34101c1982 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.615 2007-05-19 16:40:03 geuzaine Exp $ +// $Id: GUI.cpp,v 1.616 2007-05-23 21:20:57 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -28,7 +28,6 @@ #include "Draw.h" #include "GUI.h" #include "Callbacks.h" -#include "Bitmaps.h" #include "Win32Icon.h" #include "OpenFile.h" #include "CommandLine.h" @@ -892,16 +891,24 @@ GUI::GUI(int argc, char **argv) // Nothing to do here #else fl_open_display(); - Pixmap p1 = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), - gmsh32x32_bits, gmsh32x32_width, - gmsh32x32_height); - Pixmap p2 = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), - gmsh32x32_bits, gmsh32x32_width, - gmsh32x32_height); - m_window->icon((char *)p1); - g_window->icon((char *)p2); + static char gmsh32x32[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x40, 0x03, 0x00, + 0x00, 0x40, 0x03, 0x00, 0x00, 0x20, 0x07, 0x00, 0x00, 0x20, 0x07, 0x00, + 0x00, 0x10, 0x0f, 0x00, 0x00, 0x10, 0x0f, 0x00, 0x00, 0x08, 0x1f, 0x00, + 0x00, 0x08, 0x1f, 0x00, 0x00, 0x04, 0x3f, 0x00, 0x00, 0x04, 0x3f, 0x00, + 0x00, 0x02, 0x7f, 0x00, 0x00, 0x02, 0x7f, 0x00, 0x00, 0x01, 0xff, 0x00, + 0x00, 0x01, 0xff, 0x00, 0x80, 0x00, 0xff, 0x01, 0x80, 0x00, 0xff, 0x01, + 0x40, 0x00, 0xff, 0x03, 0x40, 0x00, 0xff, 0x03, 0x20, 0x00, 0xff, 0x07, + 0x20, 0x00, 0xff, 0x07, 0x10, 0x00, 0xff, 0x0f, 0x10, 0x00, 0xff, 0x0f, + 0x08, 0x00, 0xff, 0x1f, 0x08, 0x00, 0xff, 0x1f, 0x04, 0x40, 0xfd, 0x3f, + 0x04, 0xa8, 0xea, 0x3f, 0x02, 0x55, 0x55, 0x7f, 0xa2, 0xaa, 0xaa, 0x7a, + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }; + m_window->icon((char*)XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), + gmsh32x32, 32, 32)); + g_window->icon((char*)XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), + gmsh32x32, 32, 32)); #endif - + // we must show() m_window first (at least on Win32, since the icon // is associated with m_window); and besides, it's probably better // to have the initial focus on g_window so that we can directly @@ -1305,6 +1312,69 @@ int GUI::get_context() // Create the graphic window +#define vv(x,y) fl_vertex(x,y) +#define bl fl_begin_loop() +#define el fl_end_loop() + +void gmsh_play(Fl_Color c) +{ + fl_color(c); + bl; vv(-0.4,0.8); vv(0.4,0.0); vv(-0.4,-0.8); el; +} + +void gmsh_pause(Fl_Color c) +{ + fl_color(c); + bl; vv(-0.6,-0.8); vv(-0.1,-0.8); vv(-0.1,0.8); vv(-0.6,0.8); el; + bl; vv(0.2,-0.8); vv(0.7,-0.8); vv(0.7,0.8); vv(0.2,0.8); el; +} + +void gmsh_rewind(Fl_Color c) +{ + fl_color(c); + fl_rotate(180); + bl; vv(0.2,0.8); vv(0.6,0.8); vv(0.6,-0.8); vv(0.2,-0.8); el; + bl; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); el; +} + +void gmsh_forward(Fl_Color c) +{ + fl_color(c); + bl; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); el; + fl_begin_line(); vv(-0.2,0.8); vv(0.6,0.0); fl_end_line(); + fl_begin_line(); vv(-0.2,0.8); vv(-0.2,0.4); fl_end_line(); + fl_begin_line(); vv(-0.2,-0.8); vv(0.6,0.0); fl_end_line(); + fl_begin_line(); vv(-0.2,-0.8); vv(-0.2,-0.4); fl_end_line(); +} + +void gmsh_back(Fl_Color c) +{ + fl_rotate(180); + gmsh_forward(c); +} + +void gmsh_ortho(Fl_Color c) +{ + fl_color(c); + bl; vv(-0.8,0.8); vv(0.4,0.8); vv(0.4,-0.4); vv(-0.8,-0.4); el; + bl; vv(-0.4,0.4); vv(0.8,0.4); vv(0.8,-0.8); vv(-0.4,-0.8); el; + fl_begin_line(); vv(-0.8,0.8); vv(-0.4,0.4); fl_end_line(); + fl_begin_line(); vv(0.4,0.8); vv(0.8,0.4); fl_end_line(); + fl_begin_line(); vv(0.4,-0.4); vv(0.8,-0.8); fl_end_line(); + fl_begin_line(); vv(-0.8,-0.4); vv(-0.4,-0.8); fl_end_line(); +} + +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,1); vv(-0.1,0.2); fl_end_polygon(); +} + +#undef vv +#undef bl +#undef el + void GUI::create_graphic_window() { if(g_window) { @@ -1312,8 +1382,16 @@ void GUI::create_graphic_window() return; } + 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); + int sh = 2 * fontsize - 4; // status bar height - int sw = fontsize + 4; // status button width + int sw = fontsize + 3; // status button width int width = CTX.viewport[2] - CTX.viewport[0]; int glheight = CTX.viewport[3] - CTX.viewport[1]; int height = glheight + sh; @@ -1344,24 +1422,20 @@ void GUI::create_graphic_window() g_status_butt[2]->callback(status_xyz1p_cb, (void *)"z"); g_status_butt[2]->tooltip("Set +Z or -Z view (Alt+z or Alt+Shift+z)"); - g_status_butt[4] = new Fl_Button(x, glheight + 2, sw, sht); + g_status_butt[4] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_rotate"); x += sw; g_status_butt[4]->callback(status_xyz1p_cb, (void *)"r"); g_status_butt[4]->tooltip("Rotate +90 or -90 degrees"); - rotate_bmp = new Fl_Bitmap(rotate_bits, rotate_width, rotate_height); - rotate_bmp->label(g_status_butt[4]); g_status_butt[3] = new Fl_Button(x, glheight + 2, 2 * fontsize, sht, "1:1"); x += 2 * fontsize; g_status_butt[3]->callback(status_xyz1p_cb, (void *)"1:1"); g_status_butt[3]->tooltip("Set unit scale"); - g_status_butt[8] = new Fl_Button(x, glheight + 2, sw, sht); + g_status_butt[8] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_ortho"); x += sw; g_status_butt[8]->callback(status_xyz1p_cb, (void *)"p"); g_status_butt[8]->tooltip("Toggle projection mode (Alt+o or Alt+Shift+o)"); - ortho_bmp = new Fl_Bitmap(ortho_bits, ortho_width, ortho_height); - ortho_bmp->label(g_status_butt[8]); g_status_butt[9] = new Fl_Button(x, glheight + 2, sw, sht, "S"); x += sw; @@ -1373,39 +1447,28 @@ void GUI::create_graphic_window() g_status_butt[5]->callback(status_xyz1p_cb, (void *)"?"); g_status_butt[5]->tooltip("Show current options"); - g_status_butt[6] = new Fl_Button(x, glheight + 2, sw, sht); + g_status_butt[6] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_rewind"); x += sw; g_status_butt[6]->callback(status_rewind_cb); g_status_butt[6]->tooltip("Rewind animation"); - rewind_bmp = new Fl_Bitmap(rewind_bits, rewind_width, rewind_height); - rewind_bmp->label(g_status_butt[6]); g_status_butt[6]->deactivate(); - g_status_butt[10] = new Fl_Button(x, glheight + 2, sw, sht); + g_status_butt[10] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_back"); x += sw; g_status_butt[10]->callback(status_stepbackward_cb); g_status_butt[10]->tooltip("Step backward"); - stepbackward_bmp = new Fl_Bitmap(stepbackward_bits, stepbackward_width, - stepbackward_height); - stepbackward_bmp->label(g_status_butt[10]); g_status_butt[10]->deactivate(); - g_status_butt[7] = new Fl_Button(x, glheight + 2, sw, sht); + g_status_butt[7] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_play"); x += sw; g_status_butt[7]->callback(status_play_cb); g_status_butt[7]->tooltip("Play/pause animation"); - start_bmp = new Fl_Bitmap(start_bits, start_width, start_height); - start_bmp->label(g_status_butt[7]); - stop_bmp = new Fl_Bitmap(stop_bits, stop_width, stop_height); g_status_butt[7]->deactivate(); - g_status_butt[11] = new Fl_Button(x, glheight + 2, sw, sht); + g_status_butt[11] = new Fl_Button(x, glheight + 2, sw, sht, "@-1gmsh_forward"); x += sw; g_status_butt[11]->callback(status_stepforward_cb); g_status_butt[11]->tooltip("Step forward"); - stepforward_bmp = new Fl_Bitmap(stepforward_bits, stepforward_width, - stepforward_height); - stepforward_bmp->label(g_status_butt[11]); g_status_butt[11]->deactivate(); for(int i = 0; i < 12; i++) { @@ -1460,11 +1523,11 @@ void GUI::set_anim_buttons(int mode) { if(mode) { g_status_butt[7]->callback(status_play_cb); - start_bmp->label(g_status_butt[7]); + g_status_butt[7]->label("@-1gmsh_play"); } else { g_status_butt[7]->callback(status_pause_cb); - stop_bmp->label(g_status_butt[7]); + g_status_butt[7]->label("@-1gmsh_pause"); } } diff --git a/Fltk/GUI.h b/Fltk/GUI.h index 7f29505c6708a14428fea144e8f8924c3763d588..e0507a0059ff109bc1e5fb910058a2587d45f08e 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -126,10 +126,6 @@ class GUI{ int MH, fontsize; Fl_Scroll *m_scroll; - // Bitmaps - Fl_Bitmap *abort_bmp, *rotate_bmp, *ortho_bmp; - Fl_Bitmap *start_bmp, *stop_bmp, *rewind_bmp, *stepbackward_bmp, *stepforward_bmp; - void add_multiline_in_browser(Fl_Browser *o, char* prefix, char *str); public: diff --git a/Fltk/Makefile b/Fltk/Makefile index 38df86aee5ee12c1c52fed5c862e4c9cd26730b2..30dc6e78f6ee9be488b23c2d6fcd098d1502d8ee 100644 --- a/Fltk/Makefile +++ b/Fltk/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.131 2007-04-21 19:40:00 geuzaine Exp $ +# $Id: Makefile,v 1.132 2007-05-23 21:20:57 geuzaine Exp $ # # Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle # @@ -106,7 +106,7 @@ GUI.o: GUI.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \ ../Common/ColorTable.h ../Common/VertexArray.h ../Common/SmoothData.h \ ../Common/AdaptiveViews.h ../Common/GmshMatrix.h GUI.h Opengl_Window.h \ Colorbar_Window.h Popup_Button.h SpherePosition_Widget.h Callbacks.h \ - Bitmaps.h Win32Icon.h ../Parser/OpenFile.h ../Common/CommandLine.h \ + Win32Icon.h ../Parser/OpenFile.h ../Common/CommandLine.h \ ../Mesh/Generator.h Solvers.h ../Plugin/PluginManager.h \ ../Plugin/Plugin.h Shortcut_Window.h GUI_Extras.o: GUI_Extras.cpp ../Common/Gmsh.h ../Common/Message.h \