Hello !

I'm trying to make some modifications to fluid to better suit my needs and till now I succed with:

-Add an input line on top of the code editor to show the return type and parameter of the function using the showing code.
-Add the possibility of having multiline declaration blocks.
-Add the possibility of have declaration blocks for variables with initialization. -Add tree options on the layout menu to make the selected object to fill it's parent on width, height or both.

What I'm trying now but I'm having difficulty is to allow seelect a text on the codeviewer and show the correspond selection on the widget_browser (the oposite of what is already implemented). The final idea is to be able to direct select or search on the source viewer and then show the widget that generate it to easy even more code navigation.

Can someone help here !

--------
//on CodeViewer handle event:
int CodeViewer::handle(int ev) {
        if(ev == FL_RELEASE) do_callback();
        return Fl_Text_Display::handle(ev);
}
--------
//on sourceview_panel in the codeviews callback
update_widget_browser_position_cb(NULL, o, sv_line_pos);
--------
//on fluid.cxx

extern void select(Fl_Type *o, int v);
extern void deselect();
//
// Update the selected object depending on the view position
//
void update_selected_object_by_view_position(int source_line, int header_line)
{
  Fl_Type *t;
  for (t = Fl_Type::first; t; t = t->next) {
    // Find the first window...
        if(source_line >= 0) {
if( (source_line >= t->code_line) && (source_line <= t->code_line_end) ) break;
        } else if(header_line >= 0) {
if( (header_line >= t->header_line) && (header_line <= t->header_line_end) ) break;
        } else return;
  }
  if (!t) return;
  deselect();
  //Fl_Type::current = t;
select(t,1); //<<== here I expect to have found a Fl_Type that generated the selected lines and make it visible
}

void update_widget_browser_position_cb(CodeViewer *source, CodeViewer *header, Fl_Input *ii){
        char buf[64];
        int start, end, line;
        CodeViewer *o = source ? source : header;
        if(o) {
                o->buffer()->selection_position(&start, &end);
                line = o->buffer()->count_lines(0, start);
                sprintf(buf,"%d", line);
                ii->value(buf);
update_selected_object_by_view_position(source ? line : -1, header ? line : -1);
        }
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to