summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fluid/CodeEditor.cxx14
-rw-r--r--fluid/CodeEditor.h5
-rw-r--r--fluid/fluid.cxx10
-rw-r--r--fluid/function_panel.cxx38
-rw-r--r--fluid/function_panel.fl8
-rw-r--r--fluid/function_panel.h4
6 files changed, 45 insertions, 34 deletions
diff --git a/fluid/CodeEditor.cxx b/fluid/CodeEditor.cxx
index ec8afd789..eea99d24d 100644
--- a/fluid/CodeEditor.cxx
+++ b/fluid/CodeEditor.cxx
@@ -295,16 +295,24 @@ void CodeViewer::draw()
Fl::set_color(FL_SELECTION_COLOR, c);
}
-// ---- DesignViewer implementation
+// ---- TextViewer implementation
/**
- Create a DesignViewer widget.
+ Create a TextViewer widget.
\param[in] X, Y, W, H position and size of the widget
\param[in] L optional label
*/
-DesignViewer::DesignViewer(int X, int Y, int W, int H, const char *L)
+TextViewer::TextViewer(int X, int Y, int W, int H, const char *L)
: Fl_Text_Display(X, Y, W, H, L)
{
buffer(new Fl_Text_Buffer);
}
+/**
+ Avoid memory leaks.
+ */
+TextViewer::~TextViewer() {
+ Fl_Text_Buffer *buf = mBuffer;
+ buffer(0);
+ delete buf;
+}
diff --git a/fluid/CodeEditor.h b/fluid/CodeEditor.h
index 767c960ee..e55bff8f6 100644
--- a/fluid/CodeEditor.h
+++ b/fluid/CodeEditor.h
@@ -68,9 +68,10 @@ protected:
// ---- DesignViewer declaration
-class DesignViewer : public Fl_Text_Display {
+class TextViewer : public Fl_Text_Display {
public:
- DesignViewer(int X, int Y, int W, int H, const char *L=0);
+ TextViewer(int X, int Y, int W, int H, const char *L=0);
+ ~TextViewer();
int top_line() { return get_absolute_top_line_number(); }
};
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx
index 252353bb3..ea8744831 100644
--- a/fluid/fluid.cxx
+++ b/fluid/fluid.cxx
@@ -1794,11 +1794,11 @@ void update_sourceview_cb(Fl_Button*, void*)
strlcat(sv_design_filename, "source_view_tmp.fl", FL_PATH_MAX);
}
- if (sv_design->visible_r()) {
+ if (sv_project->visible_r()) {
write_file(sv_design_filename);
- int top = sv_design->top_line();
- sv_design->buffer()->loadfile(sv_design_filename);
- sv_design->scroll(top, 0);
+ 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];
@@ -2021,6 +2021,8 @@ int main(int argc,char **argv) {
#endif // _WIN32
undo_clear();
+ if (g_shell_command)
+ ::free(g_shell_command);
return (0);
}
diff --git a/fluid/function_panel.cxx b/fluid/function_panel.cxx
index 33157400d..26e2a70fd 100644
--- a/fluid/function_panel.cxx
+++ b/fluid/function_panel.cxx
@@ -1484,9 +1484,9 @@ CodeViewer *sv_source=(CodeViewer *)0;
CodeViewer *sv_header=(CodeViewer *)0;
-DesignViewer *sv_strings=(DesignViewer *)0;
+TextViewer *sv_strings=(TextViewer *)0;
-DesignViewer *sv_design=(DesignViewer *)0;
+TextViewer *sv_project=(TextViewer *)0;
Fl_Light_Button *sv_autorefresh=(Fl_Light_Button *)0;
@@ -1545,7 +1545,7 @@ Fl_Double_Window* make_sourceview() {
{ Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Strings");
o->labelsize(13);
o->hide();
- { DesignViewer* o = sv_strings = new DesignViewer(20, 50, 480, 390);
+ { 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);
@@ -1560,28 +1560,28 @@ Fl_Double_Window* make_sourceview() {
Fl_Group::current()->resizable(sv_strings);
o->linenumber_width(60);
o->linenumber_size(o->Fl_Text_Display::textsize());
- } // DesignViewer* sv_strings
+ } // TextViewer* sv_strings
o->end();
} // Fl_Group* o
- { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Design");
+ { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Project");
o->labelsize(13);
o->hide();
- { DesignViewer* o = sv_design = new DesignViewer(20, 50, 480, 390);
- sv_design->box(FL_DOWN_FRAME);
- sv_design->color(FL_BACKGROUND2_COLOR);
- sv_design->selection_color(FL_SELECTION_COLOR);
- sv_design->labeltype(FL_NORMAL_LABEL);
- sv_design->labelfont(0);
- sv_design->labelsize(14);
- sv_design->labelcolor(FL_FOREGROUND_COLOR);
- sv_design->textfont(4);
- sv_design->textsize(11);
- sv_design->align(Fl_Align(FL_ALIGN_TOP));
- sv_design->when(FL_WHEN_RELEASE);
- Fl_Group::current()->resizable(sv_design);
+ { 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());
- } // DesignViewer* sv_design
+ } // TextViewer* sv_project
o->end();
} // Fl_Group* o
sv_tab->end();
diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl
index 6631035e7..e1464fd4e 100644
--- a/fluid/function_panel.fl
+++ b/fluid/function_panel.fl
@@ -1017,18 +1017,18 @@ Function {make_sourceview()} {open
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 DesignViewer
+ class TextViewer
}
}
Fl_Group {} {
- label Design open
+ label Project open
xywh {10 35 500 415} labelsize 13 hide
} {
- Fl_Text_Display sv_design {
+ 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 DesignViewer
+ class TextViewer
}
}
}
diff --git a/fluid/function_panel.h b/fluid/function_panel.h
index d94e02dc4..b64c1b98c 100644
--- a/fluid/function_panel.h
+++ b/fluid/function_panel.h
@@ -114,8 +114,8 @@ extern void update_sourceview_position_cb(Fl_Tabs*, void*);
extern Fl_Tabs *sv_tab;
extern CodeViewer *sv_source;
extern CodeViewer *sv_header;
-extern DesignViewer *sv_strings;
-extern DesignViewer *sv_design;
+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;