Used Fluid to generate Fluid files. Fixed two naming issues for the new Fl_Int_Input type, generated by Fluid.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8072 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2010-12-20 12:21:24 +00:00
parent a35defedd5
commit 150fc6e7f7
9 changed files with 171 additions and 161 deletions

View File

@ -84,7 +84,7 @@ void guides_cb(Fl_Check_Button *i, long) {
}
}
void grid_cb(Fl_Input *i, long v) {
void grid_cb(Fl_Int_Input *i, long v) {
int n = atoi(i->value());
if (n < 0) n = 0;
switch (v) {
@ -165,16 +165,23 @@ void i18n_type_cb(Fl_Choice *c, void *) {
void i18n_text_cb(Fl_Input *i, void *) {
undo_checkpoint();
if (i == i18n_function_input)
i18n_function = i->value();
else if (i == i18n_file_input)
i18n_file = i->value();
else if (i == i18n_set_input)
i18n_set = i->value();
else if (i == i18n_include_input)
i18n_include = i->value();
set_modflag(1);
}
void i18n_int_cb(Fl_Int_Input *i, void *) {
undo_checkpoint();
if (i == i18n_set_input)
i18n_set = i->value();
set_modflag(1);
}

View File

@ -283,10 +283,10 @@ Fl_Double_Window* make_about_panel() {
o->selection_color(FL_DARK1);
o->labelfont(1);
o->labelsize(18);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ Fl_Box* o = new Fl_Box(135, 89, 170, 42, "Copyright 1998-2010 by\nBill Spitzak and others");
o->align(132|FL_ALIGN_INSIDE);
{ Fl_Box* o = new Fl_Box(135, 89, 170, 42, "Copyright 1998-2009 by\nBill Spitzak and others");
o->align(Fl_Align(132|FL_ALIGN_INSIDE));
} // Fl_Box* o
{ Fl_Button* o = new Fl_Button(89, 141, 123, 25, "View License...");
o->labelcolor(FL_DARK_BLUE);

View File

@ -57,7 +57,7 @@ Fl_Input *i18n_include_input=(Fl_Input *)0;
Fl_Input *i18n_file_input=(Fl_Input *)0;
Fl_Input *i18n_set_input=(Fl_Input *)0;
Fl_Int_Input *i18n_set_input=(Fl_Int_Input *)0;
Fl_Input *i18n_function_input=(Fl_Input *)0;
@ -125,14 +125,14 @@ Fl_Double_Window* make_project_window() {
i18n_file_input->textfont(4);
i18n_file_input->callback((Fl_Callback*)i18n_text_cb);
} // Fl_Input* i18n_file_input
{ i18n_set_input = new Fl_Input(100, 128, 272, 20, "Set:");
{ i18n_set_input = new Fl_Int_Input(100, 128, 272, 20, "Set:");
i18n_set_input->tooltip("The message set number.");
i18n_set_input->type(2);
i18n_set_input->box(FL_THIN_DOWN_BOX);
i18n_set_input->labelfont(1);
i18n_set_input->textfont(4);
i18n_set_input->callback((Fl_Callback*)i18n_text_cb);
} // Fl_Input* i18n_set_input
i18n_set_input->callback((Fl_Callback*)i18n_int_cb);
} // Fl_Int_Input* i18n_set_input
{ i18n_function_input = new Fl_Input(100, 103, 272, 20, "Function:");
i18n_function_input->tooltip("The function to call to internationalize the labels and tooltips.");
i18n_function_input->box(FL_THIN_DOWN_BOX);
@ -379,11 +379,11 @@ Fl_Double_Window* make_shell_window() {
Fl_Double_Window *grid_window=(Fl_Double_Window *)0;
Fl_Input *horizontal_input=(Fl_Input *)0;
Fl_Int_Input *horizontal_input=(Fl_Int_Input *)0;
Fl_Input *vertical_input=(Fl_Input *)0;
Fl_Int_Input *vertical_input=(Fl_Int_Input *)0;
Fl_Input *snap_input=(Fl_Input *)0;
Fl_Int_Input *snap_input=(Fl_Int_Input *)0;
Fl_Check_Button *guides_toggle=(Fl_Check_Button *)0;
@ -395,30 +395,30 @@ Fl_Round_Button *def_widget_size[6]={(Fl_Round_Button *)0};
Fl_Double_Window* make_layout_window() {
{ grid_window = new Fl_Double_Window(285, 245, "Layout Settings");
{ Fl_Input* o = horizontal_input = new Fl_Input(106, 10, 50, 25, "x");
{ Fl_Int_Input* o = horizontal_input = new Fl_Int_Input(106, 10, 50, 25, "x");
horizontal_input->tooltip("Horizontal grid spacing.");
horizontal_input->type(2);
horizontal_input->box(FL_THIN_DOWN_BOX);
horizontal_input->callback((Fl_Callback*)grid_cb, (void*)(1));
horizontal_input->align(Fl_Align(FL_ALIGN_RIGHT));
o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
} // Fl_Input* horizontal_input
{ Fl_Input* o = vertical_input = new Fl_Input(166, 10, 50, 25, "pixels");
} // Fl_Int_Input* horizontal_input
{ Fl_Int_Input* o = vertical_input = new Fl_Int_Input(166, 10, 50, 25, "pixels");
vertical_input->tooltip("Vertical grid spacing.");
vertical_input->type(2);
vertical_input->box(FL_THIN_DOWN_BOX);
vertical_input->callback((Fl_Callback*)grid_cb, (void*)(2));
vertical_input->align(Fl_Align(FL_ALIGN_RIGHT));
o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
} // Fl_Input* vertical_input
{ Fl_Input* o = snap_input = new Fl_Input(106, 45, 50, 25, "pixel snap");
} // Fl_Int_Input* vertical_input
{ Fl_Int_Input* o = snap_input = new Fl_Int_Input(106, 45, 50, 25, "pixel snap");
snap_input->tooltip("Snap to grid within this many pixels.");
snap_input->type(2);
snap_input->box(FL_THIN_DOWN_BOX);
snap_input->callback((Fl_Callback*)grid_cb, (void*)(3));
snap_input->align(Fl_Align(FL_ALIGN_RIGHT));
o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
} // Fl_Input* snap_input
} // Fl_Int_Input* snap_input
{ guides_toggle = new Fl_Check_Button(106, 80, 110, 25, "Show Guides");
guides_toggle->tooltip("Show distance and alignment guides in overlay");
guides_toggle->down_box(FL_DOWN_BOX);

View File

@ -37,7 +37,7 @@ decl {\#include <FL/Fl_Text_Buffer.H>} {public local
decl {\#include <FL/Fl_Text_Display.H>} {public local
}
decl {\#include <FL/filename.H>} {selected public local
decl {\#include <FL/filename.H>} {public local
}
decl {extern void load_history();} {public local
@ -142,7 +142,7 @@ Function {make_project_window()} {open
}
Fl_Input i18n_set_input {
label {Set:}
callback i18n_text_cb
callback i18n_int_cb selected
tooltip {The message set number.} xywh {100 128 272 20} type Int box THIN_DOWN_BOX labelfont 1 textfont 4
}
Fl_Input i18n_function_input {

View File

@ -32,6 +32,7 @@
#include <FL/Fl.H>
#include <FL/Fl_Text_Buffer.H>
#include <FL/Fl_Text_Display.H>
#include <FL/filename.H>
extern void load_history();
extern void redraw_browser();
extern int show_comments;
@ -63,7 +64,9 @@ extern Fl_Choice *i18n_type_chooser;
extern void i18n_text_cb(Fl_Input*, void*);
extern Fl_Input *i18n_include_input;
extern Fl_Input *i18n_file_input;
extern Fl_Input *i18n_set_input;
#include <FL/Fl_Int_Input.H>
extern void i18n_int_cb(Fl_Int_Input*, void*);
extern Fl_Int_Input *i18n_set_input;
extern Fl_Input *i18n_function_input;
Fl_Double_Window* make_project_window();
extern Fl_Menu_Item menu_i18n_type_chooser[];
@ -94,10 +97,10 @@ extern Fl_Text_Display *shell_run_display;
extern Fl_Return_Button *shell_run_button;
Fl_Double_Window* make_shell_window();
extern Fl_Double_Window *grid_window;
extern void grid_cb(Fl_Input*, long);
extern Fl_Input *horizontal_input;
extern Fl_Input *vertical_input;
extern Fl_Input *snap_input;
extern void grid_cb(Fl_Int_Input*, long);
extern Fl_Int_Input *horizontal_input;
extern Fl_Int_Input *vertical_input;
extern Fl_Int_Input *snap_input;
extern void guides_cb(Fl_Check_Button*, long);
extern Fl_Check_Button *guides_toggle;
#include <FL/Fl_Round_Button.H>

View File

@ -690,15 +690,15 @@ Fl_Double_Window* make_comment_panel() {
void type_make_cb(Fl_Widget*,void*d) {
undo_checkpoint();
Fl_Type *t = Fl_Type_make((char*)d);
if (t) {
select_only(t);
set_modflag(1);
t->open();
} else {
undo_current --;
undo_last --;
}
Fl_Type *t = Fl_Type_make((char*)d);
if (t) {
select_only(t);
set_modflag(1);
t->open();
} else {
undo_current --;
undo_last --;
}
}
Fl_Window *widgetbin_panel=(Fl_Window *)0;

View File

@ -73,9 +73,9 @@ static void cb_print_selection(Fl_Round_Button*, void*) {
print_to->deactivate();
}
Fl_Input *print_from=(Fl_Input *)0;
Fl_Int_Input *print_from=(Fl_Int_Input *)0;
Fl_Input *print_to=(Fl_Input *)0;
Fl_Int_Input *print_to=(Fl_Int_Input *)0;
Fl_Spinner *print_copies=(Fl_Spinner *)0;
@ -278,16 +278,16 @@ Fl_Double_Window* make_print_panel() {
print_selection->down_box(FL_ROUND_DOWN_BOX);
print_selection->callback((Fl_Callback*)cb_print_selection);
} // Fl_Round_Button* print_selection
{ print_from = new Fl_Input(136, 126, 28, 25, "From:");
{ print_from = new Fl_Int_Input(136, 126, 28, 25, "From:");
print_from->type(2);
print_from->textfont(4);
print_from->deactivate();
} // Fl_Input* print_from
{ print_to = new Fl_Input(199, 126, 28, 25, "To:");
} // Fl_Int_Input* print_from
{ print_to = new Fl_Int_Input(199, 126, 28, 25, "To:");
print_to->type(2);
print_to->textfont(4);
print_to->deactivate();
} // Fl_Input* print_to
} // Fl_Int_Input* print_to
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(247, 86, 210, 105, "Copies");
@ -510,77 +510,77 @@ void print_cb(Fl_Return_Button *, void *);
void print_load() {
FILE *lpstat;
char line[1024], name[1024], *nptr, qname[2048], *qptr, defname[1024];
int i;
if (print_choice->size() > 1) {
for (i = 1; print_choice->text(i); i ++) {
free(print_choice->menu()[i].user_data());
char line[1024], name[1024], *nptr, qname[2048], *qptr, defname[1024];
int i;
if (print_choice->size() > 1) {
for (i = 1; print_choice->text(i); i ++) {
free(print_choice->menu()[i].user_data());
}
}
}
print_choice->clear();
print_choice->add("Print To File", 0, 0, 0, FL_MENU_DIVIDER);
print_choice->value(0);
defname[0] = '\0';
if ((lpstat = popen("LC_MESSAGES=C LANG=C lpstat -p -d", "r")) != NULL) {
while (fgets(line, sizeof(line), lpstat)) {
if (!strncmp(line, "printer ", 8) &&
sscanf(line + 8, "%s", name) == 1) {
for (nptr = name, qptr = qname; *nptr; *qptr++ = *nptr++) {
if (*nptr == '/') *qptr++ = '\\';
print_choice->clear();
print_choice->add("Print To File", 0, 0, 0, FL_MENU_DIVIDER);
print_choice->value(0);
defname[0] = '\0';
if ((lpstat = popen("LC_MESSAGES=C LANG=C lpstat -p -d", "r")) != NULL) {
while (fgets(line, sizeof(line), lpstat)) {
if (!strncmp(line, "printer ", 8) &&
sscanf(line + 8, "%s", name) == 1) {
for (nptr = name, qptr = qname; *nptr; *qptr++ = *nptr++) {
if (*nptr == '/') *qptr++ = '\\';
}
*qptr = '\0';
print_choice->add(qname, 0, 0, (void *)strdup(name), 0);
} else if (!strncmp(line, "system default destination: ", 28)) {
if (sscanf(line + 28, "%s", defname) != 1) defname[0] = '\0';
}
*qptr = '\0';
print_choice->add(qname, 0, 0, (void *)strdup(name), 0);
} else if (!strncmp(line, "system default destination: ", 28)) {
if (sscanf(line + 28, "%s", defname) != 1) defname[0] = '\0';
}
pclose(lpstat);
}
pclose(lpstat);
}
if (defname[0]) {
for (i = 1; print_choice->text(i); i ++) {
if (!strcmp((char *)print_choice->menu()[i].user_data(), defname)) {
print_choice->value(i);
break;
if (defname[0]) {
for (i = 1; print_choice->text(i); i ++) {
if (!strcmp((char *)print_choice->menu()[i].user_data(), defname)) {
print_choice->value(i);
break;
}
}
}
} else if (print_choice->size() > 2) print_choice->value(1);
print_update_status();
} else if (print_choice->size() > 2) print_choice->value(1);
print_update_status();
}
void print_update_status() {
FILE *lpstat;
char command[1024];
static char status[1024];
const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
if (print_choice->value()) {
snprintf(command, sizeof(command), "lpstat -p '%s'", printer);
if ((lpstat = popen(command, "r")) != NULL) {
if (fgets(status, sizeof(status), lpstat)==0) { /* ignore */ }
pclose(lpstat);
} else strcpy(status, "printer status unavailable");
} else status[0] = '\0';
print_status->label(status);
char name[1024];
int val;
snprintf(name, sizeof(name), "%s/page_size", printer);
fluid_prefs.get(name, val, 0);
print_page_size->value(val);
snprintf(name, sizeof(name), "%s/output_mode", printer);
fluid_prefs.get(name, val, 0);
print_output_mode[val]->setonly();
char command[1024];
static char status[1024];
const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
if (print_choice->value()) {
snprintf(command, sizeof(command), "lpstat -p '%s'", printer);
if ((lpstat = popen(command, "r")) != NULL) {
if (fgets(status, sizeof(status), lpstat)==0) { /* ignore */ }
pclose(lpstat);
} else strcpy(status, "printer status unavailable");
} else status[0] = '\0';
print_status->label(status);
char name[1024];
int val;
snprintf(name, sizeof(name), "%s/page_size", printer);
fluid_prefs.get(name, val, 0);
print_page_size->value(val);
snprintf(name, sizeof(name), "%s/output_mode", printer);
fluid_prefs.get(name, val, 0);
print_output_mode[val]->setonly();
}
//

View File

@ -44,9 +44,9 @@ extern Fl_Box *print_status;
extern Fl_Round_Button *print_all;
extern Fl_Round_Button *print_pages;
extern Fl_Round_Button *print_selection;
#include <FL/Fl_Input.H>
extern Fl_Input *print_from;
extern Fl_Input *print_to;
#include <FL/Fl_Int_Input.H>
extern Fl_Int_Input *print_from;
extern Fl_Int_Input *print_to;
#include <FL/Fl_Spinner.H>
extern Fl_Spinner *print_copies;
#include <FL/Fl_Check_Button.H>

View File

@ -91,7 +91,7 @@ template_name->value(template_browser->text(item));
template_delete->activate();
char pngfile[FL_PATH_MAX], *ext;
char pngfile[1024], *ext;
strlcpy(pngfile, flfile, sizeof(pngfile));
if ((ext = strrchr(pngfile, '.')) == NULL) return;
@ -148,12 +148,12 @@ Fl_Double_Window* make_template_panel() {
template_browser->type(2);
template_browser->labelfont(1);
template_browser->callback((Fl_Callback*)cb_template_browser);
template_browser->align(FL_ALIGN_TOP_LEFT);
template_browser->align(Fl_Align(FL_ALIGN_TOP_LEFT));
template_browser->when(3);
} // Fl_Browser* template_browser
{ template_preview = new Fl_Box(200, 28, 250, 250);
template_preview->box(FL_THIN_DOWN_BOX);
template_preview->align(69|FL_ALIGN_INSIDE);
template_preview->align(Fl_Align(69|FL_ALIGN_INSIDE));
Fl_Group::current()->resizable(template_preview);
} // Fl_Box* template_preview
{ template_name = new Fl_Input(124, 288, 326, 25, "Template Name:");
@ -190,67 +190,67 @@ Fl_Double_Window* make_template_panel() {
void template_clear() {
int i;
void *filename;
for (i = 1; i <= template_browser->size(); i ++) {
if ((filename = template_browser->data(i)) != NULL) free(filename);
}
template_browser->deselect();
template_browser->clear();
void *filename;
for (i = 1; i <= template_browser->size(); i ++) {
if ((filename = template_browser->data(i)) != NULL) free(filename);
}
template_browser->deselect();
template_browser->clear();
}
void template_delete_cb(Fl_Button *, void *) {
int item = template_browser->value();
if (item < 1) return;
const char *name = template_browser->text(item);
const char *flfile = (const char *)template_browser->data(item);
if (!flfile) return;
if (!fl_choice("Are you sure you want to delete the template \"%s\"?",
"Cancel", "Delete", 0, name)) return;
if (unlink(flfile)) {
fl_alert("Unable to delete template \"%s\":\n%s", name, strerror(errno));
return;
}
template_browser->remove(item);
template_browser->do_callback();
if (item < 1) return;
const char *name = template_browser->text(item);
const char *flfile = (const char *)template_browser->data(item);
if (!flfile) return;
if (!fl_choice("Are you sure you want to delete the template \"%s\"?",
"Cancel", "Delete", 0, name)) return;
if (unlink(flfile)) {
fl_alert("Unable to delete template \"%s\":\n%s", name, strerror(errno));
return;
}
template_browser->remove(item);
template_browser->do_callback();
}
void template_load() {
int i;
char name[FL_PATH_MAX], filename[FL_PATH_MAX], path[FL_PATH_MAX], *ptr;
struct dirent **files;
int num_files;
fluid_prefs.getUserdataPath(path, sizeof(path));
strlcat(path, "templates", sizeof(path));
num_files = fl_filename_list(path, &files);
for (i = 0; i < num_files; i ++) {
if (fl_filename_match(files[i]->d_name, "*.fl")) {
// Format the name as the filename with "_" replaced with " "
// and without the trailing ".fl"...
strlcpy(name, files[i]->d_name, sizeof(name));
*strstr(name, ".fl") = '\0';
for (ptr = name; *ptr; ptr ++) {
if (*ptr == '_') *ptr = ' ';
char name[1024], filename[1024], path[1024], *ptr;
struct dirent **files;
int num_files;
fluid_prefs.getUserdataPath(path, sizeof(path));
strlcat(path, "templates", sizeof(path));
num_files = fl_filename_list(path, &files);
for (i = 0; i < num_files; i ++) {
if (fl_filename_match(files[i]->d_name, "*.fl")) {
// Format the name as the filename with "_" replaced with " "
// and without the trailing ".fl"...
strlcpy(name, files[i]->d_name, sizeof(name));
*strstr(name, ".fl") = '\0';
for (ptr = name; *ptr; ptr ++) {
if (*ptr == '_') *ptr = ' ';
}
// Add the template to the browser...
snprintf(filename, sizeof(filename), "%s/%s", path, files[i]->d_name);
template_browser->add(name, strdup(filename));
}
// Add the template to the browser...
snprintf(filename, sizeof(filename), "%s/%s", path, files[i]->d_name);
template_browser->add(name, strdup(filename));
free(files[i]);
}
free(files[i]);
}
if (num_files > 0) free(files);
if (num_files > 0) free(files);
}
//