2005-03-25 18:20:26 +03:00
|
|
|
//
|
|
|
|
// "$Id$"
|
|
|
|
//
|
|
|
|
// Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2015-03-10 04:41:55 +03:00
|
|
|
// Copyright 1998-2015 by Bill Spitzak and others.
|
2005-03-25 18:20:26 +03:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/COPYING.php
|
2005-03-25 18:20:26 +03:00
|
|
|
//
|
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
|
|
|
//
|
2014-10-05 15:28:29 +04:00
|
|
|
// ========================================================================
|
|
|
|
// DO NOT EDIT FL/Fl_Help_Dialog.H and src/Fl_Help_Dialog.cxx !!!
|
|
|
|
// ========================================================================
|
|
|
|
// Please use fluid to change src/Fl_Help_Dialog.fl interactively
|
|
|
|
// and then use fluid to "write code" or edit and use fluid -c .
|
|
|
|
// ========================================================================
|
|
|
|
//
|
2005-03-25 18:20:26 +03:00
|
|
|
|
2016-01-30 03:56:42 +03:00
|
|
|
// generated by Fast Light User Interface Designer (fluid) version 1.0400
|
2001-08-02 23:43:49 +04:00
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
#include "../FL/Fl_Help_Dialog.H"
|
2002-05-16 16:47:44 +04:00
|
|
|
#include "flstring.h"
|
2002-08-30 20:58:16 +04:00
|
|
|
#include <FL/fl_ask.H>
|
2001-08-02 23:43:49 +04:00
|
|
|
|
2005-04-15 22:00:33 +04:00
|
|
|
void Fl_Help_Dialog::cb_back__i(Fl_Button*, void*) {
|
2001-08-02 23:43:49 +04:00
|
|
|
if (index_ > 0)
|
|
|
|
index_ --;
|
|
|
|
|
|
|
|
if (index_ == 0)
|
|
|
|
back_->deactivate();
|
|
|
|
|
|
|
|
forward_->activate();
|
|
|
|
|
2004-03-11 08:17:12 +03:00
|
|
|
int l = line_[index_];
|
|
|
|
|
2001-08-02 23:43:49 +04:00
|
|
|
if (strcmp(view_->filename(), file_[index_]) != 0)
|
|
|
|
view_->load(file_[index_]);
|
|
|
|
|
2004-03-11 08:17:12 +03:00
|
|
|
view_->topline(l);
|
2001-08-02 23:43:49 +04:00
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::cb_back_(Fl_Button* o, void* v) {
|
2005-03-25 18:20:26 +03:00
|
|
|
((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_back__i(o,v);
|
2001-08-02 23:43:49 +04:00
|
|
|
}
|
|
|
|
|
2005-04-15 22:00:33 +04:00
|
|
|
void Fl_Help_Dialog::cb_forward__i(Fl_Button*, void*) {
|
2001-08-02 23:43:49 +04:00
|
|
|
if (index_ < max_)
|
|
|
|
index_ ++;
|
|
|
|
|
|
|
|
if (index_ >= max_)
|
|
|
|
forward_->deactivate();
|
|
|
|
|
|
|
|
back_->activate();
|
|
|
|
|
2004-03-11 08:17:12 +03:00
|
|
|
int l = view_->topline();
|
|
|
|
|
2001-08-02 23:43:49 +04:00
|
|
|
if (strcmp(view_->filename(), file_[index_]) != 0)
|
|
|
|
view_->load(file_[index_]);
|
|
|
|
|
2004-03-11 08:17:12 +03:00
|
|
|
view_->topline(l);
|
2001-08-02 23:43:49 +04:00
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::cb_forward_(Fl_Button* o, void* v) {
|
2005-03-25 18:20:26 +03:00
|
|
|
((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_forward__i(o,v);
|
2001-08-02 23:43:49 +04:00
|
|
|
}
|
|
|
|
|
2005-04-15 22:00:33 +04:00
|
|
|
void Fl_Help_Dialog::cb_smaller__i(Fl_Button*, void*) {
|
2001-08-02 23:43:49 +04:00
|
|
|
if (view_->textsize() > 8)
|
|
|
|
view_->textsize(view_->textsize() - 2);
|
|
|
|
|
|
|
|
if (view_->textsize() <= 8)
|
|
|
|
smaller_->deactivate();
|
|
|
|
larger_->activate();
|
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::cb_smaller_(Fl_Button* o, void* v) {
|
2005-03-25 18:20:26 +03:00
|
|
|
((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_smaller__i(o,v);
|
2001-08-02 23:43:49 +04:00
|
|
|
}
|
|
|
|
|
2005-04-15 22:00:33 +04:00
|
|
|
void Fl_Help_Dialog::cb_larger__i(Fl_Button*, void*) {
|
2001-08-02 23:43:49 +04:00
|
|
|
if (view_->textsize() < 18)
|
|
|
|
view_->textsize(view_->textsize() + 2);
|
|
|
|
|
|
|
|
if (view_->textsize() >= 18)
|
|
|
|
larger_->deactivate();
|
|
|
|
smaller_->activate();
|
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::cb_larger_(Fl_Button* o, void* v) {
|
2005-03-25 18:20:26 +03:00
|
|
|
((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_larger__i(o,v);
|
2001-08-02 23:43:49 +04:00
|
|
|
}
|
|
|
|
|
2005-04-15 22:00:33 +04:00
|
|
|
void Fl_Help_Dialog::cb_find__i(Fl_Input*, void*) {
|
2003-05-21 20:12:14 +04:00
|
|
|
find_pos_ = view_->find(find_->value(), find_pos_);
|
|
|
|
}
|
|
|
|
void Fl_Help_Dialog::cb_find_(Fl_Input* o, void* v) {
|
2005-03-25 18:20:26 +03:00
|
|
|
((Fl_Help_Dialog*)(o->parent()->parent()->parent()->user_data()))->cb_find__i(o,v);
|
2003-05-21 20:12:14 +04:00
|
|
|
}
|
|
|
|
|
2007-01-28 22:36:51 +03:00
|
|
|
void Fl_Help_Dialog::cb_view__i(Fl_Help_View*, void*) {
|
|
|
|
if (view_->filename())
|
|
|
|
{
|
|
|
|
if (view_->changed())
|
|
|
|
{
|
|
|
|
index_ ++;
|
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
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();
|
|
|
|
back_->deactivate();
|
|
|
|
forward_->deactivate();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
void Fl_Help_Dialog::cb_view_(Fl_Help_View* o, void* v) {
|
|
|
|
((Fl_Help_Dialog*)(o->parent()->user_data()))->cb_view__i(o,v);
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
Fl_Help_Dialog::Fl_Help_Dialog() {
|
2006-11-17 02:17:13 +03:00
|
|
|
{ window_ = new Fl_Double_Window(530, 385, "Help Dialog");
|
|
|
|
window_->user_data((void*)(this));
|
2007-01-28 22:36:51 +03:00
|
|
|
{ Fl_Group* o = new Fl_Group(10, 10, 511, 25);
|
|
|
|
{ back_ = new Fl_Button(10, 10, 25, 25, "@<-");
|
2006-11-17 02:17:13 +03:00
|
|
|
back_->tooltip("Show the previous help page.");
|
|
|
|
back_->shortcut(0xff51);
|
|
|
|
back_->labelcolor((Fl_Color)2);
|
|
|
|
back_->callback((Fl_Callback*)cb_back_);
|
|
|
|
} // Fl_Button* back_
|
2007-01-28 22:36:51 +03:00
|
|
|
{ forward_ = new Fl_Button(45, 10, 25, 25, "@->");
|
2006-11-17 02:17:13 +03:00
|
|
|
forward_->tooltip("Show the next help page.");
|
|
|
|
forward_->shortcut(0xff53);
|
|
|
|
forward_->labelcolor((Fl_Color)2);
|
|
|
|
forward_->callback((Fl_Callback*)cb_forward_);
|
|
|
|
} // Fl_Button* forward_
|
2007-01-28 22:36:51 +03:00
|
|
|
{ smaller_ = new Fl_Button(80, 10, 25, 25, "F");
|
2006-11-17 02:17:13 +03:00
|
|
|
smaller_->tooltip("Make the help text smaller.");
|
|
|
|
smaller_->labelfont(1);
|
|
|
|
smaller_->labelsize(10);
|
|
|
|
smaller_->callback((Fl_Callback*)cb_smaller_);
|
|
|
|
} // Fl_Button* smaller_
|
2007-01-28 22:36:51 +03:00
|
|
|
{ larger_ = new Fl_Button(115, 10, 25, 25, "F");
|
2006-11-17 02:17:13 +03:00
|
|
|
larger_->tooltip("Make the help text larger.");
|
|
|
|
larger_->labelfont(1);
|
|
|
|
larger_->labelsize(16);
|
|
|
|
larger_->callback((Fl_Callback*)cb_larger_);
|
|
|
|
} // Fl_Button* larger_
|
2007-01-28 22:36:51 +03:00
|
|
|
{ Fl_Group* o = new Fl_Group(350, 10, 171, 25);
|
2005-03-25 18:20:26 +03:00
|
|
|
o->box(FL_DOWN_BOX);
|
|
|
|
o->color(FL_BACKGROUND2_COLOR);
|
2007-01-28 22:36:51 +03:00
|
|
|
{ find_ = new Fl_Input(375, 12, 143, 21, "@search");
|
2006-11-17 02:17:13 +03:00
|
|
|
find_->tooltip("find text in document");
|
|
|
|
find_->box(FL_FLAT_BOX);
|
|
|
|
find_->labelsize(13);
|
2007-01-28 22:36:51 +03:00
|
|
|
find_->textfont(4);
|
2006-11-17 02:17:13 +03:00
|
|
|
find_->callback((Fl_Callback*)cb_find_);
|
|
|
|
find_->when(FL_WHEN_ENTER_KEY_ALWAYS);
|
|
|
|
} // Fl_Input* find_
|
2005-03-25 18:20:26 +03:00
|
|
|
o->end();
|
2006-11-17 02:17:13 +03:00
|
|
|
} // Fl_Group* o
|
2007-01-28 22:36:51 +03:00
|
|
|
{ Fl_Box* o = new Fl_Box(150, 10, 190, 25);
|
|
|
|
Fl_Group::current()->resizable(o);
|
|
|
|
} // Fl_Box* o
|
2004-07-04 10:49:34 +04:00
|
|
|
o->end();
|
2006-11-17 02:17:13 +03:00
|
|
|
} // Fl_Group* o
|
2007-01-28 22:36:51 +03:00
|
|
|
{ view_ = new Fl_Help_View(10, 45, 510, 330);
|
|
|
|
view_->box(FL_DOWN_BOX);
|
|
|
|
view_->callback((Fl_Callback*)cb_view_);
|
|
|
|
Fl_Group::current()->resizable(view_);
|
|
|
|
} // Fl_Help_View* view_
|
2006-11-17 02:17:13 +03:00
|
|
|
window_->size_range(260, 150);
|
|
|
|
window_->end();
|
|
|
|
} // Fl_Double_Window* window_
|
2001-08-02 23:43:49 +04:00
|
|
|
back_->deactivate();
|
2014-10-05 15:28:29 +04:00
|
|
|
forward_->deactivate();
|
|
|
|
|
|
|
|
index_ = -1;
|
|
|
|
max_ = 0;
|
|
|
|
find_pos_ = 0;
|
|
|
|
|
|
|
|
fl_register_images();
|
2001-08-02 23:43:49 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
Fl_Help_Dialog::~Fl_Help_Dialog() {
|
2001-08-02 23:43:49 +04:00
|
|
|
delete window_;
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
int Fl_Help_Dialog::h() {
|
2001-08-02 23:43:49 +04:00
|
|
|
return (window_->h());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::hide() {
|
2001-08-02 23:43:49 +04:00
|
|
|
window_->hide();
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::load(const char *f) {
|
2001-08-02 23:43:49 +04:00
|
|
|
view_->set_changed();
|
2014-10-05 15:28:29 +04:00
|
|
|
view_->load(f);
|
|
|
|
window_->label(view_->title());
|
2001-08-02 23:43:49 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::position(int xx, int yy) {
|
2001-08-02 23:43:49 +04:00
|
|
|
window_->position(xx, yy);
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::resize(int xx, int yy, int ww, int hh) {
|
2001-08-02 23:43:49 +04:00
|
|
|
window_->resize(xx, yy, ww, hh);
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::show() {
|
2001-08-02 23:43:49 +04:00
|
|
|
window_->show();
|
|
|
|
}
|
|
|
|
|
2001-12-23 06:40:51 +03:00
|
|
|
void Fl_Help_Dialog::show(int argc, char **argv) {
|
|
|
|
window_->show(argc, argv);
|
|
|
|
}
|
|
|
|
|
2008-08-16 01:11:21 +04:00
|
|
|
void Fl_Help_Dialog::textsize(Fl_Fontsize s) {
|
2001-08-02 23:43:49 +04:00
|
|
|
view_->textsize(s);
|
2014-10-05 15:28:29 +04:00
|
|
|
|
|
|
|
if (s <= 8)
|
|
|
|
smaller_->deactivate();
|
|
|
|
else
|
|
|
|
smaller_->activate();
|
|
|
|
|
|
|
|
if (s >= 18)
|
|
|
|
larger_->deactivate();
|
|
|
|
else
|
|
|
|
larger_->activate();
|
2001-08-02 23:43:49 +04:00
|
|
|
}
|
|
|
|
|
2008-08-16 01:11:21 +04:00
|
|
|
Fl_Fontsize Fl_Help_Dialog::textsize() {
|
2001-08-02 23:43:49 +04:00
|
|
|
return (view_->textsize());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::topline(const char *n) {
|
2001-08-02 23:43:49 +04:00
|
|
|
view_->topline(n);
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_Help_Dialog::topline(int n) {
|
2001-08-02 23:43:49 +04:00
|
|
|
view_->topline(n);
|
|
|
|
}
|
|
|
|
|
2005-09-25 20:54:40 +04:00
|
|
|
void Fl_Help_Dialog::value(const char *f) {
|
|
|
|
view_->set_changed();
|
2014-10-05 15:28:29 +04:00
|
|
|
view_->value(f);
|
|
|
|
window_->label(view_->title());
|
2005-09-25 20:54:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
const char * Fl_Help_Dialog::value() const {
|
|
|
|
return view_->value();
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
int Fl_Help_Dialog::visible() {
|
2001-08-02 23:43:49 +04:00
|
|
|
return (window_->visible());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
int Fl_Help_Dialog::w() {
|
2001-08-02 23:43:49 +04:00
|
|
|
return (window_->w());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
int Fl_Help_Dialog::x() {
|
2001-08-02 23:43:49 +04:00
|
|
|
return (window_->x());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
int Fl_Help_Dialog::y() {
|
2001-08-02 23:43:49 +04:00
|
|
|
return (window_->y());
|
|
|
|
}
|
2005-03-25 18:20:26 +03:00
|
|
|
|
|
|
|
//
|
|
|
|
// End of "$Id$".
|
|
|
|
//
|