Browse Source

Fluid Code Viewer is now truly a viewer, not an editor. I would love to allow text editing in the Code Viewer and re-enter the code into the UI, but that is currently close to impossible to implement

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5039 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/168/head
Matthias Melcher 19 years ago
parent
commit
d90102f9d2
  1. 2
      CHANGES
  2. 8
      fluid/CodeEditor.cxx
  3. 11
      fluid/CodeEditor.h
  4. 8
      fluid/function_panel.cxx
  5. 8
      fluid/function_panel.fl
  6. 4
      fluid/function_panel.h

2
CHANGES

@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.8 CHANGES IN FLTK 1.1.8
- Fluid Code Viewer is now truly a viewer, not a text
editor because edited text can not be saved.
- Fl_Spinner is now fully supported by Fluid (STR #1158) - Fl_Spinner is now fully supported by Fluid (STR #1158)
- Fixed usage of deleted object after menu pulldown - Fixed usage of deleted object after menu pulldown
(STR #1162) (STR #1162)

8
fluid/CodeEditor.cxx

@ -406,6 +406,14 @@ CodeEditor::~CodeEditor() {
} }
CodeViewer::CodeViewer(int X, int Y, int W, int H, const char *L)
: CodeEditor(X, Y, W, H, L)
{
default_key_function(kf_ignore);
remove_all_key_bindings(&key_bindings);
cursor_style(CARET_CURSOR);
}
// //
// End of "$Id$". // End of "$Id$".
// //

11
fluid/CodeEditor.h

@ -70,6 +70,17 @@ class CodeEditor : public Fl_Text_Editor {
int top_line() { return get_absolute_top_line_number(); } int top_line() { return get_absolute_top_line_number(); }
}; };
class CodeViewer : public CodeEditor {
public:
CodeViewer(int X, int Y, int W, int H, const char *L=0);
protected:
int handle(int ev) { return Fl_Text_Display::handle(ev); }
};
#endif // !CodeEditor_h #endif // !CodeEditor_h
// //

8
fluid/function_panel.cxx

@ -843,9 +843,9 @@ Fl_Double_Window *sourceview_panel=(Fl_Double_Window *)0;
Fl_Tabs *sv_tab=(Fl_Tabs *)0; Fl_Tabs *sv_tab=(Fl_Tabs *)0;
CodeEditor *sv_source=(CodeEditor *)0; CodeViewer *sv_source=(CodeViewer *)0;
CodeEditor *sv_header=(CodeEditor *)0; CodeViewer *sv_header=(CodeViewer *)0;
Fl_Light_Button *sv_autorefresh=(Fl_Light_Button *)0; Fl_Light_Button *sv_autorefresh=(Fl_Light_Button *)0;
@ -863,7 +863,7 @@ Fl_Double_Window* make_sourceview() {
{ Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Source"); { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Source");
o->labelsize(13); o->labelsize(13);
o->hide(); o->hide();
{ CodeEditor* o = sv_source = new CodeEditor(20, 50, 480, 390); { CodeViewer* o = sv_source = new CodeViewer(20, 50, 480, 390);
o->box(FL_DOWN_FRAME); o->box(FL_DOWN_FRAME);
o->color(FL_BACKGROUND2_COLOR); o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR); o->selection_color(FL_SELECTION_COLOR);
@ -882,7 +882,7 @@ Fl_Double_Window* make_sourceview() {
} }
{ Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Header"); { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Header");
o->labelsize(13); o->labelsize(13);
{ CodeEditor* o = sv_header = new CodeEditor(20, 50, 480, 390); { CodeViewer* o = sv_header = new CodeViewer(20, 50, 480, 390);
o->box(FL_DOWN_FRAME); o->box(FL_DOWN_FRAME);
o->color(FL_BACKGROUND2_COLOR); o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR); o->selection_color(FL_SELECTION_COLOR);

8
fluid/function_panel.fl

@ -402,7 +402,7 @@ Function {make_widgetbin()} {open
} }
Fl_Button {} { Fl_Button {} {
user_data {"declblock"} user_data {"declblock"}
callback type_make_cb selected callback type_make_cb
tooltip {Declaration Block} xywh {30 55 25 25} box THIN_UP_BOX tooltip {Declaration Block} xywh {30 55 25 25} box THIN_UP_BOX
code0 {o->image(pixmap[11]);} code0 {o->image(pixmap[11]);}
} }
@ -702,17 +702,17 @@ Function {make_sourceview()} {open
Fl_Text_Editor sv_source { Fl_Text_Editor sv_source {
xywh {20 50 480 390} textfont 4 textsize 11 resizable xywh {20 50 480 390} textfont 4 textsize 11 resizable
code0 {\#include "CodeEditor.h"} code0 {\#include "CodeEditor.h"}
class CodeEditor class CodeViewer
} }
} }
Fl_Group {} { Fl_Group {} {
label Header open label Header open selected
xywh {10 35 500 415} labelsize 13 xywh {10 35 500 415} labelsize 13
} { } {
Fl_Text_Editor sv_header { Fl_Text_Editor sv_header {
xywh {20 50 480 390} textfont 4 textsize 11 resizable xywh {20 50 480 390} textfont 4 textsize 11 resizable
code0 {\#include "CodeEditor.h"} code0 {\#include "CodeEditor.h"}
class CodeEditor class CodeViewer
} }
} }
} }

4
fluid/function_panel.h

@ -97,8 +97,8 @@ extern Fl_Double_Window *sourceview_panel;
#include <FL/Fl_Tabs.H> #include <FL/Fl_Tabs.H>
extern void update_sourceview_position_cb(Fl_Tabs*, void*); extern void update_sourceview_position_cb(Fl_Tabs*, void*);
extern Fl_Tabs *sv_tab; extern Fl_Tabs *sv_tab;
extern CodeEditor *sv_source; extern CodeViewer *sv_source;
extern CodeEditor *sv_header; extern CodeViewer *sv_header;
extern void update_sourceview_cb(Fl_Button*, void*); extern void update_sourceview_cb(Fl_Button*, void*);
extern Fl_Light_Button *sv_autorefresh; extern Fl_Light_Button *sv_autorefresh;
extern Fl_Light_Button *sv_autoposition; extern Fl_Light_Button *sv_autoposition;

Loading…
Cancel
Save