Select Git revision
Get_Geometry.h
GUI_Extras.cpp 15.81 KiB
// $Id: GUI_Extras.cpp,v 1.14 2006-01-06 00:34:23 geuzaine Exp $
//
// Copyright (C) 1997-2006 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>.
#include "Gmsh.h"
#include "GmshUI.h"
#include "Mesh.h"
#include "File_Picker.h"
#include "Shortcut_Window.h"
#include "CreateFile.h"
#include "Options.h"
#include "Context.h"
#include "Draw.h"
#include <FL/Fl_Button.H>
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Value_Slider.H>
#include <FL/Fl_Menu_Window.H>
#include <errno.h>
extern Context_T CTX;
// File chooser
static File_Picker *fc = NULL;
int file_chooser(int multi, int create, const char *message,
const char *filter, char *fname)
{
static char thefilter[1024] = "";
static int thefilterindex = 0;
Fl_File_Chooser::show_label = "Format:";
Fl_File_Chooser::all_files_label = "All files (*)";
if(strncmp(thefilter, filter, 1024)) {
// reset the filter and the selection if the filter has changed
strncpy(thefilter, filter, 1024);
thefilterindex = 0;
}
if(!fc) {
fc = new File_Picker(getenv("PWD") ? "." : CTX.home_dir, thefilter,
Fl_File_Chooser::SINGLE, message);
fc->position(CTX.file_chooser_position[0], CTX.file_chooser_position[1]);
}
if(multi)
fc->type(Fl_File_Chooser::MULTI);
else if(create)
fc->type(Fl_File_Chooser::CREATE);
else
fc->type(Fl_File_Chooser::SINGLE);