summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-08-29 02:20:45 +0200
committerMatthias Melcher <github@matthiasm.com>2023-08-29 02:20:50 +0200
commit814d642e5da5e1be5dbfb609f43b25313487aa11 (patch)
tree0e90090dada6aaeab56c8202365c4c768eff17d8
parent33353550d9a7c274a338ea40f77a76e5298c7069 (diff)
FLUID: separate SourceView panel into its own file
hereby removing almost 200 lines of unrelated code form fluid.cxx and making the location of the panel code more obvious. Needs a make depend on Linux.
-rw-r--r--fluid/CMakeLists.txt2
-rw-r--r--fluid/Makefile2
-rw-r--r--fluid/fluid.cxx192
-rw-r--r--fluid/fluid.h2
-rw-r--r--fluid/function_panel.cxx138
-rw-r--r--fluid/function_panel.fl106
-rw-r--r--fluid/function_panel.h14
-rw-r--r--fluid/sourceview_panel.cxx331
-rw-r--r--fluid/sourceview_panel.fl301
-rw-r--r--fluid/sourceview_panel.h48
10 files changed, 703 insertions, 433 deletions
diff --git a/fluid/CMakeLists.txt b/fluid/CMakeLists.txt
index 715b4ffc4..62eec124d 100644
--- a/fluid/CMakeLists.txt
+++ b/fluid/CMakeLists.txt
@@ -38,6 +38,7 @@ set (CPPFILES
function_panel.cxx
pixmaps.cxx
shell_command.cxx
+ sourceview_panel.cxx
template_panel.cxx
undo.cxx
widget_browser.cxx
@@ -70,6 +71,7 @@ set (HEADERFILES
print_panel.h
pixmaps.h
shell_command.h
+ sourceview_panel.h
template_panel.h
undo.h
widget_browser.h
diff --git a/fluid/Makefile b/fluid/Makefile
index 5cab97a69..6975e9bcd 100644
--- a/fluid/Makefile
+++ b/fluid/Makefile
@@ -39,6 +39,7 @@ CPPFILES = \
function_panel.cxx \
pixmaps.cxx \
shell_command.cxx \
+ sourceview_panel.cxx \
template_panel.cxx \
undo.cxx \
widget_browser.cxx \
@@ -142,5 +143,6 @@ rebuild: fluid$(EXEEXT)
./fluid$(EXEEXT) -u -c alignment_panel.fl
./fluid$(EXEEXT) -u -c function_panel.fl
./fluid$(EXEEXT) -u -c print_panel.fl
+ ./fluid$(EXEEXT) -u -c sourceview_panel.fl
./fluid$(EXEEXT) -u -c template_panel.fl
./fluid$(EXEEXT) -u -c widget_panel.fl
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx
index c9dd48195..788ed241e 100644
--- a/fluid/fluid.cxx
+++ b/fluid/fluid.cxx
@@ -30,6 +30,7 @@
#include "alignment_panel.h"
#include "function_panel.h"
+#include "sourceview_panel.h"
#include "template_panel.h"
#include "about_panel.h"
@@ -347,13 +348,6 @@ bool confirm_project_clear() {
return true;
}
-// ---- Sourceview definition
-
-void update_sourceview_position();
-void update_sourceview_position_cb(Fl_Tabs*, void*);
-void update_sourceview_cb(Fl_Button*, void*);
-void update_sourceview_timer(void*);
-
// ----
extern Fl_Window *the_panel;
@@ -438,7 +432,7 @@ void leave_project_dir() {
\param[in] X, Y, W, H default size and position if nothing is specified in the preferences
\return 1 if the caller should make the window visible, 0 if hidden.
*/
-char position_window(Fl_Window *w, const char *prefsName, int Visible, int X, int Y, int W=0, int H=0 ) {
+char position_window(Fl_Window *w, const char *prefsName, int Visible, int X, int Y, int W, int H) {
Fl_Preferences pos(fluid_prefs, prefsName);
if (prevpos_button->value()) {
pos.get("x", X, X);
@@ -942,7 +936,7 @@ bool merge_project_file(const Fl_String &filename_arg) {
free((void *)filename);
filename = oldfilename;
if (main_window) set_modflag(modflag);
- return;
+ return false;
}
undo_resume();
widget_browser->rebuild();
@@ -958,6 +952,7 @@ bool merge_project_file(const Fl_String &filename_arg) {
if (oldfilename) free((void *)oldfilename);
}
g_project.update_settings_dialog();
+ return true;
}
/**
@@ -1586,43 +1581,12 @@ void toggle_widgetbin_cb(Fl_Widget *, void *) {
}
}
-/**
- Show or hide the source code preview.
- The state is stored in the app preferences.
- */
void toggle_sourceview_cb(Fl_Double_Window *, void *) {
- if (!sourceview_panel) {
- make_sourceview();
- sourceview_panel->callback((Fl_Callback*)toggle_sourceview_cb);
- Fl_Preferences svp(fluid_prefs, "sourceview");
- int autorefresh;
- svp.get("autorefresh", autorefresh, 1);
- sv_autorefresh->value(autorefresh);
- int autoposition;
- svp.get("autoposition", autoposition, 1);
- sv_autoposition->value(autoposition);
- int tab;
- svp.get("tab", tab, 0);
- if (tab>=0 && tab<sv_tab->children()) sv_tab->value(sv_tab->child(tab));
- if (!position_window(sourceview_panel,"sourceview_pos", 0, 320, 120, 550, 500)) return;
- }
-
- if (sourceview_panel->visible()) {
- sourceview_panel->hide();
- sourceview_item->label("Show Source Code...");
- } else {
- sourceview_panel->show();
- sourceview_item->label("Hide Source Code...");
- update_sourceview_cb(0,0);
- }
+ sourceview_toggle_visibility();
}
-/**
- Show or hide the source code preview, called from a button.
- The state is stored in the app preferences.
- */
void toggle_sourceview_b_cb(Fl_Button*, void *) {
- toggle_sourceview_cb(0,0);
+ sourceview_toggle_visibility();
}
/**
@@ -1823,149 +1787,7 @@ void set_modflag(int mf, int mfc) {
}
// if the UI was modified in any way, update the Source View panel
if (sourceview_panel && sourceview_panel->visible() && sv_autorefresh->value())
- {
- // we will only update earliest 0.5 seconds after the last change, and only
- // if no other change was made, so dragging a widget will not generate any
- // CPU load
- Fl::remove_timeout(update_sourceview_timer, 0);
- Fl::add_timeout(0.5, update_sourceview_timer, 0);
- }
-}
-
-// ---- Sourceview implementation
-
-static char *sv_source_filename = NULL;
-static char *sv_header_filename = NULL;
-static char *sv_design_filename = NULL;
-
-/**
- Update the header and source code highlighting depending on the
- currently selected object
-
- The Source View system offers an immediate preview of the code
- files that will be generated by FLUID. It also marks the code
- generated for the last selected item in the header and the source
- file.
- */
-void update_sourceview_position()
-{
- if (!sourceview_panel || !sourceview_panel->visible())
- return;
- if (sv_autoposition->value()==0)
- return;
- if (sourceview_panel && sourceview_panel->visible() && Fl_Type::current) {
- int pos0, pos1;
- if (sv_source->visible_r()) {
- pos0 = Fl_Type::current->code_position;
- pos1 = Fl_Type::current->code_position_end;
- if (pos0>=0) {
- if (pos1<pos0)
- pos1 = pos0;
- sv_source->buffer()->highlight(pos0, pos1);
- int line = sv_source->buffer()->count_lines(0, pos0);
- sv_source->scroll(line, 0);
- }
- }
- if (sv_header->visible_r()) {
- pos0 = Fl_Type::current->header_position;
- pos1 = Fl_Type::current->header_position_end;
- if (pos0>=0) {
- if (pos1<pos0)
- pos1 = pos0;
- sv_header->buffer()->highlight(pos0, pos1);
- int line = sv_header->buffer()->count_lines(0, pos0);
- sv_header->scroll(line, 0);
- }
- }
- }
-}
-
-/**
- Callback to update the sourceview position.
- */
-void update_sourceview_position_cb(Fl_Tabs*, void*)
-{
- // make sure that the selected tab shows the current view
- update_sourceview_cb(0,0);
- // highlight the selected widget in the selected tab
- update_sourceview_position();
-}
-
-/**
- Generate a header, source, strings, or design file in a temporary directory
- and load those into the Code Viewer widgets.
- */
-void update_sourceview_cb(Fl_Button*, void*)
-{
- if (!sourceview_panel || !sourceview_panel->visible())
- return;
-
- if (!sv_source_filename) {
- sv_source_filename = (char*)malloc(FL_PATH_MAX);
- fluid_prefs.getUserdataPath(sv_source_filename, FL_PATH_MAX);
- strlcat(sv_source_filename, "source_view_tmp.cxx", FL_PATH_MAX);
- }
- if (!sv_header_filename) {
- sv_header_filename = (char*)malloc(FL_PATH_MAX);
- fluid_prefs.getUserdataPath(sv_header_filename, FL_PATH_MAX);
- strlcat(sv_header_filename, "source_view_tmp.h", FL_PATH_MAX);
- }
- if (!sv_design_filename) {
- sv_design_filename = (char*)malloc(FL_PATH_MAX);
- fluid_prefs.getUserdataPath(sv_design_filename, FL_PATH_MAX);
- strlcat(sv_design_filename, "source_view_tmp.fl", FL_PATH_MAX);
- }
-
- if (sv_project->visible_r()) {
- write_file(sv_design_filename);
- int top = sv_project->top_line();
- sv_project->buffer()->loadfile(sv_design_filename);
- sv_project->scroll(top, 0);
- } else if (sv_strings->visible_r()) {
- static const char *exts[] = { ".txt", ".po", ".msg" };
- char fn[FL_PATH_MAX];
- fluid_prefs.getUserdataPath(fn, FL_PATH_MAX);
- fl_filename_setext(fn, FL_PATH_MAX, exts[g_project.i18n_type]);
- write_strings(fn);
- int top = sv_strings->top_line();
- sv_strings->buffer()->loadfile(fn);
- sv_strings->scroll(top, 0);
- } else if (sv_source->visible_r() || sv_header->visible_r()) {
- g_project.basename = fl_filename_name(sv_source_filename);
- g_project.basename = fl_filename_setext(g_project.basename, "");
- Fl_String code_file_name_bak = g_project.code_file_name;
- g_project.code_file_name = sv_source_filename;
- Fl_String header_file_name_bak = g_project.header_file_name;
- g_project.header_file_name = sv_header_filename;
-
- // generate the code and load the files
- Fd_Code_Writer f;
- // generate files
- if (f.write_code(sv_source_filename, sv_header_filename, true))
- {
- // load file into source editor
- int pos = sv_source->top_line();
- sv_source->buffer()->loadfile(sv_source_filename);
- sv_source->scroll(pos, 0);
- // load file into header editor
- pos = sv_header->top_line();
- sv_header->buffer()->loadfile(sv_header_filename);
- sv_header->scroll(pos, 0);
- // update the source code highlighting
- update_sourceview_position();
- }
-
- g_project.code_file_name = code_file_name_bak;
- g_project.header_file_name = header_file_name_bak;
- }
-}
-
-/**
- This is called by the timer itself
- */
-void update_sourceview_timer(void*)
-{
- update_sourceview_cb(0,0);
+ sourceview_defer_update();
}
// ---- Main program entry point
diff --git a/fluid/fluid.h b/fluid/fluid.h
index ac6d303bd..e52828fa7 100644
--- a/fluid/fluid.h
+++ b/fluid/fluid.h
@@ -134,6 +134,8 @@ extern void write_strings_cb(Fl_Widget *, void *);
extern void align_widget_cb(Fl_Widget *, long);
extern void toggle_widgetbin_cb(Fl_Widget *, void *);
+extern char position_window(Fl_Window *w, const char *prefsName, int Visible, int X, int Y, int W=0, int H=0);
+
inline int fd_min(int a, int b) { return (a < b ? a : b); }
inline int fd_max(int a, int b) { return (a > b ? a : b); }
inline int fd_min(int a, int b, int c) { return fd_min(a, fd_min(b, c)); }
diff --git a/fluid/function_panel.cxx b/fluid/function_panel.cxx
index 04c1a4785..379b015ad 100644
--- a/fluid/function_panel.cxx
+++ b/fluid/function_panel.cxx
@@ -1479,142 +1479,4 @@ Fl_Window* make_widgetbin() {
return widgetbin_panel;
}
-Fl_Double_Window *sourceview_panel=(Fl_Double_Window *)0;
-
-Fl_Tabs *sv_tab=(Fl_Tabs *)0;
-
-CodeViewer *sv_source=(CodeViewer *)0;
-
-CodeViewer *sv_header=(CodeViewer *)0;
-
-TextViewer *sv_strings=(TextViewer *)0;
-
-TextViewer *sv_project=(TextViewer *)0;
-
-Fl_Light_Button *sv_autorefresh=(Fl_Light_Button *)0;
-
-Fl_Light_Button *sv_autoposition=(Fl_Light_Button *)0;
-
-Fl_Double_Window* make_sourceview() {
- { sourceview_panel = new Fl_Double_Window(520, 490, "Code View");
- sourceview_panel->callback((Fl_Callback*)toggle_sourceview_cb);
- sourceview_panel->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
- { sv_tab = new Fl_Tabs(10, 10, 500, 440);
- sv_tab->selection_color((Fl_Color)4);
- sv_tab->labelcolor(FL_BACKGROUND2_COLOR);
- sv_tab->callback((Fl_Callback*)update_sourceview_position_cb);
- { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Source");
- o->labelsize(13);
- { CodeViewer* o = sv_source = new CodeViewer(20, 50, 480, 390);
- sv_source->box(FL_DOWN_FRAME);
- sv_source->color(FL_BACKGROUND2_COLOR);
- sv_source->selection_color(FL_SELECTION_COLOR);
- sv_source->labeltype(FL_NORMAL_LABEL);
- sv_source->labelfont(0);
- sv_source->labelsize(14);
- sv_source->labelcolor(FL_FOREGROUND_COLOR);
- sv_source->textfont(4);
- sv_source->textsize(11);
- sv_source->align(Fl_Align(FL_ALIGN_TOP));
- sv_source->when(FL_WHEN_RELEASE);
- Fl_Group::current()->resizable(sv_source);
- o->linenumber_width(60);
- o->linenumber_size(o->Fl_Text_Display::textsize());
- } // CodeViewer* sv_source
- o->end();
- Fl_Group::current()->resizable(o);
- } // Fl_Group* o
- { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Header");
- o->labelsize(13);
- o->hide();
- { CodeViewer* o = sv_header = new CodeViewer(20, 50, 480, 390);
- sv_header->box(FL_DOWN_FRAME);
- sv_header->color(FL_BACKGROUND2_COLOR);
- sv_header->selection_color(FL_SELECTION_COLOR);
- sv_header->labeltype(FL_NORMAL_LABEL);
- sv_header->labelfont(0);
- sv_header->labelsize(14);
- sv_header->labelcolor(FL_FOREGROUND_COLOR);
- sv_header->textfont(4);
- sv_header->textsize(11);
- sv_header->align(Fl_Align(FL_ALIGN_TOP));
- sv_header->when(FL_WHEN_RELEASE);
- Fl_Group::current()->resizable(sv_header);
- o->linenumber_width(60);
- o->linenumber_size(o->Fl_Text_Display::textsize());
- } // CodeViewer* sv_header
- o->end();
- } // Fl_Group* o
- { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Strings");
- o->labelsize(13);
- o->hide();
- { TextViewer* o = sv_strings = new TextViewer(20, 50, 480, 390);
- sv_strings->box(FL_DOWN_FRAME);
- sv_strings->color(FL_BACKGROUND2_COLOR);
- sv_strings->selection_color(FL_SELECTION_COLOR);
- sv_strings->labeltype(FL_NORMAL_LABEL);
- sv_strings->labelfont(0);
- sv_strings->labelsize(14);
- sv_strings->labelcolor(FL_FOREGROUND_COLOR);
- sv_strings->textfont(4);
- sv_strings->textsize(11);
- sv_strings->align(Fl_Align(FL_ALIGN_TOP));
- sv_strings->when(FL_WHEN_RELEASE);
- Fl_Group::current()->resizable(sv_strings);
- o->linenumber_width(60);
- o->linenumber_size(o->Fl_Text_Display::textsize());
- } // TextViewer* sv_strings
- o->end();
- } // Fl_Group* o
- { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Project");
- o->labelsize(13);
- o->hide();
- { TextViewer* o = sv_project = new TextViewer(20, 50, 480, 390);
- sv_project->box(FL_DOWN_FRAME);
- sv_project->color(FL_BACKGROUND2_COLOR);
- sv_project->selection_color(FL_SELECTION_COLOR);
- sv_project->labeltype(FL_NORMAL_LABEL);
- sv_project->labelfont(0);
- sv_project->labelsize(14);
- sv_project->labelcolor(FL_FOREGROUND_COLOR);
- sv_project->textfont(4);
- sv_project->textsize(11);
- sv_project->align(Fl_Align(FL_ALIGN_TOP));
- sv_project->when(FL_WHEN_RELEASE);
- Fl_Group::current()->resizable(sv_project);
- o->linenumber_width(60);
- o->linenumber_size(o->Fl_Text_Display::textsize());
- } // TextViewer* sv_project
- o->end();
- } // Fl_Group* o
- sv_tab->end();
- Fl_Group::current()->resizable(sv_tab);
- } // Fl_Tabs* sv_tab
- { Fl_Group* o = new Fl_Group(10, 460, 500, 20);
- { Fl_Button* o = new Fl_Button(10, 460, 61, 20, "Refresh");
- o->labelsize(11);
- o->callback((Fl_Callback*)update_sourceview_cb);
- } // Fl_Button* o
- { Fl_Light_Button* o = sv_autorefresh = new Fl_Light_Button(76, 460, 91, 20, "Auto-Refresh");
- sv_autorefresh->labelsize(11);
- o->callback((Fl_Callback*)update_sourceview_cb);
- } // Fl_Light_Button* sv_autorefresh
- { sv_autoposition = new Fl_Light_Button(172, 460, 89, 20, "Auto-Position");
- sv_autoposition->labelsize(11);
- } // Fl_Light_Button* sv_autoposition
- { Fl_Button* o = new Fl_Button(460, 460, 50, 20, "Close");
- o->labelsize(11);
- o->callback((Fl_Callback*)toggle_sourceview_b_cb);
- } // Fl_Button* o
- { Fl_Box* o = new Fl_Box(265, 460, 190, 20);
- Fl_Group::current()->resizable(o);
- } // Fl_Box* o
- o->end();
- } // Fl_Group* o
- sourceview_panel->size_range(384, 120);
- sourceview_panel->end();
- } // Fl_Double_Window* sourceview_panel
- return sourceview_panel;
-}
-
//
diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl
index 8977fecdf..bb29b403d 100644
--- a/fluid/function_panel.fl
+++ b/fluid/function_panel.fl
@@ -146,7 +146,7 @@ Function {make_code_panel()} {open
callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape)
return; // ignore Escape
code_panel->hide(); // otherwise hide..}
- xywh {425 882 540 180} type Double labelsize 11 hide resizable
+ xywh {539 567 540 180} type Double labelsize 11 hide resizable
code0 {o->size_range(200, 150);} modal
} {
Fl_Text_Editor code_input {
@@ -484,9 +484,9 @@ Function {make_class_panel()} {open
Function {make_comment_panel()} {open
} {
Fl_Window comment_panel {
- label {Comment Properties} open
- xywh {519 374 550 280} type Double labelsize 11 resizable
- code0 {o->size_range(320, 180);} modal visible
+ label {Comment Properties}
+ xywh {519 374 550 280} type Double labelsize 11 hide resizable
+ code0 {o->size_range(320, 180);} modal
} {
Fl_Text_Editor comment_input {
xywh {110 10 430 230} box DOWN_BOX labelsize 11 textfont 4 textsize 11 textcolor 58 resizable
@@ -534,13 +534,14 @@ Function {make_comment_panel()} {open
}
}
-Function {type_make_cb(Fl_Widget*,void*d)} {return_type void
+Function {type_make_cb(Fl_Widget*,void*d)} {open return_type void
} {
code {const char *type_name = (const char*)d;
if (Fl_Type::current && Fl_Type::current->is_parent())
add_new_widget_from_user(type_name, kAddAsLastChild);
else
- add_new_widget_from_user(type_name, kAddAfterCurrent);} {}
+ add_new_widget_from_user(type_name, kAddAfterCurrent);} {selected
+ }
}
Function {make_widgetbin()} {open
@@ -550,8 +551,8 @@ Function {make_widgetbin()} {open
callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape)
exit_cb((Fl_Widget*)o, v);
else
- toggle_widgetbin_cb((Fl_Widget*)o, v);} open
- xywh {436 243 600 102} type Single align 80 non_modal visible
+ toggle_widgetbin_cb((Fl_Widget*)o, v);}
+ xywh {395 227 600 102} type Single align 80 non_modal visible
} {
Fl_Group {} {
label Code open
@@ -964,7 +965,7 @@ else
}
Fl_Button {} {
user_data {"Fl_Clock"}
- callback type_make_cb selected
+ callback type_make_cb
tooltip Clock xywh {567 21 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[Fl_Type::ID_Clock]);}
class Widget_Bin_Button
@@ -980,93 +981,6 @@ else
}
}
-Function {make_sourceview()} {open
-} {
- Fl_Window sourceview_panel {
- label {Code View}
- callback toggle_sourceview_cb open
- xywh {400 569 520 490} type Double align 80 resizable size_range {384 120 0 0} visible
- } {
- Fl_Tabs sv_tab {
- callback update_sourceview_position_cb open
- xywh {10 10 500 440} selection_color 4 labelcolor 7 resizable
- } {
- Fl_Group {} {
- label Source open
- xywh {10 35 500 415} labelsize 13 resizable
- } {
- Fl_Text_Editor sv_source {
- xywh {20 50 480 390} textfont 4 textsize 11 resizable
- code0 {\#include "CodeEditor.h"}
- code1 {o->linenumber_width(60);}
- code2 {o->linenumber_size(o->Fl_Text_Display::textsize());}
- class CodeViewer
- }
- }
- Fl_Group {} {
- label Header open
- xywh {10 35 500 415} labelsize 13 hide
- } {
- Fl_Text_Editor sv_header {
- xywh {20 50 480 390} textfont 4 textsize 11 resizable
- code0 {\#include "CodeEditor.h"}
- code1 {o->linenumber_width(60);}
- code2 {o->linenumber_size(o->Fl_Text_Display::textsize());}
- class CodeViewer
- }
- }
- Fl_Group {} {
- label Strings open
- xywh {10 35 500 415} labelsize 13 hide
- } {
- Fl_Text_Display sv_strings {
- xywh {20 50 480 390} textfont 4 textsize 11 resizable
- code1 {o->linenumber_width(60);}
- code2 {o->linenumber_size(o->Fl_Text_Display::textsize());}
- class TextViewer
- }
- }
- Fl_Group {} {
- label Project open
- xywh {10 35 500 415} labelsize 13 hide
- } {
- Fl_Text_Display sv_project {
- xywh {20 50 480 390} textfont 4 textsize 11 resizable
- code1 {o->linenumber_width(60);}
- code2 {o->linenumber_size(o->Fl_Text_Display::textsize());}
- class TextViewer
- }
- }
- }
- Fl_Group {} {
- xywh {10 460 500 20}
- } {
- Fl_Button {} {
- label Refresh
- callback update_sourceview_cb
- xywh {10 460 61 20} labelsize 11
- }
- Fl_Light_Button sv_autorefresh {
- label {Auto-Refresh}
- xywh {76 460 91 20} labelsize 11
- code0 {o->callback((Fl_Callback*)update_sourceview_cb);}
- }
- Fl_Light_Button sv_autoposition {
- label {Auto-Position}
- xywh {172 460 89 20} labelsize 11
- }
- Fl_Button {} {
- label Close
- callback toggle_sourceview_b_cb
- xywh {460 460 50 20} labelsize 11
- }
- Fl_Box {} {
- xywh {265 460 190 20} resizable
- }
- }
- }
-}
-
comment {
//} {in_source in_header
}
diff --git a/fluid/function_panel.h b/fluid/function_panel.h
index 0de723061..ba07009d5 100644
--- a/fluid/function_panel.h
+++ b/fluid/function_panel.h
@@ -107,20 +107,6 @@ void type_make_cb(Fl_Widget*,void*d);
#include <FL/Fl_Window.H>
extern Fl_Window *widgetbin_panel;
Fl_Window* make_widgetbin();
-extern void toggle_sourceview_cb(Fl_Double_Window*, void*);
-extern Fl_Double_Window *sourceview_panel;
-#include <FL/Fl_Tabs.H>
-extern void update_sourceview_position_cb(Fl_Tabs*, void*);
-extern Fl_Tabs *sv_tab;
-extern CodeViewer *sv_source;
-extern CodeViewer *sv_header;
-extern TextViewer *sv_strings;
-extern TextViewer *sv_project;
-extern void update_sourceview_cb(Fl_Button*, void*);
-extern Fl_Light_Button *sv_autorefresh;
-extern Fl_Light_Button *sv_autoposition;
-extern void toggle_sourceview_b_cb(Fl_Button*, void*);
-Fl_Double_Window* make_sourceview();
#endif
//
diff --git a/fluid/sourceview_panel.cxx b/fluid/sourceview_panel.cxx
new file mode 100644
index 000000000..8754858c8
--- /dev/null
+++ b/fluid/sourceview_panel.cxx
@@ -0,0 +1,331 @@
+//
+// Code dialogs for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2023 by Bill Spitzak and others.
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file. If this
+// file is missing or damaged, see the license at:
+//
+// https://www.fltk.org/COPYING.php
+//
+// Please see the following page on how to report bugs and issues:
+//
+// https://www.fltk.org/bugs.php
+//
+
+// generated by Fast Light User Interface Designer (fluid) version 1.0400
+
+#include "sourceview_panel.h"
+#include "fluid.h"
+#include "file.h"
+#include <FL/Fl_Tabs.H>
+#include <FL/Fl_Button.H>
+static char *sv_source_filename = NULL;
+static char *sv_header_filename = NULL;
+static char *sv_design_filename = NULL;
+
+/**
+ Update the header and source code highlighting depending on the
+ currently selected object
+
+ The Source View system offers an immediate preview of the code
+ files that will be generated by FLUID. It also marks the code
+ generated for the last selected item in the header and the source
+ file.
+*/
+void update_sourceview_position() {
+ if (!sourceview_panel || !sourceview_panel->visible())
+ return;
+ if (sv_autoposition->value()==0)
+ return;
+ if (sourceview_panel && sourceview_panel->visible() && Fl_Type::current) {
+ int pos0, pos1;
+ if (sv_source->visible_r()) {
+ pos0 = Fl_Type::current->code_position;
+ pos1 = Fl_Type::current->code_position_end;
+ if (pos0>=0) {
+ if (pos1<pos0)
+ pos1 = pos0;
+ sv_source->buffer()->highlight(pos0, pos1);
+ int line = sv_source->buffer()->count_lines(0, pos0);
+ sv_source->scroll(line, 0);
+ }
+ }
+ if (sv_header->visible_r()) {
+ pos0 = Fl_Type::current->header_position;
+ pos1 = Fl_Type::current->header_position_end;
+ if (pos0>=0) {
+ if (pos1<pos0)
+ pos1 = pos0;
+ sv_header->buffer()->highlight(pos0, pos1);
+ int line = sv_header->buffer()->count_lines(0, pos0);
+ sv_header->scroll(line, 0);
+ }
+ }
+ }
+}
+
+/**
+ Callback to update the sourceview position.
+*/
+void update_sourceview_position_cb(class Fl_Tabs*, void*) {
+ // make sure that the selected tab shows the current view
+ update_sourceview_cb(0,0);
+ // highlight the selected widget in the selected tab
+ update_sourceview_position();
+}
+
+/**
+ Generate a header, source, strings, or design file in a temporary directory
+ and load those into the Code Viewer widgets.
+*/
+void update_sourceview_cb(class Fl_Button*, void*) {
+ if (!sourceview_panel || !sourceview_panel->visible())
+ return;
+
+ if (!sv_source_filename) {
+ sv_source_filename = (char*)malloc(FL_PATH_MAX);
+ fluid_prefs.getUserdataPath(sv_source_filename, FL_PATH_MAX);
+ strlcat(sv_source_filename, "source_view_tmp.cxx", FL_PATH_MAX);
+ }
+ if (!sv_header_filename) {
+ sv_header_filename = (char*)malloc(FL_PATH_MAX);
+ fluid_prefs.getUserdataPath(sv_header_filename, FL_PATH_MAX);
+ strlcat(sv_header_filename, "source_view_tmp.h", FL_PATH_MAX);
+ }
+ if (!sv_design_filename) {
+ sv_design_filename = (char*)malloc(FL_PATH_MAX);
+ fluid_prefs.getUserdataPath(sv_design_filename, FL_PATH_MAX);
+ strlcat(sv_design_filename, "source_view_tmp.fl", FL_PATH_MAX);
+ }
+
+ if (sv_project->visible_r()) {
+ write_file(sv_design_filename);
+ int top = sv_project->top_line();
+ sv_project->buffer()->loadfile(sv_design_filename);
+ sv_project->scroll(top, 0);
+ } else if (sv_strings->visible_r()) {
+ static const char *exts[] = { ".txt", ".po", ".msg" };
+ char fn[FL_PATH_MAX];
+ fluid_prefs.getUserdataPath(fn, FL_PATH_MAX);
+ fl_filename_setext(fn, FL_PATH_MAX, exts[g_project.i18n_type]);
+ write_strings(fn);
+ int top = sv_strings->top_line();
+ sv_strings->buffer()->loadfile(fn);
+ sv_strings->scroll(top, 0);
+ } else if (sv_source->visible_r() || sv_header->visible_r()) {
+ g_project.basename = fl_filename_name(sv_source_filename);
+ g_project.basename = fl_filename_setext(g_project.basename, "");
+ Fl_String code_file_name_bak = g_project.code_file_name;
+ g_project.code_file_name = sv_source_filename;
+ Fl_String header_file_name_bak = g_project.header_file_name;
+ g_project.header_file_name = sv_header_filename;
+
+ // generate the code and load the files
+ Fd_Code_Writer f;
+ // generate files
+ if (f.write_code(sv_source_filename, sv_header_filename, true))
+ {
+ // load file into source editor
+ int pos = sv_source->top_line();
+ sv_source->buffer()->loadfile(sv_source_filename);
+ sv_source->scroll(pos, 0);
+ // load file into header editor
+ pos = sv_header->top_line();
+ sv_header->buffer()->loadfile(sv_header_filename);
+ sv_header->scroll(pos, 0);
+ // update the source code highlighting
+ update_sourceview_position();
+ }
+
+ g_project.code_file_name = code_file_name_bak;
+ g_project.header_file_name = header_file_name_bak;
+ }
+}
+
+/**
+ This is called by the timer itself
+*/
+void update_sourceview_timer(void*) {
+ update_sourceview_cb(0,0);
+}
+
+void sourceview_defer_update() {
+ // we will only update earliest 0.5 seconds after the last change, and only
+ // if no other change was made, so dragging a widget will not generate any
+ // CPU load
+ Fl::remove_timeout(update_sourceview_timer, 0);
+ Fl::add_timeout(0.5, update_sourceview_timer, 0);
+}
+
+/**
+ Show or hide the source code preview.
+ The state is stored in the app preferences.
+*/
+void sourceview_toggle_visibility() {
+ if (!sourceview_panel) {
+ make_sourceview();
+ sourceview_panel->callback((Fl_Callback*)toggle_sourceview_cb);
+ Fl_Preferences svp(fluid_prefs, "sourceview");
+ int autorefresh;
+ svp.get("autorefresh", autorefresh, 1);
+ sv_autorefresh->value(autorefresh);
+ int autoposition;
+ svp.get("autoposition", autoposition, 1);
+ sv_autoposition->value(autoposition);
+ int tab;
+ svp.get("tab", tab, 0);
+ if (tab>=0 && tab<sv_tab->children()) sv_tab->value(sv_tab->child(tab));
+ if (!position_window(sourceview_panel,"sourceview_pos", 0, 320, 120, 550, 500)) return;
+ }
+
+ if (sourceview_panel->visible()) {
+ sourceview_panel->hide();
+ sourceview_item->label("Show Source Code...");
+ } else {
+ sourceview_panel->show();
+ sourceview_item->label("Hide Source Code...");
+ update_sourceview_cb(0,0);
+ }
+}
+
+Fl_Double_Window *sourceview_panel=(Fl_Double_Window *)0;
+
+Fl_Tabs *sv_tab=(Fl_Tabs *)0;
+
+CodeViewer *sv_source=(CodeViewer *)0;
+
+CodeViewer *sv_header=(CodeViewer *)0;
+
+TextViewer *sv_strings=(TextViewer *)0;
+
+TextViewer *sv_project=(TextViewer *)0;
+
+Fl_Light_Button *sv_autorefresh=(Fl_Light_Button *)0;
+
+Fl_Light_Button *sv_autoposition=(Fl_Light_Button *)0;
+
+Fl_Double_Window* make_sourceview() {
+ { sourceview_panel = new Fl_Double_Window(520, 490, "Code View");
+ sourceview_panel->callback((Fl_Callback*)toggle_sourceview_cb);
+ sourceview_panel->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
+ { sv_tab = new Fl_Tabs(10, 10, 500, 440);
+ sv_tab->selection_color((Fl_Color)4);
+ sv_tab->labelcolor(FL_BACKGROUND2_COLOR);
+ sv_tab->callback((Fl_Callback*)update_sourceview_position_cb);
+ { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Source");
+ o->labelsize(13);
+ { CodeViewer* o = sv_source = new CodeViewer(20, 50, 480, 390);
+ sv_source->box(FL_DOWN_FRAME);
+ sv_source->color(FL_BACKGROUND2_COLOR);
+ sv_source->selection_color(FL_SELECTION_COLOR);
+ sv_source->labeltype(FL_NORMAL_LABEL);
+ sv_source->labelfont(0);
+ sv_source->labelsize(14);
+ sv_source->labelcolor(FL_FOREGROUND_COLOR);
+ sv_source->textfont(4);
+ sv_source->textsize(11);
+ sv_source->align(Fl_Align(FL_ALIGN_TOP));
+ sv_source->when(FL_WHEN_RELEASE);
+ Fl_Group::current()->resizable(sv_source);
+ o->linenumber_width(60);
+ o->linenumber_size(o->Fl_Text_Display::textsize());
+ } // CodeViewer* sv_source
+ o->end();
+ Fl_Group::current()->resizable(o);
+ } // Fl_Group* o
+ { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Header");
+ o->labelsize(13);
+ o->hide();
+ { CodeViewer* o = sv_header = new CodeViewer(20, 50, 480, 390);
+ sv_header->box(FL_DOWN_FRAME);
+ sv_header->color(FL_BACKGROUND2_COLOR);
+ sv_header->selection_color(FL_SELECTION_COLOR);
+ sv_header->labeltype(FL_NORMAL_LABEL);
+ sv_header->labelfont(0);
+ sv_header->labelsize(14);
+ sv_header->labelcolor(FL_FOREGROUND_COLOR);
+ sv_header->textfont(4);
+ sv_header->textsize(11);
+ sv_header->align(Fl_Align(FL_ALIGN_TOP));
+ sv_header->when(FL_WHEN_RELEASE);
+ Fl_Group::current()->resizable(sv_header);
+ o->linenumber_width(60);
+ o->linenumber_size(o->Fl_Text_Display::textsize());
+ } // CodeViewer* sv_header
+ o->end();
+ } // Fl_Group* o
+ { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Strings");
+ o->labelsize(13);
+ o->hide();
+ { TextViewer* o = sv_strings = new TextViewer(20, 50, 480, 390);
+ sv_strings->box(FL_DOWN_FRAME);
+ sv_strings->color(FL_BACKGROUND2_COLOR);
+ sv_strings->selection_color(FL_SELECTION_COLOR);
+ sv_strings->labeltype(FL_NORMAL_LABEL);
+ sv_strings->labelfont(0);
+ sv_strings->labelsize(14);
+ sv_strings->labelcolor(FL_FOREGROUND_COLOR);
+ sv_strings->textfont(4);
+ sv_strings->textsize(11);
+ sv_strings->align(Fl_Align(FL_ALIGN_TOP));
+ sv_strings->when(FL_WHEN_RELEASE);
+ Fl_Group::current()->resizable(sv_strings);
+ o->linenumber_width(60);
+ o->linenumber_size(o->Fl_Text_Display::textsize());
+ } // TextViewer* sv_strings
+ o->end();
+ } // Fl_Group* o
+ { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Project");
+ o->labelsize(13);
+ o->hide();
+ { TextViewer* o = sv_project = new TextViewer(20, 50, 480, 390);
+ sv_project->box(FL_DOWN_FRAME);
+ sv_project->color(FL_BACKGROUND2_COLOR);
+ sv_project->selection_color(FL_SELECTION_COLOR);
+ sv_project->labeltype(FL_NORMAL_LABEL);
+ sv_project->labelfont(0);
+ sv_project->labelsize(14);
+ sv_project->labelcolor(FL_FOREGROUND_COLOR);
+ sv_project->textfont(4);
+ sv_project->textsize(11);
+ sv_project->align(Fl_Align(FL_ALIGN_TOP));
+ sv_project->when(FL_WHEN_RELEASE);
+ Fl_Group::current()->resizable(sv_project);
+ o->linenumber_width(60);
+ o->linenumber_size(o->Fl_Text_Display::textsize());
+ } // TextViewer* sv_project
+ o->end();
+ } // Fl_Group* o
+ sv_tab->end();
+ Fl_Group::current()->resizable(sv_tab);
+ } // Fl_Tabs* sv_tab
+ { Fl_Group* o = new Fl_Group(10, 460, 500, 20);
+ { Fl_Button* o = new Fl_Button(10, 460, 61, 20, "Refresh");
+ o->labelsize(11);
+ o->callback((Fl_Callback*)update_sourceview_cb);
+ } // Fl_Button* o
+ { Fl_Light_Button* o = sv_autorefresh = new Fl_Light_Button(76, 460, 91, 20, "Auto-Refresh");
+ sv_autorefresh->labelsize(11);
+ o->callback((Fl_Callback*)update_sourceview_cb);
+ } // Fl_Light_Button* sv_autorefresh
+ { sv_autoposition = new Fl_Light_Button(172, 460, 89, 20, "Auto-Position");
+ sv_autoposition->labelsize(11);
+ } // Fl_Light_Button* sv_autoposition
+ { Fl_Button* o = new Fl_Button(460, 460, 50, 20, "Close");
+ o->labelsize(11);
+ o->callback((Fl_Callback*)toggle_sourceview_b_cb);
+ } // Fl_Button* o
+ { Fl_Box* o = new Fl_Box(265, 460, 190, 20);
+ Fl_Group::current()->resizable(o);
+ } // Fl_Box* o
+ o->end();
+ } // Fl_Group* o
+ sourceview_panel->size_range(384, 120);
+ sourceview_panel->end();
+ } // Fl_Double_Window* sourceview_panel
+ return sourceview_panel;
+}
+
+//
diff --git a/fluid/sourceview_panel.fl b/fluid/sourceview_panel.fl
new file mode 100644
index 000000000..7842983c6
--- /dev/null
+++ b/fluid/sourceview_panel.fl
@@ -0,0 +1,301 @@
+# data file for the Fltk User Interface Designer (fluid)
+version 1.0400
+header_name {.h}
+code_name {.cxx}
+snap {
+ ver 1
+ current_suite FLTK
+ current_preset 1
+}
+comment {//
+// Code dialogs for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2023 by Bill Spitzak and others.
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file. If this
+// file is missing or damaged, see the license at:
+//
+// https://www.fltk.org/COPYING.php
+//
+// Please see the following page on how to report bugs and issues:
+//
+// https://www.fltk.org/bugs.php
+//
+} {in_source in_header
+}
+
+decl {\#include "fluid.h"} {private local
+}
+
+decl {\#include "file.h"} {private local
+}
+
+decl {\#include <FL/Fl_Tabs.H>} {private local
+}
+
+decl {\#include <FL/Fl_Button.H>} {private local
+}
+
+decl {char *sv_source_filename = NULL;} {private local
+}
+
+decl {char *sv_header_filename = NULL;} {private local
+}
+
+decl {char *sv_design_filename = NULL;} {private local
+}
+
+Function {update_sourceview_position()} {
+ comment {Update the header and source code highlighting depending on the
+currently selected object
+
+The Source View system offers an immediate preview of the code
+files that will be generated by FLUID. It also marks the code
+generated for the last selected item in the header and the source
+file.} open return_type void
+} {
+ code {if (!sourceview_panel || !sourceview_panel->visible())
+ return;
+ if (sv_autoposition->value()==0)
+ return;
+ if (sourceview_panel && sourceview_panel->visible() && Fl_Type::current) {
+ int pos0, pos1;
+ if (sv_source->visible_r()) {
+ pos0 = Fl_Type::current->code_position;
+ pos1 = Fl_Type::current->code_position_end;
+ if (pos0>=0) {
+ if (pos1<pos0)
+ pos1 = pos0;
+ sv_source->buffer()->highlight(pos0, pos1);
+ int line = sv_source->buffer()->count_lines(0, pos0);
+ sv_source->scroll(line, 0);
+ }
+ }
+ if (sv_header->visible_r()) {
+ pos0 = Fl_Type::current->header_position;
+ pos1 = Fl_Type::current->header_position_end;
+ if (pos0>=0) {
+ if (pos1<pos0)
+ pos1 = pos0;
+ sv_header->buffer()->highlight(pos0, pos1);
+ int line = sv_header->buffer()->count_lines(0, pos0);
+ sv_header->scroll(line, 0);
+ }
+ }
+ }} {}
+}
+
+Function {update_sourceview_position_cb(class Fl_Tabs*, void*)} {
+ comment {Callback to update the sourceview position.} open return_type void
+} {
+ code {// make sure that the selected tab shows the current view
+ update_sourceview_cb(0,0);
+ // highlight the selected widget in the selected tab
+ update_sourceview_position();} {}
+}
+
+Function {update_sourceview_cb(class Fl_Button*, void*)} {
+ comment {Generate a header, source, strings, or design file in a temporary directory
+and load those into the Code Viewer widgets.} open return_type void
+} {
+ code {if (!sourceview_panel || !sourceview_panel->visible())
+ return;
+
+ if (!sv_source_filename) {
+ sv_source_filename = (char*)malloc(FL_PATH_MAX);
+ fluid_prefs.getUserdataPath(sv_source_filename, FL_PATH_MAX);
+ strlcat(sv_source_filename, "source_view_tmp.cxx", FL_PATH_MAX);
+ }
+ if (!sv_header_filename) {
+ sv_header_filename = (char*)malloc(FL_PATH_MAX);
+ fluid_prefs.getUserdataPath(sv_header_filename, FL_PATH_MAX);
+ strlcat(sv_header_filename, "source_view_tmp.h", FL_PATH_MAX);
+ }
+ if (!sv_design_filename) {
+ sv_design_filename = (char*)malloc(FL_PATH_MAX);
+ fluid_prefs.getUserdataPath(sv_design_filename, FL_PATH_MAX);
+ strlcat(sv_design_filename, "source_view_tmp.fl", FL_PATH_MAX);
+ }
+
+ if (sv_project->visible_r()) {
+ write_file(sv_design_filename);
+ int top = sv_project->top_line();
+ sv_project->buffer()->loadfile(sv_design_filename);
+ sv_project->scroll(top, 0);
+ } else if (sv_strings->visible_r()) {
+ static const char *exts[] = { ".txt", ".po", ".msg" };
+ char fn[FL_PATH_MAX];
+ fluid_prefs.getUserdataPath(fn, FL_PATH_MAX);
+ fl_filename_setext(fn, FL_PATH_MAX, exts[g_project.i18n_type]);
+ write_strings(fn);
+ int top = sv_strings->top_line();
+ sv_strings->buffer()->loadfile(fn);
+ sv_strings->scroll(top, 0);
+ } else if (sv_source->visible_r() || sv_header->visible_r()) {
+ g_project.basename = fl_filename_name(sv_source_filename);
+ g_project.basename = fl_filename_setext(g_project.basename, "");
+ Fl_String code_file_name_bak = g_project.code_file_name;
+ g_project.code_file_name = sv_source_filename;
+ Fl_String header_file_name_bak = g_project.header_file_name;
+ g_project.header_file_name = sv_header_filename;
+
+ // generate the code and load the files
+ Fd_Code_Writer f;
+ // generate files
+ if (f.write_code(sv_source_filename, sv_header_filename, true))
+ {
+ // load file into source editor
+ int pos = sv_source->top_line();
+ sv_source->buffer()->loadfile(sv_source_filename);
+ sv_source->scroll(pos, 0);
+ // load file into header editor
+ pos = sv_header->top_line();
+ sv_header->buffer()->loadfile(sv_header_filename);
+ sv_header->scroll(pos, 0);
+ // update the source code highlighting
+ update_sourceview_position();
+ }
+
+ g_project.code_file_name = code_file_name_bak;
+ g_project.header_file_name = header_file_name_bak;
+ }} {}
+}
+
+Function {update_sourceview_timer(void*)} {
+ comment {This is called by the timer itself
+} open return_type void
+} {
+ code {update_sourceview_cb(0,0);} {}
+}
+
+Function {sourceview_defer_update()} {open return_type void
+} {
+ code {// we will only update earliest 0.5 seconds after the last change, and only
+ // if no other change was made, so dragging a widget will not generate any
+ // CPU load
+ Fl::remove_timeout(update_sourceview_timer, 0);
+ Fl::add_timeout(0.5, update_sourceview_timer, 0);} {}
+}
+
+Function {sourceview_toggle_visibility()} {
+ comment {Show or hide the source code preview.
+The state is stored in the app preferences.
+} open return_type void
+} {
+ code {if (!sourceview_panel) {
+ make_sourceview();
+ sourceview_panel->callback((Fl_Callback*)toggle_sourceview_cb);
+ Fl_Preferences svp(fluid_prefs, "sourceview");
+ int autorefresh;
+ svp.get("autorefresh", autorefresh, 1);
+ sv_autorefresh->value(autorefresh);
+ int autoposition;
+ svp.get("autoposition", autoposition, 1);
+ sv_autoposition->value(autoposition);
+ int tab;
+ svp.get("tab", tab, 0);
+ if (tab>=0 && tab<sv_tab->children()) sv_tab->value(sv_tab->child(tab));
+ if (!position_window(sourceview_panel,"sourceview_pos", 0, 320, 120, 550, 500)) return;
+ }
+
+ if (sourceview_panel->visible()) {
+ sourceview_panel->hide();
+ sourceview_item->label("Show Source Code...");
+ } else {
+ sourceview_panel->show();
+ sourceview_item->label("Hide Source Code...");
+ update_sourceview_cb(0,0);
+ }} {}
+}
+
+Function {make_sourceview()} {open
+} {
+ Fl_Window sourceview_panel {
+ label {Code View}
+ callback toggle_sourceview_cb open
+ xywh {400 569 520 490} type Double align 80 resizable size_range {384 120 0 0} visible
+ } {
+ Fl_Tabs sv_tab {
+ callback update_sourceview_position_cb open
+ xywh {10 10 500 440} selection_color 4 labelcolor 7 resizable
+ } {
+ Fl_Group {} {
+ label Source open
+ xywh {10 35 500 415} labelsize 13 resizable
+ } {
+ Fl_Text_Editor sv_source {
+ xywh {20 50 480 390} textfont 4 textsize 11 resizable
+ code0 {\#include "CodeEditor.h"}
+ code1 {o->linenumber_width(60);}
+ code2 {o->linenumber_size(o->Fl_Text_Display::textsize());}
+ class CodeViewer
+ }
+ }
+ Fl_Group {} {
+ label Header open
+ xywh {10 35 500 415} labelsize 13 hide
+ } {
+ Fl_Text_Editor sv_header {
+ xywh {20 50 480 390} textfont 4 textsize 11 resizable
+ code0 {\#include "CodeEditor.h"}
+ code1 {o->linenumber_width(60);}
+ code2 {o->linenumber_size(o->Fl_Text_Display::textsize());}
+ class CodeViewer
+ }
+ }
+ Fl_Group {} {
+ label Strings open
+ xywh {10 35 500 415} labelsize 13 hide
+ } {
+ Fl_Text_Display sv_strings {
+ xywh {20 50 480 390} textfont 4 textsize 11 resizable
+ code1 {o->linenumber_width(60);}
+ code2 {o->linenumber_size(o->Fl_Text_Display::textsize());}
+ class TextViewer
+ }
+ }
+ Fl_Group {} {
+ label Project open
+ xywh {10 35 500 415} labelsize 13 hide
+ } {
+ Fl_Text_Display sv_project {
+ xywh {20 50 480 390} textfont 4 textsize 11 resizable
+ code1 {o->linenumber_width(60);}
+ code2 {o->linenumber_size(o->Fl_Text_Display::textsize());}
+ class TextViewer
+ }
+ }
+ }
+ Fl_Group {} {open
+ xywh {10 460 500 20}
+ } {
+ Fl_Button {} {
+ label Refresh
+ callback update_sourceview_cb
+ xywh {10 460 61 20} labelsize 11
+ }
+ Fl_Light_Button sv_autorefresh {
+ label {Auto-Refresh}
+ xywh {76 460 91 20} labelsize 11
+ code0 {o->callback((Fl_Callback*)update_sourceview_cb);}
+ }
+ Fl_Light_Button sv_autoposition {
+ label {Auto-Position}
+ xywh {172 460 89 20} labelsize 11
+ }
+ Fl_Button {} {
+ label Close
+ callback toggle_sourceview_b_cb
+ xywh {460 460 50 20} labelsize 11
+ }
+ Fl_Box {} {
+ xywh {265 460 190 20} resizable
+ }
+ }
+ }
+}
+
+comment {
+//} {in_source in_header
+}
diff --git a/fluid/sourceview_panel.h b/fluid/sourceview_panel.h
new file mode 100644
index 000000000..88b37450c
--- /dev/null
+++ b/fluid/sourceview_panel.h
@@ -0,0 +1,48 @@
+//
+// Code dialogs for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2023 by Bill Spitzak and others.
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file. If this
+// file is missing or damaged, see the license at:
+//
+// https://www.fltk.org/COPYING.php
+//
+// Please see the following page on how to report bugs and issues:
+//
+// https://www.fltk.org/bugs.php
+//
+
+// generated by Fast Light User Interface Designer (fluid) version 1.0400
+
+#ifndef sourceview_panel_h
+#define sourceview_panel_h
+#include <FL/Fl.H>
+void update_sourceview_position();
+void update_sourceview_position_cb(class Fl_Tabs*, void*);
+void update_sourceview_cb(class Fl_Button*, void*);
+void update_sourceview_timer(void*);
+void sourceview_defer_update();
+void sourceview_toggle_visibility();
+#include <FL/Fl_Double_Window.H>
+extern void toggle_sourceview_cb(Fl_Double_Window*, void*);
+extern Fl_Double_Window *sourceview_panel;
+#include <FL/Fl_Tabs.H>
+extern Fl_Tabs *sv_tab;
+#include <FL/Fl_Group.H>
+#include "CodeEditor.h"
+extern CodeViewer *sv_source;
+extern CodeViewer *sv_header;
+extern TextViewer *sv_strings;
+extern TextViewer *sv_project;
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Light_Button.H>
+extern Fl_Light_Button *sv_autorefresh;
+extern Fl_Light_Button *sv_autoposition;
+extern void toggle_sourceview_b_cb(Fl_Button*, void*);
+#include <FL/Fl_Box.H>
+Fl_Double_Window* make_sourceview();
+#endif
+
+//