home *** CD-ROM | disk | FTP | other *** search
- menu -plot /* make sure plot window menu */
-
- menu 4
- /* Assume Origin's default
- * menu, which has page at the 4th
- * position
- */
-
- menu -i 5 (Full Screen) {
- type -b "Double-click to restore the screen.";
- plot -screen;
- }
- menu -i 5 /* add a space */
-
- def CheckMargins {
- CheckVar Top 10;
- CheckVar Left 15;
- CheckVar Right 10;
- CheckVar Bottom 15;
- CheckVar xGap 5;
- CheckVar yGap 5;
- }
-
- /* ArrangeLayers nRow nCol
- * Assume xGap, yGap, top, left,right,bottm
- */
- def ArrangeLayers {
- /* use x and y as temperary variables width and height
- * %1 = nRow
- * %2 = nCol
- */
- x = 100 - Left - Right - (%2-1)*xGap;
- x/=%2;
- y = 100 - Top - Bottom - (%1-1)*yGap;
- y/=%1;
-
- if(x < 5 || y < 5) {
- ty -b "Resulting layers are too small, operation aborted!";
- break 1;
- };
- for(i = 1; i <= %1; i+=1) {
- for(j = 1; j <= %2; j+=1) {
- layer -s ((i-1)*%2 + j);
-
- layer -u 1;/* make sure unit is 1 which is % of page */
- if(%2==1) { /* one column, put layer 1 at bottom */
- layer x y [Left+(j-1)*(x + xGap)] [Top+(%1 - i)*(y + yGap)];
- }
- else {
- layer x y [Left+(j-1)*(x + xGap)] [Top+(i-1)*(y + yGap)];
- };
- }
- };
- }
-
- menu "Arrange All Layers.." {
- CheckVar nRow 2;
- CheckVar nColumn 1;
- GetNum
- [Number of Rows] nRow
- [Number of Columns] nColumn
- [Total number of layers];
- doc -CL;
- /* count the number of layers already on the page
- * result is put into count
- */
- n = nRow * nColumn - count;
- if(n > 0) {
- ty -N "Need to create $(n) more layers. Go ahead?";
-
- repeat n {
- layer -n;/* create a new layer */
- plot -L;
- /* plot the layer, this force the layer
- * to finish making itself before
- * the next one is created.
- */
- }
- };
-
- CheckMargins;/* see def above */
-
- GetNum
- [Horizontal Gap] xGap
- [Vertical Gap] yGap
- [Left Margin] Left
- [Right Margin] Right
- [Top Margin] Top
- [Bottom Margin] Bottom
- [Spacings in % of Page Dimension];
-
- ArrangeLayers nRow nColumn;
-
- }
-
-
- menu "&Fit Layer to Page.." {
- type -N Are you sure you want to fit the layer to the whole page?;
- layer 0;
- #Maximize the active layer to fit to the page.
- }
-
-
- menu /* add a separator */
-
-
- menu "&Rotate Page" {
- page -O Rotate;/* P = portrait, L = landscape, R = rotate */
- #Exchange between landscape and portrait.
- }
-
- menu "Page &Control.." {
- page;
- #Open the page control dialog box
- }
-
- menu /* add a separator */
-
- menu "&Merge All Pages" {
- Window -M;
- #Put all layers from other plot windows into %H. Close other windows.
- }
-
-
- /* we also need to add the file import and export commands to the
- * File menu
- */
- menu 1/* the File menu is the 1st one */
-
- menu -i 11/* insert separation line */
-
- menu -L -i 12 (&Import ASCII)
- /* new drop down menu at position 12 */
- menu (Single File...) {
- ImportAscii;
- }
-
- menu "Multiple Files.." {
- getfile -m *.dat;
- for(i = 1; i <= count; i+=1) {
- getfile -g i;
- open -w %A;
- }
- #Import multiple ACSII files into the active plot %H
- }
- menu -L
- /* end the drop down menu */
-
- menu -L -i 13 (&Export Page)
- /* new drop down menu at position 13 */
-
-
- menu EPS.. {
- ty -N
- "Click Yes if you have already selected an EPS
- file on a PostScript printer. If not, choose
- a PostScript printer within Printer Setup.
- Click on Options and set printing to EPS file.
- Leave the filename blank and Origin will
- prompt for filename.";
- print -e;
- #Print %H window into an Encapsulated PostScript file.
- }
-
- menu (Windows Metafile..) {
- GetSaveName %H *.WMF;
- clipb -C (%H) %A;
- }
-
- menu (Bitmap (BMP) ...) {
- GetSaveName %H *.BMP;
-
- page -pg width x;
- page -pg height y;
- BMP.Width=nint(prec(0.5+x/5,2));
- BMP.Height=nint(prec(0.5+y/5,2));
- /* we suggest 1/5 of page resolution
- * to conserve space
- */
- CheckVar BMP.BW 0;/* black and white is equal to one */
-
- GetNumber
- [Width (pixels)] BMP.width
- [Height (pixels)] BMP.height
- (Black and White) BMP.BW:2
- (Image Attributes);
-
- if(BMP.BW) {
- save -BS %H %A BMP.width BMP.height Black;
- }
- else {
- save -BS %H %A BMP.width BMP.height;
- };
- #Export the %H window into a device independent bitmap file
- }
-
- menu -L
- /* end the drop down menu */
-
-