FLUID refactor and macOS warnings removed (#623)
P renamed to g_project class Project renamed to class Fluid_Project fixes macOS type cast warnings
This commit is contained in:
parent
23e8d831a8
commit
a63ad76603
@ -291,7 +291,7 @@ const char* ExternalCodeEditor::tmp_filename() {
|
|||||||
static char path[FL_PATH_MAX+1];
|
static char path[FL_PATH_MAX+1];
|
||||||
const char *tmpdir = create_tmpdir();
|
const char *tmpdir = create_tmpdir();
|
||||||
if ( !tmpdir ) return 0;
|
if ( !tmpdir ) return 0;
|
||||||
const char *ext = P.code_file_name; // e.g. ".cxx"
|
const char *ext = g_project.code_file_name; // e.g. ".cxx"
|
||||||
snprintf(path, FL_PATH_MAX, "%s/%p%s", tmpdir, (void*)this, ext);
|
snprintf(path, FL_PATH_MAX, "%s/%p%s", tmpdir, (void*)this, ext);
|
||||||
path[FL_PATH_MAX] = 0;
|
path[FL_PATH_MAX] = 0;
|
||||||
return path;
|
return path;
|
||||||
|
@ -359,7 +359,7 @@ const char* ExternalCodeEditor::tmp_filename() {
|
|||||||
static char path[512];
|
static char path[512];
|
||||||
const char *tmpdir = create_tmpdir();
|
const char *tmpdir = create_tmpdir();
|
||||||
if ( !tmpdir ) return 0;
|
if ( !tmpdir ) return 0;
|
||||||
const char *ext = P.code_file_name; // e.g. ".cxx"
|
const char *ext = g_project.code_file_name; // e.g. ".cxx"
|
||||||
_snprintf(path, sizeof(path), "%s\\%p%s", tmpdir, (void*)this, ext);
|
_snprintf(path, sizeof(path), "%s\\%p%s", tmpdir, (void*)this, ext);
|
||||||
path[sizeof(path)-1] = 0;
|
path[sizeof(path)-1] = 0;
|
||||||
return path;
|
return path;
|
||||||
|
@ -378,10 +378,10 @@ void Fl_Menu_Item_Type::write_item() {
|
|||||||
write_comment_inline_c(" ");
|
write_comment_inline_c(" ");
|
||||||
write_c(" {");
|
write_c(" {");
|
||||||
if (label() && label()[0])
|
if (label() && label()[0])
|
||||||
switch (P.i18n_type) {
|
switch (g_project.i18n_type) {
|
||||||
case 1:
|
case 1:
|
||||||
// we will call i18n when the menu is instantiated for the first time
|
// we will call i18n when the menu is instantiated for the first time
|
||||||
write_c("%s(", P.i18n_static_function.value());
|
write_c("%s(", g_project.i18n_static_function.value());
|
||||||
write_cstring(label());
|
write_cstring(label());
|
||||||
write_c(")");
|
write_c(")");
|
||||||
break;
|
break;
|
||||||
@ -394,7 +394,7 @@ void Fl_Menu_Item_Type::write_item() {
|
|||||||
write_c("\"\"");
|
write_c("\"\"");
|
||||||
if (((Fl_Button*)o)->shortcut()) {
|
if (((Fl_Button*)o)->shortcut()) {
|
||||||
int s = ((Fl_Button*)o)->shortcut();
|
int s = ((Fl_Button*)o)->shortcut();
|
||||||
if (P.use_FL_COMMAND && (s & (FL_CTRL|FL_META))) {
|
if (g_project.use_FL_COMMAND && (s & (FL_CTRL|FL_META))) {
|
||||||
write_c(", FL_COMMAND|0x%x, ", s & ~(FL_CTRL|FL_META));
|
write_c(", FL_COMMAND|0x%x, ", s & ~(FL_CTRL|FL_META));
|
||||||
} else {
|
} else {
|
||||||
write_c(", 0x%x, ", s);
|
write_c(", 0x%x, ", s);
|
||||||
@ -474,15 +474,15 @@ void Fl_Menu_Item_Type::write_code1() {
|
|||||||
write_c("%sml->labela = (char*)", indent());
|
write_c("%sml->labela = (char*)", indent());
|
||||||
image->write_inline();
|
image->write_inline();
|
||||||
write_c(";\n");
|
write_c(";\n");
|
||||||
if (P.i18n_type==0) {
|
if (g_project.i18n_type==0) {
|
||||||
write_c("%sml->labelb = o->label();\n", indent());
|
write_c("%sml->labelb = o->label();\n", indent());
|
||||||
} else if (P.i18n_type==1) {
|
} else if (g_project.i18n_type==1) {
|
||||||
write_c("%sml->labelb = %s(o->label());\n",
|
write_c("%sml->labelb = %s(o->label());\n",
|
||||||
indent(), P.i18n_function.value());
|
indent(), g_project.i18n_function.value());
|
||||||
} else if (P.i18n_type==2) {
|
} else if (g_project.i18n_type==2) {
|
||||||
write_c("%sml->labelb = catgets(%s,%s,i+%d,o->label());\n",
|
write_c("%sml->labelb = catgets(%s,%s,i+%d,o->label());\n",
|
||||||
indent(), P.i18n_file[0] ? P.i18n_file.value() : "_catalog",
|
indent(), g_project.i18n_file[0] ? g_project.i18n_file.value() : "_catalog",
|
||||||
P.i18n_set.value(), msgnum());
|
g_project.i18n_set.value(), msgnum());
|
||||||
}
|
}
|
||||||
write_c("%sml->typea = FL_IMAGE_LABEL;\n", indent());
|
write_c("%sml->typea = FL_IMAGE_LABEL;\n", indent());
|
||||||
write_c("%sml->typeb = FL_NORMAL_LABEL;\n", indent());
|
write_c("%sml->typeb = FL_NORMAL_LABEL;\n", indent());
|
||||||
@ -491,20 +491,20 @@ void Fl_Menu_Item_Type::write_code1() {
|
|||||||
image->write_code(0, "o");
|
image->write_code(0, "o");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (P.i18n_type && label() && label()[0]) {
|
if (g_project.i18n_type && label() && label()[0]) {
|
||||||
Fl_Labeltype t = o->labeltype();
|
Fl_Labeltype t = o->labeltype();
|
||||||
if (image) {
|
if (image) {
|
||||||
// label was already copied a few lines up
|
// label was already copied a few lines up
|
||||||
} else if ( t==FL_NORMAL_LABEL || t==FL_SHADOW_LABEL
|
} else if ( t==FL_NORMAL_LABEL || t==FL_SHADOW_LABEL
|
||||||
|| t==FL_ENGRAVED_LABEL || t==FL_EMBOSSED_LABEL) {
|
|| t==FL_ENGRAVED_LABEL || t==FL_EMBOSSED_LABEL) {
|
||||||
start_menu_initialiser(menuItemInitialized, mname, i);
|
start_menu_initialiser(menuItemInitialized, mname, i);
|
||||||
if (P.i18n_type==1) {
|
if (g_project.i18n_type==1) {
|
||||||
write_c("%so->label(%s(o->label()));\n",
|
write_c("%so->label(%s(o->label()));\n",
|
||||||
indent(), P.i18n_function.value());
|
indent(), g_project.i18n_function.value());
|
||||||
} else if (P.i18n_type==2) {
|
} else if (g_project.i18n_type==2) {
|
||||||
write_c("%so->label(catgets(%s,%s,i+%d,o->label()));\n",
|
write_c("%so->label(catgets(%s,%s,i+%d,o->label()));\n",
|
||||||
indent(), P.i18n_file[0] ? P.i18n_file.value() : "_catalog",
|
indent(), g_project.i18n_file[0] ? g_project.i18n_file.value() : "_catalog",
|
||||||
P.i18n_set.value(), msgnum());
|
g_project.i18n_set.value(), msgnum());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2869,18 +2869,18 @@ void Fl_Widget_Type::write_code1() {
|
|||||||
}
|
}
|
||||||
if (label() && *label()) {
|
if (label() && *label()) {
|
||||||
write_c(", ");
|
write_c(", ");
|
||||||
switch (P.i18n_type) {
|
switch (g_project.i18n_type) {
|
||||||
case 0 : /* None */
|
case 0 : /* None */
|
||||||
write_cstring(label());
|
write_cstring(label());
|
||||||
break;
|
break;
|
||||||
case 1 : /* GNU gettext */
|
case 1 : /* GNU gettext */
|
||||||
write_c("%s(", P.i18n_function.value());
|
write_c("%s(", g_project.i18n_function.value());
|
||||||
write_cstring(label());
|
write_cstring(label());
|
||||||
write_c(")");
|
write_c(")");
|
||||||
break;
|
break;
|
||||||
case 2 : /* POSIX catgets */
|
case 2 : /* POSIX catgets */
|
||||||
write_c("catgets(%s,%s,%d,", P.i18n_file[0] ? P.i18n_file.value() : "_catalog",
|
write_c("catgets(%s,%s,%d,", g_project.i18n_file[0] ? g_project.i18n_file.value() : "_catalog",
|
||||||
P.i18n_set.value(), msgnum());
|
g_project.i18n_set.value(), msgnum());
|
||||||
write_cstring(label());
|
write_cstring(label());
|
||||||
write_c(")");
|
write_c(")");
|
||||||
break;
|
break;
|
||||||
@ -2942,18 +2942,18 @@ void Fl_Widget_Type::write_widget_code() {
|
|||||||
|
|
||||||
if (tooltip() && *tooltip()) {
|
if (tooltip() && *tooltip()) {
|
||||||
write_c("%s%s->tooltip(",indent(), var);
|
write_c("%s%s->tooltip(",indent(), var);
|
||||||
switch (P.i18n_type) {
|
switch (g_project.i18n_type) {
|
||||||
case 0 : /* None */
|
case 0 : /* None */
|
||||||
write_cstring(tooltip());
|
write_cstring(tooltip());
|
||||||
break;
|
break;
|
||||||
case 1 : /* GNU gettext */
|
case 1 : /* GNU gettext */
|
||||||
write_c("%s(", P.i18n_function.value());
|
write_c("%s(", g_project.i18n_function.value());
|
||||||
write_cstring(tooltip());
|
write_cstring(tooltip());
|
||||||
write_c(")");
|
write_c(")");
|
||||||
break;
|
break;
|
||||||
case 2 : /* POSIX catgets */
|
case 2 : /* POSIX catgets */
|
||||||
write_c("catgets(%s,%s,%d,", P.i18n_file[0] ? P.i18n_file.value() : "_catalog",
|
write_c("catgets(%s,%s,%d,", g_project.i18n_file[0] ? g_project.i18n_file.value() : "_catalog",
|
||||||
P.i18n_set.value(), msgnum() + 1);
|
g_project.i18n_set.value(), msgnum() + 1);
|
||||||
write_cstring(tooltip());
|
write_cstring(tooltip());
|
||||||
write_c(")");
|
write_c(")");
|
||||||
break;
|
break;
|
||||||
@ -2975,7 +2975,7 @@ void Fl_Widget_Type::write_widget_code() {
|
|||||||
else if (is_value_input()) shortcut = ((Fl_Value_Input*)o)->shortcut();
|
else if (is_value_input()) shortcut = ((Fl_Value_Input*)o)->shortcut();
|
||||||
else if (is_text_display()) shortcut = ((Fl_Text_Display*)o)->shortcut();
|
else if (is_text_display()) shortcut = ((Fl_Text_Display*)o)->shortcut();
|
||||||
if (shortcut) {
|
if (shortcut) {
|
||||||
if (P.use_FL_COMMAND && (shortcut & (FL_CTRL|FL_META))) {
|
if (g_project.use_FL_COMMAND && (shortcut & (FL_CTRL|FL_META))) {
|
||||||
write_c("%s%s->shortcut(FL_COMMAND|0x%x);\n", indent(), var, shortcut & ~(FL_CTRL|FL_META));
|
write_c("%s%s->shortcut(FL_COMMAND|0x%x);\n", indent(), var, shortcut & ~(FL_CTRL|FL_META));
|
||||||
} else {
|
} else {
|
||||||
write_c("%s%s->shortcut(0x%x);\n", indent(), var, shortcut);
|
write_c("%s%s->shortcut(0x%x);\n", indent(), var, shortcut);
|
||||||
|
@ -117,7 +117,7 @@ void default_widget_size_cb(Fl_Round_Button *b, long size) {
|
|||||||
void i18n_type_cb(Fl_Choice *c, void *) {
|
void i18n_type_cb(Fl_Choice *c, void *) {
|
||||||
undo_checkpoint();
|
undo_checkpoint();
|
||||||
|
|
||||||
switch (P.i18n_type = c->value()) {
|
switch (g_project.i18n_type = c->value()) {
|
||||||
case 0 : /* None */
|
case 0 : /* None */
|
||||||
i18n_include_input->hide();
|
i18n_include_input->hide();
|
||||||
i18n_conditional_input->hide();
|
i18n_conditional_input->hide();
|
||||||
@ -128,13 +128,13 @@ void i18n_type_cb(Fl_Choice *c, void *) {
|
|||||||
break;
|
break;
|
||||||
case 1 : /* GNU gettext */
|
case 1 : /* GNU gettext */
|
||||||
i18n_include_input->value("<libintl.h>");
|
i18n_include_input->value("<libintl.h>");
|
||||||
P.i18n_include = i18n_include_input->value();
|
g_project.i18n_include = i18n_include_input->value();
|
||||||
i18n_conditional_input->value("");
|
i18n_conditional_input->value("");
|
||||||
P.i18n_conditional = i18n_conditional_input->value();
|
g_project.i18n_conditional = i18n_conditional_input->value();
|
||||||
i18n_function_input->value("gettext");
|
i18n_function_input->value("gettext");
|
||||||
P.i18n_function = i18n_function_input->value();
|
g_project.i18n_function = i18n_function_input->value();
|
||||||
i18n_static_function_input->value("gettext_noop");
|
i18n_static_function_input->value("gettext_noop");
|
||||||
P.i18n_static_function = i18n_static_function_input->value();
|
g_project.i18n_static_function = i18n_static_function_input->value();
|
||||||
i18n_include_input->show();
|
i18n_include_input->show();
|
||||||
i18n_conditional_input->show();
|
i18n_conditional_input->show();
|
||||||
i18n_file_input->hide();
|
i18n_file_input->hide();
|
||||||
@ -144,13 +144,13 @@ void i18n_type_cb(Fl_Choice *c, void *) {
|
|||||||
break;
|
break;
|
||||||
case 2 : /* POSIX cat */
|
case 2 : /* POSIX cat */
|
||||||
i18n_include_input->value("<nl_types.h>");
|
i18n_include_input->value("<nl_types.h>");
|
||||||
P.i18n_include = i18n_include_input->value();
|
g_project.i18n_include = i18n_include_input->value();
|
||||||
i18n_conditional_input->value("");
|
i18n_conditional_input->value("");
|
||||||
P.i18n_conditional = i18n_conditional_input->value();
|
g_project.i18n_conditional = i18n_conditional_input->value();
|
||||||
i18n_file_input->value("");
|
i18n_file_input->value("");
|
||||||
P.i18n_file = i18n_file_input->value();
|
g_project.i18n_file = i18n_file_input->value();
|
||||||
i18n_set_input->value("1");
|
i18n_set_input->value("1");
|
||||||
P.i18n_set = i18n_set_input->value();
|
g_project.i18n_set = i18n_set_input->value();
|
||||||
i18n_include_input->show();
|
i18n_include_input->show();
|
||||||
i18n_conditional_input->show();
|
i18n_conditional_input->show();
|
||||||
i18n_file_input->show();
|
i18n_file_input->show();
|
||||||
@ -167,15 +167,15 @@ void i18n_text_cb(Fl_Input *i, void *) {
|
|||||||
undo_checkpoint();
|
undo_checkpoint();
|
||||||
|
|
||||||
if (i == i18n_function_input)
|
if (i == i18n_function_input)
|
||||||
P.i18n_function = i->value();
|
g_project.i18n_function = i->value();
|
||||||
else if (i == i18n_static_function_input)
|
else if (i == i18n_static_function_input)
|
||||||
P.i18n_static_function = i->value();
|
g_project.i18n_static_function = i->value();
|
||||||
else if (i == i18n_file_input)
|
else if (i == i18n_file_input)
|
||||||
P.i18n_file = i->value();
|
g_project.i18n_file = i->value();
|
||||||
else if (i == i18n_include_input)
|
else if (i == i18n_include_input)
|
||||||
P.i18n_include = i->value();
|
g_project.i18n_include = i->value();
|
||||||
else if (i == i18n_conditional_input)
|
else if (i == i18n_conditional_input)
|
||||||
P.i18n_conditional = i->value();
|
g_project.i18n_conditional = i->value();
|
||||||
|
|
||||||
set_modflag(1);
|
set_modflag(1);
|
||||||
}
|
}
|
||||||
@ -184,27 +184,27 @@ void i18n_int_cb(Fl_Int_Input *i, void *) {
|
|||||||
undo_checkpoint();
|
undo_checkpoint();
|
||||||
|
|
||||||
if (i == i18n_set_input)
|
if (i == i18n_set_input)
|
||||||
P.i18n_set = i->value();
|
g_project.i18n_set = i->value();
|
||||||
|
|
||||||
set_modflag(1);
|
set_modflag(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_project_cb(Fl_Widget *, void *) {
|
void show_project_cb(Fl_Widget *, void *) {
|
||||||
if(project_window==0) make_project_window();
|
if(project_window==0) make_project_window();
|
||||||
include_H_from_C_button->value(P.include_H_from_C);
|
include_H_from_C_button->value(g_project.include_H_from_C);
|
||||||
use_FL_COMMAND_button->value(P.use_FL_COMMAND);
|
use_FL_COMMAND_button->value(g_project.use_FL_COMMAND);
|
||||||
utf8_in_src_button->value(P.utf8_in_src);
|
utf8_in_src_button->value(g_project.utf8_in_src);
|
||||||
avoid_early_includes_button->value(P.avoid_early_includes);
|
avoid_early_includes_button->value(g_project.avoid_early_includes);
|
||||||
header_file_input->value(P.header_file_name);
|
header_file_input->value(g_project.header_file_name);
|
||||||
code_file_input->value(P.code_file_name);
|
code_file_input->value(g_project.code_file_name);
|
||||||
i18n_type_chooser->value(P.i18n_type);
|
i18n_type_chooser->value(g_project.i18n_type);
|
||||||
i18n_function_input->value(P.i18n_function);
|
i18n_function_input->value(g_project.i18n_function);
|
||||||
i18n_static_function_input->value(P.i18n_static_function);
|
i18n_static_function_input->value(g_project.i18n_static_function);
|
||||||
i18n_file_input->value(P.i18n_file);
|
i18n_file_input->value(g_project.i18n_file);
|
||||||
i18n_set_input->value(P.i18n_set);
|
i18n_set_input->value(g_project.i18n_set);
|
||||||
i18n_include_input->value(P.i18n_include);
|
i18n_include_input->value(g_project.i18n_include);
|
||||||
i18n_conditional_input->value(P.i18n_conditional);
|
i18n_conditional_input->value(g_project.i18n_conditional);
|
||||||
switch (P.i18n_type) {
|
switch (g_project.i18n_type) {
|
||||||
case 0 : /* None */
|
case 0 : /* None */
|
||||||
i18n_include_input->hide();
|
i18n_include_input->hide();
|
||||||
i18n_conditional_input->hide();
|
i18n_conditional_input->hide();
|
||||||
@ -262,41 +262,41 @@ void show_global_settings_cb(Fl_Widget *, void *) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void header_input_cb(Fl_Input* i, void*) {
|
void header_input_cb(Fl_Input* i, void*) {
|
||||||
if (strcmp(P.header_file_name, i->value()))
|
if (strcmp(g_project.header_file_name, i->value()))
|
||||||
set_modflag(1);
|
set_modflag(1);
|
||||||
P.header_file_name = i->value();
|
g_project.header_file_name = i->value();
|
||||||
}
|
}
|
||||||
void code_input_cb(Fl_Input* i, void*) {
|
void code_input_cb(Fl_Input* i, void*) {
|
||||||
if (strcmp(P.code_file_name, i->value()))
|
if (strcmp(g_project.code_file_name, i->value()))
|
||||||
set_modflag(1);
|
set_modflag(1);
|
||||||
P.code_file_name = i->value();
|
g_project.code_file_name = i->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void include_H_from_C_button_cb(Fl_Check_Button* b, void*) {
|
void include_H_from_C_button_cb(Fl_Check_Button* b, void*) {
|
||||||
if (P.include_H_from_C != b->value()) {
|
if (g_project.include_H_from_C != b->value()) {
|
||||||
set_modflag(1);
|
set_modflag(1);
|
||||||
P.include_H_from_C = b->value();
|
g_project.include_H_from_C = b->value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void use_FL_COMMAND_button_cb(Fl_Check_Button* b, void*) {
|
void use_FL_COMMAND_button_cb(Fl_Check_Button* b, void*) {
|
||||||
if (P.use_FL_COMMAND != b->value()) {
|
if (g_project.use_FL_COMMAND != b->value()) {
|
||||||
set_modflag(1);
|
set_modflag(1);
|
||||||
P.use_FL_COMMAND = b->value();
|
g_project.use_FL_COMMAND = b->value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void utf8_in_src_cb(Fl_Check_Button *b, void*) {
|
void utf8_in_src_cb(Fl_Check_Button *b, void*) {
|
||||||
if (P.utf8_in_src != b->value()) {
|
if (g_project.utf8_in_src != b->value()) {
|
||||||
set_modflag(1);
|
set_modflag(1);
|
||||||
P.utf8_in_src = b->value();
|
g_project.utf8_in_src = b->value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void avoid_early_includes_cb(Fl_Check_Button *b, void*) {
|
void avoid_early_includes_cb(Fl_Check_Button *b, void*) {
|
||||||
if (P.avoid_early_includes != b->value()) {
|
if (g_project.avoid_early_includes != b->value()) {
|
||||||
set_modflag(1);
|
set_modflag(1);
|
||||||
P.avoid_early_includes = b->value();
|
g_project.avoid_early_includes = b->value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ void Shortcut_Button::draw() {
|
|||||||
if (value()) draw_box(FL_DOWN_BOX, (Fl_Color)9);
|
if (value()) draw_box(FL_DOWN_BOX, (Fl_Color)9);
|
||||||
else draw_box(FL_UP_BOX, FL_WHITE);
|
else draw_box(FL_UP_BOX, FL_WHITE);
|
||||||
fl_font(FL_HELVETICA,14); fl_color(FL_FOREGROUND_COLOR);
|
fl_font(FL_HELVETICA,14); fl_color(FL_FOREGROUND_COLOR);
|
||||||
if (P.use_FL_COMMAND && (svalue & (FL_CTRL|FL_META))) {
|
if (g_project.use_FL_COMMAND && (svalue & (FL_CTRL|FL_META))) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
fl_snprintf(buf, 1023, "Command+%s", fl_shortcut_label(svalue&~(FL_CTRL|FL_META)));
|
fl_snprintf(buf, 1023, "Command+%s", fl_shortcut_label(svalue&~(FL_CTRL|FL_META)));
|
||||||
fl_draw(buf,x()+6,y(),w(),h(),FL_ALIGN_LEFT);
|
fl_draw(buf,x()+6,y(),w(),h(),FL_ALIGN_LEFT);
|
||||||
|
@ -270,7 +270,7 @@ void write_cstring(const char *s, int length) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// if the UTF-8 option is checked, write unicode characters verbatim
|
// if the UTF-8 option is checked, write unicode characters verbatim
|
||||||
if (P.utf8_in_src && (c&0x80)) {
|
if (g_project.utf8_in_src && (c&0x80)) {
|
||||||
if ((c&0x40)) {
|
if ((c&0x40)) {
|
||||||
// This is the first character in a utf-8 sequence (0b11......).
|
// This is the first character in a utf-8 sequence (0b11......).
|
||||||
// A line break would be ok here. Do not put linebreak in front of
|
// A line break would be ok here. Do not put linebreak in front of
|
||||||
@ -584,47 +584,47 @@ int write_code(const char *s, const char *t) {
|
|||||||
fprintf(header_file, "#define %s\n", define_name);
|
fprintf(header_file, "#define %s\n", define_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (P.avoid_early_includes==0) {
|
if (g_project.avoid_early_includes==0) {
|
||||||
write_declare("#include <FL/Fl.H>");
|
write_declare("#include <FL/Fl.H>");
|
||||||
}
|
}
|
||||||
if (t && P.include_H_from_C) {
|
if (t && g_project.include_H_from_C) {
|
||||||
if (P.header_file_name[0] == '.' && strchr(P.header_file_name, '/') == NULL) {
|
if (g_project.header_file_name[0] == '.' && strchr(g_project.header_file_name, '/') == NULL) {
|
||||||
write_c("#include \"%s\"\n", fl_filename_name(t));
|
write_c("#include \"%s\"\n", fl_filename_name(t));
|
||||||
} else {
|
} else {
|
||||||
write_c("#include \"%s\"\n", t);
|
write_c("#include \"%s\"\n", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (P.i18n_type && P.i18n_include[0]) {
|
if (g_project.i18n_type && g_project.i18n_include[0]) {
|
||||||
int conditional = (P.i18n_conditional[0]!=0);
|
int conditional = (g_project.i18n_conditional[0]!=0);
|
||||||
if (conditional) {
|
if (conditional) {
|
||||||
write_c("#ifdef %s\n", P.i18n_conditional.value());
|
write_c("#ifdef %s\n", g_project.i18n_conditional.value());
|
||||||
indentation++;
|
indentation++;
|
||||||
}
|
}
|
||||||
if (P.i18n_include[0] != '<' &&
|
if (g_project.i18n_include[0] != '<' &&
|
||||||
P.i18n_include[0] != '\"')
|
g_project.i18n_include[0] != '\"')
|
||||||
write_c("#%sinclude \"%s\"\n", indent(), P.i18n_include.value());
|
write_c("#%sinclude \"%s\"\n", indent(), g_project.i18n_include.value());
|
||||||
else
|
else
|
||||||
write_c("#%sinclude %s\n", indent(), P.i18n_include.value());
|
write_c("#%sinclude %s\n", indent(), g_project.i18n_include.value());
|
||||||
if (P.i18n_type == 2) {
|
if (g_project.i18n_type == 2) {
|
||||||
if (P.i18n_file[0]) {
|
if (g_project.i18n_file[0]) {
|
||||||
write_c("extern nl_catd %s;\n", P.i18n_file.value());
|
write_c("extern nl_catd %s;\n", g_project.i18n_file.value());
|
||||||
} else {
|
} else {
|
||||||
write_c("// Initialize I18N stuff now for menus...\n");
|
write_c("// Initialize I18N stuff now for menus...\n");
|
||||||
write_c("#%sinclude <locale.h>\n", indent());
|
write_c("#%sinclude <locale.h>\n", indent());
|
||||||
write_c("static char *_locale = setlocale(LC_MESSAGES, \"\");\n");
|
write_c("static char *_locale = setlocale(LC_MESSAGES, \"\");\n");
|
||||||
write_c("static nl_catd _catalog = catopen(\"%s\", 0);\n", P.i18n_program.value());
|
write_c("static nl_catd _catalog = catopen(\"%s\", 0);\n", g_project.i18n_program.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (conditional) {
|
if (conditional) {
|
||||||
write_c("#else\n");
|
write_c("#else\n");
|
||||||
if (P.i18n_type == 1) {
|
if (g_project.i18n_type == 1) {
|
||||||
if (P.i18n_function[0]) {
|
if (g_project.i18n_function[0]) {
|
||||||
write_c("#%sifndef %s\n", indent(), P.i18n_function.value());
|
write_c("#%sifndef %s\n", indent(), g_project.i18n_function.value());
|
||||||
write_c("#%sdefine %s(text) text\n", indent_plus(1), P.i18n_function.value());
|
write_c("#%sdefine %s(text) text\n", indent_plus(1), g_project.i18n_function.value());
|
||||||
write_c("#%sendif\n", indent());
|
write_c("#%sendif\n", indent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (P.i18n_type == 2) {
|
if (g_project.i18n_type == 2) {
|
||||||
write_c("#%sifndef catgets\n", indent());
|
write_c("#%sifndef catgets\n", indent());
|
||||||
write_c("#%sdefine catgets(catalog, set, msgid, text) text\n", indent_plus(1));
|
write_c("#%sdefine catgets(catalog, set, msgid, text) text\n", indent_plus(1));
|
||||||
write_c("#%sendif\n", indent());
|
write_c("#%sendif\n", indent());
|
||||||
@ -632,9 +632,9 @@ int write_code(const char *s, const char *t) {
|
|||||||
indentation--;
|
indentation--;
|
||||||
write_c("#endif\n");
|
write_c("#endif\n");
|
||||||
}
|
}
|
||||||
if (P.i18n_type == 1 && P.i18n_static_function[0]) {
|
if (g_project.i18n_type == 1 && g_project.i18n_static_function[0]) {
|
||||||
write_c("#ifndef %s\n", P.i18n_static_function.value());
|
write_c("#ifndef %s\n", g_project.i18n_static_function.value());
|
||||||
write_c("#%sdefine %s(text) text\n", indent_plus(1), P.i18n_static_function.value());
|
write_c("#%sdefine %s(text) text\n", indent_plus(1), g_project.i18n_static_function.value());
|
||||||
write_c("#endif\n");
|
write_c("#endif\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -692,7 +692,7 @@ int write_strings(const char *sfile) {
|
|||||||
|
|
||||||
if (!fp) return 1;
|
if (!fp) return 1;
|
||||||
|
|
||||||
switch (P.i18n_type) {
|
switch (g_project.i18n_type) {
|
||||||
case 0 : /* None, just put static text out */
|
case 0 : /* None, just put static text out */
|
||||||
fprintf(fp, "# generated by Fast Light User Interface Designer (fluid) version %.4f\n",
|
fprintf(fp, "# generated by Fast Light User Interface Designer (fluid) version %.4f\n",
|
||||||
FL_VERSION);
|
FL_VERSION);
|
||||||
@ -772,7 +772,7 @@ int write_strings(const char *sfile) {
|
|||||||
case 2 : /* POSIX catgets, put a .msg file out */
|
case 2 : /* POSIX catgets, put a .msg file out */
|
||||||
fprintf(fp, "$ generated by Fast Light User Interface Designer (fluid) version %.4f\n",
|
fprintf(fp, "$ generated by Fast Light User Interface Designer (fluid) version %.4f\n",
|
||||||
FL_VERSION);
|
FL_VERSION);
|
||||||
fprintf(fp, "$set %s\n", P.i18n_set.value());
|
fprintf(fp, "$set %s\n", g_project.i18n_set.value());
|
||||||
fputs("$quote \"\n", fp);
|
fputs("$quote \"\n", fp);
|
||||||
|
|
||||||
for (i = 1, p = Fl_Type::first; p; p = p->next) {
|
for (i = 1, p = Fl_Type::first; p; p = p->next) {
|
||||||
|
@ -377,36 +377,36 @@ int write_file(const char *filename, int selected_only) {
|
|||||||
if (!open_write(filename)) return 0;
|
if (!open_write(filename)) return 0;
|
||||||
write_string("# data file for the Fltk User Interface Designer (fluid)\n"
|
write_string("# data file for the Fltk User Interface Designer (fluid)\n"
|
||||||
"version %.4f",FL_VERSION);
|
"version %.4f",FL_VERSION);
|
||||||
if(!P.include_H_from_C)
|
if(!g_project.include_H_from_C)
|
||||||
write_string("\ndo_not_include_H_from_C");
|
write_string("\ndo_not_include_H_from_C");
|
||||||
if(P.use_FL_COMMAND)
|
if(g_project.use_FL_COMMAND)
|
||||||
write_string("\nuse_FL_COMMAND");
|
write_string("\nuse_FL_COMMAND");
|
||||||
if (P.utf8_in_src)
|
if (g_project.utf8_in_src)
|
||||||
write_string("\nutf8_in_src");
|
write_string("\nutf8_in_src");
|
||||||
if (P.avoid_early_includes)
|
if (g_project.avoid_early_includes)
|
||||||
write_string("\navoid_early_includes");
|
write_string("\navoid_early_includes");
|
||||||
if (P.i18n_type) {
|
if (g_project.i18n_type) {
|
||||||
write_string("\ni18n_type %d", P.i18n_type);
|
write_string("\ni18n_type %d", g_project.i18n_type);
|
||||||
write_string("\ni18n_include"); write_word(P.i18n_include);
|
write_string("\ni18n_include"); write_word(g_project.i18n_include);
|
||||||
write_string("\ni18n_conditional"); write_word(P.i18n_conditional);
|
write_string("\ni18n_conditional"); write_word(g_project.i18n_conditional);
|
||||||
switch (P.i18n_type) {
|
switch (g_project.i18n_type) {
|
||||||
case 1 : /* GNU gettext */
|
case 1 : /* GNU gettext */
|
||||||
write_string("\ni18n_function"); write_word(P.i18n_function);
|
write_string("\ni18n_function"); write_word(g_project.i18n_function);
|
||||||
write_string("\ni18n_static_function"); write_word(P.i18n_static_function);
|
write_string("\ni18n_static_function"); write_word(g_project.i18n_static_function);
|
||||||
break;
|
break;
|
||||||
case 2 : /* POSIX catgets */
|
case 2 : /* POSIX catgets */
|
||||||
if (P.i18n_file[0]) {
|
if (g_project.i18n_file[0]) {
|
||||||
write_string("\ni18n_file");
|
write_string("\ni18n_file");
|
||||||
write_word(P.i18n_file);
|
write_word(g_project.i18n_file);
|
||||||
}
|
}
|
||||||
write_string("\ni18n_set"); write_word(P.i18n_set);
|
write_string("\ni18n_set"); write_word(g_project.i18n_set);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!selected_only) {
|
if (!selected_only) {
|
||||||
write_string("\nheader_name"); write_word(P.header_file_name);
|
write_string("\nheader_name"); write_word(g_project.header_file_name);
|
||||||
write_string("\ncode_name"); write_word(P.code_file_name);
|
write_string("\ncode_name"); write_word(g_project.code_file_name);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// https://github.com/fltk/fltk/issues/328
|
// https://github.com/fltk/fltk/issues/328
|
||||||
@ -495,62 +495,62 @@ static void read_children(Fl_Type *p, int paste, Strategy strategy, char skip_op
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(c,"do_not_include_H_from_C")) {
|
if (!strcmp(c,"do_not_include_H_from_C")) {
|
||||||
P.include_H_from_C=0;
|
g_project.include_H_from_C=0;
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"use_FL_COMMAND")) {
|
if (!strcmp(c,"use_FL_COMMAND")) {
|
||||||
P.use_FL_COMMAND=1;
|
g_project.use_FL_COMMAND=1;
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"utf8_in_src")) {
|
if (!strcmp(c,"utf8_in_src")) {
|
||||||
P.utf8_in_src=1;
|
g_project.utf8_in_src=1;
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"avoid_early_includes")) {
|
if (!strcmp(c,"avoid_early_includes")) {
|
||||||
P.avoid_early_includes=1;
|
g_project.avoid_early_includes=1;
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"i18n_type")) {
|
if (!strcmp(c,"i18n_type")) {
|
||||||
P.i18n_type = atoi(read_word());
|
g_project.i18n_type = atoi(read_word());
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"i18n_function")) {
|
if (!strcmp(c,"i18n_function")) {
|
||||||
P.i18n_function = read_word();
|
g_project.i18n_function = read_word();
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"i18n_static_function")) {
|
if (!strcmp(c,"i18n_static_function")) {
|
||||||
P.i18n_static_function = read_word();
|
g_project.i18n_static_function = read_word();
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"i18n_file")) {
|
if (!strcmp(c,"i18n_file")) {
|
||||||
P.i18n_file = read_word();
|
g_project.i18n_file = read_word();
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"i18n_set")) {
|
if (!strcmp(c,"i18n_set")) {
|
||||||
P.i18n_set = read_word();
|
g_project.i18n_set = read_word();
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"i18n_include")) {
|
if (!strcmp(c,"i18n_include")) {
|
||||||
P.i18n_include = read_word();
|
g_project.i18n_include = read_word();
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"i18n_conditional")) {
|
if (!strcmp(c,"i18n_conditional")) {
|
||||||
P.i18n_conditional = read_word();
|
g_project.i18n_conditional = read_word();
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"i18n_type"))
|
if (!strcmp(c,"i18n_type"))
|
||||||
{
|
{
|
||||||
P.i18n_type = atoi(read_word());
|
g_project.i18n_type = atoi(read_word());
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
if (!strcmp(c,"header_name")) {
|
if (!strcmp(c,"header_name")) {
|
||||||
if (!P.header_file_set) P.header_file_name = read_word();
|
if (!g_project.header_file_set) g_project.header_file_name = read_word();
|
||||||
else read_word();
|
else read_word();
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(c,"code_name")) {
|
if (!strcmp(c,"code_name")) {
|
||||||
if (!P.code_file_set) P.code_file_name = read_word();
|
if (!g_project.code_file_set) g_project.code_file_name = read_word();
|
||||||
else read_word();
|
else read_word();
|
||||||
goto CONTINUE;
|
goto CONTINUE;
|
||||||
}
|
}
|
||||||
@ -649,7 +649,7 @@ int read_file(const char *filename, int merge, Strategy strategy) {
|
|||||||
if (merge)
|
if (merge)
|
||||||
deselect();
|
deselect();
|
||||||
else
|
else
|
||||||
P.reset();
|
g_project.reset();
|
||||||
read_children(Fl_Type::current, merge, strategy);
|
read_children(Fl_Type::current, merge, strategy);
|
||||||
Fl_Type::current = 0;
|
Fl_Type::current = 0;
|
||||||
// Force menu items to be rebuilt...
|
// Force menu items to be rebuilt...
|
||||||
|
@ -167,28 +167,28 @@ int batch_mode = 0; // if set (-c, -u) don't open display
|
|||||||
Fd_String g_code_filename_arg;
|
Fd_String g_code_filename_arg;
|
||||||
Fd_String g_header_filename_arg;
|
Fd_String g_header_filename_arg;
|
||||||
|
|
||||||
/** \var int Project::header_file_set
|
/** \var int Fluid_Project::header_file_set
|
||||||
If set, commandline overrides header file name in .fl file.
|
If set, commandline overrides header file name in .fl file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::code_file_set
|
/** \var int Fluid_Project::code_file_set
|
||||||
If set, commandline overrides source code file name in .fl file.
|
If set, commandline overrides source code file name in .fl file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::header_file_name
|
/** \var int Fluid_Project::header_file_name
|
||||||
Hold the default extension for header files, or the entire filename if set via command line.
|
Hold the default extension for header files, or the entire filename if set via command line.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::code_file_name
|
/** \var int Fluid_Project::code_file_name
|
||||||
Hold the default extension for source code files, or the entire filename if set via command line.
|
Hold the default extension for source code files, or the entire filename if set via command line.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::i18n_type
|
/** \var int Fluid_Project::i18n_type
|
||||||
Saved in the .fl design file.
|
Saved in the .fl design file.
|
||||||
\todo document me
|
\todo document me
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::i18n_include
|
/** \var int Fluid_Project::i18n_include
|
||||||
For either type of translation, write a #include statement into the
|
For either type of translation, write a #include statement into the
|
||||||
source file.
|
source file.
|
||||||
|
|
||||||
@ -202,12 +202,12 @@ Fd_String g_header_filename_arg;
|
|||||||
Saved in the .fl design file.
|
Saved in the .fl design file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::i18n_conditional
|
/** \var int Fluid_Project::i18n_conditional
|
||||||
Saved in the .fl design file.
|
Saved in the .fl design file.
|
||||||
\todo document me
|
\todo document me
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::i18n_function
|
/** \var int Fluid_Project::i18n_function
|
||||||
For the gettext/intl.h options, this is the function that translates text
|
For the gettext/intl.h options, this is the function that translates text
|
||||||
at runtime.
|
at runtime.
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ Fd_String g_header_filename_arg;
|
|||||||
Saved in the .fl design file.
|
Saved in the .fl design file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::i18n_static_function
|
/** \var int Fluid_Project::i18n_static_function
|
||||||
For the gettext/intl.h options, this is the function that marks the
|
For the gettext/intl.h options, this is the function that marks the
|
||||||
translation of text at initialisation time.
|
translation of text at initialisation time.
|
||||||
|
|
||||||
@ -228,17 +228,17 @@ Fd_String g_header_filename_arg;
|
|||||||
Saved in the .fl design file.
|
Saved in the .fl design file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::i18n_file
|
/** \var int Fluid_Project::i18n_file
|
||||||
Saved in the .fl design file.
|
Saved in the .fl design file.
|
||||||
\todo document me
|
\todo document me
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::i18n_set
|
/** \var int Fluid_Project::i18n_set
|
||||||
Saved in the .fl design file.
|
Saved in the .fl design file.
|
||||||
\todo document me
|
\todo document me
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \var int Project::i18n_program
|
/** \var int Fluid_Project::i18n_program
|
||||||
\todo document me
|
\todo document me
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -250,9 +250,9 @@ static int ipasteoffset = 0;
|
|||||||
|
|
||||||
// ---- project settings
|
// ---- project settings
|
||||||
|
|
||||||
Project P;
|
Fluid_Project g_project;
|
||||||
|
|
||||||
Project::Project() :
|
Fluid_Project::Fluid_Project() :
|
||||||
i18n_type(0),
|
i18n_type(0),
|
||||||
include_H_from_C(1),
|
include_H_from_C(1),
|
||||||
use_FL_COMMAND(0),
|
use_FL_COMMAND(0),
|
||||||
@ -264,10 +264,10 @@ Project::Project() :
|
|||||||
code_file_name(".cxx")
|
code_file_name(".cxx")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
Project::~Project() {
|
Fluid_Project::~Fluid_Project() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::reset() {
|
void Fluid_Project::reset() {
|
||||||
::delete_all();
|
::delete_all();
|
||||||
i18n_type = 0;
|
i18n_type = 0;
|
||||||
i18n_include = "";
|
i18n_include = "";
|
||||||
@ -698,7 +698,7 @@ void exit_cb(Fl_Widget *,void *) {
|
|||||||
// Destroy tree
|
// Destroy tree
|
||||||
// Doing so causes dtors to automatically close all external editors
|
// Doing so causes dtors to automatically close all external editors
|
||||||
// and cleans up editor tmp files. Then remove fluid tmpdir /last/.
|
// and cleans up editor tmp files. Then remove fluid tmpdir /last/.
|
||||||
P.reset();
|
g_project.reset();
|
||||||
ExternalCodeEditor::tmpdir_clear();
|
ExternalCodeEditor::tmpdir_clear();
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -865,7 +865,7 @@ void new_cb(Fl_Widget *, void *v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear the current data...
|
// Clear the current data...
|
||||||
P.reset();
|
g_project.reset();
|
||||||
set_filename(NULL);
|
set_filename(NULL);
|
||||||
set_modflag(0, 0);
|
set_modflag(0, 0);
|
||||||
widget_browser->rebuild();
|
widget_browser->rebuild();
|
||||||
@ -997,20 +997,20 @@ int write_code_files() {
|
|||||||
}
|
}
|
||||||
char cname[FL_PATH_MAX+1];
|
char cname[FL_PATH_MAX+1];
|
||||||
char hname[FL_PATH_MAX+1];
|
char hname[FL_PATH_MAX+1];
|
||||||
P.i18n_program = fl_filename_name(filename);
|
g_project.i18n_program = fl_filename_name(filename);
|
||||||
P.i18n_program.capacity(FL_PATH_MAX);
|
g_project.i18n_program.capacity(FL_PATH_MAX);
|
||||||
fl_filename_setext(P.i18n_program.buffer(), FL_PATH_MAX, "");
|
fl_filename_setext(g_project.i18n_program.buffer(), FL_PATH_MAX, "");
|
||||||
if (P.code_file_name[0] == '.' && strchr(P.code_file_name, '/') == NULL) {
|
if (g_project.code_file_name[0] == '.' && strchr(g_project.code_file_name, '/') == NULL) {
|
||||||
strlcpy(cname, fl_filename_name(filename), FL_PATH_MAX);
|
strlcpy(cname, fl_filename_name(filename), FL_PATH_MAX);
|
||||||
fl_filename_setext(cname, FL_PATH_MAX, P.code_file_name);
|
fl_filename_setext(cname, FL_PATH_MAX, g_project.code_file_name);
|
||||||
} else {
|
} else {
|
||||||
strlcpy(cname, P.code_file_name, FL_PATH_MAX);
|
strlcpy(cname, g_project.code_file_name, FL_PATH_MAX);
|
||||||
}
|
}
|
||||||
if (P.header_file_name[0] == '.' && strchr(P.header_file_name, '/') == NULL) {
|
if (g_project.header_file_name[0] == '.' && strchr(g_project.header_file_name, '/') == NULL) {
|
||||||
strlcpy(hname, fl_filename_name(filename), FL_PATH_MAX);
|
strlcpy(hname, fl_filename_name(filename), FL_PATH_MAX);
|
||||||
fl_filename_setext(hname, FL_PATH_MAX, P.header_file_name);
|
fl_filename_setext(hname, FL_PATH_MAX, g_project.header_file_name);
|
||||||
} else {
|
} else {
|
||||||
strlcpy(hname, P.header_file_name, FL_PATH_MAX);
|
strlcpy(hname, g_project.header_file_name, FL_PATH_MAX);
|
||||||
}
|
}
|
||||||
if (!batch_mode) enter_project_dir();
|
if (!batch_mode) enter_project_dir();
|
||||||
int x = write_code(cname,hname);
|
int x = write_code(cname,hname);
|
||||||
@ -1051,7 +1051,7 @@ void write_strings_cb(Fl_Widget *, void *) {
|
|||||||
}
|
}
|
||||||
char sname[FL_PATH_MAX];
|
char sname[FL_PATH_MAX];
|
||||||
strlcpy(sname, fl_filename_name(filename), sizeof(sname));
|
strlcpy(sname, fl_filename_name(filename), sizeof(sname));
|
||||||
fl_filename_setext(sname, sizeof(sname), exts[P.i18n_type]);
|
fl_filename_setext(sname, sizeof(sname), exts[g_project.i18n_type]);
|
||||||
if (!batch_mode) enter_project_dir();
|
if (!batch_mode) enter_project_dir();
|
||||||
int x = write_strings(sname);
|
int x = write_strings(sname);
|
||||||
if (!batch_mode) leave_project_dir();
|
if (!batch_mode) leave_project_dir();
|
||||||
@ -1757,7 +1757,7 @@ void set_modflag(int mf, int mfc) {
|
|||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
else basename = filename;
|
else basename = filename;
|
||||||
|
|
||||||
code_ext = fl_filename_ext(P.code_file_name);
|
code_ext = fl_filename_ext(g_project.code_file_name);
|
||||||
char mod_star = modflag ? '*' : ' ';
|
char mod_star = modflag ? '*' : ' ';
|
||||||
char mod_c_star = modflag_c ? '*' : ' ';
|
char mod_c_star = modflag_c ? '*' : ' ';
|
||||||
snprintf(title, sizeof(title), "%s%c %s%c",
|
snprintf(title, sizeof(title), "%s%c %s%c",
|
||||||
@ -1872,19 +1872,19 @@ void update_sourceview_cb(Fl_Button*, void*)
|
|||||||
static const char *exts[] = { ".txt", ".po", ".msg" };
|
static const char *exts[] = { ".txt", ".po", ".msg" };
|
||||||
char fn[FL_PATH_MAX];
|
char fn[FL_PATH_MAX];
|
||||||
fluid_prefs.getUserdataPath(fn, FL_PATH_MAX);
|
fluid_prefs.getUserdataPath(fn, FL_PATH_MAX);
|
||||||
fl_filename_setext(fn, FL_PATH_MAX, exts[P.i18n_type]);
|
fl_filename_setext(fn, FL_PATH_MAX, exts[g_project.i18n_type]);
|
||||||
write_strings(fn);
|
write_strings(fn);
|
||||||
int top = sv_strings->top_line();
|
int top = sv_strings->top_line();
|
||||||
sv_strings->buffer()->loadfile(fn);
|
sv_strings->buffer()->loadfile(fn);
|
||||||
sv_strings->scroll(top, 0);
|
sv_strings->scroll(top, 0);
|
||||||
} else if (sv_source->visible_r() || sv_header->visible_r()) {
|
} else if (sv_source->visible_r() || sv_header->visible_r()) {
|
||||||
P.i18n_program = fl_filename_name(sv_source_filename);
|
g_project.i18n_program = fl_filename_name(sv_source_filename);
|
||||||
P.i18n_program.capacity(FL_PATH_MAX);
|
g_project.i18n_program.capacity(FL_PATH_MAX);
|
||||||
fl_filename_setext(P.i18n_program.buffer(), FL_PATH_MAX, "");
|
fl_filename_setext(g_project.i18n_program.buffer(), FL_PATH_MAX, "");
|
||||||
Fd_String code_file_name_bak = P.code_file_name;
|
Fd_String code_file_name_bak = g_project.code_file_name;
|
||||||
P.code_file_name = sv_source_filename;
|
g_project.code_file_name = sv_source_filename;
|
||||||
Fd_String header_file_name_bak = P.header_file_name;
|
Fd_String header_file_name_bak = g_project.header_file_name;
|
||||||
P.header_file_name = sv_header_filename;
|
g_project.header_file_name = sv_header_filename;
|
||||||
|
|
||||||
// generate the code and load the files
|
// generate the code and load the files
|
||||||
write_sourceview = 1;
|
write_sourceview = 1;
|
||||||
@ -1904,8 +1904,8 @@ void update_sourceview_cb(Fl_Button*, void*)
|
|||||||
}
|
}
|
||||||
write_sourceview = 0;
|
write_sourceview = 0;
|
||||||
|
|
||||||
P.code_file_name = code_file_name_bak;
|
g_project.code_file_name = code_file_name_bak;
|
||||||
P.header_file_name = header_file_name_bak;
|
g_project.header_file_name = header_file_name_bak;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2059,12 +2059,12 @@ int main(int argc,char **argv) {
|
|||||||
|
|
||||||
// command line args override code and header filenams from the project file
|
// command line args override code and header filenams from the project file
|
||||||
if (!g_code_filename_arg.empty()) {
|
if (!g_code_filename_arg.empty()) {
|
||||||
P.code_file_set = 1;
|
g_project.code_file_set = 1;
|
||||||
P.code_file_name = g_code_filename_arg;
|
g_project.code_file_name = g_code_filename_arg;
|
||||||
}
|
}
|
||||||
if (!g_header_filename_arg.empty()) {
|
if (!g_header_filename_arg.empty()) {
|
||||||
P.header_file_set = 1;
|
g_project.header_file_set = 1;
|
||||||
P.header_file_name = g_header_filename_arg;
|
g_project.header_file_name = g_header_filename_arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_file) { // fluid -u
|
if (update_file) { // fluid -u
|
||||||
|
@ -92,10 +92,10 @@ public:
|
|||||||
|
|
||||||
// ---- project settings
|
// ---- project settings
|
||||||
|
|
||||||
class Project {
|
class Fluid_Project {
|
||||||
public:
|
public:
|
||||||
Project();
|
Fluid_Project();
|
||||||
~Project();
|
~Fluid_Project();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
int i18n_type;
|
int i18n_type;
|
||||||
@ -116,7 +116,7 @@ public:
|
|||||||
Fd_String code_file_name;
|
Fd_String code_file_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Project P;
|
extern Fluid_Project g_project;
|
||||||
|
|
||||||
extern Fd_String g_code_filename_arg;
|
extern Fd_String g_code_filename_arg;
|
||||||
extern Fd_String g_header_filename_arg;
|
extern Fd_String g_header_filename_arg;
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
int get_fileno() const;
|
int get_fileno() const;
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
protected:
|
protected:
|
||||||
HANDLE pin[2], pout[2], perr[2];
|
HANDLE pin[2], pout[2], perr[2];
|
||||||
char ptmode;
|
char ptmode;
|
||||||
|
@ -178,12 +178,6 @@ Fl_Double_Window* make_widget_panel() {
|
|||||||
o->labelsize(11);
|
o->labelsize(11);
|
||||||
o->callback((Fl_Callback*)image_browse_cb);
|
o->callback((Fl_Callback*)image_browse_cb);
|
||||||
} // Fl_Button* o
|
} // Fl_Button* o
|
||||||
{ Fl_Button* o = new Fl_Button(384, 65, 20, 20);
|
|
||||||
o->tooltip("bind the image to the widget, so it will be deleted automatically");
|
|
||||||
o->type(1);
|
|
||||||
o->callback((Fl_Callback*)bind_image_cb);
|
|
||||||
o->image(bind_pixmap);
|
|
||||||
} // Fl_Button* o
|
|
||||||
{ Fl_Button* o = new Fl_Button(364, 65, 20, 20);
|
{ Fl_Button* o = new Fl_Button(364, 65, 20, 20);
|
||||||
o->tooltip("store image uncompressed as RGBA data\nor compressed in the original file for\
|
o->tooltip("store image uncompressed as RGBA data\nor compressed in the original file for\
|
||||||
mat");
|
mat");
|
||||||
@ -191,6 +185,12 @@ mat");
|
|||||||
o->callback((Fl_Callback*)compress_image_cb);
|
o->callback((Fl_Callback*)compress_image_cb);
|
||||||
o->image(compressed_pixmap);
|
o->image(compressed_pixmap);
|
||||||
} // Fl_Button* o
|
} // Fl_Button* o
|
||||||
|
{ Fl_Button* o = new Fl_Button(384, 65, 20, 20);
|
||||||
|
o->tooltip("bind the image to the widget, so it will be deleted automatically");
|
||||||
|
o->type(1);
|
||||||
|
o->callback((Fl_Callback*)bind_image_cb);
|
||||||
|
o->image(bind_pixmap);
|
||||||
|
} // Fl_Button* o
|
||||||
o->end();
|
o->end();
|
||||||
} // Fl_Group* o
|
} // Fl_Group* o
|
||||||
{ Fl_Group* o = new Fl_Group(95, 90, 309, 20, "Inactive:");
|
{ Fl_Group* o = new Fl_Group(95, 90, 309, 20, "Inactive:");
|
||||||
@ -211,12 +211,6 @@ mat");
|
|||||||
o->labelsize(11);
|
o->labelsize(11);
|
||||||
o->callback((Fl_Callback*)inactive_browse_cb);
|
o->callback((Fl_Callback*)inactive_browse_cb);
|
||||||
} // Fl_Button* o
|
} // Fl_Button* o
|
||||||
{ Fl_Button* o = new Fl_Button(384, 90, 20, 20);
|
|
||||||
o->tooltip("bind the image to the widget, so it will be deleted automatically");
|
|
||||||
o->type(1);
|
|
||||||
o->callback((Fl_Callback*)bind_deimage_cb);
|
|
||||||
o->image(bind_pixmap);
|
|
||||||
} // Fl_Button* o
|
|
||||||
{ Fl_Button* o = new Fl_Button(364, 90, 20, 20);
|
{ Fl_Button* o = new Fl_Button(364, 90, 20, 20);
|
||||||
o->tooltip("store image uncompressed as RGBA data\nor compressed in the original file for\
|
o->tooltip("store image uncompressed as RGBA data\nor compressed in the original file for\
|
||||||
mat");
|
mat");
|
||||||
@ -224,6 +218,12 @@ mat");
|
|||||||
o->callback((Fl_Callback*)compress_deimage_cb);
|
o->callback((Fl_Callback*)compress_deimage_cb);
|
||||||
o->image(compressed_pixmap);
|
o->image(compressed_pixmap);
|
||||||
} // Fl_Button* o
|
} // Fl_Button* o
|
||||||
|
{ Fl_Button* o = new Fl_Button(384, 90, 20, 20);
|
||||||
|
o->tooltip("bind the image to the widget, so it will be deleted automatically");
|
||||||
|
o->type(1);
|
||||||
|
o->callback((Fl_Callback*)bind_deimage_cb);
|
||||||
|
o->image(bind_pixmap);
|
||||||
|
} // Fl_Button* o
|
||||||
o->end();
|
o->end();
|
||||||
} // Fl_Group* o
|
} // Fl_Group* o
|
||||||
{ Fl_Group* o = new Fl_Group(95, 115, 310, 20, "Alignment:");
|
{ Fl_Group* o = new Fl_Group(95, 115, 310, 20, "Alignment:");
|
||||||
|
@ -74,12 +74,6 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 15 t
|
|||||||
callback image_browse_cb
|
callback image_browse_cb
|
||||||
tooltip {Click to choose the active image.} xywh {294 65 70 20} labelsize 11
|
tooltip {Click to choose the active image.} xywh {294 65 70 20} labelsize 11
|
||||||
}
|
}
|
||||||
Fl_Button {} {
|
|
||||||
callback bind_image_cb
|
|
||||||
tooltip {bind the image to the widget, so it will be deleted automatically} xywh {384 65 20 20} type Toggle
|
|
||||||
code0 {o->image(bind_pixmap);}
|
|
||||||
code3 {\#include "pixmaps.h"}
|
|
||||||
}
|
|
||||||
Fl_Button {} {
|
Fl_Button {} {
|
||||||
callback compress_image_cb
|
callback compress_image_cb
|
||||||
tooltip {store image uncompressed as RGBA data
|
tooltip {store image uncompressed as RGBA data
|
||||||
@ -87,6 +81,12 @@ or compressed in the original file format} xywh {364 65 20 20} type Toggle
|
|||||||
code0 {o->image(compressed_pixmap);}
|
code0 {o->image(compressed_pixmap);}
|
||||||
code3 {\#include "pixmaps.h"}
|
code3 {\#include "pixmaps.h"}
|
||||||
}
|
}
|
||||||
|
Fl_Button {} {
|
||||||
|
callback bind_image_cb
|
||||||
|
tooltip {bind the image to the widget, so it will be deleted automatically} xywh {384 65 20 20} type Toggle
|
||||||
|
code0 {o->image(bind_pixmap);}
|
||||||
|
code3 {\#include "pixmaps.h"}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Fl_Group {} {
|
Fl_Group {} {
|
||||||
label {Inactive:}
|
label {Inactive:}
|
||||||
@ -102,12 +102,6 @@ or compressed in the original file format} xywh {364 65 20 20} type Toggle
|
|||||||
callback inactive_browse_cb
|
callback inactive_browse_cb
|
||||||
tooltip {Click to choose the inactive image.} xywh {294 90 70 20} labelsize 11
|
tooltip {Click to choose the inactive image.} xywh {294 90 70 20} labelsize 11
|
||||||
}
|
}
|
||||||
Fl_Button {} {
|
|
||||||
callback bind_deimage_cb
|
|
||||||
tooltip {bind the image to the widget, so it will be deleted automatically} xywh {384 90 20 20} type Toggle
|
|
||||||
code0 {o->image(bind_pixmap);}
|
|
||||||
code3 {\#include "pixmaps.h"}
|
|
||||||
}
|
|
||||||
Fl_Button {} {
|
Fl_Button {} {
|
||||||
callback compress_deimage_cb
|
callback compress_deimage_cb
|
||||||
tooltip {store image uncompressed as RGBA data
|
tooltip {store image uncompressed as RGBA data
|
||||||
@ -115,6 +109,12 @@ or compressed in the original file format} xywh {364 90 20 20} type Toggle
|
|||||||
code0 {o->image(compressed_pixmap);}
|
code0 {o->image(compressed_pixmap);}
|
||||||
code3 {\#include "pixmaps.h"}
|
code3 {\#include "pixmaps.h"}
|
||||||
}
|
}
|
||||||
|
Fl_Button {} {
|
||||||
|
callback bind_deimage_cb selected
|
||||||
|
tooltip {bind the image to the widget, so it will be deleted automatically} xywh {384 90 20 20} type Toggle
|
||||||
|
code0 {o->image(bind_pixmap);}
|
||||||
|
code3 {\#include "pixmaps.h"}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Fl_Group {} {
|
Fl_Group {} {
|
||||||
label {Alignment:}
|
label {Alignment:}
|
||||||
@ -812,7 +812,7 @@ wCallback->do_callback(wCallback, v);} open
|
|||||||
}
|
}
|
||||||
Fl_Button wLiveMode {
|
Fl_Button wLiveMode {
|
||||||
label {Live &Resize}
|
label {Live &Resize}
|
||||||
callback live_mode_cb selected
|
callback live_mode_cb
|
||||||
tooltip {Create a live duplicate of the selected widgets to test resizing and menu behavior.} xywh {155 370 80 20} type Toggle labelsize 11
|
tooltip {Create a live duplicate of the selected widgets to test resizing and menu behavior.} xywh {155 370 80 20} type Toggle labelsize 11
|
||||||
}
|
}
|
||||||
Fl_Button {} {
|
Fl_Button {} {
|
||||||
|
@ -33,12 +33,12 @@ extern void image_cb(Fl_Input*, void*);
|
|||||||
#include <FL/Fl_Button.H>
|
#include <FL/Fl_Button.H>
|
||||||
extern void image_browse_cb(Fl_Button*, void*);
|
extern void image_browse_cb(Fl_Button*, void*);
|
||||||
#include "pixmaps.h"
|
#include "pixmaps.h"
|
||||||
extern void bind_image_cb(Fl_Button*, void*);
|
|
||||||
extern void compress_image_cb(Fl_Button*, void*);
|
extern void compress_image_cb(Fl_Button*, void*);
|
||||||
|
extern void bind_image_cb(Fl_Button*, void*);
|
||||||
extern void inactive_cb(Fl_Input*, void*);
|
extern void inactive_cb(Fl_Input*, void*);
|
||||||
extern void inactive_browse_cb(Fl_Button*, void*);
|
extern void inactive_browse_cb(Fl_Button*, void*);
|
||||||
extern void bind_deimage_cb(Fl_Button*, void*);
|
|
||||||
extern void compress_deimage_cb(Fl_Button*, void*);
|
extern void compress_deimage_cb(Fl_Button*, void*);
|
||||||
|
extern void bind_deimage_cb(Fl_Button*, void*);
|
||||||
extern void align_cb(Fl_Button*, void*);
|
extern void align_cb(Fl_Button*, void*);
|
||||||
extern void align_text_image_cb(Fl_Choice*, void*);
|
extern void align_text_image_cb(Fl_Choice*, void*);
|
||||||
extern void align_position_cb(Fl_Choice*, void*);
|
extern void align_position_cb(Fl_Choice*, void*);
|
||||||
|
@ -274,7 +274,7 @@ void Fl_BMP_Image::load_bmp_(Fl_Image_Reader &rdr, int ico_height, int ico_width
|
|||||||
bDepth = 4;
|
bDepth = 4;
|
||||||
|
|
||||||
// Setup image and buffers...
|
// Setup image and buffers...
|
||||||
if (offbits) rdr.seek(offbits);
|
if (offbits) rdr.seek((unsigned int)offbits);
|
||||||
CHECK_ERROR
|
CHECK_ERROR
|
||||||
|
|
||||||
if (((size_t)width) * height * bDepth > max_size() ) {
|
if (((size_t)width) * height * bDepth > max_size() ) {
|
||||||
|
@ -387,7 +387,7 @@ int Fl_Browser::item_height(void *item) const {
|
|||||||
case 'B':
|
case 'B':
|
||||||
case 'C': while (isdigit(*str & 255)) str++; break; // skip a color number
|
case 'C': while (isdigit(*str & 255)) str++; break; // skip a color number
|
||||||
case 'F': font = (Fl_Font)strtol(str,&str,10); break;
|
case 'F': font = (Fl_Font)strtol(str,&str,10); break;
|
||||||
case 'S': tsize = strtol(str,&str,10); break;
|
case 'S': tsize = (int)strtol(str,&str,10); break;
|
||||||
case '.': goto END_FORMAT;
|
case '.': goto END_FORMAT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -450,7 +450,7 @@ int Fl_Browser::item_width(void *item) const {
|
|||||||
case 'B':
|
case 'B':
|
||||||
case 'C': while (isdigit(*str & 255)) str++; break; // skip a color number
|
case 'C': while (isdigit(*str & 255)) str++; break; // skip a color number
|
||||||
case 'F': font = (Fl_Font)strtol(str, &str, 10); break;
|
case 'F': font = (Fl_Font)strtol(str, &str, 10); break;
|
||||||
case 'S': tsize = strtol(str, &str, 10); break;
|
case 'S': tsize = (int)strtol(str, &str, 10); break;
|
||||||
case '.':
|
case '.':
|
||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
@ -556,7 +556,7 @@ void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const {
|
|||||||
lcol = FL_INACTIVE_COLOR;
|
lcol = FL_INACTIVE_COLOR;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
tsize = strtol(str, &str, 10);
|
tsize = (int)strtol(str, &str, 10);
|
||||||
break;
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
fl_color(FL_DARK3);
|
fl_color(FL_DARK3);
|
||||||
|
@ -455,15 +455,15 @@ int Fl_File_Icon::load_image(const char *ifile) // I - File to read from
|
|||||||
case 3 :
|
case 3 :
|
||||||
val[0] = lineptr[0];
|
val[0] = lineptr[0];
|
||||||
val[1] = '\0';
|
val[1] = '\0';
|
||||||
red = 255 * strtol(val, NULL, 16) / 15;
|
red = 255 * (int)strtol(val, NULL, 16) / 15;
|
||||||
|
|
||||||
val[0] = lineptr[1];
|
val[0] = lineptr[1];
|
||||||
val[1] = '\0';
|
val[1] = '\0';
|
||||||
green = 255 * strtol(val, NULL, 16) / 15;
|
green = 255 * (int)strtol(val, NULL, 16) / 15;
|
||||||
|
|
||||||
val[0] = lineptr[2];
|
val[0] = lineptr[2];
|
||||||
val[1] = '\0';
|
val[1] = '\0';
|
||||||
blue = 255 * strtol(val, NULL, 16) / 15;
|
blue = 255 * (int)strtol(val, NULL, 16) / 15;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6 :
|
case 6 :
|
||||||
@ -474,17 +474,17 @@ int Fl_File_Icon::load_image(const char *ifile) // I - File to read from
|
|||||||
val[0] = lineptr[0];
|
val[0] = lineptr[0];
|
||||||
val[1] = lineptr[1];
|
val[1] = lineptr[1];
|
||||||
val[2] = '\0';
|
val[2] = '\0';
|
||||||
red = strtol(val, NULL, 16);
|
red = (int)strtol(val, NULL, 16);
|
||||||
|
|
||||||
val[0] = lineptr[j + 0];
|
val[0] = lineptr[j + 0];
|
||||||
val[1] = lineptr[j + 1];
|
val[1] = lineptr[j + 1];
|
||||||
val[2] = '\0';
|
val[2] = '\0';
|
||||||
green = strtol(val, NULL, 16);
|
green = (int)strtol(val, NULL, 16);
|
||||||
|
|
||||||
val[0] = lineptr[2 * j + 0];
|
val[0] = lineptr[2 * j + 0];
|
||||||
val[1] = lineptr[2 * j + 1];
|
val[1] = lineptr[2 * j + 1];
|
||||||
val[2] = '\0';
|
val[2] = '\0';
|
||||||
blue = strtol(val, NULL, 16);
|
blue = (int)strtol(val, NULL, 16);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1557,7 +1557,7 @@ void Fl_Help_View::format() {
|
|||||||
if (get_attr(attrs, "START", attr, sizeof(attr)) != NULL) {
|
if (get_attr(attrs, "START", attr, sizeof(attr)) != NULL) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
char *endptr = 0;
|
char *endptr = 0;
|
||||||
ol_num = strtol(attr, &endptr, 10);
|
ol_num = (int)strtol(attr, &endptr, 10);
|
||||||
if (errno || endptr == attr || ol_num < 0)
|
if (errno || endptr == attr || ol_num < 0)
|
||||||
ol_num = 1;
|
ol_num = 1;
|
||||||
}
|
}
|
||||||
@ -2765,7 +2765,7 @@ Fl_Help_View::get_color(const char *n, // I - Color name
|
|||||||
|
|
||||||
if (n[0] == '#') {
|
if (n[0] == '#') {
|
||||||
// Do hex color lookup
|
// Do hex color lookup
|
||||||
rgb = strtol(n + 1, NULL, 16);
|
rgb = (int)strtol(n + 1, NULL, 16);
|
||||||
|
|
||||||
if (strlen(n) > 4) {
|
if (strlen(n) > 4) {
|
||||||
r = rgb >> 16;
|
r = rgb >> 16;
|
||||||
@ -3757,7 +3757,7 @@ quote_char(const char *p) { // I - Quoted string
|
|||||||
|
|
||||||
if (!strchr(p, ';')) return -1;
|
if (!strchr(p, ';')) return -1;
|
||||||
if (*p == '#') {
|
if (*p == '#') {
|
||||||
if (*(p+1) == 'x' || *(p+1) == 'X') return strtol(p+2, NULL, 16);
|
if (*(p+1) == 'x' || *(p+1) == 'X') return (int)strtol(p+2, NULL, 16);
|
||||||
else return atoi(p+1);
|
else return atoi(p+1);
|
||||||
}
|
}
|
||||||
for (i = (int)(sizeof(names) / sizeof(names[0])), nameptr = names; i > 0; i --, nameptr ++)
|
for (i = (int)(sizeof(names) / sizeof(names[0])), nameptr = names; i > 0; i --, nameptr ++)
|
||||||
|
@ -81,7 +81,7 @@ public:
|
|||||||
const char *name() const { return name_; }
|
const char *name() const { return name_; }
|
||||||
|
|
||||||
// skip a given number of bytes
|
// skip a given number of bytes
|
||||||
void skip(unsigned int n) { seek(tell() + n); }
|
void skip(unsigned int n) { seek((unsigned int)tell() + n); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// open() sets this if we read from a file
|
// open() sets this if we read from a file
|
||||||
|
@ -120,14 +120,14 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@";
|
|||||||
NSMenu* this_menu = [self menu];
|
NSMenu* this_menu = [self menu];
|
||||||
NSInteger flRank = [this_menu indexOfItem:self];
|
NSInteger flRank = [this_menu indexOfItem:self];
|
||||||
NSInteger last = [this_menu numberOfItems] - 1;
|
NSInteger last = [this_menu numberOfItems] - 1;
|
||||||
int from = flRank;
|
int from = (int)flRank;
|
||||||
while(from > 0) {
|
while(from > 0) {
|
||||||
if ([[this_menu itemAtIndex:from-1] isSeparatorItem]) break;
|
if ([[this_menu itemAtIndex:from-1] isSeparatorItem]) break;
|
||||||
item = [(FLMenuItem*)[this_menu itemAtIndex:from-1] getFlItem];
|
item = [(FLMenuItem*)[this_menu itemAtIndex:from-1] getFlItem];
|
||||||
if ( !(item->flags & FL_MENU_RADIO) ) break;
|
if ( !(item->flags & FL_MENU_RADIO) ) break;
|
||||||
from--;
|
from--;
|
||||||
}
|
}
|
||||||
int to = flRank;
|
int to = (int)flRank;
|
||||||
while (to < last) {
|
while (to < last) {
|
||||||
if ([[this_menu itemAtIndex:to+1] isSeparatorItem]) break;
|
if ([[this_menu itemAtIndex:to+1] isSeparatorItem]) break;
|
||||||
item = [(FLMenuItem*)[this_menu itemAtIndex:to+1] getFlItem];
|
item = [(FLMenuItem*)[this_menu itemAtIndex:to+1] getFlItem];
|
||||||
@ -228,7 +228,7 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@";
|
|||||||
}
|
}
|
||||||
[menu addItem:item];
|
[menu addItem:item];
|
||||||
[item setTarget:item];
|
[item setTarget:item];
|
||||||
int retval = [menu indexOfItem:item];
|
int retval = (int)[menu indexOfItem:item];
|
||||||
[item release];
|
[item release];
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ static void createSubMenu( NSMenu *mh, pFl_Menu_Item &mm, const Fl_Menu_Item *m
|
|||||||
[submenu setAutoenablesItems:NO];
|
[submenu setAutoenablesItems:NO];
|
||||||
|
|
||||||
int cnt;
|
int cnt;
|
||||||
cnt = [mh numberOfItems];
|
cnt = (int)[mh numberOfItems];
|
||||||
cnt--;
|
cnt--;
|
||||||
menuItem = [mh itemAtIndex:cnt];
|
menuItem = [mh itemAtIndex:cnt];
|
||||||
[menuItem setSubmenu:submenu];
|
[menuItem setSubmenu:submenu];
|
||||||
@ -401,7 +401,7 @@ static void convertToMenuBar(const Fl_Menu_Item *mm)
|
|||||||
{
|
{
|
||||||
NSMenu *fl_system_menu = [NSApp mainMenu];
|
NSMenu *fl_system_menu = [NSApp mainMenu];
|
||||||
int count;//first, delete all existing system menus
|
int count;//first, delete all existing system menus
|
||||||
count = [fl_system_menu numberOfItems];
|
count = (int)[fl_system_menu numberOfItems];
|
||||||
for(int i = count - 1; i > 0; i--) {
|
for(int i = count - 1; i > 0; i--) {
|
||||||
[fl_system_menu removeItem:[fl_system_menu itemAtIndex:i]];
|
[fl_system_menu removeItem:[fl_system_menu itemAtIndex:i]];
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ static char *prepareMacFilter(int count, const char *filter, char **patterns) {
|
|||||||
l += strlen(patterns[i]) + 3;
|
l += strlen(patterns[i]) + 3;
|
||||||
}
|
}
|
||||||
const char *p = filter;
|
const char *p = filter;
|
||||||
const int t_size = strlen(p) + l + 1;
|
const int t_size = (int)strlen(p) + l + 1;
|
||||||
char *q; q = new char[t_size];
|
char *q; q = new char[t_size];
|
||||||
const char *r, *s;
|
const char *r, *s;
|
||||||
char *t;
|
char *t;
|
||||||
|
@ -100,7 +100,7 @@ Fl_PNM_Image::Fl_PNM_Image(const char *filename) // I - File to read
|
|||||||
if (*lineptr == '\0' || *lineptr == '#') {
|
if (*lineptr == '\0' || *lineptr == '#') {
|
||||||
lineptr = fgets(line, sizeof(line), fp);
|
lineptr = fgets(line, sizeof(line), fp);
|
||||||
} else if (isdigit(*lineptr)) {
|
} else if (isdigit(*lineptr)) {
|
||||||
w(strtol(lineptr, &lineptr, 10));
|
w((int)strtol(lineptr, &lineptr, 10));
|
||||||
} else lineptr ++;
|
} else lineptr ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ Fl_PNM_Image::Fl_PNM_Image(const char *filename) // I - File to read
|
|||||||
if (*lineptr == '\0' || *lineptr == '#') {
|
if (*lineptr == '\0' || *lineptr == '#') {
|
||||||
lineptr = fgets(line, sizeof(line), fp);
|
lineptr = fgets(line, sizeof(line), fp);
|
||||||
} else if (isdigit(*lineptr)) {
|
} else if (isdigit(*lineptr)) {
|
||||||
h(strtol(lineptr, &lineptr, 10));
|
h((int)strtol(lineptr, &lineptr, 10));
|
||||||
} else lineptr ++;
|
} else lineptr ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ Fl_PNM_Image::Fl_PNM_Image(const char *filename) // I - File to read
|
|||||||
if (*lineptr == '\0' || *lineptr == '#') {
|
if (*lineptr == '\0' || *lineptr == '#') {
|
||||||
lineptr = fgets(line, sizeof(line), fp);
|
lineptr = fgets(line, sizeof(line), fp);
|
||||||
} else if (isdigit(*lineptr)) {
|
} else if (isdigit(*lineptr)) {
|
||||||
maxval = strtol(lineptr, &lineptr, 10);
|
maxval = (int)strtol(lineptr, &lineptr, 10);
|
||||||
} else lineptr ++;
|
} else lineptr ++;
|
||||||
}
|
}
|
||||||
} else maxval = 1;
|
} else maxval = 1;
|
||||||
|
@ -394,8 +394,8 @@ int Fl_Table::find_cell(TableContext context, int R, int C, int &X, int &Y, int
|
|||||||
X=Y=W=H=0;
|
X=Y=W=H=0;
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
X = col_scroll_position(C) - hscrollbar->value() + tix;
|
X = (int)col_scroll_position(C) - hscrollbar->value() + tix;
|
||||||
Y = row_scroll_position(R) - vscrollbar->value() + tiy;
|
Y = (int)row_scroll_position(R) - vscrollbar->value() + tiy;
|
||||||
W = col_width(C);
|
W = col_width(C);
|
||||||
H = row_height(R);
|
H = row_height(R);
|
||||||
|
|
||||||
@ -580,8 +580,8 @@ void Fl_Table::table_scrolled() {
|
|||||||
Calls recall_dimensions(), and recalculates scrollbar sizes.
|
Calls recall_dimensions(), and recalculates scrollbar sizes.
|
||||||
*/
|
*/
|
||||||
void Fl_Table::table_resized() {
|
void Fl_Table::table_resized() {
|
||||||
table_h = row_scroll_position(rows());
|
table_h = (int)row_scroll_position(rows());
|
||||||
table_w = col_scroll_position(cols());
|
table_w = (int)col_scroll_position(cols());
|
||||||
recalc_dimensions();
|
recalc_dimensions();
|
||||||
// Recalc scrollbar sizes
|
// Recalc scrollbar sizes
|
||||||
// Clamp scrollbar value() after a resize.
|
// Clamp scrollbar value() after a resize.
|
||||||
|
@ -145,7 +145,7 @@ static unsigned short* macKeyLookUp = NULL;
|
|||||||
*/
|
*/
|
||||||
static unsigned int mods_to_e_state( NSUInteger mods )
|
static unsigned int mods_to_e_state( NSUInteger mods )
|
||||||
{
|
{
|
||||||
long state = 0;
|
unsigned int state = 0;
|
||||||
if ( mods & NSCommandKeyMask ) state |= FL_META;
|
if ( mods & NSCommandKeyMask ) state |= FL_META;
|
||||||
if ( mods & NSAlternateKeyMask ) state |= FL_ALT;
|
if ( mods & NSAlternateKeyMask ) state |= FL_ALT;
|
||||||
if ( mods & NSControlKeyMask ) state |= FL_CTRL;
|
if ( mods & NSControlKeyMask ) state |= FL_CTRL;
|
||||||
@ -1179,8 +1179,8 @@ static void CocoatoFLTK(Fl_Window *win, int &x, int &y) {
|
|||||||
FLWindow *nsw = fl_xid(win);
|
FLWindow *nsw = fl_xid(win);
|
||||||
ori = [nsw convertBaseToScreen:NSMakePoint(0, [[nsw contentView] frame].size.height)];
|
ori = [nsw convertBaseToScreen:NSMakePoint(0, [[nsw contentView] frame].size.height)];
|
||||||
float s = Fl::screen_driver()->scale(0);
|
float s = Fl::screen_driver()->scale(0);
|
||||||
x = lround(ori.x / s);
|
x = (int)lround(ori.x / s);
|
||||||
y = lround((main_screen_height - ori.y) / s);
|
y = (int)lround((main_screen_height - ori.y) / s);
|
||||||
while (win->parent()) {win = win->window(); x -= win->x(); y -= win->y();}
|
while (win->parent()) {win = win->window(); x -= win->x(); y -= win->y();}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1262,12 +1262,12 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
|
|||||||
plugin = (Fl_Cocoa_Plugin*)pm.plugin("gl.cocoa.fltk.org");
|
plugin = (Fl_Cocoa_Plugin*)pm.plugin("gl.cocoa.fltk.org");
|
||||||
}
|
}
|
||||||
// calls Fl_Gl_Window::resize() without including Fl_Gl_Window.H
|
// calls Fl_Gl_Window::resize() without including Fl_Gl_Window.H
|
||||||
plugin->resize(window->as_gl_window(), X, Y, lround(r.size.width/s), lround(r.size.height/s));
|
plugin->resize(window->as_gl_window(), X, Y, (int)lround(r.size.width/s), (int)lround(r.size.height/s));
|
||||||
} else {
|
} else {
|
||||||
Fl_Cocoa_Window_Driver::driver(window)->resize(X, Y, lround(r.size.width/s), lround(r.size.height/s));
|
Fl_Cocoa_Window_Driver::driver(window)->resize(X, Y, (int)lround(r.size.width/s), (int)lround(r.size.height/s));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
window->resize(X, Y, lround(r.size.width/s), lround(r.size.height/s));
|
window->resize(X, Y, (int)lround(r.size.width/s), (int)lround(r.size.height/s));
|
||||||
Fl_Cocoa_Window_Driver::driver(window)->view_resized(0);
|
Fl_Cocoa_Window_Driver::driver(window)->view_resized(0);
|
||||||
update_e_xy_and_e_xy_root(nsw);
|
update_e_xy_and_e_xy_root(nsw);
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
||||||
@ -2031,7 +2031,7 @@ Fl_Window *fl_dnd_target_window = 0;
|
|||||||
static void q_set_window_title(NSWindow *nsw, const char * name, const char *mininame) {
|
static void q_set_window_title(NSWindow *nsw, const char * name, const char *mininame) {
|
||||||
CFStringRef title = CFStringCreateWithCString(NULL, (name ? name : ""), kCFStringEncodingUTF8);
|
CFStringRef title = CFStringCreateWithCString(NULL, (name ? name : ""), kCFStringEncodingUTF8);
|
||||||
if(!title) { // fallback when name contains malformed UTF-8
|
if(!title) { // fallback when name contains malformed UTF-8
|
||||||
int l = strlen(name);
|
int l = (int)strlen(name);
|
||||||
unsigned short* utf16 = new unsigned short[l + 1];
|
unsigned short* utf16 = new unsigned short[l + 1];
|
||||||
l = fl_utf8toUtf16(name, l, utf16, l + 1);
|
l = fl_utf8toUtf16(name, l, utf16, l + 1);
|
||||||
title = CFStringCreateWithCharacters(NULL, utf16, l);
|
title = CFStringCreateWithCharacters(NULL, utf16, l);
|
||||||
@ -2471,10 +2471,10 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
|
|||||||
- (void)flagsChanged:(NSEvent *)theEvent {
|
- (void)flagsChanged:(NSEvent *)theEvent {
|
||||||
//NSLog(@"flagsChanged: ");
|
//NSLog(@"flagsChanged: ");
|
||||||
fl_lock_function();
|
fl_lock_function();
|
||||||
static UInt32 prevMods = 0;
|
static NSEventModifierFlags prevMods = 0;
|
||||||
NSUInteger mods = [theEvent modifierFlags];
|
NSEventModifierFlags mods = [theEvent modifierFlags];
|
||||||
Fl_Window *window = (Fl_Window*)[(FLWindow*)[theEvent window] getFl_Window];
|
Fl_Window *window = (Fl_Window*)[(FLWindow*)[theEvent window] getFl_Window];
|
||||||
UInt32 tMods = prevMods ^ mods;
|
NSEventModifierFlags tMods = prevMods ^ mods;
|
||||||
int sendEvent = 0;
|
int sendEvent = 0;
|
||||||
if ( tMods )
|
if ( tMods )
|
||||||
{
|
{
|
||||||
@ -2537,7 +2537,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
|
|||||||
if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
|
if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
|
||||||
CFArrayRef files = (CFArrayRef)[pboard propertyListForType:NSFilenamesPboardType];
|
CFArrayRef files = (CFArrayRef)[pboard propertyListForType:NSFilenamesPboardType];
|
||||||
CFStringRef all = CFStringCreateByCombiningStrings(NULL, files, CFSTR("\n"));
|
CFStringRef all = CFStringCreateByCombiningStrings(NULL, files, CFSTR("\n"));
|
||||||
int l = CFStringGetMaximumSizeForEncoding(CFStringGetLength(all), kCFStringEncodingUTF8);
|
int l = (int)CFStringGetMaximumSizeForEncoding(CFStringGetLength(all), kCFStringEncodingUTF8);
|
||||||
DragData = (char *)malloc(l + 1);
|
DragData = (char *)malloc(l + 1);
|
||||||
CFStringGetCString(all, DragData, l + 1, kCFStringEncodingUTF8);
|
CFStringGetCString(all, DragData, l + 1, kCFStringEncodingUTF8);
|
||||||
CFRelease(all);
|
CFRelease(all);
|
||||||
@ -2555,7 +2555,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
Fl::e_text = DragData;
|
Fl::e_text = DragData;
|
||||||
Fl::e_length = strlen(DragData);
|
Fl::e_length = (int)strlen(DragData);
|
||||||
int old_event = Fl::e_number;
|
int old_event = Fl::e_number;
|
||||||
Fl::belowmouse()->handle(Fl::e_number = FL_PASTE);
|
Fl::belowmouse()->handle(Fl::e_number = FL_PASTE);
|
||||||
Fl::e_number = old_event;
|
Fl::e_number = old_event;
|
||||||
@ -2586,7 +2586,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
|
|||||||
static char *received_utf8 = NULL;
|
static char *received_utf8 = NULL;
|
||||||
static int lreceived = 0;
|
static int lreceived = 0;
|
||||||
char *p = (char*)[aString UTF8String];
|
char *p = (char*)[aString UTF8String];
|
||||||
int l = strlen(p);
|
int l = (int)strlen(p);
|
||||||
if (l > 0) {
|
if (l > 0) {
|
||||||
if (lreceived == 0) {
|
if (lreceived == 0) {
|
||||||
received_utf8 = (char*)malloc(l + 1);
|
received_utf8 = (char*)malloc(l + 1);
|
||||||
@ -2704,7 +2704,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
|
|||||||
}
|
}
|
||||||
if (in_key_event && Fl::e_length) [FLView concatEtext:received];
|
if (in_key_event && Fl::e_length) [FLView concatEtext:received];
|
||||||
else [FLView prepareEtext:received];
|
else [FLView prepareEtext:received];
|
||||||
Fl_Cocoa_Screen_Driver::next_marked_length = strlen([received UTF8String]);
|
Fl_Cocoa_Screen_Driver::next_marked_length = (int)strlen([received UTF8String]);
|
||||||
if (!in_key_event) Fl::handle( FL_KEYBOARD, target);
|
if (!in_key_event) Fl::handle( FL_KEYBOARD, target);
|
||||||
else need_handle = YES;
|
else need_handle = YES;
|
||||||
selectedRange = NSMakeRange(100, newSelection.length);
|
selectedRange = NSMakeRange(100, newSelection.length);
|
||||||
@ -3539,7 +3539,7 @@ static int get_plain_text_from_clipboard(int clipboard)
|
|||||||
len = strlen(aux_c) + 1;
|
len = strlen(aux_c) + 1;
|
||||||
}
|
}
|
||||||
else len = [data length] + 1;
|
else len = [data length] + 1;
|
||||||
resize_selection_buffer(len, clipboard);
|
resize_selection_buffer((int)len, clipboard);
|
||||||
if (![found isEqualToString:UTF8_pasteboard_type]) {
|
if (![found isEqualToString:UTF8_pasteboard_type]) {
|
||||||
strcpy(fl_selection_buffer[clipboard], aux_c);
|
strcpy(fl_selection_buffer[clipboard], aux_c);
|
||||||
free(aux_c);
|
free(aux_c);
|
||||||
@ -3552,7 +3552,7 @@ static int get_plain_text_from_clipboard(int clipboard)
|
|||||||
Fl::e_clipboard_type = Fl::clipboard_plain_text;
|
Fl::e_clipboard_type = Fl::clipboard_plain_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return length;
|
return (int)length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Fl_RGB_Image* get_image_from_clipboard(Fl_Widget *receiver)
|
static Fl_RGB_Image* get_image_from_clipboard(Fl_Widget *receiver)
|
||||||
@ -3581,10 +3581,10 @@ static Fl_RGB_Image* get_image_from_clipboard(Fl_Widget *receiver)
|
|||||||
bitmap = pdf_to_nsbitmapimagerep(data);
|
bitmap = pdf_to_nsbitmapimagerep(data);
|
||||||
}
|
}
|
||||||
if (!bitmap) return NULL;
|
if (!bitmap) return NULL;
|
||||||
int bytesPerPixel([bitmap bitsPerPixel]/8);
|
int bytesPerPixel((int)[bitmap bitsPerPixel]/8);
|
||||||
int bpr([bitmap bytesPerRow]);
|
int bpr((int)[bitmap bytesPerRow]);
|
||||||
int hh([bitmap pixelsHigh]);
|
int hh((int)[bitmap pixelsHigh]);
|
||||||
int ww([bitmap pixelsWide]);
|
int ww((int)[bitmap pixelsWide]);
|
||||||
uchar *imagedata = new uchar[bpr * hh];
|
uchar *imagedata = new uchar[bpr * hh];
|
||||||
memcpy(imagedata, [bitmap bitmapData], bpr * hh);
|
memcpy(imagedata, [bitmap bitmapData], bpr * hh);
|
||||||
Fl_RGB_Image *image = new Fl_RGB_Image(imagedata, ww, hh, bytesPerPixel, (bpr == ww * bytesPerPixel ? 0 : bpr) );
|
Fl_RGB_Image *image = new Fl_RGB_Image(imagedata, ww, hh, bytesPerPixel, (bpr == ww * bytesPerPixel ? 0 : bpr) );
|
||||||
@ -3966,13 +3966,13 @@ void Fl_Cocoa_Window_Driver::set_key_window()
|
|||||||
static NSImage *imageFromText(const char *text, int *pwidth, int *pheight)
|
static NSImage *imageFromText(const char *text, int *pwidth, int *pheight)
|
||||||
{
|
{
|
||||||
const char *p, *q;
|
const char *p, *q;
|
||||||
int width = 0, height, w2, ltext = strlen(text);
|
int width = 0, height, w2, ltext = (int)strlen(text);
|
||||||
fl_font(FL_HELVETICA, 10);
|
fl_font(FL_HELVETICA, 10);
|
||||||
p = text;
|
p = text;
|
||||||
int nl = 0;
|
int nl = 0;
|
||||||
while(nl < 100 && (q=strchr(p, '\n')) != NULL) {
|
while(nl < 100 && (q=strchr(p, '\n')) != NULL) {
|
||||||
nl++;
|
nl++;
|
||||||
w2 = int(fl_width(p, q - p));
|
w2 = (int)fl_width(p, (int)(q - p));
|
||||||
if (w2 > width) width = w2;
|
if (w2 > width) width = w2;
|
||||||
p = q + 1;
|
p = q + 1;
|
||||||
}
|
}
|
||||||
@ -3994,7 +3994,7 @@ static NSImage *imageFromText(const char *text, int *pwidth, int *pheight)
|
|||||||
while(TRUE) {
|
while(TRUE) {
|
||||||
q = strchr(p, '\n');
|
q = strchr(p, '\n');
|
||||||
if (q) {
|
if (q) {
|
||||||
fl_draw(p, q - p, 3, y);
|
fl_draw(p, (int)(q - p), 3, y);
|
||||||
} else {
|
} else {
|
||||||
fl_draw(p, 3, y);
|
fl_draw(p, 3, y);
|
||||||
break;
|
break;
|
||||||
@ -4101,8 +4101,8 @@ int Fl_Cocoa_Screen_Driver::dnd(int use_selection)
|
|||||||
// rescales an NSBitmapImageRep (and also rewrites it with integer pixels)
|
// rescales an NSBitmapImageRep (and also rewrites it with integer pixels)
|
||||||
static NSBitmapImageRep *scale_nsbitmapimagerep(NSBitmapImageRep *img, float scale)
|
static NSBitmapImageRep *scale_nsbitmapimagerep(NSBitmapImageRep *img, float scale)
|
||||||
{
|
{
|
||||||
int w = [img pixelsWide];
|
int w = (int)[img pixelsWide];
|
||||||
int h = [img pixelsHigh];
|
int h = (int)[img pixelsHigh];
|
||||||
long int scaled_w = lround(scale * w);
|
long int scaled_w = lround(scale * w);
|
||||||
long int scaled_h = lround(scale * h);
|
long int scaled_h = lround(scale * h);
|
||||||
NSBitmapImageRep *scaled = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
NSBitmapImageRep *scaled = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||||
@ -4153,8 +4153,9 @@ static void write_bitmap_inside(NSBitmapImageRep *to, int to_width, NSBitmapImag
|
|||||||
#endif
|
#endif
|
||||||
int to_w = (int)[to pixelsWide]; // pixel width of "to"
|
int to_w = (int)[to pixelsWide]; // pixel width of "to"
|
||||||
int from_w = (int)[from pixelsWide]; // pixel width of "from"
|
int from_w = (int)[from pixelsWide]; // pixel width of "from"
|
||||||
int from_h = [from pixelsHigh]; // pixel height of "from"
|
int from_h = (int)[from pixelsHigh]; // pixel height of "from"
|
||||||
int to_depth = [to samplesPerPixel], from_depth = [from samplesPerPixel];
|
int to_depth = (int)[to samplesPerPixel];
|
||||||
|
int from_depth = (int)[from samplesPerPixel];
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
if (to_depth > from_depth) depth = from_depth;
|
if (to_depth > from_depth) depth = from_depth;
|
||||||
else if (from_depth > to_depth) depth = to_depth;
|
else if (from_depth > to_depth) depth = to_depth;
|
||||||
@ -4397,14 +4398,14 @@ void Fl_Cocoa_Window_Driver::draw_titlebar_to_context(CGContextRef gc, int w, in
|
|||||||
*/
|
*/
|
||||||
int Fl_Darwin_System_Driver::calc_mac_os_version() {
|
int Fl_Darwin_System_Driver::calc_mac_os_version() {
|
||||||
if (fl_mac_os_version) return fl_mac_os_version;
|
if (fl_mac_os_version) return fl_mac_os_version;
|
||||||
int M, m, b = 0;
|
int M = 0, m = 0, b = 0;
|
||||||
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||||
if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) {
|
if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) {
|
||||||
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
|
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
|
||||||
M = version.majorVersion;
|
M = (int)version.majorVersion;
|
||||||
m = version.minorVersion;
|
m = (int)version.minorVersion;
|
||||||
b = version.patchVersion;
|
b = (int)version.patchVersion;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -355,8 +355,8 @@ int Fl_Cocoa_Screen_Driver::input_widget_handle_key(int key, unsigned mods, unsi
|
|||||||
|
|
||||||
void Fl_Cocoa_Screen_Driver::offscreen_size(Fl_Offscreen off, int &width, int &height)
|
void Fl_Cocoa_Screen_Driver::offscreen_size(Fl_Offscreen off, int &width, int &height)
|
||||||
{
|
{
|
||||||
width = CGBitmapContextGetWidth((CGContextRef)off);
|
width = (int)CGBitmapContextGetWidth((CGContextRef)off);
|
||||||
height = CGBitmapContextGetHeight((CGContextRef)off);
|
height = (int)CGBitmapContextGetHeight((CGContextRef)off);
|
||||||
}
|
}
|
||||||
|
|
||||||
Fl_RGB_Image *Fl_Cocoa_Screen_Driver::read_win_rectangle(int X, int Y, int w, int h, Fl_Window *window,
|
Fl_RGB_Image *Fl_Cocoa_Screen_Driver::read_win_rectangle(int X, int Y, int w, int h, Fl_Window *window,
|
||||||
@ -369,11 +369,11 @@ Fl_RGB_Image *Fl_Cocoa_Screen_Driver::read_win_rectangle(int X, int Y, int w, in
|
|||||||
CGContextRef src = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc(); // get bitmap context
|
CGContextRef src = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc(); // get bitmap context
|
||||||
base = (uchar *)CGBitmapContextGetData(src); // get data
|
base = (uchar *)CGBitmapContextGetData(src); // get data
|
||||||
if(!base) return NULL;
|
if(!base) return NULL;
|
||||||
int sw = CGBitmapContextGetWidth(src);
|
int sw = (int)CGBitmapContextGetWidth(src);
|
||||||
int sh = CGBitmapContextGetHeight(src);
|
int sh = (int)CGBitmapContextGetHeight(src);
|
||||||
if( (sw - X < w) || (sh - Y < h) ) return NULL;
|
if( (sw - X < w) || (sh - Y < h) ) return NULL;
|
||||||
bpr = CGBitmapContextGetBytesPerRow(src);
|
bpr = (int)CGBitmapContextGetBytesPerRow(src);
|
||||||
bpp = CGBitmapContextGetBitsPerPixel(src)/8;
|
bpp = (int)CGBitmapContextGetBitsPerPixel(src)/8;
|
||||||
Fl_Image_Surface *imgs = (Fl_Image_Surface*)Fl_Surface_Device::surface();
|
Fl_Image_Surface *imgs = (Fl_Image_Surface*)Fl_Surface_Device::surface();
|
||||||
int fltk_w, fltk_h;
|
int fltk_w, fltk_h;
|
||||||
imgs->printable_rect(&fltk_w, &fltk_h);
|
imgs->printable_rect(&fltk_w, &fltk_h);
|
||||||
@ -400,16 +400,16 @@ Fl_RGB_Image *Fl_Cocoa_Screen_Driver::read_win_rectangle(int X, int Y, int w, in
|
|||||||
if (!cgimg) {
|
if (!cgimg) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
w = CGImageGetWidth(cgimg);
|
w = (int)CGImageGetWidth(cgimg);
|
||||||
h = CGImageGetHeight(cgimg);
|
h = (int)CGImageGetHeight(cgimg);
|
||||||
Fl_Image_Surface *surf = new Fl_Image_Surface(w, h);
|
Fl_Image_Surface *surf = new Fl_Image_Surface(w, h);
|
||||||
Fl_Surface_Device::push_current(surf);
|
Fl_Surface_Device::push_current(surf);
|
||||||
((Fl_Quartz_Graphics_Driver*)fl_graphics_driver)->draw_CGImage(cgimg, 0, 0, w, h, 0, 0, w, h);
|
((Fl_Quartz_Graphics_Driver*)fl_graphics_driver)->draw_CGImage(cgimg, 0, 0, w, h, 0, 0, w, h);
|
||||||
CGContextRef gc = (CGContextRef)fl_graphics_driver->gc();
|
CGContextRef gc = (CGContextRef)fl_graphics_driver->gc();
|
||||||
w = CGBitmapContextGetWidth(gc);
|
w = (int)CGBitmapContextGetWidth(gc);
|
||||||
h = CGBitmapContextGetHeight(gc);
|
h = (int)CGBitmapContextGetHeight(gc);
|
||||||
bpr = CGBitmapContextGetBytesPerRow(gc);
|
bpr = (int)CGBitmapContextGetBytesPerRow(gc);
|
||||||
bpp = CGBitmapContextGetBitsPerPixel(gc)/8;
|
bpp = (int)CGBitmapContextGetBitsPerPixel(gc)/8;
|
||||||
base = (uchar*)CGBitmapContextGetData(gc);
|
base = (uchar*)CGBitmapContextGetData(gc);
|
||||||
p = new uchar[bpr * h];
|
p = new uchar[bpr * h];
|
||||||
memcpy(p, base, bpr * h);
|
memcpy(p, base, bpr * h);
|
||||||
|
@ -243,7 +243,7 @@ int Fl_Cocoa_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h, i
|
|||||||
// the current surface is generally the display, but is an Fl_Image_Surface when scrolling an Fl_Overlay_Window
|
// the current surface is generally the display, but is an Fl_Image_Surface when scrolling an Fl_Overlay_Window
|
||||||
Fl_Quartz_Graphics_Driver *qgd = (Fl_Quartz_Graphics_Driver*)Fl_Surface_Device::surface()->driver();
|
Fl_Quartz_Graphics_Driver *qgd = (Fl_Quartz_Graphics_Driver*)Fl_Surface_Device::surface()->driver();
|
||||||
float s = qgd->scale();
|
float s = qgd->scale();
|
||||||
qgd->draw_CGImage(img, dest_x, dest_y, lround(s*src_w), lround(s*src_h), 0, 0, src_w, src_h);
|
qgd->draw_CGImage(img, dest_x, dest_y, (int)lround(s*src_w), (int)lround(s*src_h), 0, 0, src_w, src_h);
|
||||||
CFRelease(img);
|
CFRelease(img);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ int Fl_Darwin_System_Driver::filename_list(const char *d, dirent ***list,
|
|||||||
int dirlen;
|
int dirlen;
|
||||||
char *dirloc;
|
char *dirloc;
|
||||||
// Assume that locale encoding is no less dense than UTF-8
|
// Assume that locale encoding is no less dense than UTF-8
|
||||||
dirlen = strlen(d);
|
dirlen = (int)strlen(d);
|
||||||
dirloc = (char *)d;
|
dirloc = (char *)d;
|
||||||
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
|
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
|
||||||
int n = scandir(dirloc, list, 0, (int(*)(const struct dirent**,const struct dirent**))sort);
|
int n = scandir(dirloc, list, 0, (int(*)(const struct dirent**,const struct dirent**))sort);
|
||||||
@ -153,7 +153,7 @@ int Fl_Darwin_System_Driver::filename_list(const char *d, dirent ***list,
|
|||||||
for (i=0; i<n; i++) {
|
for (i=0; i<n; i++) {
|
||||||
int newlen;
|
int newlen;
|
||||||
dirent *de = (*list)[i];
|
dirent *de = (*list)[i];
|
||||||
int len = strlen(de->d_name);
|
int len = (int)strlen(de->d_name);
|
||||||
newlen = len;
|
newlen = len;
|
||||||
dirent *newde = (dirent*)malloc(de->d_name - (char*)de + newlen + 2); // Add space for a / and a nul
|
dirent *newde = (dirent*)malloc(de->d_name - (char*)de + newlen + 2); // Add space for a / and a nul
|
||||||
// Conversion to UTF-8
|
// Conversion to UTF-8
|
||||||
@ -298,7 +298,7 @@ static int n_buf = 0;
|
|||||||
|
|
||||||
const char *Fl_Darwin_System_Driver::latin1_to_local(const char *t, int n)
|
const char *Fl_Darwin_System_Driver::latin1_to_local(const char *t, int n)
|
||||||
{
|
{
|
||||||
if (n==-1) n = strlen(t);
|
if (n==-1) n = (int)strlen(t);
|
||||||
if (n<=n_buf) {
|
if (n<=n_buf) {
|
||||||
n_buf = (n + 257) & 0x7fffff00;
|
n_buf = (n + 257) & 0x7fffff00;
|
||||||
if (buf) free(buf);
|
if (buf) free(buf);
|
||||||
@ -319,7 +319,7 @@ const char *Fl_Darwin_System_Driver::latin1_to_local(const char *t, int n)
|
|||||||
|
|
||||||
const char *Fl_Darwin_System_Driver::local_to_latin1(const char *t, int n)
|
const char *Fl_Darwin_System_Driver::local_to_latin1(const char *t, int n)
|
||||||
{
|
{
|
||||||
if (n==-1) n = strlen(t);
|
if (n==-1) n = (int)strlen(t);
|
||||||
if (n<=n_buf) {
|
if (n<=n_buf) {
|
||||||
n_buf = (n + 257) & 0x7fffff00;
|
n_buf = (n + 257) & 0x7fffff00;
|
||||||
if (buf) free(buf);
|
if (buf) free(buf);
|
||||||
|
@ -92,8 +92,8 @@ void Fl_Quartz_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Of
|
|||||||
// draw portion srcx,srcy,w,h of osrc to position x,y (top-left) of the graphics driver's surface
|
// draw portion srcx,srcy,w,h of osrc to position x,y (top-left) of the graphics driver's surface
|
||||||
CGContextRef src = (CGContextRef)osrc;
|
CGContextRef src = (CGContextRef)osrc;
|
||||||
void *data = CGBitmapContextGetData(src);
|
void *data = CGBitmapContextGetData(src);
|
||||||
int sw = CGBitmapContextGetWidth(src);
|
int sw = (int)CGBitmapContextGetWidth(src);
|
||||||
int sh = CGBitmapContextGetHeight(src);
|
int sh = (int)CGBitmapContextGetHeight(src);
|
||||||
CGImageRef img;
|
CGImageRef img;
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||||
if (fl_mac_os_version >= 100400) img = CGBitmapContextCreateImage(src); // requires 10.4
|
if (fl_mac_os_version >= 100400) img = CGBitmapContextCreateImage(src); // requires 10.4
|
||||||
|
@ -252,8 +252,8 @@ void Fl_Quartz_Graphics_Driver::cache(Fl_Pixmap *img) {
|
|||||||
Fl_Surface_Device::pop_current();
|
Fl_Surface_Device::pop_current();
|
||||||
CGContextRef src = (CGContextRef)Fl_Graphics_Driver::get_offscreen_and_delete_image_surface(surf);
|
CGContextRef src = (CGContextRef)Fl_Graphics_Driver::get_offscreen_and_delete_image_surface(surf);
|
||||||
void *cgdata = CGBitmapContextGetData(src);
|
void *cgdata = CGBitmapContextGetData(src);
|
||||||
int sw = CGBitmapContextGetWidth(src);
|
int sw = (int)CGBitmapContextGetWidth(src);
|
||||||
int sh = CGBitmapContextGetHeight(src);
|
int sh = (int)CGBitmapContextGetHeight(src);
|
||||||
CGImageAlphaInfo alpha = CGBitmapContextGetAlphaInfo(src);
|
CGImageAlphaInfo alpha = CGBitmapContextGetAlphaInfo(src);
|
||||||
CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
|
CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
|
||||||
CGDataProviderRef src_bytes = CGDataProviderCreateWithData(src, cgdata, sw*sh*4, pmProviderRelease);
|
CGDataProviderRef src_bytes = CGDataProviderCreateWithData(src, cgdata, sw*sh*4, pmProviderRelease);
|
||||||
|
@ -54,7 +54,7 @@ void Fl_Quartz_Graphics_Driver::line_style(int style, int width, char* dashes) {
|
|||||||
CGFloat *pDst = pattern;
|
CGFloat *pDst = pattern;
|
||||||
while (*d) { *pDst++ = (float)*d++; }
|
while (*d) { *pDst++ = (float)*d++; }
|
||||||
quartz_line_pattern = pattern;
|
quartz_line_pattern = pattern;
|
||||||
quartz_line_pattern_size = d-dashes;
|
quartz_line_pattern_size = (int)(d-dashes);
|
||||||
} else if (style & 0xff) {
|
} else if (style & 0xff) {
|
||||||
char dash, dot, gap;
|
char dash, dot, gap;
|
||||||
// adjust lengths to account for cap:
|
// adjust lengths to account for cap:
|
||||||
@ -73,7 +73,7 @@ void Fl_Quartz_Graphics_Driver::line_style(int style, int width, char* dashes) {
|
|||||||
case FL_DASHDOT: *pDst++ = dash; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; break;
|
case FL_DASHDOT: *pDst++ = dash; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; break;
|
||||||
case FL_DASHDOTDOT: *pDst++ = dash; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; break;
|
case FL_DASHDOTDOT: *pDst++ = dash; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; *pDst++ = dot; *pDst++ = gap; break;
|
||||||
}
|
}
|
||||||
quartz_line_pattern_size = pDst-pattern;
|
quartz_line_pattern_size = (int)(pDst-pattern);
|
||||||
quartz_line_pattern = pattern;
|
quartz_line_pattern = pattern;
|
||||||
} else {
|
} else {
|
||||||
quartz_line_pattern = 0;
|
quartz_line_pattern = 0;
|
||||||
|
@ -79,10 +79,10 @@ void Fl_Quartz_Image_Surface_Driver::untranslate() {
|
|||||||
Fl_RGB_Image* Fl_Quartz_Image_Surface_Driver::image()
|
Fl_RGB_Image* Fl_Quartz_Image_Surface_Driver::image()
|
||||||
{
|
{
|
||||||
CGContextFlush((CGContextRef)offscreen);
|
CGContextFlush((CGContextRef)offscreen);
|
||||||
int W = CGBitmapContextGetWidth((CGContextRef)offscreen);
|
int W = (int)CGBitmapContextGetWidth((CGContextRef)offscreen);
|
||||||
int H = CGBitmapContextGetHeight((CGContextRef)offscreen);
|
int H = (int)CGBitmapContextGetHeight((CGContextRef)offscreen);
|
||||||
int bpr = CGBitmapContextGetBytesPerRow((CGContextRef)offscreen);
|
int bpr = (int)CGBitmapContextGetBytesPerRow((CGContextRef)offscreen);
|
||||||
int bpp = CGBitmapContextGetBitsPerPixel((CGContextRef)offscreen)/8;
|
int bpp = (int)CGBitmapContextGetBitsPerPixel((CGContextRef)offscreen)/8;
|
||||||
uchar *base = (uchar*)CGBitmapContextGetData((CGContextRef)offscreen);
|
uchar *base = (uchar*)CGBitmapContextGetData((CGContextRef)offscreen);
|
||||||
int idx, idy;
|
int idx, idy;
|
||||||
uchar *pdst, *psrc;
|
uchar *pdst, *psrc;
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#define NBC 0xFFFF + 1
|
#define NBC 0xFFFF + 1
|
||||||
|
|
||||||
static int Toupper(int ucs) {
|
static int Toupper(int ucs) {
|
||||||
long i;
|
int i;
|
||||||
static unsigned short *table = NULL;
|
static unsigned short *table = NULL;
|
||||||
|
|
||||||
if (!table) {
|
if (!table) {
|
||||||
|
Loading…
Reference in New Issue
Block a user