From 84fe87f47201cf0c66d459d0d09ea8d38234101a Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 28 Jan 2007 19:36:51 +0000 Subject: 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 --- CHANGES | 3 ++ FL/Fl_Help_Dialog.H | 11 ++-- documentation/index.html | 14 +---- fltk-config.in | 8 +-- src/Fl_Help_Dialog.cxx | 129 ++++++++++++++++++++++------------------------- src/Fl_Help_Dialog.fl | 116 +++++++++++++++++++++--------------------- src/Fl_Help_View.cxx | 73 ++++++++++++++++++++++----- 7 files changed, 191 insertions(+), 163 deletions(-) diff --git a/CHANGES b/CHANGES index 6ba61db2a..b2a2ce49d 100644 --- a/CHANGES +++ b/CHANGES @@ -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) diff --git a/FL/Fl_Help_Dialog.H b/FL/Fl_Help_Dialog.H index b22eaefd4..7bd84d58e 100644 --- a/FL/Fl_Help_Dialog.H +++ b/FL/Fl_Help_Dialog.H @@ -31,10 +31,11 @@ #define Fl_Help_Dialog_H #include #include -#include #include #include #include +#include +#include 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(); diff --git a/documentation/index.html b/documentation/index.html index f12c70710..1b53a03ca 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -15,22 +15,12 @@ Copyright 1998-2007 by Bill Spitzak and others.

- - - - +
- 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. - 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.
- +
Preface
diff --git a/fltk-config.in b/fltk-config.in index 6ff22a9a7..ab70c6788 100755 --- a/fltk-config.in +++ b/fltk-config.in @@ -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 diff --git a/src/Fl_Help_Dialog.cxx b/src/Fl_Help_Dialog.cxx index 9760cd7d7..c55b5fbc6 100644 --- a/src/Fl_Help_Dialog.cxx +++ b/src/Fl_Help_Dialog.cxx @@ -31,57 +31,6 @@ #include "flstring.h" #include -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_ diff --git a/src/Fl_Help_Dialog.fl b/src/Fl_Help_Dialog.fl index 8d013ddba..ddb78af6e 100644 --- a/src/Fl_Help_Dialog.fl +++ b/src/Fl_Help_Dialog.fl @@ -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,61 +42,15 @@ 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_Help_View view_ { - callback {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(); -}} open - private xywh {10 10 510 330} box DOWN_BOX selection_color 15 resizable - } {} - Fl_Group {} {open - xywh {10 348 510 27} + Fl_Group {} {open selected + xywh {10 10 511 25} } { - 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) @@ -113,7 +67,7 @@ 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 + private tooltip {Show the previous help page.} xywh {10 10 25 25} shortcut 0xff51 labelcolor 2 } Fl_Button forward_ { label {@->} @@ -131,7 +85,7 @@ 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 + private tooltip {Show the next help page.} xywh {45 10 25 25} shortcut 0xff53 labelcolor 2 } Fl_Button smaller_ { label F @@ -141,7 +95,7 @@ view_->topline(l);} if (view_->textsize() <= 8) smaller_->deactivate(); larger_->activate();} - private tooltip {Make the help text smaller.} xywh {316 350 25 25} labelfont 1 labelsize 10 + private tooltip {Make the help text smaller.} xywh {80 10 25 25} labelfont 1 labelsize 10 } Fl_Button larger_ { label F @@ -151,17 +105,61 @@ larger_->activate();} if (view_->textsize() >= 18) larger_->deactivate(); smaller_->activate();} - private tooltip {Make the help text larger.} xywh {351 350 25 25} labelfont 1 labelsize 16 + private tooltip {Make the help text larger.} xywh {115 10 25 25} labelfont 1 labelsize 16 } Fl_Group {} {open - xywh {10 350 296 25} box DOWN_BOX color 7 resizable + xywh {350 10 171 25} box DOWN_BOX color 7 } { 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 + 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()) +{ + 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(); +}} + private xywh {10 45 510 330} box DOWN_BOX resizable } } code {back_->deactivate(); diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx index 75fffa6e6..f0b08ef39 100644 --- a/src/Fl_Help_View.cxx +++ b/src/Fl_Help_View.cxx @@ -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), -- cgit v1.2.3