The text of a manual · part 20 of 42
JANUS PSK for C/C++ Reference Manual, Version 2.1, pages 191 to 200
Pages 191 to 200 of 414
The original document is the PDF (690 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Intermec J2020, Intermec J2010 and Intermec J2050
Page 191
im_viewport_page_up im_viewport_page_up Purpose:
This function moves the viewport up one viewport length.
Syntax:
#include <im20lib.h> void im_viewport_page_up(void);
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
None.
Notes:
This function has no effect on the JANUS 2050.
See Also:
im_cursor_to_viewport, im_viewport_end, im_viewport_home, im_viewport_move, im_viewport_page_down, im_viewport_to_cursor
Example See example for im_viewport_setxy.
2-162
Page 192
im_viewport_setxy
2 im_viewport_setxy Purpose:
This function sets the viewport row and column to a specific value when moving between two screens.
Syntax:
#include <im20lib.h> IM_STATUS im_viewport_setxy (IM_USHORT *row, IM_USHORT *col);
IN/OUT Parameters:
The row parameter sets the row value (Y-coordinate) of the viewport. The col parameter sets the column value (X-coordinate) of the viewport.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
The (row, col) pair represents the upper left corner of the viewport being displayed. The minimum values for both the row and col are (0,0), which is the upper left corner of the virtual window. For the normal video mode 3 (80 x 25 display) with 20 x 16 display character size, the maximum value of row is 9 (25 minus 16) and the maximum value of col is 60 (80 minus 20). The row and column viewport settings are set to the maximum allowed for the current mode and display size. To determine the actual values set, check the returned values of row and col. This function has no effect on the JANUS 2050.
See Also:
im_viewport_move
2-163
Page 193
im_viewport_setxy
Example /******************** im_viewport_setxy ************************************/ /* Also with: im_viewport_getxy */ /* im_viewport_home */ /* im_viewport_end */ /* im_viewport_page_down */ /* im_viewport_page_up */ /* im_viewport_move */ /* im_set_display_mode */ /* im_get_display_mode */ /* im_viewport_to_cursor */ /* im_cursor_to_viewport */ #include <stdio.h> #include <dos.h> #include <conio.h> #include <stdlib.h> #include "im20lib.h" #define
SOUND_TIME void main (void) { IM_USHORT IM_STD_SIZE_MODE IM_STD_VIDEO_MODE IM_SCROLL_MODE IM_CHARACTER_HEIGHT
200
/* 200 milliseconds */ row, col; std_size, cmode_size; std_video, cmode_video; std_scroll, cmode_scroll; std_charhigh, cmode_charhigh;
/* Set display mode to 80 x 25 and remaining parameters standard. */ std_size = IM_SIZE_MODE_80X25; std_video = IM_STD_VIDEO_MODE_3; std_scroll = IM_LCD_SCROLL_AT_25; std_charhigh = IM_STANDARD_CHAR_HEIGHT; im_set_display_mode(std_size, std_video, std_scroll, std_charhigh); /* Set up mark for viewport operation fuctions */ /* DOS Screen uses (1,1) as home but im functions start at (0,0) */ gotoxy( 1, 1 ); cputs("1-viewport_home"); /* viewport_home mark*/ gotoxy( 1, 1+1); cputs(" row:0, col:0"); gotoxy( 61, 24 ); cputs("2-viewport_end"); /* viewport_end mark*/ gotoxy( 61, 24+1); cputs(" row:23, col:60"); gotoxy( 61, 1 ); cputs("3-viewport_page_up"); /* viewport_page_up */ gotoxy( 61, 1+1); cputs(" row:0, col:60"); gotoxy( 21, 1 ); cputs("4-viewport_setxy"); /* viewport_setxy */ gotoxy( 21, 1+1); cputs(" row:0, col:20"); gotoxy( 41, 1 ); cputs("5-viewport_move"); /* viewport_move */ gotoxy( 41, 1+1); cputs(" row:0, col:40"); gotoxy( 41, 19 ); cputs("6-viewport_page_down"); /* vewport_page_down */ gotoxy( 41, 19+1); cputs(" row:18, col:40"); gotoxy( 21, 19 ); cputs("7-viewport_to_cursor"); /* viewport_to_cursor*/ gotoxy( 21, 19+1); cputs(" row:18, col:20"); /* Bring cursor back so that viewport will stay with it */ gotoxy( 1, 1); /* Action 1: Set viewport back to Home */ im_viewport_home(); im_sound(IM_LOW_PITCH,SOUND_TIME,IM_LOUD_VOLUME); getch();
2-164
Page 194
im_viewport_setxy
2
/* Action 2: Viewport End */ im_viewport_end(); im_sound(IM_LOW_PITCH,SOUND_TIME,IM_LOUD_VOLUME); getch(); /* Action 3: Viewport Page Up */ im_viewport_page_up(); im_sound(IM_LOW_PITCH,SOUND_TIME,IM_LOUD_VOLUME); getch(); /* Action 4: Viewport Setxy */ row = 0; col = 20; im_viewport_setxy(&row, &col); im_sound(IM_LOW_PITCH,SOUND_TIME,IM_LOUD_VOLUME); getch(); /* Action 5: Viewport Move */ im_viewport_move(IM_VIEWPORT_RIGHT, 20, &row, &col); im_sound(IM_LOW_PITCH,SOUND_TIME,IM_LOUD_VOLUME); getch(); /* Action 6: Viewport Page Down */ im_viewport_page_down(); im_sound(IM_LOW_PITCH,SOUND_TIME,IM_LOUD_VOLUME); getch(); /* Action 7: set cursor at row:18, column:10 and viewport_to_cursor */ /* Note: Cursor at the centor of viewport */ gotoxy(20+10, 18); /* Need offset 10 to let cursor at center*/ im_viewport_to_cursor(); im_sound(IM_LOW_PITCH,SOUND_TIME,IM_LOUD_VOLUME); getch(); /* Action 8: Viewport Getxy */ im_viewport_end(); /* Force viewport to end */ /* In 80X25 mode, viewport_end causes the viewport move at (9,60) */ /* You should see value is row:9, col:60 */ im_viewport_getxy(&row, &col); im_viewport_home(); /* Force viewport to home */ gotoxy(1, 1 ); cputs ("8-viewport_getxy"); /* Start at home again */ gotoxy(1, 1+1); cprintf(" Row:%d, Col:%d", row, col); im_sound(IM_LOW_PITCH,SOUND_TIME,IM_LOUD_VOLUME); getch(); /* Action 9: Mark ref. c->v */ clrscr(); gotoxy(51, 10 ); cputs("Ref. C->V"); /* viewport_to_cursor*/ gotoxy( 1, 1); cputs("9-C->V"); gotoxy( 1, 1+1); cputs("Cursor at Ref."); getch(); /* Action 9: Move viewport to end, then Do cursor_to_viewport */ row = 2; col = 40; im_viewport_setxy(&row, &col); im_viewport_end(); /* Force viewport to end */ im_cursor_to_viewport(); /* Cursor go to center */ im_sound(IM_LOW_PITCH,SOUND_TIME,IM_LOUD_VOLUME); getch(); /* Action 10: Get Display Mode */ im_get_display_mode(&cmode_size, &cmode_video, &cmode_scroll, &cmode_charhigh); if ( (std_size == cmode_size) && (std_video == cmode_video) && (std_scroll == cmode_scroll) && (std_charhigh == cmode_charhigh) )
2-165
Page 195
im_viewport_setxy printf("\nDisplay mode setup ok\n");
2-166
Page 196
im_viewport_setxy
2 else printf("\nError in display_mode\nsetup\n"); im_sound(IM_LOW_PITCH,SOUND_TIME,IM_LOUD_VOLUME); getch(); }
2-167
Page 197
im_viewport_to_cursor im_viewport_to_cursor Purpose:
This function centers the viewport around the cursor.
Syntax:
#include <im20lib.h> void im_viewport_to_cursor(void);
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
None.
Notes:
When the cursor is not displayed, use this function to move the viewport to the cursor. This function has no effect on the JANUS 2050.
See Also:
im_cursor_to_viewport, im_viewport_end, im_viewport_home, im_viewport_move, im_viewport_page_down
Example See example for im_viewport_setxy.
2-168
Page 198
Page 199
3 Software Interrupts