Replace Class dialof box with widget panel tab.
This commit is contained in:
parent
599513b513
commit
591bed0204
@ -432,7 +432,7 @@ Type "comment" <word> : comment text
|
||||
Type "class" <word> <word> : prefix, class name
|
||||
|
||||
none or "private" or "protected" : defaults to public
|
||||
":" <word> : name of super class
|
||||
":" <word> : name of base class
|
||||
... : inherits more from Node
|
||||
|
||||
Type "Fl_Widget" <word> : C++ variable name
|
||||
|
||||
@ -319,9 +319,12 @@ Node *Project_Reader::read_children(Node *p, int merge, Strategy strategy, char
|
||||
t->name(read_word());
|
||||
|
||||
c = read_word(1);
|
||||
// There can actually be two keywords here. The first one used to be a
|
||||
// "prefix" in Fluid < 1.5.0, but is no longer supported. So if we still
|
||||
// find the prefix in files, it will simply be prefixed to the name.
|
||||
if (strcmp(c,"{") && t->is_class()) { // <prefix> <name>
|
||||
((Class_Node*)t)->prefix(t->name());
|
||||
t->name(c);
|
||||
std::string tmp = std::string {t->name() } + " " + c;
|
||||
t->name(tmp.c_str());
|
||||
c = read_word(1);
|
||||
}
|
||||
|
||||
|
||||
@ -1907,75 +1907,7 @@ void Class_Node::read_property(fld::io::Project_Reader &f, const char *c) {
|
||||
Open the class_panel to edit the class name and superclass name.
|
||||
*/
|
||||
void Class_Node::open() {
|
||||
if (!class_panel) make_class_panel();
|
||||
char fullname[FL_PATH_MAX]="";
|
||||
if (prefix() && strlen(prefix()))
|
||||
sprintf(fullname,"%s %s",prefix(),name());
|
||||
else
|
||||
strcpy(fullname, name());
|
||||
c_name_input->value(fullname);
|
||||
c_subclass_input->value(subclass_of);
|
||||
c_public_button->value(public_);
|
||||
const char *c = comment();
|
||||
c_comment_input->buffer()->text(c?c:"");
|
||||
class_panel->show();
|
||||
const char* message = nullptr;
|
||||
|
||||
char *na=nullptr,*pr=nullptr,*p=nullptr; // name and prefix substrings
|
||||
|
||||
for (;;) { // repeat as long as there are errors
|
||||
// we don;t give the option to ignore this error here because code depends
|
||||
// on this being a C++ identifier
|
||||
if (message) fl_alert("%s", message);
|
||||
for (;;) {
|
||||
Fl_Widget* w = Fl::readqueue();
|
||||
if (w == c_panel_cancel) goto BREAK2;
|
||||
else if (w == c_panel_ok) break;
|
||||
else if (!w) Fl::wait();
|
||||
}
|
||||
const char*c = c_name_input->value();
|
||||
char *s = fl_strdup(c);
|
||||
size_t len = strlen(s);
|
||||
if (!*s) goto OOPS;
|
||||
p = (char*) (s+len-1);
|
||||
while (p>=s && isspace(*p)) *(p--)='\0';
|
||||
if (p<s) goto OOPS;
|
||||
while (p>=s && is_id(*p)) p--;
|
||||
if ( (p<s && !is_id(*(p+1))) || !*(p+1) ) {
|
||||
OOPS: message = "class name must be C++ identifier";
|
||||
free((void*)s);
|
||||
continue;
|
||||
}
|
||||
na=p+1; // now we have the name
|
||||
if(p>s) *p--='\0';
|
||||
while (p>=s && isspace(*p)) *(p--)='\0';
|
||||
while (p>=s && is_id(*p)) p--;
|
||||
if (p<s) p++;
|
||||
if (is_id(*p) && p<na) pr=p; // prefix detected
|
||||
c = c_subclass_input->value();
|
||||
message = c_check(c);
|
||||
if (message) { free((void*)s);continue;}
|
||||
name(na);
|
||||
prefix(pr);
|
||||
free((void*)s);
|
||||
storestring(c, subclass_of);
|
||||
if (public_ != c_public_button->value()) {
|
||||
public_ = c_public_button->value();
|
||||
Fluid.proj.set_modflag(1);
|
||||
}
|
||||
c = c_comment_input->buffer()->text();
|
||||
if (c && *c) {
|
||||
if (!comment() || strcmp(c, comment())) { Fluid.proj.set_modflag(1); redraw_browser(); }
|
||||
comment(c);
|
||||
} else {
|
||||
if (comment()) { Fluid.proj.set_modflag(1); redraw_browser(); }
|
||||
comment(nullptr);
|
||||
}
|
||||
if (c) free((void*)c);
|
||||
break;
|
||||
}
|
||||
BREAK2:
|
||||
class_panel->hide();
|
||||
open_panel();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -280,6 +280,10 @@ public:
|
||||
bool is_a(Type inType) const override { return (inType==Type::Class) ? true : super::is_a(inType); }
|
||||
void write_properties(fld::io::Project_Writer &f) override;
|
||||
void read_property(fld::io::Project_Reader &f, const char *) override;
|
||||
const char* base_class_name() { return subclass_of; }
|
||||
void base_class_name(const char* name) { storestring(name, subclass_of); }
|
||||
char visibility() { return public_; }
|
||||
void visibility(char v) { public_ = v; }
|
||||
|
||||
// class prefix attribute access
|
||||
void prefix(const char* p);
|
||||
|
||||
@ -1278,6 +1278,10 @@ void load_panel() {
|
||||
current_node = Fluid.proj.tree.current;
|
||||
tabs_wizard->value(comment_tabs);
|
||||
numselected = 1;
|
||||
} else if (Fluid.proj.tree.current->is_a(Type::Class)) {
|
||||
current_node = Fluid.proj.tree.current;
|
||||
tabs_wizard->value(class_tabs);
|
||||
numselected = 1;
|
||||
} else {
|
||||
current_node = nullptr;
|
||||
if (Fluid.proj.tree.current->is_widget())
|
||||
|
||||
@ -480,87 +480,6 @@ Fl_Double_Window* make_decl_panel() {
|
||||
return decl_panel;
|
||||
}
|
||||
|
||||
Fl_Double_Window *class_panel=(Fl_Double_Window *)0;
|
||||
|
||||
Fl_Light_Button *c_public_button=(Fl_Light_Button *)0;
|
||||
|
||||
Fl_Input *c_name_input=(Fl_Input *)0;
|
||||
|
||||
Fl_Input *c_subclass_input=(Fl_Input *)0;
|
||||
|
||||
Fl_Text_Editor *c_comment_input=(Fl_Text_Editor *)0;
|
||||
|
||||
Fl_Return_Button *c_panel_ok=(Fl_Return_Button *)0;
|
||||
|
||||
Fl_Button *c_panel_cancel=(Fl_Button *)0;
|
||||
|
||||
Fl_Double_Window* make_class_panel() {
|
||||
{ class_panel = new Fl_Double_Window(342, 196, "Class Properties");
|
||||
class_panel->labelsize(11);
|
||||
{ Fl_Group* o = new Fl_Group(10, 10, 280, 20);
|
||||
o->hide();
|
||||
{ c_public_button = new Fl_Light_Button(10, 10, 60, 20, "public");
|
||||
c_public_button->tooltip("Make the class publicly accessible.");
|
||||
c_public_button->labelsize(11);
|
||||
c_public_button->when(FL_WHEN_NEVER);
|
||||
c_public_button->hide();
|
||||
} // Fl_Light_Button* c_public_button
|
||||
{ Fl_Box* o = new Fl_Box(80, 10, 210, 20);
|
||||
Fl_Group::current()->resizable(o);
|
||||
} // Fl_Box* o
|
||||
o->end();
|
||||
} // Fl_Group* o
|
||||
{ c_name_input = new Fl_Input(10, 20, 320, 20, "Name:");
|
||||
c_name_input->tooltip("Name of class.");
|
||||
c_name_input->labelfont(1);
|
||||
c_name_input->labelsize(11);
|
||||
c_name_input->textfont(4);
|
||||
c_name_input->textsize(11);
|
||||
c_name_input->align(Fl_Align(FL_ALIGN_TOP_LEFT));
|
||||
c_name_input->when(FL_WHEN_NEVER);
|
||||
} // Fl_Input* c_name_input
|
||||
{ c_subclass_input = new Fl_Input(10, 55, 320, 20, "Subclass of (text between : and {)");
|
||||
c_subclass_input->tooltip("Name of subclass.");
|
||||
c_subclass_input->labelfont(1);
|
||||
c_subclass_input->labelsize(11);
|
||||
c_subclass_input->textfont(4);
|
||||
c_subclass_input->textsize(11);
|
||||
c_subclass_input->align(Fl_Align(FL_ALIGN_TOP_LEFT));
|
||||
c_subclass_input->when(FL_WHEN_NEVER);
|
||||
} // Fl_Input* c_subclass_input
|
||||
{ c_comment_input = new Fl_Text_Editor(10, 90, 320, 65, "Comment:");
|
||||
c_comment_input->tooltip("Class comment in Doxygen format");
|
||||
c_comment_input->box(FL_DOWN_BOX);
|
||||
c_comment_input->labelfont(1);
|
||||
c_comment_input->labelsize(11);
|
||||
c_comment_input->textfont(4);
|
||||
c_comment_input->textsize(11);
|
||||
c_comment_input->align(Fl_Align(FL_ALIGN_TOP_LEFT));
|
||||
Fl_Group::current()->resizable(c_comment_input);
|
||||
c_comment_input->buffer(new Fl_Text_Buffer());
|
||||
c_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation);
|
||||
} // Fl_Text_Editor* c_comment_input
|
||||
{ Fl_Group* o = new Fl_Group(10, 165, 320, 20);
|
||||
{ c_panel_ok = new Fl_Return_Button(200, 165, 60, 20, "OK");
|
||||
c_panel_ok->labelsize(11);
|
||||
c_panel_ok->window()->hotspot(c_panel_ok);
|
||||
} // Fl_Return_Button* c_panel_ok
|
||||
{ c_panel_cancel = new Fl_Button(270, 165, 60, 20, "Cancel");
|
||||
c_panel_cancel->shortcut(0xff1b);
|
||||
c_panel_cancel->labelsize(11);
|
||||
} // Fl_Button* c_panel_cancel
|
||||
{ Fl_Box* o = new Fl_Box(10, 165, 185, 20);
|
||||
Fl_Group::current()->resizable(o);
|
||||
} // Fl_Box* o
|
||||
o->end();
|
||||
} // Fl_Group* o
|
||||
class_panel->set_modal();
|
||||
class_panel->size_range(343, 188);
|
||||
class_panel->end();
|
||||
} // Fl_Double_Window* class_panel
|
||||
return class_panel;
|
||||
}
|
||||
|
||||
void type_make_cb(Fl_Widget*,void*d) {
|
||||
const char *type_name = (const char*)d;
|
||||
if (Fluid.proj.tree.current && Fluid.proj.tree.current->can_have_children())
|
||||
|
||||
@ -213,7 +213,7 @@ Function {make_codeblock_panel()} {open
|
||||
Function {make_declblock_panel()} {open
|
||||
} {
|
||||
Fl_Window declblock_panel {
|
||||
label {Declaration Block Properties} open
|
||||
label {Declaration Block Properties}
|
||||
xywh {645 452 300 355} type Double labelsize 11 align 80 resizable
|
||||
code0 {o->size_range(o->w(), o->h(), Fl::w(), o->h());} modal size_range {300 355 0 0} visible
|
||||
} {
|
||||
@ -380,55 +380,6 @@ Function {make_decl_panel()} {open
|
||||
}
|
||||
}
|
||||
|
||||
Function {make_class_panel()} {open
|
||||
} {
|
||||
Fl_Window class_panel {
|
||||
label {Class Properties}
|
||||
xywh {795 337 342 196} type Double labelsize 11 hide resizable modal size_range {343 188 0 0}
|
||||
} {
|
||||
Fl_Group {} {open
|
||||
xywh {10 10 280 20} hide
|
||||
} {
|
||||
Fl_Light_Button c_public_button {
|
||||
label public
|
||||
tooltip {Make the class publicly accessible.} xywh {10 10 60 20} labelsize 11 when 0 hide
|
||||
}
|
||||
Fl_Box {} {
|
||||
xywh {80 10 210 20} resizable
|
||||
}
|
||||
}
|
||||
Fl_Input c_name_input {
|
||||
label {Name:}
|
||||
tooltip {Name of class.} xywh {10 20 320 20} labelfont 1 labelsize 11 align 5 when 0 textfont 4 textsize 11
|
||||
}
|
||||
Fl_Input c_subclass_input {
|
||||
label {Subclass of (text between : and \{)}
|
||||
tooltip {Name of subclass.} xywh {10 55 320 20} labelfont 1 labelsize 11 align 5 when 0 textfont 4 textsize 11
|
||||
}
|
||||
Fl_Text_Editor c_comment_input {
|
||||
label {Comment:}
|
||||
tooltip {Class comment in Doxygen format} xywh {10 90 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable
|
||||
code0 {c_comment_input->buffer(new Fl_Text_Buffer());}
|
||||
code1 {c_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation);}
|
||||
}
|
||||
Fl_Group {} {open
|
||||
xywh {10 165 320 20}
|
||||
} {
|
||||
Fl_Return_Button c_panel_ok {
|
||||
label OK
|
||||
xywh {200 165 60 20} labelsize 11 hotspot
|
||||
}
|
||||
Fl_Button c_panel_cancel {
|
||||
label Cancel
|
||||
xywh {270 165 60 20} shortcut 0xff1b labelsize 11
|
||||
}
|
||||
Fl_Box {} {
|
||||
xywh {10 165 185 20} resizable
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Function {type_make_cb(Fl_Widget*,void*d)} {open return_type void
|
||||
} {
|
||||
code {const char *type_name = (const char*)d;
|
||||
@ -445,7 +396,7 @@ Function {make_widgetbin()} {open
|
||||
callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape)
|
||||
Fluid.quit();
|
||||
else
|
||||
Fluid.toggle_widget_bin();} open
|
||||
Fluid.toggle_widget_bin();}
|
||||
xywh {395 227 600 102} type Single align 80 non_modal visible
|
||||
} {
|
||||
Fl_Group {} {
|
||||
|
||||
@ -75,14 +75,6 @@ extern Fl_Button *decl_panel_cancel;
|
||||
Fl_Double_Window* make_decl_panel();
|
||||
extern Fl_Menu_Item menu_decl_choice[];
|
||||
extern Fl_Menu_Item menu_decl_class_choice[];
|
||||
extern Fl_Double_Window *class_panel;
|
||||
extern Fl_Light_Button *c_public_button;
|
||||
extern Fl_Input *c_name_input;
|
||||
extern Fl_Input *c_subclass_input;
|
||||
extern Fl_Text_Editor *c_comment_input;
|
||||
extern Fl_Return_Button *c_panel_ok;
|
||||
extern Fl_Button *c_panel_cancel;
|
||||
Fl_Double_Window* make_class_panel();
|
||||
void type_make_cb(Fl_Widget*,void*d);
|
||||
#include <FL/Fl_Window.H>
|
||||
extern Fl_Window *widgetbin_panel;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@
|
||||
// https://www.fltk.org/bugs.php
|
||||
//
|
||||
|
||||
// generated by Fast Light User Interface Designer (fluid) version 1.0400
|
||||
// generated by Fast Light User Interface Designer (fluid) version 1.0500
|
||||
|
||||
#ifndef widget_panel_h
|
||||
#define widget_panel_h
|
||||
@ -118,6 +118,11 @@ extern void load_comments_preset(Fl_Preferences &menu);
|
||||
#include <FL/fl_string_functions.h>
|
||||
extern Fl_Menu_Button *comment_predefined_2;
|
||||
extern Fl_Button *comment_load_2;
|
||||
extern Fl_Tabs *class_tabs;
|
||||
extern Fl_Group *class_tabs_main;
|
||||
extern Fl_Input *c_name_input_2;
|
||||
extern Fl_Input *c_subclass_input_2;
|
||||
extern Fl_Text_Editor *c_comment_input_2;
|
||||
extern Fl_Tabs *widget_tabs_repo;
|
||||
extern void live_mode_cb(Fl_Button*, void*);
|
||||
extern Fl_Button *wLiveMode;
|
||||
@ -135,4 +140,5 @@ extern Fl_Menu_Item menu_4[];
|
||||
extern Fl_Menu_Item menu_5[];
|
||||
extern Fl_Menu_Item menu_6[];
|
||||
extern Fl_Menu_Item menu_data_mode_2[];
|
||||
extern Fl_Menu_Item menu_7[];
|
||||
#endif
|
||||
|
||||
@ -405,6 +405,7 @@ void run_autodoc(const std::string &target_dir) {
|
||||
Node *t_data = add_new_widget_from_user("Data", Strategy::AS_LAST_CHILD, false);
|
||||
Node *t_comment = add_new_widget_from_user("Comment", Strategy::AS_LAST_CHILD, false);
|
||||
t_comment->name("All work and no play make Jack a dull boy.");
|
||||
Node *t_class = add_new_widget_from_user("Class", Strategy::AS_LAST_CHILD, false);
|
||||
|
||||
widget_browser->rebuild();
|
||||
Fluid.proj.update_settings_dialog();
|
||||
@ -526,12 +527,8 @@ void run_autodoc(const std::string &target_dir) {
|
||||
adoc_declblock_panel->hide();
|
||||
|
||||
// -- Type::Class
|
||||
Fl_Window *adoc_class_panel = make_class_panel();
|
||||
decl_class_choice->hide();
|
||||
c_name_input->value("Zoo_Giraffe");
|
||||
c_subclass_input->value("Zoo_Animal");
|
||||
fl_snapshot((target_dir + "class_panel.png").c_str(), adoc_class_panel, win_margin, win_blend);
|
||||
adoc_class_panel->hide();
|
||||
select_only(t_class);
|
||||
fl_snapshot((target_dir + "class_panel.png").c_str(), class_tabs_main, tab_margin, row_blend);
|
||||
|
||||
// -- Type::Widget_Class is handled like Window_Node
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user