CircuitLayout

 view release on metacpan or  search on metacpan

Examples/GDS2Tool/gds2tool  view on Meta::CPAN

our $G_mouseMode = 'probe';
my $mouseInfoBar = $bottomArea -> Label(
    -anchor       => 'w',
    -borderwidth  => 1,
    -relief       => 'sunken',
    -textvariable => \$G_mouseInfoText, 
    -width        => 60,
);

###### start top menu bar #####
my $topMenu = $MW -> Frame(-relief => 'raised', -borderwidth => 2);
$topMenu -> pack(-fill => 'x');

$statusBar -> pack(-side => 'bottom', -fill => 'x', -padx => 2, -pady => 2);
$xyStatusBar -> pack(-side => 'right', -fill => 'x', -padx => 2, -pady => 2);
$mouseInfoBar -> pack(-side => 'bottom', -fill => 'x', -padx => 2, -pady => 2);

### canvas
our $G_canvas2;
our $G_canvas = $MW -> WorldCanvas(-height => 300, -width => 500, -bg => BlackColor);
$G_canvas -> configure(-changeView => [\&changeView, $G_canvas2]); ## -configure appends bbox coords...
##$canvas -> configure(-font => '-adobe-courier-bold-r-normal--17-120-*-*-*-*-*-*'); ##TODO 
showViewWindow();
$G_viewWindow -> withdraw;
showGridWindow();
$G_gridWindow -> withdraw;

##### options menu #####
my $fileMenu = $topMenu -> Menubutton(-text => 'File', -underline => 0);
### open
$fileMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Open ...', 
    -command          => sub {
        $G_gds2FileNameIn = $MW -> getOpenFile(
            -defaultextension => '.gds2',
            -filetypes  => [
                ['GDSII Files', ['.gds2' , '.gds', '.sf', '.gdsii']],
                ['All Files', '*'],
            ],

Examples/GDS2Tool/gds2tool  view on Meta::CPAN

            $G_canvas -> viewFit(-border => 0, ['layout=true']);
            $G_canvas -> viewFit(-border => 0.02, ['layout=true']);
            #createAxis($G_canvas);
        }
        if ($MW -> colormapfull())
        {
            print WARNING."Colormap is full. Try -privateColorMap command line option\n";
        }
    }, 
);
$fileMenu -> pack(-side=>'left');

### clear
$fileMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -command          => sub { 
        $G_canvas -> delete('all'); 
        $G_canvas2 -> delete('all'); 
        @G_selected = ();
    },
    -label            => 'Clear', 
);
$fileMenu -> pack(-side=>'left');

### quit
$fileMenu -> command(
    -activebackground => RedColor, 
    -activeforeground => WhiteColor, 
    -command          => sub { $MW -> destroy; exit(1); }, 
    -label            => 'Quit', 
);
$fileMenu -> pack(-side=>'left');

### view menu
my $modeMenu = $topMenu -> Menubutton(-text => 'Set Mode', -underline => 0);
#$modeMenu -> separator;

### pan
$modeMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Pan', 
    -command          => sub {
        $G_mouseMode = 'pan';
        setCursor();
        $G_mouseInfoText='mouse buttons:    click pan  |  drag pan  |  redraw  ';
        $G_canvas -> CanvasBind('<Button-1>' => [\&pan, Ev('x'), Ev('y')]);
        $G_canvas -> CanvasBind('<Button-2>' => sub {
            my ($c) = @_;

Examples/GDS2Tool/gds2tool  view on Meta::CPAN

        $G_canvas -> CanvasBind('<B2-Motion>' => sub {
            my ($c) = @_;
            my $e = $c -> XEvent;
            $c -> scan('dragto', $e -> x, $e -> y);
        });
        $G_canvas -> CanvasBind('<Button-3>' => \&redraw);
    },
);

### ruler
$modeMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Ruler', 
    -command          => sub {
        $G_mouseMode = 'ruler';
        setCursor();
        $G_mouseInfoText='mouse buttons:    ruler  |  multisegment ruler  |  finish ruler';
        $G_canvas -> CanvasBind('<Button-1>' => [\&ruler, 1, Ev('x'), Ev('y')]);
        $G_canvas -> CanvasBind('<Button-2>' => [\&ruler, 2, Ev('x'), Ev('y')]);
        $G_canvas -> CanvasBind('<Button-3>' => [\&ruler, 0, Ev('x'), Ev('y')]);
    },
);

### select
$modeMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Select', 
    -command          => sub {
        $G_mouseMode = 'select';
        setCursor();
        $G_mouseInfoText='mouse buttons:    select  |  add select  |  window select';
        $G_canvas -> CanvasBind('<Button-1>' => [\&selectPoint, TRUE]);
        $G_canvas -> CanvasBind('<Button-2>' => [\&selectPoint, FALSE]);
        $G_canvas -> configure(-bandColor => BrightYellowColor);

Examples/GDS2Tool/gds2tool  view on Meta::CPAN

                $tags =~ s/selected=false/selected=true/;
                @tags=split(/\s/,$tags);
                $G_canvas -> itemconfigure($id,-tags=>\@tags,-stipple=>'',-fill=>undef,-outline=>WhiteColor) if ("@tags" =~ m/type=boundary/);
                $G_canvas -> itemconfigure($id,-tags=>\@tags,-fill=>WhiteColor) if ("@tags" =~ m/type=path/ || "@tags" =~ m/type=text\b/);
            }
        });
    },
);

### unselect
$modeMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'unSelect', 
    -command          => sub
    {
        $G_mouseMode = 'unselect';
        setCursor();
        $G_mouseInfoText='mouse buttons:    unselect  |  window inside unselect  |  window outside unselect';
        $G_canvas -> CanvasBind('<Button-1>' => [\&selectPoint, FALSE, FALSE]);
        $G_canvas -> CanvasBind('<Button-2>' => [\&selectPoint, FALSE, FALSE]);

Examples/GDS2Tool/gds2tool  view on Meta::CPAN

        $G_canvas -> CanvasBind('<ButtonRelease-3>' => sub
        {
            my @box = $G_canvas -> rubberBand(2);
            my @ids = $G_canvas -> find('enclosed', @box);
            unselectFromArray($G_canvas,@ids);
        });
    },
);

### zoom in
$modeMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Zoom In', 
    -command          => sub {
        $G_mouseMode = 'zoom in';
        setCursor();
        $G_mouseInfoText='mouse buttons:    Zoom in window  |  Zoom In x 2  |  Zoom In x 5';
        $G_canvas -> CanvasBind('<Button-1>' => [\&zoom, 0, Ev('x'), Ev('y')]);
        $G_canvas -> CanvasBind('<Button-2>' => [\&zoom, 2, Ev('x'), Ev('y')]);
        $G_canvas -> CanvasBind('<Button-3>' => [\&zoom, 5, Ev('x'), Ev('y')]);
    },
);


### zoom out 
$modeMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Zoom Out', 
    -command          => sub {
        $G_mouseMode = 'zoom out';
        setCursor();
        $G_mouseInfoText='mouse buttons:    Full size  |  Zoom Out x 2  |  Zoom Out x 5';
        $G_canvas -> CanvasBind('<Button-1>' => [\&zoom, 1, Ev('x'), Ev('y')]);
        $G_canvas -> CanvasBind('<Button-2>' => [\&zoom, 0.5, Ev('x'), Ev('y')]);
        $G_canvas -> CanvasBind('<Button-3>' => [\&zoom, 0.2, Ev('x'), Ev('y')]);
    },
);

$modeMenu -> pack(-side=>'left');

### info menu
my $infoMenu = $topMenu -> Menubutton(-text => 'Info', -underline => 0);

### ruler
$infoMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Ruler  (r)', 
    -command          => sub {
        $G_mouseMode = 'ruler';
        setCursor();
        $G_statusText='Enter start coordinate for ruler';
    },
);

$infoMenu -> pack(-side=>'left');

### window menu
my $windowMenu = $topMenu -> Menubutton(-text => 'Windows', -underline => 0);
### grid window
$windowMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Grid', 
    -command          => \&showGridWindow,
);

### info window
$windowMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Info', 
    -command          => \&showInfoWindow,
);

### layer window
$windowMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Layers', 
    -command          => \&showLayerWindow,
);

### 2nd view window
$windowMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Full view', 
    -command          => \&showViewWindow,
);

### binding help
$windowMenu -> command(
    -activebackground => LightBlueColor, 
    -activeforeground => WhiteColor, 
    -label            => 'Key bindings', 
    -command          => \&showKeyBindings,
);
$windowMenu -> pack(-side=>'left');

#######
$MW -> bind( '<Any-KeyPress>' => sub 
    {
        my($c) = @_;
        my $e = $c -> XEvent;
        my( $x, $y, $W, $A ); ## $G_keyLast;
        ( $x, $y, $G_keyLast) = ($e -> x, $e -> y, $e -> K);
        if ($G_keyLast eq 'Escape') ## 
        {



( run in 0.539 second using v1.01-cache-2.11-cpan-49f99fa48dc )