mirror of
https://github.com/fltk/fltk.git
synced 2026-06-06 16:46:52 +08:00
Use grid size for window resizing.
Save work on project settings dialog. Ideal spacing for group-derived widgets is 10 pixels, except for tabs which has a Y spacing of 25 (for the normal label size) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4090 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/Fl_Menu.H>
|
||||
#include "Fluid_Image.h"
|
||||
#include <FL/fl_draw.H>
|
||||
|
||||
class Fl_Type {
|
||||
|
||||
@@ -338,6 +339,7 @@ public:
|
||||
|
||||
class Fl_Group_Type : public Fl_Widget_Type {
|
||||
public:
|
||||
virtual void ideal_spacing(int &x, int &y) { x = y = 10; }
|
||||
virtual const char *type_name() {return "Fl_Group";}
|
||||
Fl_Widget *widget(int X,int Y,int W,int H) {
|
||||
igroup *g = new igroup(X,Y,W,H); Fl_Group::current(0); return g;}
|
||||
@@ -368,6 +370,11 @@ extern const char tabs_type_name[];
|
||||
|
||||
class Fl_Tabs_Type : public Fl_Group_Type {
|
||||
public:
|
||||
virtual void ideal_spacing(int &x, int &y) {
|
||||
x = 10;
|
||||
fl_font(o->labelfont(), o->labelsize());
|
||||
y = fl_height() + o->labelsize() - 6;
|
||||
}
|
||||
virtual const char *type_name() {return tabs_type_name;}
|
||||
Fl_Widget *widget(int X,int Y,int W,int H) {
|
||||
itabs *g = new itabs(X,Y,W,H); Fl_Group::current(0); return g;}
|
||||
@@ -437,6 +444,7 @@ class Fl_Window_Type : public Fl_Widget_Type {
|
||||
|
||||
public:
|
||||
|
||||
Fl_Window_Type() { drag = dx = dy = 0; }
|
||||
uchar modal, non_modal;
|
||||
|
||||
Fl_Type *make();
|
||||
|
||||
@@ -105,9 +105,9 @@ void grid_cb(Fl_Input *i, long v) {
|
||||
for (p = Fl_Type::first; p; p = p->next) {
|
||||
if (p->is_window()) {
|
||||
w = (Fl_Window_Type *)p;
|
||||
((Fl_Window *)(w->o))->size_range(gridx * snap, gridy * snap,
|
||||
((Fl_Window *)(w->o))->size_range(gridx, gridy,
|
||||
Fl::w(), Fl::h(),
|
||||
gridx * snap, gridy * snap, 0);
|
||||
gridx, gridy, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,9 +281,9 @@ Fl_Type *Fl_Window_Type::make() {
|
||||
}
|
||||
// Set the size ranges for this window; in order to avoid opening the
|
||||
// X display we use an arbitrary maximum size...
|
||||
((Fl_Window *)(this->o))->size_range(gridx * snap, gridy * snap,
|
||||
((Fl_Window *)(this->o))->size_range(gridx, gridy,
|
||||
3072, 2048,
|
||||
gridx * snap, gridy * snap, 0);
|
||||
gridx, gridy, 0);
|
||||
myo->factory = this;
|
||||
myo->drag = 0;
|
||||
myo->numselected = 0;
|
||||
@@ -333,8 +333,7 @@ void Fl_Window_Type::open() {
|
||||
w->resizable(p);
|
||||
}
|
||||
|
||||
w->size_range(gridx * snap, gridy * snap, Fl::w(), Fl::h(),
|
||||
gridx * snap, gridy * snap, 0);
|
||||
w->size_range(gridx, gridy, Fl::w(), Fl::h(), gridx, gridy, 0);
|
||||
}
|
||||
|
||||
// control panel items:
|
||||
@@ -407,7 +406,7 @@ void Overlay_Window::resize(int X,int Y,int W,int H) {
|
||||
// nearest multiple of gridsize, and snap to original position
|
||||
void Fl_Window_Type::newdx() {
|
||||
int mydx, mydy;
|
||||
if (Fl::event_state(FL_ALT)) {
|
||||
if (Fl::event_state(FL_ALT) || !snap) {
|
||||
mydx = mx-x1;
|
||||
mydy = my-y1;
|
||||
} else {
|
||||
|
||||
+46
-19
@@ -17,9 +17,9 @@ Fl_Light_Button *include_H_from_C_button=(Fl_Light_Button *)0;
|
||||
Fl_Choice *i18n_type_chooser=(Fl_Choice *)0;
|
||||
|
||||
Fl_Menu_Item menu_i18n_type_chooser[] = {
|
||||
{"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 56},
|
||||
{"GNU gettext", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 56},
|
||||
{"POSIX catgets", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 56},
|
||||
{"None", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 11, 56},
|
||||
{"GNU gettext", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 11, 56},
|
||||
{"POSIX catgets", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 11, 56},
|
||||
{0,0,0,0,0,0,0,0,0}
|
||||
};
|
||||
|
||||
@@ -33,76 +33,103 @@ Fl_Input *i18n_function_input=(Fl_Input *)0;
|
||||
|
||||
Fl_Double_Window* make_project_window() {
|
||||
Fl_Double_Window* w;
|
||||
{ Fl_Double_Window* o = project_window = new Fl_Double_Window(365, 210, "Project Settings");
|
||||
{ Fl_Double_Window* o = project_window = new Fl_Double_Window(365, 208, "Project Settings");
|
||||
w = o;
|
||||
{ Fl_Button* o = new Fl_Button(295, 175, 60, 25, "Close");
|
||||
o->tooltip("Close this dialog.");
|
||||
o->callback((Fl_Callback*)cb_Close);
|
||||
}
|
||||
{ Fl_Tabs* o = new Fl_Tabs(10, 10, 345, 155);
|
||||
{ Fl_Group* o = new Fl_Group(10, 35, 345, 130, "Output");
|
||||
{ Fl_Box* o = new Fl_Box(25, 45, 325, 15, "Use \"name.ext\" to set name or just \".ext\" to set only extension.");
|
||||
o->labelsize(10);
|
||||
{ Fl_Tabs* o = new Fl_Tabs(10, 10, 345, 154);
|
||||
o->labelsize(11);
|
||||
{ Fl_Group* o = new Fl_Group(10, 30, 345, 134, "Output");
|
||||
o->labelsize(11);
|
||||
o->hide();
|
||||
{ Fl_Box* o = new Fl_Box(23, 40, 319, 15, "Use \"name.ext\" to set name or just \".ext\" to set only extension.");
|
||||
o->labelsize(11);
|
||||
o->align(132|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Input* o = header_file_input = new Fl_Input(105, 65, 245, 20, "Header File:");
|
||||
{ Fl_Input* o = header_file_input = new Fl_Input(97, 60, 245, 20, "Header File:");
|
||||
o->tooltip("The name of the generated header file.");
|
||||
o->box(FL_THIN_DOWN_BOX);
|
||||
o->labelsize(11);
|
||||
o->textfont(4);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)header_input_cb, (void*)(1));
|
||||
o->when(FL_WHEN_CHANGED);
|
||||
}
|
||||
{ Fl_Input* o = code_file_input = new Fl_Input(105, 95, 245, 20, "Code File:");
|
||||
{ Fl_Input* o = code_file_input = new Fl_Input(98, 85, 244, 20, "Code File:");
|
||||
o->tooltip("The name of the generated code file.");
|
||||
o->box(FL_THIN_DOWN_BOX);
|
||||
o->labelsize(11);
|
||||
o->textfont(4);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)code_input_cb, (void*)(1));
|
||||
o->when(FL_WHEN_CHANGED);
|
||||
}
|
||||
{ Fl_Light_Button* o = include_H_from_C_button = new Fl_Light_Button(105, 125, 170, 20, "Include Header from Code");
|
||||
{ Fl_Light_Button* o = include_H_from_C_button = new Fl_Light_Button(177, 110, 165, 20, "Include Header from Code");
|
||||
o->tooltip("Include the header file from the code file.");
|
||||
o->value(1);
|
||||
o->labelsize(12);
|
||||
o->labelsize(11);
|
||||
o->callback((Fl_Callback*)include_H_from_C_button_cb);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(10, 35, 345, 130, "Internationalization");
|
||||
{ Fl_Group* o = new Fl_Group(10, 30, 345, 134, "Internationalization");
|
||||
o->labelsize(11);
|
||||
o->hide();
|
||||
{ Fl_Choice* o = i18n_type_chooser = new Fl_Choice(100, 45, 125, 20, "Use:");
|
||||
{ Fl_Choice* o = i18n_type_chooser = new Fl_Choice(100, 42, 100, 20, "Use:");
|
||||
o->tooltip("Type of internationalization to use.");
|
||||
o->box(FL_THIN_UP_BOX);
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
o->labelsize(11);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)i18n_type_cb);
|
||||
o->menu(menu_i18n_type_chooser);
|
||||
}
|
||||
{ Fl_Input* o = i18n_include_input = new Fl_Input(100, 75, 245, 20, "#include:");
|
||||
{ Fl_Input* o = i18n_include_input = new Fl_Input(100, 67, 245, 20, "#include:");
|
||||
o->tooltip("The include file for internationalization.");
|
||||
o->box(FL_THIN_DOWN_BOX);
|
||||
o->labelsize(11);
|
||||
o->textfont(4);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)i18n_text_cb);
|
||||
}
|
||||
{ Fl_Input* o = i18n_file_input = new Fl_Input(100, 105, 245, 20, "File:");
|
||||
{ Fl_Input* o = i18n_file_input = new Fl_Input(100, 92, 245, 20, "File:");
|
||||
o->tooltip("The name of the message catalog.");
|
||||
o->box(FL_THIN_DOWN_BOX);
|
||||
o->labelsize(11);
|
||||
o->textfont(4);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)i18n_text_cb);
|
||||
}
|
||||
{ Fl_Input* o = i18n_set_input = new Fl_Input(100, 135, 245, 20, "Set:");
|
||||
{ Fl_Input* o = i18n_set_input = new Fl_Input(100, 117, 245, 20, "Set:");
|
||||
o->tooltip("The message set number.");
|
||||
o->type(2);
|
||||
o->box(FL_THIN_DOWN_BOX);
|
||||
o->labelsize(11);
|
||||
o->textfont(4);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)i18n_text_cb);
|
||||
}
|
||||
{ Fl_Input* o = i18n_function_input = new Fl_Input(100, 105, 245, 20, "Function:");
|
||||
{ Fl_Input* o = i18n_function_input = new Fl_Input(100, 92, 245, 20, "Function:");
|
||||
o->tooltip("The function to call to internationalize the labels and tooltips.");
|
||||
o->box(FL_THIN_DOWN_BOX);
|
||||
o->labelsize(11);
|
||||
o->textfont(4);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)i18n_text_cb);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(10, 30, 345, 134, "Copyright");
|
||||
o->labelsize(11);
|
||||
{ Fl_Text_Editor* o = new Fl_Text_Editor(15, 35, 335, 124);
|
||||
o->labelsize(11);
|
||||
o->textfont(4);
|
||||
o->textsize(11);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
o->set_modal();
|
||||
@@ -311,7 +338,7 @@ static void cb_Close2(Fl_Button*, void*) {
|
||||
|
||||
Fl_Double_Window* make_grid_window() {
|
||||
Fl_Double_Window* w;
|
||||
{ Fl_Double_Window* o = grid_window = new Fl_Double_Window(155, 208, "Grid");
|
||||
{ Fl_Double_Window* o = grid_window = new Fl_Double_Window(155, 205, "Grid");
|
||||
w = o;
|
||||
{ Fl_Tabs* o = new Fl_Tabs(10, 10, 135, 150);
|
||||
o->align(FL_ALIGN_TOP_LEFT);
|
||||
|
||||
+27
-19
@@ -12,7 +12,7 @@ Function {make_project_window()} {open
|
||||
} {
|
||||
Fl_Window project_window {
|
||||
label {Project Settings} open
|
||||
xywh {217 589 365 210} type Double
|
||||
xywh {4 21 365 210} type Double
|
||||
code0 {\#include <FL/Fl_Preferences.H>}
|
||||
code1 {\#include <FL/Fl_Tooltip.H>} modal visible
|
||||
} {
|
||||
@@ -22,75 +22,83 @@ Function {make_project_window()} {open
|
||||
tooltip {Close this dialog.} xywh {295 175 60 25}
|
||||
}
|
||||
Fl_Tabs {} {open
|
||||
xywh {10 10 345 155}
|
||||
xywh {10 10 345 154} labelsize 11
|
||||
} {
|
||||
Fl_Group {} {
|
||||
label Output
|
||||
xywh {10 35 345 130}
|
||||
label Output open
|
||||
xywh {10 30 345 134} labelsize 11 hide
|
||||
} {
|
||||
Fl_Box {} {
|
||||
label {Use "name.ext" to set name or just ".ext" to set only extension.}
|
||||
xywh {25 45 325 15} labelsize 10 align 148
|
||||
xywh {23 40 319 15} labelsize 11 align 148
|
||||
}
|
||||
Fl_Input header_file_input {
|
||||
label {Header File:}
|
||||
user_data 1 user_data_type {void*}
|
||||
callback header_input_cb
|
||||
tooltip {The name of the generated header file.} xywh {105 65 245 20} box THIN_DOWN_BOX when 1 textfont 4
|
||||
tooltip {The name of the generated header file.} xywh {97 60 245 20} box THIN_DOWN_BOX labelsize 11 when 1 textfont 4 textsize 11
|
||||
}
|
||||
Fl_Input code_file_input {
|
||||
label {Code File:}
|
||||
user_data 1 user_data_type {void*}
|
||||
callback code_input_cb
|
||||
tooltip {The name of the generated code file.} xywh {105 95 245 20} box THIN_DOWN_BOX when 1 textfont 4
|
||||
tooltip {The name of the generated code file.} xywh {98 85 244 20} box THIN_DOWN_BOX labelsize 11 when 1 textfont 4 textsize 11
|
||||
}
|
||||
Fl_Light_Button include_H_from_C_button {
|
||||
label {Include Header from Code}
|
||||
callback include_H_from_C_button_cb
|
||||
tooltip {Include the header file from the code file.} xywh {105 125 170 20} value 1 labelsize 12
|
||||
tooltip {Include the header file from the code file.} xywh {177 110 165 20} value 1 labelsize 11
|
||||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label Internationalization open
|
||||
xywh {10 35 345 130} hide
|
||||
xywh {10 30 345 134} labelsize 11 hide
|
||||
} {
|
||||
Fl_Choice i18n_type_chooser {
|
||||
label {Use:}
|
||||
callback i18n_type_cb open
|
||||
tooltip {Type of internationalization to use.} xywh {100 45 125 20} box THIN_UP_BOX down_box BORDER_BOX
|
||||
tooltip {Type of internationalization to use.} xywh {100 42 100 20} box THIN_UP_BOX down_box BORDER_BOX labelsize 11 textsize 11
|
||||
} {
|
||||
menuitem {} {
|
||||
label None
|
||||
xywh {0 0 100 20}
|
||||
xywh {0 0 100 20} labelsize 11
|
||||
}
|
||||
menuitem {} {
|
||||
label {GNU gettext}
|
||||
xywh {0 0 100 20}
|
||||
xywh {0 0 100 20} labelsize 11
|
||||
}
|
||||
menuitem {} {
|
||||
label {POSIX catgets}
|
||||
xywh {0 0 100 20}
|
||||
xywh {0 0 100 20} labelsize 11
|
||||
}
|
||||
}
|
||||
Fl_Input i18n_include_input {
|
||||
label {\#include:}
|
||||
callback i18n_text_cb
|
||||
tooltip {The include file for internationalization.} xywh {100 75 245 20} box THIN_DOWN_BOX textfont 4
|
||||
tooltip {The include file for internationalization.} xywh {100 67 245 20} box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11
|
||||
}
|
||||
Fl_Input i18n_file_input {
|
||||
label {File:}
|
||||
callback i18n_text_cb
|
||||
tooltip {The name of the message catalog.} xywh {100 105 245 20} box THIN_DOWN_BOX textfont 4
|
||||
tooltip {The name of the message catalog.} xywh {100 92 245 20} box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11
|
||||
}
|
||||
Fl_Input i18n_set_input {
|
||||
label {Set:}
|
||||
callback i18n_text_cb
|
||||
tooltip {The message set number.} xywh {100 135 245 20} type Int box THIN_DOWN_BOX textfont 4
|
||||
tooltip {The message set number.} xywh {100 117 245 20} type Int box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11
|
||||
}
|
||||
Fl_Input i18n_function_input {
|
||||
label {Function:}
|
||||
callback i18n_text_cb
|
||||
tooltip {The function to call to internationalize the labels and tooltips.} xywh {100 105 245 20} box THIN_DOWN_BOX textfont 4
|
||||
tooltip {The function to call to internationalize the labels and tooltips.} xywh {100 92 245 20} box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11
|
||||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label Copyright open
|
||||
xywh {10 30 345 134} labelsize 11
|
||||
} {
|
||||
Fl_Text_Editor {} {selected
|
||||
xywh {20 40 325 114} labelsize 11 textfont 4 textsize 11
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,7 +249,7 @@ Function {make_grid_window()} {open
|
||||
} {
|
||||
Fl_Window grid_window {
|
||||
label Grid open
|
||||
xywh {51 589 155 208} type Double visible
|
||||
xywh {51 589 155 205} type Double visible
|
||||
} {
|
||||
Fl_Tabs {} {
|
||||
xywh {10 10 135 150} align 5
|
||||
@@ -274,7 +282,7 @@ Function {make_grid_window()} {open
|
||||
Fl_Check_Button guides_toggle {
|
||||
label {Show Guides}
|
||||
user_data 4 user_data_type long
|
||||
callback guides_cb selected
|
||||
callback guides_cb
|
||||
tooltip {Show distance and alignment guides in overlay} xywh {30 125 105 25} down_box DOWN_BOX
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ extern Fl_Input *i18n_include_input;
|
||||
extern Fl_Input *i18n_file_input;
|
||||
extern Fl_Input *i18n_set_input;
|
||||
extern Fl_Input *i18n_function_input;
|
||||
#include <FL/Fl_Text_Editor.H>
|
||||
Fl_Double_Window* make_project_window();
|
||||
extern Fl_Menu_Item menu_i18n_type_chooser[];
|
||||
extern void i18n_cb(Fl_Choice *,void *);
|
||||
|
||||
Reference in New Issue
Block a user