1 #include <../../nrnconf.h>
5 #include <InterViews/background.h>
6 #include <InterViews/canvas.h>
7 #include <InterViews/printer.h>
8 #include <InterViews/label.h>
9 #include <IV-look/kit.h>
23 virtual ~GAxisItem(){};
61 init(x1, x2, pos, ntic, nminor,
invert, number);
97 "save_window_.%caxis(%g,%g,%g,%d,%d,%d,%d)",
106 o <<
buf << std::endl;
128 Coord x1, y1, x2, y2;
130 if (
v &&
v->scene() ==
s_) {
131 v->zin(x1, y1, x2, y2);
167 float y_align, x_align;
184 if (
s == 1 ||
s == 2)
192 if (logstep >= 0 && logstep <= 5) {
193 Sprintf(pform,
"%%0.%.0ff", logstep + addprec);
202 tic =
new Line(0, length);
204 minor_tic =
new Line(0, l_minor);
209 x =
amin_ +
i * tic_space;
210 if (std::abs(x) < 1e-10) {
236 if (i < ntic_ && invert_ >= 0) {
246 if (logstep >= 0 && logstep <= 5) {
247 Sprintf(pform,
" %%0.%.0ff ", logstep + 1);
256 tic =
new Line(length, 0);
258 minor_tic =
new Line(l_minor, 0);
263 y =
amin_ +
i * tic_space;
286 if (i < ntic_ && invert_ >= 0) {
313 tic =
new Line(0, length);
317 if (std::abs(x) < 1e-10) {
335 tic =
new Line(length, 0);
359 Background::draw(
c, a);
363 Background::print(
c, a);
367 #define IDLINE(x1, y1, x2, y2, color, br) \
368 c->line(x1, y1, x2, y2, color, br); \
369 IfIdraw(line(c, x1, y1, x2, y2, color, br));
374 Coord x1, y1, x2, y2;
378 v.zin(x1, y1, x2, y2);
390 tr.inverse_transform(x1, y1, l, b);
391 tr.inverse_transform(x2, y2, r,
t);
393 c->rect(l, b, r,
t, color, br);
394 IfIdraw(rect(
c, l, b, r,
t, color, br,
false));
395 const Coord tic = 10;
398 Coord dtic = (r - l) / xtic;
399 Coord dx = (x2 - x1) / xtic;
401 for (
i = 0;
i <= xtic; ++
i) {
403 if (
i > 0 &&
i < xtic) {
404 IDLINE(x, b, x, b + tic, color, br);
405 IDLINE(x,
t, x,
t - tic, color, br);
409 dtic = (
t - b) / ytic;
410 dx = (y2 - y1) / ytic;
411 for (
i = 0;
i <= ytic; ++
i) {
413 if (
i > 0 &&
i < ytic) {
414 IDLINE(l, y, l + tic, y, color, br);
415 IDLINE(r, y, r - tic, y, color, br);
420 c->clip_rect(l, b, r,
t);
439 t.translate(a.
x(), a.
y());
450 Background::draw(
c, a);
454 Background::print(
c, a);
461 Coord x1, y1, x2, y2;
465 v.zin(x1, y1, x2, y2);
477 tr.inverse_transform(x1, y1, l, b);
478 tr.inverse_transform(x2, y2, r,
t);
490 tr.inverse_transform(
xorg,
yorg, xo, yo);
492 IDLINE(l, yo, r, yo, color, br);
493 IDLINE(xo, b, xo,
t, color, br);
494 const Coord tic = 10;
497 Coord dtic = (r - l) / xtic;
498 Coord dx = (x2 - x1) / xtic;
500 for (
i = 0;
i <= xtic; ++
i) {
502 IDLINE(x, yo, x, yo + tic, color, br);
505 dtic = (
t - b) / ytic;
506 dx = (y2 - y1) / ytic;
507 for (
i = 0;
i <= ytic; ++
i) {
509 IDLINE(xo, y, xo + tic, y, color, br);
531 t.translate(a.
x(), a.
y());
Allotment & x_allotment()
Allotment & y_allotment()
static const Color * default_color()
static const Brush * default_brush()
void draw_help(Canvas *, const Allocation &) const
void tic_label(Coord x, Coord y, Coord val, float x_align, float y_align, Canvas *) const
virtual void print(Printer *, const Allocation &) const
virtual void draw(Canvas *, const Allocation &) const
virtual ~AxisBackground()
virtual void save(std::ostream &)
virtual void update(Observable *)
Axis(Scene *, DimensionName)
virtual void size(float &, float &)
void init(Coord x1, Coord x2, Coord pos=0., int ntic=1, int nminor=0, int invert=0, bool number=true)
virtual void draw(Canvas *, const Allocation &) const
void tic_label(Coord x, Coord y, Coord val, float x_align, float y_align, Canvas *) const
virtual void print(Printer *, const Allocation &) const
void draw_help(Canvas *, const Allocation &) const
virtual void erase(Scene *, GlyphIndex, int erase_type)
static void round_range_down(Coord x1, Coord x2, double &y1, double &y2, int &ntic)
static void round_range(Coord x1, Coord x2, double &y1, double &y2, int &ntic)
static bool inside(Coord x, Coord min, Coord max)
virtual void attach(Observer *)
virtual void detach(Observer *)
static void text(Canvas *, const char *, const Transformer &, const Font *f=NULL, const Color *c=NULL)
static std::ostream * idraw_stream
const Requirement & x_requirement() const
const Requirement & y_requirement() const
virtual void unref() const
void move(GlyphIndex, Coord x, Coord y)
virtual void append(Glyph *)
static const Color * default_foreground()
virtual GlyphIndex count() const
virtual void append_fixed(Glyph *)
static XYView * current_draw_view()
static XYView * current_pick_view()
unsigned int DimensionName
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.