#ifndef UEW_H #define UEW_H #include "../include/osw-x.h" #include "../include/widget.h" #include "../include/objects.h" #include "../include/imgrefs.h" #include "uetypes.h" #include "uewprops.h" /* * Draw Amounts: */ #define UEW_DRAW_COMPLETE 0 #define UEW_DRAW_TOOLBAR 1 #define UEW_DRAW_PREVIEW 2 #define UEW_DRAW_VIEW 3 #define UEW_DRAW_VIEW_STATUS 4 #define UEW_DRAW_STATUS 5 /* * OP Codes: */ #define UEW_OP_NONE 0 #define UEW_OP_NEW 1 /* Create a new universe */ #define UEW_OP_OPEN 2 /* Open universe file */ #define UEW_OP_OPEN_NEW_UEW 3 /* Open universe file in a * new window */ #define UEW_OP_INSERT_UNIVERSE 4 /* Insert objects from * a universe file */ #define UEW_OP_SAVE 5 /* Save universe file */ #define UEW_OP_SAVE_AS 6 /* Save as universe file */ #define UEW_OP_SAVE_SELECTED_AS 7 /* Save selected object(s) * to a universe file */ #define UEW_OP_SAVE_AS_IMAGE 8 /* Screenshot */ #define UEW_OP_PRINT 9 /* Print view */ #define UEW_OP_CLOSE 10 /* Close the window */ #define UEW_OP_EXIT 11 /* Close all windows */ #define UEW_OP_UNDO 20 /* Undo */ #define UEW_OP_CUT 30 /* Cut the selected object(s) */ #define UEW_OP_COPY 31 /* Copy the selected object(s) */ #define UEW_OP_PASTE 32 /* Paste object(s) */ #define UEW_OP_DELETE 35 /* Delete the selected object(s) */ #define UEW_OP_SELECT_ALL 37 /* Select all objects */ #define UEW_OP_UNSELECT_ALL 38 /* Unselect all objects */ #define UEW_OP_INVERT_SELECTION 39 /* Select all unselected * objects and unselect all * selected objects */ #define UEW_OP_SHOW_OBJECT_LABELS 40 /* Show/hide object labels */ #define UEW_OP_SHOW_GEOMETRY_LABELS 41 /* Show/hide geometry labels */ #define UEW_OP_SHOW_GRID 42 /* Show/hide grid */ #define UEW_OP_SHOW_CONTACT_BOUNDS 43 /* Show/hide contact bounds */ #define UEW_OP_ANIMATE_OBJECT_DISPLAY 45 /* Animate object display */ #define UEW_OP_LEGEND 50 /* Edit the universe legend */ #define UEW_OP_CHECK_UNIVERSE 55 /* Check universe */ #define UEW_OP_INSERT_OBJECT 60 /* Insert a new object from * the selected OPM */ #define UEW_OP_INSERT_OBJECT_PLAIN 61 /* Insert a plain new object */ #define UEW_OP_OBJ_PROPERTIES 62 /* Edit the object's properties */ #define UEW_OP_OBJ_WEAPONS 63 /* Edit the object's weapons */ #define UEW_OP_OBJ_ECONOMY 64 /* Edit the object's economy */ #define UEW_OP_OBJ_REMODEL 65 /* Remodel the seleced * object(s) after the * selected OPM */ #define UEW_OP_SELECT_OPM_FILE 66 /* Select an OPM file */ #define UEW_OP_EXPORT_OPM_FILE 67 /* Export the selected * objects to a OPM file */ #define UEW_OP_OPTIONS 70 /* Options */ #define UEW_OP_NEW_UEW 80 /* Create a new window */ #define UEW_OP_ABOUT 90 /* About this program */ /* OP codes reserved for the windows list: * * window_index = op - UEW_OP_WINDOW_START */ #define UEW_OP_WINDOW_START 100 /* Window item start */ #define UEW_OP_WINDOW_END 199 /* Window item end */ /* * View Zoom Bounds: */ #define UEW_VIEW_DEF_ZOOM 0.082 #define UEW_VIEW_ZOOM_MIN 0.003 #define UEW_VIEW_ZOOM_MAX 2.000 /* * Drag Operations: */ #define UEW_DRAG_OP_NONE 0 #define UEW_DRAG_OP_RESIZE_LIST 1 #define UEW_DRAG_OP_RESIZE_VIEW 2 #define UEW_DRAG_OP_VIEW_TRANSLATE 3 #define UEW_DRAG_OP_VIEW_ZOOM 4 #define UEW_DRAG_OP_VIEW_SELECT_RECTANGULAR 6 #define UEW_DRAG_OP_VIEW_MOVE_OBJECT 7 #define UEW_DRAG_OP_VIEW_MEASURE 8 /* * Universe Editor Window: */ struct _uew_struct { bool_t map_state, has_focus, disabled; int freeze_count, busy_count; int x, y; unsigned int width, height; unsigned int options; char *unv_file; bool_t has_changes; win_t toplevel; /* Menu Bar */ menu_bar_struct mb; int window_menu_num, help_menu_num; /* Tool Bar */ win_t toolbar; push_button_struct tb_new_btn, tb_open_btn, tb_save_btn, tb_save_as_btn, tb_save_as_image_btn, tb_cut_btn, tb_copy_btn, tb_paste_btn, tb_header_btn, /* opm_pulist is placed here */ tb_select_opm_file_btn, tb_insert_object_btn, tb_insert_object_plain_btn, tb_properties_btn, tb_weapons_btn, tb_economy_btn, tb_remodel_btn, tb_delete_btn, tb_check_unv_btn, tb_print_btn; popup_list_struct opm_pulist; /* Pane window x coordinate positions */ int view_pos, properties_pos; /* Objects List */ clist_struct objects_list; int last_selected_object; /* Preview */ popup_list_struct imgrefs_pulist; win_t preview; pixmap_t preview_buf; shared_image_t *imgref_img; /* Small image of imgref to be put * on preview */ /* View */ win_t view, view_split_bar; pixmap_t view_buf; bool_t view_has_focus; long sect_x, sect_y, sect_z; /* Current sector */ float cx, cy, cz; /* Current position */ float zoom; /* View position status */ win_t view_status; prompt_struct obj_cx_prompt, obj_cy_prompt, obj_cz_prompt, obj_sect_x_prompt, obj_sect_y_prompt, obj_sect_z_prompt, obj_name_prompt, obj_heading_prompt, obj_size_prompt; /* Properties */ win_t props, props_split_bar; scroll_bar_struct props_sb; prompt_struct prop_prompt[UEW_TOTAL_PROPS]; /* Status Bar */ win_t status; char *status_message; progress_bar_struct pbar; /* Right-Click Menu */ menu_struct menu; /* DND */ atom_t target_string; atom_t dnd_action; win_t dnd_tar_w; int dnd_x, dnd_y; /* Drag information */ int drag_op; /* One of UEW_DRAG_OP_* */ int button_pressed; /* Currently pressed button */ int button_last_x, button_last_y; time_t button_pressed_time; /* In ms */ /* Resize Bar */ int resize_bar_last_pos; #ifdef HAVE_X gc_t invert_gc; #endif /* Unverse Legend */ sw_legend_struct legend; /* Imgrefs */ imgref_struct **imgref; int total_imgrefs, cur_imgref; /* Imgref animation markers */ int ani_frame, ani_total_frames; time_t ani_int, ani_next; /* Universe Header Window */ uhw_struct *uhw; /* Properties Dialogs */ prop_dlg_struct **prop_dlg; int total_prop_dlgs; /* Weapon Windows */ wepw_struct **wepw; int total_wepws; /* Economy Windows */ ecow_struct **ecow; int total_ecows; /* Print Dialog */ print_dlg_struct *print_dlg; }; /* uew.cpp */ extern void UEWSetTitle(uew_struct *uew, const char *s); extern void UEWUpdateTitle(uew_struct *uew); extern void UEWDisplayObject( uew_struct *uew, const int obj_num, const bool_t move_to ); extern void UEWStatusMessage(uew_struct *uew, const char *msg); #define UEWStatus UEWStatusMessage extern void UEWStatusProgress(uew_struct *uew, const float coeff); extern void UEWSetBusy(uew_struct *uew, const bool_t busy); extern uew_struct *UEWNew(void); extern void UEWResize(uew_struct *uew); extern void UEWQueueResize(uew_struct *uew); extern void UEWDraw(uew_struct *uew, const int amount); extern void UEWQueueDraw(uew_struct *uew, const int amount); extern int UEWManage(uew_struct *uew, event_t *event); extern void UEWMaintain( void *data, uew_struct *uew, const time_t cur_ms, const time_t cur_sec, const float tc ); extern void UEWUpdateWidgets(uew_struct *uew); extern void UEWMap(uew_struct *uew); extern void UEWUnmap(uew_struct *uew); extern void UEWDelete(uew_struct *uew); /* uewcb.cpp */ extern void UEWMenuActivateCB( menu_struct *menu, int id, void *data ); extern void UEWUnvFIOProgressCB( void *data, unsigned long i, unsigned long n ); extern void UEWImgRefsFIOProgressCB( void *data, unsigned long i, unsigned long n ); extern void UEWSndRefsFIOProgressCB( void *data, unsigned long i, unsigned long n ); extern void UEWOPMListDestroyCB(void *data); extern void UEWOPMListSelectCB( popup_list_struct *pulist, int sel_item, void *data ); extern void UEWImgRefsListSelectCB( popup_list_struct *pulist, int sel_item, void *data ); extern void UEWObjectsCListDestroyCB(void *data); extern void UEWObjectsCListActivateCB( clist_struct *clist, void *data ); extern void UEWObjectsCListSelectCB( clist_struct *clist, int row_num, void *data ); extern void UEWObjectsCListUnselectCB( clist_struct *clist, int row_num, void *data ); extern void UEWPropsSBValueChangedCB( scroll_bar_struct *sb, float x, float y, void *data ); extern void UEWTBNewPBCB(push_button_struct *btn, void *data); extern void UEWTBOpenPBCB(push_button_struct *btn, void *data); extern void UEWTBInsertPBCB(push_button_struct *btn, void *data); extern void UEWTBSavePBCB(push_button_struct *btn, void *data); extern void UEWTBSaveAsPBCB(push_button_struct *btn, void *data); extern void UEWTBSaveSelectedAsPBCB(push_button_struct *btn, void *data); extern void UEWTBSaveAsImagePBCB(push_button_struct *btn, void *data); extern void UEWTBCutPBCB(push_button_struct *btn, void *data); extern void UEWTBCopyPBCB(push_button_struct *btn, void *data); extern void UEWTBPastePBCB(push_button_struct *btn, void *data); extern void UEWTBHeaderPBCB(push_button_struct *btn, void *data); extern void UEWTBCheckUnvPBCB(push_button_struct *btn, void *data); extern void UEWTBSelectOPMFilePBCB(push_button_struct *btn, void *data); extern void UEWTBExportOPMFilePBCB(push_button_struct *btn, void *data); extern void UEWTBInsertObjectPBCB(push_button_struct *btn, void *data); extern void UEWTBDeletePBCB(push_button_struct *btn, void *data); extern void UEWTBPropertiesPBCB(push_button_struct *btn, void *data); extern void UEWTBEconomyPBCB(push_button_struct *btn, void *data); extern void UEWTBWeaponsPBCB(push_button_struct *btn, void *data); extern void UEWTBRemodelPBCB(push_button_struct *btn, void *data); extern void UEWTBPrintPBCB(push_button_struct *btn, void *data); /* uewlist.cpp */ extern void UEWObjectsListItemUpdateObjNum( uew_struct *uew, const int obj_num ); extern void UEWObjectsListItemUpdateObjName( uew_struct *uew, const int obj_num ); /* uewobjectdisplay.cpp */ extern void UEWObjectDisplayDrawPixmap( pixmap_t pixmap, shared_image_t *simg, xsw_object_struct *obj, imgref_struct *imgref, const int imgref_frame ); /* uewops.cpp */ extern xsw_object_struct *UEWGetObjectPtr(uew_struct *uew, const int obj_num); extern bool_t UEWIsObjectSelected(uew_struct *uew, const int obj_num); extern void UEWDoChownAll( uew_struct *uew, const int old_owner, const int new_owner ); extern void UEWSetOPMFile(uew_struct *uew, const char *path); extern void UEWOpenImgRefs(uew_struct *uew, const char *path); extern void UEWDoUpdateWindowMenus(void); extern void UEWNewUniverse(uew_struct *uew); extern void UEWOpenFile(uew_struct *uew, const char *path); extern void UEWOpen(uew_struct *uew); extern void UEWOpenNew(uew_struct *uew); extern void UEWInsert(uew_struct *uew); extern void UEWOpenDNDURL(uew_struct *uew, const char *url); extern int UEWSave(uew_struct *uew); extern int UEWSaveAs(uew_struct *uew); extern int UEWSaveSelectedAs(uew_struct *uew); extern int UEWSaveAsImage(uew_struct *uew); extern void UEWInsertObject( uew_struct *uew, xsw_object_struct *obj, bool_t keep_obj_position ); extern void UEWCut(uew_struct *uew); extern void UEWCopy(uew_struct *uew); extern void UEWPaste(uew_struct *uew); extern void UEWRemodel(uew_struct *uew); extern void UEWDeleteObject(uew_struct *uew); extern void UEWCheckUnv( uew_struct *uew, const bool_t verbose, const bool_t automatic ); extern void UEWSelectOPMFile(uew_struct *uew); extern int UEWExportOPMFile(uew_struct *uew); /* uewprops.cpp */ extern void UEWPropsDrawCB(void *widget, void *data); extern bool_t UEWPropsHasFocus(uew_struct *uew); extern void UEWPropsDoGetValues(uew_struct *uew, const int obj_num); extern void UEWPropsDoSetValues(uew_struct *uew, const int obj_num); extern int UEWPropsInit(uew_struct *uew); extern void UEWPropsResize(uew_struct *uew); extern void UEWPropsDraw(uew_struct *uew, int direction); extern int UEWPropsManage(uew_struct *uew, event_t *event); extern void UEWPropsDestroy(uew_struct *uew); /* uewpropsio.cpp */ extern void UEWPropsSet( prompt_struct *prompt, xsw_object_struct *obj ); extern void UEWPropsGet( prompt_struct *prompt, xsw_object_struct *obj ); /* uewview.cpp */ extern bool_t UEWViewConvertPositionToWindowCoordinates( const unsigned long wwidth, const unsigned long wheight, const float sect_width, const float sect_height, const long cur_sect_x, const long cur_sect_y, const float cur_x, const float cur_y, const long sect_x, const long sect_y, const float x, const float y, const float zoom, int *wx_rtn, int *wy_rtn ); extern int UEWViewMatchObject( uew_struct *uew, const int x, const int y, const int start_obj_num ); extern void UEWViewStatusGetValues( uew_struct *uew, xsw_object_struct *obj ); extern void UEWViewDrawPixmap( uew_struct *uew, pixmap_t pixmap, win_t w, /* View window */ const bool_t draw_printer_friendly, /* Draw printer friendly version */ const bool_t draw_grayscale /* Draw greyscale */ ); extern void UEWViewDraw(uew_struct *uew); #endif /* UEW_H */