Author: matt
Date: 2012-05-08 14:26:41 -0700 (Tue, 08 May 2012)
New Revision: 9467
Log:
A bunch of coordinate fixes.
Modified:
branches/branch-3.0/include/fltk/HelpDialog.h
branches/branch-3.0/include/fltk3/InputChoice.h
branches/branch-3.0/src/fltk3/Dial.cxx
branches/branch-3.0/src/fltk3/TextDisplay.cxx
branches/branch-3.0/src/fltk3images/HelpDialog.cxx
branches/branch-3.0/test/browser.cxx
branches/branch-3.0/test/curve.cxx
branches/branch-3.0/test/editor.cxx
branches/branch-3.0/test/fonts.cxx
branches/branch-3.0/test/fractals.cxx
branches/branch-3.0/test/help.cxx
Modified: branches/branch-3.0/include/fltk/HelpDialog.h
===================================================================
--- branches/branch-3.0/include/fltk/HelpDialog.h 2012-05-08 16:48:38 UTC
(rev 9466)
+++ branches/branch-3.0/include/fltk/HelpDialog.h 2012-05-08 21:26:41 UTC
(rev 9467)
@@ -11,57 +11,57 @@
#include <fltk/Input.h>
namespace fltk {
-
-class FL_IMAGES_API HelpDialog {
- int index_;
- int max_;
- int line_[100];
- char file_[100][256];
- int find_pos_;
-public:
- HelpDialog();
-private:
- fltk::DoubleBufferWindow *window_;
+
+ class FL_IMAGES_API HelpDialog {
+ int index_;
+ int max_;
+ int line_[100];
+ char file_[100][256];
+ int find_pos_;
+ public:
+ HelpDialog();
+ private:
+ fltk::DoubleBufferWindow *window_;
fltk::HelpView *view_;
inline void cb_view__i(fltk::HelpView*, void*);
static void cb_view_(fltk::HelpView*, void*);
- inline void cb_Close_i(fltk::Button*, void*);
- static void cb_Close(fltk::Button*, void*);
- fltk::Button *back_;
- inline void cb_back__i(fltk::Button*, void*);
- static void cb_back_(fltk::Button*, void*);
- fltk::Button *forward_;
- inline void cb_forward__i(fltk::Button*, void*);
- static void cb_forward_(fltk::Button*, void*);
- fltk::Button *smaller_;
- inline void cb_smaller__i(fltk::Button*, void*);
- static void cb_smaller_(fltk::Button*, void*);
- fltk::Button *larger_;
- inline void cb_larger__i(fltk::Button*, void*);
- static void cb_larger_(fltk::Button*, void*);
- fltk::Input *find_;
- inline void cb_find__i(fltk::Input*, void*);
- static void cb_find_(fltk::Input*, void*);
-public:
- ~HelpDialog();
- int h();
- void hide();
- void load(const char *f);
- void position(int xx, int yy);
- void resize(int xx, int yy, int ww, int hh);
- void show();
- void show(int argc, char **argv);
- void textsize(uchar s);
- uchar textsize();
- void topline(const char *n);
- void topline(int n);
- void value(const char *f);
- const char * value() const;
- int visible();
- int w();
- int x();
- int y();
-};
+ inline void cb_Close_i(fltk::Button*, void*);
+ static void cb_Close(fltk::Button*, void*);
+ fltk::Button *back_;
+ inline void cb_back__i(fltk::Button*, void*);
+ static void cb_back_(fltk::Button*, void*);
+ fltk::Button *forward_;
+ inline void cb_forward__i(fltk::Button*, void*);
+ static void cb_forward_(fltk::Button*, void*);
+ fltk::Button *smaller_;
+ inline void cb_smaller__i(fltk::Button*, void*);
+ static void cb_smaller_(fltk::Button*, void*);
+ fltk::Button *larger_;
+ inline void cb_larger__i(fltk::Button*, void*);
+ static void cb_larger_(fltk::Button*, void*);
+ fltk::Input *find_;
+ inline void cb_find__i(fltk::Input*, void*);
+ static void cb_find_(fltk::Input*, void*);
+ public:
+ ~HelpDialog();
+ int h();
+ void hide();
+ void load(const char *f);
+ void position(int xx, int yy);
+ void resize(int xx, int yy, int ww, int hh);
+ void show();
+ void show(int argc, char **argv);
+ void textsize(uchar s);
+ uchar textsize();
+ void topline(const char *n);
+ void topline(int n);
+ void value(const char *f);
+ const char * value() const;
+ int visible();
+ int w();
+ int x();
+ int y();
+ };
}
// Header for //\n// End of "$Id: HelpDialog.fl 4721 2005-12-19...
#endif
Modified: branches/branch-3.0/include/fltk3/InputChoice.h
===================================================================
--- branches/branch-3.0/include/fltk3/InputChoice.h 2012-05-08 16:48:38 UTC
(rev 9466)
+++ branches/branch-3.0/include/fltk3/InputChoice.h 2012-05-08 21:26:41 UTC
(rev 9467)
@@ -65,7 +65,7 @@
void draw() {
draw_box(fltk3::UP_BOX, color());
fltk3::color(active_r() ? labelcolor() :
fltk3::inactive(labelcolor()));
- int xc = x()+w()/2, yc=y()+h()/2;
+ int xc = w()/2, yc=h()/2;
fltk3::polygon(xc-5,yc-3,xc+5,yc-3,xc,yc+3);
if (fltk3::focus() == this) draw_focus();
}
@@ -126,13 +126,13 @@
}
// Custom resize behavior -- input stretches, menu button doesn't
- inline int inp_x() { return(x() + fltk3::box_dx(box())); }
- inline int inp_y() { return(y() + fltk3::box_dy(box())); }
+ inline int inp_x() { return(fltk3::box_dx(box())); }
+ inline int inp_y() { return(fltk3::box_dy(box())); }
inline int inp_w() { return(w() - fltk3::box_dw(box()) - 20); }
inline int inp_h() { return(h() - fltk3::box_dh(box())); }
- inline int menu_x() { return(x() + w() - 20 - fltk3::box_dx(box())); }
- inline int menu_y() { return(y() + fltk3::box_dy(box())); }
+ inline int menu_x() { return(w() - 20 - fltk3::box_dx(box())); }
+ inline int menu_y() { return(fltk3::box_dy(box())); }
inline int menu_w() { return(20); }
inline int menu_h() { return(h() - fltk3::box_dh(box())); }
Modified: branches/branch-3.0/src/fltk3/Dial.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Dial.cxx 2012-05-08 16:48:38 UTC (rev
9466)
+++ branches/branch-3.0/src/fltk3/Dial.cxx 2012-05-08 21:26:41 UTC (rev
9467)
@@ -100,7 +100,7 @@
Draws dial at current position and size.
*/
void fltk3::Dial::draw() {
- draw(x(), y(), w(), h());
+ draw(0, 0, w(), h());
draw_label();
}
@@ -147,7 +147,7 @@
Allow subclasses to handle event based on current position and size.
*/
int fltk3::Dial::handle(int e) {
- return handle(e, x(), y(), w(), h());
+ return handle(e, 0, 0, w(), h());
}
/**
Modified: branches/branch-3.0/src/fltk3/TextDisplay.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/TextDisplay.cxx 2012-05-08 16:48:38 UTC
(rev 9466)
+++ branches/branch-3.0/src/fltk3/TextDisplay.cxx 2012-05-08 21:26:41 UTC
(rev 9467)
@@ -296,8 +296,8 @@
#endif // DEBUG
Widget::resize(X,Y,W,H);
if (!buffer()) return;
- X += fltk3::box_dx(box());
- Y += fltk3::box_dy(box());
+ X = fltk3::box_dx(box());
+ Y = fltk3::box_dy(box());
W -= fltk3::box_dw(box());
H -= fltk3::box_dh(box());
@@ -3370,7 +3370,7 @@
// don't even try if there is no associated text buffer!
if (!buffer()) { draw_box(); return; }
- fltk3::push_clip(x(),y(),w(),h()); // prevent drawing outside widget area
+ fltk3::push_clip(0,0,w(),h()); // prevent drawing outside widget area
// draw the non-text, non-scrollbar areas.
if (damage() & fltk3::DAMAGE_ALL) {
@@ -3381,7 +3381,7 @@
}
// draw the box()
int W = w(), H = h();
- draw_box(box(), x(), y(), W, H, color());
+ draw_box(box(), 0, 0, W, H, color());
if (mHScrollBar->visible())
W -= scrollbar_width();
Modified: branches/branch-3.0/src/fltk3images/HelpDialog.cxx
===================================================================
--- branches/branch-3.0/src/fltk3images/HelpDialog.cxx 2012-05-08 16:48:38 UTC
(rev 9466)
+++ branches/branch-3.0/src/fltk3images/HelpDialog.cxx 2012-05-08 21:26:41 UTC
(rev 9467)
@@ -33,19 +33,19 @@
void fltk3::HelpDialog::cb_back__i(fltk3::Button*, void*) {
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);
+ 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);
}
void fltk3::HelpDialog::cb_back_(fltk3::Button* o, void* v) {
((fltk3::HelpDialog*)(o->parent()->parent()->user_data()))->cb_back__i(o,v);
@@ -53,19 +53,19 @@
void fltk3::HelpDialog::cb_forward__i(fltk3::Button*, void*) {
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);
+ 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);
}
void fltk3::HelpDialog::cb_forward_(fltk3::Button* o, void* v) {
((fltk3::HelpDialog*)(o->parent()->parent()->user_data()))->cb_forward__i(o,v);
@@ -73,11 +73,11 @@
void fltk3::HelpDialog::cb_smaller__i(fltk3::Button*, void*) {
if (view_->textsize() > 8)
- view_->textsize(view_->textsize() - 2);
-
-if (view_->textsize() <= 8)
- smaller_->deactivate();
-larger_->activate();
+ view_->textsize(view_->textsize() - 2);
+
+ if (view_->textsize() <= 8)
+ smaller_->deactivate();
+ larger_->activate();
}
void fltk3::HelpDialog::cb_smaller_(fltk3::Button* o, void* v) {
((fltk3::HelpDialog*)(o->parent()->parent()->user_data()))->cb_smaller__i(o,v);
@@ -85,11 +85,11 @@
void fltk3::HelpDialog::cb_larger__i(fltk3::Button*, void*) {
if (view_->textsize() < 18)
- view_->textsize(view_->textsize() + 2);
-
-if (view_->textsize() >= 18)
- larger_->deactivate();
-smaller_->activate();
+ view_->textsize(view_->textsize() + 2);
+
+ if (view_->textsize() >= 18)
+ larger_->deactivate();
+ smaller_->activate();
}
void fltk3::HelpDialog::cb_larger_(fltk3::Button* o, void* v) {
((fltk3::HelpDialog*)(o->parent()->parent()->user_data()))->cb_larger__i(o,v);
@@ -104,43 +104,43 @@
void fltk3::HelpDialog::cb_view__i(fltk3::HelpView*, void*) {
if (view_->filename())
-{
- if (view_->changed())
{
- index_ ++;
-
- if (index_ >= 100)
+ if (view_->changed())
{
- memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
- memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
- index_ -= 10;
+ 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());
}
-
- max_ = index_;
-
- strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
+ 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();
-
- if (index_ > 0)
- back_->activate();
- else
- back_->deactivate();
-
+ 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 fltk3::HelpDialog::cb_view_(fltk3::HelpView* o, void* v) {
((fltk3::HelpDialog*)(o->parent()->user_data()))->cb_view__i(o,v);
@@ -150,34 +150,34 @@
{ window_ = new fltk3::DoubleWindow(530, 385, "Help Dialog");
window_->user_data((void*)(this));
{ fltk3::Group* o = new fltk3::Group(10, 10, 511, 25);
- { back_ = new fltk3::Button(10, 10, 25, 25, "@<-");
+ { back_ = new fltk3::Button(0, 0, 25, 25, "@<-");
back_->tooltip("Show the previous help page.");
back_->shortcut(0xff51);
back_->labelcolor((fltk3::Color)2);
back_->callback((fltk3::Callback*)cb_back_);
} // fltk3::Button* back_
- { forward_ = new fltk3::Button(45, 10, 25, 25, "@->");
+ { forward_ = new fltk3::Button(35, 0, 25, 25, "@->");
forward_->tooltip("Show the next help page.");
forward_->shortcut(0xff53);
forward_->labelcolor((fltk3::Color)2);
forward_->callback((fltk3::Callback*)cb_forward_);
} // fltk3::Button* forward_
- { smaller_ = new fltk3::Button(80, 10, 25, 25, "F");
+ { smaller_ = new fltk3::Button(70, 0, 25, 25, "F");
smaller_->tooltip("Make the help text smaller.");
smaller_->labelfont(1);
smaller_->labelsize(10);
smaller_->callback((fltk3::Callback*)cb_smaller_);
} // fltk3::Button* smaller_
- { larger_ = new fltk3::Button(115, 10, 25, 25, "F");
+ { larger_ = new fltk3::Button(105, 0, 25, 25, "F");
larger_->tooltip("Make the help text larger.");
larger_->labelfont(1);
larger_->labelsize(16);
larger_->callback((fltk3::Callback*)cb_larger_);
} // fltk3::Button* larger_
- { fltk3::Group* o = new fltk3::Group(350, 10, 171, 25);
+ { fltk3::Group* o = new fltk3::Group(340, 0, 171, 25);
o->box(fltk3::DOWN_BOX);
o->color(fltk3::BACKGROUND2_COLOR);
- { find_ = new fltk3::Input(375, 12, 143, 21, "@search");
+ { find_ = new fltk3::Input(25, 2, 143, 21, "@search");
find_->tooltip("find text in document");
find_->box(fltk3::FLAT_BOX);
find_->labelsize(13);
@@ -187,7 +187,7 @@
} // fltk3::Input* find_
o->end();
} // fltk3::Group* o
- { fltk3::Box* o = new fltk3::Box(150, 10, 190, 25);
+ { fltk3::Box* o = new fltk3::Box(140, 0, 190, 25);
fltk3::Group::current()->resizable(o);
} // fltk3::Box* o
o->end();
@@ -201,13 +201,13 @@
window_->end();
} // fltk3::DoubleWindow* window_
back_->deactivate();
-forward_->deactivate();
-
-index_ = -1;
-max_ = 0;
-find_pos_ = 0;
-
-fltk3::register_images();
+ forward_->deactivate();
+
+ index_ = -1;
+ max_ = 0;
+ find_pos_ = 0;
+
+ fltk3::register_images();
}
fltk3::HelpDialog::~HelpDialog() {
@@ -224,8 +224,8 @@
void fltk3::HelpDialog::load(const char *f) {
view_->set_changed();
-view_->load(f);
-window_->label(view_->title());
+ view_->load(f);
+ window_->label(view_->title());
}
void fltk3::HelpDialog::position(int xx, int yy) {
@@ -246,16 +246,16 @@
void fltk3::HelpDialog::textsize(fltk3::Fontsize s) {
view_->textsize(s);
-
-if (s <= 8)
- smaller_->deactivate();
-else
- smaller_->activate();
-
-if (s >= 18)
- larger_->deactivate();
-else
- larger_->activate();
+
+ if (s <= 8)
+ smaller_->deactivate();
+ else
+ smaller_->activate();
+
+ if (s >= 18)
+ larger_->deactivate();
+ else
+ larger_->activate();
}
fltk3::Fontsize fltk3::HelpDialog::textsize() {
@@ -272,8 +272,8 @@
void fltk3::HelpDialog::value(const char *f) {
view_->set_changed();
-view_->value(f);
-window_->label(view_->title());
+ view_->value(f);
+ window_->label(view_->title());
}
const char * fltk3::HelpDialog::value() const {
Modified: branches/branch-3.0/test/browser.cxx
===================================================================
--- branches/branch-3.0/test/browser.cxx 2012-05-08 16:48:38 UTC (rev
9466)
+++ branches/branch-3.0/test/browser.cxx 2012-05-08 21:26:41 UTC (rev
9467)
@@ -153,7 +153,7 @@
char *slash = strrchr(buf, '/');
if (slash)
strcpy(slash, "/../Resources/browser.cxx");
-#ifndef MATT_IS_LAZY
+#ifdef MATT_IS_LAZY
done = browser->load("/Users/matt/dev/fltk-1.3.0/test/browser.cxx");
#else
done = browser->load(buf);
Modified: branches/branch-3.0/test/curve.cxx
===================================================================
--- branches/branch-3.0/test/curve.cxx 2012-05-08 16:48:38 UTC (rev 9466)
+++ branches/branch-3.0/test/curve.cxx 2012-05-08 21:26:41 UTC (rev 9467)
@@ -40,21 +40,21 @@
class Drawing : public fltk3::Widget {
void draw() {
- fltk3::push_clip(x(),y(),w(),h());
+ fltk3::push_clip(0,0,w(),h());
fltk3::color(fltk3::DARK3);
- fltk3::rectf(x(),y(),w(),h());
+ fltk3::rectf(0,0,w(),h());
fltk3::push_matrix();
if (args[8]) {
- fltk3::translate(x()+w()/2.0, y()+h()/2.0);
+ fltk3::translate(w()/2.0, h()/2.0);
fltk3::rotate(args[8]);
- fltk3::translate(-(x()+w()/2.0), -(y()+h()/2.0));
+ fltk3::translate(-(w()/2.0), -(h()/2.0));
}
- fltk3::translate(x(),y());
+ fltk3::translate(0,0);
if (!points) {
- fltk3::color(fltk3::WHITE);
- fltk3::begin_complex_polygon();
-
fltk3::curve(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
- fltk3::end_complex_polygon();
+ fltk3::color(fltk3::WHITE);
+ fltk3::begin_complex_polygon();
+
fltk3::curve(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
+ fltk3::end_complex_polygon();
}
fltk3::color(fltk3::BLACK);
fltk3::begin_line();
@@ -65,7 +65,7 @@
fltk3::end_line();
fltk3::color(points ? fltk3::WHITE : fltk3::RED);
points ? fltk3::begin_points() : fltk3::begin_line();
-
fltk3::curve(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
+
fltk3::curve(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
points ? fltk3::end_points() : fltk3::end_line();
fltk3::pop_matrix();
fltk3::pop_clip();
@@ -91,7 +91,7 @@
fltk3::DoubleWindow window(300,555);
Drawing drawing(10,10,280,280);
d = &drawing;
-
+
int y = 300;
for (int n = 0; n<9; n++) {
fltk3::Slider* s = new fltk3::HorValueSlider(50,y,240,25,name[n]); y += 25;
@@ -104,7 +104,7 @@
}
fltk3::ToggleButton but(50,y,50,25,"points");
but.callback(points_cb);
-
+
window.end();
window.show(argc,argv);
return fltk3::run();
Modified: branches/branch-3.0/test/editor.cxx
===================================================================
--- branches/branch-3.0/test/editor.cxx 2012-05-08 16:48:38 UTC (rev 9466)
+++ branches/branch-3.0/test/editor.cxx 2012-05-08 21:26:41 UTC (rev 9467)
@@ -64,89 +64,89 @@
#define TS 14 // default editor textsize
fltk3::TextBuffer *stylebuf = 0;
fltk3::TextDisplay::StyleTableEntry
- styletable[] = { // Style table
- { fltk3::BLACK, fltk3::COURIER, TS }, // A
- Plain
- { fltk3::DARK_GREEN, fltk3::HELVETICA_ITALIC, TS }, // B
- Line comments
- { fltk3::DARK_GREEN, fltk3::HELVETICA_ITALIC, TS }, // C
- Block comments
- { fltk3::BLUE, fltk3::COURIER, TS }, // D
- Strings
- { fltk3::DARK_RED, fltk3::COURIER, TS }, // E
- Directives
- { fltk3::DARK_RED, fltk3::COURIER_BOLD, TS }, // F
- Types
- { fltk3::BLUE, fltk3::COURIER_BOLD, TS }, // G
- Keywords
- };
+styletable[] = { // Style table
+ { fltk3::BLACK, fltk3::COURIER, TS }, // A - Plain
+ { fltk3::DARK_GREEN, fltk3::HELVETICA_ITALIC, TS }, // B - Line comments
+ { fltk3::DARK_GREEN, fltk3::HELVETICA_ITALIC, TS }, // C - Block comments
+ { fltk3::BLUE, fltk3::COURIER, TS }, // D - Strings
+ { fltk3::DARK_RED, fltk3::COURIER, TS }, // E - Directives
+ { fltk3::DARK_RED, fltk3::COURIER_BOLD, TS }, // F - Types
+ { fltk3::BLUE, fltk3::COURIER_BOLD, TS }, // G - Keywords
+};
const char *code_keywords[] = { // List of known C/C++
keywords...
- "and",
- "and_eq",
- "asm",
- "bitand",
- "bitor",
- "break",
- "case",
- "catch",
- "compl",
- "continue",
- "default",
- "delete",
- "do",
- "else",
- "false",
- "for",
- "goto",
- "if",
- "new",
- "not",
- "not_eq",
- "operator",
- "or",
- "or_eq",
- "return",
- "switch",
- "template",
- "this",
- "throw",
- "true",
- "try",
- "while",
- "xor",
- "xor_eq"
- };
+ "and",
+ "and_eq",
+ "asm",
+ "bitand",
+ "bitor",
+ "break",
+ "case",
+ "catch",
+ "compl",
+ "continue",
+ "default",
+ "delete",
+ "do",
+ "else",
+ "false",
+ "for",
+ "goto",
+ "if",
+ "new",
+ "not",
+ "not_eq",
+ "operator",
+ "or",
+ "or_eq",
+ "return",
+ "switch",
+ "template",
+ "this",
+ "throw",
+ "true",
+ "try",
+ "while",
+ "xor",
+ "xor_eq"
+};
const char *code_types[] = { // List of known C/C++ types...
- "auto",
- "bool",
- "char",
- "class",
- "const",
- "const_cast",
- "double",
- "dynamic_cast",
- "enum",
- "explicit",
- "extern",
- "float",
- "friend",
- "inline",
- "int",
- "long",
- "mutable",
- "namespace",
- "private",
- "protected",
- "public",
- "register",
- "short",
- "signed",
- "sizeof",
- "static",
- "static_cast",
- "struct",
- "template",
- "typedef",
- "typename",
- "union",
- "unsigned",
- "virtual",
- "void",
- "volatile"
- };
+ "auto",
+ "bool",
+ "char",
+ "class",
+ "const",
+ "const_cast",
+ "double",
+ "dynamic_cast",
+ "enum",
+ "explicit",
+ "extern",
+ "float",
+ "friend",
+ "inline",
+ "int",
+ "long",
+ "mutable",
+ "namespace",
+ "private",
+ "protected",
+ "public",
+ "register",
+ "short",
+ "signed",
+ "sizeof",
+ "static",
+ "static_cast",
+ "struct",
+ "template",
+ "typedef",
+ "typename",
+ "union",
+ "unsigned",
+ "virtual",
+ "void",
+ "volatile"
+};
//
@@ -173,9 +173,9 @@
int col;
int last;
char buf[255],
- *bufptr;
+ *bufptr;
const char *temp;
-
+
// Style letters:
//
// A - Plain
@@ -185,7 +185,7 @@
// E - Directives
// F - Types
// G - Keywords
-
+
for (current = *style, col = 0, last = 0; length > 0; length --, text ++) {
if (current == 'B' || current == 'F' || current == 'G') current = 'A';
if (current == 'A') {
@@ -196,7 +196,7 @@
} else if (strncmp(text, "//", 2) == 0) {
current = 'B';
for (; length > 0 && *text != '\n'; length --, text ++) *style++ = 'B';
-
+
if (length == 0) break;
} else if (strncmp(text, "/*", 2) == 0) {
current = 'C';
@@ -215,12 +215,12 @@
for (temp = text, bufptr = buf;
(islower((*temp)&255) || *temp == '_') && bufptr < (buf +
sizeof(buf) - 1);
*bufptr++ = *temp++);
-
+
if (!islower((*temp)&255) && *temp != '_') {
*bufptr = '\0';
-
+
bufptr = buf;
-
+
if (bsearch(&bufptr, code_types,
sizeof(code_types) / sizeof(code_types[0]),
sizeof(code_types[0]), compare_keywords)) {
@@ -230,7 +230,7 @@
length --;
col ++;
}
-
+
text --;
length ++;
last = 1;
@@ -244,7 +244,7 @@
length --;
col ++;
}
-
+
text --;
length ++;
last = 1;
@@ -279,14 +279,14 @@
continue;
}
}
-
+
// Copy style info...
if (current == 'A' && (*text == '{' || *text == '}')) *style++ = 'G';
else *style++ = current;
col ++;
-
+
last = isalnum((*text)&255) || *text == '_' || *text == '.';
-
+
if (*text == '\n') {
// Reset column and possibly reset the style
col = 0;
@@ -304,14 +304,14 @@
style_init(void) {
char *style = new char[textbuf->length() + 1];
char *text = textbuf->text();
-
+
memset(style, 'A', textbuf->length());
style[textbuf->length()] = '\0';
-
+
if (!stylebuf) stylebuf = new fltk3::TextBuffer(textbuf->length());
-
+
style_parse(text, style, textbuf->length());
-
+
stylebuf->text(style);
delete[] style;
free(text);
@@ -339,43 +339,43 @@
const char * /*deletedText*/,// I - Text that was deleted
void *cbArg) { // I - Callback data
int start, // Start of text
- end; // End of text
+ end; // End of text
char last, // Last style on line
- *style, // Style data
- *text; // Text data
-
-
+ *style, // Style data
+ *text; // Text data
+
+
// If this is just a selection change, just unselect the style buffer...
if (nInserted == 0 && nDeleted == 0) {
stylebuf->unselect();
return;
}
-
+
// Track changes in the text buffer...
if (nInserted > 0) {
// Insert characters into the style buffer...
style = new char[nInserted + 1];
memset(style, 'A', nInserted);
style[nInserted] = '\0';
-
+
stylebuf->replace(pos, pos + nDeleted, style);
delete[] style;
} else {
// Just delete characters in the style buffer...
stylebuf->remove(pos, pos + nDeleted);
}
-
+
// Select the area that was just updated to avoid unnecessary
// callbacks...
stylebuf->select(pos, pos + nInserted - nDeleted);
-
+
// Re-parse the changed region; we do this by parsing from the
// beginning of the previous line of the changed region to the end of
// the line of the changed region... Then we check the last
// style character and keep updating if we have a multi-line
// comment character...
start = textbuf->line_start(pos);
-// if (start > 0) start = textbuf->line_start(start - 1);
+ // if (start > 0) start = textbuf->line_start(start - 1);
end = textbuf->line_end(pos + nInserted);
text = textbuf->text_range(start, end);
style = stylebuf->text_range(start, end);
@@ -383,36 +383,36 @@
last = 0;
else
last = style[end - start - 1];
-
-// printf("start = %d, end = %d, text = \"%s\", style = \"%s\",
last='%c'...\n",
-// start, end, text, style, last);
-
+
+ // printf("start = %d, end = %d, text = \"%s\", style = \"%s\",
last='%c'...\n",
+ // start, end, text, style, last);
+
style_parse(text, style, end - start);
-
-// printf("new style = \"%s\", new last='%c'...\n",
-// style, style[end - start - 1]);
-
+
+ // printf("new style = \"%s\", new last='%c'...\n",
+ // style, style[end - start - 1]);
+
stylebuf->replace(start, end, style);
((fltk3::TextEditor *)cbArg)->redisplay_range(start, end);
-
+
if (start==end || last != style[end - start - 1]) {
-// printf("Recalculate the rest of the buffer style\n");
+ // printf("Recalculate the rest of the buffer style\n");
// Either the user deleted some text, or the last character
// on the line changed styles, so reparse the
// remainder of the buffer...
free(text);
free(style);
-
+
end = textbuf->length();
text = textbuf->text_range(start, end);
style = stylebuf->text_range(start, end);
-
+
style_parse(text, style, end - start);
-
+
stylebuf->replace(start, end, style);
((fltk3::TextEditor *)cbArg)->redisplay_range(start, end);
}
-
+
free(text);
free(style);
}
@@ -427,37 +427,37 @@
void replcan_cb(fltk3::Widget*, void*);
class EditorWindow : public fltk3::DoubleWindow {
- public:
- EditorWindow(int w, int h, const char* t);
- ~EditorWindow();
-
- fltk3::Window *replace_dlg;
- fltk3::Input *replace_find;
- fltk3::Input *replace_with;
- fltk3::Button *replace_all;
- fltk3::ReturnButton *replace_next;
- fltk3::Button *replace_cancel;
-
- fltk3::TextEditor *editor;
- char search[256];
+public:
+ EditorWindow(int w, int h, const char* t);
+ ~EditorWindow();
+
+ fltk3::Window *replace_dlg;
+ fltk3::Input *replace_find;
+ fltk3::Input *replace_with;
+ fltk3::Button *replace_all;
+ fltk3::ReturnButton *replace_next;
+ fltk3::Button *replace_cancel;
+
+ fltk3::TextEditor *editor;
+ char search[256];
};
EditorWindow::EditorWindow(int w, int h, const char* t) :
fltk3::DoubleWindow(w, h, t) {
replace_dlg = new fltk3::Window(300, 105, "Replace");
- replace_find = new fltk3::Input(80, 10, 210, 25, "Find:");
- replace_find->align(fltk3::ALIGN_LEFT);
-
- replace_with = new fltk3::Input(80, 40, 210, 25, "Replace:");
- replace_with->align(fltk3::ALIGN_LEFT);
-
- replace_all = new fltk3::Button(10, 70, 90, 25, "Replace All");
- replace_all->callback((fltk3::Callback *)replall_cb, this);
-
- replace_next = new fltk3::ReturnButton(105, 70, 120, 25, "Replace Next");
- replace_next->callback((fltk3::Callback *)replace2_cb, this);
-
- replace_cancel = new fltk3::Button(230, 70, 60, 25, "Cancel");
- replace_cancel->callback((fltk3::Callback *)replcan_cb, this);
+ replace_find = new fltk3::Input(80, 10, 210, 25, "Find:");
+ replace_find->align(fltk3::ALIGN_LEFT);
+
+ replace_with = new fltk3::Input(80, 40, 210, 25, "Replace:");
+ replace_with->align(fltk3::ALIGN_LEFT);
+
+ replace_all = new fltk3::Button(10, 70, 90, 25, "Replace All");
+ replace_all->callback((fltk3::Callback *)replall_cb, this);
+
+ replace_next = new fltk3::ReturnButton(105, 70, 120, 25, "Replace Next");
+ replace_next->callback((fltk3::Callback *)replace2_cb, this);
+
+ replace_cancel = new fltk3::Button(230, 70, 60, 25, "Cancel");
+ replace_cancel->callback((fltk3::Callback *)replcan_cb, this);
replace_dlg->end();
replace_dlg->set_non_modal();
editor = 0;
@@ -470,16 +470,16 @@
int check_save(void) {
if (!changed) return 1;
-
+
int r = fltk3::choice("The current file has not been saved.\n"
- "Would you like to save it now?",
- "Cancel", "Save", "Don't Save");
-
+ "Would you like to save it now?",
+ "Cancel", "Save", "Don't Save");
+
if (r == 1) {
save_cb(); // Save the file...
return !changed;
}
-
+
return (r == 2) ? 1 : 0;
}
@@ -527,7 +527,7 @@
void find_cb(fltk3::Widget* w, void* v) {
EditorWindow* e = (EditorWindow*)v;
const char *val;
-
+
val = fltk3::input("Search String:", e->search);
if (val != NULL) {
// User entered a string - go find it!
@@ -543,7 +543,7 @@
find_cb(w, v);
return;
}
-
+
int pos = e->editor->insert_position();
int found = textbuf->search_forward(pos, e->search, &pos);
if (found) {
@@ -566,9 +566,9 @@
if (slash != NULL) strcpy(title, slash + 1);
else strcpy(title, filename);
}
-
+
if (changed) strcat(title, " (modified)");
-
+
w->label(title);
}
@@ -581,7 +581,7 @@
void new_cb(fltk3::Widget*, void*) {
if (!check_save()) return;
-
+
filename[0] = '\0';
textbuf->select(0, textbuf->length());
textbuf->remove_selection();
@@ -596,7 +596,7 @@
fnfc.type(fltk3::NativeFileChooser::BROWSE_FILE);
if ( fnfc.show() ) return;
load_file(fnfc.filename(), -1);
-
+
}
void insert_cb(fltk3::Widget*, void *v) {
@@ -617,18 +617,18 @@
void close_cb(fltk3::Widget*, void* v) {
EditorWindow* w = (EditorWindow*)v;
-
+
if (num_windows == 1) {
if (!check_save())
return;
}
-
+
w->hide();
w->editor->buffer(0);
textbuf->remove_modify_callback(style_update, w->editor);
textbuf->remove_modify_callback(changed_cb, w);
fltk3::delete_widget(w);
-
+
num_windows--;
if (!num_windows) exit(0);
}
@@ -636,7 +636,7 @@
void quit_cb(fltk3::Widget*, void*) {
if (changed && !check_save())
return;
-
+
exit(0);
}
@@ -649,18 +649,18 @@
EditorWindow* e = (EditorWindow*)v;
const char *find = e->replace_find->value();
const char *replace = e->replace_with->value();
-
+
if (find[0] == '\0') {
// Search string is blank; get a new one...
e->replace_dlg->show();
return;
}
-
+
e->replace_dlg->hide();
-
+
int pos = e->editor->insert_position();
int found = textbuf->search_forward(pos, find, &pos);
-
+
if (found) {
// Found a match; update the position and replace text...
textbuf->select(pos, pos+strlen(find));
@@ -677,24 +677,24 @@
EditorWindow* e = (EditorWindow*)v;
const char *find = e->replace_find->value();
const char *replace = e->replace_with->value();
-
+
find = e->replace_find->value();
if (find[0] == '\0') {
// Search string is blank; get a new one...
e->replace_dlg->show();
return;
}
-
+
e->replace_dlg->hide();
-
+
e->editor->insert_position(0);
int times = 0;
-
+
// Loop through the whole string
for (int found = 1; found;) {
int pos = e->editor->insert_position();
found = textbuf->search_forward(pos, find, &pos);
-
+
if (found) {
// Found a match; update the position and replace text...
textbuf->select(pos, pos+strlen(find));
@@ -705,7 +705,7 @@
times++;
}
}
-
+
if (times) fltk3::message("Replaced %d occurrences.", times);
else fltk3::alert("No occurrences of \'%s\' found!", find);
}
@@ -741,56 +741,56 @@
fltk3::MenuItem menuitems[] = {
{ "&File", 0, 0, 0, fltk3::SUBMENU },
- { "&New File", 0, (fltk3::Callback *)new_cb },
- { "&Open File...", fltk3::COMMAND + 'o', (fltk3::Callback *)open_cb },
- { "&Insert File...", fltk3::COMMAND + 'i', (fltk3::Callback *)insert_cb,
0, fltk3::MENU_DIVIDER },
- { "&Save File", fltk3::COMMAND + 's', (fltk3::Callback *)save_cb },
- { "Save File &As...", fltk3::COMMAND + fltk3::SHIFT + 's',
(fltk3::Callback *)saveas_cb, 0, fltk3::MENU_DIVIDER },
- { "New &View", fltk3::ALT
+ { "&New File", 0, (fltk3::Callback *)new_cb },
+ { "&Open File...", fltk3::COMMAND + 'o', (fltk3::Callback *)open_cb },
+ { "&Insert File...", fltk3::COMMAND + 'i', (fltk3::Callback *)insert_cb, 0,
fltk3::MENU_DIVIDER },
+ { "&Save File", fltk3::COMMAND + 's', (fltk3::Callback *)save_cb },
+ { "Save File &As...", fltk3::COMMAND + fltk3::SHIFT + 's', (fltk3::Callback
*)saveas_cb, 0, fltk3::MENU_DIVIDER },
+ { "New &View", fltk3::ALT
#ifdef __APPLE__
- + fltk3::COMMAND
+ + fltk3::COMMAND
#endif
- + 'v', (fltk3::Callback *)view_cb, 0 },
- { "&Close View", fltk3::COMMAND + 'w', (fltk3::Callback *)close_cb,
0, fltk3::MENU_DIVIDER },
- { "E&xit", fltk3::COMMAND + 'q', (fltk3::Callback *)quit_cb, 0
},
- { 0 },
-
+ + 'v', (fltk3::Callback *)view_cb, 0 },
+ { "&Close View", fltk3::COMMAND + 'w', (fltk3::Callback *)close_cb, 0,
fltk3::MENU_DIVIDER },
+ { "E&xit", fltk3::COMMAND + 'q', (fltk3::Callback *)quit_cb, 0 },
+ { 0 },
+
{ "&Edit", 0, 0, 0, fltk3::SUBMENU },
- { "Cu&t", fltk3::COMMAND + 'x', (fltk3::Callback *)cut_cb },
- { "&Copy", fltk3::COMMAND + 'c', (fltk3::Callback *)copy_cb },
- { "&Paste", fltk3::COMMAND + 'v', (fltk3::Callback *)paste_cb },
- { "&Delete", 0, (fltk3::Callback *)delete_cb },
- { 0 },
-
+ { "Cu&t", fltk3::COMMAND + 'x', (fltk3::Callback *)cut_cb },
+ { "&Copy", fltk3::COMMAND + 'c', (fltk3::Callback *)copy_cb },
+ { "&Paste", fltk3::COMMAND + 'v', (fltk3::Callback *)paste_cb },
+ { "&Delete", 0, (fltk3::Callback *)delete_cb },
+ { 0 },
+
{ "&Search", 0, 0, 0, fltk3::SUBMENU },
- { "&Find...", fltk3::COMMAND + 'f', (fltk3::Callback *)find_cb },
- { "F&ind Again", fltk3::COMMAND + 'g', find2_cb },
- { "&Replace...", fltk3::COMMAND + 'r', replace_cb },
- { "Re&place Again", fltk3::COMMAND + 't', replace2_cb },
- { 0 },
-
+ { "&Find...", fltk3::COMMAND + 'f', (fltk3::Callback *)find_cb },
+ { "F&ind Again", fltk3::COMMAND + 'g', find2_cb },
+ { "&Replace...", fltk3::COMMAND + 'r', replace_cb },
+ { "Re&place Again", fltk3::COMMAND + 't', replace2_cb },
+ { 0 },
+
{ 0 }
};
fltk3::Window* new_view() {
EditorWindow* w = new EditorWindow(660, 400, title);
- w->begin();
- fltk3::MenuBar* m = new fltk3::MenuBar(0, 0, 660, 30);
- m->copy(menuitems, w);
- w->editor = new fltk3::TextEditor(0, 30, 660, 370);
- w->editor->textfont(fltk3::COURIER);
- w->editor->textsize(TS);
+ w->begin();
+ fltk3::MenuBar* m = new fltk3::MenuBar(0, 0, 660, 30);
+ m->copy(menuitems, w);
+ w->editor = new fltk3::TextEditor(0, 30, 660, 370);
+ w->editor->textfont(fltk3::COURIER);
+ w->editor->textsize(TS);
//w->editor->wrap_mode(fltk3::Text_Editor::WRAP_AT_BOUNDS, 250);
- w->editor->buffer(textbuf);
- w->editor->highlight_data(stylebuf, styletable,
- sizeof(styletable) / sizeof(styletable[0]),
- 'A', style_unfinished_cb, 0);
+ w->editor->buffer(textbuf);
+ w->editor->highlight_data(stylebuf, styletable,
+ sizeof(styletable) / sizeof(styletable[0]),
+ 'A', style_unfinished_cb, 0);
textbuf->text();
style_init();
w->end();
w->resizable(w->editor);
w->callback((fltk3::Callback *)close_cb, w);
-
+
textbuf->add_modify_callback(style_update, w->editor);
textbuf->add_modify_callback(changed_cb, w);
textbuf->call_modify_callbacks();
@@ -800,15 +800,15 @@
int main(int argc, char **argv) {
textbuf = new fltk3::TextBuffer;
-//textbuf->transcoding_warning_action = NULL;
+ //textbuf->transcoding_warning_action = NULL;
style_init();
-
+
fltk3::Window* window = new_view();
-
+
window->show(1, argv);
-
+
if (argc > 1) load_file(argv[1], -1);
-
+
return fltk3::run();
}
Modified: branches/branch-3.0/test/fonts.cxx
===================================================================
--- branches/branch-3.0/test/fonts.cxx 2012-05-08 16:48:38 UTC (rev 9466)
+++ branches/branch-3.0/test/fonts.cxx 2012-05-08 21:26:41 UTC (rev 9467)
@@ -49,7 +49,7 @@
draw_box();
fltk3::font((fltk3::Font)font, size);
fltk3::color(fltk3::BLACK);
- fltk3::draw(label(), x()+3, y()+3, w()-6, h()-6, align());
+ fltk3::draw(label(), 3, 3, w()-6, h()-6, align());
}
FontDisplay *textobj;
@@ -139,11 +139,11 @@
fltk3::Group *fontgroup = new fltk3::Group(0, 185, 550, 185);
fontgroup->box(fltk3::FLAT_BOX);
- fontobj = new fltk3::HoldBrowser(10, 190, 390, 170);
+ fontobj = new fltk3::HoldBrowser(10, 5, 390, 170);
fontobj->box(fltk3::FRAME_BOX);
fontobj->color(53,3);
fontobj->callback(font_cb);
- sizeobj = new fltk3::HoldBrowser(410, 190, 130, 170);
+ sizeobj = new fltk3::HoldBrowser(410, 5, 130, 170);
sizeobj->box(fltk3::FRAME_BOX);
sizeobj->color(53,3);
sizeobj->callback(size_cb);
@@ -164,12 +164,7 @@
fltk3::get_system_colors();
create_the_forms();
-// For the Unicode test, get all fonts...
-//#ifdef __APPLE__
int i = 0;
-//#else
-// int i = fltk3::choice("Which fonts:","-*","iso8859","All");
-//#endif
int k = fltk3::set_fonts(i ? (i>1 ? "*" : 0) : "-*");
sizes = new int*[k];
numsizes = new int[k];
Modified: branches/branch-3.0/test/fractals.cxx
===================================================================
--- branches/branch-3.0/test/fractals.cxx 2012-05-08 16:48:38 UTC (rev
9466)
+++ branches/branch-3.0/test/fractals.cxx 2012-05-08 21:26:41 UTC (rev
9467)
@@ -7,7 +7,7 @@
// demonstrate how to add FLTK controls to a GLUT program. The GLUT
// code is unchanged except for the end (search for FLTK to find changes).
//
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2012 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -788,15 +788,15 @@
g->align(fltk3::ALIGN_LEFT);
g->begin();
fltk3::Button *b;
- b = new fltk3::Button(110,50,30,30,"0"); b->callback(setlevel,(void*)0);
- b = new fltk3::Button(140,50,30,30,"1"); b->callback(setlevel,(void*)1);
- b = new fltk3::Button(170,50,30,30,"2"); b->callback(setlevel,(void*)2);
- b = new fltk3::Button(200,50,30,30,"3"); b->callback(setlevel,(void*)3);
- b = new fltk3::Button(230,50,30,30,"4"); b->callback(setlevel,(void*)4);
- b = new fltk3::Button(260,50,30,30,"5"); b->callback(setlevel,(void*)5);
- b = new fltk3::Button(290,50,30,30,"6"); b->callback(setlevel,(void*)6);
- b = new fltk3::Button(320,50,30,30,"7"); b->callback(setlevel,(void*)7);
- b = new fltk3::Button(350,50,30,30,"8"); b->callback(setlevel,(void*)8);
+ b = new fltk3::Button( 0,0,30,30,"0"); b->callback(setlevel,(void*)0);
+ b = new fltk3::Button( 30,0,30,30,"1"); b->callback(setlevel,(void*)1);
+ b = new fltk3::Button( 60,0,30,30,"2"); b->callback(setlevel,(void*)2);
+ b = new fltk3::Button( 90,0,30,30,"3"); b->callback(setlevel,(void*)3);
+ b = new fltk3::Button(120,0,30,30,"4"); b->callback(setlevel,(void*)4);
+ b = new fltk3::Button(150,0,30,30,"5"); b->callback(setlevel,(void*)5);
+ b = new fltk3::Button(180,0,30,30,"6"); b->callback(setlevel,(void*)6);
+ b = new fltk3::Button(210,0,30,30,"7"); b->callback(setlevel,(void*)7);
+ b = new fltk3::Button(240,0,30,30,"8"); b->callback(setlevel,(void*)8);
g->end();
b = new fltk3::Button(400,50,100,30,"New Fractal");
b->callback(handlemenu,(void*)MENU_RAND);
Modified: branches/branch-3.0/test/help.cxx
===================================================================
--- branches/branch-3.0/test/help.cxx 2012-05-08 16:48:38 UTC (rev 9466)
+++ branches/branch-3.0/test/help.cxx 2012-05-08 21:26:41 UTC (rev 9467)
@@ -64,23 +64,23 @@
char *argv[]) // I - Command-line arguments
{
fltk3::HelpDialog *help; // Help dialog
-
+
help = new fltk3::HelpDialog;
-
- int argn = 1;
#ifdef USING_XCODE
set_app_dir();
+ //int argn = 1;
//if (argc <= argn)
- help->load("/Users/matt/mygcc/gcc-4.6.1/INSTALL/index.html");
+ help->load("/Users/matt/mygcc/gcc-4.6.1/INSTALL/index.html");
//help->load("../../../../documentation/html/intro.html");
//else
//help->load(argv[argn]);
#else
+ int argn = 1;
if (argc <= argn)
help->load("../documentation/html/intro.html");
else
@@ -89,11 +89,11 @@
#endif
help->show(1, argv);
-
+
fltk3::run();
-
+
delete help;
-
+
return (0);
}
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit