Fixed VC++.NET project files (FLTK, FLTKDLL, FLUID).

Fixed Cygwin FLUID compile problem (STR #772)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4192 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2005-03-25 21:12:15 +00:00
parent f5ed012b28
commit f6a137b998
7 changed files with 597 additions and 584 deletions

View File

@ -46,7 +46,7 @@
#include "alignment_panel.h" #include "alignment_panel.h"
#include "function_panel.h" #include "function_panel.h"
#include "template_panel.h" #include "template_panel.h"
#ifndef WIN32 #if !defined(WIN32) || defined(__CYGWIN__)
# include "print_panel.h" # include "print_panel.h"
#endif // !WIN32 #endif // !WIN32
@ -251,7 +251,11 @@ void save_template_cb(Fl_Widget *, void *) {
fluid_prefs.getUserdataPath(filename, sizeof(filename)); fluid_prefs.getUserdataPath(filename, sizeof(filename));
strlcat(filename, "templates", sizeof(filename)); strlcat(filename, "templates", sizeof(filename));
#if defined(WIN32) && !defined(__CYGWIN__)
if (access(filename, 0)) mkdir(filename);
#else
if (access(filename, 0)) mkdir(filename, 0777); if (access(filename, 0)) mkdir(filename, 0777);
#endif // WIN32 && !__CYGWIN__
strlcat(filename, "/", sizeof(filename)); strlcat(filename, "/", sizeof(filename));
strlcat(filename, safename, sizeof(filename)); strlcat(filename, safename, sizeof(filename));
@ -848,7 +852,7 @@ void manual_cb(Fl_Widget *, void *) {
// Load and show the print dialog... // Load and show the print dialog...
void print_menu_cb(Fl_Widget *, void *) { void print_menu_cb(Fl_Widget *, void *) {
#ifdef WIN32 #if defined(WIN32) && !defined(__CYGWIN__)
fl_message("Sorry, printing is not yet implemented on Windows..."); fl_message("Sorry, printing is not yet implemented on Windows...");
} }
#else #else
@ -1300,7 +1304,7 @@ void print_cb(Fl_Return_Button *, void *) {
print_progress->hide(); print_progress->hide();
print_panel->hide(); print_panel->hide();
} }
#endif // WIN32 #endif // WIN32 && !__CYGWIN__
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////

View File

@ -1,260 +1,260 @@
// //
// "$Id$" // "$Id$"
// //
// FLUID template support for the Fast Light Tool Kit (FLTK). // FLUID template support for the Fast Light Tool Kit (FLTK).
// //
// Copyright 1998-2005 by Bill Spitzak and others. // Copyright 1998-2005 by Bill Spitzak and others.
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details. // Library General Public License for more details.
// //
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA. // USA.
// //
// Please report all bugs and problems on the following page: // Please report all bugs and problems on the following page:
// //
// http://www.fltk.org/str.php // http://www.fltk.org/str.php
// //
// generated by Fast Light User Interface Designer (fluid) version 1.0107 // generated by Fast Light User Interface Designer (fluid) version 1.0107
#include "template_panel.h" #include "template_panel.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "../src/flstring.h" #include "../src/flstring.h"
#include <errno.h> #include <errno.h>
#include <FL/filename.H> #include <FL/filename.H>
#include <FL/fl_ask.H> #include <FL/fl_ask.H>
#include <FL/Fl_Shared_Image.H> #include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Preferences.H> #include <FL/Fl_Preferences.H>
#ifdef WIN32 #if defined(WIN32) && !defined(__CYGWIN__)
#include <io.h> #include <io.h>
#else #else
#include <unistd.h> #include <unistd.h>
#endif // WIN32 #endif // WIN32 && !__CYGWIN__
extern Fl_Preferences fluid_prefs; extern Fl_Preferences fluid_prefs;
Fl_Double_Window *template_panel=(Fl_Double_Window *)0; Fl_Double_Window *template_panel=(Fl_Double_Window *)0;
static void cb_template_panel(Fl_Double_Window*, void*) { static void cb_template_panel(Fl_Double_Window*, void*) {
Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image(); Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
if (img) img->release(); if (img) img->release();
template_preview->image(0); template_preview->image(0);
template_browser->deselect(); template_browser->deselect();
template_name->value(""); template_name->value("");
template_instance->value(""); template_instance->value("");
template_panel->hide(); template_panel->hide();
} }
Fl_Browser *template_browser=(Fl_Browser *)0; Fl_Browser *template_browser=(Fl_Browser *)0;
static void cb_template_browser(Fl_Browser*, void*) { static void cb_template_browser(Fl_Browser*, void*) {
if (Fl::event_clicks()) { if (Fl::event_clicks()) {
template_panel->hide(); template_panel->hide();
return; return;
} }
Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image(); Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
if (img) img->release(); if (img) img->release();
template_preview->image(0); template_preview->image(0);
template_preview->redraw(); template_preview->redraw();
int item = template_browser->value(); int item = template_browser->value();
if (item <= 1) template_instance->deactivate(); if (item <= 1) template_instance->deactivate();
else template_instance->activate(); else template_instance->activate();
if (item < 1) { if (item < 1) {
template_submit->deactivate(); template_submit->deactivate();
template_delete->deactivate(); template_delete->deactivate();
return; return;
} }
template_submit->activate(); template_submit->activate();
const char *flfile = (const char *)template_browser->data(item); const char *flfile = (const char *)template_browser->data(item);
if (!flfile) { if (!flfile) {
template_delete->deactivate(); template_delete->deactivate();
return; return;
} }
template_name->value(template_browser->text(item)); template_name->value(template_browser->text(item));
template_delete->activate(); template_delete->activate();
char pngfile[1024], *ext; char pngfile[1024], *ext;
strlcpy(pngfile, flfile, sizeof(pngfile)); strlcpy(pngfile, flfile, sizeof(pngfile));
if ((ext = strrchr(pngfile, '.')) == NULL) return; if ((ext = strrchr(pngfile, '.')) == NULL) return;
strcpy(ext, ".png"); strcpy(ext, ".png");
img = Fl_Shared_Image::get(pngfile); img = Fl_Shared_Image::get(pngfile);
if (img) { if (img) {
template_preview->image(img); template_preview->image(img);
template_preview->redraw(); template_preview->redraw();
}; };
} }
Fl_Box *template_preview=(Fl_Box *)0; Fl_Box *template_preview=(Fl_Box *)0;
Fl_Input *template_name=(Fl_Input *)0; Fl_Input *template_name=(Fl_Input *)0;
static void cb_template_name(Fl_Input*, void*) { static void cb_template_name(Fl_Input*, void*) {
if (strlen(template_name->value())) { if (strlen(template_name->value())) {
template_submit->activate(); template_submit->activate();
if (Fl::event_key() == FL_Enter) template_panel->hide(); if (Fl::event_key() == FL_Enter) template_panel->hide();
} else template_submit->deactivate(); } else template_submit->deactivate();
} }
Fl_Input *template_instance=(Fl_Input *)0; Fl_Input *template_instance=(Fl_Input *)0;
Fl_Button *template_delete=(Fl_Button *)0; Fl_Button *template_delete=(Fl_Button *)0;
static void cb_Cancel(Fl_Button*, void*) { static void cb_Cancel(Fl_Button*, void*) {
Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image(); Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
if (img) img->release(); if (img) img->release();
template_preview->image(0); template_preview->image(0);
template_browser->deselect(); template_browser->deselect();
template_name->value(""); template_name->value("");
template_instance->value(""); template_instance->value("");
template_panel->hide(); template_panel->hide();
} }
Fl_Return_Button *template_submit=(Fl_Return_Button *)0; Fl_Return_Button *template_submit=(Fl_Return_Button *)0;
static void cb_template_submit(Fl_Return_Button*, void*) { static void cb_template_submit(Fl_Return_Button*, void*) {
Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image(); Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
if (img) img->release(); if (img) img->release();
template_preview->image(0); template_preview->image(0);
template_panel->hide(); template_panel->hide();
} }
Fl_Double_Window* make_template_panel() { Fl_Double_Window* make_template_panel() {
Fl_Double_Window* w; Fl_Double_Window* w;
{ Fl_Double_Window* o = template_panel = new Fl_Double_Window(460, 355, "New/Save Template"); { Fl_Double_Window* o = template_panel = new Fl_Double_Window(460, 355, "New/Save Template");
w = o; w = o;
o->callback((Fl_Callback*)cb_template_panel); o->callback((Fl_Callback*)cb_template_panel);
{ Fl_Browser* o = template_browser = new Fl_Browser(10, 28, 180, 250, "Available Templates:"); { Fl_Browser* o = template_browser = new Fl_Browser(10, 28, 180, 250, "Available Templates:");
o->type(2); o->type(2);
o->labelfont(1); o->labelfont(1);
o->callback((Fl_Callback*)cb_template_browser); o->callback((Fl_Callback*)cb_template_browser);
o->align(FL_ALIGN_TOP_LEFT); o->align(FL_ALIGN_TOP_LEFT);
o->when(3); o->when(3);
} }
{ Fl_Box* o = template_preview = new Fl_Box(200, 28, 250, 250); { Fl_Box* o = template_preview = new Fl_Box(200, 28, 250, 250);
o->box(FL_THIN_DOWN_BOX); o->box(FL_THIN_DOWN_BOX);
o->align(69|FL_ALIGN_INSIDE); o->align(69|FL_ALIGN_INSIDE);
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(o);
} }
{ Fl_Input* o = template_name = new Fl_Input(124, 288, 326, 25, "Template Name:"); { Fl_Input* o = template_name = new Fl_Input(124, 288, 326, 25, "Template Name:");
o->labelfont(1); o->labelfont(1);
o->textfont(4); o->textfont(4);
o->callback((Fl_Callback*)cb_template_name); o->callback((Fl_Callback*)cb_template_name);
o->when(3); o->when(3);
} }
{ Fl_Input* o = template_instance = new Fl_Input(124, 288, 326, 25, "Instance Name:"); { Fl_Input* o = template_instance = new Fl_Input(124, 288, 326, 25, "Instance Name:");
o->labelfont(1); o->labelfont(1);
o->textfont(4); o->textfont(4);
o->hide(); o->hide();
} }
{ Fl_Group* o = new Fl_Group(10, 323, 440, 25); { Fl_Group* o = new Fl_Group(10, 323, 440, 25);
{ Fl_Button* o = template_delete = new Fl_Button(10, 323, 133, 25, "Delete Template"); { Fl_Button* o = template_delete = new Fl_Button(10, 323, 133, 25, "Delete Template");
o->callback((Fl_Callback*)template_delete_cb); o->callback((Fl_Callback*)template_delete_cb);
} }
{ Fl_Box* o = new Fl_Box(153, 323, 126, 25); { Fl_Box* o = new Fl_Box(153, 323, 126, 25);
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(o);
} }
{ Fl_Button* o = new Fl_Button(289, 323, 72, 25, "Cancel"); { Fl_Button* o = new Fl_Button(289, 323, 72, 25, "Cancel");
o->callback((Fl_Callback*)cb_Cancel); o->callback((Fl_Callback*)cb_Cancel);
} }
{ Fl_Return_Button* o = template_submit = new Fl_Return_Button(371, 323, 79, 25, "Save"); { Fl_Return_Button* o = template_submit = new Fl_Return_Button(371, 323, 79, 25, "Save");
o->callback((Fl_Callback*)cb_template_submit); o->callback((Fl_Callback*)cb_template_submit);
} }
o->end(); o->end();
} }
o->set_modal(); o->set_modal();
o->end(); o->end();
} }
return w; return w;
} }
void template_clear() { void template_clear() {
int i; int i;
void *filename; void *filename;
for (i = 1; i <= template_browser->size(); i ++) { for (i = 1; i <= template_browser->size(); i ++) {
if ((filename = template_browser->data(i)) != NULL) free(filename); if ((filename = template_browser->data(i)) != NULL) free(filename);
} }
template_browser->deselect(); template_browser->deselect();
template_browser->clear(); template_browser->clear();
} }
void template_delete_cb(Fl_Button *, void *) { void template_delete_cb(Fl_Button *, void *) {
int item = template_browser->value(); int item = template_browser->value();
if (item < 1) return; if (item < 1) return;
const char *name = template_browser->text(item); const char *name = template_browser->text(item);
const char *flfile = (const char *)template_browser->data(item); const char *flfile = (const char *)template_browser->data(item);
if (!flfile) return; if (!flfile) return;
if (!fl_choice("Are you sure you want to delete the template \"%s\"?", if (!fl_choice("Are you sure you want to delete the template \"%s\"?",
"Cancel", "Delete", 0, name)) return; "Cancel", "Delete", 0, name)) return;
if (unlink(flfile)) { if (unlink(flfile)) {
fl_alert("Unable to delete template \"%s\":\n%s", name, strerror(errno)); fl_alert("Unable to delete template \"%s\":\n%s", name, strerror(errno));
return; return;
} }
template_browser->remove(item); template_browser->remove(item);
template_browser->do_callback(); template_browser->do_callback();
} }
void template_load() { void template_load() {
int i; int i;
char name[1024], filename[1024], path[1024], *ptr; char name[1024], filename[1024], path[1024], *ptr;
struct dirent **files; struct dirent **files;
int num_files; int num_files;
fluid_prefs.getUserdataPath(path, sizeof(path)); fluid_prefs.getUserdataPath(path, sizeof(path));
strlcat(path, "templates", sizeof(path)); strlcat(path, "templates", sizeof(path));
num_files = fl_filename_list(path, &files); num_files = fl_filename_list(path, &files);
for (i = 0; i < num_files; i ++) { for (i = 0; i < num_files; i ++) {
if (fl_filename_match(files[i]->d_name, "*.fl")) { if (fl_filename_match(files[i]->d_name, "*.fl")) {
// Format the name as the filename with "_" replaced with " " // Format the name as the filename with "_" replaced with " "
// and without the trailing ".fl"... // and without the trailing ".fl"...
strlcpy(name, files[i]->d_name, sizeof(name)); strlcpy(name, files[i]->d_name, sizeof(name));
*strstr(name, ".fl") = '\0'; *strstr(name, ".fl") = '\0';
for (ptr = name; *ptr; ptr ++) { for (ptr = name; *ptr; ptr ++) {
if (*ptr == '_') *ptr = ' '; if (*ptr == '_') *ptr = ' ';
} }
// Add the template to the browser... // Add the template to the browser...
snprintf(filename, sizeof(filename), "%s/%s", path, files[i]->d_name); snprintf(filename, sizeof(filename), "%s/%s", path, files[i]->d_name);
template_browser->add(name, strdup(filename)); template_browser->add(name, strdup(filename));
} }
free(files[i]); free(files[i]);
} }
if (num_files > 0) free(files); if (num_files > 0) free(files);
} }
// //
// End of "$Id$". // End of "$Id$".
// //

View File

@ -1,244 +1,244 @@
# data file for the Fltk User Interface Designer (fluid) # data file for the Fltk User Interface Designer (fluid)
version 1.0107 version 1.0107
header_name {.h} header_name {.h}
code_name {.cxx} code_name {.cxx}
comment {// comment {//
// "$Id$" // "$Id$"
// //
// FLUID template support for the Fast Light Tool Kit (FLTK). // FLUID template support for the Fast Light Tool Kit (FLTK).
// //
// Copyright 1998-2005 by Bill Spitzak and others. // Copyright 1998-2005 by Bill Spitzak and others.
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details. // Library General Public License for more details.
// //
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA. // USA.
// //
// Please report all bugs and problems on the following page: // Please report all bugs and problems on the following page:
// //
// http://www.fltk.org/str.php // http://www.fltk.org/str.php
// //
} {in_source in_header } {in_source in_header
} }
decl {\#include <stdio.h>} {} decl {\#include <stdio.h>} {}
decl {\#include <stdlib.h>} {} decl {\#include <stdlib.h>} {}
decl {\#include "../src/flstring.h"} {} decl {\#include "../src/flstring.h"} {}
decl {\#include <errno.h>} {} decl {\#include <errno.h>} {}
decl {\#include <FL/filename.H>} {} decl {\#include <FL/filename.H>} {}
decl {\#include <FL/fl_ask.H>} {} decl {\#include <FL/fl_ask.H>} {}
decl {\#include <FL/Fl_Shared_Image.H>} {} decl {\#include <FL/Fl_Shared_Image.H>} {}
decl {\#include <FL/Fl_Preferences.H>} {} decl {\#include <FL/Fl_Preferences.H>} {}
declblock {\#ifdef WIN32} {after {\#endif // WIN32} declblock {\#if defined(WIN32) && !defined(__CYGWIN__)} {selected after {\#endif // WIN32 && !__CYGWIN__}
} { } {
decl {\#include <io.h>} {} decl {\#include <io.h>} {}
decl {\#else} {} decl {\#else} {}
decl {\#include <unistd.h>} {} decl {\#include <unistd.h>} {}
} }
decl {extern Fl_Preferences fluid_prefs;} {} decl {extern Fl_Preferences fluid_prefs;} {}
Function {make_template_panel()} {open Function {make_template_panel()} {open
} { } {
Fl_Window template_panel { Fl_Window template_panel {
label {New/Save Template} label {New/Save Template}
callback {Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image(); callback {Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
if (img) img->release(); if (img) img->release();
template_preview->image(0); template_preview->image(0);
template_browser->deselect(); template_browser->deselect();
template_name->value(""); template_name->value("");
template_instance->value(""); template_instance->value("");
template_panel->hide();} open template_panel->hide();} open
xywh {340 237 460 355} type Double resizable modal visible xywh {340 237 460 355} type Double resizable modal visible
} { } {
Fl_Browser template_browser { Fl_Browser template_browser {
label {Available Templates:} label {Available Templates:}
callback {if (Fl::event_clicks()) { callback {if (Fl::event_clicks()) {
template_panel->hide(); template_panel->hide();
return; return;
} }
Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image(); Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
if (img) img->release(); if (img) img->release();
template_preview->image(0); template_preview->image(0);
template_preview->redraw(); template_preview->redraw();
int item = template_browser->value(); int item = template_browser->value();
if (item <= 1) template_instance->deactivate(); if (item <= 1) template_instance->deactivate();
else template_instance->activate(); else template_instance->activate();
if (item < 1) { if (item < 1) {
template_submit->deactivate(); template_submit->deactivate();
template_delete->deactivate(); template_delete->deactivate();
return; return;
} }
template_submit->activate(); template_submit->activate();
const char *flfile = (const char *)template_browser->data(item); const char *flfile = (const char *)template_browser->data(item);
if (!flfile) { if (!flfile) {
template_delete->deactivate(); template_delete->deactivate();
return; return;
} }
template_name->value(template_browser->text(item)); template_name->value(template_browser->text(item));
template_delete->activate(); template_delete->activate();
char pngfile[1024], *ext; char pngfile[1024], *ext;
strlcpy(pngfile, flfile, sizeof(pngfile)); strlcpy(pngfile, flfile, sizeof(pngfile));
if ((ext = strrchr(pngfile, '.')) == NULL) return; if ((ext = strrchr(pngfile, '.')) == NULL) return;
strcpy(ext, ".png"); strcpy(ext, ".png");
img = Fl_Shared_Image::get(pngfile); img = Fl_Shared_Image::get(pngfile);
if (img) { if (img) {
template_preview->image(img); template_preview->image(img);
template_preview->redraw(); template_preview->redraw();
}} selected }}
xywh {10 28 180 250} type Hold labelfont 1 align 5 when 3 xywh {10 28 180 250} type Hold labelfont 1 align 5 when 3
} }
Fl_Box template_preview { Fl_Box template_preview {
xywh {200 28 250 250} box THIN_DOWN_BOX align 85 resizable xywh {200 28 250 250} box THIN_DOWN_BOX align 85 resizable
} }
Fl_Input template_name { Fl_Input template_name {
label {Template Name:} label {Template Name:}
callback {if (strlen(template_name->value())) { callback {if (strlen(template_name->value())) {
template_submit->activate(); template_submit->activate();
if (Fl::event_key() == FL_Enter) template_panel->hide(); if (Fl::event_key() == FL_Enter) template_panel->hide();
} else template_submit->deactivate();} } else template_submit->deactivate();}
xywh {124 288 326 25} labelfont 1 when 3 textfont 4 xywh {124 288 326 25} labelfont 1 when 3 textfont 4
} }
Fl_Input template_instance { Fl_Input template_instance {
label {Instance Name:} label {Instance Name:}
xywh {124 288 326 25} labelfont 1 textfont 4 hide xywh {124 288 326 25} labelfont 1 textfont 4 hide
} }
Fl_Group {} { Fl_Group {} {
xywh {10 323 440 25} xywh {10 323 440 25}
} { } {
Fl_Button template_delete { Fl_Button template_delete {
label {Delete Template} label {Delete Template}
callback template_delete_cb callback template_delete_cb
xywh {10 323 133 25} xywh {10 323 133 25}
} }
Fl_Box {} { Fl_Box {} {
xywh {153 323 126 25} resizable xywh {153 323 126 25} resizable
} }
Fl_Button {} { Fl_Button {} {
label Cancel label Cancel
callback {Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image(); callback {Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
if (img) img->release(); if (img) img->release();
template_preview->image(0); template_preview->image(0);
template_browser->deselect(); template_browser->deselect();
template_name->value(""); template_name->value("");
template_instance->value(""); template_instance->value("");
template_panel->hide();} template_panel->hide();}
xywh {289 323 72 25} xywh {289 323 72 25}
} }
Fl_Return_Button template_submit { Fl_Return_Button template_submit {
label Save label Save
callback {Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image(); callback {Fl_Shared_Image *img = (Fl_Shared_Image *)template_preview->image();
if (img) img->release(); if (img) img->release();
template_preview->image(0); template_preview->image(0);
template_panel->hide();} template_panel->hide();}
xywh {371 323 79 25} xywh {371 323 79 25}
} }
} }
} }
} }
Function {template_clear()} {return_type void Function {template_clear()} {return_type void
} { } {
code {int i; code {int i;
void *filename; void *filename;
for (i = 1; i <= template_browser->size(); i ++) { for (i = 1; i <= template_browser->size(); i ++) {
if ((filename = template_browser->data(i)) != NULL) free(filename); if ((filename = template_browser->data(i)) != NULL) free(filename);
} }
template_browser->deselect(); template_browser->deselect();
template_browser->clear();} {} template_browser->clear();} {}
} }
Function {template_delete_cb(Fl_Button *, void *)} {return_type void Function {template_delete_cb(Fl_Button *, void *)} {return_type void
} { } {
code {int item = template_browser->value(); code {int item = template_browser->value();
if (item < 1) return; if (item < 1) return;
const char *name = template_browser->text(item); const char *name = template_browser->text(item);
const char *flfile = (const char *)template_browser->data(item); const char *flfile = (const char *)template_browser->data(item);
if (!flfile) return; if (!flfile) return;
if (!fl_choice("Are you sure you want to delete the template \\"%s\\"?", if (!fl_choice("Are you sure you want to delete the template \\"%s\\"?",
"Cancel", "Delete", 0, name)) return; "Cancel", "Delete", 0, name)) return;
if (unlink(flfile)) { if (unlink(flfile)) {
fl_alert("Unable to delete template \\"%s\\":\\n%s", name, strerror(errno)); fl_alert("Unable to delete template \\"%s\\":\\n%s", name, strerror(errno));
return; return;
} }
template_browser->remove(item); template_browser->remove(item);
template_browser->do_callback();} {} template_browser->do_callback();} {}
} }
Function {template_load()} {open return_type void Function {template_load()} {open return_type void
} { } {
code {int i; code {int i;
char name[1024], filename[1024], path[1024], *ptr; char name[1024], filename[1024], path[1024], *ptr;
struct dirent **files; struct dirent **files;
int num_files; int num_files;
fluid_prefs.getUserdataPath(path, sizeof(path)); fluid_prefs.getUserdataPath(path, sizeof(path));
strlcat(path, "templates", sizeof(path)); strlcat(path, "templates", sizeof(path));
num_files = fl_filename_list(path, &files); num_files = fl_filename_list(path, &files);
for (i = 0; i < num_files; i ++) { for (i = 0; i < num_files; i ++) {
if (fl_filename_match(files[i]->d_name, "*.fl")) { if (fl_filename_match(files[i]->d_name, "*.fl")) {
// Format the name as the filename with "_" replaced with " " // Format the name as the filename with "_" replaced with " "
// and without the trailing ".fl"... // and without the trailing ".fl"...
strlcpy(name, files[i]->d_name, sizeof(name)); strlcpy(name, files[i]->d_name, sizeof(name));
*strstr(name, ".fl") = '\\0'; *strstr(name, ".fl") = '\\0';
for (ptr = name; *ptr; ptr ++) { for (ptr = name; *ptr; ptr ++) {
if (*ptr == '_') *ptr = ' '; if (*ptr == '_') *ptr = ' ';
} }
// Add the template to the browser... // Add the template to the browser...
snprintf(filename, sizeof(filename), "%s/%s", path, files[i]->d_name); snprintf(filename, sizeof(filename), "%s/%s", path, files[i]->d_name);
template_browser->add(name, strdup(filename)); template_browser->add(name, strdup(filename));
} }
free(files[i]); free(files[i]);
} }
if (num_files > 0) free(files);} {} if (num_files > 0) free(files);} {}
} }
comment { comment {
// //
// End of "$Id$". // End of "$Id$".
//} {in_source in_header //} {in_source in_header
} }

View File

@ -1,56 +1,56 @@
// //
// "$Id$" // "$Id$"
// //
// FLUID template support for the Fast Light Tool Kit (FLTK). // FLUID template support for the Fast Light Tool Kit (FLTK).
// //
// Copyright 1998-2005 by Bill Spitzak and others. // Copyright 1998-2005 by Bill Spitzak and others.
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version. // version 2 of the License, or (at your option) any later version.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details. // Library General Public License for more details.
// //
// You should have received a copy of the GNU Library General Public // You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA. // USA.
// //
// Please report all bugs and problems on the following page: // Please report all bugs and problems on the following page:
// //
// http://www.fltk.org/str.php // http://www.fltk.org/str.php
// //
// generated by Fast Light User Interface Designer (fluid) version 1.0107 // generated by Fast Light User Interface Designer (fluid) version 1.0107
#ifndef template_panel_h #ifndef template_panel_h
#define template_panel_h #define template_panel_h
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Double_Window.H> #include <FL/Fl_Double_Window.H>
extern Fl_Double_Window *template_panel; extern Fl_Double_Window *template_panel;
#include <FL/Fl_Browser.H> #include <FL/Fl_Browser.H>
extern Fl_Browser *template_browser; extern Fl_Browser *template_browser;
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
extern Fl_Box *template_preview; extern Fl_Box *template_preview;
#include <FL/Fl_Input.H> #include <FL/Fl_Input.H>
extern Fl_Input *template_name; extern Fl_Input *template_name;
extern Fl_Input *template_instance; extern Fl_Input *template_instance;
#include <FL/Fl_Group.H> #include <FL/Fl_Group.H>
#include <FL/Fl_Button.H> #include <FL/Fl_Button.H>
extern void template_delete_cb(Fl_Button*, void*); extern void template_delete_cb(Fl_Button*, void*);
extern Fl_Button *template_delete; extern Fl_Button *template_delete;
#include <FL/Fl_Return_Button.H> #include <FL/Fl_Return_Button.H>
extern Fl_Return_Button *template_submit; extern Fl_Return_Button *template_submit;
Fl_Double_Window* make_template_panel(); Fl_Double_Window* make_template_panel();
void template_clear(); void template_clear();
void template_delete_cb(Fl_Button *, void *); void template_delete_cb(Fl_Button *, void *);
void template_load(); void template_load();
#endif #endif
// //
// End of "$Id$". // End of "$Id$".
// //

View File

@ -1732,6 +1732,9 @@
PreprocessorDefinitions=""/> PreprocessorDefinitions=""/>
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\src\fl_read_image.cxx">
</File>
<File <File
RelativePath="..\src\fl_rect.cxx"> RelativePath="..\src\fl_rect.cxx">
<FileConfiguration <FileConfiguration

View File

@ -1781,6 +1781,9 @@
PreprocessorDefinitions="FL_DLL;FL_LIBRARY;WIN32;_DEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN;$(NoInherit)"/> PreprocessorDefinitions="FL_DLL;FL_LIBRARY;WIN32;_DEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN;$(NoInherit)"/>
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\src\fl_read_image.cxx">
</File>
<File <File
RelativePath="..\src\fl_rect.cxx"> RelativePath="..\src\fl_rect.cxx">
<FileConfiguration <FileConfiguration

View File

@ -20,7 +20,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories=".,.." AdditionalIncludeDirectories=".,..,..\zlib,..\png"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN"
RuntimeLibrary="3" RuntimeLibrary="3"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
@ -87,7 +87,7 @@
InlineFunctionExpansion="2" InlineFunctionExpansion="2"
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
FavorSizeOrSpeed="0" FavorSizeOrSpeed="0"
AdditionalIncludeDirectories=".,.." AdditionalIncludeDirectories=".,..,..\zlib,..\png"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
@ -219,6 +219,25 @@
PreprocessorDefinitions=""/> PreprocessorDefinitions=""/>
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\fluid\CodeEditor.cxx">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
FavorSizeOrSpeed="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File <File
RelativePath="..\fluid\factory.cxx"> RelativePath="..\fluid\factory.cxx">
<FileConfiguration <FileConfiguration
@ -428,6 +447,9 @@
PreprocessorDefinitions=""/> PreprocessorDefinitions=""/>
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\fluid\template_panel.cxx">
</File>
<File <File
RelativePath="..\fluid\undo.cxx"> RelativePath="..\fluid\undo.cxx">
<FileConfiguration <FileConfiguration
@ -466,25 +488,6 @@
PreprocessorDefinitions=""/> PreprocessorDefinitions=""/>
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\fluid\CodeEditor.cxx">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
FavorSizeOrSpeed="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>