3
- Title with file currently loaded
5
- buttons for next/previous error.
9
#include <FL/Fl_Select_Browser.H>
10
#include <FL/Fl_Double_Window.H>
11
#include <FL/Fl_Button.H>
12
#include <FL/Fl_Input.H>
17
#include <FL/Fl_Box.H>
20
Fl_Select_Browser *showBrowser;
21
Fl_Select_Browser *selectBrowser;
22
Fl_Box *fileNameLabel;
26
char* theFileName=NULL;
29
void select_cb(Fl_Widget* o, void*)
32
printf("callback, selection = %d, event_clicks = %d\n",
33
((Fl_Browser*)o)->value(), Fl::event_clicks());
34
printf("Text is: %s\n",selectBrowser->text(((Fl_Browser*)o)->value()));
36
int selectLine = ((Fl_Browser*)o)->value();
37
const char* origTxt = selectBrowser->text(selectLine);
38
const char* endStr = "(-1) : ";
39
char* txt = (char*)malloc(strlen(origTxt)+1+strlen(endStr));
43
while (*ptr != '(')ptr++;
47
while (*ptr != ')')ptr++;
50
int errorLine = atoi(num);
54
// printf("Not an error line\n");
61
strcat(curfname,fullDir);
66
if (!showBrowser->load(curfname))
68
printf("Can't load %s, %s\n", curfname, strerror(errno));
74
while (*ptr != ':')ptr++;
77
txt[strlen(origTxt)] = '\0';
82
theErrStr = strdup(erstr);
83
statusLabel->label(theErrStr);
89
theFileName = strdup(txt);
90
fileNameLabel->label(theFileName);
92
showBrowser->position(errorLine);
93
showBrowser->select(errorLine);
99
int main(int argc, char **argv)
101
if (argc<2) return 0;
110
Fl_Window window(400,400,"Error browser");
112
fileNameLabel = new Fl_Box(FL_NO_BOX,10,0,400,20,"");
113
fileNameLabel->align(FL_ALIGN_CENTER);
115
showBrowser = new Fl_Select_Browser(0,20,400,200-20,0);
116
showBrowser->type(FL_HOLD_BROWSER);
118
selectBrowser = new Fl_Select_Browser(0,200,400,200-20,0);
119
//selectBrowser->type(FL_HOLD_BROWSER);
120
selectBrowser->callback(select_cb);
121
if (!selectBrowser->load(fname))
123
printf("Can't load %s, %s\n", fname, strerror(errno));
127
statusLabel = new Fl_Box(FL_NO_BOX,10,400-20,400,20,"Status line");
128
// statusLabel->align(FL_ALIGN_LEFT);
130
selectBrowser->position(0);
131
window.resizable(showBrowser);
132
window.resizable(selectBrowser);