summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fluid/Fl_Type.cxx6
-rw-r--r--fluid/Fl_Type.h3
-rw-r--r--fluid/code.cxx18
-rw-r--r--fluid/sourceview_panel.cxx18
-rw-r--r--fluid/sourceview_panel.fl23
5 files changed, 44 insertions, 24 deletions
diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx
index ecb109785..bc31755b7 100644
--- a/fluid/Fl_Type.cxx
+++ b/fluid/Fl_Type.cxx
@@ -351,7 +351,8 @@ Fl_Type::Fl_Type() :
code_static_start(-1), code_static_end(-1),
code1_start(-1), code1_end(-1),
code2_start(-1), code2_end(-1),
-header_start(-1), header_end(-1),
+header1_start(-1), header1_end(-1),
+header2_start(-1), header2_end(-1),
header_static_start(-1), header_static_end(-1),
proj1_start(-1), proj1_end(-1),
proj2_start(-1), proj2_end(-1)
@@ -1038,7 +1039,8 @@ Fl_Type *Fl_Type::find_in_text(int text_type, int crsr) {
if (crsr >= node->code_static_start && crsr < node->code_static_end) return node;
break;
case 1:
- if (crsr >= node->header_start && crsr < node->header_end) return node;
+ if (crsr >= node->header1_start && crsr < node->header1_end) return node;
+ if (crsr >= node->header2_start && crsr < node->header2_end) return node;
if (crsr >= node->header_static_start && crsr < node->header_static_end) return node;
break;
case 2:
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index 1f7f689da..246294e26 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -148,7 +148,8 @@ public: // things that should not be public:
int code_static_start, code_static_end;
int code1_start, code1_end;
int code2_start, code2_end;
- int header_start, header_end;
+ int header1_start, header1_end;
+ int header2_start, header2_end;
int header_static_start, header_static_end;
int proj1_start, proj1_end;
int proj2_start, proj2_end;
diff --git a/fluid/code.cxx b/fluid/code.cxx
index b4c5c9c9d..896dcc9ea 100644
--- a/fluid/code.cxx
+++ b/fluid/code.cxx
@@ -649,13 +649,14 @@ void Fd_Code_Writer::write_c_indented(const char *textlines, int inIndent, char
Recursively dump code, putting children between the two parts of the parent code.
*/
Fl_Type* Fd_Code_Writer::write_code(Fl_Type* p) {
- if (write_sourceview) p->header_start = (int)ftell(header_file);
// write all code that come before the children code
// (but don't write the last comment until the very end)
if (!(p==Fl_Type::last && p->is_a(ID_Comment))) {
if (write_sourceview) p->code1_start = (int)ftell(code_file);
+ if (write_sourceview) p->header1_start = (int)ftell(header_file);
p->write_code1(*this);
if (write_sourceview) p->code1_end = (int)ftell(code_file);
+ if (write_sourceview) p->header1_end = (int)ftell(header_file);
}
// recursively write the code of all children
Fl_Type* q;
@@ -672,9 +673,11 @@ Fl_Type* Fd_Code_Writer::write_code(Fl_Type* p) {
}
// write all code that come after the children
- if (write_sourceview) p->code2_start = (int)ftell(header_file);
+ if (write_sourceview) p->code2_start = (int)ftell(code_file);
+ if (write_sourceview) p->header2_start = (int)ftell(header_file);
p->write_code2(*this);
if (write_sourceview) p->code2_end = (int)ftell(code_file);
+ if (write_sourceview) p->header2_end = (int)ftell(header_file);
for (q = p->next; q && q->level > p->level;) {
if (q->is_a(ID_Function)) q = write_code(q);
@@ -692,10 +695,11 @@ Fl_Type* Fd_Code_Writer::write_code(Fl_Type* p) {
for (q = p->next; q && q->level > p->level;) q = write_code(q);
// write all code that come after the children
if (write_sourceview) p->code2_start = (int)ftell(code_file);
+ if (write_sourceview) p->header2_start = (int)ftell(header_file);
p->write_code2(*this);
if (write_sourceview) p->code2_end = (int)ftell(code_file);
+ if (write_sourceview) p->header2_end = (int)ftell(header_file);
}
- if (write_sourceview) p->header_end = (int)ftell(header_file);
return q;
}
@@ -735,13 +739,13 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview)
if (first_type && first_type->is_a(ID_Comment)) {
if (write_sourceview) {
first_type->code1_start = first_type->code2_start = (int)ftell(code_file);
- first_type->header_start = (int)ftell(header_file);
+ first_type->header1_start = first_type->header2_start = (int)ftell(header_file);
}
// it is ok to write non-recursive code here, because comments have no children or code2 blocks
first_type->write_code1(*this);
if (write_sourceview) {
first_type->code1_end = first_type->code2_end = (int)ftell(code_file);
- first_type->header_end = (int)ftell(header_file);
+ first_type->header1_end = first_type->header2_end = (int)ftell(header_file);
}
first_type = first_type->next;
}
@@ -850,12 +854,12 @@ int Fd_Code_Writer::write_code(const char *s, const char *t, bool to_sourceview)
if (last_type && last_type->is_a(ID_Comment)) {
if (write_sourceview) {
last_type->code1_start = last_type->code2_start = (int)ftell(code_file);
- last_type->header_start = (int)ftell(header_file);
+ first_type->header1_start = first_type->header2_start = (int)ftell(header_file);
}
last_type->write_code1(*this);
if (write_sourceview) {
last_type->code1_end = last_type->code2_end = (int)ftell(code_file);
- last_type->header_end = (int)ftell(header_file);
+ first_type->header1_end = first_type->header2_end = (int)ftell(header_file);
}
}
int x = 0, y = 0;
diff --git a/fluid/sourceview_panel.cxx b/fluid/sourceview_panel.cxx
index 7c249e58c..79c034702 100644
--- a/fluid/sourceview_panel.cxx
+++ b/fluid/sourceview_panel.cxx
@@ -78,17 +78,23 @@ void update_sourceview_position() {
}
if (sv_header->visible_r()) {
switch (sv_code_choice) {
- case 2: // code: entire implementation block including children
- case 3: // code1: all implementation code before the children
- case 4: // code1: all implementation code before the children
- pos0 = Fl_Type::current->header_start;
- pos1 = Fl_Type::current->header_end;
- break;
case 0: // prolog: not yet (include statements)
case 1: // static: callbacks, menu declarations
pos0 = Fl_Type::current->header_static_start;
pos1 = Fl_Type::current->header_static_end;
break;
+ case 2: // code: entire implementation block including children
+ pos0 = Fl_Type::current->header1_start;
+ pos1 = Fl_Type::current->header2_end;
+ break;
+ case 3: // code1: all implementation code before the children
+ pos0 = Fl_Type::current->header1_start;
+ pos1 = Fl_Type::current->header1_end;
+ break;
+ case 4: // code1: all implementation code before the children
+ pos0 = Fl_Type::current->header2_start;
+ pos1 = Fl_Type::current->header2_end;
+ break;
}
if (pos0>=0) {
if (pos1<pos0)
diff --git a/fluid/sourceview_panel.fl b/fluid/sourceview_panel.fl
index 1cfd13001..99089f299 100644
--- a/fluid/sourceview_panel.fl
+++ b/fluid/sourceview_panel.fl
@@ -101,17 +101,23 @@ file.} open return_type void
}
if (sv_header->visible_r()) {
switch (sv_code_choice) {
- case 2: // code: entire implementation block including children
- case 3: // code1: all implementation code before the children
- case 4: // code1: all implementation code before the children
- pos0 = Fl_Type::current->header_start;
- pos1 = Fl_Type::current->header_end;
- break;
case 0: // prolog: not yet (include statements)
case 1: // static: callbacks, menu declarations
pos0 = Fl_Type::current->header_static_start;
pos1 = Fl_Type::current->header_static_end;
break;
+ case 2: // code: entire implementation block including children
+ pos0 = Fl_Type::current->header1_start;
+ pos1 = Fl_Type::current->header2_end;
+ break;
+ case 3: // code1: all implementation code before the children
+ pos0 = Fl_Type::current->header1_start;
+ pos1 = Fl_Type::current->header1_end;
+ break;
+ case 4: // code1: all implementation code before the children
+ pos0 = Fl_Type::current->header2_start;
+ pos1 = Fl_Type::current->header2_end;
+ break;
}
if (pos0>=0) {
if (pos1<pos0)
@@ -146,7 +152,8 @@ file.} open return_type void
sv_project->scroll(line, 0);
}
}
- }} {}
+ }} {selected
+ }
}
Function {update_sourceview_position_cb(class Fl_Tabs*, void*)} {
@@ -288,7 +295,7 @@ Function {make_sourceview()} {open
label Source open
xywh {10 35 500 415} labelsize 13 resizable
} {
- Fl_Text_Editor sv_source {selected
+ Fl_Text_Editor sv_source {
xywh {10 40 500 410} textfont 4 textsize 11 resizable
code0 {\#include "CodeEditor.h"}
code1 {o->linenumber_width(60);}