mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 23:42:15 +08:00
STR #1035: Fl_Help_View now accepts direct buffer loading and reading via 'value()' functions.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4582 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -79,6 +79,8 @@ public:
|
|||||||
uchar textsize();
|
uchar textsize();
|
||||||
void topline(const char *n);
|
void topline(const char *n);
|
||||||
void topline(int n);
|
void topline(int n);
|
||||||
|
void value(const char *f);
|
||||||
|
const char * value() const;
|
||||||
int visible();
|
int visible();
|
||||||
int w();
|
int w();
|
||||||
int x();
|
int x();
|
||||||
|
|||||||
+42
-23
@@ -32,34 +32,43 @@
|
|||||||
#include <FL/fl_ask.H>
|
#include <FL/fl_ask.H>
|
||||||
|
|
||||||
void Fl_Help_Dialog::cb_view__i(Fl_Help_View*, void*) {
|
void Fl_Help_Dialog::cb_view__i(Fl_Help_View*, void*) {
|
||||||
|
if (view_->filename())
|
||||||
|
{
|
||||||
if (view_->changed())
|
if (view_->changed())
|
||||||
{
|
|
||||||
index_ ++;
|
|
||||||
|
|
||||||
if (index_ >= 100)
|
|
||||||
{
|
{
|
||||||
memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
|
index_ ++;
|
||||||
memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
|
|
||||||
index_ -= 10;
|
if (index_ >= 100)
|
||||||
|
{
|
||||||
|
memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
|
||||||
|
memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
|
||||||
|
index_ -= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
max_ = index_;
|
||||||
|
|
||||||
|
strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
|
||||||
|
line_[index_] = view_->topline();
|
||||||
|
|
||||||
|
if (index_ > 0)
|
||||||
|
back_->activate();
|
||||||
|
else
|
||||||
|
back_->deactivate();
|
||||||
|
|
||||||
|
forward_->deactivate();
|
||||||
|
window_->label(view_->title());
|
||||||
}
|
}
|
||||||
|
else // if ! view_->changed()
|
||||||
max_ = index_;
|
{
|
||||||
|
strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
|
||||||
strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
|
line_[index_] = view_->topline();
|
||||||
|
}
|
||||||
|
} else { // if ! view_->filename()
|
||||||
|
index_ = 0; // hitting an internal page will disable the back/fwd buffer
|
||||||
|
file_[index_][0] = 0; // unnamed internal page
|
||||||
line_[index_] = view_->topline();
|
line_[index_] = view_->topline();
|
||||||
|
back_->deactivate();
|
||||||
if (index_ > 0)
|
|
||||||
back_->activate();
|
|
||||||
else
|
|
||||||
back_->deactivate();
|
|
||||||
|
|
||||||
forward_->deactivate();
|
forward_->deactivate();
|
||||||
window_->label(view_->title());
|
|
||||||
}
|
|
||||||
else if (view_->filename())
|
|
||||||
{
|
|
||||||
strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
|
|
||||||
line_[index_] = view_->topline();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
void Fl_Help_Dialog::cb_view_(Fl_Help_View* o, void* v) {
|
void Fl_Help_Dialog::cb_view_(Fl_Help_View* o, void* v) {
|
||||||
@@ -281,6 +290,16 @@ void Fl_Help_Dialog::topline(int n) {
|
|||||||
view_->topline(n);
|
view_->topline(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Fl_Help_Dialog::value(const char *f) {
|
||||||
|
view_->set_changed();
|
||||||
|
view_->value(f);
|
||||||
|
window_->label(view_->title());
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * Fl_Help_Dialog::value() const {
|
||||||
|
return view_->value();
|
||||||
|
}
|
||||||
|
|
||||||
int Fl_Help_Dialog::visible() {
|
int Fl_Help_Dialog::visible() {
|
||||||
return (window_->visible());
|
return (window_->visible());
|
||||||
}
|
}
|
||||||
|
|||||||
+44
-26
@@ -42,41 +42,49 @@ class FL_EXPORT Fl_Help_Dialog {open
|
|||||||
decl {int line_[100];} {}
|
decl {int line_[100];} {}
|
||||||
decl {char file_[100][256];} {}
|
decl {char file_[100][256];} {}
|
||||||
decl {int find_pos_;} {}
|
decl {int find_pos_;} {}
|
||||||
Function {Fl_Help_Dialog()} {open
|
Function {Fl_Help_Dialog()} {} {
|
||||||
} {
|
|
||||||
Fl_Window window_ {
|
Fl_Window window_ {
|
||||||
label {Help Dialog} open selected
|
label {Help Dialog} open
|
||||||
private xywh {398 65 530 385} type Double resizable size_range {260 150 0 0} visible
|
private xywh {398 65 530 385} type Double resizable size_range {260 150 0 0} visible
|
||||||
} {
|
} {
|
||||||
Fl_Group view_ {
|
Fl_Group view_ {
|
||||||
callback {if (view_->changed())
|
callback {if (view_->filename())
|
||||||
{
|
{
|
||||||
index_ ++;
|
if (view_->changed())
|
||||||
|
|
||||||
if (index_ >= 100)
|
|
||||||
{
|
{
|
||||||
memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
|
index_ ++;
|
||||||
memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
|
|
||||||
index_ -= 10;
|
if (index_ >= 100)
|
||||||
|
{
|
||||||
|
memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
|
||||||
|
memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
|
||||||
|
index_ -= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
max_ = index_;
|
||||||
|
|
||||||
|
strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
|
||||||
|
line_[index_] = view_->topline();
|
||||||
|
|
||||||
|
if (index_ > 0)
|
||||||
|
back_->activate();
|
||||||
|
else
|
||||||
|
back_->deactivate();
|
||||||
|
|
||||||
|
forward_->deactivate();
|
||||||
|
window_->label(view_->title());
|
||||||
}
|
}
|
||||||
|
else // if ! view_->changed()
|
||||||
max_ = index_;
|
{
|
||||||
|
strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
|
||||||
strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
|
line_[index_] = view_->topline();
|
||||||
|
}
|
||||||
|
} else { // if ! view_->filename()
|
||||||
|
index_ = 0; // hitting an internal page will disable the back/fwd buffer
|
||||||
|
file_[index_][0] = 0; // unnamed internal page
|
||||||
line_[index_] = view_->topline();
|
line_[index_] = view_->topline();
|
||||||
|
back_->deactivate();
|
||||||
if (index_ > 0)
|
|
||||||
back_->activate();
|
|
||||||
else
|
|
||||||
back_->deactivate();
|
|
||||||
|
|
||||||
forward_->deactivate();
|
forward_->deactivate();
|
||||||
window_->label(view_->title());
|
|
||||||
}
|
|
||||||
else if (view_->filename())
|
|
||||||
{
|
|
||||||
strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
|
|
||||||
line_[index_] = view_->topline();
|
|
||||||
}} open
|
}} open
|
||||||
private xywh {10 10 510 330} box DOWN_BOX selection_color 15 resizable
|
private xywh {10 10 510 330} box DOWN_BOX selection_color 15 resizable
|
||||||
code0 {\#include <FL/Fl_Help_View.H>}
|
code0 {\#include <FL/Fl_Help_View.H>}
|
||||||
@@ -226,6 +234,16 @@ else
|
|||||||
} {
|
} {
|
||||||
code {view_->topline(n);} {}
|
code {view_->topline(n);} {}
|
||||||
}
|
}
|
||||||
|
Function {value(const char *f)} {return_type void
|
||||||
|
} {
|
||||||
|
code {view_->set_changed();
|
||||||
|
view_->value(f);
|
||||||
|
window_->label(view_->title());} {}
|
||||||
|
}
|
||||||
|
Function {value() const} {selected return_type {const char *}
|
||||||
|
} {
|
||||||
|
code {return view_->value();} {}
|
||||||
|
}
|
||||||
Function {visible()} {return_type int
|
Function {visible()} {return_type int
|
||||||
} {
|
} {
|
||||||
code {return (window_->visible());} {}
|
code {return (window_->visible());} {}
|
||||||
|
|||||||
Reference in New Issue
Block a user