Skip to content

Commit

Permalink
FLUID changes to support GNU gettext and POSIX catgets under FLTK 1.0;
Browse files Browse the repository at this point in the history
will work on changes for 2.0 later this week...

(please let me know what you think...)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1082 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
michaelrsweet committed Apr 24, 2000
1 parent cd91436 commit 8ff6d1d
Show file tree
Hide file tree
Showing 10 changed files with 431 additions and 42 deletions.
29 changes: 26 additions & 3 deletions fluid/Fl_Menu_Type.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Menu_Type.cxx,v 1.16.2.5 2000/02/05 09:20:45 bill Exp $"
// "$Id: Fl_Menu_Type.cxx,v 1.16.2.6 2000/04/24 18:22:47 mike Exp $"
//
// Menu item code for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -31,6 +31,7 @@

#include <FL/Fl.H>
#include "Fl_Widget_Type.h"
#include "alignment_panel.h"
#include <FL/fl_message.H>
#include <FL/Fl_Menu_.H>
#include <FL/Fl_Button.H>
Expand All @@ -46,6 +47,12 @@ Fl_Menu_Item menu_item_type_menu[] = {

extern int reading_file;
extern int force_parent;
extern int msgnum;
extern int i18n_type;
extern const char* i18n_include;
extern const char* i18n_function;
extern const char* i18n_file;
extern const char* i18n_set;

static char submenuflag;

Expand Down Expand Up @@ -209,7 +216,23 @@ int Fl_Menu_Item_Type::flags() {
void Fl_Menu_Item_Type::write_item() {
write_c(" {");
if (image) write_c("0");
else if (label()) write_cstring(label());
else if (label()) {
switch (i18n_type) {
case 0 : /* None */
write_cstring(label());
break;
case 1 : /* GNU gettext */
write_c("%s(", i18n_function);
write_cstring(label());
write_c(")");
break;
case 2 : /* POSIX catgets */
write_c("catgets(%s,%s,%d,", i18n_file, i18n_set, msgnum ++);
write_cstring(label());
write_c(")");
break;
}
}
else write_c("\"\"");
if (((Fl_Button*)o)->shortcut())
write_c(", 0x%x, ", ((Fl_Button*)o)->shortcut());
Expand Down Expand Up @@ -439,5 +462,5 @@ void shortcut_in_cb(Shortcut_Button* i, void* v) {
}

//
// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.5 2000/02/05 09:20:45 bill Exp $".
// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.6 2000/04/24 18:22:47 mike Exp $".
//
5 changes: 3 additions & 2 deletions fluid/Fl_Type.h
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Type.h,v 1.5.2.6 2000/02/05 09:20:46 bill Exp $"
// "$Id: Fl_Type.h,v 1.5.2.7 2000/04/24 18:22:47 mike Exp $"
//
// Widget type header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -499,6 +499,7 @@ void write_word(const char *);
void write_string(const char *,...);
int write_file(const char *, int selected_only = 0);
int write_code(const char *cfile, const char *hfile);
int write_strings(const char *sfile);

int write_declare(const char *, ...);
int is_id(char);
Expand Down Expand Up @@ -528,5 +529,5 @@ int storestring(const char *n, const char * & p, int nostrip=0);
extern int include_H_from_C;

//
// End of "$Id: Fl_Type.h,v 1.5.2.6 2000/02/05 09:20:46 bill Exp $".
// End of "$Id: Fl_Type.h,v 1.5.2.7 2000/04/24 18:22:47 mike Exp $".
//
27 changes: 24 additions & 3 deletions fluid/Fl_Widget_Type.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.10 2000/03/06 14:45:54 mike Exp $"
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.11 2000/04/24 18:22:48 mike Exp $"
//
// Widget type code for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -27,6 +27,7 @@
#include <FL/Fl_Group.H>
#include <FL/Fl_Input.H>
#include "Fl_Widget_Type.h"
#include "alignment_panel.h"
#include <FL/fl_message.H>
#include <FL/Fl_Slider.H>
#include <FL/Fl_Window.H>
Expand All @@ -45,6 +46,12 @@ extern int reading_file;
int force_parent;
extern int gridx;
extern int gridy;
extern int msgnum;
extern int i18n_type;
extern const char* i18n_include;
extern const char* i18n_function;
extern const char* i18n_file;
extern const char* i18n_set;

int Fl_Widget_Type::is_widget() const {return 1;}

Expand Down Expand Up @@ -1333,7 +1340,21 @@ void Fl_Widget_Type::write_code1() {
}
if (!image && label() && *label()) {
write_c(", ");
write_cstring(label());
switch (i18n_type) {
case 0 : /* None */
write_cstring(label());
break;
case 1 : /* GNU gettext */
write_c("%s(", i18n_function);
write_cstring(label());
write_c(")");
break;
case 2 : /* POSIX catgets */
write_c("catgets(%s,%s,%d,", i18n_file, i18n_set, msgnum ++);
write_cstring(label());
write_c(")");
break;
}
}
write_c(");\n");
indentation += 2;
Expand Down Expand Up @@ -1747,5 +1768,5 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) {
}

//
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.10 2000/03/06 14:45:54 mike Exp $".
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.11 2000/04/24 18:22:48 mike Exp $".
//
79 changes: 77 additions & 2 deletions fluid/Fl_Window_Type.cxx
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Window_Type.cxx,v 1.13.2.3 1999/09/10 16:40:17 bill Exp $"
// "$Id: Fl_Window_Type.cxx,v 1.13.2.4 2000/04/24 18:22:49 mike Exp $"
//
// Window type code for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -43,6 +43,12 @@ int gridy = 5;
int snap = 3;

int include_H_from_C = 1;
extern int i18n_type;
extern const char* i18n_include;
extern const char* i18n_function;
extern const char* i18n_file;
extern const char* i18n_set;
extern int modflag;

void alignment_cb(Fl_Input *i, long v) {
int n = atoi(i->value());
Expand All @@ -52,6 +58,50 @@ void alignment_cb(Fl_Input *i, long v) {
case 2: gridy = n; break;
case 3: snap = n; break;
}
modflag = 1;
}

void i18n_type_cb(Fl_Choice *c, void *) {
switch (i18n_type = c->value()) {
case 0 : /* None */
i18n_include_input->hide();
i18n_file_input->hide();
i18n_set_input->hide();
i18n_function_input->hide();
break;
case 1 : /* GNU gettext */
i18n_include_input->value("<libintl.h>");
i18n_function_input->value("gettext");
i18n_include_input->show();
i18n_file_input->hide();
i18n_set_input->hide();
i18n_function_input->show();
break;
case 2 : /* POSIX cat */
i18n_include_input->value("<nl_types.h>");
i18n_file_input->value("i18n_file");
i18n_set_input->value("1");
i18n_include_input->show();
i18n_file_input->show();
i18n_set_input->show();
i18n_function_input->hide();
break;
}

modflag = 1;
}

void i18n_text_cb(Fl_Input *i, void *) {
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();

modflag = 1;
}

extern const char* header_file_name;
Expand All @@ -66,6 +116,31 @@ void show_alignment_cb(Fl_Widget *, void *) {
sprintf(buf,"%d",gridx); horizontal_input->value(buf);
sprintf(buf,"%d",gridy); vertical_input->value(buf);
sprintf(buf,"%d",snap); snap_input->value(buf);
i18n_type_chooser->value(i18n_type);
i18n_function_input->value(i18n_function);
i18n_file_input->value(i18n_file);
i18n_set_input->value(i18n_set);
i18n_include_input->value(i18n_include);
switch (i18n_type) {
case 0 : /* None */
i18n_include_input->hide();
i18n_file_input->hide();
i18n_set_input->hide();
i18n_function_input->hide();
break;
case 1 : /* GNU gettext */
i18n_include_input->show();
i18n_file_input->hide();
i18n_set_input->hide();
i18n_function_input->show();
break;
case 2 : /* POSIX cat */
i18n_include_input->show();
i18n_file_input->show();
i18n_set_input->show();
i18n_function_input->hide();
break;
}
alignment_window->show();
}

Expand Down Expand Up @@ -672,5 +747,5 @@ int Fl_Window_Type::read_fdesign(const char* name, const char* value) {
}

//
// End of "$Id: Fl_Window_Type.cxx,v 1.13.2.3 1999/09/10 16:40:17 bill Exp $".
// End of "$Id: Fl_Window_Type.cxx,v 1.13.2.4 2000/04/24 18:22:49 mike Exp $".
//
77 changes: 66 additions & 11 deletions fluid/alignment_panel.cxx
Expand Up @@ -20,62 +20,117 @@ Fl_Input *code_file_input=(Fl_Input *)0;

Fl_Light_Button *include_H_from_C_button=(Fl_Light_Button *)0;

Fl_Choice *i18n_type_chooser=(Fl_Choice *)0;

Fl_Menu_Item menu_i18n_type_chooser[] = {
{"None", 0, 0, 0, 0, 0, 0, 14, 0},
{"GNU gettext", 0, 0, 0, 0, 0, 0, 14, 0},
{"POSIX catgets", 0, 0, 0, 0, 0, 0, 14, 0},
{0}
};

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_Input *i18n_function_input=(Fl_Input *)0;

Fl_Window* make_alignment_window() {
Fl_Window* w;
{ Fl_Window* o = alignment_window = new Fl_Window(210, 320, "Preferences");
{ Fl_Window* o = alignment_window = new Fl_Window(365, 340, "Preferences");
w = o;
{ Fl_Box* o = new Fl_Box(10, 25, 190, 100, "Alignment:");
{ Fl_Box* o = new Fl_Box(10, 25, 130, 130, "Alignment:");
o->box(FL_ENGRAVED_FRAME);
o->labelsize(12);
o->align(FL_ALIGN_TOP_LEFT);
}
{ Fl_Input* o = horizontal_input = new Fl_Input(90, 35, 100, 20, "Horizontal:");
{ Fl_Input* o = horizontal_input = new Fl_Input(90, 35, 40, 20, "Horizontal:");
o->type(2);
o->box(FL_THIN_DOWN_BOX);
o->callback((Fl_Callback*)alignment_cb, (void*)(1));
o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
}
{ Fl_Input* o = vertical_input = new Fl_Input(90, 65, 100, 20, "Vertical:");
{ Fl_Input* o = vertical_input = new Fl_Input(90, 65, 40, 20, "Vertical:");
o->type(2);
o->box(FL_THIN_DOWN_BOX);
o->callback((Fl_Callback*)alignment_cb, (void*)(2));
o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
}
{ Fl_Input* o = snap_input = new Fl_Input(90, 95, 100, 20, "Snap:");
{ Fl_Input* o = snap_input = new Fl_Input(90, 95, 40, 20, "Snap:");
o->type(2);
o->box(FL_THIN_DOWN_BOX);
o->callback((Fl_Callback*)alignment_cb, (void*)(3));
o->when(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY);
}
{ Fl_Button* o = new Fl_Button(140, 285, 60, 25, "Close");
{ Fl_Button* o = new Fl_Button(295, 305, 60, 25, "Close");
o->callback((Fl_Callback*)cb_Close);
}
{ Fl_Box* o = new Fl_Box(10, 145, 190, 130, "Output File Names:");
{ Fl_Box* o = new Fl_Box(10, 175, 345, 120, "Output File Names:");
o->box(FL_ENGRAVED_FRAME);
o->labelsize(12);
o->align(FL_ALIGN_TOP_LEFT);
}
{ Fl_Box* o = new Fl_Box(20, 155, 170, 30, "Use \"name.ext\" to set name or just \".ext\" to set only extension.");
{ Fl_Box* o = new Fl_Box(20, 185, 325, 15, "Use \"name.ext\" to set name or just \".ext\" to set only extension.");
o->labelsize(10);
o->align(132|FL_ALIGN_INSIDE);
}
{ Fl_Input* o = header_file_input = new Fl_Input(100, 185, 90, 20, "Header File:");
{ Fl_Input* o = header_file_input = new Fl_Input(100, 205, 245, 20, "Header File:");
o->box(FL_THIN_DOWN_BOX);
o->textfont(4);
o->callback((Fl_Callback*)header_input_cb, (void*)(1));
o->when(FL_WHEN_CHANGED);
}
{ Fl_Input* o = code_file_input = new Fl_Input(100, 215, 90, 20, "Code File:");
{ Fl_Input* o = code_file_input = new Fl_Input(100, 235, 245, 20, "Code File:");
o->box(FL_THIN_DOWN_BOX);
o->textfont(4);
o->callback((Fl_Callback*)code_input_cb, (void*)(1));
o->when(FL_WHEN_CHANGED);
}
{ Fl_Light_Button* o = include_H_from_C_button = new Fl_Light_Button(20, 245, 170, 20, "Include Header from Code");
{ Fl_Light_Button* o = include_H_from_C_button = new Fl_Light_Button(100, 265, 170, 20, "Include Header from Code");
o->value(1);
o->labelsize(12);
o->callback((Fl_Callback*)include_H_from_C_button_cb);
}
{ Fl_Box* o = new Fl_Box(150, 25, 205, 130, "Internationalization:");
o->box(FL_ENGRAVED_FRAME);
o->labelsize(12);
o->align(FL_ALIGN_TOP_LEFT);
}
{ Fl_Choice* o = i18n_type_chooser = new Fl_Choice(220, 35, 125, 20, "Use:");
o->box(FL_THIN_UP_BOX);
o->callback((Fl_Callback*)i18n_type_cb);
o->menu(menu_i18n_type_chooser);
}
{ Fl_Input* o = i18n_include_input = new Fl_Input(220, 65, 125, 20, "#include:");
o->box(FL_THIN_DOWN_BOX);
o->textfont(4);
o->callback((Fl_Callback*)i18n_text_cb);
o->hide();
}
{ Fl_Input* o = i18n_file_input = new Fl_Input(220, 95, 125, 20, "File:");
o->box(FL_THIN_DOWN_BOX);
o->textfont(4);
o->callback((Fl_Callback*)i18n_text_cb);
o->hide();
}
{ Fl_Input* o = i18n_set_input = new Fl_Input(220, 125, 125, 20, "Set:");
o->type(2);
o->box(FL_THIN_DOWN_BOX);
o->textfont(4);
o->callback((Fl_Callback*)i18n_text_cb);
o->hide();
}
{ Fl_Input* o = i18n_function_input = new Fl_Input(220, 95, 125, 20, "Function:");
o->box(FL_THIN_DOWN_BOX);
o->textfont(4);
o->callback((Fl_Callback*)i18n_text_cb);
o->hide();
}
o->set_modal();
o->end();
}
return w;
}
extern void i18n_cb(Fl_Choice *,void *);

0 comments on commit 8ff6d1d

Please sign in to comment.