Exemple #1
0
void AlignToGridCmd::Align (GraphicView* gv, float refx, float refy) {
    MoveData* md = (MoveData*) Recall(gv->GetGraphicComp());

    if (md == nil) {
        Viewer* v = gv->GetViewer();
        Grid* grid = (v == nil) ? nil : v->GetGrid();

        if (grid == nil) {
            return;
        }

        Graphic* g = gv->GetGraphic();
        Transformer t;
        g->Parent()->TotalTransformation(t);
        t.Invert();

        Coord cx = iv26_round(refx);
        Coord cy = iv26_round(refy);

        grid->Constrain(cx, cy);

        float dx, dy, trefx, trefy;

        t.Transform(float(cx), float(cy), dx, dy);
        t.Transform(refx, refy, trefx, trefy);

        dx -= trefx;
        dy -= trefy;
        Store(gv->GetGraphicComp(), new MoveData(dx, dy));

    }
    Move(gv->GetGraphicComp());
}
Exemple #2
0
void PSIdraw::ConstProcs (ostream& out) {
    int arrowWidth = iv26_round(ARROWWIDTH*points);
    int arrowHeight = iv26_round(ARROWHEIGHT*points);

    out << "/arrowHeight " << arrowHeight << " def\n";
    out << "/arrowWidth " << arrowWidth << " def\n\n";

    PostScriptViews::ConstProcs(out);
}
Exemple #3
0
FileDialog::FileDialog (
    const char* msg, const char* dir, const char* confirmLbl
) {
    int space = iv26_round(fspace*cm);
    _browser = new FileBrowser(state, dir, 20, 35, false, Reversed,"\000\007");
    _dirs = new FileBrowser(
        "dirBrowser", state, dir, 20, 24, true, Reversed,"d\007"
    );
    _dirs->SetTextFilter("^$");                 // show directories only
    _dirs->Update();

    _cur_dir = new MarginFrame(new Message("path", FullPath(_dirs)));
    HBox* dirBox = new HBox(
        new Message("Directory: "),
        _cur_dir,
        new HGlue
    );
    dirBox->Propagate(false);

    Insert(
        new MarginFrame(
            new VBox(
                new HBox(
                    new VBox(
                        new Message("Change directory to:", Left, 0, hfil),
                        new Frame(AddScroller(_dirs))
                    ),
                    new HGlue(space, 0),
                    new VBox(
                        new Message(msg, Left, 0, hfil),
                        new Frame(AddScroller(_browser))
                    )
                ),
                new VGlue(space, 0),
                dirBox,
                new VGlue(space, 0),
                new HBox(
                    new HGlue,
                    new PushButton(" Cancel ", state, '\007'),
                    new HGlue(space, 0),
                    new PushButton(confirmLbl, state, '\r')
                )
            ), space, space, 0
        )
    );
}
Exemple #4
0
AcknowledgeDialog::AcknowledgeDialog (const char* msg, const char* btnLbl) {
    int space = iv26_round(fspace*cm);

    Insert(
        new MarginFrame(
            new VBox(
                new Message(msg),
                new VGlue(space),
                new HBox(
                    new HGlue,
                    new PushButton(btnLbl, state, '\r'),
                    new HGlue
                )
            ), space, space, 0
        )
    );
}
Exemple #5
0
Interactor* ConfirmDialog::Interior (const char* msg) {
    const int space = iv26_round(.5*cm);

    return new MarginFrame(
        new VBox(
            new HBox(new Message(msg), new HGlue),
            new VGlue(space),
            new HBox(
                new HGlue,
                new PushButton("  Yes  ", state, 'y'),
                new HGlue(space, 0),
                new PushButton("  No  ", state, 'n'),
                new HGlue(space, 0), 
                new PushButton("Cancel", state, '\007'),
                new HGlue
            )
        ), space, space/2, 0
    );
}
Exemple #6
0
Interactor* RotateDialog::Interior () {
    const int space = iv26_round(.5*cm);

    VBox* titleblock = new VBox(
        new HBox(_title, new HGlue),
        new HBox(_subtitle, new HGlue)
    );

    return new MarginFrame(
        new VBox(
            titleblock,
            new VGlue(space),
            new Frame(new MarginFrame(_medit, 2)),
            new VGlue(space),
            new HBox(
                new HGlue,
                new PushButton("Cancel", state, '\007'),
		new HGlue(space, 0),
                new PushButton("  OK  ", state, '\r')
            )
        ), space, space/2, 0
    );
}
Exemple #7
0
void StringDialog::Init (const char* msg, const char* confirmLbl, int width) {
    int space = iv26_round(fspace*cm);
    _sedit = new StringEditor(state, "");
    HBox* framedSedit = new HBox;

    if (width == 0) {
        framedSedit->Insert(_sedit);

    } else {
        framedSedit->Insert(new HGlue);
        framedSedit->Insert(
            new VBox(
                new Frame(new MarginFrame(_sedit, 2)),
                new HGlue(width, 0, 0)
            )
        );
        framedSedit->Insert(new HGlue);
    }

    Insert(
        new MarginFrame(
            new VBox(
                new Message(msg),
                new VGlue(space),
                framedSedit,
                new VGlue(space),
                new HBox(
                    new HGlue,
                    new PushButton(" Cancel ", state, '\007'),
                    new HGlue(space, 0),
                    new PushButton(confirmLbl, state, '\r')
                )
            ), space, space, 0
        )
    );
}
Exemple #8
0
Interactor* MoveDialog::Interior () {
    const int space = iv26_round(.5*cm);

    VBox* titleblock = new VBox(
        new HBox(_title, new HGlue),
        new HBox(_subtitle, new HGlue)
    );

    HBox* rbuttons = new HBox(
        new RadioButton("Pixels", _units, 'p'),
        new HGlue(space, 0),
        new RadioButton("Points", _units, 'o'),
        new HGlue(space, 0),
        new RadioButton("Centimeters", _units, 'c'),
        new HGlue(space, 0),
        new RadioButton("Inches", _units, 'i')
    );
    rbuttons->Insert(new HGlue);

    return new MarginFrame(
        new VBox(
            titleblock,
            new VGlue(space),
            new Frame(new MarginFrame(_medit, 2)),
            new VGlue(space/2, 0),
            rbuttons,
            new VGlue(space),
            new HBox(
                new HGlue,
                new PushButton("Cancel", state, '\007'),
		new HGlue(space, 0),
                new PushButton("  OK  ", state, '\r')
            )
        ), space, space/2, 0
    );
}