mirror of
https://github.com/fltk/fltk.git
synced 2026-05-29 04:26:27 +08:00
Beautified some of the code. Removed size calculation error.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13027 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+36
-22
@@ -927,46 +927,60 @@ void Fl_Data_Type::write_code1() {
|
|||||||
} else {
|
} else {
|
||||||
fn = fn ? filename_ : "<no filename>";
|
fn = fn ? filename_ : "<no filename>";
|
||||||
}
|
}
|
||||||
const char *variableType = text_mode_ ? "char" : "unsigned char";
|
if (is_in_class()) {
|
||||||
if (is_in_class()) {
|
|
||||||
write_public(public_);
|
write_public(public_);
|
||||||
write_comment_h(" ");
|
write_comment_h(" ");
|
||||||
write_h(" static %s %s[%d];\n", variableType, c, nData);
|
if (text_mode_) {
|
||||||
write_c("%s %s::%s[%d] = /* data inlined from %s */\n", variableType, class_name(1), c, nData, fn);
|
write_h(" static char *%s;\n", c);
|
||||||
if (message) write_c("#error %s %s\n", message, fn);
|
write_c("char *%s::%s = /* text inlined from %s */\n", class_name(1), c, fn);
|
||||||
if (text_mode_)
|
if (message) write_c("#error %s %s\n", message, fn);
|
||||||
write_cstring(data, nData);
|
write_cstring(data, nData);
|
||||||
else
|
} else {
|
||||||
write_cdata(data, nData);
|
write_h(" static unsigned char %s[%d];\n", c, nData);
|
||||||
|
write_c("unsigned char %s::%s[%d] = /* data inlined from %s */\n", class_name(1), c, nData, fn);
|
||||||
|
if (message) write_c("#error %s %s\n", message, fn);
|
||||||
|
write_cdata(data, nData);
|
||||||
|
}
|
||||||
write_c(";\n");
|
write_c(";\n");
|
||||||
} else {
|
} else {
|
||||||
// the "header only" option does not apply here!
|
// the "header only" option does not apply here!
|
||||||
if (public_) {
|
if (public_) {
|
||||||
if (static_) {
|
if (static_) {
|
||||||
write_h("extern %s %s[%d];\n", variableType, c, nData);
|
if (text_mode_) {
|
||||||
write_comment_c();
|
write_h("extern char *%s;\n", c);
|
||||||
write_c("%s %s[%d] = /* data inlined from %s */\n", variableType, c, nData, fn);
|
write_comment_c();
|
||||||
if (message) write_c("#error %s %s\n", message, fn);
|
write_c("char *%s = /* text inlined from %s */\n", c, fn);
|
||||||
if (text_mode_)
|
if (message) write_c("#error %s %s\n", message, fn);
|
||||||
write_cstring(data, nData);
|
write_cstring(data, nData);
|
||||||
else
|
} else {
|
||||||
write_cdata(data, nData);
|
write_h("extern unsigned char %s[%d];\n", c, nData);
|
||||||
|
write_comment_c();
|
||||||
|
write_c("unsigned char %s[%d] = /* data inlined from %s */\n", c, nData, fn);
|
||||||
|
if (message) write_c("#error %s %s\n", message, fn);
|
||||||
|
write_cdata(data, nData);
|
||||||
|
}
|
||||||
write_c(";\n");
|
write_c(";\n");
|
||||||
} else {
|
} else {
|
||||||
write_comment_h();
|
write_comment_h();
|
||||||
write_h("#error Unsupported declaration loading inline data %s\n", fn);
|
write_h("#error Unsupported declaration loading inline data %s\n", fn);
|
||||||
write_h("%s %s[3] = { 1, 2, 3 };\n", variableType, c);
|
if (text_mode_)
|
||||||
|
write_h("char *%s = \"abc...\";\n", c);
|
||||||
|
else
|
||||||
|
write_h("unsigned char %s[3] = { 1, 2, 3 };\n", c);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
write_comment_c();
|
write_comment_c();
|
||||||
if (static_)
|
if (static_)
|
||||||
write_c("static ");
|
write_c("static ");
|
||||||
write_c("%s %s[%d] = /* data inlined from %s */\n", variableType, c, nData, fn);
|
if (text_mode_) {
|
||||||
if (message) write_c("#error %s %s\n", message, fn);
|
write_c("char *%s = /* text inlined from %s */\n", c, fn);
|
||||||
if (text_mode_)
|
if (message) write_c("#error %s %s\n", message, fn);
|
||||||
write_cstring(data, nData);
|
write_cstring(data, nData);
|
||||||
else
|
} else {
|
||||||
|
write_c("unsigned char %s[%d] = /* data inlined from %s */\n", c, nData, fn);
|
||||||
|
if (message) write_c("#error %s %s\n", message, fn);
|
||||||
write_cdata(data, nData);
|
write_cdata(data, nData);
|
||||||
|
}
|
||||||
write_c(";\n");
|
write_c(";\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -483,8 +483,8 @@ Fl_Double_Window* make_data_panel() {
|
|||||||
data_class_choice->menu(menu_data_class_choice);
|
data_class_choice->menu(menu_data_class_choice);
|
||||||
} // Fl_Choice* data_class_choice
|
} // Fl_Choice* data_class_choice
|
||||||
{ data_mode = new Fl_Check_Button(200, 10, 78, 20, "text mode");
|
{ data_mode = new Fl_Check_Button(200, 10, 78, 20, "text mode");
|
||||||
data_mode->tooltip("When text mode is seleted, the returned type is \"const char[]\" and a traili\
|
data_mode->tooltip("When text mode is seleted, the returned type is \"const char*\" and a trailin\
|
||||||
ng NUL will be appended to the data.");
|
g NUL will be appended to the data.");
|
||||||
data_mode->down_box(FL_DOWN_BOX);
|
data_mode->down_box(FL_DOWN_BOX);
|
||||||
data_mode->labelsize(11);
|
data_mode->labelsize(11);
|
||||||
} // Fl_Check_Button* data_mode
|
} // Fl_Check_Button* data_mode
|
||||||
@@ -492,7 +492,7 @@ ng NUL will be appended to the data.");
|
|||||||
} // Fl_Group* o
|
} // Fl_Group* o
|
||||||
{ data_input = new Fl_Input(10, 52, 320, 20, "Variable Name:");
|
{ data_input = new Fl_Input(10, 52, 320, 20, "Variable Name:");
|
||||||
data_input->tooltip("Inline Data variables are declared \"const unsigned char []\" in binary mode \
|
data_input->tooltip("Inline Data variables are declared \"const unsigned char []\" in binary mode \
|
||||||
and \"const char[]\" in text mode.");
|
and \"const char*\" in text mode.");
|
||||||
data_input->labelfont(1);
|
data_input->labelfont(1);
|
||||||
data_input->labelsize(11);
|
data_input->labelsize(11);
|
||||||
data_input->textfont(4);
|
data_input->textfont(4);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# data file for the Fltk User Interface Designer (fluid)
|
# data file for the Fltk User Interface Designer (fluid)
|
||||||
version 1.0304
|
version 1.0400
|
||||||
header_name {.h}
|
header_name {.h}
|
||||||
code_name {.cxx}
|
code_name {.cxx}
|
||||||
comment {//
|
comment {//
|
||||||
@@ -383,12 +383,12 @@ Function {make_data_panel()} {open
|
|||||||
}
|
}
|
||||||
Fl_Check_Button data_mode {
|
Fl_Check_Button data_mode {
|
||||||
label {text mode}
|
label {text mode}
|
||||||
tooltip {When text mode is seleted, the returned type is "const char[]" and a trailing NUL will be appended to the data.} xywh {200 10 78 20} down_box DOWN_BOX labelsize 11
|
tooltip {When text mode is seleted, the returned type is "const char*" and a trailing NUL will be appended to the data.} xywh {200 10 78 20} down_box DOWN_BOX labelsize 11
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Fl_Input data_input {
|
Fl_Input data_input {
|
||||||
label {Variable Name:} selected
|
label {Variable Name:}
|
||||||
tooltip {Inline Data variables are declared "const unsigned char []" in binary mode and "const char[]" in text mode.} xywh {10 52 320 20} labelfont 1 labelsize 11 align 133 when 0 textfont 4 textsize 11
|
tooltip {Inline Data variables are declared "const unsigned char []" in binary mode and "const char*" in text mode.} xywh {10 52 320 20} labelfont 1 labelsize 11 align 133 when 0 textfont 4 textsize 11
|
||||||
}
|
}
|
||||||
Fl_Input data_filename {
|
Fl_Input data_filename {
|
||||||
label {Filename:}
|
label {Filename:}
|
||||||
@@ -399,7 +399,7 @@ Function {make_data_panel()} {open
|
|||||||
xywh {290 90 40 20} labelcolor 134
|
xywh {290 90 40 20} labelcolor 134
|
||||||
}
|
}
|
||||||
Fl_Text_Editor data_comment_input {
|
Fl_Text_Editor data_comment_input {
|
||||||
label {Comment:}
|
label {Comment:} selected
|
||||||
tooltip {Declaration comment in Doxygen format} xywh {10 130 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable
|
tooltip {Declaration comment in Doxygen format} xywh {10 130 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable
|
||||||
code0 {data_comment_input->buffer(new Fl_Text_Buffer());}
|
code0 {data_comment_input->buffer(new Fl_Text_Buffer());}
|
||||||
code1 {data_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation);}
|
code1 {data_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation);}
|
||||||
@@ -536,7 +536,8 @@ Function {type_make_cb(Fl_Widget*,void*d)} {return_type void
|
|||||||
}} {}
|
}} {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Function {make_widgetbin()} {} {
|
Function {make_widgetbin()} {open
|
||||||
|
} {
|
||||||
Fl_Window widgetbin_panel {
|
Fl_Window widgetbin_panel {
|
||||||
label {Widget Bin}
|
label {Widget Bin}
|
||||||
callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape)
|
callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape)
|
||||||
@@ -545,7 +546,7 @@ else
|
|||||||
toggle_widgetbin_cb((Fl_Widget*)o, v);} open
|
toggle_widgetbin_cb((Fl_Widget*)o, v);} open
|
||||||
xywh {410 171 574 85} type Single align 80 hide non_modal
|
xywh {410 171 574 85} type Single align 80 hide non_modal
|
||||||
} {
|
} {
|
||||||
Fl_Group {} {
|
Fl_Group {} {open
|
||||||
xywh {3 3 79 79}
|
xywh {3 3 79 79}
|
||||||
} {
|
} {
|
||||||
Fl_Button {} {
|
Fl_Button {} {
|
||||||
|
|||||||
Reference in New Issue
Block a user