Fix indentation of elements (STR #1549)

Update layout of help dialog to look like other help dialogs.

Drop resource fork stuff from fltk-config (no more --post, it is a no-op)

Use a single table for the header on the documentation page.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5643 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2007-01-28 19:36:51 +00:00
parent 8cd623c118
commit 84fe87f472
7 changed files with 212 additions and 184 deletions

View File

@ -1,5 +1,8 @@
CHANGES IN FLTK 1.1.8
- Fixed indentation of nested HTML elements (STR #1549)
- Made layout of Fl_Help_Dialog consistent with other
help windows and web browsers.
- Improved GTK+ schemed round box (STR #1531)
- Fluid avoids writing unsupported combinations of the
"when()" flags (STR #1501)

View File

@ -31,10 +31,11 @@
#define Fl_Help_Dialog_H
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Help_View.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Help_View.H>
class FL_EXPORT Fl_Help_Dialog {
int index_;
@ -46,11 +47,6 @@ public:
Fl_Help_Dialog();
private:
Fl_Double_Window *window_;
Fl_Help_View *view_;
void cb_view__i(Fl_Help_View*, void*);
static void cb_view_(Fl_Help_View*, void*);
void cb_Close_i(Fl_Button*, void*);
static void cb_Close(Fl_Button*, void*);
Fl_Button *back_;
void cb_back__i(Fl_Button*, void*);
static void cb_back_(Fl_Button*, void*);
@ -66,6 +62,9 @@ private:
Fl_Input *find_;
void cb_find__i(Fl_Input*, void*);
static void cb_find_(Fl_Input*, void*);
Fl_Help_View *view_;
void cb_view__i(Fl_Help_View*, void*);
static void cb_view_(Fl_Help_View*, void*);
public:
~Fl_Help_Dialog();
int h();

View File

@ -15,22 +15,12 @@
Copyright 1998-2007 by Bill Spitzak and others.</P>
</TD>
</TR>
</TABLE>
<TABLE BGCOLOR="#9f9f9f" CELLPADDING="8" CELLSPACING="0" SUMMARY="TITLE BAR" WIDTH="700">
<TR>
<TD ALIGN="CENTER">
<B>This software and manual are
provided under the terms of the GNU Library General
Public License.
Permission is granted to reproduce this manual or any portion
for any purpose, provided this copyright and permission notice
are preserved.</B>
</TD>
<TH COLSPAN=2>This software and manual are provided under the terms of the GNU Library General Public License. Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.</TH>
</TR>
</TABLE>
<TABLE COLS="2" BGCOLOR="#9f9fef" CELLPADDING="8" CELLSPACING="0" SUMMARY="Table of Contents" WIDTH="700">
<TABLE BGCOLOR="#9f9fef" CELLPADDING="8" CELLSPACING="0" SUMMARY="Table of Contents" WIDTH="700">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP"><B><A HREF="preface.html#preface">Preface</A></B>
<BR>

View File

@ -271,10 +271,10 @@ if test -n "$compile"; then
$CXX $ARCHFLAGS $includes $CXXFLAGS $debug -o $prog $compile $LDSTATIC
fi
if test -n "$post" -a "$POSTBUILD" != ":"; then
echo $POSTBUILD $post $includedir/FL/mac.r
$POSTBUILD $post $includedir/FL/mac.r
fi
#if test -n "$post" -a "$POSTBUILD" != ":"; then
# echo $POSTBUILD $post $includedir/FL/mac.r
# $POSTBUILD $post $includedir/FL/mac.r
#fi
if test "$echo_cflags" = "yes"; then
echo $includes $CFLAGS

View File

@ -31,57 +31,6 @@
#include "flstring.h"
#include <FL/fl_ask.H>
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);
}
void Fl_Help_Dialog::cb_Close_i(Fl_Button*, void*) {
window_->hide();
}
void Fl_Help_Dialog::cb_Close(Fl_Button* o, void* v) {
((Fl_Help_Dialog*)(o->parent()->parent()->user_data()))->cb_Close_i(o,v);
}
void Fl_Help_Dialog::cb_back__i(Fl_Button*, void*) {
if (index_ > 0)
index_ --;
@ -153,59 +102,101 @@ void Fl_Help_Dialog::cb_find_(Fl_Input* o, void* v) {
((Fl_Help_Dialog*)(o->parent()->parent()->parent()->user_data()))->cb_find__i(o,v);
}
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);
}
Fl_Help_Dialog::Fl_Help_Dialog() {
{ window_ = new Fl_Double_Window(530, 385, "Help Dialog");
window_->user_data((void*)(this));
{ view_ = new Fl_Help_View(10, 10, 510, 330);
view_->box(FL_DOWN_BOX);
view_->callback((Fl_Callback*)cb_view_);
Fl_Group::current()->resizable(view_);
} // Fl_Help_View* view_
{ Fl_Group* o = new Fl_Group(10, 348, 510, 27);
{ Fl_Button* o = new Fl_Button(456, 350, 64, 25, "Close");
o->callback((Fl_Callback*)cb_Close);
o->label(fl_close);
} // Fl_Button* o
{ back_ = new Fl_Button(386, 350, 25, 25, "@<-");
{ Fl_Group* o = new Fl_Group(10, 10, 511, 25);
{ back_ = new Fl_Button(10, 10, 25, 25, "@<-");
back_->tooltip("Show the previous help page.");
back_->shortcut(0xff51);
back_->labelcolor((Fl_Color)2);
back_->callback((Fl_Callback*)cb_back_);
} // Fl_Button* back_
{ forward_ = new Fl_Button(421, 350, 25, 25, "@->");
{ forward_ = new Fl_Button(45, 10, 25, 25, "@->");
forward_->tooltip("Show the next help page.");
forward_->shortcut(0xff53);
forward_->labelcolor((Fl_Color)2);
forward_->callback((Fl_Callback*)cb_forward_);
} // Fl_Button* forward_
{ smaller_ = new Fl_Button(316, 350, 25, 25, "F");
{ smaller_ = new Fl_Button(80, 10, 25, 25, "F");
smaller_->tooltip("Make the help text smaller.");
smaller_->labelfont(1);
smaller_->labelsize(10);
smaller_->callback((Fl_Callback*)cb_smaller_);
} // Fl_Button* smaller_
{ larger_ = new Fl_Button(351, 350, 25, 25, "F");
{ larger_ = new Fl_Button(115, 10, 25, 25, "F");
larger_->tooltip("Make the help text larger.");
larger_->labelfont(1);
larger_->labelsize(16);
larger_->callback((Fl_Callback*)cb_larger_);
} // Fl_Button* larger_
{ Fl_Group* o = new Fl_Group(10, 350, 296, 25);
{ Fl_Group* o = new Fl_Group(350, 10, 171, 25);
o->box(FL_DOWN_BOX);
o->color(FL_BACKGROUND2_COLOR);
{ find_ = new Fl_Input(35, 352, 268, 21, "@search");
{ find_ = new Fl_Input(375, 12, 143, 21, "@search");
find_->tooltip("find text in document");
find_->box(FL_FLAT_BOX);
find_->labelsize(13);
find_->textfont(4);
find_->callback((Fl_Callback*)cb_find_);
find_->when(FL_WHEN_ENTER_KEY_ALWAYS);
Fl_Group::current()->resizable(find_);
} // Fl_Input* find_
o->end();
Fl_Group::current()->resizable(o);
} // Fl_Group* o
{ Fl_Box* o = new Fl_Box(150, 10, 190, 25);
Fl_Group::current()->resizable(o);
} // Fl_Box* o
o->end();
} // Fl_Group* o
{ 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_
window_->size_range(260, 150);
window_->end();
} // Fl_Double_Window* window_

View File

@ -1,5 +1,5 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0107
version 1.0108
header_name {../FL/Fl_Help_Dialog.H}
code_name {.cxx}
comment {//
@ -42,11 +42,84 @@ class FL_EXPORT Fl_Help_Dialog {open
decl {int line_[100];} {}
decl {char file_[100][256];} {}
decl {int find_pos_;} {}
Function {Fl_Help_Dialog()} {} {
Function {Fl_Help_Dialog()} {open
} {
Fl_Window window_ {
label {Help Dialog} open
private xywh {398 65 530 385} type Double resizable size_range {260 150 0 0} visible
private xywh {398 64 530 385} type Double resizable size_range {260 150 0 0} visible
} {
Fl_Group {} {open selected
xywh {10 10 511 25}
} {
Fl_Button back_ {
label {@<-}
callback {if (index_ > 0)
index_ --;
if (index_ == 0)
back_->deactivate();
forward_->activate();
int l = line_[index_];
if (strcmp(view_->filename(), file_[index_]) != 0)
view_->load(file_[index_]);
view_->topline(l);}
private tooltip {Show the previous help page.} xywh {10 10 25 25} shortcut 0xff51 labelcolor 2
}
Fl_Button forward_ {
label {@->}
callback {if (index_ < max_)
index_ ++;
if (index_ >= max_)
forward_->deactivate();
back_->activate();
int l = view_->topline();
if (strcmp(view_->filename(), file_[index_]) != 0)
view_->load(file_[index_]);
view_->topline(l);}
private tooltip {Show the next help page.} xywh {45 10 25 25} shortcut 0xff53 labelcolor 2
}
Fl_Button smaller_ {
label F
callback {if (view_->textsize() > 8)
view_->textsize(view_->textsize() - 2);
if (view_->textsize() <= 8)
smaller_->deactivate();
larger_->activate();}
private tooltip {Make the help text smaller.} xywh {80 10 25 25} labelfont 1 labelsize 10
}
Fl_Button larger_ {
label F
callback {if (view_->textsize() < 18)
view_->textsize(view_->textsize() + 2);
if (view_->textsize() >= 18)
larger_->deactivate();
smaller_->activate();}
private tooltip {Make the help text larger.} xywh {115 10 25 25} labelfont 1 labelsize 16
}
Fl_Group {} {open
xywh {350 10 171 25} box DOWN_BOX color 7
} {
Fl_Input find_ {
label {@search}
callback {find_pos_ = view_->find(find_->value(), find_pos_);}
private tooltip {find text in document} xywh {375 12 143 21} box FLAT_BOX labelsize 13 when 10 textfont 4
}
}
Fl_Box {} {
xywh {150 10 190 25} resizable
}
}
Fl_Help_View view_ {
callback {if (view_->filename())
{
@ -85,83 +158,8 @@ class FL_EXPORT Fl_Help_Dialog {open
line_[index_] = view_->topline();
back_->deactivate();
forward_->deactivate();
}} open
private xywh {10 10 510 330} box DOWN_BOX selection_color 15 resizable
} {}
Fl_Group {} {open
xywh {10 348 510 27}
} {
Fl_Button {} {
label Close
callback {window_->hide();}
private xywh {456 350 64 25}
code0 {o->label(fl_close);}
}
Fl_Button back_ {
label {@<-}
callback {if (index_ > 0)
index_ --;
if (index_ == 0)
back_->deactivate();
forward_->activate();
int l = line_[index_];
if (strcmp(view_->filename(), file_[index_]) != 0)
view_->load(file_[index_]);
view_->topline(l);}
private tooltip {Show the previous help page.} xywh {386 350 25 25} shortcut 0xff51 labelcolor 2
}
Fl_Button forward_ {
label {@->}
callback {if (index_ < max_)
index_ ++;
if (index_ >= max_)
forward_->deactivate();
back_->activate();
int l = view_->topline();
if (strcmp(view_->filename(), file_[index_]) != 0)
view_->load(file_[index_]);
view_->topline(l);}
private tooltip {Show the next help page.} xywh {421 350 25 25} shortcut 0xff53 labelcolor 2
}
Fl_Button smaller_ {
label F
callback {if (view_->textsize() > 8)
view_->textsize(view_->textsize() - 2);
if (view_->textsize() <= 8)
smaller_->deactivate();
larger_->activate();}
private tooltip {Make the help text smaller.} xywh {316 350 25 25} labelfont 1 labelsize 10
}
Fl_Button larger_ {
label F
callback {if (view_->textsize() < 18)
view_->textsize(view_->textsize() + 2);
if (view_->textsize() >= 18)
larger_->deactivate();
smaller_->activate();}
private tooltip {Make the help text larger.} xywh {351 350 25 25} labelfont 1 labelsize 16
}
Fl_Group {} {open
xywh {10 350 296 25} box DOWN_BOX color 7 resizable
} {
Fl_Input find_ {
label {@search}
callback {find_pos_ = view_->find(find_->value(), find_pos_);} selected
private tooltip {find text in document} xywh {35 352 268 21} box FLAT_BOX labelsize 13 when 10 resizable
}
}
}}
private xywh {10 45 510 330} box DOWN_BOX resizable
}
}
code {back_->deactivate();

View File

@ -3,7 +3,7 @@
//
// Fl_Help_View widget routines.
//
// Copyright 1997-2006 by Easy Software Products.
// Copyright 1997-2007 by Easy Software Products.
// Image support donated by Matthias Melcher, Copyright 2000.
//
// This library is free software; you can redistribute it and/or
@ -137,6 +137,52 @@ static const char *broken_xpm[] =
static Fl_Pixmap broken_image(broken_xpm);
//
// Simple margin stack for Fl_Help_View::format()...
//
struct fl_margins {
int depth_;
int margins_[100];
fl_margins() { clear(); }
int clear() {
// puts("fl_margins::clear()");
depth_ = 0;
return margins_[0] = 4;
}
int current() { return margins_[depth_]; }
int pop() {
// printf("fl_margins::pop(): depth_=%d, xx=%d\n", depth_,
// depth_ > 0 ? margins_[depth_ - 1] : 4);
if (depth_ > 0) {
depth_ --;
return margins_[depth_];
} else return 4;
}
int push(int indent) {
int xx;
xx = margins_[depth_] + indent;
// printf("fl_margins::push(indent=%d): depth_=%d, xx=%d\n", indent,
// depth_ + 1, xx);
if (depth_ < 99) {
depth_ ++;
margins_[depth_] = xx;
}
return xx;
}
};
//
// All the stuff needed to implement text selection in Fl_Help_View
//
@ -454,10 +500,9 @@ Fl_Help_View::draw()
if (!value_)
return;
if (current_view==this && selected) {
hv_selection_color = FL_SELECTION_COLOR;
if (current_view == this && selected) {
hv_selection_color = FL_SELECTION_COLOR;
hv_selection_text_color = fl_contrast(textcolor_, FL_SELECTION_COLOR);
}
// Clip the drawing to the inside of the box...
@ -1048,6 +1093,7 @@ Fl_Help_View::format()
Fl_Color tc, rc; // Table/row background color
Fl_Boxtype b = box() ? box() : FL_DOWN_BOX;
// Box to draw...
fl_margins margins; // Left margin stack...
// Reset document width...
@ -1078,7 +1124,7 @@ Fl_Help_View::format()
line = 0;
links = 0;
xx = 4;
xx = margins.clear();
yy = fsize + 2;
ww = 0;
column = 0;
@ -1291,7 +1337,7 @@ Fl_Help_View::format()
strcasecmp(buf, "DL") == 0)
{
block->h += fsize + 2;
xx += 4 * fsize;
xx = margins.push(4 * fsize);
}
else if (strcasecmp(buf, "TABLE") == 0)
{
@ -1407,16 +1453,13 @@ Fl_Help_View::format()
strcasecmp(buf, "/OL") == 0 ||
strcasecmp(buf, "/DL") == 0)
{
xx -= 4 * fsize;
xx = margins.pop();
block->h += fsize + 2;
}
else if (strcasecmp(buf, "/TABLE") == 0)
{
block->h += fsize + 2;
// the current block is *not* the table block, so the current xx is
// meaningless. Set it back to page x, so the next block will be aligned
// reasonably. This fails fro table-in-table html!
xx = 4;
xx = margins.current();
}
else if (strcasecmp(buf, "/PRE") == 0)
{
@ -1494,7 +1537,6 @@ Fl_Help_View::format()
talign = LEFT;
xx = blocks_[row].x;
yy = blocks_[row].y + blocks_[row].h;
for (cell = blocks_ + row + 1; cell <= block; cell ++)
@ -1512,7 +1554,7 @@ Fl_Help_View::format()
cell->h = block->h;
}
yy = block->y + block->h - 4;
yy = block->y + block->h /*- 4*/;
block = add_block(start, xx, yy, hsize_, 0);
needspace = 0;
row = 0;
@ -1539,6 +1581,8 @@ Fl_Help_View::format()
for (i = 0; i < column; i ++)
xx += columns[i] + 6;
margins.push(xx - margins.current());
if (get_attr(attrs, "COLSPAN", attr, sizeof(attr)) != NULL)
colspan = atoi(attr);
else
@ -1573,7 +1617,9 @@ Fl_Help_View::format()
else if ((strcasecmp(buf, "/TD") == 0 ||
strcasecmp(buf, "/TH") == 0) && row)
{
line = do_align(block, line, xx, newalign, links);
popfont(font, fsize);
xx = margins.pop();
talign = LEFT;
}
else if (strcasecmp(buf, "FONT") == 0)
@ -1762,6 +1808,7 @@ Fl_Help_View::format()
size_ = yy + hh;
}
// printf("margins.depth_=%d\n", margins.depth_);
if (ntargets_ > 1)
qsort(targets_, ntargets_, sizeof(Fl_Help_Target),