void deskmenu_init(void) { int i; h_gem_menu = gemtk_obj_get_tree(MAINMENU); /* Install menu: */ menu_bar(h_gem_menu, MENU_INSTALL); /* parse and update menu items: */ i = 0; while( menu_evnt_tbl[i].rid != -1 ) { register_menu_str( &menu_evnt_tbl[i] ); /* Update menu string if not null: */ if( menu_evnt_tbl[i].menustr != NULL ){ menu_text(h_gem_menu, menu_evnt_tbl[i].rid, menu_evnt_tbl[i].menustr); } i++; } deskmenu_update(); /* Redraw menu: */ menu_bar(h_gem_menu, MENU_UPDATE); }
/* * Top level; * we get control from the desktop. */ main() { pnf = 0; /* set the flag to it isn't partition yet */ appl_init(); phys_handle=graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox); wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); open_vwork(); wi_handle=wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk); hidden = FALSE; butdown = TRUE; /* doing a checking see if the cache in the system */ cachexst = (char) chkcache(); /* check the existence of the BLiTTER */ blitxst = chkblit(); if (!rsrc_load(RESOURCEFILE)) { errs("[2][|", RESOURCEFILE, "][ EXIT ]"); goto punt; } /* Get all addresses of dialogues from resource file */ if (getalladdr() != OK) { errs("[2][|", RESOURCEFILE, "][ EXIT ]"); goto punt; } needscan = TRUE; redomul: ARROW_MOUSE; /* display menu bar */ menu_bar(menuobj, 1); running = TRUE; while (running) { domulti(); } /* * If nothing has been done to the hard disks * then just get out, back to the desktop. * Otherwise reboot the system. */ menu_bar(menuobj, 0); /* erase menu bar */ punt: wind_delete(wi_handle); v_clsvwk(handle); appl_exit(); }
/* * Top level; * we get control from the desktop. * */ main() { long *cookptr; /* pointer to AHDI cookie */ running = TRUE; appl_init(); phys_handle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox); wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); open_vwork(); wi_handle = wind_create(WI_KIND, xdesk, ydesk, wdesk, hdesk); hidden = FALSE; butdown = TRUE; if (!rsrc_load(RESOURCEFILE)) { errs("[2][", RESOURCEFILE, "][ OK ]"); goto punt; } graf_mouse(ARROW, 0L); /* display menu bar */ if (getalladdr() == ERROR) { errs("[2][", RESOURCEFILE, "][ OK ]"); goto punt; } ostack = Super(NULL); /* Superuser mode for low memory access */ pun = (int *)(*(long *)PUNPTR); Super(ostack); /* back to User mode */ if (!pun || !(*pun)) { /* if no unit exists */ err(noavdrv); /* return error */ goto punt; } cookptr = (long *)((char *)pun + 2 + 16 + 16*4); if (*cookptr != AHDI || cookptr != *(long *)(cookptr + 1)) vernum = 0L; else vernum = (int *)(cookptr + 2); menu_bar(menubar, 1); /* put up menu bar */ while (running) domulti(); menu_bar(menubar, 0); /* erase menu bar */ punt: wind_delete(wi_handle); /* close window on screen */ v_clsvwk(handle); /* close virtual workstation */ appl_exit(); /* exit application HDX */ Pterm(0); /* terminate process */ }
/** * Handle an menu item event */ int deskmenu_dispatch_item(short title, short item) { int i=0; int retval = 0; OBJECT * menu_root = deskmenu_get_obj_tree(); menu_tnormal(menu_root, item, 1); menu_tnormal(menu_root, title, 1); menu_bar(menu_root, 1); // legacy code, is this sensible?: /* while( gw ) { window_set_focus( gw, WIDGET_NONE, NULL ); gw = gw->next; } */ while (menu_evnt_tbl[i].rid != -1) { if (menu_evnt_tbl[i].rid == item) { if (menu_evnt_tbl[i].menu_func != NULL) { menu_evnt_tbl[i].menu_func(item, title, NULL); } break; } i++; } return(retval); }
/* -------------------------------- */ void install_prg(void) { register int i; ap_id = appl_init(); open_vwork(); kb_rec = (int *)Iorec(1); for (i = 0; i < 5; i++) old_kb[i] = kb_rec[i + 2]; kb_rec[2] = 10; kb_rec[3] = 0; kb_rec[4] = 0; kb_rec[5] = 2; kb_rec[6] = 8; rsrc_load("M_TEXT.RSC"); rsrc_gaddr(ROOT, TXT_MENU, &menu_adr); graf_mouse(ARROW, 0L); init_mtext(); init_rsc(); menu_bar(menu_adr, TRUE); }
GemTerm() { #ifndef SAI /* * Remove the menu bar */ menu_bar( gl_menu, FALSE ); #endif SAI /* * Free up the memory used by the resource */ rsrc_free(); /* * Close the workstation */ v_clsvwk( vdi_handle ); /* * And terminate the application */ appl_exit(); }
void LLWidgetReg::initClass(bool register_widgets) { // Only need to register if the Windows linker has optimized away the // references to the object files. if (register_widgets) { LLDefaultChildRegistry::Register<LLButton> button("button"); LLDefaultChildRegistry::Register<LLMenuButton> menu_button("menu_button"); LLDefaultChildRegistry::Register<LLCheckBoxCtrl> check_box("check_box"); LLDefaultChildRegistry::Register<LLComboBox> combo_box("combo_box"); LLDefaultChildRegistry::Register<LLFilterEditor> filter_editor("filter_editor"); LLDefaultChildRegistry::Register<LLFlyoutButton> flyout_button("flyout_button"); LLDefaultChildRegistry::Register<LLContainerView> container_view("container_view"); LLDefaultChildRegistry::Register<LLIconCtrl> icon("icon"); LLDefaultChildRegistry::Register<LLLoadingIndicator> loading_indicator("loading_indicator"); LLDefaultChildRegistry::Register<LLLineEditor> line_editor("line_editor"); LLDefaultChildRegistry::Register<LLMenuItemSeparatorGL> menu_item_separator("menu_item_separator"); LLDefaultChildRegistry::Register<LLMenuItemCallGL> menu_item_call_gl("menu_item_call"); LLDefaultChildRegistry::Register<LLMenuItemCheckGL> menu_item_check_gl("menu_item_check"); LLDefaultChildRegistry::Register<LLMenuGL> menu("menu"); LLDefaultChildRegistry::Register<LLMenuBarGL> menu_bar("menu_bar"); LLDefaultChildRegistry::Register<LLContextMenu> context_menu("context_menu"); LLDefaultChildRegistry::Register<LLMultiSlider> multi_slider_bar("multi_slider_bar"); LLDefaultChildRegistry::Register<LLMultiSliderCtrl> multi_slider("multi_slider"); LLDefaultChildRegistry::Register<LLPanel> panel("panel", &LLPanel::fromXML); LLDefaultChildRegistry::Register<LLLayoutStack> layout_stack("layout_stack"); LLDefaultChildRegistry::Register<LLProgressBar> progress_bar("progress_bar"); LLDefaultChildRegistry::Register<LLRadioGroup> radio_group("radio_group"); LLDefaultChildRegistry::Register<LLSearchEditor> search_editor("search_editor"); LLDefaultChildRegistry::Register<LLScrollContainer> scroll_container("scroll_container"); LLDefaultChildRegistry::Register<LLScrollingPanelList> scrolling_panel_list("scrolling_panel_list"); LLDefaultChildRegistry::Register<LLScrollListCtrl> scroll_list("scroll_list"); LLDefaultChildRegistry::Register<LLSlider> slider_bar("slider_bar"); LLDefaultChildRegistry::Register<LLSliderCtrl> slider("slider"); LLDefaultChildRegistry::Register<LLSpinCtrl> spinner("spinner"); LLDefaultChildRegistry::Register<LLStatBar> stat_bar("stat_bar"); //LLDefaultChildRegistry::Register<LLPlaceHolderPanel> placeholder("placeholder"); LLDefaultChildRegistry::Register<LLTabContainer> tab_container("tab_container"); LLDefaultChildRegistry::Register<LLTextBox> text("text"); LLDefaultChildRegistry::Register<LLTimeCtrl> time("time"); LLDefaultChildRegistry::Register<LLTextEditor> simple_text_editor("simple_text_editor"); LLDefaultChildRegistry::Register<LLUICtrl> ui_ctrl("ui_ctrl"); LLDefaultChildRegistry::Register<LLStatView> stat_view("stat_view"); //LLDefaultChildRegistry::Register<LLUICtrlLocate> locate("locate"); //LLDefaultChildRegistry::Register<LLUICtrlLocate> pad("pad"); LLDefaultChildRegistry::Register<LLViewBorder> view_border("view_border"); } // *HACK: Usually this is registered as a viewer text editor LLDefaultChildRegistry::Register<LLTextEditor> text_editor("text_editor"); }
/** * Uninstall the desktop menu */ void deskmenu_destroy(void) { int i; /* Remove menu from desktop: */ menu_bar(h_gem_menu, MENU_REMOVE); /* Free modified menu titles: */ i=0; while(menu_evnt_tbl[i].rid != -1) { if( menu_evnt_tbl[i].menustr != NULL ) free(menu_evnt_tbl[i].menustr); i++; } }
launcher_main(void) #endif { OBJECT * desktop_bg; OBJECT * menu; int ap_id; /* Pdomain (1); FIXME decide where to put this */ /* Get application id */ ap_id = appl_init(); /* Fix resource data */ rsrc_rcfix(launch); /* Get address of desktop background */ rsrc_gaddr(R_TREE, DESKBG, &desktop_bg); /* Set desktop background */ wind_set(0, WF_NEWDESK, HI_WORD(desktop_bg), LO_WORD(desktop_bg), 0, 0); /* Get address of the menu */ rsrc_gaddr(R_TREE, MENU, &menu); /* Install menu */ menu_bar(menu, MENU_INSTALL); /* Register launcher as "oAESis" */ menu_register(ap_id, " oAESis"); graf_mouse(ARROW, 0L); start_programs(); updatewait(); appl_exit(); return 0; }
BOOLEAN rsrc_init( void ) { if( rsrc_load( "xftest.rsc" ) ) { rsrc_gaddr( R_TREE, DIAL, &tree ); TedText(EDIT1) = edit1; TedText(EDIT2) = edit2; TedText(EDIT3) = edit3; rsrc_gaddr( R_TREE, MENU, &menu ); menu_bar( menu, TRUE ); graf_mouse( ARROW, NULL ); return TRUE; /* Resource is okay */ } return FALSE; }
int execute(char program[MAXSTRING],char command[MAXSTRING],int multi) { char comstring[MAXSTRING+1]; if(!multi) { // hide_dialog(NULL); strncpy(comstring," ",MAXSTRING); comstring[MAXSTRING]=EOL; strncat(comstring,command,MAXSTRING); comstring[MAXSTRING]=EOL; Pexec(0,program,comstring,NULL); menu_bar(menu_tree, 1); redraw_window(NULL); // unhide_dialog(NULL); } Return TRUE; }
static boolean init(void) { int error; char *fullname; xw_get(NULL, WF_WORKXYWH, &screen_info.dsk); if ((fullname = xshel_find(optname, &error)) != NULL) { free(optname); optname = fullname; } else { if ((error == EFILNF) && ((fullname = x_fullname(optname, &error)) != NULL)) { free(optname); optname = fullname; } if (error != 0) { xform_error(error); return TRUE; } } if (dsk_init() == TRUE) return TRUE; ft_init(); icnt_init(); app_init(); prg_init(); wd_init(); menu_bar(menu, 1); x_setpath("\\"); load_options(); return FALSE; }
//******************************************************************** // 1998-09-16 - Created //******************************************************************** // deinit: De-inits everything from memory de-allocations to closing // files and windows //******************************************************************** void deinit(void) { #ifdef LOGGING Log(LOG_FUNCTION,"deinit()\n"); #endif // close_main_win(); deinit_graph(); #ifdef USE_MENU menu_bar(menu_tree,0); #endif if(icons) rsrc_free(); if(ap_id!=NOLL) appl_exit(); }
/* MAIN() * ================================================================ */ VOID main( VOID ) { WORD button; BOOLEAN done; OBJECT *tree; appl_init(); phys_handle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox ); open_vwork(); graf_mouse( ARROW, 0L ); rsrc_load( "DEMO.RSC" ); rsrc_gaddr( 0, MENUBAR, &ad_menubar ); rsrc_gaddr( 0, ATREE, &ad_tree ); rsrc_gaddr( 0, FONTTREE, &ad_fonts ); rsrc_gaddr( 0, STREE, &ad_style ); rsrc_gaddr( 0, POSTREE, &ad_position ); rsrc_gaddr( 0, CTREE, &ad_color ); rsrc_gaddr( 0, PTREE, &ad_pattern ); rsrc_gaddr( 0, MTREE, &ad_modem ); rsrc_gaddr( 0, BAUDRATE, &ad_baudrate ); rsrc_gaddr( 0, PARTREE, &ad_parity ); rsrc_gaddr( 0, BITTREE, &ad_bittree ); rsrc_gaddr( 0, STOPTREE, &ad_stoptree ); rsrc_gaddr( 0, PORTTREE, &ad_porttree ); rsrc_gaddr( 0, FLOWTREE, &ad_flowtree ); rsrc_gaddr( 0, LTREE, &ad_list ); rsrc_gaddr( 0, TOOLBOX, &ad_tools ); rsrc_gaddr( 0, BLANK, &ad_blank ); rsrc_gaddr( 0, TOOLBOX2, &ad_box2 ); rsrc_gaddr( 0, TOOLBAR, &ad_box3 ); rsrc_gaddr( 0, FONT2, &ad_font2 ); /* Attach all Submenus that are being attached */ AttachMenus(); /* CheckMark the Current Menu Items in their respective menus */ menu_icheck( ad_baudrate, CurBaudRate, 1 ); menu_icheck( ad_parity, CurParity, 1 ); menu_icheck( ad_bittree, CurBits, 1 ); menu_icheck( ad_stoptree, CurStopBits, 1 ); menu_icheck( ad_porttree, CurPort, 1 ); menu_icheck( ad_flowtree, CurFlow, 1 ); menu_icheck( ad_style, CurStyle, 1 ); menu_icheck( ad_position, CurPos, 1 ); menu_icheck( ad_fonts, CurFonts, 1 ); menu_icheck( ad_font2, CurFont2, 1 ); /* display menubar stuff here */ menu_bar( ad_menubar, TRUE ); /* initialize windows */ wind_get( 0, WF_FULLXYWH, &desk.g_x, &desk.g_y, &desk.g_w, &desk.g_h ); cur_tree = ad_tools; menu_flag = TRUE; /* Set Toggle Flags */ SubFlag = TRUE; ToolFlag = TRUE; CurRect.g_x = desk.g_x; CurRect.g_y = desk.g_y; CurRect.g_w = 320; CurRect.g_h = 200; InitObjects(); InitWindow(); menu_ienable( ad_menubar, FOPEN, 0 ); menu_ienable( ad_menubar, FCLOSE, 1 ); done = FALSE; do { evnt_mesag( msg ); wind_update( BEG_UPDATE ); if( msg[0] == MN_SELECTED ) { /* msg[7] is the parent of FQUIT - which the user can't know */ ptr = ( OBJECT **)&msg[5]; if( *ptr == ad_menubar ) { switch( msg[4] ) { case FQUIT: button = form_alert( 1, "[1][ | EXIT PROGRAM? ][OK|Cancel]"); if( button == 1 ) done = TRUE; break; case ABOUTX: execform( ad_tree, 0 ); break; case PHONE: do_modem(); break; case TABOUT: /* Enable, Disable About PLUS change TEXT */ menu_flag ^= 1; menu_ienable( ad_menubar, ABOUTX, menu_flag ); menu_text( ad_menubar, TABOUT, TextAbout[ menu_flag ] ); if( menu_flag ) menu_text( ad_menubar, ABOUTX, " About Demo... " ); else menu_text( ad_menubar, ABOUTX, " Disabled... " ); break; case TSUB: /* Enable/Disable all Submenus */ SubFlag ^= 1; menu_text( ad_menubar, TSUB, TextSubMenu[ SubFlag ] ); if( SubFlag ) AttachMenus(); else DetachMenus(); break; case SLISTS: DoList(); /* Do A Drop Down List Dialog */ break; case TOOLFLAG: /* Enable/Disable ToolBox */ ToolFlag ^= 1; menu_text( ad_menubar, TOOLFLAG, TextToolBox[ ToolFlag ] ); if( ToolFlag ) { *( (LONG *)&tree_data[0] ) = ( LONG )cur_tree; wind_set( wid, WF_TOOLBAR, tree_data[0], tree_data[1], dummy, dummy ); } else wind_set( wid, WF_TOOLBAR, 0, 0, dummy, dummy ); break; case SWITCH: /* Switch ToolBoxes */ if( cur_tree == ad_tools ) cur_tree = ad_box2; else if( cur_tree == ad_box2 ) { cur_tree = ad_box3; ActiveTree( ad_fonts ); textptr = ObString( CurFonts ); strncpy( &tbuff[0], &textptr[1], 28 ); ActiveTree( ad_box3 ); TedText( FBUTT1 ) = &tbuff[0]; } else cur_tree = ad_tools; *( (LONG *)&tree_data[0] ) = ( LONG )cur_tree; ToolFlag = TRUE; menu_text( ad_menubar, TOOLFLAG, TextToolBox[ ToolFlag ] ); wind_set( wid, WF_TOOLBAR, tree_data[0], tree_data[1], dummy, dummy ); break; case FCLOSE: /* close Window */ if( wid ) { wind_get( wid, WF_CURRXYWH, &CurRect.g_x, &CurRect.g_y, &CurRect.g_w, &CurRect.g_h ); wind_close( wid ); wind_delete( wid ); wid = 0; menu_ienable( ad_menubar, FCLOSE, 0 ); menu_ienable( ad_menubar, FOPEN, 1 ); } break; case FOPEN: /* open Window */ if( !wid ) { InitWindow(); menu_ienable( ad_menubar, FOPEN, 0 ); menu_ienable( ad_menubar, FCLOSE, 1 ); } break; default: break; } } /* MENU SELECTED -> Font Style Menu Clicked on as a SUBMENU from the Menubar*/ if( *ptr == ad_style ) { menu_icheck( ad_style, CurStyle, 0 ); /* Turn OFF Old Checkmark */ menu_icheck( ad_style, msg[4], 1 ); /* Turn ON New CheckMark */ CurStyle = msg[4]; /* Update Current Var */ menu_istart( 1, ad_style, ROOT, CurStyle ); /* Reset Starting Position*/ } /* MENU SELECTED -> Font Position Clicked on as a SUBMENU from the menubar */ if( *ptr == ad_position ) { menu_icheck( ad_position, CurPos, 0 ); menu_icheck( ad_position, msg[4], 1 ); CurPos = msg[4]; menu_istart( 1, ad_position, ROOT, CurPos ); } /* MENU SELECTED -> Fonts Menu Clicked on as a SUBMENU from the menubar */ if( *ptr == ad_fonts ) { menu_icheck( ad_fonts, CurFonts, 0 ); menu_icheck( ad_fonts, msg[4], 1 ); CurFonts = msg[4]; menu_istart( 1, ad_fonts, ROOT, CurFonts ); } menu_tnormal( ad_menubar, msg[3], TRUE ); } if( msg[0] != MN_SELECTED ) { switch( msg[0] ) { case WM_FULLED: DoFull( msg[3] ); break; case WM_REDRAW: DoRedraw( msg ); break; case WM_ARROWED: case WM_HSLID: case WM_VSLID: break; case WM_MOVED: if( msg[3] == wid ) { wind_set( wid, WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7] ); } break; case WM_TOPPED: if( msg[3] == wid ) { wind_set( wid, WF_TOP ); } break; case WM_CLOSED: if( msg[3] == wid ) { wind_get( wid, WF_CURRXYWH, &CurRect.g_x, &CurRect.g_y, &CurRect.g_w, &CurRect.g_h ); wind_close( wid ); wind_delete( wid ); wid = 0; menu_ienable( ad_menubar, FCLOSE, 0 ); menu_ienable( ad_menubar, FOPEN, 1 ); } break; case WM_SIZED: DoSizer( msg ); break; case WM_TOOLBAR: if( msg[3] == wid ) { /* Button Handling for ToolBox #1 */ if( cur_tree == ad_tools ) { switch( msg[4] ) { case T1B1: button = B1B1; break; case T1B2: button = B1B2; break; case T1B3: button = B1B3; break; case T1B4: button = B1B4; break; case T1B5: button = B1B5; break; } } /* Button Handling for TOOLBOX 2 */ if( cur_tree == ad_box2 ) { switch( msg[4] ) { case T2I1: button = T2B1; break; case T2I2: button = T2B2; break; case T2I3: button = T2B3; break; case T2I4: button = T2B4; break; case T2I5: button = T2B5; break; } } /* Word Processing Tree */ if( cur_tree == ad_box3 ) { switch( msg[4] ) { case FBUTT1: case FBUTT2: DoFonts(); break; default: break; } } if( cur_tree != ad_box3 ) { if( cur_tree[ button ].ob_state & SELECTED ) cur_tree[ button ].ob_state &= ~SELECTED; else cur_tree[ button ].ob_state |= SELECTED; objc_offset( cur_tree, button, &r.g_x, &r.g_y ); r.g_x -= 2; r.g_y -= 2; r.g_w = cur_tree[ button ].ob_width + 4; r.g_h = cur_tree[ button ].ob_height + 4; do_redraw( cur_tree, button, &r ); } } /* end of msg[3] == wid */ break; case WM_ICONIFY: if( msg[3] == wid ) wind_set( msg[3], WF_ICONIFY, msg[4], msg[5], msg[6], msg[7] ); break; case WM_UNICONIFY: if( msg[3] == wid ) wind_set( msg[3], WF_UNICONIFY, msg[4], msg[5], msg[6], msg[7] ); break; default: break; } /* end of switch */ } wind_update( END_UPDATE ); }while( !done ); if( wid > 0 ) wind_delete( wid ); menu_bar( ad_menubar, FALSE ); graf_mouse( ARROW, 0L ); rsrc_free(); close_vwork(); appl_exit(); }
int main(void) { int error; #if _MINT_ /* HR 151102 */ have_ssystem = Ssystem(-1, 0, 0) == 0; /* HR 151102: use Ssystem where possible */ mint = (find_cookie('MiNT') == -1) ? FALSE : TRUE; magx = (find_cookie('MagX') == -1) ? FALSE : TRUE; /* HR 151102 */ geneva = (find_cookie('Gnva') == -1) ? FALSE : TRUE; /* DjV 035 080203 */ mint |= magx; /* Quick & dirty */ if (mint) { Psigsetmask(0x7FFFE14EL); Pdomain(1); } #endif x_init(); if ((ap_id = appl_init()) < 0) return -1; if (_GemParBlk.glob.version >= 0x400) { shel_write(9, 1, 0, NULL, NULL); menu_register(ap_id, " Tera Desktop"); } if (rsrc_load(RSRCNAME) == 0) form_alert(1, msg_resnfnd); else { if ((error = init_xdialog(&vdi_handle, malloc, free, "Tera Desktop", 1, &nfonts)) < 0) xform_error(error); else { init_vdi(); rsc_init(); if (((max_w / screen_info.fnt_w) < 40) || ((max_h / screen_info.fnt_h) < 25)) alert_printf(1, MRESTLOW); else { if ((error = alloc_global_memory()) == 0) { if (exec_deskbat() == FALSE) { if (load_icons() == FALSE) { if (init() == FALSE) { graf_mouse(ARROW, NULL); evntloop(); wd_del_all(); menu_bar(menu, 0); xw_close_desk(); } free_icons(); /* HR 151102 */ wind_set(0, WF_NEWDESK, NULL, 0); dsk_draw(); } } Mfree(global_memory); } else xform_error(error); } if (vq_gdos() != 0) vst_unload_fonts(vdi_handle, 0); exit_xdialog(); } rsrc_free(); } /* DjV 013 030103 100203 ---vvv--- */ /* * The following section handles system shutdown and resolution change * If a resolution change is required, shutdown is performed first * If only shutdown s required, system will reset at the end. */ /* appl_exit(); */ if ( chrez || shutdown ) /* If change resolution or shutdown ... */ { /* Tell all applications which would understand it to end */ quit = shel_write ( 4, 2, 0, NULL, NULL ); /* complete shutdown */ evnt_timer( 3000, 0 ); /* Wait a bit? */ /* /* * In Mint, must tell all proceseses to terminate nicely ? * but this is only in this group ? What to do? */ Pkill(0, SIGTERM); evnt_timer(3000, 0); /* Wait a bit? */ */ /* * After all applications have hopefully been closed, * change the screen resolution if needed; * else- reset the computer */ if ( chrez ) get_set_video(2); #if 1 else #if _MINT_ if (!mint) /* HR 230203: Dont reset under MiNT or MagiC !!!!! */ #endif { /* Perform a reset here */ #if 0 /* with warnings */ long *m; /* to memory locations */ long rv; /* reset vector */ Super ( 0L ); /* Supervisor; old stack won't be needed again */ *(m = 0x420L) = 0L; /* memctrl */ *(m = 0x43aL) = 0L; /* memval2 */ *(m = 0x426L) = 0L; /* resvalid */ m = *( m = 0x4f2 ); /* to start of OS */ rv = *(m + 4); /* to routine that handles the reset */ Supexec(rv); /* execute it */ #else /* HR: without warnings */ long (*rv)(); /* reset vector */ Super ( 0L ); /* Supervisor; old stack won't be needed again */ memctrl = 0L; memval2 = 0L; resvalid = 0L; (long)rv = *((long *)os_start + 4); /* routine that handles the reset */ Supexec(rv); /* execute it */ #endif } #endif }
/* *** Beim GEM anmelden *** */ int initGEM(void) { int rgb[3]; int work_in[12], work_out[57]; /* VDI-Felder */ int i, ap_id; ap_id=appl_init(); if(ap_id==-1) return(-1); if(aesversion>=0x400) /* Wenn m�glich einen Namen anmelden */ menu_register(ap_id, " STed\0\0\0\0"); graf_mouse(ARROW, 0L); /* Maus als Pfeil */ if( !rsrc_load("sted.rsc") ) { form_alert(1, "[3][Could not|load <sted.rsc>][Cancel]"); appl_exit(); return(-1); } rsrc_gaddr(R_TREE, MAINMENU, &menu); /* Adresse holen */ rsrc_gaddr(R_TREE, ABOUTSED, &aboutdlg); rsrc_gaddr(R_TREE, LDATDIA, &lvdatdlg); #ifdef RESTRIC_STED lvdatdlg[LVLTYP].ob_flags |= HIDETREE; lvdatdlg[LVLTYP].ob_flags &= ~EDITABLE; lvdatdlg[LVLTYPT1].ob_flags |= HIDETREE; lvdatdlg[LVLTYPT2].ob_flags |= HIDETREE; lvdatdlg[LVLID].ob_flags |= HIDETREE; lvdatdlg[LVLID].ob_flags &= ~EDITABLE; lvdatdlg[LVLIDT1].ob_flags |= HIDETREE; #endif wind_get(0, WF_WORKXYWH, &deskx, &desky, &deskw, &deskh); /* Desktopgr��e */ vhndl=graf_handle(&i, &i, &i, &i); for(i=0; i<10; i++) work_in[i]=1; work_in[10]=2; v_opnvwk(work_in, &vhndl, work_out); /* VDI-Station �ffnen */ vq_extnd(vhndl, 1, work_out); bipp=work_out[4]; /* Bits pro Bitplane ermitteln */ if(bipp>8) { form_alert(1, "[3][Sorry, STed only works|in 16 and 256 colors!][Ok]"); v_clsvwk(vhndl); rsrc_free(); appl_exit(); return(-1); } menu_bar(menu, 1); /* Men� darstellen */ for(i=0; i<15; i++) /* Alte Farben sichern */ { vq_color(vhndl, i, 1, rgb); oldpal[i][0]=rgb[0]; oldpal[i][1]=rgb[1]; oldpal[i][2]=rgb[2]; } setpal(newpal); /* Neue Farben setzen */ return(0); }
/* ----------------- */ show_font() { int off, key, w, h, ww, wh, dummy; register int i, hg, eo; OBJECT *show_form; int sx, sy, sw, sh, c_xy[4], eff = NORMAL, f_sld; int sk = 0; menu_bar(menu_adr, FALSE); store_char(); inst_font(&show_head); vsf_interior(vdi_handle, 0); for (i = 0; i < 14 && show_head.skewmask != skew[i]; i++); if (i < 14) sk = i; else sk = 6; rsrc_gaddr(ROOT, SHW_FLD, &show_form); form_center(show_form, &sx, &sy, &sw, &sh); strcpy(show_form[SHW_NAM].ob_spec, font_back[FONTNAME].ob_spec); strcpy(show_form[SHW_DEF].ob_spec, font_back[CHAR_DEF].ob_spec); show_form[BOLD].ob_state &= ~SELECTED; show_form[ITALIC].ob_state &= ~SELECTED; show_form[LIGHT].ob_state &= ~SELECTED; show_form[OUTL].ob_state &= ~SELECTED; show_form[UNDERL].ob_state &= ~SELECTED; show_form[KR_UP].ob_state |= DISABLED; show_form[KR_DWN].ob_state |= DISABLED; show_form[UL_UP].ob_state |= DISABLED; show_form[UL_DWN].ob_state |= DISABLED; hg = show_head.top * 2; make_rasc((long)hg, 100L, ((TEDINFO *)show_form[SHW_TG].ob_spec)->te_ptext); off = akt_char; set_aktshw(&f_sld, off, show_form); make_rasc((long)show_head.formheight, 10L, show_form[SHW_HGHT].ob_spec); objc_draw(show_form, ROOT, MAX_DEPTH, sx, sy, sw, sh); objc_offset(show_form, SHW_WIND, &c_xy[0], &c_xy[1]); c_xy[2] = c_xy[0] + show_form[SHW_WIND].ob_width - 1; c_xy[3] = c_xy[1] + show_form[SHW_WIND].ob_height - 1; do { make_fontscreen(off, hg, c_xy, eff); eo = form_do(show_form, 0) & 0x7FFF; if (!(show_form[eo].ob_state & DISABLED)) switch(eo) { case BOLD: if (show_form[BOLD].ob_state & SELECTED) eff |= 1; else eff &= ~1; break; case LIGHT: if (show_form[LIGHT].ob_state & SELECTED) eff |= 2; else eff &= ~2; break; case ITALIC: if (show_form[ITALIC].ob_state & SELECTED) { eff |= 4; show_form[KR_UP].ob_state &= ~DISABLED; show_form[KR_DWN].ob_state &= ~DISABLED; } else { eff &= ~4; show_form[KR_UP].ob_state |= DISABLED; show_form[KR_DWN].ob_state |= DISABLED; } objc_draw(show_form, SHW_PARA, MAX_DEPTH, sx, sy, sw, sh); break; case UNDERL: if (show_form[UNDERL].ob_state & SELECTED) { eff |= 8; show_form[UL_UP].ob_state &= ~DISABLED; show_form[UL_DWN].ob_state &= ~DISABLED; } else { eff &= ~8; show_form[UL_UP].ob_state |= DISABLED; show_form[UL_DWN].ob_state |= DISABLED; } objc_draw(show_form, SHW_PARA, MAX_DEPTH, sx, sy, sw, sh); break; case OUTL: if (show_form[OUTL].ob_state & SELECTED) eff |= 16; else eff &= ~16; break; case TG_UP: if (hg < show_head.top * 2) do { hg++; }while(hg == show_head.top); make_rasc((long)hg, 100L, ((TEDINFO *)show_form[SHW_TG].ob_spec)->te_ptext); objc_draw(show_form, SHW_TG, MAX_DEPTH, sx, sy, sw, sh); break; case TG_DWN: if (hg > 3) do { hg--; }while(hg == show_head.top); make_rasc((long)hg, 100L, ((TEDINFO *)show_form[SHW_TG].ob_spec)->te_ptext); objc_draw(show_form, SHW_TG, MAX_DEPTH, sx, sy, sw, sh); break; case UL_DWN: if (show_head.underlinemask < 10) show_head.underlinemask++; break; case UL_UP: if (show_head.underlinemask > 0) show_head.underlinemask--; break; case KR_DWN: if (sk < 13) show_head.skewmask = skew[++sk]; break; case KR_UP: if (sk > 0) show_head.skewmask = skew[--sk]; break; case SHW_UP: if (off > 0) off--; set_aktshw(&f_sld, off, show_form); objc_draw(show_form, SHW_CBKG, MAX_DEPTH, sx, sy, sw, sh); objc_draw(show_form, SHW_INFO, MAX_DEPTH, sx, sy, sw, sh); break; case SHW_DWN: if (off < 255) off++; set_aktshw(&f_sld, off, show_form); objc_draw(show_form, SHW_CBKG, MAX_DEPTH, sx, sy, sw, sh); objc_draw(show_form, SHW_INFO, MAX_DEPTH, sx, sy, sw, sh); break; default: show_form[eo].ob_state &= ~SELECTED; } }while(eo != SHW_END); deinst_font(); menu_bar(menu_adr, TRUE); objc_change(font_back, MARKER, 0, fx, fy, fw, fh, NORMAL, TRUE); form_dial(FMD_FINISH, 0, 0, 0, 0, sx, sy, sw, sh); show_character(); show_ccharacter(); draw_edit(); objc_change(font_back, MARKER, 0, fx, fy, fw, fh, SELECTED, TRUE); }
/* menu_owner(): return the AES id of the current menu owner, or -1 if none. *----------------------------------------------------------------------- * On AES < 4.0, returns GL_APID if your menu is showing, else AESERR (-1). * On AES >= 4.0, returns the result of menu_bar(-1,NULL): * the apid of the current menu owner, or AESERR (-1). */ int menu_owner(void) { if (isAES4()) return menu_bar(NULL,-1); return (showing) ? GL_APID : AESERR; }
void get_set_video (int set){ /* 0=get, 1=set, 2=set & change rez */ long #ifdef _OVSCAN s, /* sup.stack p. */ #endif logb, /* logical screen base */ phyb; /* physical screen base */ #ifdef _OVSCAN char *acia; static int ov_max_h, ov_max_w; int std_x[4] = {320,640,1280,0}; int std_y[4] = {200,400,800,0}; int idi; #endif /* Where is the screen ? */ logb = xbios(3); /* Logbase(); */ phyb = xbios(2); /* Physbase(); */ if ( set == 0 ){ /* get data */ /* Find about video hardware (shifter; will be 0xffffffff without cookie */ vdo = find_cookie( '_VDO' ); /* Try to find out about a couple of overscan types */ #ifdef _OVSCAN if ( ( (over = find_cookie('OVER')) != - 1 ) || ( (over = find_cookie('Lace')) != - 1 ) ) { ovrstat = 0; for ( idi = 0; idi < 3; idi++ ) if ( max_h > std_y[idi] && max_h < std_y[idi + 1] ) { ov_max_w = max_w; ov_max_h = max_h; ovrstat = 1; break; } if ( ovrstat != 0 ) options.V2_2.vprefs |= VO_OVSCAN; else options.V2_2.vprefs &= ~VO_OVSCAN; } else over = 0xffffffffL; #endif /* Get current blitter state; insert into options */ if ( get_tosversion() >= 0x104 ) bltstat = Blitmode(-1); /* Function known only to tos >= 1.4 ? */ else bltstat = 0; if ( bltstat & 0x0001 ) options.V2_2.vprefs |= VO_BLITTER; else options.V2_2.vprefs &= ~VO_BLITTER; /* Which is the current standard resolution ? */ currez = xbios(4); /* Getrez() */ options.V2_2.vrez = currez; } else /* set data */ { /* Set blitter, if present */ if ( bltstat & 0x0002 ) { if ( options.V2_2.vprefs & VO_BLITTER ) bltstat |= 0x0001; else bltstat &= ~0x0001; bltstat = Blitmode ( bltstat ); } #ifdef _OVSCAN /* * Set overscan (Lacescan, in fact) * that which is below is ok but not enough !!!! * therefore disabled for the time being */ if ( (over != 0xffffffffL ) && ( (vprefsold^options.V2_2.vprefs) && VO_OVSCAN) ) { menu_bar ( menu, 0 ); s = Super (0L ); (long)acia = 0xFFFC00L; /* address of the acia chip reg HR 240203 (long) */ if ( options.V2_2.vprefs & VO_OVSCAN ) { *acia = 0xD6; /* value for the acia reg- switch overscan ON */ ovrstat = 1; max_h = ov_max_h; max_w = ov_max_w; } else { *acia = 0x96; /* value for the acia reg- switch overscan OFF */ ovrstat = 0; max_w = std_x[idi]; max_h = std_y[idi]; } /* * An attempt to change resolution (to the same one) will * provoke Lacescan to adapt */ xbios(5, logb, phyb, currez); /* Setscreen (logb,phyb,currez); */ Super ( (void *) s ); wind_set(0, WF_NEWDESK, desktop, 0); /* * For some reason desktop doesn't get redrawn correctly here * after overstat switch unless menu_bar is called TWICE * (possibly at first call it is too long and corrupts * part of the screen?) */ menu_bar(menu, 1); dsk_draw(); menu_bar(menu, 1); /* wd_attrib(); */ wd_fields(); /* HR 050303 */ } #endif /* Change resolution */ /* xbios(...) produces slightly smaller code */ if ( set > 1 ) { /* * This will actually (almost) reset the computer */ shel_write( 5, currez + 2, 0, NULL, NULL ); /* DjV 007 110203 */ /* DjV 007 290103: is no good, so disabled for the time being */ xbios(5, logb, phyb, currez); /* Setscreen (logb,phyb,currez); */ } } }
void QueryEditor::create_ui() { Wait_Cursor bob; XmStringLocalized mtfstring; String string; KeySym mnemonic; f_shell = WTopLevelShell(window_system().toplevel(), WPopup, "query_editor"); window_system().register_shell (&f_shell); string = CATGETS(Set_QueryEditor, 1, "Dtinfo: Query Editor"); XtVaSetValues((Widget)f_shell, XmNtitle, string, NULL); // Main form and menu bar. WXmForm form (f_shell, "form" ); WXmMenuBar menu_bar (form, "menu_bar" ); WXmPulldownMenu scope_menu (form, "scope_menu"); Arg args[1]; int n = 0; XtSetArg(args[n], XmNsubMenuId, (Widget) scope_menu); n++; f_scope_option = WXmOptionMenu (form, "scope_option", AM, args, n); mtfstring = CATGETS(Set_AgentLabel, 212, "Scope Name"); XtVaSetValues(f_scope_option, XmNlabelString, (XmString)mtfstring, NULL); // Menu definitions. how about using AddPushButton (name, obj, fun)?? WXmCascadeButton edit_cascade (menu_bar, "edit", AM); WXmPulldownMenu edit_menu (menu_bar, "edit_menu" ); f_cut_btn = WXmPushButton (edit_menu, "cut", AM); f_copy_btn = WXmPushButton (edit_menu, "copy", AM); f_paste_btn = WXmPushButton (edit_menu, "paste", AM); f_paste_btn = WXmPushButton (edit_menu, "new_term", AM); WXmSeparator group_sep (edit_menu, "group_sep", AM); f_group_btn = WXmPushButton (edit_menu, "group", AM); f_ungroup_btn = WXmPushButton (edit_menu, "ungroup", AM); WXmSeparator undo_sep (edit_menu, "undo_sep", AM); f_undo_btn = WXmPushButton (edit_menu, "undo", AM); f_redo_btn = WXmPushButton (edit_menu, "redo", AM); mtfstring = CATGETS(Set_AgentLabel, 16, "Edit"); mnemonic = *CATGETS(Set_AgentLabel, 17, "E"); XtVaSetValues(edit_cascade, XmNlabelString, (XmString)mtfstring, XmNmnemonic, mnemonic, NULL); mtfstring = CATGETS(Set_AgentLabel, 224, "Cut"); XtVaSetValues(f_cut_btn, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 18, "Copy"); XtVaSetValues(f_copy_btn, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 225, "Paste"); XtVaSetValues(f_paste_btn, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 226, "Group"); XtVaSetValues(f_group_btn, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 227, "Ungroup"); XtVaSetValues(f_ungroup_btn, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 228, "Undo"); XtVaSetValues(f_undo_btn, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 229, "Redo"); XtVaSetValues(f_redo_btn, XmNlabelString, (XmString)mtfstring, NULL); // Button area at the bottom WXmForm hform (form, "hform" ); f_hist_prev = WXmArrowButton (hform, "hist_prev", AM); f_hist_next = WXmArrowButton (hform, "hist_next", AM); WXmLabel history (hform, "history", AM); f_search_btn = WXmPushButton (form, "search", AM); WXmPushButton cancel (form, "cancel", AM); WXmPushButton clear (form, "clear", AM); WXmPushButton scope (form, "scope", AM); WXmPushButton help (form, "help", AM); WXmSeparator separator (form, "separator", AM); mtfstring = CATGETS(Set_AgentLabel, 92, "History"); XtVaSetValues(history, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 102, "Search"); XtVaSetValues(f_search_btn, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 231, "Clear All"); XtVaSetValues(clear, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 46, "Scope Editor"); XtVaSetValues(scope, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 12, "Close"); XtVaSetValues(cancel, XmNlabelString, (XmString)mtfstring, NULL); mtfstring = CATGETS(Set_AgentLabel, 48, "Help"); XtVaSetValues(help, XmNlabelString, (XmString)mtfstring, NULL); help_agent().add_activate_help (help, "query_editor_help"); // Main "work" area WXmPanedWindow pane (form, "pane" ); WXmForm qform (pane, "qform" ); WXmLabel qlabel (qform, "qlabel", AM); mtfstring = CATGETS(Set_AgentLabel, 230, "Query"); XtVaSetValues(qlabel, XmNlabelString, (XmString)mtfstring, NULL); f_query_text = WXmScrolledText (qform, "qtext", AM); // f_query_text.SetEditable(False); f_query_area = WXmScrolledWindow (pane, "query_area", AM); XtUnmanageChild (f_query_area.HorizontalScrollBar()); edit_cascade.SubMenuId (edit_menu); // Callbacks ON_ACTIVATE (f_search_btn, search_activate); ON_ACTIVATE (cancel, cancel); ON_ACTIVATE (clear, clear); ON_ACTIVATE (scope, scope); // f_query_text.SetFocusCallback (this, // (WWL_FUN) &QueryEditor::modify_verify); // f_query_text.SetModifyVerifyCallback (this, // (WWL_FUN) &QueryEditor::modify_verify); // Set minimum sizes. qform.Manage(); pane.Manage(); // hform.Manage(); form.DefaultButton (f_search_btn); form.ShadowThickness (0); form.InitialFocus (pane); pane.InitialFocus (f_query_area); qform.PaneMinimum (f_query_text.Height()); form.Manage(); f_shell.Realize(); f_shell.MinWidth (f_shell.Width()); f_shell.MinHeight (f_shell.Height()); ON_DEBUG(printf ("Query for height = %d\n", qform.Height())); //cerr << "Query for height = " << qform.Height() << endl; //#ifndef UseFJMTF #if 1 // Swap the entries in the pane around. Have to do this now // to get initial sizes right. qform.PositionIndex (1); #endif fill_menu(); UAS_SearchScope::request ((UAS_Receiver<ScopeCreated> *) this); UAS_SearchScope::request ((UAS_Receiver<ScopeDeleted> *) this); UAS_SearchScope::request ((UAS_Receiver<ScopeRenamed> *) this); search_scope_mgr().option_menu(this); }
/* MAIN() * ================================================================ */ VOID main( VOID ) { OBJECT *tree; WORD i; WORD button; GRECT box; GRECT xrect; WORD tempx; GRECT rect; MRETS mk; WORD ptitle, pitem, pmenu; OBJECT *ptree; BOOLEAN flag; BOOLEAN done; WORD dummy; WORD xvalue; appl_init(); phys_handle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox ); graf_mouse( ARROW, 0L ); rsrc_load( "TEST.RSC" ); rsrc_gaddr( 0, MENU1, &ad_tree ); rsrc_gaddr( 0, BIGBOX, &ad_box ); rsrc_gaddr( 0, COUNTRY, &ad_country ); rsrc_gaddr( 0, OTHER, &ad_other ); rsrc_gaddr( 0, MENUBAR, &ad_menubar ); rsrc_gaddr( 0, TREE6, &ad_extra ); ad_other[ ROOT ].ob_x = ad_other[ ROOT ].ob_y = 0; #if 0 /* test setting delay and height variables */ TData.Delay = 100L; TData.Drag = 10000L; TData.Delay = 250L; TData.Speed = 0L; TData.Height = 16; menu_settings( 1, &TData ); #endif /* test attaching submenus */ Menu.mn_tree = ad_country; Menu.mn_menu = ROOT; Menu.mn_item = Cur2; Menu.mn_scroll = TRUE; menu_attach( 1, ad_tree, DELETE, &Menu ); Menu.mn_tree = ad_other; Menu.mn_menu = DISNEY; Menu.mn_item = MICKEY; Menu.mn_scroll = FALSE; menu_attach( 1, ad_tree, FLOPPY, &Menu ); Menu.mn_tree = ad_other; Menu.mn_menu = MODEM; Menu.mn_item = Cur3; Menu.mn_scroll = FALSE; menu_attach( 1, ad_country, 5, &Menu ); Menu.mn_tree = ad_other; Menu.mn_menu = DISNEY; Menu.mn_item = MICKEY; Menu.mn_scroll = FALSE; menu_attach( 1, ad_country, 1, &Menu ); Menu.mn_tree = ad_other; Menu.mn_menu = DISNEY; Menu.mn_item = MICKEY; Menu.mn_scroll = FALSE; menu_attach( 1, ad_country, ARKANSAS, &Menu ); Menu.mn_tree = ad_other; Menu.mn_menu = QUOTES; Menu.mn_item = Cur4; Menu.mn_scroll = FALSE; menu_attach( 1, ad_other, 5, &Menu ); Menu.mn_tree = ad_country; Menu.mn_menu = ROOT; Menu.mn_item = Cur2; Menu.mn_scroll = TRUE; menu_attach( 1, ad_menubar, PASTE, &Menu ); Menu.mn_tree = ad_country; Menu.mn_menu = ROOT; Menu.mn_item = Cur2; Menu.mn_scroll = TRUE; menu_attach( 1, ad_menubar, FNEW, &Menu ); menu_icheck( ad_tree, Cur1, 1 ); menu_icheck( ad_country, Cur2, 1 ); menu_icheck( ad_other, Cur3, 1 ); menu_icheck( ad_other, Cur4, 1 ); menu_icheck( ad_other, Cur5, 1 ); ActiveTree( ad_box ); form_center( ad_box, &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h ); ObX( ROOT ) = rect.g_x; xrect = ObRect( TITLE1 ); objc_offset( ad_box, TITLE1, &xrect.g_x, &xrect.g_y ); tempx = xrect.g_x; xrect.g_x = (( xrect.g_x + 7 )/8 ) * 8; rect.g_x = rect.g_x + ( xrect.g_x - tempx ); ObX( ROOT ) = rect.g_x; rect.g_x -= 3; form_dial( FMD_START, rect.g_x, rect.g_y, rect.g_w, rect.g_h, rect.g_x, rect.g_y, rect.g_w, rect.g_h ); objc_draw( ad_box, ROOT, MAX_DEPTH, rect.g_x, rect.g_y, rect.g_w, rect.g_h ); do { ActiveTree( ad_box ); button = form_do( ad_box, 0L ); switch( button ) { case TITLE1: box = ObRect( TITLE1 ); objc_offset( ad_box, TITLE1, &box.g_x, &box.g_y ); Menu.mn_tree = ad_tree; Menu.mn_menu = ROOT; Menu.mn_item = Cur1; Menu.mn_scroll = FALSE; flag = menu_popup( &Menu, box.g_x, box.g_y, &MData ); if( flag ) MenuCheck( MData.mn_tree, MData.mn_menu, MData.mn_item ); break; case TITLE2: box = ObRect( TITLE2 ); objc_offset( ad_box, TITLE2, &box.g_x, &box.g_y ); Menu.mn_tree = ad_country; Menu.mn_menu = ROOT; Menu.mn_item = Cur2; Menu.mn_scroll = TRUE; flag = menu_popup( &Menu, box.g_x, box.g_y, &MData ); if( flag ) MenuCheck( MData.mn_tree, MData.mn_menu, MData.mn_item ); break; case TITLE3: box = ObRect( TITLE3 ); objc_offset( ad_box, TITLE3, &box.g_x, &box.g_y ); Menu.mn_tree = ad_other; Menu.mn_menu = MODEM; Menu.mn_item = Cur3; Menu.mn_scroll = FALSE; flag = menu_popup( &Menu, box.g_x, box.g_y, &MData ); if( flag ) MenuCheck( MData.mn_tree, MData.mn_menu, MData.mn_item ); break; case TITLE4: box = ObRect( TITLE4 ); objc_offset( ad_box, TITLE4, &box.g_x, &box.g_y ); Menu.mn_tree = ad_other; Menu.mn_menu = QUOTES; Menu.mn_item = Cur4; Menu.mn_scroll = FALSE; flag = menu_popup( &Menu, box.g_x, box.g_y, &MData ); if( flag ) MenuCheck( MData.mn_tree, MData.mn_menu, MData.mn_item ); break; default: break; } }while( button != XEXIT ); form_dial( FMD_FINISH, rect.g_x, rect.g_y, rect.g_w, rect.g_h, rect.g_x, rect.g_y, rect.g_w, rect.g_h ); evnt_button( 1, 1, 0, &dummy, &dummy, &dummy, &dummy ); /* display menubar stuff here */ ActiveTree( ad_menubar ); menu_bar( ad_menubar, TRUE ); do { evnt_mesag( msg ); if( msg[0] == MN_SELECTED ) { /* msg[7] is the parent of FQUIT - which the user can't know */ ptr = &msg[5]; if( ( *ptr == ad_menubar ) && ( msg[4] == FQUIT ) ) { button = form_alert( 1, "[1][ | EXIT PROGRAM? ][OK|Cancel]"); if( button == 1 ) done = TRUE; } else MenuCheck( *ptr, msg[7], msg[4] ); menu_tnormal( ad_menubar, msg[3], TRUE ); } }while( !done ); menu_bar( ad_menubar, FALSE ); rsrc_free(); graf_mouse( ARROW, 0L ); appl_exit(); }
void setup_main_window( application_t* app ) { // INIT ONCE all this stuff! INITCOMMONCONTROLSEX control_info = { sizeof(INITCOMMONCONTROLSEX), 0x0000FFFF }; ::InitCommonControlsEx(&control_info); WNDCLASSW wc; const wchar_t* window_class(L"adobe_begin_main_window"); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = main_window_proc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = ::GetModuleHandle(NULL); wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(RES_APP_ICON)); wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wc.lpszMenuName = window_class; wc.lpszClassName = window_class; RegisterClassW(&wc); HWND root_window = ::CreateWindowExW(WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME | WS_EX_COMPOSITED, window_class, L"Adobe Begin", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU, 10, 10, 640, 480, NULL, ::CreateMenu(), ::GetModuleHandle(NULL), NULL); if (root_window == NULL) throw std::runtime_error("Could not open main window"); ::ShowWindow(root_window, SW_NORMAL); ::DragAcceptFiles(root_window, TRUE); ::SetWindowLongPtrA(root_window, GWLP_USERDATA, hackery::cast<LONG>(app)); // setup the menu system HMENU menu_bar(::GetMenu(root_window)); HMENU app_menu(::CreatePopupMenu()); HMENU view_options_menu(::CreatePopupMenu()); HMENU localization_menu(::CreatePopupMenu()); ::AppendMenu(app_menu, MF_STRING, ADOBE_ABOUT, _T("&About Adobe Begin")); ::AppendMenu(app_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(app_menu, MF_STRING, ADOBE_QUIT, _T("&Quit Adobe Begin")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_REFRESH_VIEW, _T("&Refresh View")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_REFRESH_SHEET, _T("R&efresh Sheet")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_NORMAL_DIALOG_SIZE, _T("&Normal Dialog Size")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_SMALL_DIALOG_SIZE, _T("&Small Dialog Size")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_MINI_DIALOG_SIZE, _T("&Mini Dialog Size")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_SHOW_WIDGET_FRAMES, _T("&Show Widget Frames")); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_CLEAR_WIDGET_FRAMES, _T("&Clear Widget Frames")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_SERIALIZE_WIDGETS, _T("&Serialize Widgets")); ::AppendMenu(view_options_menu, MF_SEPARATOR, 0, NULL); ::AppendMenu(view_options_menu, MF_STRING, ADOBE_RUN_MODAL, _T("&Run Modal")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_ENUS, _T("&Standard English (en-us)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_DEDE, _T("&German (de-de)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_JAJP, _T("&Japanese (ja-jp)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_KOKR, _T("&Korean (ko-kr)")); ::AppendMenu(localization_menu, MF_STRING, ADOBE_LOCALIZATION_PGPG, _T("&Pig Latin (pg-pg)")); ::AppendMenu(menu_bar, MF_POPUP, hackery::cast<UINT_PTR>(app_menu), _T("&Adobe Begin")); ::AppendMenu(menu_bar, MF_POPUP, hackery::cast<UINT_PTR>(view_options_menu), _T("&View Options")); ::AppendMenu(menu_bar, MF_POPUP, hackery::cast<UINT_PTR>(localization_menu), _T("&Localization")); ::DrawMenuBar(root_window); // set root in display adobe::get_main_display().set_root(root_window); }
/* * Top level; * we get control from the desktop. */ main() { pnf = 0; /* set the flag to it isn't partition yet */ appl_init(); phys_handle=graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox); wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); open_vwork(); wi_handle=wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk); hidden = FALSE; butdown = TRUE; /* doing a checking see if the cache in the system */ cachexst = (char) chkcache(); if (!rsrc_load(RESOURCEFILE)) { errs("[2][|", RESOURCEFILE, "][ EXIT ]"); goto punt; } /* Get all addresses of dialogues from resource file */ if (getalladdr() != OK) { errs("[2][|", RESOURCEFILE, "][ EXIT ]"); goto punt; } /* * Get maximum partition size from * wincap "@@" entry. */ /* if (wgetent("Parameters", "@@") == OK) { if (wgetnum("ms", &mxpsiz) != OK) mxpsiz = MAXPSIZ; } else { goto punt; } */ needscan = TRUE; redomul: ARROW_MOUSE; /* display menu bar */ menu_bar(menuobj, 1); running = TRUE; while (running) { domulti(); } /* * If nothing has been done to the hard disks * then just get out, back to the desktop. * Otherwise reboot the system. */ menu_bar(menuobj, 0); /* erase menu bar */ punt: /* * If we have to reboot, * tell the user and then do it. * */ if (rebootp) { if (form_alert(2, autoboot) == 1) { reboot(); } else { goto redomul; } } wind_delete(wi_handle); v_clsvwk(handle); appl_exit(); }
GemInit() { int work_in[11]; int i; int dev_id; int work_out[57]; appl_init(); if( gl_apid == -1 ) return(4); /* Make Alice compatible with the fine Atari GDOS */ dev_id = Getrez() + 2; gem_handle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox ); vdi_handle = gem_handle; /* * Open the Virtual Workstation */ for( i=1; i<10; i++ ) work_in[i] = 1; work_in[0] = dev_id; work_in[10] = 2; /* Raster coords */ v_opnvwk( work_in, &vdi_handle, work_out ); scr_area.g_w = work_out[0] + 1; scr_area.g_h = work_out[1] + 1; scr_area.g_x = 0; scr_area.g_y = 0; if( (scr_area.g_w / gl_wchar) < 70 ) LoRes = TRUE; #ifdef EMBEDDED_RCS rsc_fix(); #else if( !rsrc_load( "ALICE.RSC" ) ) { form_alert( 1, LDS( 375, "[3][Fatal Error !|ALICE.RSC must be|in current directory][ Abort ]")); v_clsvwk( vdi_handle ); appl_exit(); exit( 1 ); } #endif EMBEDDED_RCS #ifndef SAI /* * Set up the menu bar */ rsrc_gaddr( R_TREE, MENU, &gl_menu ); if( LoRes ) { ShortenMenu( gl_menu ); FixBar( gl_menu ); } menu_bar( gl_menu, TRUE ); #endif SAI /* * Set the mouse to an arrow, and end the update */ graf_mouse( ARROW, 0x0L ); resetVDI(); }