Ejemplo n.º 1
0
void Viewer::Magnify (Coord left, Coord bottom, Coord right, Coord top) {
    Perspective np = *perspective;
    NormalRect(left, bottom, right, top);
    np.curx += left;
    np.cury += bottom;
    np.curwidth = Math::max(right - left, 1);
    np.curheight = Math::max(top - bottom, 1);
    Adjust(np);
}
Ejemplo n.º 2
0
Command* StrBrowserView::InterpretManipulator (Manipulator* m) {
    Command* cmd = nil;
    Tool* tool = m->GetTool();

    if (tool->IsA(IBGRAPHIC_COMP_TOOL)) {
	cmd = InteractorView::InterpretManipulator(m);

    } else if (tool->IsA(GRAPHIC_COMP_TOOL)) {
        DragManip* dm = (DragManip*) m;
        IBEditor* ed = (IBEditor*) dm->GetViewer()->GetEditor();

        Tool* tool = dm->GetTool();
        Transformer* rel = dm->GetTransformer();
        RubberRect* rubberRect = (RubberRect*) dm->GetRubberband();
        Coord x0, y0, x1, y1;
        rubberRect->GetCurrent(x0, y0, x1, y1);
        NormalRect(x0, y0, x1, y1);

        if (rel != nil) {
            rel->InvTransformRect(x0, y0, x1, y1);
        }
	GetABSCoord(ed, x0, y0, x1, y1);

	ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar");
	FontVar* fontVar = (FontVar*) ed->GetState("FontVar");

        StrBrowserComp* comp = (StrBrowserComp*) GetStrBrowserComp()->Copy();
        StrBrowserGraphic* g = (StrBrowserGraphic*) comp->GetGraphic();
	g->SetRowsCols(y1-y0+1, x1-x0+1);

	if (colVar != nil) {
            g->SetColors(colVar->GetFgColor(), colVar->GetBgColor());
        }
        if (fontVar != nil) {
            g->SetFont(fontVar->GetFont());
        }
	cmd = new MacroCmd(
            ed, new PasteCmd(ed, new Clipboard(comp)),
            new PlaceCmd(ed, x0, y0, x1-1, y1-1, new Clipboard(comp))
        );

    } else if (!tool->IsA(RESHAPE_TOOL)){
        cmd = MessageView::InterpretManipulator(m);
    }
    return cmd;
}