From ed97f43c0c9499c2e9c382177c49063cfeca202c Mon Sep 17 00:00:00 2001 From: kgv Date: Wed, 17 Apr 2013 16:36:16 +0400 Subject: [PATCH] 0022590: Migration to FreeImage - revision of Xw and WNT packages Clean up Xw package from outdated and unused functionality Adjusting test case for current state of master --- samples/qt/Common/src/View.cxx | 2 +- src/Graphic3d/Graphic3d.cdl | 1 - src/TKService/EXTERNLIB | 1 + src/ViewerTest/ViewerTest_Tool.cxx | 12 +- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 4 +- src/Visual3d/Visual3d.cdl | 1 - src/Visual3d/Visual3d_View.cxx | 10 +- src/Xw/EXTERNLIB | 1 + src/Xw/FILES | 145 +- src/Xw/Xw.cdl | 124 - src/Xw/Xw.cxx | 69 - src/Xw/Xw.edl | 24 - src/Xw/Xw_CMPLRS.edl | 64 - src/Xw/Xw_Cextern.hxx | 1981 ---------------- src/Xw/Xw_ColorMap.cdl | 312 --- src/Xw/Xw_ColorMap.cxx | 417 ---- src/Xw/Xw_Extension.h | 955 -------- src/Xw/Xw_FontMap.cdl | 108 - src/Xw/Xw_FontMap.cxx | 127 - src/Xw/Xw_MarkMap.cdl | 109 - src/Xw/Xw_MarkMap.cxx | 140 -- src/Xw/Xw_TypeMap.cdl | 109 - src/Xw/Xw_TypeMap.cxx | 135 -- src/Xw/Xw_WOKSteps.edl | 43 - src/Xw/Xw_WOKUMake.edl | 35 - src/Xw/Xw_WidthMap.cdl | 107 - src/Xw/Xw_WidthMap.cxx | 124 - src/Xw/Xw_Window.cdl | 263 --- src/Xw/Xw_Window.cxx | 678 +++--- src/Xw/Xw_Window.hxx | 124 + src/Xw/Xw_alloc_color.cxx | 200 -- src/Xw/Xw_alloc_pixel.cxx | 171 -- src/Xw/Xw_calc_points.cxx | 82 - src/Xw/Xw_convert_image.cxx | 581 ----- src/Xw/Xw_def_background_color.cxx | 157 -- src/Xw/Xw_def_color.cxx | 117 - src/Xw/Xw_def_colormap.cxx | 1461 ------------ src/Xw/Xw_def_font.cxx | 206 -- src/Xw/Xw_def_fontmap.cxx | 232 -- src/Xw/Xw_def_highlight_color.cxx | 131 -- src/Xw/Xw_def_marker.cxx | 110 - src/Xw/Xw_def_markmap.cxx | 191 -- src/Xw/Xw_def_tile.cxx | 120 - src/Xw/Xw_def_tilemap.cxx | 185 -- src/Xw/Xw_def_type.cxx | 103 - src/Xw/Xw_def_typemap.cxx | 186 -- src/Xw/Xw_def_width.cxx | 81 - src/Xw/Xw_def_widthmap.cxx | 185 -- src/Xw/Xw_def_window.cxx | 618 ----- src/Xw/Xw_draw_arc.cxx | 314 --- src/Xw/Xw_draw_buffer.cxx | 2189 ------------------ src/Xw/Xw_draw_image.cxx | 223 -- src/Xw/Xw_draw_line.cxx | 535 ----- src/Xw/Xw_draw_marker.cxx | 494 ---- src/Xw/Xw_draw_point.cxx | 275 --- src/Xw/Xw_draw_poly.cxx | 600 ----- src/Xw/Xw_draw_polyarc.cxx | 326 --- src/Xw/Xw_draw_polytext.cxx | 459 ---- src/Xw/Xw_draw_segment.cxx | 399 ---- src/Xw/Xw_draw_text.cxx | 469 ---- src/Xw/Xw_draw_zoomed_image.cxx | 202 -- src/Xw/Xw_erase_area.cxx | 108 - src/Xw/Xw_erase_window.cxx | 77 - src/Xw/Xw_flush.cxx | 69 - src/Xw/Xw_gamma_image.cxx | 124 - src/Xw/Xw_get_background_color.cxx | 80 - src/Xw/Xw_get_background_image.cxx | 120 - src/Xw/Xw_get_background_index.cxx | 63 - src/Xw/Xw_get_background_pixel.cxx | 70 - src/Xw/Xw_get_color.cxx | 113 - src/Xw/Xw_get_color_index.cxx | 325 --- src/Xw/Xw_get_color_name.cxx | 70 - src/Xw/Xw_get_color_pixel.cxx | 170 -- src/Xw/Xw_get_colormap_info.cxx | 92 - src/Xw/Xw_get_colormap_visual.cxx | 58 - src/Xw/Xw_get_colormap_xid.cxx | 180 -- src/Xw/Xw_get_cursor_position.cxx | 70 - src/Xw/Xw_get_display_info.cxx | 76 - src/Xw/Xw_get_display_visual.cxx | 74 - src/Xw/Xw_get_double_buffer.cxx | 56 - src/Xw/Xw_get_env.cxx | 77 - src/Xw/Xw_get_filename.cxx | 119 - src/Xw/Xw_get_font.cxx | 81 - src/Xw/Xw_get_font_index.cxx | 91 - src/Xw/Xw_get_fontmap_info.cxx | 75 - src/Xw/Xw_get_highlight_color.cxx | 138 -- src/Xw/Xw_get_image.cxx | 270 --- src/Xw/Xw_get_image_info.cxx | 74 - src/Xw/Xw_get_marker_index.cxx | 101 - src/Xw/Xw_get_markmap_info.cxx | 75 - src/Xw/Xw_get_mmscreen_pixelvalue.cxx | 61 - src/Xw/Xw_get_pixel.cxx | 132 -- src/Xw/Xw_get_pixel_mmscreenvalue.cxx | 61 - src/Xw/Xw_get_pixel_screencoord.cxx | 75 - src/Xw/Xw_get_pixel_screenvalue.cxx | 61 - src/Xw/Xw_get_pixel_windowcoord.cxx | 67 - src/Xw/Xw_get_pixel_windowvalue.cxx | 64 - src/Xw/Xw_get_rgbpixel.cxx | 152 -- src/Xw/Xw_get_screen_pixelcoord.cxx | 74 - src/Xw/Xw_get_screen_pixelvalue.cxx | 60 - src/Xw/Xw_get_screen_size.cxx | 107 - src/Xw/Xw_get_text_size.cxx | 100 - src/Xw/Xw_get_tilemap_info.cxx | 74 - src/Xw/Xw_get_type.cxx | 82 - src/Xw/Xw_get_type_index.cxx | 99 - src/Xw/Xw_get_typemap_info.cxx | 74 - src/Xw/Xw_get_width.cxx | 69 - src/Xw/Xw_get_width_index.cxx | 94 - src/Xw/Xw_get_widthmap_info.cxx | 74 - src/Xw/Xw_get_window_info.cxx | 95 - src/Xw/Xw_get_window_pixelcoord.cxx | 63 - src/Xw/Xw_get_window_pixelvalue.cxx | 61 - src/Xw/Xw_get_window_position.cxx | 252 -- src/Xw/Xw_get_window_visual.cxx | 61 - src/Xw/Xw_isdefine_color.cxx | 199 -- src/Xw/Xw_isdefine_colormap.cxx | 58 - src/Xw/Xw_isdefine_display.cxx | 58 - src/Xw/Xw_isdefine_font.cxx | 89 - src/Xw/Xw_isdefine_fontmap.cxx | 58 - src/Xw/Xw_isdefine_image.cxx | 57 - src/Xw/Xw_isdefine_marker.cxx | 87 - src/Xw/Xw_isdefine_markmap.cxx | 58 - src/Xw/Xw_isdefine_tile.cxx | 89 - src/Xw/Xw_isdefine_tilemap.cxx | 58 - src/Xw/Xw_isdefine_type.cxx | 90 - src/Xw/Xw_isdefine_typemap.cxx | 58 - src/Xw/Xw_isdefine_width.cxx | 88 - src/Xw/Xw_isdefine_widthmap.cxx | 58 - src/Xw/Xw_isdefine_window.cxx | 58 - src/Xw/Xw_load_bmp_image.cxx | 464 ---- src/Xw/Xw_load_gif_image.cxx | 427 ---- src/Xw/Xw_load_icons.cxx | 1203 ---------- src/Xw/Xw_load_image.cxx | 209 -- src/Xw/Xw_load_xwd_image.cxx | 272 --- src/Xw/Xw_open_display.cxx | 606 ----- src/Xw/Xw_open_image.cxx | 253 -- src/Xw/Xw_open_pixmap.cxx | 282 --- src/Xw/Xw_open_window.cxx | 167 -- src/Xw/Xw_put_background_image.cxx | 307 --- src/Xw/Xw_put_pixel.cxx | 112 - src/Xw/Xw_put_rgbpixel.cxx | 122 - src/Xw/Xw_resize_window.cxx | 116 - src/Xw/Xw_restore_area.cxx | 87 - src/Xw/Xw_restore_window.cxx | 66 - src/Xw/Xw_save_image.cxx | 103 - src/Xw/Xw_set_background_index.cxx | 93 - src/Xw/Xw_set_colormap.cxx | 153 -- src/Xw/Xw_set_double_buffer.cxx | 101 - src/Xw/Xw_set_event.cxx | 321 --- src/Xw/Xw_set_extended_text_attrib.cxx | 140 -- src/Xw/Xw_set_fontmap.cxx | 70 - src/Xw/Xw_set_hard_cursor.cxx | 148 -- src/Xw/Xw_set_internal_event.cxx | 261 --- src/Xw/Xw_set_line_attrib.cxx | 198 -- src/Xw/Xw_set_marker_attrib.cxx | 137 -- src/Xw/Xw_set_markmap.cxx | 71 - src/Xw/Xw_set_poly_attrib.cxx | 206 -- src/Xw/Xw_set_soft_cursor.cxx | 273 --- src/Xw/Xw_set_text_attrib.cxx | 188 -- src/Xw/Xw_set_tilemap.cxx | 70 - src/Xw/Xw_set_trace.cxx | 851 ------- src/Xw/Xw_set_typemap.cxx | 70 - src/Xw/Xw_set_widthmap.cxx | 70 - src/Xw/Xw_set_window_ratio.cxx | 74 - src/Xw/Xw_set_window_state.cxx | 148 -- src/Xw/Xw_wait_event.cxx | 315 --- src/Xw/Xw_zoom_image.cxx | 190 -- tests/bugs/vis/bug23123 | 16 +- 168 files changed, 436 insertions(+), 32722 deletions(-) delete mode 100755 src/Xw/Xw.cdl delete mode 100755 src/Xw/Xw.cxx delete mode 100755 src/Xw/Xw.edl delete mode 100755 src/Xw/Xw_CMPLRS.edl delete mode 100755 src/Xw/Xw_Cextern.hxx delete mode 100755 src/Xw/Xw_ColorMap.cdl delete mode 100755 src/Xw/Xw_ColorMap.cxx delete mode 100755 src/Xw/Xw_Extension.h delete mode 100755 src/Xw/Xw_FontMap.cdl delete mode 100755 src/Xw/Xw_FontMap.cxx delete mode 100755 src/Xw/Xw_MarkMap.cdl delete mode 100755 src/Xw/Xw_MarkMap.cxx delete mode 100755 src/Xw/Xw_TypeMap.cdl delete mode 100755 src/Xw/Xw_TypeMap.cxx delete mode 100755 src/Xw/Xw_WOKSteps.edl delete mode 100755 src/Xw/Xw_WOKUMake.edl delete mode 100755 src/Xw/Xw_WidthMap.cdl delete mode 100755 src/Xw/Xw_WidthMap.cxx delete mode 100755 src/Xw/Xw_Window.cdl mode change 100755 => 100644 src/Xw/Xw_Window.cxx create mode 100644 src/Xw/Xw_Window.hxx delete mode 100755 src/Xw/Xw_alloc_color.cxx delete mode 100755 src/Xw/Xw_alloc_pixel.cxx delete mode 100755 src/Xw/Xw_calc_points.cxx delete mode 100755 src/Xw/Xw_convert_image.cxx delete mode 100755 src/Xw/Xw_def_background_color.cxx delete mode 100755 src/Xw/Xw_def_color.cxx delete mode 100755 src/Xw/Xw_def_colormap.cxx delete mode 100755 src/Xw/Xw_def_font.cxx delete mode 100755 src/Xw/Xw_def_fontmap.cxx delete mode 100755 src/Xw/Xw_def_highlight_color.cxx delete mode 100755 src/Xw/Xw_def_marker.cxx delete mode 100755 src/Xw/Xw_def_markmap.cxx delete mode 100755 src/Xw/Xw_def_tile.cxx delete mode 100755 src/Xw/Xw_def_tilemap.cxx delete mode 100755 src/Xw/Xw_def_type.cxx delete mode 100755 src/Xw/Xw_def_typemap.cxx delete mode 100755 src/Xw/Xw_def_width.cxx delete mode 100755 src/Xw/Xw_def_widthmap.cxx delete mode 100755 src/Xw/Xw_def_window.cxx delete mode 100755 src/Xw/Xw_draw_arc.cxx delete mode 100755 src/Xw/Xw_draw_buffer.cxx delete mode 100755 src/Xw/Xw_draw_image.cxx delete mode 100755 src/Xw/Xw_draw_line.cxx delete mode 100755 src/Xw/Xw_draw_marker.cxx delete mode 100755 src/Xw/Xw_draw_point.cxx delete mode 100755 src/Xw/Xw_draw_poly.cxx delete mode 100755 src/Xw/Xw_draw_polyarc.cxx delete mode 100755 src/Xw/Xw_draw_polytext.cxx delete mode 100755 src/Xw/Xw_draw_segment.cxx delete mode 100755 src/Xw/Xw_draw_text.cxx delete mode 100755 src/Xw/Xw_draw_zoomed_image.cxx delete mode 100755 src/Xw/Xw_erase_area.cxx delete mode 100755 src/Xw/Xw_erase_window.cxx delete mode 100755 src/Xw/Xw_flush.cxx delete mode 100755 src/Xw/Xw_gamma_image.cxx delete mode 100755 src/Xw/Xw_get_background_color.cxx delete mode 100755 src/Xw/Xw_get_background_image.cxx delete mode 100755 src/Xw/Xw_get_background_index.cxx delete mode 100755 src/Xw/Xw_get_background_pixel.cxx delete mode 100755 src/Xw/Xw_get_color.cxx delete mode 100755 src/Xw/Xw_get_color_index.cxx delete mode 100755 src/Xw/Xw_get_color_name.cxx delete mode 100755 src/Xw/Xw_get_color_pixel.cxx delete mode 100755 src/Xw/Xw_get_colormap_info.cxx delete mode 100755 src/Xw/Xw_get_colormap_visual.cxx delete mode 100755 src/Xw/Xw_get_colormap_xid.cxx delete mode 100755 src/Xw/Xw_get_cursor_position.cxx delete mode 100755 src/Xw/Xw_get_display_info.cxx delete mode 100755 src/Xw/Xw_get_display_visual.cxx delete mode 100755 src/Xw/Xw_get_double_buffer.cxx delete mode 100755 src/Xw/Xw_get_env.cxx delete mode 100755 src/Xw/Xw_get_filename.cxx delete mode 100755 src/Xw/Xw_get_font.cxx delete mode 100755 src/Xw/Xw_get_font_index.cxx delete mode 100755 src/Xw/Xw_get_fontmap_info.cxx delete mode 100755 src/Xw/Xw_get_highlight_color.cxx delete mode 100755 src/Xw/Xw_get_image.cxx delete mode 100755 src/Xw/Xw_get_image_info.cxx delete mode 100755 src/Xw/Xw_get_marker_index.cxx delete mode 100755 src/Xw/Xw_get_markmap_info.cxx delete mode 100755 src/Xw/Xw_get_mmscreen_pixelvalue.cxx delete mode 100755 src/Xw/Xw_get_pixel.cxx delete mode 100755 src/Xw/Xw_get_pixel_mmscreenvalue.cxx delete mode 100755 src/Xw/Xw_get_pixel_screencoord.cxx delete mode 100755 src/Xw/Xw_get_pixel_screenvalue.cxx delete mode 100755 src/Xw/Xw_get_pixel_windowcoord.cxx delete mode 100755 src/Xw/Xw_get_pixel_windowvalue.cxx delete mode 100755 src/Xw/Xw_get_rgbpixel.cxx delete mode 100755 src/Xw/Xw_get_screen_pixelcoord.cxx delete mode 100755 src/Xw/Xw_get_screen_pixelvalue.cxx delete mode 100755 src/Xw/Xw_get_screen_size.cxx delete mode 100755 src/Xw/Xw_get_text_size.cxx delete mode 100755 src/Xw/Xw_get_tilemap_info.cxx delete mode 100755 src/Xw/Xw_get_type.cxx delete mode 100755 src/Xw/Xw_get_type_index.cxx delete mode 100755 src/Xw/Xw_get_typemap_info.cxx delete mode 100755 src/Xw/Xw_get_width.cxx delete mode 100755 src/Xw/Xw_get_width_index.cxx delete mode 100755 src/Xw/Xw_get_widthmap_info.cxx delete mode 100755 src/Xw/Xw_get_window_info.cxx delete mode 100755 src/Xw/Xw_get_window_pixelcoord.cxx delete mode 100755 src/Xw/Xw_get_window_pixelvalue.cxx delete mode 100755 src/Xw/Xw_get_window_position.cxx delete mode 100755 src/Xw/Xw_get_window_visual.cxx delete mode 100755 src/Xw/Xw_isdefine_color.cxx delete mode 100755 src/Xw/Xw_isdefine_colormap.cxx delete mode 100755 src/Xw/Xw_isdefine_display.cxx delete mode 100755 src/Xw/Xw_isdefine_font.cxx delete mode 100755 src/Xw/Xw_isdefine_fontmap.cxx delete mode 100755 src/Xw/Xw_isdefine_image.cxx delete mode 100755 src/Xw/Xw_isdefine_marker.cxx delete mode 100755 src/Xw/Xw_isdefine_markmap.cxx delete mode 100755 src/Xw/Xw_isdefine_tile.cxx delete mode 100755 src/Xw/Xw_isdefine_tilemap.cxx delete mode 100755 src/Xw/Xw_isdefine_type.cxx delete mode 100755 src/Xw/Xw_isdefine_typemap.cxx delete mode 100755 src/Xw/Xw_isdefine_width.cxx delete mode 100755 src/Xw/Xw_isdefine_widthmap.cxx delete mode 100755 src/Xw/Xw_isdefine_window.cxx delete mode 100755 src/Xw/Xw_load_bmp_image.cxx delete mode 100755 src/Xw/Xw_load_gif_image.cxx delete mode 100755 src/Xw/Xw_load_icons.cxx delete mode 100755 src/Xw/Xw_load_image.cxx delete mode 100755 src/Xw/Xw_load_xwd_image.cxx delete mode 100755 src/Xw/Xw_open_display.cxx delete mode 100755 src/Xw/Xw_open_image.cxx delete mode 100755 src/Xw/Xw_open_pixmap.cxx delete mode 100755 src/Xw/Xw_open_window.cxx delete mode 100755 src/Xw/Xw_put_background_image.cxx delete mode 100755 src/Xw/Xw_put_pixel.cxx delete mode 100755 src/Xw/Xw_put_rgbpixel.cxx delete mode 100755 src/Xw/Xw_resize_window.cxx delete mode 100755 src/Xw/Xw_restore_area.cxx delete mode 100755 src/Xw/Xw_restore_window.cxx delete mode 100755 src/Xw/Xw_save_image.cxx delete mode 100755 src/Xw/Xw_set_background_index.cxx delete mode 100755 src/Xw/Xw_set_colormap.cxx delete mode 100755 src/Xw/Xw_set_double_buffer.cxx delete mode 100755 src/Xw/Xw_set_event.cxx delete mode 100755 src/Xw/Xw_set_extended_text_attrib.cxx delete mode 100755 src/Xw/Xw_set_fontmap.cxx delete mode 100755 src/Xw/Xw_set_hard_cursor.cxx delete mode 100755 src/Xw/Xw_set_internal_event.cxx delete mode 100755 src/Xw/Xw_set_line_attrib.cxx delete mode 100755 src/Xw/Xw_set_marker_attrib.cxx delete mode 100755 src/Xw/Xw_set_markmap.cxx delete mode 100755 src/Xw/Xw_set_poly_attrib.cxx delete mode 100755 src/Xw/Xw_set_soft_cursor.cxx delete mode 100755 src/Xw/Xw_set_text_attrib.cxx delete mode 100755 src/Xw/Xw_set_tilemap.cxx delete mode 100755 src/Xw/Xw_set_trace.cxx delete mode 100755 src/Xw/Xw_set_typemap.cxx delete mode 100755 src/Xw/Xw_set_widthmap.cxx delete mode 100755 src/Xw/Xw_set_window_ratio.cxx delete mode 100755 src/Xw/Xw_set_window_state.cxx delete mode 100755 src/Xw/Xw_wait_event.cxx delete mode 100755 src/Xw/Xw_zoom_image.cxx diff --git a/samples/qt/Common/src/View.cxx b/samples/qt/Common/src/View.cxx index 67ef5b3277..947f2615af 100755 --- a/samples/qt/Common/src/View.cxx +++ b/samples/qt/Common/src/View.cxx @@ -173,7 +173,7 @@ void View::init() NSView* aViewHandle = (NSView* )winId(); Handle(Cocoa_Window) hWnd = new Cocoa_Window (aViewHandle); #else - Aspect_Handle aWindowHandle = (Aspect_Handle )winId(); + Window aWindowHandle = (Window )winId(); Handle(Aspect_DisplayConnection) aDispConnection = myContext->CurrentViewer()->Driver()->GetDisplayConnection(); Handle(Xw_Window) hWnd = new Xw_Window (aDispConnection, aWindowHandle); #endif // WNT diff --git a/src/Graphic3d/Graphic3d.cdl b/src/Graphic3d/Graphic3d.cdl index fa02dd9112..80b9a11072 100755 --- a/src/Graphic3d/Graphic3d.cdl +++ b/src/Graphic3d/Graphic3d.cdl @@ -74,7 +74,6 @@ uses Quantity, Aspect, MMgt, - Xw, WNT, Image, AlienImage, diff --git a/src/TKService/EXTERNLIB b/src/TKService/EXTERNLIB index 7268b178a0..2c4b2261b1 100755 --- a/src/TKService/EXTERNLIB +++ b/src/TKService/EXTERNLIB @@ -1,5 +1,6 @@ TKernel TKMath +CSF_OpenGlLibs CSF_XwLibs CSF_dpsLibs CSF_XmuLibs diff --git a/src/ViewerTest/ViewerTest_Tool.cxx b/src/ViewerTest/ViewerTest_Tool.cxx index 6b5cf25c2d..cb7f440733 100755 --- a/src/ViewerTest/ViewerTest_Tool.cxx +++ b/src/ViewerTest/ViewerTest_Tool.cxx @@ -59,7 +59,6 @@ #else #include #include -#include #include #endif @@ -96,8 +95,7 @@ Handle(V3d_Viewer) ViewerTest_Tool::MakeViewer (const Standard_CString theTitle) #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX) Handle(Aspect_Window) window = new Cocoa_Window (theTitle, 0, 460, 409, 409); #else - Handle(Aspect_Window) window = new Xw_Window (GetDisplayConnection(), theTitle, - 0, 460, 409, 409, Quantity_NOC_BLACK); + Handle(Aspect_Window) window = new Xw_Window (GetDisplayConnection(), theTitle, 0, 460, 409, 409); #endif window->SetVirtual (Draw_VirtualWindows); window->Map(); @@ -122,7 +120,7 @@ Handle(V3d_Viewer) ViewerTest_Tool::MakeViewer (const Standard_CString theTitle) //======================================================================= //function : MakeContext -//purpose : +//purpose : //======================================================================= Handle(AIS_InteractiveContext) ViewerTest_Tool::MakeContext (const Standard_CString title) @@ -134,7 +132,7 @@ Handle(AIS_InteractiveContext) ViewerTest_Tool::MakeContext (const Standard_CSt //======================================================================= //function : InitViewerTest -//purpose : +//purpose : //======================================================================= // ********* next method is defined in ViewerTest_ViewerCommands.hxx **** @@ -142,7 +140,7 @@ extern void ViewerTest_InitViewerTest (const Handle(AIS_InteractiveContext)&); // ********************************************************************** void ViewerTest_Tool::InitViewerTest (const Handle(AIS_InteractiveContext)& context) -{ +{ ViewerTest_InitViewerTest (context); -} +} diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 98546d846f..4e0d888b60 100755 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -88,7 +88,6 @@ #include #include #else - #include #include #include /* contains some dangerous #defines such as Status, True etc. */ #include @@ -247,8 +246,7 @@ void ViewerTest::ViewerInit (const Standard_Integer thePxLeft, const Standard_I VT_GetWindow() = new Xw_Window (aDisplayConnection, "Test3d", aPxLeft, aPxTop, - aPxWidth, aPxHeight, - Quantity_NOC_BLACK); + aPxWidth, aPxHeight); } #endif VT_GetWindow()->SetVirtual (Draw_VirtualWindows); diff --git a/src/Visual3d/Visual3d.cdl b/src/Visual3d/Visual3d.cdl index 73a738f22e..3e50348f99 100755 --- a/src/Visual3d/Visual3d.cdl +++ b/src/Visual3d/Visual3d.cdl @@ -56,7 +56,6 @@ uses Graphic3d, Image, MMgt, - Xw, WNT, OSD, Font diff --git a/src/Visual3d/Visual3d_View.cxx b/src/Visual3d/Visual3d_View.cxx index 10b6f5b26f..9cd1188e77 100755 --- a/src/Visual3d/Visual3d_View.cxx +++ b/src/Visual3d/Visual3d_View.cxx @@ -464,7 +464,7 @@ void Visual3d_View::SetWindow (const Handle(Aspect_Window)& theWindow) #else const Handle(Xw_Window) aWin = Handle(Xw_Window)::DownCast (theWindow); MyCView.DefWindow.XWindow = aWin->XWindow(); - MyCView.DefWindow.XParentWindow = aWin->XParentWindow(); + //MyCView.DefWindow.XParentWindow = aWin->XParentWindow(); #endif Standard_Integer Width, Height; @@ -1091,7 +1091,7 @@ void Visual3d_View::SetViewOrientation (const Visual3d_ViewOrientation& VO) { if (IsDeleted ()) return; MyViewOrientation = VO; - + Standard_Real X, Y, Z; // Tests on modification of parameters. Standard_Boolean VUPIsModified = Standard_False; @@ -1166,9 +1166,9 @@ void Visual3d_View::SetViewOrientation (const Visual3d_ViewOrientation& VO) { MyMatOfOriIsEvaluated = !VUPIsModified && !VRPIsModified && !VRUIsModified && !ScaleIsModified; - + if (! IsDefined ()) return; - + Standard_Boolean AWait = Standard_False; // => immediate update MyGraphicDriver->ViewOrientation (MyCView, AWait); IsInitialized = Standard_True; @@ -1276,7 +1276,7 @@ void Visual3d_View::ViewOrientationReset () { // Restart if one of parameters is modified if (!IsInitialized || VUPIsModified || VRPIsModified || VRUIsModified || ScaleIsModified || CustomIsModified) { - + MyMatOfOriIsEvaluated = !VUPIsModified && !VRPIsModified && !VRUIsModified && !ScaleIsModified; diff --git a/src/Xw/EXTERNLIB b/src/Xw/EXTERNLIB index 990b6d9cb0..b908e4e0ea 100755 --- a/src/Xw/EXTERNLIB +++ b/src/Xw/EXTERNLIB @@ -1 +1,2 @@ CSF_XwLibs +CSF_OpenGlLibs diff --git a/src/Xw/FILES b/src/Xw/FILES index a16b8c2eb2..14fceb9519 100755 --- a/src/Xw/FILES +++ b/src/Xw/FILES @@ -1,144 +1,3 @@ -Xw_Extension.h -Xw_Cextern.hxx -Xw_alloc_color.cxx -Xw_alloc_pixel.cxx -Xw_convert_image.cxx -Xw_def_background_color.cxx -Xw_def_color.cxx -Xw_def_colormap.cxx -Xw_def_font.cxx -Xw_def_fontmap.cxx -Xw_def_highlight_color.cxx -Xw_def_marker.cxx -Xw_def_markmap.cxx -Xw_def_tile.cxx -Xw_def_tilemap.cxx -Xw_def_type.cxx -Xw_def_typemap.cxx -Xw_def_width.cxx -Xw_def_widthmap.cxx -Xw_def_window.cxx -Xw_draw_arc.cxx -Xw_draw_buffer.cxx -Xw_draw_image.cxx -Xw_draw_zoomed_image.cxx -Xw_draw_line.cxx -Xw_draw_marker.cxx -Xw_draw_point.cxx -Xw_draw_poly.cxx -Xw_draw_polyarc.cxx -Xw_draw_polytext.cxx -Xw_draw_segment.cxx -Xw_draw_text.cxx -Xw_erase_area.cxx -Xw_erase_window.cxx -Xw_flush.cxx -Xw_gamma_image.cxx -Xw_get_background_color.cxx -Xw_get_background_image.cxx -Xw_get_background_index.cxx -Xw_get_background_pixel.cxx -Xw_get_color.cxx -Xw_get_color_index.cxx -Xw_get_color_name.cxx -Xw_get_color_pixel.cxx -Xw_get_colormap_info.cxx -Xw_get_colormap_visual.cxx -Xw_get_colormap_xid.cxx -Xw_get_cursor_position.cxx -Xw_get_display_info.cxx -Xw_get_display_visual.cxx -Xw_get_double_buffer.cxx -Xw_get_env.cxx -Xw_get_filename.cxx -Xw_get_font.cxx -Xw_get_font_index.cxx -Xw_get_fontmap_info.cxx -Xw_get_highlight_color.cxx -Xw_get_image.cxx -Xw_get_image_info.cxx -Xw_get_marker_index.cxx -Xw_get_markmap_info.cxx -Xw_get_mmscreen_pixelvalue.cxx -Xw_get_pixel.cxx -Xw_get_pixel_mmscreenvalue.cxx -Xw_get_pixel_screencoord.cxx -Xw_get_pixel_screenvalue.cxx -Xw_get_pixel_windowcoord.cxx -Xw_get_pixel_windowvalue.cxx -Xw_get_rgbpixel.cxx -Xw_get_screen_pixelcoord.cxx -Xw_get_screen_pixelvalue.cxx -Xw_get_screen_size.cxx -Xw_get_text_size.cxx -Xw_get_tilemap_info.cxx -Xw_get_type.cxx -Xw_get_type_index.cxx -Xw_get_typemap_info.cxx -Xw_get_width.cxx -Xw_get_width_index.cxx -Xw_get_widthmap_info.cxx -Xw_get_window_info.cxx -Xw_get_window_pixelcoord.cxx -Xw_get_window_pixelvalue.cxx -Xw_get_window_position.cxx -Xw_get_window_visual.cxx -Xw_isdefine_color.cxx -Xw_isdefine_colormap.cxx -Xw_isdefine_display.cxx -Xw_isdefine_font.cxx -Xw_isdefine_fontmap.cxx -Xw_isdefine_image.cxx -Xw_isdefine_marker.cxx -Xw_isdefine_markmap.cxx -Xw_isdefine_tile.cxx -Xw_isdefine_tilemap.cxx -Xw_isdefine_type.cxx -Xw_isdefine_typemap.cxx -Xw_isdefine_width.cxx -Xw_isdefine_widthmap.cxx -Xw_isdefine_window.cxx -Xw_load_icons.cxx -Xw_load_image.cxx -Xw_load_gif_image.cxx -Xw_load_xwd_image.cxx -Xw_load_bmp_image.cxx -Xw_open_display.cxx -Xw_open_image.cxx -Xw_open_pixmap.cxx -Xw_open_window.cxx -Xw_put_background_image.cxx -Xw_put_pixel.cxx -Xw_put_rgbpixel.cxx -Xw_resize_window.cxx -Xw_restore_area.cxx -Xw_restore_window.cxx -Xw_save_image.cxx -Xw_set_background_index.cxx -Xw_set_colormap.cxx -Xw_set_double_buffer.cxx -Xw_set_event.cxx -Xw_set_extended_text_attrib.cxx -Xw_set_fontmap.cxx -Xw_set_hard_cursor.cxx -Xw_set_internal_event.cxx -Xw_set_line_attrib.cxx -Xw_set_marker_attrib.cxx -Xw_set_markmap.cxx -Xw_set_poly_attrib.cxx -Xw_set_soft_cursor.cxx -Xw_set_text_attrib.cxx -Xw_set_tilemap.cxx -Xw_set_trace.cxx -Xw_set_typemap.cxx -Xw_set_widthmap.cxx -Xw_set_window_ratio.cxx -Xw_set_window_state.cxx -Xw_wait_event.cxx -Xw_zoom_image.cxx -Xw.edl -Xw_CMPLRS.edl -Xw_WOKUMake.edl EXTERNLIB -Xw_WOKSteps.edl -Xw_calc_points.cxx +Xw_Window.cxx +Xw_Window.hxx diff --git a/src/Xw/Xw.cdl b/src/Xw/Xw.cdl deleted file mode 100755 index e0bc621d11..0000000000 --- a/src/Xw/Xw.cdl +++ /dev/null @@ -1,124 +0,0 @@ --- Created on: 1993-06-24 --- Created by: GG --- Copyright (c) 1993-1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - - -package Xw - - ---Version: - - ---Purpose: This package contains the common X graphic interface. - -- Warning: All the interface is described by a set of C routines. - -- All these C routines are stored in the library - -- of this package. - - ---References: - -uses - - TCollection, - TShort, - Aspect, - Quantity, - Image, - TColQuantity, - TColStd - -is - - -------------------- - -- Category: Classes - -------------------- - - class Window; - ---Purpose: Creates the X Window drawable. - ---Category: Classes - - class ColorMap; - ---Purpose: Creates the X Colormap - ---Category: Classes - - class TypeMap; - ---Purpose: Creates the X Typemap - ---Category: Classes - - class WidthMap; - ---Purpose: Creates the X Widthmap - ---Category: Classes - - class FontMap; - ---Purpose: Creates the X Fontmap - ---Category: Classes - - class MarkMap; - ---Purpose: Creates the X Markmap - ---Category: Classes - - ------------------------- - -- Category: Enumerations - ------------------------- - - enumeration WindowQuality is WQ_3DQUALITY, - WQ_PICTUREQUALITY, - WQ_DRAWINGQUALITY, - WQ_SAMEQUALITY, - WQ_TRANSPARENT, - WQ_OVERLAY - end WindowQuality ; - ---Purpose: Definition of the Window graphic quality - - enumeration TypeOfVisual is TOV_STATICGRAY, - TOV_GRAYSCALE, - TOV_STATICCOLOR, - TOV_PSEUDOCOLOR, - TOV_TRUECOLOR, - TOV_DIRECTCOLOR, - TOV_DEFAULT, - TOV_PREFERRED_PSEUDOCOLOR, - TOV_PREFERRED_TRUECOLOR, - TOV_PREFERRED_OVERLAY, - TOV_OVERLAY - end TypeOfVisual from Xw; - ---Purpose: Definition of the visual type - - enumeration TypeOfMapping is TOM_HARDRAMP, - TOM_SIMPLERAMP, - TOM_BESTRAMP, - TOM_COLORCUBE, - TOM_READONLY - end TypeOfMapping from Xw; - ---Purpose: Definition of the colormap type - - ----------------------------- - -- Category: Trace management - ----------------------------- - - SetTrace( TraceLevel,ErrorLevel : Integer ) ; - ---Purpose: Global Trace Level for Maintenance Only - ---Category: Trace management - - TraceLevel returns Integer is private ; - ---Purpose: Return current global Trace level . - ---Category: Trace management - - ErrorLevel returns Integer is private ; - ---Purpose: Return current global Error level . - ---Category: Trace management - -end Xw; diff --git a/src/Xw/Xw.cxx b/src/Xw/Xw.cxx deleted file mode 100755 index 5e411837cd..0000000000 --- a/src/Xw/Xw.cxx +++ /dev/null @@ -1,69 +0,0 @@ -// Created by: GG -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - - - - -//-Version - -//-Design - -//-Warning - -//-References - -//-Language C++ 2.1 - -//-Declarations - -// for the class -#include - -// Routines C a declarer en extern -//extern "C" { -#include -//} - -//-Aliases - -//-Global data definitions - -//-Local data definitions -static Standard_Integer MyTraceLevel = 0 ; -static Standard_Integer MyErrorLevel = 4 ; - -//-Constructors - -void Xw::SetTrace(const Standard_Integer TraceLevel,const Standard_Integer ErrorLevel) { - MyTraceLevel = TraceLevel ; - MyErrorLevel = ErrorLevel ; - - Xw_set_trace((int)MyTraceLevel,(int)MyErrorLevel) ; -} - -Standard_Integer Xw::TraceLevel() { - - return MyTraceLevel ; -} - -Standard_Integer Xw::ErrorLevel() { - - return MyErrorLevel ; -} diff --git a/src/Xw/Xw.edl b/src/Xw/Xw.edl deleted file mode 100755 index 4045da5a1a..0000000000 --- a/src/Xw/Xw.edl +++ /dev/null @@ -1,24 +0,0 @@ --- Created on: 1996-10-03 --- Created by: Jean GAUTIER --- Copyright (c) 1996-1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - - -@ifnotdefined ( %Xw_EDL) then - @set %Xw_EDL = ""; -@endif; diff --git a/src/Xw/Xw_CMPLRS.edl b/src/Xw/Xw_CMPLRS.edl deleted file mode 100755 index 7b154e4b88..0000000000 --- a/src/Xw/Xw_CMPLRS.edl +++ /dev/null @@ -1,64 +0,0 @@ --- Copyright (c) 1996-1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - -@ifnotdefined ( %Xw_CMPLRS_EDL) then - @set %Xw_CMPLRS_EDL = ""; - - @uses "CSF.edl"; - --- Use GLX or Cocoa -@ifnotdefined ( %MACOSX_USE_GLX ) then - @set %MACOSX_USE_GLX = "${MACOSX_USE_GLX}"; -@endif; - - @if ( %Station == "wnt" || (%Station == "mac" && %MACOSX_USE_GLX != "true")) then - -- Pas de compile sur WNT - @set %WOKUMake_Steps = "src"; - @endif; - - @string %CMPLRS_CXX_Options = %CMPLRS_CXX_Options " -DITYPE_REF "; --- @string %CMPLRS_C_Options = %CMPLRS_C_Options " -DHAVE_X11_EXTENSIONS_MULTIBUF_H "; - - @if ( %Station == "sun" ) then - @string %CMPLRS_C_Options += %CSF_X11_INCLUDE " -DHAVE_X11_EXTENSIONS_TRANSOLV_H -DHAVE_X11_EXTENSIONS_MULTIBUF_H " ; - @string %CMPLRS_CXX_Options += %CSF_X11_INCLUDE " -DHAVE_X11_EXTENSIONS_TRANSOLV_H -DHAVE_X11_EXTENSIONS_MULTIBUF_H " ; - @endif; - - @if ( %Station == "sil" ) then - @string %CMPLRS_C_Options = %CMPLRS_C_Options " -ansi "; - @string %CMPLRS_C_Options += " -DHAVE_X11_EXTENSIONS_READDISPLAY_H "; - @string %CMPLRS_CXX_Options += " -DHAVE_X11_EXTENSIONS_READDISPLAY_H "; - @endif; - - @if ( %Station == "ao1" ) then - @string %CMPLRS_C_Options = %CMPLRS_C_Options " -std1"; - @endif; - - @if ( %Station == "hp" ) then - @string %CMPLRS_C_Options = %CSF_X11_INCLUDE " " %CSF_XMU_INCLUDE %CMPLRS_C_Options ; - @string %CMPLRS_C_Options = %CMPLRS_C_Options " -Ac"; - @string %CMPLRS_CXX_Options = %CSF_X11_INCLUDE " " %CSF_XMU_INCLUDE %CMPLRS_CXX_Options ; - - @endif; - - @string %CMPLRS_C_Options = %CMPLRS_C_Options " -DXW"; - --@string %CMPLRS_C_Options = %CMPLRS_C_Options " -DXW -DTRACE"; - @string %CMPLRS_CXX_Options = %CMPLRS_CXX_Options " -DXW"; - --@string %CMPLRS_CXX_Options = %CMPLRS_CXX_Options " -DXW -DTRACE"; - -@endif; diff --git a/src/Xw/Xw_Cextern.hxx b/src/Xw/Xw_Cextern.hxx deleted file mode 100755 index 83bcde94d0..0000000000 --- a/src/Xw/Xw_Cextern.hxx +++ /dev/null @@ -1,1981 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#ifndef XW_CEXTERN -#define XW_CEXTERN - -#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) -#define XW_PROTOTYPE 1 -#endif - -#define XW_EXT_DISPLAY void -#define XW_EXT_WINDOW void -#define XW_EXT_COLORMAP void -#define XW_EXT_WIDTHMAP void -#define XW_EXT_TYPEMAP void -#define XW_EXT_FONTMAP void -#define XW_EXT_TILEMAP void -#define XW_EXT_MARKMAP void -#define XW_EXT_IMAGEDATA void -#define XW_EXT_COLOR void -#define XW_USERDATA void - -#ifndef WNT -# include -#else -# define STRICT -# include -# define Aspect_Handle HANDLE -#endif /* WNT */ - -#include -#include - -#ifndef _Xw_TypeOfVisual_HeaderFile -typedef enum { - Xw_TOV_STATICGRAY, - Xw_TOV_GRAYSCALE, - Xw_TOV_STATICCOLOR, - Xw_TOV_PSEUDOCOLOR, - Xw_TOV_TRUECOLOR, - Xw_TOV_DIRECTCOLOR, - Xw_TOV_DEFAULT, - Xw_TOV_PREFERRED_PSEUDOCOLOR, - Xw_TOV_PREFERRED_TRUECOLOR, - Xw_TOV_PREFERRED_OVERLAY, - Xw_TOV_OVERLAY -} Xw_TypeOfVisual ; -#endif - -#ifndef _Xw_TypeOfMapping_HeaderFile -typedef enum { - Xw_TOM_HARDRAMP, - Xw_TOM_SIMPLERAMP, - Xw_TOM_BESTRAMP, - Xw_TOM_COLORCUBE, - Xw_TOM_READONLY -} Xw_TypeOfMapping ; -#endif - -typedef int XW_ATTRIB ; -#define XW_ALLATTRIB ~0 -#define XW_NOATTRIB 0 - -typedef enum { - XW_REPLACE,XW_ERASE,XW_XORBACK,XW_XORLIGHT,XW_HIGHLIGHT,XW_UNHIGHLIGHT -} XW_DRAWMODE ; - -typedef enum { - XW_DISABLE,XW_ENABLE -} XW_DOUBLEBUFFERMODE ; - -typedef enum { - XW_WS_UNKNOWN,XW_MAP,XW_POP,XW_PUSH,XW_ICONIFY -} XW_WINDOWSTATE ; - -typedef enum { - XW_MOUSEBUTTON,XW_MOUSEBUTTON1,XW_MOUSEBUTTON2,XW_MOUSEBUTTON3, - XW_MOUSEMOVE,XW_MOUSEMOVEWITHBUTTON,XW_MOUSEMOVEWITHBUTTON1, - XW_MOUSEMOVEWITHBUTTON2,XW_MOUSEMOVEWITHBUTTON3, - XW_KEYBOARD,XW_ENTERWINDOW,XW_RESIZEWINDOW, - XW_MOVEWINDOW,XW_ICONIFYWINDOW,XW_EXPOSEWINDOW,XW_ALLEVENT -} XW_EVENTTYPE ; - -typedef struct { - XW_EVENTTYPE type ; - XW_EXT_WINDOW *awindow ; -} XW_ANYEVENT ; - -typedef struct { - XW_EVENTTYPE type ; - XW_EXT_WINDOW *awindow ; - int modifier ; /* Special Key code */ - int button ; /* Button number */ - int state ; /* Button state : True if Press */ - int x,y ; /* Mouse position */ -} XW_MOUSEBUTTONEVENT ; - -typedef struct { - XW_EVENTTYPE type ; - XW_EXT_WINDOW *awindow ; - int modifier ; /* Special Key code */ - int x,y ; /* Mouse position */ -} XW_MOUSEMOVEEVENT ; - -typedef struct { - XW_EVENTTYPE type ; - XW_EXT_WINDOW *awindow ; - int modifier ; /* Special Key code */ - int button ; /* Button number */ - int state ; /* Button state : True if Press */ - int x,y ; /* Mouse position */ -} XW_MOUSEMOVEWITHBUTTONEVENT ; - -typedef struct { - XW_EVENTTYPE type ; - XW_EXT_WINDOW *awindow ; - int modifier ; /* Special Key code */ - int keycode ; /* Function Key code */ - int state ; /* Key state : True if Press */ - char *string ; - int x,y ; /* Mouse position */ -} XW_KEYBOARDEVENT ; - -typedef struct { - XW_EVENTTYPE type ; - XW_EXT_WINDOW *awindow ; - int xc,yc ; /* Exposure center position */ - int width,height ; /* Exposure size */ -} XW_WINDOWEXPOSEEVENT ; - -typedef struct { - XW_EVENTTYPE type ; - XW_EXT_WINDOW *awindow ; - int xc,yc ; /* Window center position */ - int width,height ; /* Window size */ -} XW_WINDOWRESIZEEVENT ; - -typedef struct { - XW_EVENTTYPE type ; - XW_EXT_WINDOW *awindow ; - int xc,yc ; /* Window center position */ -} XW_WINDOWMOVEEVENT ; - -typedef struct { - XW_EVENTTYPE type ; - XW_EXT_WINDOW *awindow ; -} XW_WINDOWICONIFYEVENT ; - -typedef struct { - XW_EVENTTYPE type ; - XW_EXT_WINDOW *awindow ; -} XW_WINDOWENTEREVENT ; - -typedef union { - XW_EVENTTYPE type ; - XW_ANYEVENT any ; - XW_MOUSEBUTTONEVENT mousebutton ; - XW_MOUSEMOVEEVENT mousemove ; - XW_MOUSEMOVEWITHBUTTONEVENT mousemovewithbutton ; - XW_KEYBOARDEVENT keyboard ; - XW_WINDOWEXPOSEEVENT windowexpose ; - XW_WINDOWRESIZEEVENT windowresize ; - XW_WINDOWMOVEEVENT windowmove ; - XW_WINDOWICONIFYEVENT windowiconify ; - XW_WINDOWENTEREVENT windowenter ; -} XW_EVENT ; - -typedef enum { - XW_WITHOUT_CURSOR,XW_RUBBERLINE_CURSOR, - XW_RUBBERBAND_CURSOR,XW_USERDEFINED_CURSOR -} XW_CURSORTYPE ; - -typedef enum { - XW_TOR_UNKNOWN,XW_NO_BORDER,XW_TOP_BORDER, - XW_RIGHT_BORDER,XW_BOTTOM_BORDER,XW_LEFT_BORDER, - XW_TOP_AND_RIGHT_BORDER,XW_RIGHT_AND_BOTTOM_BORDER, - XW_BOTTOM_AND_LEFT_BORDER,XW_LEFT_AND_TOP_BORDER -} XW_RESIZETYPE ; - -typedef enum { - XW_ERROR,XW_SUCCESS -} XW_STATUS ; - -#define XW_EXTENDEDTEXT_XSCALE 1 -#define XW_EXTENDEDTEXT_YSCALE 2 -#define XW_EXTENDEDTEXT_SLANT 4 -#define XW_EXTENDEDTEXT_WIDTH 8 -#define XW_EXTENDEDTEXT_HEIGHT 16 -#define XW_EXTENDEDTEXT_MINHEIGHT 32 -#define XW_EXTENDEDTEXT_UNDERLINE 64 - -#define XW_EXTENDEDTEXT_OUTLINE 256 -#define XW_EXTENDEDTEXT_COMPOSITE 512 - -typedef struct { - int type ; - float xscale,yscale ; - float slant ; - float spacing ; - float width,height,minheight ; - int isUnderlined ; -} XW_EXTENDEDTEXT ; - -typedef XW_STATUS (*XW_CALLBACK)( -#ifdef XW_PROTOTYPE - XW_EVENT* anyevent , - XW_USERDATA* userdata -#endif - ) ; - -/* - Trace & Errors -*/ - - void Xw_set_trace ( -#ifdef XW_PROTOTYPE - int TraceLevel , - int ErrorLevel -#endif - ) ; - - char* Xw_get_error ( -#ifdef XW_PROTOTYPE - int* Code , - int* Gravity -#endif - ) ; - - XW_STATUS Xw_print_error ( - ) ; - -/* - Attributes selection -*/ - - XW_ATTRIB Xw_set_line_attrib ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int color , - int type , - int width , - XW_DRAWMODE mode -#endif - ); - - XW_ATTRIB Xw_get_line_attrib ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int *color , - int *type , - int *width , - XW_DRAWMODE *mode -#endif - ); - - - XW_ATTRIB Xw_set_poly_attrib ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int color , - int type , - int tile , - XW_DRAWMODE mode -#endif - ); - - XW_ATTRIB Xw_get_poly_attrib ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int *color , - int *type , - int *tile , - XW_DRAWMODE *mode -#endif - ); - - - XW_ATTRIB Xw_set_text_attrib ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int color , - int type , - int font , - XW_DRAWMODE mode -#endif - ); - - XW_ATTRIB Xw_get_text_attrib ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int *color , - int *type , - int *font , - XW_DRAWMODE *mode -#endif - ); - - XW_ATTRIB Xw_set_extended_text_attrib ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int color , - int font , - XW_DRAWMODE mode , - XW_EXTENDEDTEXT *attribs -#endif - ); - - XW_ATTRIB Xw_set_marker_attrib ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int color , - int type , - int width , - XW_DRAWMODE mode -#endif - ); - - XW_ATTRIB Xw_get_marker_attrib ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int *color , - int *type , - int *width , - XW_DRAWMODE *mode -#endif - ); - -/* - Output primitives -*/ - - void Xw_set_clipping ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int flag -#endif - ); - - int Xw_get_clipping ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_draw_line ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int npoint , - float* x , - float* y -#endif - ); - - XW_STATUS Xw_begin_line ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int npoint -#endif - ); - - XW_STATUS Xw_line_point ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float x , - float y -#endif - ); - - XW_STATUS Xw_close_line ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_draw_segment ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float x1 , - float y1 , - float x2 , - float y2 -#endif - ); - - XW_STATUS Xw_draw_segments ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int nsegments , - float* x1 , - float* y1 , - float* x2 , - float* y2 -#endif - ); - - XW_STATUS Xw_begin_segments ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int nsegment -#endif - ); - - XW_STATUS Xw_close_segments ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_draw_arc ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float xc , - float yc , - float xradius , - float yradius , - float start_angle , - float angle -#endif - ); - - XW_STATUS Xw_begin_arcs ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int narc -#endif - ); - - XW_STATUS Xw_close_arcs ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_draw_polyarc ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float xc , - float yc , - float xradius , - float yradius , - float start_angle , - float angle -#endif - ); - - XW_STATUS Xw_begin_polyarcs ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int narc -#endif - ); - - XW_STATUS Xw_close_polyarcs ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - - XW_STATUS Xw_draw_poly ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int npoint , - float* x , - float* y -#endif - ); - - XW_STATUS Xw_begin_poly ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int npoint , - int npath -#endif - ); - - XW_STATUS Xw_poly_point ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float x , - float y -#endif - ); - - XW_STATUS Xw_close_poly ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_close_path ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_draw_text ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float x , - float y , - char* text , - float angle , - int mode -#endif - ); - - XW_STATUS Xw_draw_polytext ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float x , - float y , - char* text , - float angle , - float marge , - int mode -#endif - ); - - XW_STATUS Xw_get_text_size ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int Index , - char* string , - float* width , - float* height , - float* xoffset , - float* yoffset -#endif - ); - - XW_STATUS Xw_draw_marker ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int Index , - float x , - float y , - float width , - float height , - float angle -#endif - ); - - XW_STATUS Xw_begin_markers ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int nmarker -#endif - ); - - XW_STATUS Xw_close_markers ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_draw_point ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float x , - float y -#endif - ); - - XW_STATUS Xw_begin_points ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int npoint -#endif - ); - - XW_STATUS Xw_close_points ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_open_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId, - float Xpivot, - float Ypivot, - int widthindex, - int colorindex, - int fontindex, - XW_DRAWMODE drawmode -#endif - ); - - XW_STATUS Xw_close_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId -#endif - ); - - XW_STATUS Xw_set_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId -#endif - ); - - XW_STATUS Xw_draw_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId -#endif - ); - - XW_STATUS Xw_erase_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId -#endif - ); - - XW_STATUS Xw_move_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId, - float Xpivot, - float Ypivot -#endif - ); - - XW_STATUS Xw_scale_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId, - float Sx, - float Sy -#endif - ); - - XW_STATUS Xw_rotate_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId, - float Angle -#endif - ); - - XW_STATUS Xw_clear_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId -#endif - ); - - - XW_STATUS Xw_get_buffer_info ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId, - float* xpivot, - float* ypivot, - float* xscale, - float* yscale, - float* angle -#endif - ); - - XW_STATUS Xw_get_buffer_status ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int BufferId, - int* isOpen, - int* isDrawn, - int* isEmpty -#endif - ); - -/* - Window Miscellaneous -*/ - - XW_STATUS Xw_def_background_color ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float r , - float g , - float b -#endif - ); - - XW_STATUS Xw_set_background_index ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int index -#endif - ); - - XW_STATUS Xw_get_background_index ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int* index -#endif - ); - - XW_STATUS Xw_get_background_color ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float* r , - float* g , - float* b -#endif - ); - XW_STATUS Xw_get_background_pixel ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - unsigned long* pixel -#endif - ); - - XW_STATUS Xw_open_pixmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_close_pixmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_open_background_pixmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_close_background_pixmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_set_double_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_DOUBLEBUFFERMODE state -#endif - ); - - XW_DOUBLEBUFFERMODE Xw_get_double_buffer ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_erase_window ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_erase_area ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int Xcenter , - int Ycenter , - int width , - int height -#endif - ); - - XW_RESIZETYPE Xw_resize_window ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_restore_area ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int Xcenter , - int Ycenter , - int width , - int height -#endif - ); - - XW_STATUS Xw_restore_window ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_flush ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension, - int synchronize -#endif - ); - - XW_EXT_WINDOW* Xw_def_window ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension , - Aspect_Handle XWindowID, - int istransparent -#endif - ); - - XW_STATUS Xw_isdefine_window ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - Aspect_Handle Xw_open_window ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension , - Xw_TypeOfVisual pclass , - Aspect_Handle parent , - float xc , - float yc , - float width , - float height , - char* title , - int istransparent -#endif - ); - - XW_STATUS Xw_close_window ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension, - int destroy -#endif - ); - - XW_STATUS Xw_set_window_state ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_WINDOWSTATE state -#endif - ); - - XW_STATUS Xw_set_window_ratio ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float ratio -#endif - ); - - XW_STATUS Xw_set_window_position ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int Xcenter , - int Ycenter , - int width , - int height -#endif - ); - - XW_WINDOWSTATE Xw_get_window_position ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int* Xcenter , - int* Ycenter , - int* width , - int* height -#endif - ); - - XW_WINDOWSTATE Xw_get_window_state ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_get_window_size ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int* width , - int* height -#endif - ); - - Xw_TypeOfVisual Xw_get_window_visual ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - float Xw_get_window_pixelvalue ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int Pv -#endif - ); - - XW_STATUS Xw_get_window_pixelcoord ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int Px , - int Py , - float* Dx , - float* Dy -#endif - ); - - XW_STATUS Xw_get_window_info ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - Aspect_Handle* window , - Aspect_Handle* pixmap , - Aspect_Handle* root , - Aspect_Handle* colormap, - Xw_TypeOfVisual* pclass , - int* depth , - int* visualid -#endif - ); - - XW_STATUS Xw_set_hard_cursor ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int XcursorID , - int grab , - float red , - float green , - float blue -#endif - ); - - XW_STATUS Xw_set_soft_cursor ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_CURSORTYPE cursor , - int button -#endif - ); - - XW_STATUS Xw_get_cursor_position ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int* Xpos , - int* Ypos -#endif - ); - -/* - Images Miscellaneous -*/ - - XW_EXT_IMAGEDATA* Xw_open_image ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_USERDATA* aimageinfo, - int width , - int height -#endif - ); - - XW_STATUS Xw_isdefine_image ( -#ifdef XW_PROTOTYPE - XW_EXT_IMAGEDATA* image_extension -#endif - ); - - XW_STATUS Xw_close_image ( -#ifdef XW_PROTOTYPE - XW_EXT_IMAGEDATA* image_extension -#endif - ); - - XW_STATUS Xw_draw_image ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EXT_IMAGEDATA* image_extension , - float Xcenter , - float Ycenter -#endif - ); - -XW_STATUS Xw_draw_zoomed_image -( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension, - XW_EXT_IMAGEDATA* image_extension, - float Xcenter, - float Ycenter, - float zoom -#endif -); - - XW_STATUS Xw_zoom_image ( -#ifdef XW_PROTOTYPE - XW_EXT_IMAGEDATA* image_extension , - float zoom -#endif - ); - - XW_STATUS Xw_gamma_image ( -#ifdef XW_PROTOTYPE - XW_EXT_IMAGEDATA* image_extension , - float gamma -#endif - ); - - - XW_STATUS Xw_put_background_image ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EXT_IMAGEDATA* image_extension , - Aspect_FillMethod method -#endif - ); - - XW_STATUS Xw_update_background_image ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_STATUS Xw_set_background_pixmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW * awindow, - Aspect_Handle apixmap -#endif - ); - - XW_STATUS Xw_get_background_pixmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW * awindow, - Aspect_Handle& apixmap -#endif - ); - - XW_STATUS Xw_clear_background_image ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - - XW_EXT_IMAGEDATA* Xw_get_image ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_USERDATA* aimageinfo, - int Xcenter , - int Ycenter , - int width , - int height -#endif - ); - - XW_EXT_IMAGEDATA* Xw_get_image_from_pixmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_USERDATA* aimageinfo, - Aspect_Handle pixmapID, - int Xcenter , - int Ycenter , - int width , - int height -#endif - ); - - XW_STATUS Xw_get_background_image ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - int Xcenter , - int Ycenter , - int width , - int height -#endif - ); - - XW_EXT_IMAGEDATA* Xw_get_image_handle ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_USERDATA* aimageinfo -#endif - ); - - XW_EXT_IMAGEDATA* Xw_load_image ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_USERDATA* aimageinfo , - char* FileName -#endif - ); - - XW_STATUS Xw_convert_image ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EXT_IMAGEDATA* image_extension, - XW_EXT_COLOR* color_extension, - int ncolors -#endif - ); - - XW_STATUS Xw_get_image_info ( -#ifdef XW_PROTOTYPE - XW_EXT_IMAGEDATA* image_extension, - float* zoom , - int* width , - int* height , - int* depth -#endif - ); - - XW_STATUS Xw_save_image ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EXT_IMAGEDATA* image_extension , - char* FileName -#endif - ); - - XW_STATUS Xw_put_pixel ( -#ifdef XW_PROTOTYPE - XW_EXT_IMAGEDATA* image_extension , - int x , - int y , - int index , - int npixel -#endif - ); - - XW_STATUS Xw_put_rgbpixel ( -#ifdef XW_PROTOTYPE - XW_EXT_IMAGEDATA* image_extension , - int x , - int y , - float r , - float g , - float b , - int npixel -#endif - ); - - XW_STATUS Xw_get_pixel ( -#ifdef XW_PROTOTYPE - XW_EXT_IMAGEDATA* image_extension , - int x , - int y , - int* index , - int* npixel -#endif - ); - - XW_STATUS Xw_get_rgbpixel ( -#ifdef XW_PROTOTYPE - XW_EXT_IMAGEDATA* image_extension , - int x , - int y , - float* r , - float* g , - float* b , - int* npixel -#endif - ); - - XW_STATUS Xw_alloc_pixel ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - unsigned long *pixel -#endif - ); - - XW_STATUS Xw_free_pixel ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - unsigned long pixel -#endif - ); - - XW_STATUS Xw_set_pixel ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - unsigned long pixel , - float r , - float g , - float b -#endif - ); - - XW_STATUS Xw_set_pixel ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - unsigned long pixel , - float r , - float g , - float b -#endif - ); - -/* - Display miscellaneous -*/ - - XW_EXT_DISPLAY* Xw_set_display ( -#ifdef XW_PROTOTYPE - void* pDisplay -#endif - ); - - XW_EXT_DISPLAY* Xw_open_display ( -#ifdef XW_PROTOTYPE - char* connexion -#endif - ); - - char* Xw_get_display_name ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* adisplay -#endif - ); - - int Xw_get_plane_layer ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* adisplay , - int visualid -#endif - ); - - XW_EXT_DISPLAY* Xw_get_display ( -#ifdef XW_PROTOTYPE - char* connexion -#endif - ); - - XW_STATUS Xw_close_display ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* adisplay -#endif - ); - - XW_STATUS Xw_get_screen_size ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* adisplay , - int* width , - int* height -#endif - ); - - XW_STATUS Xw_get_mmscreen_size ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* adisplay , - float* width , - float* height -#endif - ); - - XW_STATUS Xw_get_screen_pixelcoord ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display , - int px , - int py , - float* sx , - float* sy -#endif - ); - - XW_STATUS Xw_get_pixel_screencoord ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display , - float sx , - float sy , - int* px , - int* py -#endif - ); - - float Xw_get_screen_pixelvalue ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display , - int pv -#endif - ); - - int Xw_get_pixel_screenvalue ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display , - float sv -#endif - ); - - float Xw_get_mmscreen_pixelvalue ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display , - int pv -#endif - ); - - int Xw_get_pixel_mmscreenvalue ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* adisplay , - float mv -#endif - ); - - XW_STATUS Xw_isdefine_display ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension -#endif - ); - -#if defined(XW_PROTOTYPE) && ( defined(__cplusplus) || defined(c_plusplus) ) -extern "C" { -#endif - XW_STATUS Xw_get_display_info ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension , - Aspect_Handle** display , - Aspect_Handle* root , - Aspect_Handle* colormap , - Xw_TypeOfVisual* pclass , - int* depth -#endif - ); -#if defined(XW_PROTOTYPE) && ( defined(__cplusplus) || defined(c_plusplus) ) - } -#endif - - Xw_TypeOfVisual Xw_get_display_visual ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension , - Xw_TypeOfVisual visual -#endif - ); -/* - IconBox -*/ - - int Xw_load_icons ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* iconbox_extension , - char* filename -#endif - ); - - int Xw_clear_icons ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* iconbox_extension , - char* filename -#endif - ); - - XW_STATUS Xw_show_icons ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* iconbox_extension -#endif - ); - - int Xw_save_icons ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* iconbox_extension -#endif - ); - - Aspect_Handle Xw_get_icon_pixmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* iconbox_extension , - int width , - int height , - char* iconname -#endif - ); - - XW_STATUS Xw_get_icon_size ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* iconbox_extension , - char* iconname, - int* width , - int* height -#endif - ); - - char* Xw_get_icon_name ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* iconbox_extension , - int index -#endif - ); - - XW_STATUS Xw_put_window_icon ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* iconbox_extension , - XW_EXT_WINDOW* window_extension , - char* iconname , - int width , - int height -#endif - ); - - -/* - Colormap & Color attributs definition -*/ - - XW_EXT_COLORMAP* Xw_def_colormap ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension , - Xw_TypeOfVisual pclass , - int ncolor , - Aspect_Handle BaseMap , - Xw_TypeOfMapping mapping -#endif - ); - - XW_STATUS Xw_close_colormap ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension -#endif - ); - - XW_STATUS Xw_set_colormap_mapping ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension, - Xw_TypeOfMapping mapping -#endif - ); - - XW_STATUS Xw_isdefine_colormap ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension -#endif - ); - - XW_STATUS Xw_set_colormap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EXT_COLORMAP* colormap_extension -#endif - ); - - Xw_TypeOfVisual Xw_get_colormap_visual ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension -#endif - ); - - Aspect_Handle Xw_get_colormap_xid ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension -#endif - ); - - XW_STATUS Xw_get_colormap_colorcube ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension, - Aspect_Handle *colormap, - int *visualid, - int *base_pixel, - int *red_max, - int *red_mult, - int *green_max, - int *green_mult, - int *blue_max, - int *blue_mult -#endif - ); - - XW_STATUS Xw_get_colormap_grayramp ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension, - Aspect_Handle *colormap, - int *visualid, - int *base_pixel, - int *gray_max, - int *gray_mult -#endif - ); - - XW_STATUS Xw_get_colormap_info ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - Aspect_Handle** visual, - Xw_TypeOfVisual* pclass , - int* visualid, - int* maxcolor , - int* systemcolor , - int* usercolor , - int* definecolor , - int* firstfreecolorindex -#endif - ); - - XW_STATUS Xw_def_color ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - int index , - float r , - float g , - float b -#endif - ); - - XW_STATUS Xw_def_highlight_color ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - float r , - float g , - float b -#endif - ); - - XW_STATUS Xw_get_color ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - int index , - float* r , - float* g , - float* b , - unsigned long* pixel -#endif - ); - - XW_STATUS Xw_get_color_index ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - float r , - float g , - float b , - int* index -#endif - ); - - XW_STATUS Xw_get_color_pixel ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - float r , - float g , - float b , - unsigned long* pixel , - int* isapproximate -#endif - ); - - XW_STATUS Xw_get_color_name ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - const char* name , - float* r , - float* g , - float* b -#endif - ); - - XW_STATUS Xw_get_highlight_color ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - float* r , - float* g , - float* b -#endif - ); - - XW_STATUS Xw_get_highlight_pixel ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - unsigned long* pixel -#endif - ); - - XW_STATUS Xw_isdefine_color ( -#ifdef XW_PROTOTYPE - XW_EXT_COLORMAP* colormap_extension , - int index -#endif - ); -/* - Widthmap & Width attributs definition -*/ - - XW_EXT_WIDTHMAP* Xw_def_widthmap ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension , - int nwidth -#endif - ); - - XW_STATUS Xw_close_widthmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WIDTHMAP* widthmap_extension -#endif - ); - - XW_STATUS Xw_isdefine_widthmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WIDTHMAP* widthmap_extension -#endif - ); - - XW_STATUS Xw_set_widthmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EXT_WIDTHMAP* widthmap_extension -#endif - ); - - XW_STATUS Xw_get_widthmap_info ( -#ifdef XW_PROTOTYPE - XW_EXT_WIDTHMAP* widthmap_extension , - int* maxwidth , - int* userwidth , - int* definewidth , - int* firstfreewidthindex -#endif - ); - - XW_STATUS Xw_def_width ( -#ifdef XW_PROTOTYPE - XW_EXT_WIDTHMAP* widthmap_extension , - int index , - float MMwidth -#endif - ); - - XW_STATUS Xw_get_width_index ( -#ifdef XW_PROTOTYPE - XW_EXT_WIDTHMAP* widthmap_extension , - float Width , - int* index -#endif - ); - - XW_STATUS Xw_get_width ( -#ifdef XW_PROTOTYPE - XW_EXT_WIDTHMAP* widthmap_extension , - int index , - float* MMwidth -#endif - ); - - XW_STATUS Xw_isdefine_width ( -#ifdef XW_PROTOTYPE - XW_EXT_WIDTHMAP* widthmap_extension , - int index -#endif - ); - -/* - Typemap & Type attributs definition -*/ - - XW_EXT_TYPEMAP* Xw_def_typemap ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension , - int ntype -#endif - ); - - XW_STATUS Xw_close_typemap ( -#ifdef XW_PROTOTYPE - XW_EXT_TYPEMAP* typemap_extension -#endif - ); - - XW_STATUS Xw_isdefine_typemap ( -#ifdef XW_PROTOTYPE - XW_EXT_TYPEMAP* typemap_extension -#endif - ); - - XW_STATUS Xw_set_typemap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EXT_TYPEMAP* typemap_extension -#endif - ); - - XW_STATUS Xw_get_typemap_info ( -#ifdef XW_PROTOTYPE - XW_EXT_TYPEMAP* typemap_extension , - int* maxtype , - int* usertype , - int* definetype , - int* firstfreetypeindex -#endif - ); - - XW_STATUS Xw_def_type ( -#ifdef XW_PROTOTYPE - XW_EXT_TYPEMAP* typemap_extension , - int index , - int DescriptorLength , - float* TypeDescriptor -#endif - ); - - XW_STATUS Xw_get_type ( -#ifdef XW_PROTOTYPE - XW_EXT_TYPEMAP* typemap_extension , - int index , - int* DescriptorLength , - float* TypeDescriptor -#endif - ); - - XW_STATUS Xw_get_type_index ( -#ifdef XW_PROTOTYPE - XW_EXT_TYPEMAP* typemap_extension , - float* TypeDescriptor , - int DescriptorLength , - int* index -#endif - ); - - XW_STATUS Xw_isdefine_type ( -#ifdef XW_PROTOTYPE - XW_EXT_TYPEMAP* typemap_extension , - int index -#endif - ); - -/* - Fontmap & Font attributs definition -*/ - - XW_EXT_FONTMAP* Xw_def_fontmap ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension , - int nfont -#endif - ); - - XW_STATUS Xw_close_fontmap ( -#ifdef XW_PROTOTYPE - XW_EXT_FONTMAP* fontmap_extension -#endif - ); - - XW_STATUS Xw_isdefine_fontmap ( -#ifdef XW_PROTOTYPE - XW_EXT_FONTMAP* fontmap_extension -#endif - ); - - XW_STATUS Xw_set_fontmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EXT_FONTMAP* fontmap_extension -#endif - ); - - XW_STATUS Xw_get_fontmap_info ( -#ifdef XW_PROTOTYPE - XW_EXT_FONTMAP* fontmap_extension , - int* maxfont , - int* userfont , - int* definefont , - int* firstfreefontindex -#endif - ); - - XW_STATUS Xw_def_font ( -#ifdef XW_PROTOTYPE - XW_EXT_FONTMAP* fontmap_extension , - int index , - float size , - char* FontName -#endif - ); - - XW_STATUS Xw_get_font_index ( -#ifdef XW_PROTOTYPE - XW_EXT_FONTMAP* fontmap_extension , - float size , - char* FontName , - int* index -#endif - ); - - - char* Xw_get_font ( -#ifdef XW_PROTOTYPE - XW_EXT_FONTMAP* fontmap_extension , - int index , - float* size , - float* bheight -#endif - ); - - XW_STATUS Xw_isdefine_font ( -#ifdef XW_PROTOTYPE - XW_EXT_FONTMAP* fontmap_extension , - int index -#endif - ); - -/* - Tilemap & Tile attributs definition -*/ - - XW_EXT_TILEMAP* Xw_def_tilemap ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension , - int ntile -#endif - ); - - XW_STATUS Xw_isdefine_tilemap ( -#ifdef XW_PROTOTYPE - XW_EXT_TILEMAP* tilemap_extension -#endif - ); - - XW_STATUS Xw_set_tilemap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EXT_TILEMAP* tilemap_extension -#endif - ); - - XW_STATUS Xw_get_tilemap_info ( -#ifdef XW_PROTOTYPE - XW_EXT_TILEMAP* tilemap_extension , - int* maxtile , - int* usertile , - int* definetile , - int* firstfreetileindex -#endif - ); - - XW_STATUS Xw_def_tile ( -#ifdef XW_PROTOTYPE - XW_EXT_TILEMAP* tilemap_extension , - int index , - int width , - int height , - char* tiledata -#endif - ); - - XW_STATUS Xw_isdefine_tile ( -#ifdef XW_PROTOTYPE - XW_EXT_TILEMAP* tilemap_extension , - int index -#endif - ); -/* - Markmap & Marker attributs definition -*/ - - XW_EXT_MARKMAP* Xw_def_markmap ( -#ifdef XW_PROTOTYPE - XW_EXT_DISPLAY* display_extension , - int nmarker -#endif - ); - - XW_STATUS Xw_close_markmap ( -#ifdef XW_PROTOTYPE - XW_EXT_MARKMAP* markmap_extension -#endif - ); - - XW_STATUS Xw_isdefine_markmap ( -#ifdef XW_PROTOTYPE - XW_EXT_MARKMAP* markmap_extension -#endif - ); - - XW_STATUS Xw_set_markmap ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EXT_MARKMAP* markmap_extension -#endif - ); - - XW_STATUS Xw_get_markmap_info ( -#ifdef XW_PROTOTYPE - XW_EXT_MARKMAP* markmap_extension , - int* maxmarker , - int* usermarker , - int* definemarker , - int* firstfreemarkerindex -#endif - ); - - - XW_STATUS Xw_def_marker ( -#ifdef XW_PROTOTYPE - XW_EXT_MARKMAP* markmap_extension , - int index , - int length , - int* spoint , - float* xpoint , - float* ypoint -#endif - ); - - XW_STATUS Xw_isdefine_marker ( -#ifdef XW_PROTOTYPE - XW_EXT_MARKMAP* markmap_extension , - int index -#endif - ); - - XW_STATUS Xw_isdefine_marker ( -#ifdef XW_PROTOTYPE - XW_EXT_MARKMAP* markmap_extension , - int index -#endif - ); - - XW_STATUS Xw_get_marker_index ( -#ifdef XW_PROTOTYPE - XW_EXT_MARKMAP* markmap_extension , - int DescriptorLength , - int* sVector , - float* xVector , - float* yVector , - int* index -#endif - ); -/* - Event management -*/ - - XW_STATUS Xw_set_event ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - XW_EVENTTYPE type , - XW_CALLBACK call_back_routine, - XW_USERDATA* user_data -#endif - ); - - XW_STATUS Xw_wait_event ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension -#endif - ); - -/* - Mapping -*/ - - - XW_STATUS Xw_get_pixel_windowcoord ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float ux , - float uy , - int* px , - int* py -#endif - ); - - int Xw_get_pixel_windowvalue ( -#ifdef XW_PROTOTYPE - XW_EXT_WINDOW* window_extension , - float uv -#endif - ); - -/* - Environment -*/ - - XW_STATUS Xw_get_env( -#ifdef XW_PROTOTYPE - const char* symbol, - char* value, - int length -#endif - ); - -#endif /*XW_CEXTERN*/ diff --git a/src/Xw/Xw_ColorMap.cdl b/src/Xw/Xw_ColorMap.cdl deleted file mode 100755 index ad0e159d4c..0000000000 --- a/src/Xw/Xw_ColorMap.cdl +++ /dev/null @@ -1,312 +0,0 @@ --- Created on: 1993-08-24 --- Created by: GG --- Copyright (c) 1993-1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - - -class ColorMap from Xw inherits TShared from MMgt - - ---Version: 0.0 - - ---Purpose: This class defines a GenericColorMap object. - - ---Keywords: - ---Warning: - ---References: - -uses - - ColorMap from Aspect, - ColorMapEntry from Aspect, - Parameter from Quantity, - Color from Quantity, - NameOfColor from Quantity, - TypeOfVisual from Xw, - TypeOfMapping from Xw, - Handle from Aspect - -raises - - ColorMapDefinitionError from Aspect, - BadAccess from Aspect - -is - - Create - returns mutable ColorMap from Xw - is protected; - ---Level: Internal - - Create (Connexion : CString from Standard ; - Visual : TypeOfVisual from Xw = Xw_TOV_PREFERRED_PSEUDOCOLOR; - Mapping : TypeOfMapping from Xw = Xw_TOM_COLORCUBE; - Ncolors : Integer from Standard = 0; - UseDefault: Boolean from Standard = Standard_True ) - returns mutable ColorMap from Xw - ---Level: Public - ---Purpose: Creates a generic ColorMap with a maximum of - -- unallocated ColorMapEntry. - -- Sets this colormap with the best colorcube in - -- the Default HardWare Colormap. - raises ColorMapDefinitionError from Aspect; - ---Error if ColorMap creation failed according - -- to the supported hardware - - SetEntry ( me : mutable ; - Index: Integer from Standard; - Red,Green,Blue: Real from Standard) - ---Level: Public - ---Purpose: Modifies an entry in the color map . - raises BadAccess from Aspect is virtual; - ---Purpose: Warning if Index is < 0 or >= MaxColors() - -- or ColorMap is not defined properly - - SetEntry ( me : mutable ; - Entry : ColorMapEntry from Aspect) - ---Level: Public - ---Purpose: Modifies an entry in the color map . - raises BadAccess from Aspect is virtual; - ---Purpose: Warning if ColorMap size is exceeded. - -- or ColorMap is not defined properly - -- or ColorMapEntry Index is out of range according - -- to the supported hardware, - -- or the Mapping type of this colormap is READ_ONLY. - - SetEntries ( me : mutable ; - Colormap : ColorMap from Aspect ) - ---Level: Public - ---Purpose: Modifies all Entries from the new colormap - raises BadAccess from Aspect is virtual; - ---Purpose: Warning if ColorMap size is exceeded. - -- or ColorMap is not defined properly - -- or One of the new ColorMapEntry Index is out of range - -- according to the supported hardware - - SetHighlightColor( me : mutable ; aColor : Color from Quantity ) - ---Level: Public - ---Purpose: Sets the Highlight Color for all Windows - -- which use it . - -- Error if Colormap is not defined properly - raises BadAccess from Aspect is virtual; - - Destroy( me : mutable ) is virtual; - ---Level: Public - ---Purpose: Destroies the Colormap - ---C++: alias ~ - - ---------------------------- - -- Category: Inquire methods - ---------------------------- - - HighlightColor( me ) - returns Color from Quantity is virtual; - ---Level: Public - ---Purpose: Returns the highlight color . - - PixelOfColor ( me ; aColor : Color from Quantity ) - returns Integer from Standard - ---Level: Public - ---Purpose: Returns a pixel value of an RGB color given as - -- Quantity_Color, depending of the HardWare and - -- Visual class. - raises BadAccess from Aspect is virtual; - ---Error If ColorMap is not defined properly - - AllocatesPixelOfColor ( me ) - returns Integer from Standard - ---Level: Advanced - ---Purpose: Returns an allocated pixel of color - -- writable by using the method SetColorOfPixel(..) - -- or -1 if no more pixel must be allocated. - -- Warning: this call take has an effect in PseudoColor model only. - raises BadAccess from Aspect is virtual; - ---Error If ColorMap is not defined properly - - FreePixelOfColor ( me ; aPixel: Integer from Standard ); - ---Level: Advanced - ---Purpose: Free an allocated pixel of color - -- Warning: this call take has an effect in PseudoColor model only. - - SetColorOfPixel ( me ; aPixel: Integer from Standard; - aColor : Color from Quantity ) - returns Boolean from Standard - ---Level: Advanced - ---Purpose: Returns TRUE if the allocated pixel - -- has been updated correctly with the color - raises BadAccess from Aspect is virtual; - ---Error If ColorMap is not defined properly - - Entry ( me ; Index : Integer from Standard; - Red,Green,Blue: out Real from Standard ) - returns Integer from Standard - ---Level: Public - ---Purpose: Returns a pixel value and the components of the - -- corresponding color index. - raises BadAccess from Aspect is virtual; - ---Error If ColorMap is not defined properly - -- or Index is < 0 or >= MaxColors(). - - HighlightPixel (me) - returns Integer from Standard - ---Level: Public - ---Purpose: Returns the current HighLight pixel value , - -- depending of the HardWare and Visual class - raises BadAccess from Aspect is virtual; - ---Error If ColorMap is not defined properly - - MaxColors ( me ) - returns Integer from Standard is static; - ---Level: Public - ---Purpose: Returns the number of available colors in the colormap. - -- or 0 if the colormap is not enabled. - - MaxOverlayColors ( me ) - returns Integer from Standard is static; - ---Level: Public - ---Purpose: Returns the number of available colors in the associated - -- overlay colormap if any. - -- or 0 if the overlay colormap is not enabled. - - XColorMap ( me ) - returns Handle from Aspect - ---Level: Public - ---Purpose: Returns the Colormap XId of the Colormap - -- depending of the HardWare and Visual class - raises BadAccess from Aspect is static; - ---Error If ColorMap is not defined properly - - XColorCube ( me ; ColormapID: out Handle from Aspect; - VisualID: out Integer from Standard; - BasePixel: out Integer from Standard; - RedMax: out Integer from Standard; - RedMult: out Integer from Standard; - GreenMax: out Integer from Standard; - GreenMult: out Integer from Standard; - BlueMax: out Integer from Standard; - BlueMult: out Integer from Standard ) - returns Boolean from Standard is static; - ---Level: Public - ---Purpose: Returns TRUE and the color-cube definition of the colormap - -- depending of the HardWare and Visual class - -- or returns FALSE if the colormap dont't have a color-cube defined. - -- Color computation from the colorcube : - -- colorindex = BasePixel + - -- r*RedMax*RedMult + g*GreenMax*GreenMult + b*BlueMax*BlueMult - -- where r,g,b are the red,green,blue components of the color in the - -- range [0.,1.] - - XGrayRamp ( me ; ColormapID: out Handle from Aspect; - VisualID: out Integer from Standard; - BasePixel: out Integer from Standard; - GrayMax: out Integer from Standard; - GrayMult: out Integer from Standard) - returns Boolean from Standard is static; - ---Level: Public - ---Purpose: Returns TRUE and the gray-ramp definition of the colormap - -- depending of the HardWare and Visual class - -- or returns FALSE if the colormap dont't have a gray-ramp defined. - -- Color computation from the grayramp : - -- colorindex = BasePixel + g*GrayMax*GrayMult - -- where g is the gray intensity of the color in the - -- range [0.,1.] - - XOverlayColorMap ( me ) - returns Handle from Aspect - ---Level: Public - ---Purpose: Returns the Colormap XId of the associated Overlay Colormap - -- depending of the HardWare and Visual class - raises BadAccess from Aspect is static; - ---Error If ColorMap is not defined properly - - XVisual ( me ) - returns Address from Standard - ---Level: Public - ---Purpose: Returns the Visual address of the Colormap - -- depending of the HardWare - raises BadAccess from Aspect is static; - ---Error If ColorMap is not defined properly - - XOverlayVisual ( me ) - returns Address from Standard - ---Level: Public - ---Purpose: Returns the Visual address of the associated Overlay Colormap - -- depending of the HardWare - raises BadAccess from Aspect is static; - ---Error If ColorMap is not defined properly - - VisualClass ( me ) - returns TypeOfVisual from Xw - ---Level: Public - ---Purpose: Returns the Visual Class of the Colormap - -- depending of the HardWare - raises BadAccess from Aspect is static; - ---Error If ColorMap is not defined properly - - OverlayVisualClass ( me ) - returns TypeOfVisual from Xw - ---Level: Public - ---Purpose: Returns the Visual Class of the associated Overlay Colormap - -- depending of the HardWare - raises BadAccess from Aspect is static; - ---Error If ColorMap is not defined properly - - VisualID ( me ) - returns Integer from Standard - ---Level: Public - ---Purpose: Returns the Visual ID of the Colormap - -- depending of the HardWare - raises BadAccess from Aspect is static; - ---Error If ColorMap is not defined properly - - OverlayVisualID ( me ) - returns Integer from Standard - ---Level: Public - ---Purpose: Returns the Visual ID of the associated Overlay Colormap - -- depending of the HardWare - raises BadAccess from Aspect is static; - ---Error If ColorMap is not defined properly - - ExtendedColorMap ( me ) - returns Address from Standard - is static protected ; - ---Level: Public - ---Purpose: Returns extended data colormap structure pointer. - ---Category: Inquire methods - - ExtendedOverlayColorMap ( me ) - returns Address from Standard - is static protected ; - ---Level: Public - ---Purpose: Returns extended data overlay colormap structure pointer. - ---Category: Inquire methods - - PrintError(myclass) is protected; - ---Purpose: Print last error or raise depending of the error gravity. - -fields - - MyExtendedDisplay : Address from Standard ; - MyExtendedColorMap : Address from Standard ; - MyExtendedOverlayColorMap : Address from Standard ; - MyMapping : TypeOfMapping from Xw ; - -friends - - class Window from Xw - -end ColorMap; diff --git a/src/Xw/Xw_ColorMap.cxx b/src/Xw/Xw_ColorMap.cxx deleted file mode 100755 index 55e9244933..0000000000 --- a/src/Xw/Xw_ColorMap.cxx +++ /dev/null @@ -1,417 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define PRO7349 //GG_11/04/97 -// Modification de la methode PixelOfColor -// qui renvoie maintenant un numero de pixel negatif -// lorsqu'il correspond a une couleur approximee. - -#define PRO10676 //GG_151297 -// Permettre de reserver un index de couleur modifiable -// dans la colormap. - -#include -#include -#include -#include - -// Routines C a declarer en extern -//extern "C" { -#include -//} - -//-Static data definitions - -static XW_STATUS status ; - -void Xw_ColorMap::PrintError() { -Standard_CString ErrorMessag ; -Standard_Integer ErrorNumber ; -Standard_Integer ErrorGravity ; - - status = XW_SUCCESS ; - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) Aspect_ColorMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; -} - -Xw_ColorMap::Xw_ColorMap () { -} - -Xw_ColorMap::Xw_ColorMap (const Standard_CString Connexion, const Xw_TypeOfVisual Visual, const Xw_TypeOfMapping Mapping, const Standard_Integer Ncolors, const Standard_Boolean UseDefault) { -Aspect_Handle BaseMap = 0 ; - - MyExtendedDisplay = Xw_open_display((Standard_PCharacter)Connexion) ; - - if( !MyExtendedDisplay ) PrintError() ; - - if( UseDefault ) { - Aspect_Handle *display,root ; - Xw_TypeOfVisual vclass ; - int depth ; - - status = Xw_get_display_info (MyExtendedDisplay, - &display,&root,&BaseMap,&vclass,&depth); - if( Visual != vclass ) BaseMap = 0; - } - - MyExtendedColorMap = Xw_def_colormap(MyExtendedDisplay, - Visual,Ncolors,BaseMap,Mapping) ; - - if( !Xw_isdefine_colormap(MyExtendedColorMap) ) PrintError() ; - - MyExtendedOverlayColorMap = Xw_def_colormap(MyExtendedDisplay, - Xw_TOV_OVERLAY,0,0,Xw_TOM_READONLY) ; - - SetHighlightColor(Quantity_NOC_WHITESMOKE) ; - - MyMapping = Mapping ; -} - -void Xw_ColorMap::SetEntry (const Standard_Integer Index,const Standard_Real Red, const Standard_Real Green, const Standard_Real Blue) { - - - switch ( MyMapping ) { - - case Xw_TOM_HARDRAMP: - case Xw_TOM_SIMPLERAMP: - case Xw_TOM_BESTRAMP: - status = Xw_def_color(MyExtendedColorMap, - (int)Index,(float)Red,(float)Green,(float)Blue) ; - - if( !status ) PrintError() ; - break ; - - case Xw_TOM_COLORCUBE: - case Xw_TOM_READONLY: - Aspect_BadAccess::Raise ("Try to write in a READ ONLY colormap"); - } - -} - -void Xw_ColorMap::SetEntry (const Aspect_ColorMapEntry& Entry) { -Standard_Real r,g,b ; - - (Entry.Color()).Values(r,g,b,Quantity_TOC_RGB) ; - - SetEntry(Entry.Index(),r,g,b) ; - -} - -void Xw_ColorMap::SetEntries (const Handle(Aspect_ColorMap)& Colormap) { -Standard_Integer size = Colormap->Size() ; -Standard_Integer i ; - - for( i=1 ; i<=size ; i++ ) { - SetEntry(Colormap->Entry(i)) ; - } -} - -void Xw_ColorMap::SetHighlightColor ( const Quantity_Color& aColor) { -Standard_Real r,g,b ; - - aColor.Values(r,g,b,Quantity_TOC_RGB) ; - - status = Xw_def_highlight_color(MyExtendedColorMap, - (float)r,(float)g,(float)b) ; - if( !status ) PrintError() ; - - if( MyExtendedOverlayColorMap ) { - status = Xw_def_highlight_color(MyExtendedOverlayColorMap, - (float)r,(float)g,(float)b) ; - if( !status ) PrintError() ; - } -} - -void Xw_ColorMap::Destroy() { - - if( MyExtendedColorMap ) { - Xw_close_colormap(MyExtendedColorMap) ; - MyExtendedColorMap = NULL ; - } - - if( MyExtendedOverlayColorMap ) { - Xw_close_colormap(MyExtendedOverlayColorMap) ; - MyExtendedOverlayColorMap = NULL ; - } -} - -Quantity_Color Xw_ColorMap::HighlightColor ( ) const { -float r,g,b ; - - status = Xw_get_highlight_color (MyExtendedColorMap,&r,&g,&b); - - Standard_Real Red = r; - Standard_Real Green = g; - Standard_Real Blue = b; - - return Quantity_Color(Red,Green,Blue,Quantity_TOC_RGB) ; -} - -Standard_Integer Xw_ColorMap::HighlightPixel ( ) const { -unsigned long pixel ; - - status = Xw_get_highlight_pixel(MyExtendedColorMap,&pixel) ; - - if( !status ) PrintError() ; - - return (Standard_Integer(pixel)) ; -} - -Standard_Integer Xw_ColorMap::PixelOfColor ( const Quantity_Color &aColor ) const { -Standard_Real Red,Green,Blue ; -unsigned long pixel ; -Standard_Integer isapproximate; - - aColor.Values(Red,Green,Blue,Quantity_TOC_RGB) ; - -#ifdef PRO7349 - status = Xw_get_color_pixel(MyExtendedColorMap, - (float)Red,(float)Green,(float)Blue,&pixel,&isapproximate) ; - if( !status ) PrintError() ; - - if( isapproximate ) return (-Standard_Integer(pixel)); - - else return (Standard_Integer(pixel)) ; -#else - status = Xw_get_color_pixel(MyExtendedColorMap, - (float)Red,(float)Green,(float)Blue,&pixel) ; - - if( !status ) PrintError() ; - - return (Standard_Integer(pixel)) ; -#endif -} - -#ifdef PRO10676 -Standard_Integer Xw_ColorMap::AllocatesPixelOfColor ( ) const { - unsigned long pixel; - if( Xw_alloc_pixel(MyExtendedColorMap,&pixel) ) - return Standard_Integer(pixel); - else { - Xw_print_error(); - return -1; - } -} - -void Xw_ColorMap::FreePixelOfColor ( const Standard_Integer aPixel ) const { - unsigned long pixel = aPixel; - Xw_free_pixel(MyExtendedColorMap,pixel); -} - -Standard_Boolean Xw_ColorMap::SetColorOfPixel ( const Standard_Integer aPixel, - const Quantity_Color &aColor ) const { -Standard_Real Red,Green,Blue ; - aColor.Values(Red,Green,Blue,Quantity_TOC_RGB) ; - Standard_ShortReal r = Red,g = Green,b = Blue; - unsigned long pixel = aPixel; - return Xw_set_pixel(MyExtendedColorMap,pixel,r,g,b); -} -#endif - -Standard_Integer Xw_ColorMap::Entry ( const Standard_Integer Index, Standard_Real &Red, Standard_Real &Green, Standard_Real &Blue ) const { -unsigned long pixel = 0 ; -float red,green,blue ; - - status = Xw_get_color(MyExtendedColorMap,Index, - &red,&green,&blue,&pixel) ; - - if( !status ) PrintError() ; - - Red = red; Green = green; Blue = blue; - - return (Standard_Integer(pixel)) ; -} - -Xw_TypeOfVisual Xw_ColorMap::VisualClass( ) const { -Xw_TypeOfVisual vclass ; - - vclass = Xw_get_colormap_visual(MyExtendedColorMap) ; - - if( vclass == Xw_TOV_DEFAULT ) PrintError() ; - - return (vclass) ; -} - -Xw_TypeOfVisual Xw_ColorMap::OverlayVisualClass( ) const { -Xw_TypeOfVisual vclass = Xw_TOV_DEFAULT; - - if( MyExtendedOverlayColorMap ) { - vclass = Xw_get_colormap_visual(MyExtendedOverlayColorMap) ; - } - - return (vclass) ; -} - -Standard_Integer Xw_ColorMap::VisualID( ) const { -Aspect_Handle *VisualInfo ; -Xw_TypeOfVisual VisualClass ; -int MaxColor,BasePixel,MaxUserColor,MaxDefineColor,FirstFreeColorIndex,visualid = 0 ; - - status = Xw_get_colormap_info(MyExtendedColorMap,&VisualInfo, - &VisualClass,&visualid,&MaxColor,&BasePixel, - &MaxUserColor,&MaxDefineColor,&FirstFreeColorIndex) ; - - if( !status ) Xw_print_error(); - - return (visualid) ; -} - -Standard_Integer Xw_ColorMap::OverlayVisualID( ) const { -Aspect_Handle *VisualInfo ; -Xw_TypeOfVisual VisualClass ; -int MaxColor,BasePixel,MaxUserColor,MaxDefineColor,FirstFreeColorIndex,visualid = 0; - - if( MyExtendedOverlayColorMap ) { - status = Xw_get_colormap_info(MyExtendedOverlayColorMap,&VisualInfo, - &VisualClass,&visualid,&MaxColor,&BasePixel, - &MaxUserColor,&MaxDefineColor,&FirstFreeColorIndex) ; - - if( !status ) Xw_print_error() ; - } - return (visualid) ; -} - -Standard_Integer Xw_ColorMap::MaxColors( ) const { -Aspect_Handle *VisualInfo ; -Xw_TypeOfVisual VisualClass ; -int MaxColor,BasePixel,MaxUserColor,MaxDefineColor,FirstFreeColorIndex,visualid ; - - status = Xw_get_colormap_info(MyExtendedColorMap,&VisualInfo, - &VisualClass,&visualid,&MaxColor,&BasePixel, - &MaxUserColor,&MaxDefineColor,&FirstFreeColorIndex) ; - - if( status ) { - if( VisualClass == Xw_TOV_TRUECOLOR ) return MaxColor ; - else return MaxUserColor; - } else { - Xw_print_error() ; - return 0 ; - } -} - -Standard_Integer Xw_ColorMap::MaxOverlayColors( ) const { -Aspect_Handle *VisualInfo ; -Xw_TypeOfVisual VisualClass ; -int MaxColor,BasePixel,MaxDefineColor,FirstFreeColorIndex,visualid, MaxUserColor = 0; - - status = XW_ERROR; - if( MyExtendedOverlayColorMap ) { - status = Xw_get_colormap_info(MyExtendedOverlayColorMap,&VisualInfo, - &VisualClass,&visualid,&MaxColor,&BasePixel, - &MaxUserColor,&MaxDefineColor,&FirstFreeColorIndex) ; - if( !status ) Xw_print_error() ; - } - - return (status) ? MaxUserColor : 0; -} - -Standard_Address Xw_ColorMap::XVisual( ) const { -Aspect_Handle *VisualInfo ; -Xw_TypeOfVisual VisualClass ; -int MaxColor,BasePixel,MaxUserColor,MaxDefineColor,FirstFreeColorIndex,visualid ; - - status = Xw_get_colormap_info(MyExtendedColorMap,&VisualInfo, - &VisualClass,&visualid,&MaxColor,&BasePixel, - &MaxUserColor,&MaxDefineColor,&FirstFreeColorIndex) ; - - if( !status ) PrintError() ; - - return (VisualInfo) ; -} - -Standard_Address Xw_ColorMap::XOverlayVisual( ) const { -Aspect_Handle *VisualInfo = NULL ; -Xw_TypeOfVisual VisualClass ; -int MaxColor,BasePixel,MaxUserColor,MaxDefineColor,FirstFreeColorIndex,visualid ; - - status = XW_ERROR; - if( MyExtendedOverlayColorMap ) { - status = Xw_get_colormap_info(MyExtendedOverlayColorMap,&VisualInfo, - &VisualClass,&visualid,&MaxColor,&BasePixel, - &MaxUserColor,&MaxDefineColor,&FirstFreeColorIndex) ; - if( !status ) Xw_print_error() ; - } - - return (status) ? VisualInfo : NULL ; -} - -Aspect_Handle Xw_ColorMap::XColorMap( ) const { -Aspect_Handle colormap ; - - colormap = Xw_get_colormap_xid(MyExtendedColorMap) ; - - if( !colormap ) PrintError() ; - - return (colormap) ; -} - -Aspect_Handle Xw_ColorMap::XOverlayColorMap( ) const { -Aspect_Handle colormap = 0; - - if( MyExtendedOverlayColorMap ) { - colormap = Xw_get_colormap_xid(MyExtendedOverlayColorMap) ; - } - - return (colormap); -} - -Standard_Address Xw_ColorMap::ExtendedColorMap () const { - - return (MyExtendedColorMap); - -} - -Standard_Address Xw_ColorMap::ExtendedOverlayColorMap () const { - - return (MyExtendedOverlayColorMap); - -} - -Standard_Boolean Xw_ColorMap::XColorCube ( Aspect_Handle &ColormapID, - Standard_Integer &VisualID, - Standard_Integer &BasePixel, - Standard_Integer &RedMax, - Standard_Integer &RedMult, - Standard_Integer &GreenMax, - Standard_Integer &GreenMult, - Standard_Integer &BlueMax, - Standard_Integer &BlueMult ) const -{ - - status = Xw_get_colormap_colorcube(MyExtendedColorMap, - &ColormapID,&VisualID,&BasePixel, - &RedMax,&RedMult,&GreenMax,&GreenMult,&BlueMax,&BlueMult); - - return status; -} - - -Standard_Boolean Xw_ColorMap::XGrayRamp ( Aspect_Handle &ColormapID, - Standard_Integer &VisualID, - Standard_Integer &BasePixel, - Standard_Integer &GrayMax, - Standard_Integer &GrayMult) const -{ - - status = Xw_get_colormap_grayramp(MyExtendedColorMap, - &ColormapID,&VisualID,&BasePixel,&GrayMax,&GrayMult); - - return status; -} - diff --git a/src/Xw/Xw_Extension.h b/src/Xw/Xw_Extension.h deleted file mode 100755 index 1551e9f6b6..0000000000 --- a/src/Xw/Xw_Extension.h +++ /dev/null @@ -1,955 +0,0 @@ -/* - Copyright (c) 1995-1999 Matra Datavision - Copyright (c) 1999-2012 OPEN CASCADE SAS - - The content of this file is subject to the Open CASCADE Technology Public - License Version 6.5 (the "License"). You may not use the content of this file - except in compliance with the License. Please obtain a copy of the License - at http://www.opencascade.org and read it completely before using this file. - - The Initial Developer of the Original Code is Open CASCADE S.A.S., having its - main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. - - The Original Code and all software distributed under the License is - distributed on an "AS IS" basis, without warranty of any kind, and the - Initial Developer hereby disclaims all such warranties, including without - limitation, any warranties of merchantability, fitness for a particular - purpose or non-infringement. Please see the License for the specific terms - and conditions governing the rights and limitations under the License. - -*/ - -#include -#include -#include -#include -#include -#include - -#ifndef TRACE -//#define TRACE -#endif - -#include - -#include -#include -#include -#include -#include - -#ifndef min -#define min(a,b) (a>b ? b : a) -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef HAVE_X11_EXTENSIONS_TRANSOLV_H -#include -#endif - -#ifndef max -#define max(a,b) (aattributes -#define _WINDOW pwindow->window -#define _PIXMAP pwindow->pixmap -#define _NWBUFFER pwindow->nwbuffer -#define _FWBUFFER pwindow->wbuffers[0] -#define _BWBUFFER pwindow->wbuffers[1] -#define _DRAWABLE pwindow->drawable -#define _COLORMAP (pwindow->pcolormap) -#define _WIDTHMAP (pwindow->pwidthmap) -#define _TYPEMAP (pwindow->ptypemap) -#define _FONTMAP (pwindow->pfontmap) -#define _TILEMAP (pwindow->ptilemap) -#define _MARKMAP (pwindow->pmarkmap) -#define _ROOT (_ATTRIBUTES.root) -#define _SCREEN (_ATTRIBUTES.screen) -#define _VISUAL (_ATTRIBUTES.visual) -#if defined(__cplusplus) || defined(c_plusplus) -#define _CLASS (_VISUAL->c_class) -#else -#define _CLASS (_VISUAL->class) -#endif -#ifdef _X -#undef _X -#endif -#define _X (_ATTRIBUTES.x) -#ifdef _Y -#undef _Y -#endif -#define _Y (_ATTRIBUTES.y) -#define _WIDTH (_ATTRIBUTES.width) -#define _HEIGHT (_ATTRIBUTES.height) -#define _STATE (_ATTRIBUTES.map_state) -#define _DEPTH (_ATTRIBUTES.depth) -#define _EVENT_MASK (_ATTRIBUTES.your_event_mask) - -#define QGCODE(color,type,width,mode) ((color<<20)|(type<<12)|(width<<4)|mode) -#define QGCOLOR(code) ((code>>20)&0xFFF) -#define QGSETCOLOR(code,color) ((code&0x000FFFFF)|(color<<20)) -#define QGTYPE(code) ((code>>12)&0xFF) -#define QGSETTYPE(code,type) ((code&0xFFF00FFF)|(type<<12)) -#define QGWIDTH(code) ((code>> 4)&0xFF) -#define QGSETWIDTH(code,width) ((code&0xFFFFF00F)|(width<<4)) -#define QGTILE(code) ((code>> 4)&0xFF) -#define QGSETTILE(code,mark) ((code&0xFFFFF00F)|(mark<<4)) -#define QGFONT(code) ((code>> 4)&0xFF) -#define QGSETFONT(code,font) ((code&0xFFFFF00F)|(font<<4)) -#define QGMODE(code) (code&0xF) -#define QGSETMODE(code,mode) ((code&0xFFFFFFF0)|mode) - -#define ROUND(v) ( ((v) > 0.) ? ((v) < (float)(INT_MAX-1)) ? \ - (int)((v)+.5) : INT_MAX : ((v) > (float)(INT_MIN+1)) ? \ - (int)((v)-.5) : INT_MIN ) -#ifdef OLD /*S3593 OPTIMISATION*/ -#define PXPOINT(x) (ROUND((x) / pwindow->xratio)) -#define PYPOINT(y) (ROUND(_HEIGHT - ((y) / pwindow->yratio))) -#define PVALUE(v) (ROUND((v) / ((pwindow->xratio+pwindow->yratio)/2.))) -#define UVALUE(v) ((float)(v) * (pwindow->xratio+pwindow->yratio)/2.) -#else -#define PXPOINT(x) ((int)((x) / pwindow->xratio)) -#define PYPOINT(y) ((int)(_HEIGHT - ((y) / pwindow->yratio))) -#define PVALUE(v) ((int)((v) / ((pwindow->xratio+pwindow->yratio)/2.))) -#define UVALUE(v) ((float)(v) * (pwindow->xratio+pwindow->yratio)/2.) -#endif - -//OCC186 -#undef PXPOINT -#undef PYPOINT -#undef PVALUE -//OCC186 - -#define UXPOINT(x) ((float)(x) * pwindow->xratio) -#define UYPOINT(y) ((float)(_HEIGHT - (y)) * pwindow->yratio) - -/* DISPLAY */ - -#define DISPLAY_TYPE 0 -#ifdef XW_EXT_DISPLAY -#undef XW_EXT_DISPLAY -#endif -#define _DDISPLAY pdisplay->display -#define _DSCREEN (pdisplay->screen) -#define _DVISUAL (pdisplay->visual) - -#if defined(__cplusplus) || defined(c_plusplus) -#define _DCLASS (pdisplay->visual->c_class) -#else -#define _DCLASS (pdisplay->visual->class) -#endif -#define _DCOLORMAP pdisplay->colormap -#define _DGC pdisplay->gc -#define _DROOT pdisplay->rootwindow -#define _DGRAB pdisplay->grabwindow -#define _DWIDTH pdisplay->width -#define _DHEIGHT pdisplay->height -#define MMPXVALUE(v) ((float)((v)*WidthMMOfScreen(_DSCREEN))/(float)_DWIDTH) -#define MMPYVALUE(v) ((float)((v)*HeightMMOfScreen(_DSCREEN))/(float)_DHEIGHT) -#define PMMXVALUE(v) ((int)((v)*_DWIDTH/(float)WidthMMOfScreen(_DSCREEN))) -#define PMMYVALUE(v) ((int)((v)*_DHEIGHT/(float)HeightMMOfScreen(_DSCREEN))) -typedef enum { - XW_SERVER_IS_UNKNOWN,XW_SERVER_IS_DEC,XW_SERVER_IS_SUN, - XW_SERVER_IS_SGI,XW_SERVER_IS_NEC,XW_SERVER_IS_HP -} XW_SERVER_TYPE ; - -typedef struct { - /* Avoid 64-bit portability problems by being careful to use - longs due to the way XGetWindowProperty is specified. Note - that these parameters are passed as CARD32s over X - protocol. */ - - long overlay_visual; - long transparent_type; - long value; - long layer; -} XOverlayVisualInfo ; - -typedef struct { - void *link ; - int type ; /* DISPLAY_TYPE */ - XW_SERVER_TYPE server ; - Display *display ; - Screen *screen ; - Visual *visual ; - GC gc ; - int width ; - int height ; - Colormap colormap ; - Window rootwindow ; - Window grabwindow ; - float gamma ; - char* gname ; -} XW_EXT_DISPLAY; -/* COLORMAP */ - -#ifdef XW_EXT_COLORMAP -#undef XW_EXT_COLORMAP -#endif - -#define COLORMAP_TYPE 2 -#define _CDISPLAY (pcolormap->connexion->display) -#define _CSCREEN (pcolormap->connexion->screen) -#define _CCOLORMAP (pcolormap->connexion->colormap) -#define _CROOT (pcolormap->connexion->rootwindow) -#define _CVISUAL (pcolormap->visual) -#if defined(__cplusplus) || defined(c_plusplus) -#define _CCLASS (pcolormap->visual->c_class) -#else -#define _CCLASS (pcolormap->visual->class) -#endif -#define _CINFO (pcolormap->info) -#define _CGINFO (pcolormap->ginfo) -#define FREECOLOR 0 /* Free color Index if define[] = 0 */ -#define USERCOLOR 1 /* User color Index if define[] = 1 */ -#define IMAGECOLOR 2 /* Image color Index if define[] = 2 */ -#define HIGHCOLOR 3 /* HighLight color Index if define[] = 3 */ -#define BACKCOLOR 4 /* Background color Index if define[] = 4 */ -#define SYSTEMCOLOR 5 /* System color Index if define[] = 5 */ - -typedef struct { - void *link ; - int type ; /* COLORMAP_TYPE */ - XW_EXT_DISPLAY* connexion ; - Visual *visual ; - XStandardColormap info,ginfo ; - int maxhcolor ; /* Colormap Hard Length */ - int maxucolor ; /* Colormap User Length */ - int maxcolor ; /* Colormap Length */ - int maxwindow ; /* Number of reference Window*/ - Xw_TypeOfMapping mapping ; /* Colormap mapping */ - unsigned char define[MAXCOLOR] ; /* 0 if FREE color */ - unsigned long highpixel ; /* HighLightPixel Value */ - unsigned long backpixel ; /* TransparentPixel Value */ - unsigned long pixels[MAXCOLOR] ; -} XW_EXT_COLORMAP ; - -/* WIDTHMAP */ - -#define WIDTHMAP_TYPE 3 -#ifdef XW_EXT_WIDTHMAP -#undef XW_EXT_WIDTHMAP -#endif - -#define _WDISPLAY (pwidthmap->connexion->display) - -typedef struct { - void *link ; - int type ; /* WIDTHMAP_TYPE */ - XW_EXT_DISPLAY* connexion ; - int maxwidth ; /* Widthmap Length */ - int maxwindow ; /* Number of reference Window */ - unsigned char widths[MAXWIDTH] ; /* Pixel width > 0 if defined*/ -} XW_EXT_WIDTHMAP ; - -/* TYPEMAP */ - -#define TYPEMAP_TYPE 4 -#ifdef XW_EXT_TYPEMAP -#undef XW_EXT_TYPEMAP -#endif - -#define _TDISPLAY (ptypemap->connexion->display) - -typedef struct { - void *link ; - int type ; /* TYPEMAP_TYPE */ - XW_EXT_DISPLAY* connexion ; - int maxtype ; /* Typemap Length */ - int maxwindow ; /* Number of reference Window */ - unsigned char *types[MAXTYPE] ; /* Line Type Pixel lengths */ - /* NULL if type is not defined*/ -} XW_EXT_TYPEMAP ; - -/* FONTMAP */ - -#define FONTMAP_TYPE 5 -#ifdef XW_EXT_FONTMAP -#undef XW_EXT_FONTMAP -#endif - -#define _FDISPLAY (pfontmap->connexion->display) - -typedef struct { - void* link ; - int type ; /* FONTMAP_TYPE */ - XW_EXT_DISPLAY* connexion ; - int maxfont ; /* Fontmap Length */ - int maxwindow ; /* Number of reference Window */ - float gsizes[MAXFONT] ; /* Generic Font size in MM */ - float fsizes[MAXFONT] ; /* Font size in MM */ - float fratios[MAXFONT] ; /* Font baseline ratio */ - float ssizex[MAXFONT] ; /* Selected X Font size in MM */ - float ssizey[MAXFONT] ; /* Selected Y Font size in MM */ - float gslants[MAXFONT] ; /* Generic Font slant in RAD */ - float sslants[MAXFONT] ; /* Selected Font slant in RAD */ - char* gnames[MAXFONT] ; /* Generic font name */ - char* snames[MAXFONT] ; /* Selected font name */ - XFontStruct* fonts[MAXFONT] ;/* Selected Font structure */ - /* NULL if font is not defined*/ -} XW_EXT_FONTMAP ; - -/* TILEMAP */ - -#define TILEMAP_TYPE 6 -#ifdef XW_EXT_TILEMAP -#undef XW_EXT_TILEMAP -#endif - -#define _PDISPLAY (ptilemap->connexion->display) - -typedef struct { - void *link ; - int type ; /* TILEMAP_TYPE */ - XW_EXT_DISPLAY* connexion ; - int maxtile ; /* Tilemap Length */ - int maxwindow ; /* Number of reference Window */ - Pixmap tiles[MAXTILE] ; /* Tile pixmap */ - /* 0 if tile is not defined */ -} XW_EXT_TILEMAP ; - -/* MARKMAP */ - -#define MARKMAP_TYPE 7 -#ifdef XW_EXT_MARKMAP -#undef XW_EXT_MARKMAP -#endif - -#define _MDISPLAY (pmarkmap->connexion->display) - -typedef struct { - void *link ; - int type ; /* MARKMAP_TYPE */ - XW_EXT_DISPLAY* connexion ; - int maxmarker ; /* Markmap Length */ - int maxwindow ; /* Number of reference Window */ - unsigned int width[MAXMARKER] ; /* Pmarker Size in pixels */ - unsigned int height[MAXMARKER] ; /* Pmarker Size in pixels */ - Pixmap marks[MAXMARKER] ; /* Pmarker pixmap */ - int npoint[MAXMARKER] ; /* Lmarker length */ - int* spoint[MAXMARKER] ; /* Lmarker status */ - float* xpoint[MAXMARKER] ; /* Lmarker x coords */ - float* ypoint[MAXMARKER] ; /* Lmarker y coords */ -} XW_EXT_MARKMAP ; - -/* IMAGEDATA*/ - -#define IMAGE_TYPE 8 -#ifdef XW_EXT_IMAGEDATA -#undef XW_EXT_IMAGEDATA -#endif - -#define _ICOLORMAP (pimage->pcolormap) -#define _IVISUAL (_ICOLORMAP->visual) -#define _IIMAGE (pimage->pximage) -#define _ZIMAGE (pimage->zximage) -#define _IINFO (pimage->pimageinfo) - -typedef struct { - void *link ; - int type ; /* IMAGE_TYPE */ - XW_EXT_COLORMAP *pcolormap ; - int maxwindow ; /* Number of reference Window*/ - float zoom; /* Zoom factor */ - XImage *pximage ; /* Ref image */ - XImage *zximage ; /* Zoomed image */ - XW_USERDATA *pimageinfo ; /* external IMAGE Infos*/ -} XW_EXT_IMAGEDATA ; - -typedef struct { - void* link ; - int isupdated ; - int npoint ; - XPoint rpoints[MAXPOINTS] ; - XPoint upoints[MAXPOINTS] ; -} XW_EXT_POINT ; - -typedef struct { - void* link ; - int nchar ; - char chars[MAXCHARS] ; -} XW_EXT_CHAR ; - -typedef struct { - void* link ; - int isupdated ; - int nseg ; - XSegment rsegments[MAXSEGMENTS] ; - XSegment usegments[MAXSEGMENTS] ; -} XW_EXT_SEGMENT ; - -typedef struct { - void* link ; - int isupdated ; - int nmark ; - int nseg ; - int marks[MAXLMARKERS] ; /* seg numbers */ - XPoint rcenters[MAXLMARKERS] ; /* marker center */ - XPoint ucenters[MAXLMARKERS] ; /* marker center */ - XSegment rsegments[MAXSEGMENTS] ; - XSegment usegments[MAXSEGMENTS] ; -} XW_EXT_LMARKER ; - -typedef struct { - void* link ; - int isupdated ; - int nmark ; - int npoint ; - int marks[MAXPMARKERS] ; /* point numbers */ - XPoint rcenters[MAXPMARKERS] ; /* marker center */ - XPoint ucenters[MAXPMARKERS] ; /* marker center */ - XPoint rpoints[MAXPOINTS] ; - XPoint upoints[MAXPOINTS] ; -} XW_EXT_PMARKER ; - -typedef struct { - void* link ; - int isupdated ; - int nline ; - int lines[MAXLINES] ; /* line point numbers */ - XPoint *plines[MAXLINES] ; /* LINE descriptor */ -} XW_EXT_LINE ; - -typedef struct { - void* link ; - int isupdated ; - int npoly ; - int polys[MAXPOLYS] ; /* poly point numbers */ - int paths[MAXPOLYS] ; /* path point numbers */ - XPoint *ppolys[MAXPOLYS] ; /* POLY descriptor */ -} XW_EXT_POLY ; - -typedef struct { - void* link ; - int isupdated ; - int narc ; - XArc rarcs[MAXARCS] ; - XArc uarcs[MAXARCS] ; -} XW_EXT_ARC ; - -typedef struct { - void* link ; - int isupdated ; - int ntext ; - int modes[MAXLTEXTS] ; /* TEXT draw mode */ - int texts[MAXLTEXTS] ; - char *ptexts[MAXLTEXTS] ; /* TEXT descriptor */ - XPoint rpoints[MAXLTEXTS] ; - XPoint upoints[MAXLTEXTS] ; - float rangles[MAXLTEXTS] ; /* rotated string angle */ - float uangles[MAXLTEXTS] ; - float rscalex[MAXLTEXTS] ; /* rotated string scale */ - float uscalex[MAXLTEXTS] ; - float rscaley[MAXLTEXTS] ; /* rotated string scale */ - float uscaley[MAXLTEXTS] ; - float slants[MAXLTEXTS] ; /* TEXT slant */ -} XW_EXT_LTEXT ; - -typedef struct { - void* link ; - int isupdated ; - int ntext ; - int modes[MAXLTEXTS] ; /* TEXT draw mode */ - int texts[MAXPTEXTS] ; - char *ptexts[MAXPTEXTS] ; /* TEXT descriptor */ - XPoint rpoints[MAXPTEXTS] ; - XPoint upoints[MAXPTEXTS] ; - float rangles[MAXPTEXTS] ; /* rotated string angle */ - float uangles[MAXPTEXTS] ; - float marges[MAXPTEXTS] ; /* polygon margins */ - float rscalex[MAXLTEXTS] ; /* rotated string scale */ - float uscalex[MAXLTEXTS] ; - float rscaley[MAXLTEXTS] ; /* rotated string scale */ - float uscaley[MAXLTEXTS] ; - float slants[MAXLTEXTS] ; /* TEXT slant */ -} XW_EXT_PTEXT ; - -typedef struct { - void *link ; - int isupdated ; - int nimage ; /* Image number to drawn */ - XPoint rpoints[MAXIMAGES] ; - XPoint upoints[MAXIMAGES] ; - XW_EXT_IMAGEDATA *pimagdata[MAXIMAGES] ; -} XW_EXT_IMAGE ; - -typedef struct { - int bufferid ; /* Identification */ - GC gcf,gcb ; /* Graphic context */ - XW_ATTRIB code ; /* QG code as C,T,F,M*/ - int isdrawn; /* True if visible at screen */ - int isempty; /* True if empty */ - int isretain; /* True if retain drawing*/ - int isupdated; /* True if has been updated*/ - int rxmin,rymin,rxmax,rymax; /* Min Max ref. buffer */ - int uxmin,uymin,uxmax,uymax; /* Min Max upt. buffer */ - int xpivot,ypivot ; /* Buffer ref. pivot point */ - int dxpivot,dypivot ; /* Current Buffer transl. vector */ - float xscale,yscale; /* Buffer ref. drawing scale */ - float dxscale,dyscale; /* Current Buffer drawing scale */ - float angle; /* Buffer ref. drawing angle */ - float dangle; /* Current Buffer drawing angle */ - XW_EXT_CHAR *ptextdesc ; /* Retain desc. texts list */ - XW_EXT_POINT *plinedesc ; /* Retain desc. lines list */ - XW_EXT_POINT *ppntlist ; /* Retain Points list */ - XW_EXT_SEGMENT *pseglist ; /* Retain Segments list */ - XW_EXT_LINE *plinelist ; /* Retain Polylines list */ - XW_EXT_POLY *ppolylist ; /* Retain Polygones list */ - XW_EXT_ARC *plarclist ; /* Retain Arcs list */ - XW_EXT_ARC *pparclist ; /* Retain poly Arcs list */ - XW_EXT_LTEXT *pltextlist ; /* Retain Texts list */ - XW_EXT_PTEXT *pptextlist ; /* Retain poly Texts list */ - XW_EXT_LMARKER *plmarklist ; /* Retain Markers list */ - XW_EXT_PMARKER *ppmarklist ; /* Retain poly Markers list */ - XW_EXT_IMAGE *pimaglist ; /* Retain Image list */ -} XW_EXT_BUFFER ; - -typedef struct { /* Line GC */ - GC gc ; /* Graphic context */ - unsigned int count ; /* Used count info */ - XW_ATTRIB code ; /* QG code as C,T,W,M*/ -} XW_QGL ; - -typedef struct { /* Polygon GC */ - GC gc ; /* Graphic context */ - unsigned int count ; /* Used count info */ - XW_ATTRIB code ; /* QG code as C,T,T,M*/ -} XW_QGP ; - -typedef struct { /* Text GC */ - GC gc ; /* Graphic context */ - unsigned int count ; /* Used count info */ - XW_ATTRIB code ; /* QG code as C,T,F,M*/ -} XW_QGT ; - -typedef struct { /* Marker GC */ - GC gc ; /* Graphic context */ - unsigned int count ; /* Used count info */ - XW_ATTRIB code ; /* QG code as C,T,T,M*/ -} XW_QGM ; - -#define _BIMAGE pwindow->qgwind.pimage -#define _BMETHOD pwindow->qgwind.method -#define _BPIXMAP pwindow->qgwind.pixmap -#define _BINDEX pwindow->qgwind.cbufindex -#define _BUFFER(index) pwindow->qgwind.pbuflist[index] - -typedef struct { /* Window GC */ - GC gc ; /* Graphic context */ - GC gcclear ; /* Graphic context */ - GC gccopy ; /* Graphic context */ - GC gchigh ; /* Graphic context */ - XW_ATTRIB code ; /* QG code as C,T,T,M*/ - XW_EXT_IMAGEDATA *pimage ; /* Back image data's */ - Aspect_FillMethod method ; /* Back fill method */ - Pixmap pixmap ; /* Back Pixmap or 0 */ - int cbufindex ; /* Current buffer index */ - XW_EXT_BUFFER pbuflist[MAXBUFFERS]; /* Retain primitives list*/ -} XW_QGW ; - -/* CALLBACK */ - -typedef struct { - XW_CALLBACK function ; /* CallBack Address */ - void *userdata ; /* CallBack UserData*/ -} XW_ECBK ; - -#ifdef XW_PROTOTYPE -typedef XW_STATUS (*XW_ICALLBACK)(XW_EVENT* anyevent) ; -#else -typedef XW_STATUS (*XW_ICALLBACK)() ; -#endif /*XW_PROTOTYPE*/ - -typedef struct { - XW_ICALLBACK function ; /* CallBack Address */ -} XW_ICBK ; - -/* WINDOW */ - -#define WINDOW_TYPE 1 -#ifdef XW_EXT_WINDOW -#undef XW_EXT_WINDOW -#endif -#define _DISPLAY (pwindow->connexion->display) -typedef struct { - void *link ; - int type ; /* WINDOW_TYPE */ - XWindowAttributes attributes ; /* Window Attributes */ - int axleft ; /* Actual Window position */ - int aytop ; /* Actual Window position */ - int axright ; /* Actual Window position */ - int aybottom ; /* Actual Window position */ - int rwidth ; /* Requested Window width*/ - int rheight ; /* Requested Window height*/ - float xratio ; /* Window User/Pixel Ratio*/ - float yratio ; /* Window User/Pixel Ratio*/ - XW_EXT_DISPLAY* connexion ; - Window window ; /* Window ID */ - Pixmap pixmap ; /* Associated Window Pixmap*/ - int nwbuffer ; /* MultiBuffers number if any */ - XID wbuffers[2] ; /* Associated Window Buffers*/ - Drawable drawable ; /* Can be Window or Pixmap */ - int backindex ; /* Colormap background Index */ - int clipflag ; /* Unable internal clipping*/ - XW_EXT_COLORMAP *pcolormap ; /* Colormap Extension */ - XW_EXT_WIDTHMAP *pwidthmap ; /* Widthmap Extension */ - XW_EXT_TYPEMAP *ptypemap ; /* Widthmap Extension */ - XW_EXT_FONTMAP *pfontmap ; /* Fontmap Extension */ - XW_EXT_TILEMAP *ptilemap ; /* Tilemap Extension */ - XW_EXT_MARKMAP *pmarkmap ; /* Markmap Extension */ - int lineindex ; /* Current QG line index used */ - XW_QGL qgline[MAXQG] ; /* QG Line Bundle indexs */ - int polyindex ; /* Current QG poly index used */ - XW_QGP qgpoly[MAXQG] ; /* QG poly Bundle indexs */ - int textindex ; /* Current QG text index used */ - XW_QGT qgtext[MAXQG] ; /* QG text Bundle indexs */ - int markindex ; /* Current QG markerindex used*/ - XW_QGM qgmark[MAXQG] ; /* QG marker Bundle indexs */ - XW_QGW qgwind ; /* QG Window Bundle */ - XW_ECBK ecbk[MAXEVENT] ; /* External CallBack EventList*/ - XW_ICBK icbk[MAXEVENT] ; /* Internal CallBack EventList*/ - void *other ; /* Other data extension */ -} XW_EXT_WINDOW; - -/* ICONS */ - -#define ICON_TYPE 10 - -typedef struct { - void *link ; - int type ; /* ICON_TYPE */ - char *pname ; - char *pfile ; - XW_EXT_IMAGEDATA *pimage ; /* Associated Image data's */ - Pixmap pixmap ; /* Associated Pixmap if any */ - int update; -} XW_EXT_ICON ; - -/* - Internal Functions -*/ - -#define Xw_malloc malloc -#define Xw_calloc calloc -#define Xw_free free - -#ifdef XW_PROTOTYPE -#ifdef __cplusplus -extern "C" { -#endif -void _XInitImageFuncPtrs(XImage* pximage); -#ifdef __cplusplus -} -#endif -XVisualInfo* Xw_get_visual_info(XW_EXT_DISPLAY* display,Xw_TypeOfVisual tclass); -XVisualInfo* Xw_get_overlay_visual_info(XW_EXT_DISPLAY* display,Xw_TypeOfVisual tclass,unsigned long* backpixel) ; - -XW_EXT_DISPLAY* Xw_get_display_structure(Display* display) ; -XW_EXT_DISPLAY* Xw_add_display_structure(int size) ; -XW_STATUS Xw_del_display_structure(XW_EXT_DISPLAY* adisplay) ; - -XW_EXT_WINDOW* Xw_get_window_structure(Window window) ; -XW_EXT_WINDOW* Xw_add_window_structure(int size) ; -XW_STATUS Xw_del_window_structure(XW_EXT_WINDOW* awindow) ; -XW_STATUS Xw_reset_attrib(XW_EXT_WINDOW* awindow) ; - -XW_STATUS Xw_redraw_buffer(XW_EXT_WINDOW *pwindow,XW_EXT_BUFFER *pbuffer) ; -XW_STATUS Xw_update_buffer(XW_EXT_WINDOW *pwindow,XW_EXT_BUFFER *pbuffer) ; -XW_EXT_BUFFER* Xw_get_buffer_structure(XW_EXT_WINDOW *pwindow,int bufferid) ; - -XW_EXT_CHAR* Xw_add_text_desc_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_text_desc_structure(XW_EXT_BUFFER *pbuflist) ; - -XW_EXT_POINT* Xw_add_line_desc_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_line_desc_structure(XW_EXT_BUFFER *pbuflist) ; - -XW_EXT_POINT* Xw_add_point_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_point_structure(XW_EXT_BUFFER *pbuflist) ; -void Xw_draw_pixel_points(XW_EXT_WINDOW* pwindow,XW_EXT_POINT* ppntlist,GC gc) ; - -XW_EXT_SEGMENT* Xw_add_segment_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_segment_structure(XW_EXT_BUFFER *pbuflist) ; -void Xw_draw_pixel_segments(XW_EXT_WINDOW* pwindow,XW_EXT_SEGMENT* pseglist,GC gc) ; - -XW_EXT_LINE* Xw_add_polyline_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_polyline_structure(XW_EXT_BUFFER *pbuflist) ; -void Xw_draw_pixel_lines(XW_EXT_WINDOW* pwindow,XW_EXT_LINE* plinelist,GC gc) ; - -XW_EXT_ARC* Xw_add_arc_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_arc_structure(XW_EXT_BUFFER *pbuflist) ; -void Xw_draw_pixel_arcs(XW_EXT_WINDOW* pwindow,XW_EXT_ARC* parclist,GC gc) ; - -XW_EXT_ARC* Xw_add_polyarc_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_polyarc_structure(XW_EXT_BUFFER *pbuflist) ; -void Xw_draw_pixel_polyarcs(XW_EXT_WINDOW* pwindow,XW_EXT_ARC* parclist, - GC gcpoly,GC gcline) ; - -XW_EXT_POLY* Xw_add_polygone_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_polygone_structure(XW_EXT_BUFFER *pbuflist) ; -void Xw_draw_pixel_polys(XW_EXT_WINDOW* pwindow,XW_EXT_POLY* ppolylist, - GC gcpoly,GC gcline) ; - -XW_EXT_LTEXT* Xw_add_text_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_text_structure(XW_EXT_BUFFER *pbuflist) ; -void Xw_draw_pixel_texts(XW_EXT_WINDOW* pwindow,XW_EXT_LTEXT* ptextlist, - GC gc,XW_ATTRIB code) ; - -XW_EXT_PTEXT* Xw_add_polytext_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_polytext_structure(XW_EXT_BUFFER *pbuflist) ; -void Xw_draw_pixel_polytexts(XW_EXT_WINDOW* pwindow,XW_EXT_PTEXT* ptextlist, - GC gctext,GC gcpoly,GC gcline,XW_ATTRIB code) ; - -XW_STATUS Xw_isdefine_markerindex(XW_EXT_MARKMAP* amarkmap,int index) ; -XW_EXT_LMARKER* Xw_add_lmarker_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_lmarker_structure(XW_EXT_BUFFER *pbuflist) ; -void Xw_draw_pixel_lmarkers(XW_EXT_WINDOW* pwindow,XW_EXT_LMARKER* pmarklist,GC gc) ; -XW_EXT_PMARKER* Xw_add_pmarker_structure(XW_EXT_BUFFER *pbuflist) ; -XW_STATUS Xw_del_pmarker_structure(XW_EXT_BUFFER *pbuflist) ; -void Xw_draw_pixel_pmarkers(XW_EXT_WINDOW* pwindow,XW_EXT_PMARKER* pmarklist,GC gc) ; -Colormap Xw_create_colormap(XW_EXT_COLORMAP *pcolormap) ; -XW_EXT_COLORMAP* Xw_add_colormap_structure(int size) ; -XW_EXT_COLORMAP* Xw_get_colormap_structure(XW_EXT_COLORMAP* acolormap) ; -XW_STATUS Xw_del_colormap_structure(XW_EXT_COLORMAP* acolormap) ; -XW_STATUS Xw_get_color_attrib(XW_EXT_WINDOW* awindow, - XW_DRAWMODE mode,int color,unsigned long* hcolor, - int* function,unsigned long* planemask) ; -XW_STATUS Xw_isdefine_colorindex(XW_EXT_COLORMAP* acolormap,int index) ; -XW_STATUS Xw_ifsystem_colorindex(XW_EXT_COLORMAP* acolormap,int index) ; -XW_STATUS Xw_ifimage_colorindex(XW_EXT_COLORMAP* acolormap,int index) ; -XW_STATUS Xw_ifbackground_colorindex(XW_EXT_COLORMAP* acolormap,int index) ; -XW_STATUS Xw_ifhighlight_colorindex(XW_EXT_COLORMAP* acolormap,int index) ; -char* Xw_get_filename(char* filename,const char *extension) ; - -XW_EXT_WIDTHMAP* Xw_add_widthmap_structure(int size) ; -XW_STATUS Xw_del_widthmap_structure(XW_EXT_WIDTHMAP* awidthmap) ; -XW_STATUS Xw_isdefine_widthindex(XW_EXT_WIDTHMAP* awidthmap,int index) ; - -XW_EXT_TYPEMAP* Xw_add_typemap_structure(int size) ; -XW_STATUS Xw_del_typemap_structure(XW_EXT_TYPEMAP* atypemap) ; -XW_STATUS Xw_isdefine_typeindex(XW_EXT_TYPEMAP* atypemap,int index) ; - -XW_EXT_FONTMAP* Xw_add_fontmap_structure(int size) ; -XW_STATUS Xw_del_fontmap_structure(XW_EXT_FONTMAP* afontmap) ; -XW_STATUS Xw_isdefine_fontindex(XW_EXT_FONTMAP* afontmap,int index) ; - -XW_EXT_TILEMAP* Xw_add_tilemap_structure(int size) ; -XW_STATUS Xw_del_tilemap_structure(XW_EXT_TILEMAP* atilemap) ; -XW_STATUS Xw_isdefine_tileindex(XW_EXT_TILEMAP* atilemap,int index) ; - -XW_EXT_MARKMAP* Xw_add_markmap_structure(int size) ; -XW_STATUS Xw_del_markmap_structure(XW_EXT_MARKMAP* amarkmap) ; - -XW_EXT_IMAGEDATA* Xw_add_imagedata_structure(int size) ; -XW_STATUS Xw_del_imagedata_structure(XW_EXT_IMAGEDATA* aimagedata) ; - -XW_EXT_IMAGE* Xw_add_image_structure(XW_EXT_BUFFER* pbuflist) ; -XW_STATUS Xw_del_image_structure(XW_EXT_BUFFER* pbuflist) ; -void Xw_draw_pixel_images(XW_EXT_WINDOW* pwindow,XW_EXT_IMAGE *pimaglist, - GC gcimag,GC gcline) ; - -XW_STATUS Xw_set_internal_event(XW_EXT_WINDOW* awindow, - XW_EVENTTYPE type,XW_ICALLBACK call_back) ; - -XW_STATUS Xw_alloc_color(XW_EXT_COLORMAP* acolormap,float r,float g,float b,unsigned long *pixel,int *isapproximate); - -int Xw_clip_segment(XW_EXT_WINDOW* pwindow,int x1,int y1,int x2,int y2, -XSegment* segment); -int Xw_get_trace() ; -int Xw_test(unsigned long mask) ; -void Xw_set_error(int code,const char* message,void* pvalue) ; -int Xw_error_handler(Display* display,XErrorEvent* event) ; -void Xw_set_synchronize(Display* display,int state) ; -void Xw_longcopy(register long* from,register long* to,register unsigned n) ; -void Xw_shortcopy(register short* from,register short* to,register unsigned n) ; -void Xw_bytecopy(register char* from,register char* to,register unsigned n) ; - -#ifndef Xw_malloc -void* Xw_malloc(int size) ; -#endif - -#ifndef Xw_calloc -void* Xw_calloc(int length,int size) ; -#endif - -#ifndef Xw_free -void Xw_free(void* address) ; -#endif - -//OCC186 -int PXPOINT( double x, double ratio ); -int PYPOINT( double y, double height, double ratio ); -int PVALUE( double v, double xratio, double yratio ); -//OCC186 - -#else /*XW_PROTOTYPE*/ - -extern "C" { -void _XInitImageFuncPtrs(); -} -XVisualInfo* Xw_get_visual_info() ; -XVisualInfo* Xw_get_overlay_visual_info() ; - -XW_EXT_DISPLAY* Xw_get_display_structure() ; -XW_EXT_DISPLAY* Xw_add_display_structure() ; -XW_STATUS Xw_del_display_structure() ; - -XW_EXT_WINDOW* Xw_get_window_structure() ; -XW_EXT_WINDOW* Xw_add_window_structure() ; -XW_STATUS Xw_del_window_structure() ; -XW_STATUS Xw_reset_attrib() ; - -XW_STATUS Xw_redraw_buffer() ; -XW_STATUS Xw_update_buffer() ; -XW_EXT_BUFFER* Xw_get_buffer_structure() ; - -XW_EXT_CHAR* Xw_add_text_desc_structure() ; -XW_STATUS Xw_del_text_desc_structure() ; - -XW_EXT_POINT* Xw_add_line_desc_structure() ; -XW_STATUS Xw_del_line_desc_structure() ; - -XW_EXT_POINT* Xw_add_point_structure() ; -XW_STATUS Xw_del_point_structure() ; -void Xw_draw_pixel_points() ; - -XW_EXT_SEGMENT* Xw_add_segment_structure() ; -XW_STATUS Xw_del_segment_structure() ; -void Xw_draw_pixel_segments() ; - -XW_EXT_LINE* Xw_add_polyline_structure() ; -XW_STATUS Xw_del_polyline_structure() ; -void Xw_draw_pixel_lines() ; - -XW_EXT_ARC* Xw_add_arc_structure() ; -XW_STATUS Xw_del_arc_structure() ; -void Xw_draw_pixel_arcs() ; - -XW_EXT_ARC* Xw_add_polyarc_structure() ; -XW_STATUS Xw_del_polyarc_structure() ; -void Xw_draw_pixel_polyarcs() ; - -XW_EXT_POLY* Xw_add_polygone_structure() ; -XW_STATUS Xw_del_polygone_structure() ; -void Xw_draw_pixel_polys() ; - -XW_EXT_LTEXT* Xw_add_text_structure() ; -XW_STATUS Xw_del_text_structure() ; -void Xw_draw_pixel_texts() ; - -XW_EXT_PTEXT* Xw_add_polytext_structure() ; -XW_STATUS Xw_del_polytext_structure() ; -void Xw_draw_pixel_polytexts() ; - -XW_STATUS Xw_isdefine_markerindex() ; -XW_EXT_LMARKER* Xw_add_lmarker_structure() ; -XW_STATUS Xw_del_lmarker_structure() ; -void Xw_draw_pixel_lmarkers() ; -XW_EXT_PMARKER* Xw_add_pmarker_structure() ; -XW_STATUS Xw_del_pmarker_structure() ; -void Xw_draw_pixel_pmarkers() ; - -Colormap Xw_create_colormap() ; -XW_EXT_COLORMAP* Xw_add_colormap_structure() ; -XW_EXT_COLORMAP* Xw_get_colormap_structure() ; -XW_STATUS Xw_del_colormap_structure() ; -XW_STATUS Xw_get_color_attrib() ; -XW_STATUS Xw_isdefine_colorindex() ; -XW_STATUS Xw_ifsystem_colorindex() ; -XW_STATUS Xw_ifimage_colorindex() ; -XW_STATUS Xw_ifbackground_colorindex() ; -XW_STATUS Xw_ifhighlight_colorindex() ; -char* Xw_get_filename() ; - -XW_EXT_WIDTHMAP* Xw_add_widthmap_structure() ; -XW_STATUS Xw_del_widthmap_structure() ; -XW_STATUS Xw_isdefine_widthindex() ; - -XW_EXT_TYPEMAP* Xw_add_typemap_structure() ; -XW_STATUS Xw_del_typemap_structure() ; -XW_STATUS Xw_isdefine_typeindex() ; - -XW_EXT_FONTMAP* Xw_add_fontmap_structure() ; -XW_STATUS Xw_del_fontmap_structure() ; -XW_STATUS Xw_isdefine_fontindex() ; - -XW_EXT_TILEMAP* Xw_add_tilemap_structure() ; -XW_STATUS Xw_del_tilemap_structure() ; -XW_STATUS Xw_isdefine_tileindex() ; - -XW_EXT_MARKMAP* Xw_add_markmap_structure() ; -XW_STATUS Xw_del_markmap_structure() ; - -XW_EXT_IMAGEDATA* Xw_add_imagedata_structure() ; -XW_STATUS Xw_del_imagedata_structure() ; - -XW_EXT_IMAGE* Xw_add_image_structure() ; -XW_STATUS Xw_del_image_structure() ; -void Xw_draw_pixel_images() ; - -XW_STATUS Xw_set_internal_event() ; - -XW_STATUS Xw_alloc_color(); - -int Xw_clip_segment(); -int Xw_test() ; -int Xw_get_trace() ; -void Xw_set_error() ; -int Xw_error_handler() ; -void Xw_set_synchronize() ; -void Xw_longcopy() ; -void Xw_shortcopy() ; -void Xw_bytecopy() ; - -#ifndef Xw_malloc -void* Xw_malloc() ; -#endif - -#ifndef Xw_calloc -void* Xw_calloc() ; -#endif - -#ifndef Xw_free -void Xw_free() ; -#endif - -//OCC186 -int PXPOINT(); -int PYPOINT(); -int PVALUE(); -//OCC186 - -#endif /*XW_PROTOTYPE*/ diff --git a/src/Xw/Xw_FontMap.cdl b/src/Xw/Xw_FontMap.cdl deleted file mode 100755 index de4ad18b3b..0000000000 --- a/src/Xw/Xw_FontMap.cdl +++ /dev/null @@ -1,108 +0,0 @@ --- Created on: 1993-08-24 --- Created by: GG --- Copyright (c) 1993-1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - - -class FontMap from Xw inherits Transient - - ---Version: 0.0 - - ---Purpose: This class defines a FontMap object. - - ---Keywords: - ---Warning: - ---References: - -uses - - FontMap from Aspect, - FontMapEntry from Aspect - -raises - - FontMapDefinitionError from Aspect, - BadAccess from Aspect - -is - - Create - returns mutable FontMap from Xw - is protected; - ---Level: Internal - - Create (Connexion : CString from Standard) - returns mutable FontMap from Xw - ---Level: Public - ---Purpose: Creates a FontMap with an unallocated FontMapEntry. - raises FontMapDefinitionError from Aspect; - ---Error if FontMap creation failed according - -- to the supported hardware - - SetEntry (me : mutable; - Entry : FontMapEntry from Aspect) - ---Level: Public - ---Purpose: Modifies an entry already defined or adds - -- in the font map if it don't exist. - raises BadAccess from Aspect is virtual; - ---Purpose: Warning if FontMap size is exceeded. - -- or FontMap is not defined properly - -- or FontMapEntry Index is out of range according - -- to the supported hardware - - SetEntries (me : mutable; - Fontmap : FontMap from Aspect) - ---Level: Public - ---Purpose: Modifies all entries of from the new Fontmap. - raises BadAccess from Aspect is virtual; - ---Purpose: Warning if FontMap size is exceeded. - -- or FontMap is not defined properly - -- or One of new FontMapEntry Index is out of range according - -- to the supported hardware - - Destroy (me : mutable) is virtual; - ---Level: Public - ---Purpose: Destroies the Fontmap - ---C++: alias ~ - - ---------------------------- - -- Category: Inquire methods - ---------------------------- - - FreeFonts (me) - returns Integer from Standard - ---Level: Public - ---Purpose: Returns the number of Free Fonts in the Fontmap - -- depending of the HardWare - raises BadAccess from Aspect is static; - ---Error If FontMap is not defined properly - - ExtendedFontMap (me) - returns Address from Standard - is static protected; - ---Level: Public - ---Purpose: Returns extended data fontmap structure pointer. - ---Category: Inquire methods - - -fields - - MyExtendedDisplay : Address from Standard; - MyExtendedFontMap : Address from Standard; - -end FontMap; diff --git a/src/Xw/Xw_FontMap.cxx b/src/Xw/Xw_FontMap.cxx deleted file mode 100755 index dd7be1a1ac..0000000000 --- a/src/Xw/Xw_FontMap.cxx +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include -#include -#include -#include - -// Routines C a declarer en extern -//extern "C" { -#include -//} - -//-Static data definitions - -static char *ErrorMessag ; -static int ErrorNumber ; -static int ErrorGravity ; -static XW_STATUS status ; - -Xw_FontMap::Xw_FontMap () { -} - -Xw_FontMap::Xw_FontMap (const Standard_CString Connexion) { - - MyExtendedDisplay = Xw_open_display((Standard_PCharacter)Connexion) ; - - if( !MyExtendedDisplay ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity ) - Aspect_FontMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - MyExtendedFontMap = Xw_def_fontmap(MyExtendedDisplay,(int)0) ; - - if( !Xw_isdefine_fontmap(MyExtendedFontMap) ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity ) - Aspect_FontMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } -} - -void Xw_FontMap::SetEntry (const Aspect_FontMapEntry& Entry) { -Aspect_FontStyle style = Entry.Type() ; -int ffont = (int) Entry.Index() ; -Standard_CString value = style.FullName() ; -float csize = TOMILLIMETER(style.Size()) ; - - if( ffont ) { /* Don't modify Index 0,Default font */ - status = Xw_def_font(MyExtendedFontMap,ffont,csize,(char*)value); - - if( !status ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_BadAccess::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - } - -} - -void Xw_FontMap::SetEntries (const Handle(Aspect_FontMap)& Fontmap) { -Standard_Integer size = Fontmap->Size() ; -Standard_Integer i ; - - if( !Xw_isdefine_fontmap(MyExtendedFontMap) ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_FontMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - for( i=1 ; i<=size ; i++ ) { - SetEntry(Fontmap->Entry(i)) ; - } -} - -void Xw_FontMap::Destroy() { - - if( MyExtendedFontMap ) { - Xw_close_fontmap(MyExtendedFontMap) ; - MyExtendedFontMap = NULL ; - } -} - -Standard_Integer Xw_FontMap::FreeFonts( ) const { -Standard_Integer nfont ; -int mfont,ufont,dfont,ffont ; - - status = Xw_get_fontmap_info(MyExtendedFontMap, - &mfont,&ufont,&dfont,&ffont) ; - - if( !status ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_BadAccess::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - nfont = ufont - dfont ; - - return (nfont) ; -} - -Standard_Address Xw_FontMap::ExtendedFontMap () const { - - return (MyExtendedFontMap); - -} diff --git a/src/Xw/Xw_MarkMap.cdl b/src/Xw/Xw_MarkMap.cdl deleted file mode 100755 index ff83c67e25..0000000000 --- a/src/Xw/Xw_MarkMap.cdl +++ /dev/null @@ -1,109 +0,0 @@ --- Created on: 1995-01-17 --- Created by: GG --- Copyright (c) 1995-1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - - -class MarkMap from Xw inherits Transient - - ---Version: 0.0 - - ---Purpose: This class defines a MarkMap object. - - ---Keywords: - ---Warning: - ---References: - -uses - - MarkMap from Aspect, - MarkMapEntry from Aspect, - MarkerStyle from Aspect - -raises - - MarkMapDefinitionError from Aspect, - BadAccess from Aspect - -is - - Create - returns mutable MarkMap from Xw - is protected ; - ---Level: Internal - - Create ( Connexion : CString from Standard ) - returns mutable MarkMap from Xw - ---Level: Public - ---Purpose: Creates a MarkMap with unallocated MarkMapEntry. - -- Warning: Raises if MarkMap creation failed according - -- to the supported hardware - raises MarkMapDefinitionError from Aspect ; - - SetEntry ( me : mutable ; - anEntry : MarkMapEntry from Aspect ) - ---Level: Public - ---Purpose: Modifies an entry already defined or Add the Entry - -- in the marker map if it don't exist. - -- Warning: Raises if MarkMap size is exceeded, - -- or MarkMap is not defined properly, - -- or MarkMapEntry Index is out of range according - -- to the supported hardware - raises BadAccess from Aspect is virtual; - - SetEntries ( me : mutable ; - aMarkmap : MarkMap from Aspect ) - ---Level: Public - ---Purpose: Modifies all entries from a new Markmap - -- Warning: Raises if MarkMap size is exceeded, - -- or MarkMap is not defined properly, - -- or One of new MarkMapEntry Index is out of range according - -- to the supported hardware - raises BadAccess from Aspect is virtual; - - Destroy ( me : mutable ) is virtual; - ---Level: Public - ---Purpose: Destroies the Markmap - ---C++: alias ~ - - ---------------------------- - -- Category: Inquire methods - ---------------------------- - - FreeMarkers ( me ) - returns Integer from Standard - ---Level: Public - ---Purpose: Returns the Number of Free Marks in the Typemap - -- depending of the HardWare - -- Warning: Raises if MarkMap is not defined properly - raises BadAccess from Aspect is static; - - ExtendedMarkMap ( me ) - returns Address from Standard - is static protected ; - ---Level: Internal - ---Purpose: Returns extended data markermap structure pointer. - ---Category: Inquire methods - - -fields - - MyExtendedDisplay : Address from Standard ; - MyExtendedMarkMap : Address from Standard ; - -end MarkMap ; diff --git a/src/Xw/Xw_MarkMap.cxx b/src/Xw/Xw_MarkMap.cxx deleted file mode 100755 index 22c9e0deb6..0000000000 --- a/src/Xw/Xw_MarkMap.cxx +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include -#include -#include -#include -#include -#include -#include - -// Routines C a declarer en extern -//extern "C" { -#include -//} - -//-Static data definitions - -static char *ErrorMessag ; -static int ErrorNumber ; -static int ErrorGravity ; -static XW_STATUS status ; - -Xw_MarkMap::Xw_MarkMap () { -} - -Xw_MarkMap::Xw_MarkMap (const Standard_CString Connexion) { - - MyExtendedDisplay = Xw_open_display((Standard_PCharacter)Connexion) ; - - if( !MyExtendedDisplay ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity ) - Aspect_MarkMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - MyExtendedMarkMap = Xw_def_markmap(MyExtendedDisplay,(int)0) ; - - if( !Xw_isdefine_markmap(MyExtendedMarkMap) ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity ) - Aspect_MarkMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } -} - -void Xw_MarkMap::SetEntry (const Aspect_MarkMapEntry& anEntry) { -Aspect_MarkerStyle style = anEntry.Style() ; -int length = (int) style.Length() ; -int index = (int) anEntry.Index() ; -const TShort_Array1OfShortReal& xvalues(style.XValues()) ; -const TShort_Array1OfShortReal& yvalues(style.YValues()) ; -const TColStd_Array1OfBoolean& svalues(style.SValues()) ; -float *X = (float*) &xvalues.Value(xvalues.Lower()); -float *Y = (float*) &yvalues.Value(yvalues.Lower()); -int *S = (int*) &svalues.Value(svalues.Lower()); -Standard_Integer i; - - for( i=1 ; i<=length ; i++ ) { -// Standard_Real xcoord,ycoord; -// Standard_Boolean state = style.Values(i,xcoord,ycoord); - } - - if( index ) { /* Index 0 is default POINT Marker ,cann't be changed */ - status = Xw_def_marker(MyExtendedMarkMap,index,length,S,X,Y) ; - - if( !status ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_BadAccess::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - } -} - -void Xw_MarkMap::SetEntries (const Handle(Aspect_MarkMap)& Markmap) { -Standard_Integer size = Markmap->Size() ; -Standard_Integer i ; - - if( !Xw_isdefine_markmap(MyExtendedMarkMap) ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_MarkMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - for( i=1 ; i<=size ; i++ ) { - SetEntry(Markmap->Entry(i)) ; - } -} - -void Xw_MarkMap::Destroy() { - - if( MyExtendedMarkMap ) { - Xw_close_markmap(MyExtendedMarkMap) ; - MyExtendedMarkMap = NULL ; - } -} - -Standard_Integer Xw_MarkMap::FreeMarkers( ) const { -Standard_Integer ntype ; -int mtype,utype,dtype,ftype ; - - status = Xw_get_markmap_info(MyExtendedMarkMap, - &mtype,&utype,&dtype,&ftype) ; - - if( !status ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_BadAccess::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - ntype = utype - dtype ; - - return (ntype) ; -} - -Standard_Address Xw_MarkMap::ExtendedMarkMap () const { - - return (MyExtendedMarkMap); - -} diff --git a/src/Xw/Xw_TypeMap.cdl b/src/Xw/Xw_TypeMap.cdl deleted file mode 100755 index 6ad93bd510..0000000000 --- a/src/Xw/Xw_TypeMap.cdl +++ /dev/null @@ -1,109 +0,0 @@ --- Created on: 1993-08-24 --- Created by: GG --- Copyright (c) 1993-1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - - -class TypeMap from Xw inherits Transient - - ---Version: 0.0 - - ---Purpose: This class defines a TypeMap object. - - ---Keywords: - ---Warning: - ---References: - -uses - - TypeMap from Aspect, - TypeMapEntry from Aspect, - LineStyle from Aspect - -raises - - TypeMapDefinitionError from Aspect, - BadAccess from Aspect - -is - - Create - returns mutable TypeMap from Xw - is protected ; - ---Level: Internal - - Create ( Connexion : CString from Standard ) - returns mutable TypeMap from Xw - ---Level: Public - ---Purpose: Creates a TypeMap with unallocated TypeMapEntry. - -- Warning: Raises if TypeMap creation failed according - -- to the supported hardware - raises TypeMapDefinitionError from Aspect ; - - SetEntry ( me : mutable ; - Entry : TypeMapEntry from Aspect ) - ---Level: Public - ---Purpose: Modifies an entry already defined or Add the Entry - -- in the type map if it don't exist. - -- Warning: Raises if TypeMap size is exceeded, - -- or TypeMap is not defined properly, - -- or TypeMapEntry Index is out of range according - -- to the supported hardware - raises BadAccess from Aspect is virtual; - - SetEntries ( me : mutable ; - Typemap : TypeMap from Aspect ) - ---Level: Public - ---Purpose: Modifies all entries from a new Typemap - -- Warning: Raises if TypeMap size is exceeded, - -- or TypeMap is not defined properly, - -- or One of new TypeMapEntry Index is out of range according - -- to the supported hardware - raises BadAccess from Aspect is virtual; - - Destroy ( me : mutable ) is virtual; - ---Level: Public - ---Purpose: Destroies the Typemap - ---C++: alias ~ - - ---------------------------- - -- Category: Inquire methods - ---------------------------- - - FreeTypes ( me ) - returns Integer from Standard - ---Level: Public - ---Purpose: Returns the Number of Free Types in the Typemap - -- depending of the HardWare - -- Warning: Raises if TypeMap is not defined properly - raises BadAccess from Aspect is static; - - ExtendedTypeMap ( me ) - returns Address from Standard - is static protected ; - ---Level: Internal - ---Purpose: Returns extended data typemap structure pointer. - ---Category: Inquire methods - - -fields - - MyExtendedDisplay : Address from Standard ; - MyExtendedTypeMap : Address from Standard ; - -end TypeMap ; diff --git a/src/Xw/Xw_TypeMap.cxx b/src/Xw/Xw_TypeMap.cxx deleted file mode 100755 index 5e44ebbdf4..0000000000 --- a/src/Xw/Xw_TypeMap.cxx +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include -#include -#include -#include -#include -#include -#include - -// Routines C a declarer en extern -//extern "C" { -#include -//} - -//-Static data definitions - -static char *ErrorMessag ; -static int ErrorNumber ; -static int ErrorGravity ; -static XW_STATUS status ; - -Xw_TypeMap::Xw_TypeMap () { -} - -Xw_TypeMap::Xw_TypeMap (const Standard_CString Connexion) { - - MyExtendedDisplay = Xw_open_display((Standard_PCharacter)Connexion) ; - - if( !MyExtendedDisplay ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity ) - Aspect_TypeMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - MyExtendedTypeMap = Xw_def_typemap(MyExtendedDisplay,(int)0) ; - - if( !Xw_isdefine_typemap(MyExtendedTypeMap) ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity ) - Aspect_TypeMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } -} - -void Xw_TypeMap::SetEntry (const Aspect_TypeMapEntry& Entry) { -Aspect_LineStyle style = Entry.Type() ; -int length = (int) style.Length() ; -int ftype = (int) Entry.Index() ; -const TColQuantity_Array1OfLength& values(style.Values()) ; -TShort_Array1OfShortReal svalues(values.Lower(),values.Length()) ; -float *V = (float*) &svalues.Value(values.Lower()) ; -Standard_Integer i ; - - if( ftype ) { /* Index 0 is default SOLID Line ,cann't be changed */ - for( i=values.Lower() ; i<=values.Upper() ; i++) - svalues(i) = TOMILLIMETER(Standard_ShortReal(values(i))) ; - - status = Xw_def_type(MyExtendedTypeMap,ftype,length,V) ; - - if( !status ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_BadAccess::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - } -} - -void Xw_TypeMap::SetEntries (const Handle(Aspect_TypeMap)& Typemap) { -Standard_Integer size = Typemap->Size() ; -Standard_Integer i ; - - if( !Xw_isdefine_typemap(MyExtendedTypeMap) ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_TypeMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - for( i=1 ; i<=size ; i++ ) { - SetEntry(Typemap->Entry(i)) ; - } -} - -void Xw_TypeMap::Destroy() { - - if( MyExtendedTypeMap ) { - Xw_close_typemap(MyExtendedTypeMap) ; - MyExtendedTypeMap = NULL ; - } -} - -Standard_Integer Xw_TypeMap::FreeTypes( ) const { -Standard_Integer ntype ; -int mtype,utype,dtype,ftype ; - - status = Xw_get_typemap_info(MyExtendedTypeMap, - &mtype,&utype,&dtype,&ftype) ; - - if( !status ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_BadAccess::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - ntype = utype - dtype ; - - return (ntype) ; -} - -Standard_Address Xw_TypeMap::ExtendedTypeMap () const { - - return (MyExtendedTypeMap); - -} diff --git a/src/Xw/Xw_WOKSteps.edl b/src/Xw/Xw_WOKSteps.edl deleted file mode 100755 index 7527a77686..0000000000 --- a/src/Xw/Xw_WOKSteps.edl +++ /dev/null @@ -1,43 +0,0 @@ --- Created on: 1999-07-15 --- Created by: Atelier CAS2000 --- Copyright (c) 1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - - - -@ifnotdefined ( %Xw_WOKSteps_EDL ) then ----@set %Xw_WOKSteps_EDL = ""; - --- Use GLX or Cocoa -@ifnotdefined ( %MACOSX_USE_GLX ) then - @set %MACOSX_USE_GLX = "${MACOSX_USE_GLX}"; -@endif; - ---- Insert your stuff Here -@if ( %Station == "wnt" || (%Station == "mac" && %MACOSX_USE_GLX != "true")) then - -- Pas d'Xw sur Windows NT - @set %WOKSteps_ObjGroup = ""; - @set %WOKSteps_DepGroup = ""; - @set %WOKSteps_LibGroup = ""; - @set %WOKSteps_ExecGroup = ""; - - -@endif; - - -@endif; diff --git a/src/Xw/Xw_WOKUMake.edl b/src/Xw/Xw_WOKUMake.edl deleted file mode 100755 index 634fb4cc52..0000000000 --- a/src/Xw/Xw_WOKUMake.edl +++ /dev/null @@ -1,35 +0,0 @@ --- Created on: 1999-07-15 --- Created by: Atelier CAS2000 --- Copyright (c) 1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - -sss -@ifnotdefined ( %Xw_WOKUMake_EDL ) then -@set %Xw_WOKUMake_EDL = ""; - --- Use GLX or Cocoa -@ifnotdefined ( %MACOSX_USE_GLX ) then - @set %MACOSX_USE_GLX = "${MACOSX_USE_GLX}"; -@endif; - ---- Insert your stuff Here - -@if ( %Station == "wnt" || (%Station == "mac" && %MACOSX_USE_GLX != "true")) then - @set %WOKUMake_Steps = "*src xcpp.fill(src) xcpp.src(xcpp.fill) xcpp.header(xcpp.fill) .xcpp.template(xcpp.fill) obj.inc"; -@endif; -@endif; diff --git a/src/Xw/Xw_WidthMap.cdl b/src/Xw/Xw_WidthMap.cdl deleted file mode 100755 index 7365670ef4..0000000000 --- a/src/Xw/Xw_WidthMap.cdl +++ /dev/null @@ -1,107 +0,0 @@ --- Created on: 1993-08-24 --- Created by: GG --- Copyright (c) 1993-1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - - -class WidthMap from Xw inherits Transient - - ---Version: 0.0 - - ---Purpose: This class defines a WidthMap object. - - ---Keywords: - ---Warning: - ---References: - -uses - - WidthMap from Aspect, - WidthMapEntry from Aspect - -raises - - WidthMapDefinitionError from Aspect, - BadAccess from Aspect - -is - - Create - returns mutable WidthMap from Xw - is protected ; - ---Level: Public - - Create ( Connexion : CString from Standard ) - returns mutable WidthMap from Xw - ---Level: Public - ---Purpose: Creates a WidthMap with unallocated WidthMapEntry. - -- Warning: Raises if WidthMap creation failed according - -- to the supported hardware - raises WidthMapDefinitionError from Aspect ; - - SetEntry ( me : mutable ; - Entry : WidthMapEntry from Aspect ) - ---Level: Public - ---Purpose: Modifies an entry already defined or Add the Entry - -- in the type map if it don't exist. - -- Warning: Raises if WidthMap size is exceeded, - -- or WidthMap is not defined properly, - -- or WidthMapEntry Index is out of range according - -- to the supported hardware - raises BadAccess from Aspect is virtual; - - SetEntries ( me : mutable ; - Widthmap : WidthMap from Aspect ) - ---Level: Public - ---Purpose: Modifies all entries from the New Widthmap - -- Warning: Raises if WidthMap size is exceeded, - -- or WidthMap is not defined properly, - -- or One of new WidthMapEntry Index is out of range according - -- to the supported hardware - raises BadAccess from Aspect is virtual; - - Destroy( me : mutable ) is virtual; - ---Level: Public - ---Purpose: Destroies the Widthmap - ---C++: alias ~ - - ---------------------------- - -- Category: Inquire methods - ---------------------------- - - FreeWidths( me ) - returns Integer from Standard - ---Level: Internal - ---Purpose: Returns the Number of Free Widths in the Widthmap - -- depending of the HardWare - -- Warning: Raises if WidthMap is not defined properly - raises BadAccess from Aspect is static; - - ExtendedWidthMap ( me ) - returns Address from Standard - is static protected ; - ---Level: Internal - ---Purpose: Returns extended data typemap structure pointer. - ---Category: Inquire methods - -fields - - MyExtendedDisplay : Address from Standard ; - MyExtendedWidthMap : Address from Standard ; - -end WidthMap ; diff --git a/src/Xw/Xw_WidthMap.cxx b/src/Xw/Xw_WidthMap.cxx deleted file mode 100755 index 37a2de2941..0000000000 --- a/src/Xw/Xw_WidthMap.cxx +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include -#include -#include - -// Routines C a declarer en extern -//extern "C" { -#include -//} - -//-Static data definitions - -static char *ErrorMessag ; -static int ErrorNumber ; -static int ErrorGravity ; -static XW_STATUS status ; - -Xw_WidthMap::Xw_WidthMap () { -} - -Xw_WidthMap::Xw_WidthMap (const Standard_CString Connexion) { - - MyExtendedDisplay = Xw_open_display((Standard_PCharacter)Connexion) ; - - if( !MyExtendedDisplay ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity ) - Aspect_WidthMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - MyExtendedWidthMap = Xw_def_widthmap(MyExtendedDisplay,(int)0) ; - - if( !Xw_isdefine_widthmap(MyExtendedWidthMap) ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity ) - Aspect_WidthMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } -} - -void Xw_WidthMap::SetEntry (const Aspect_WidthMapEntry& Entry) { -int fwidth = (int) Entry.Index() ; -float width = (float) TOMILLIMETER(Entry.Width()) ; - - if( fwidth ) { /* Don't change Default index 0,One pixel Width */ - status = Xw_def_width(MyExtendedWidthMap,fwidth,width) ; - - if( !status ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_BadAccess::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - } - -} - -void Xw_WidthMap::SetEntries (const Handle(Aspect_WidthMap)& Widthmap) { -Standard_Integer size = Widthmap->Size() ; -Standard_Integer i ; - - if( !Xw_isdefine_widthmap(MyExtendedWidthMap) ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_WidthMapDefinitionError::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - for( i=1 ; i<=size ; i++ ) { - SetEntry(Widthmap->Entry(i)) ; - } -} - -void Xw_WidthMap::Destroy() { - - if( MyExtendedWidthMap ) { - Xw_close_widthmap(MyExtendedWidthMap) ; - MyExtendedWidthMap = NULL ; - } -} - -Standard_Integer Xw_WidthMap::FreeWidths( ) const { -Standard_Integer nwidth ; -int mwidth,uwidth,dwidth,fwidth ; - - status = Xw_get_widthmap_info(MyExtendedWidthMap, - &mwidth,&uwidth,&dwidth,&fwidth) ; - - if( !status ) { - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - if( ErrorGravity > 2 ) - Aspect_BadAccess::Raise (ErrorMessag) ; - else Xw_print_error() ; - } - - nwidth = uwidth - dwidth ; - - return (nwidth) ; -} - -Standard_Address Xw_WidthMap::ExtendedWidthMap () const { - - return (MyExtendedWidthMap); - -} diff --git a/src/Xw/Xw_Window.cdl b/src/Xw/Xw_Window.cdl deleted file mode 100755 index 9a5b0025ab..0000000000 --- a/src/Xw/Xw_Window.cdl +++ /dev/null @@ -1,263 +0,0 @@ --- Created on: 1991-11-18 --- Created by: NW,JPB,CAL,GG --- Copyright (c) 1991-1999 Matra Datavision --- Copyright (c) 1999-2012 OPEN CASCADE SAS --- --- The content of this file is subject to the Open CASCADE Technology Public --- License Version 6.5 (the "License"). You may not use the content of this file --- except in compliance with the License. Please obtain a copy of the License --- at http://www.opencascade.org and read it completely before using this file. --- --- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its --- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. --- --- The Original Code and all software distributed under the License is --- distributed on an "AS IS" basis, without warranty of any kind, and the --- Initial Developer hereby disclaims all such warranties, including without --- limitation, any warranties of merchantability, fitness for a particular --- purpose or non-infringement. Please see the License for the specific terms --- and conditions governing the rights and limitations under the License. - -class Window from Xw - -inherits - - Window from Aspect - -uses - - AsciiString from TCollection, - Background from Aspect, - GradientBackground from Aspect, - TypeOfResize from Aspect, - Handle from Aspect, - FillMethod from Aspect, - GradientFillMethod from Aspect, - DisplayConnection_Handle from Aspect, - PixMap from Image, - NameOfColor from Quantity, - Parameter from Quantity, - Ratio from Quantity, - Color from Quantity, - ColorMap from Xw, - WindowQuality from Xw, - TypeOfVisual from Xw - -raises - - WindowDefinitionError from Aspect, - WindowError from Aspect - -is - - Create ( theDisplayConnection : DisplayConnection_Handle from Aspect ) - returns mutable Window from Xw - raises WindowDefinitionError from Aspect; - ---Level: Public - - Create ( theDisplayConnection : DisplayConnection_Handle from Aspect ; - aPart1, aPart2 : Integer from Standard ; - BackColor : NameOfColor from Quantity = - Quantity_NOC_MATRAGRAY ) - returns mutable Window from Xw - ---Level: Public - ---Purpose: Creates a Window from an X Window defined by his ID - -- This Xid equals (aPart1 << 16) + aPart2. - -- A child of this Window is created when the WindowQuality - -- isn't the same than the parent Window - -- Trigger: Raises WindowDefinitionError if the connection failed - -- or if the Position out of the Screen Space - raises WindowDefinitionError from Aspect ; - - Create ( theDisplayConnection : DisplayConnection_Handle from Aspect ; - aWindow : Handle from Aspect; - BackColor : NameOfColor from Quantity = - Quantity_NOC_MATRAGRAY ) - returns mutable Window from Xw - ---Level: Public - ---Purpose: Creates a Window from an X Window defined by his Xid - -- A child of this Window is created when the WindowQuality - -- isn't the same than the parent Window - -- Trigger: Raises WindowDefinitionError if the connection failed - -- or if the Position out of the Screen Space - raises WindowDefinitionError from Aspect ; - - Create ( theDisplayConnection : DisplayConnection_Handle from Aspect ; - theTitle : CString from Standard ; - thePxLeft : Integer from Standard ; - thePxTop : Integer from Standard ; - thePxWidth : Integer from Standard ; - thePxHeight : Integer from Standard ; - theBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY ; - theParent : Handle from Aspect = 0 ) - returns mutable Window from Xw - ---Level: Public - ---Purpose: Creates a Window defined by his position and size - -- in pixels from the Parent Window. - -- Trigger: Raises WindowDefinitionError if the connection failed - -- or if the Position out of the Screen Space - raises WindowDefinitionError from Aspect ; - - --------------------------------------------------- - -- Category: Methods to modify the class definition - --------------------------------------------------- - - Map ( me ) is virtual; - ---Level: Public - ---Purpose: Opens the window . - ---Category: Methods to modify the class definition - - Unmap ( me ) is virtual; - ---Level: Public - ---Purpose: Closes the window . - ---Category: Methods to modify the class definition - - DoResize ( me ) - returns TypeOfResize from Aspect - ---Level: Advanced - ---Purpose: Applies the resizing to the window . - ---Category: Methods to modify the class definition - raises WindowError from Aspect is virtual; - - DoMapping ( me ) returns Boolean from Standard - raises WindowError from Aspect is virtual; - ---Level: Advanced - ---Purpose: Apply the mapping change to the window - -- and returns TRUE if the window is mapped at screen. - ---Category: Methods to modify the class definition - - Destroy ( me : mutable ) - ---Level: Advanced - ---Purpose: Destroies the Window - -- C++: alias ~ - -- Category: Methods to modify the class definition - -- Trigger: Raises if Window is not defined properly - raises WindowError from Aspect is virtual; - - SetCursor ( me ; anId : Integer from Standard ; - aColor : NameOfColor from Quantity - = Quantity_NOC_YELLOW ) is virtual ; - ---Level: Advanced - ---Purpose: Changes the current window cursor by anId cursor - -- in the specified color. - -- NOTE than anId must be one of /usr/include/X11/cursorfont.h - -- or 0 for Deactivate the cursor - ---Category: Methods to modify the class definition - - ---------------------------- - -- Category: Inquire methods - ---------------------------- - - IsMapped ( me ) - returns Boolean from Standard is virtual; - ---Level: Public - ---Purpose: Returns True if the window is opened - -- and False if the window is closed. - ---Category: Inquire methods - - Ratio ( me ) - returns Ratio from Quantity is virtual; - ---Level: Public - ---Purpose: Returns The Window RATIO equal to the physical - -- WIDTH/HEIGHT dimensions - ---Category: Inquire methods - - Position ( me ; - X1, Y1, X2, Y2 : out Integer from Standard ) is virtual; - ---Level: Public - ---Purpose: Returns The Window POSITION in PIXEL - ---Category: Inquire methods - - Size ( me ; - Width, Height : out Integer from Standard ) is virtual; - ---Level: Public - ---Purpose: Returns The Window SIZE in PIXEL - ---Category: Inquire methods - - XWindow ( me ) - returns Handle from Aspect is static; - ---Level: Public - ---Purpose: Returns the X window ID of the created window . - ---Category: Inquire methods - - XWindow ( me ; aPart1, aPart2 : out Integer from Standard ) is static; - ---Level: Public - ---Purpose: Returns the X window ID of the created window . - -- This Xid equals (aPart1 << 16) + aPart2. - - XParentWindow ( me ) - returns Handle from Aspect is static; - ---Level: Public - ---Purpose: Returns the X window ID parent of the created window . - ---Category: Inquire methods - - XParentWindow ( me ; aPart1, aPart2 : out Integer from Standard ) is static; - ---Level: Public - ---Purpose: Returns the X window ID parent of the created window . - -- This Xid equals (aPart1 << 16) + aPart2. - - XPixmap ( me ) - returns Handle from Aspect is static; - ---Level: Internal - ---Purpose: Returns the X pixmap ID of the created window . - -- If BackingStore () is permitted. - ---Category: Inquire methods - - PointerPosition ( me ; X, Y : out Integer from Standard ) - returns Boolean from Standard is virtual; - ---Level: Advanced - ---Purpose: Returns the Pointer position relatively to the Window - -- and FALSE if the pointer is outside of the window - ---Category: Inquire methods - - VisualClass ( me ) - returns TypeOfVisual from Xw is static; - ---Level: Public - ---Purpose: Returns the X window Visual class of the created window - ---Category: Inquire methods - - BackgroundPixel ( me ; aPixel : out Integer from Standard ) - returns Boolean from Standard is static; - ---Level: Public - ---Purpose: Returns FALSE when the returned background pixel - -- value is not defined - - ExtendedWindow ( me ) - returns Address from Standard - is static protected ; - ---Level: Internal - ---Purpose: Returns the ExtendedWindow address of the created window. - ---Category: Inquire methods - - SetWindow ( me: mutable ; aWindow : Handle from Aspect ; - BackColor : NameOfColor from Quantity ) - ---Level: Internal - ---Trigger: Raises if Window is not defined properly - raises WindowError from Aspect - is static private ; - - SetWindow ( me: mutable ; Title : CString from Standard ; - Xc, Yc, Width, Height: Parameter from Quantity ; - BackColor : NameOfColor from Quantity ; - Parent : Handle from Aspect ) - ---Level: Internal - ---Trigger: Raises if Window is not defined properly - raises WindowError from Aspect - is static private ; - - PrintError(myclass) is protected; - ---Purpose: Print last error or raise depending of the error gravity. - - Init( me: mutable ) is private; - ---Purpose: Initialise the fileds of class - -fields - - MyXWindow : Handle from Aspect is protected ; - MyXParentWindow : Handle from Aspect is protected ; - MyVisualClass : TypeOfVisual from Xw is protected ; - MyExtendedDisplay : Address from Standard is protected ; - MyExtendedWindow : Address from Standard is protected ; - myDisplayConnection : DisplayConnection_Handle from Aspect is protected; - -end Window ; diff --git a/src/Xw/Xw_Window.cxx b/src/Xw/Xw_Window.cxx old mode 100755 new mode 100644 index 79344a0950..2918dc471f --- a/src/Xw/Xw_Window.cxx +++ b/src/Xw/Xw_Window.cxx @@ -1,6 +1,6 @@ -// Created by: NW,JPB,CAL,GG -// Copyright (c) 1991-1999 Matra Datavision -// Copyright (c) 1999-2012 OPEN CASCADE SAS +// Created on: 2013-04-06 +// Created by: Kirill Gavrilov +// Copyright (c) 2013 OPEN CASCADE SAS // // The content of this file is subject to the Open CASCADE Technology Public // License Version 6.5 (the "License"). You may not use the content of this file @@ -17,449 +17,347 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. -#define BUC60701 //GG 23/06/00 Enable to dump an exact image size -// according to the window size -#define RIC120302 //GG Add a NEW XParentWindow methods which enable -// to retrieve the parent of the actual Xwindow ID. +#include +#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) -//-Version - -//-Design Creation d'une fenetre X - -//-Warning - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include -// Routines C a declarer en extern -//extern "C" { -#include -//} #include -#include -#include -#include +#include -#include +#include -//-Static data definitions - -static XW_STATUS status ; +namespace +{ -//============================================================================ -//==== HashCode : Returns a HashCode CString -//============================================================================ -inline Standard_Integer HashCode (const Standard_CString Value) + //! Search for RGBA double-buffered visual + static int TheDoubleBuff[] = + { + GLX_RGBA, + GLX_DEPTH_SIZE, 16, + GLX_DOUBLEBUFFER, + None + }; + +}; + +IMPLEMENT_STANDARD_HANDLE (Xw_Window, Aspect_Window) +IMPLEMENT_STANDARD_RTTIEXT(Xw_Window, Aspect_Window) + +// ======================================================================= +// function : Xw_Window +// purpose : +// ======================================================================= +Xw_Window::Xw_Window (const Handle(Aspect_DisplayConnection)& theXDisplay, + const Standard_CString theTitle, + const Standard_Integer thePxLeft, + const Standard_Integer thePxTop, + const Standard_Integer thePxWidth, + const Standard_Integer thePxHeight) +: Aspect_Window(), + myDisplay (theXDisplay), + myXWindow (0), + myXLeft (thePxLeft), + myYTop (thePxTop), + myXRight (thePxLeft + thePxWidth), + myYBottom (thePxTop + thePxHeight), + myIsOwnWin (Standard_True) { -Standard_Integer i,n,aHashCode = 0; -union { - char charPtr[80]; - int intPtr[20]; -} u; - - n = strlen(Value); - - if( n > 0 ) { - if( n < 80 ) { - n = (n+3)/4; - u.intPtr[n-1] = 0; - strcpy(u.charPtr,Value); - } else { - n = 20; - strncpy(u.charPtr,Value,80); - } - - for( i=0 ; iGetDisplay(), &aDummy, &aDummy)) + { + Aspect_WindowDefinitionError::Raise ("Xw_Window, GLX extension is unavailable"); + return; } -//printf(" HashCode of '%s' is %d\n",Value,aHashCode); + Display* aDisp = myDisplay->GetDisplay(); + int aScreen = DefaultScreen(aDisp); + Window aParent = RootWindow (aDisp, aScreen); - return Abs(aHashCode) + 1; -} + XVisualInfo* aVisInfo = glXChooseVisual (aDisp, aScreen, TheDoubleBuff); + if (aVisInfo == NULL) + { + Aspect_WindowDefinitionError::Raise ("Xw_Window, couldn't find compatible Visual (RGBA, double-buffered)"); + return; + } -void Xw_Window::PrintError() { -Standard_CString ErrorMessag ; -Standard_Integer ErrorNumber ; -Standard_Integer ErrorGravity ; + unsigned long aMask = 0; + XSetWindowAttributes aWinAttr; + memset(&aWinAttr, 0, sizeof(XSetWindowAttributes)); + aWinAttr.event_mask = ExposureMask | StructureNotifyMask; + aMask |= CWEventMask; + aWinAttr.colormap = XCreateColormap(aDisp, aParent, aVisInfo->visual, AllocNone); + aWinAttr.border_pixel = 0; + aWinAttr.override_redirect = False; + + myXWindow = XCreateWindow(aDisp, aParent, + myXLeft, myYTop, thePxWidth, thePxHeight, + 0, aVisInfo->depth, + InputOutput, + aVisInfo->visual, + CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect, &aWinAttr); + XFree (aVisInfo); aVisInfo = NULL; + if (myXWindow == 0) + { + Aspect_WindowDefinitionError::Raise ("Xw_Window, Unable to create window"); + return; + } - status = XW_SUCCESS ; - ErrorMessag = Xw_get_error(&ErrorNumber,&ErrorGravity) ; - Xw_print_error() ; + // if parent - desktop + XSizeHints aSizeHints; + aSizeHints.x = myXLeft; + aSizeHints.y = myYTop; + aSizeHints.flags = PPosition; + aSizeHints.width = thePxWidth; + aSizeHints.height = thePxHeight; + aSizeHints.flags |= PSize; + XSetStandardProperties (aDisp, myXWindow, theTitle, theTitle, None, + NULL, 0, &aSizeHints); + + /*XTextProperty aTitleProperty; + aTitleProperty.encoding = None; + char* aTitle = (char* )theTitle; + Xutf8TextListToTextProperty(aDisp, &aTitle, 1, XUTF8StringStyle, &aTitleProperty); + XSetWMName (aDisp, myXWindow, &aTitleProperty); + XSetWMProperties(aDisp, myXWindow, &aTitleProperty, &aTitleProperty, NULL, 0, NULL, NULL, NULL);*/ + + XFlush (aDisp); } -//-Aliases - -//-Global data definitions - -//-Constructors - -Xw_Window::Xw_Window (const Handle(Aspect_DisplayConnection)& theDisplayConnection) +// ======================================================================= +// function : Xw_Window +// purpose : +// ======================================================================= +Xw_Window::Xw_Window (const Handle(Aspect_DisplayConnection)& theXDisplay, + const Window theXWin) : Aspect_Window(), - myDisplayConnection (theDisplayConnection) + myDisplay (theXDisplay), + myXWindow (theXWin), + myXLeft (0), + myYTop (0), + myXRight (512), + myYBottom (512), + myIsOwnWin (Standard_False) { - Init(); -} - + int aDummy = 0; + if (theXWin == 0) + { + Aspect_WindowDefinitionError::Raise ("Xw_Window, given invalid X window"); + return; + } + else if (theXDisplay.IsNull()) + { + Aspect_WindowDefinitionError::Raise ("Xw_Window, X Display connection is undefined"); + return; + } + else if (!glXQueryExtension (myDisplay->GetDisplay(), &aDummy, &aDummy)) + { + myXWindow = 0; + Aspect_WindowDefinitionError::Raise ("Xw_Window, GLX extension is unavailable"); + return; + } -//======================================================================= -//function : Xw_Window -//purpose : -//======================================================================= -Xw_Window::Xw_Window (const Handle(Aspect_DisplayConnection)& theDisplayConnection, - const Standard_Integer aPart1, - const Standard_Integer aPart2, - const Quantity_NameOfColor BackColor) -: Aspect_Window(), - myDisplayConnection (theDisplayConnection) -{ - Init(); - Aspect_Handle aWindow = (aPart1 << 16) | (aPart2 & 0xFFFF); - SetWindow (aWindow, BackColor); -} + Display* aDisp = myDisplay->GetDisplay(); + + XWindowAttributes aWinAttr; + XGetWindowAttributes (aDisp, myXWindow, &aWinAttr); + const int aScreen = DefaultScreen (aDisp); + const long aVisInfoMask = VisualIDMask | VisualScreenMask; + XVisualInfo aVisInfoTmp; + aVisInfoTmp.visualid = aWinAttr.visual->visualid; + aVisInfoTmp.screen = aScreen; + int aNbItems = 0; + XVisualInfo* aVisInfo = XGetVisualInfo (aDisp, aVisInfoMask, &aVisInfoTmp, &aNbItems); + if (aVisInfo == NULL) + { + Aspect_WindowDefinitionError::Raise ("Xw_Window, Visual is unavailable"); + return; + } + XFree (aVisInfo); -//======================================================================= -//function : Xw_Window -//purpose : -//======================================================================= -Xw_Window::Xw_Window (const Handle(Aspect_DisplayConnection)& theDisplayConnection, - const Aspect_Handle aWindow, - const Quantity_NameOfColor BackColor) -: Aspect_Window(), - myDisplayConnection (theDisplayConnection) -{ - Init(); - SetWindow (aWindow, BackColor); + DoResize(); } -//======================================================================= -//function : Xw_Window -//purpose : -//======================================================================= -Xw_Window::Xw_Window (const Handle(Aspect_DisplayConnection)& theDisplayConnection, - const Standard_CString theTitle, - const Standard_Integer thePxLeft, - const Standard_Integer thePxTop, - const Standard_Integer theWidth, - const Standard_Integer theHeight, - const Quantity_NameOfColor theBackColor, - const Aspect_Handle theParent) -: Aspect_Window (), - myDisplayConnection (theDisplayConnection) +// ======================================================================= +// function : Destroy +// purpose : +// ======================================================================= +void Xw_Window::Destroy() { - Init(); - - Standard_Integer aParentSizeX = 1; - Standard_Integer aParentSizeY = 1; - - Aspect_Handle aRoot, aColormap, *aDisplay; - Xw_TypeOfVisual aVisualClass; - Standard_Integer aVisualDepth; - Xw_get_display_info (MyExtendedDisplay, - &aDisplay, &aRoot, &aColormap, &aVisualClass, &aVisualDepth); - Xw_get_screen_size (MyExtendedDisplay, &aParentSizeX, &aParentSizeY); - if (theParent) + if (myIsOwnWin && myXWindow != 0 && !myDisplay.IsNull()) { - XWindowAttributes anAttributes; - if(XGetWindowAttributes ((Display* )aDisplay, theParent, &anAttributes)) - { - aParentSizeX = anAttributes.width; - aParentSizeY = anAttributes.height; - } + XDestroyWindow (myDisplay->GetDisplay(), myXWindow); } - Quantity_Parameter aQCenterX, aQCenterY, aQSizeX, aQSizeY; - Aspect_Convert::ConvertCoordinates (aParentSizeX, aParentSizeY, - thePxLeft, thePxTop, theWidth, theHeight, - aQCenterX, aQCenterY, aQSizeX, aQSizeY); - SetWindow (theTitle, aQCenterX, aQCenterY, aQSizeX, aQSizeY, - theBackColor, theParent); } -void Xw_Window::Init() +// ======================================================================= +// function : XWindow +// purpose : +// ======================================================================= +Window Xw_Window::XWindow() const { - MyXWindow = 0 ; - MyXParentWindow = 0 ; -#if defined(__APPLE__) && !defined(MACOSX_USE_GLX) - MyExtendedDisplay = NULL; -#else - MyExtendedDisplay = Xw_set_display (myDisplayConnection->GetDisplay()); -#endif - MyExtendedWindow = NULL ; - MyVisualClass = Xw_TOV_TRUECOLOR; + return myXWindow; } -//======================================================================= -//function : SetWindow -//purpose : -//======================================================================= - -void Xw_Window::SetWindow (const Aspect_Handle aWindow, - const Quantity_NameOfColor BackColor) +// ======================================================================= +// function : IsMapped +// purpose : +// ======================================================================= +Standard_Boolean Xw_Window::IsMapped() const { - Aspect_Handle window,root,colormap,pixmap ; - Xw_TypeOfVisual visualclass ; - int visualdepth,visualid ; - - MyXWindow = aWindow ; - MyXParentWindow = aWindow ; - - if( !MyXWindow ) { - PrintError() ; + if (myXWindow == 0) + { + return false; } - - MyExtendedWindow = - Xw_def_window (MyExtendedDisplay,MyXWindow,Standard_False); - - status = Xw_get_window_info(MyExtendedWindow,&window,&pixmap, - &root,&colormap,&visualclass, - &visualdepth,&visualid); - if( !status ) { - PrintError() ; + else if (IsVirtual()) + { + return Standard_True; } - SetBackground(BackColor) ; + XFlush (myDisplay->GetDisplay()); + XWindowAttributes aWinAttr; + XGetWindowAttributes (myDisplay->GetDisplay(), myXWindow, &aWinAttr); + return aWinAttr.map_state == IsUnviewable + || aWinAttr.map_state == IsViewable; } -//======================================================================= -//function : SetWindow -//purpose : -//======================================================================= - -void Xw_Window::SetWindow (const Standard_CString Title, - const Quantity_Parameter Xc, - const Quantity_Parameter Yc, - const Quantity_Parameter Width, - const Quantity_Parameter Height, - const Quantity_NameOfColor BackColor, - const Aspect_Handle Parent) +// ======================================================================= +// function : Map +// purpose : +// ======================================================================= +void Xw_Window::Map() const { - Standard_Integer istransparent = Standard_False ; - - MyXParentWindow = Parent ; - MyXWindow = 0 ; - - MyXWindow = Xw_open_window(MyExtendedDisplay,MyVisualClass,MyXParentWindow, - (float)Xc,(float)Yc,(float)Width,(float)Height, - (Standard_PCharacter)Title,istransparent) ; - if( !MyXWindow ) { - PrintError() ; + if (IsVirtual() || myXWindow == 0) + { + return; } - MyExtendedWindow = - Xw_def_window (MyExtendedDisplay,MyXWindow,istransparent); - - SetBackground(BackColor) ; - - if( MyXParentWindow && (MyXWindow != MyXParentWindow) ) Map() ; - -} - -void Xw_Window::Map () const { -#ifdef RIC120302 - if( MyXWindow == MyXParentWindow ) return; -#endif - if (IsVirtual()) return; - status = Xw_set_window_state (MyExtendedWindow, XW_MAP); - if( !status ) { - PrintError() ; - } -} - -void Xw_Window::Unmap () const { -#ifdef RIC120302 - if( MyXWindow == MyXParentWindow ) return; -#endif - status = Xw_set_window_state (MyExtendedWindow, XW_ICONIFY); - if( !status ) { - PrintError() ; - } -} - -Aspect_TypeOfResize Xw_Window::DoResize () const { -XW_RESIZETYPE state ; - - state = Xw_resize_window (MyExtendedWindow); -// if( state == Aspect_TOR_UNKNOWN ) { - if( state == XW_TOR_UNKNOWN ) { - PrintError() ; - } - - return (Aspect_TypeOfResize(state)) ; + XMapWindow (myDisplay->GetDisplay(), myXWindow); + XFlush (myDisplay->GetDisplay()); } -Standard_Boolean Xw_Window::DoMapping () const { -int pxc,pyc,width,height; -XW_WINDOWSTATE state; - - state = Xw_get_window_position (MyExtendedWindow,&pxc,&pyc,&width,&height); - - return IsMapped(); -} - -void Xw_Window::Destroy () { -Standard_Boolean destroy = - ( MyXWindow == MyXParentWindow ) ? Standard_False : Standard_True; - - status = Xw_close_window (MyExtendedWindow,destroy); - if( !status ) { - PrintError() ; - } - - MyXWindow = 0 ; - MyExtendedWindow = NULL ; -} - -void Xw_Window::SetCursor (const Standard_Integer anId, const Quantity_NameOfColor aColor) const { -Quantity_Color Color(aColor) ; -Standard_Real r,g,b ; - - Color.Values(r,g,b,Quantity_TOC_RGB) ; - - status = Xw_set_hard_cursor (MyExtendedWindow,(int)anId,0, - (float)r, - (float)g, - (float)b) ; - - if( !status ) { - PrintError() ; - } -} - -Standard_Boolean Xw_Window::IsMapped () const { - if (IsVirtual()) { - return Standard_True; +// ======================================================================= +// function : Unmap +// purpose : +// ======================================================================= +void Xw_Window::Unmap() const +{ + if (IsVirtual() || myXWindow == 0) + { + return; } -XW_WINDOWSTATE state; - state = Xw_get_window_state (MyExtendedWindow); - switch (state) { - case XW_WS_UNKNOWN: - return Standard_False; - case XW_ICONIFY: - return Standard_False; - case XW_PUSH: - return Standard_True; - case XW_MAP: - return Standard_True; -#ifndef DEB - default: - return Standard_False; -#endif - } - return Standard_False; -} - -Standard_Real Xw_Window::Ratio () const { -int width, height; - - status = Xw_get_window_size (MyExtendedWindow,&width,&height); - if( !status ) { - Xw_print_error() ; - } - - return ((Standard_Real)width/height) ; -} - -void Xw_Window::Size (Standard_Integer &Width, Standard_Integer &Height) const { -int width, height; - status = Xw_get_window_size (MyExtendedWindow,&width,&height); - if( !status ) { - Xw_print_error() ; - } - - Width = width ; - Height = height ; -} - -void Xw_Window::Position (Standard_Integer &X1, Standard_Integer &Y1, Standard_Integer &X2, Standard_Integer &Y2) const { -XW_WINDOWSTATE state = XW_WS_UNKNOWN ; -int pxc, pyc; -int width, height; - - state = Xw_get_window_position (MyExtendedWindow, - &pxc,&pyc,&width,&height); - if( state == XW_WS_UNKNOWN ) { - Xw_print_error() ; - } - - X1 = pxc - width/2 ; Y1 = pyc - height/2 ; - X2 = X1 + width - 1 ; Y2 = Y1 + height - 1 ; -} - -Aspect_Handle Xw_Window::XWindow () const { - - return (MyXWindow); + XIconifyWindow (myDisplay->GetDisplay(), myXWindow, DefaultScreen(myDisplay->GetDisplay())); } -void Xw_Window::XWindow (Standard_Integer& aPart1, Standard_Integer& aPart2) const { - - aPart1 = (Standard_Integer)((MyXWindow >> 16 ) & 0xffff); - aPart2 = (Standard_Integer)(MyXWindow & 0xffff); -} +// ======================================================================= +// function : DoResize +// purpose : +// ======================================================================= +Aspect_TypeOfResize Xw_Window::DoResize() const +{ + if (myXWindow == 0) + { + return Aspect_TOR_UNKNOWN; + } -// RIC120302 -Aspect_Handle Xw_Window::XParentWindow () const { + XFlush (myDisplay->GetDisplay()); + XWindowAttributes aWinAttr; + XGetWindowAttributes (myDisplay->GetDisplay(), myXWindow, &aWinAttr); + if (aWinAttr.map_state == IsUnmapped) + { + return Aspect_TOR_UNKNOWN; + } - return (MyXParentWindow); + Standard_Integer aMask = 0; + Aspect_TypeOfResize aMode = Aspect_TOR_UNKNOWN; -} - -void Xw_Window::XParentWindow (Standard_Integer& aPart1, Standard_Integer& aPart2) const { + if (Abs (aWinAttr.x - myXLeft ) > 2) aMask |= 1; + if (Abs ((aWinAttr.x + aWinAttr.width) - myXRight ) > 2) aMask |= 2; + if (Abs (aWinAttr.y - myYTop ) > 2) aMask |= 4; + if (Abs ((aWinAttr.y + aWinAttr.height) - myYBottom) > 2) aMask |= 8; + switch (aMask) + { + case 0: aMode = Aspect_TOR_NO_BORDER; break; + case 1: aMode = Aspect_TOR_LEFT_BORDER; break; + case 2: aMode = Aspect_TOR_RIGHT_BORDER; break; + case 4: aMode = Aspect_TOR_TOP_BORDER; break; + case 5: aMode = Aspect_TOR_LEFT_AND_TOP_BORDER; break; + case 6: aMode = Aspect_TOR_TOP_AND_RIGHT_BORDER; break; + case 8: aMode = Aspect_TOR_BOTTOM_BORDER; break; + case 9: aMode = Aspect_TOR_BOTTOM_AND_LEFT_BORDER; break; + case 10: aMode = Aspect_TOR_RIGHT_AND_BOTTOM_BORDER; break; + default: break; + } - aPart1 = (Standard_Integer)((MyXParentWindow >> 16 ) & 0xffff); - aPart2 = (Standard_Integer)(MyXParentWindow & 0xffff); + *((Standard_Integer* )&myXLeft ) = aWinAttr.x; + *((Standard_Integer* )&myXRight ) = aWinAttr.x + aWinAttr.width; + *((Standard_Integer* )&myYTop ) = aWinAttr.y; + *((Standard_Integer* )&myYBottom ) = aWinAttr.y + aWinAttr.height; + return aMode; } -// RIC120302 - -Aspect_Handle Xw_Window::XPixmap () const { -Aspect_Handle window,pixmap,root,colormap ; -Xw_TypeOfVisual visualclass ; -int visualdepth,visualid ; - status = Xw_get_window_info(MyExtendedWindow,&window,&pixmap, - &root,&colormap,&visualclass,&visualdepth,&visualid) ; - - return (pixmap); +// ======================================================================= +// function : DoMapping +// purpose : +// ======================================================================= +Standard_Boolean Xw_Window::DoMapping() const +{ + return Standard_True; // IsMapped() } -Standard_Boolean Xw_Window::PointerPosition (Standard_Integer& X, Standard_Integer& Y) const { -Standard_Boolean cstatus ; -int x,y ; - - cstatus = Xw_get_cursor_position(MyExtendedWindow,&x,&y) ; - X = x ; - Y = y ; +// ======================================================================= +// function : Ratio +// purpose : +// ======================================================================= +Quantity_Ratio Xw_Window::Ratio() const +{ + if (myXWindow == 0) + { + return 1.0; + } - return (cstatus); + XFlush (myDisplay->GetDisplay()); + XWindowAttributes aWinAttr; + XGetWindowAttributes (myDisplay->GetDisplay(), myXWindow, &aWinAttr); + return Quantity_Ratio(aWinAttr.width) / Quantity_Ratio(aWinAttr.height); } -Xw_TypeOfVisual Xw_Window::VisualClass () const { - - return (MyVisualClass); - +// ======================================================================= +// function : Position +// purpose : +// ======================================================================= +void Xw_Window::Position (Standard_Integer& X1, Standard_Integer& Y1, + Standard_Integer& X2, Standard_Integer& Y2) const +{ + // } -Standard_Boolean Xw_Window::BackgroundPixel ( Standard_Integer &aPixel ) const { -unsigned long pixel ; - - status = Xw_get_background_pixel(MyExtendedWindow,&pixel) ; - if( !status ) PrintError() ; - - aPixel = Standard_Integer(pixel); +// ======================================================================= +// function : Size +// purpose : +// ======================================================================= +void Xw_Window::Size (Standard_Integer& theWidth, + Standard_Integer& theHeight) const +{ + if (myXWindow == 0) + { + return; + } - return status; + XFlush (myDisplay->GetDisplay()); + XWindowAttributes aWinAttr; + XGetWindowAttributes (myDisplay->GetDisplay(), myXWindow, &aWinAttr); + theWidth = aWinAttr.width; + theHeight = aWinAttr.height; } - -Standard_Address Xw_Window::ExtendedWindow () const { - - return (MyExtendedWindow); - -} +#endif // Win32 or Mac OS X diff --git a/src/Xw/Xw_Window.hxx b/src/Xw/Xw_Window.hxx new file mode 100644 index 0000000000..b5caf23da0 --- /dev/null +++ b/src/Xw/Xw_Window.hxx @@ -0,0 +1,124 @@ +// Created on: 2013-04-06 +// Created by: Kirill Gavrilov +// Copyright (c) 2013 OPEN CASCADE SAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 65 (the "License") You may not use the content of this file +// except in compliance with the License Please obtain a copy of the License +// at http://wwwopencascadeorg and read it completely before using this file +// +// The Initial Developer of the Original Code is Open CASCADE SAS, having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement Please see the License for the specific terms +// and conditions governing the rights and limitations under the License + +#ifndef _Xw_Window_H__ +#define _Xw_Window_H__ + +#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Aspect_WindowDefinitionError; +class Aspect_WindowError; +class Aspect_Background; +class Quantity_Color; +class Aspect_GradientBackground; + +//! This class defines XLib window intended for creation of OpenGL context. +class Xw_Window : public Aspect_Window +{ + +public: + + //! Creates a XLib window defined by his position and size in pixels. + //! Throws exception if window can not be created or Display do not support GLX extension. + Standard_EXPORT Xw_Window (const Handle(Aspect_DisplayConnection)& theXDisplay, + const Standard_CString theTitle, + const Standard_Integer thePxLeft, + const Standard_Integer thePxTop, + const Standard_Integer thePxWidth, + const Standard_Integer thePxHeight); + + //! Creates a wrapper over existing Window handle + Standard_EXPORT Xw_Window (const Handle(Aspect_DisplayConnection)& theXDisplay, + const Window theXWin); + + //! Destroies the Window and all resourses attached to it + Standard_EXPORT virtual void Destroy(); + + ~Xw_Window() + { + Destroy(); + } + + //! Opens the window + Standard_EXPORT virtual void Map() const; + + //! Closes the window + Standard_EXPORT virtual void Unmap() const; + + //! Applies the resizing to the window + Standard_EXPORT virtual Aspect_TypeOfResize DoResize() const; + + //! Apply the mapping change to the window + Standard_EXPORT virtual Standard_Boolean DoMapping() const; + + //! Returns True if the window is opened + Standard_EXPORT virtual Standard_Boolean IsMapped() const; + + //! Returns The Window RATIO equal to the physical WIDTH/HEIGHT dimensions + Standard_EXPORT virtual Quantity_Ratio Ratio() const; + + //! Returns The Window POSITION in PIXEL + Standard_EXPORT virtual void Position (Standard_Integer& X1, + Standard_Integer& Y1, + Standard_Integer& X2, + Standard_Integer& Y2) const; + + //! Returns The Window SIZE in PIXEL + Standard_EXPORT virtual void Size (Standard_Integer& theWidth, + Standard_Integer& theHeight) const; + + //! @return native Window handle + Standard_EXPORT Window XWindow() const; + + //! @return connection to X Display + Standard_EXPORT const Handle(Aspect_DisplayConnection)& DisplayConnection() const; + +protected: + + Handle(Aspect_DisplayConnection) myDisplay; //!< X Display connection + Window myXWindow; //!< XLib window handle + Standard_Integer myXLeft; //!< left position in pixels + Standard_Integer myYTop; //!< top position in pixels + Standard_Integer myXRight; //!< right position in pixels + Standard_Integer myYBottom; //!< bottom position in pixels + Standard_Boolean myIsOwnWin; //!< flag to indicate own window handle (to be deallocated on destruction) + +public: + + DEFINE_STANDARD_RTTI(Xw_Window) + +}; + +DEFINE_STANDARD_HANDLE(Xw_Window, Aspect_Window) + +#endif // Win32 or Mac OS X +#endif // _Xw_Window_H__ diff --git a/src/Xw/Xw_alloc_color.cxx b/src/Xw/Xw_alloc_color.cxx deleted file mode 100755 index a55b190714..0000000000 --- a/src/Xw/Xw_alloc_color.cxx +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ALLOC_COLOR -#endif - -/* - XW_STATUS Xw_alloc_color(pcolormap,r,g,b,pixel,isapproximate): - XW_EXT_COLORMAP *pcolormap - float r,g,b ; Red,Green,Blue color value 0. >= x <= 1. - unsigned long pixel ;Returned Color pixel value - bool isapproximate - - Get the color pixel value from an {r,g,b} color definition. - Returned the existing color pixel or create an other if it don't exist. - - Returns ERROR if Bad Color pixel - Returns SUCCESS if Successful - -*/ - -#define OCC38 /* SAV 30/11/01 correcred: gamma correction formula */ - -static double theGammaCorrection = 1.0; -static Colormap theColormap; -static XColor theColors[MAXCOLOR]; -static unsigned char theFilters[MAXCOLOR]; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_alloc_color (XW_EXT_COLORMAP* pcolormap, - float r,float g,float b,unsigned long *pixel,int *isapproximate) -#else -XW_STATUS Xw_alloc_color (pcolormap,r,g,b,pixel,isapproximate) -XW_EXT_COLORMAP *pcolormap; -float r,g,b ; -unsigned long *pixel; -int *isapproximate; -#endif /*XW_PROTOTYPE*/ -{ -int status = False; -int drmin = 65536; -int dgmin = 65536; -int dbmin = 65536; -XColor color; -unsigned char filter='\0'; -char svalue[6]; - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_alloc_color",pcolormap) ; - return (XW_ERROR) ; - } - - *isapproximate = False; - if( _CCLASS == TrueColor ) { - if( theColormap != _CINFO.colormap ) { - theColormap = _CINFO.colormap; - if( Xw_get_env("Xw_SET_GAMMA_CORRECTION",svalue,sizeof(svalue)) ) { - if( strlen(svalue) > 0 ) { - float gamma; - sscanf(svalue,"%f",&gamma); -#ifdef OCC38 - if( gamma > 0. ) - theGammaCorrection = 1. / gamma; -#else - if( gamma > 0. ) theGammaCorrection = gamma; -#endif - } - printf(" Xw_SET_GAMMA_CORRECTION is %f\n",theGammaCorrection) ; - } - } - color.pixel = 0; - if( theGammaCorrection != 1.0 ) { - color.red = (unsigned short) (pow((double)r,theGammaCorrection)*65535.); - color.green = (unsigned short) (pow((double)g,theGammaCorrection)*65535.); - color.blue = (unsigned short) (pow((double)b,theGammaCorrection)*65535.); - } else { - color.red = (unsigned short) (r*65535.); - color.green = (unsigned short) (g*65535.); - color.blue = (unsigned short) (b*65535.); - } - status = XAllocColor(_CDISPLAY,_CINFO.colormap,&color) ; - if( !status ) { - unsigned long mask = _CVISUAL->map_entries-1 ; - unsigned long red = (unsigned long) (r * mask) ; - unsigned long green = (unsigned long) (g * mask) ; - unsigned long blue = (unsigned long) (b * mask) ; - - mask = _CVISUAL->red_mask; - while ( !(mask & 0x01) ) { mask >>= 1; red <<= 1; } - mask = _CVISUAL->green_mask; - while ( !(mask & 0x01) ) { mask >>= 1; green <<= 1; } - mask = _CVISUAL->blue_mask; - while ( !(mask & 0x01) ) { mask >>= 1; blue <<= 1; } - color.pixel = red|green|blue ; - } - } else { - color.pixel = 0; - color.red = (unsigned short) (r*65535.); - color.green = (unsigned short) (g*65535.); - color.blue = (unsigned short) (b*65535.); - status = XAllocColor(_CDISPLAY,_CINFO.colormap,&color) ; - if( !status ) { - int i,j,ncolor = min(MAXCOLOR,_CVISUAL->map_entries); - int dr,dg,db; - - if( theColormap != _CINFO.colormap ) { - theColormap = _CINFO.colormap; - for( i=0 ; i theColors[i].blue ) filter |= 1; - else if( theColors[i].blue > theColors[i].red ) filter |= 4; - if( theColors[i].red > theColors[i].green ) filter |= 2; - else if( theColors[i].green > theColors[i].red ) filter |= 4; - if( theColors[i].blue > theColors[i].green ) filter |= 2; - else if( theColors[i].green > theColors[i].blue ) filter |= 1; - theFilters[i] = filter; - } - } - - filter = 0; - if( color.red > color.blue ) filter |= 1; - else if( color.blue > color.red ) filter |= 4; - if( color.red > color.green ) filter |= 2; - else if( color.green > color.red ) filter |= 4; - if( color.blue > color.green ) filter |= 2; - else if( color.green > color.blue ) filter |= 1; - - for( i=j=0 ; i> 8; - dg = abs( color.green - theColors[i].green ) >> 8; - db = abs( color.blue - theColors[i].blue ) >> 8; - if( (dr <= drmin) && (dg <= dgmin) && (db <= dbmin) ) { - j = i; drmin = dr; dgmin = dg; dbmin = db; - } - } else { /* This is a gray */ - dr = abs( color.red - theColors[i].red ) >> 8; - if( dr <= drmin ) { - j = i; drmin = dr; - } - } - } - } - - if( filter ) { - if( (drmin > 0) || (dgmin > 0) || (dbmin > 0) ) *isapproximate = True; - } else { - if( drmin > 0 ) *isapproximate = True; - } - - color.pixel = theColors[j].pixel; - } - } - *pixel = color.pixel; - status = XW_SUCCESS; - -#ifdef TRACE_ALLOC_COLOR -if( Xw_get_trace() ) { - printf(" %d = Xw_alloc_color(%lx,%f,%f,%f,%ld,%d)\n", - status,(long ) pcolormap,r,g,b,*pixel,*isapproximate) ; - if( *isapproximate ) { - if( !filter ) { - printf(" Is an approximate color of delta-GRAY (%f)\n",(float)drmin/65535.); - } else { - printf(" Is an approximate color of delta-COLOR (%f,%f,%f)\n", - (float)drmin/65535., - (float)dgmin/65535., - (float)dbmin/65535.); - } - } -} -#endif - return (XW_STATUS)status; -} diff --git a/src/Xw/Xw_alloc_pixel.cxx b/src/Xw/Xw_alloc_pixel.cxx deleted file mode 100755 index 4277a905ca..0000000000 --- a/src/Xw/Xw_alloc_pixel.cxx +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ALLOC_PIXEL -#define TRACE_SET_PIXEL -#define TRACE_FREE_PIXEL -#endif - -/* - XW_STATUS Xw_alloc_pixel(pcolormap,*pixel): - XW_EXT_COLORMAP *pcolormap - unsigned long *pixel; - - Allocates a pixel in the colormap and - returns SUCCESS for a valid pixel value according of the free space of - the colormap, - or ERROR if no more room exist in the colormap. - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_alloc_pixel (void* acolormap, unsigned long *pixel) -#else -XW_STATUS Xw_alloc_pixel (acolormap,pixel) -void *acolormap; -unsigned long *pixel; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*) acolormap; -XW_STATUS status = XW_ERROR; - - *pixel = 0; - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_alloc_pixel",pcolormap) ; - return (XW_ERROR) ; - } - - if( _CCLASS == PseudoColor ) { - if( XAllocColorCells(_CDISPLAY, - _CINFO.colormap,False,NULL,0,pixel,1) ) { - status = XW_SUCCESS; - } - } - -#ifdef TRACE_ALLOC_PIXEL -if( Xw_get_trace() ) { - printf(" %d = Xw_alloc_pixel(%lx,%ld)\n",status,(long ) pcolormap,*pixel) ; -} -#endif - return (status); -} - -/* - XW_STATUS Xw_set_pixel(pcolormap,pixel,r,g,b): - XW_EXT_COLORMAP *pcolormap - unsigned long pixel; - float r,g,b; - - Updates a pixel with the color {r,g,b} defined in [0-1] space - returns SUCCESS for a valid PseudoColor pixel -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_pixel (void* acolormap, unsigned long pixel, float r, float g, float b) -#else -XW_STATUS Xw_set_pixel (acolormap,pixel,r,g,b) -void *acolormap; -unsigned long pixel; -float r,g,b; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*) acolormap; -XW_STATUS status = XW_ERROR; - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_set_pixel",pcolormap) ; - return (XW_ERROR) ; - } - - if( _CCLASS == PseudoColor ) { - XColor color; - int error,gravity; - char *serror; - color.pixel = pixel; - color.red = (unsigned short) (r*65535.); - color.green = (unsigned short) (g*65535.); - color.blue = (unsigned short) (b*65535.); - color.flags = DoRed | DoGreen | DoBlue; - - Xw_print_error(); - if( !Xw_get_trace() ) Xw_set_synchronize(_CDISPLAY,True); - XStoreColor(_CDISPLAY,_CINFO.colormap,&color); - if( !Xw_get_trace() ) Xw_set_synchronize(_CDISPLAY,False); - serror = Xw_get_error(&error,&gravity); - if( error < 1000 ) status = XW_SUCCESS; - } - -#ifdef TRACE_SET_PIXEL -if( Xw_get_trace() ) { - printf(" %d = Xw_set_pixel(%lx,%ld,%f,%f,%f)\n",status,(long ) pcolormap,pixel,r,g,b) ; -} -#endif - return (status); -} - -/* - XW_STATUS Xw_free_pixel(pcolormap,pixel): - XW_EXT_COLORMAP *pcolormap - unsigned long pixel; - - Free a pixel from the colormap - returns SUCCESS for a valid PseudoColor pixel -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_free_pixel (void* acolormap, unsigned long pixel) -#else -XW_STATUS Xw_free_pixel (acolormap,pixel) -void *acolormap; -unsigned long pixel; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*) acolormap; -XW_STATUS status = XW_ERROR; - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_free_pixel",pcolormap) ; - return (XW_ERROR) ; - } - - if( _CCLASS == PseudoColor ) { - int error,gravity; - char *serror; - - Xw_print_error(); - if( !Xw_get_trace() ) Xw_set_synchronize(_CDISPLAY,True); - XFreeColors(_CDISPLAY,_CINFO.colormap,&pixel,1,0); - if( !Xw_get_trace() ) Xw_set_synchronize(_CDISPLAY,False); - serror = Xw_get_error(&error,&gravity); - if( error < 1000 ) status = XW_SUCCESS; - } - -#ifdef TRACE_FREE_PIXEL -if( Xw_get_trace() ) { - printf(" %d = Xw_free_pixel(%lx,%ld)\n",status,(long ) pcolormap,pixel) ; -} -#endif - return (status); -} diff --git a/src/Xw/Xw_calc_points.cxx b/src/Xw/Xw_calc_points.cxx deleted file mode 100755 index b82a90abde..0000000000 --- a/src/Xw/Xw_calc_points.cxx +++ /dev/null @@ -1,82 +0,0 @@ -// Created on: 2002-02-20 -// Created by: Sergey ALTUKHOV -// Copyright (c) 2002-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include -#include -#include -#include - - -#ifdef XW_PROTOTYPE -int PXPOINT( double x, double ratio ) -#else -int PXPOINT( x, ratio ) -double x, ratio; -#endif /*XW_PROTOTYPE*/ -{ - int result = 0; - try { - OCC_CATCH_SIGNALS - result = (int) ( x / ratio ); - } - catch (Standard_Failure) { - result = ROUND( x / ratio ); - } - return result; -} - - -#ifdef XW_PROTOTYPE -int PYPOINT( double y, double height, double ratio ) -#else -int PYPOINT( y, height, ratio ) -double y, height, ratio; -#endif /*XW_PROTOTYPE*/ -{ - int result = 0; - try { - OCC_CATCH_SIGNALS - result = (int)( height - ( y / ratio ) ); - } - catch (Standard_Failure) { - result = ROUND( height - ( y / ratio ) ); - } - return result; -} - - -#ifdef XW_PROTOTYPE -int PVALUE( double v, double xratio, double yratio ) -#else -int PVALUE( v, xratio, yratio ) -double v, xratio, yratio; -#endif /*XW_PROTOTYPE*/ -{ - int result = 0; - try { - OCC_CATCH_SIGNALS - result = (int)( v / ( ( xratio + yratio ) / 2. ) ); - } - catch (Standard_Failure) { - result = ROUND( v / ( ( xratio + yratio ) / 2. ) ); - } - return result; -} - diff --git a/src/Xw/Xw_convert_image.cxx b/src/Xw/Xw_convert_image.cxx deleted file mode 100755 index 8bad4ee06b..0000000000 --- a/src/Xw/Xw_convert_image.cxx +++ /dev/null @@ -1,581 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -/* -C< -C*********************************************************************** -C -C FONCTION : -C ---------- -C -C -C$ HISTORIQUE DES MODIFICATIONS : -C -------------------------------- -C 21-02-97 : GG ; G1334-PERF -C Ameliorer les performances de traduction -C des images XWD. -C >> Rempacer XGetPixel et XputPixel par des -C directes dans le buffer image. -C 07-05-97 : GG ; PRO7909 -C Eviter de detruire l'image convertie lorsqu'il n'y a pas -C de conversion a faire ! -*/ - -#define PRO7909 - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_CONVERT_IMAGE -#endif - -/* - XW_STATUS Xw_convert_image (awindow,aimage,acolors,ncolors): - XW_EXT_WINDOW *awindow - XW_EXT_IMAGEDATA *aimage - XW_EXT_COLOR *acolors (can be NULL) - int ncolors - - Convert an image depending of the window class - - returns ERROR if image can't be converted. - returns SUCCESS if successfull - -*/ - -#define CREATE_IMAGE(_fun,_out,_nbp) \ - /* Allocate the new pixel buffer */ \ - if( !(_out = (unsigned char*) Xw_calloc(piimage->width * piimage->height,_nbp)) ) {\ - /*ERROR*Bad Image allocation*/ \ - Xw_set_error(60,_fun,0) ; \ - return NULL ; \ - } \ - /* Create the new Image structure */ \ - if( !(poimage = XCreateImage(_DISPLAY,_VISUAL,_DEPTH,ZPixmap,\ - 0,(char*)_out,piimage->width,piimage->height,_nbp*8,0)) ) {\ - /* ERROR*XImage Creation failed */ \ - Xw_set_error(62,_fun,0) ; \ - Xw_free((char*)_out) ; \ - return NULL ; \ - } - -#define COPY_PSEUDO_TO_PSEUDO(_fun,_in,_out) \ - for( y=0 ; yheight ; y++ ) { \ - for( x=0 ; xwidth ; x++ ) { \ - ipixel = *_in++; \ - if( ipixel != lipixel ) { \ - lipixel = ipixel; \ - if( ipixel >= MAXCOLOR ) ipixel = 0 ; \ - opixel = mapping[ipixel] ; \ - if( !opixel ) { \ - for( i=0,j=ipixel ; i= ncolors ) j = 0 ; \ - if( ipixel == pcolors[j].pixel ) break; \ - } \ - red = (float)pcolors[j].red/0xFFFF ; \ - green = (float)pcolors[j].green/0xFFFF ; \ - blue = (float)pcolors[j].blue/0xFFFF ; \ - if( !Xw_get_color_pixel(_COLORMAP,red,green,blue,&opixel,&isapproximate)) {\ - /*ERROR*XImage Creation failed*/ \ - Xw_set_error(63,_fun,&_COLORMAP->info.colormap) ;\ - } \ - mapping[ipixel] = opixel ; \ - } \ - } \ - *_out++ = opixel; \ - } \ - if( ipad > 0 ) pidata.cdata += ipad; \ - } - -#define COPY_PSEUDO_TO_TRUE(_fun,_in,_out) \ - for( y=0 ; yheight ; y++ ) { \ - for( x=0 ; xwidth ; x++ ) { \ - ipixel = *_in++; \ - if( ipixel != lipixel ) { \ - lipixel = ipixel; \ - if( ipixel >= MAXCOLOR ) ipixel = 0 ; \ - opixel = mapping[ipixel] ; \ - if( !opixel ) { \ - for( i=0,j=ipixel ; i= ncolors ) j = 0 ; \ - if( ipixel == pcolors[j].pixel ) break; \ - } \ - red = (float)pcolors[j].red/0xFFFF ; \ - green = (float)pcolors[j].green/0xFFFF ; \ - blue = (float)pcolors[j].blue/0xFFFF ; \ - if( !Xw_get_color_pixel(_COLORMAP,red,green,blue,&opixel,&isapproximate)) {\ - /*ERROR*XImage Creation failed*/ \ - Xw_set_error(63,_fun,&_COLORMAP->info.colormap) ;\ - } \ - mapping[ipixel] = opixel ; \ - } \ - } \ - *_out++ = opixel; \ - } \ - if( ipad > 0 ) pidata.cdata += ipad; \ - } - -#define COPY_TRUE_TO_PSEUDO(_fun,_in,_out) \ - for( y=0 ; yheight ; y++ ) { \ - for( x=0 ; xwidth ; x++ ) { \ - ipixel = *_in++; \ - if( ipixel != lipixel ) { \ - lipixel = ipixel; \ - red = (float)((ipixel >> sred) & cmask)/(float)cmask; \ - green = (float)((ipixel >> sgreen) & cmask)/(float)cmask; \ - blue = (float)((ipixel >> sblue) & cmask)/(float)cmask; \ - if( !Xw_get_color_pixel(_COLORMAP,red,green,blue,&opixel,&isapproximate)) {\ - /*ERROR*XImage Creation failed*/ \ - Xw_set_error(63,_fun,&_COLORMAP->info.colormap) ; \ - } \ - } \ - *_out++ = opixel; \ - } \ - if( ipad > 0 ) pidata.cdata += ipad; \ - } - -#define COPY_TRUE_TO_TRUE(_fun,_in,_out) \ - for( y=0 ; yheight ; y++ ) { \ - for( x=0 ; xwidth ; x++ ) { \ - ipixel = *_in++; \ - if( ipixel != lipixel ) { \ - lipixel = ipixel; \ - red = (float)((ipixel >> sred) & cmask)/(float)cmask; \ - green = (float)((ipixel >> sgreen) & cmask)/(float)cmask; \ - blue = (float)((ipixel >> sblue) & cmask)/(float)cmask; \ - if( !Xw_get_color_pixel(_COLORMAP,red,green,blue,&opixel,&isapproximate)) {\ - /*ERROR*XImage Creation failed*/ \ - Xw_set_error(63,_fun,&_COLORMAP->info.colormap) ; \ - } \ - } \ - *_out++ = opixel; \ - } \ - if( ipad > 0 ) pidata.cdata += ipad; \ - } - - -#ifdef XW_PROTOTYPE -static XImage* ConvertPseudoToPseudo(XW_EXT_WINDOW *pwindow,XImage *piimage,XColor *pcolors,int ncolors) ; -static XImage* ConvertPseudoToTrue(XW_EXT_WINDOW *pwindow,XImage *piimage,XColor *pcolors,int ncolors) ; -static XImage* ConvertTrueToPseudo(XW_EXT_WINDOW *pwindow,XImage *piimage) ; -static XImage* ConvertTrueToTrue(XW_EXT_WINDOW *pwindow,XImage *piimage) ; -#else -static XImage* ConvertPseudoToPseudo() ; -static XImage* ConvertPseudoToTrue() ; -static XImage* ConvertTrueToPseudo() ; -static XImage* ConvertTrueToTrue() ; -#endif /*XW_PROTOTYPE*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_convert_image (void *awindow,void *aimage,void *acolors,int ncolors) -#else -XW_STATUS Xw_convert_image (awindow,aimage,acolors,ncolors) -void *awindow; -void *aimage; -void *acolors; -int ncolors; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*)aimage; -XColor *pcolors = (XColor*)acolors; -XImage *piimage,*poimage = NULL; -XW_STATUS status = XW_ERROR; -int i,iclass = 0; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_convert_image",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_image(pimage) ) { - /*ERROR*Bad EXT_IMAGEDATA Address*/ - Xw_set_error(25,"Xw_convert_image",pimage) ; - return (XW_ERROR) ; - } - - piimage = (_ZIMAGE) ? _ZIMAGE : _IIMAGE; - - if( !pcolors && piimage->red_mask && - piimage->green_mask && piimage->blue_mask ) iclass = TrueColor; - else iclass = PseudoColor; - - switch ( iclass ) { - case PseudoColor : - - if( !pcolors ) { - if( !_ICOLORMAP ) _ICOLORMAP = _COLORMAP; - ncolors = min(_IVISUAL->map_entries,MAXCOLOR); - pcolors = (XColor*) Xw_calloc(sizeof(XColor),ncolors); - for( i=0 ; iinfo.colormap,pcolors,ncolors) ; - } - - if( pcolors ) switch (_CLASS ) { - case PseudoColor : /* Convert Pseudo to PseudoColor */ - if( acolors || (_ICOLORMAP != _COLORMAP) ) { - poimage = ConvertPseudoToPseudo(pwindow,piimage,pcolors,ncolors) ; - } else { - poimage = piimage; - } - break ; - case TrueColor : /* Convert Pseudo to TrueColor */ - poimage = ConvertPseudoToTrue(pwindow,piimage,pcolors,ncolors) ; - break ; - default: - /*ERROR*Unimplemented Visual class*/ - Xw_set_error(5,"Xw_convert_image",&_CLASS) ; - } -#ifdef BUG /* Cette memoire est liberee par Xw_load_image !! */ - if( pcolors && !acolors ) Xw_free(pcolors); -#endif - break ; - - case TrueColor : - switch (_CLASS ) { - case PseudoColor : /* Convert True to PseudoColor */ - poimage = ConvertTrueToPseudo(pwindow,piimage) ; - break ; - case TrueColor : /* Convert True to TrueColor */ - poimage = ConvertTrueToTrue(pwindow,piimage) ; - break ; - default: - /*ERROR*Unimplemented Visual class*/ - Xw_set_error(5,"Xw_convert_image",&_CLASS) ; - } - break ; - - default: - /*ERROR*Unimplemented Visual class*/ - Xw_set_error(5,"Xw_convert_image",&iclass) ; - } - - _ICOLORMAP = _COLORMAP; - if( poimage ) { - status = XW_SUCCESS; - /* Destroy the old image */ - if( _ZIMAGE && (_ZIMAGE != _IIMAGE) ) { - XDestroyImage(_ZIMAGE); - _ZIMAGE = NULL; - } - /* Initialize the output image */ -#ifdef PRO7909 - if( _IIMAGE != poimage ) { - XDestroyImage(_IIMAGE); - _IIMAGE = poimage; - } -#else - XDestroyImage(_IIMAGE); - _IIMAGE = poimage; -#endif - pimage->zoom = 1.; - } - -#ifdef TRACE_CONVERT_IMAGE -if( Xw_get_trace() ) { - printf (" %d = Xw_convert_image(%lx,%lx,%lx,%d)\n", - status,(long ) pwindow,(long ) pimage,(long ) pcolors,ncolors); -} -#endif - - return (status); -} - -#ifdef XW_PROTOTYPE -static XImage* ConvertTrueToPseudo(XW_EXT_WINDOW *pwindow,XImage *piimage) -#else -static XImage* ConvertTrueToPseudo(pwindow,piimage) -XW_EXT_WINDOW *pwindow ; -XImage *piimage ; -#endif /*XW_PROTOTYPE*/ -/* - Convert TrueColor to PseudoColor Image -*/ -{ -unsigned long ipixel,opixel,cmask ; -unsigned long lipixel = 0xFFFFFFFF ; -//int i,j,ipad,isapproximate ; -int ipad,isapproximate ; -int sred,sgreen,sblue ; -float red,green,blue ; -register union { - unsigned char *cdata ; - unsigned short *sdata ; - unsigned int *idata ; -} pidata,podata; -register int x,y; -XImage *poimage = NULL ; - -#ifdef TRACE_CONVERT_IMAGE - if( Xw_get_trace() ) { - printf(" Xw_convert_image.TrueToPseudo()\n") ; - } -#endif - - ipad = piimage->bytes_per_line - - piimage->width * piimage->bits_per_pixel/8 ; - pidata.cdata = (unsigned char*)piimage->data + piimage->xoffset; - - sred = sgreen = sblue = 0 ; - cmask = piimage->red_mask ; - while ( !(cmask & 1) ) { cmask >>= 1 ; sred++ ; } - cmask = piimage->green_mask ; - while ( !(cmask & 1) ) { cmask >>= 1 ; sgreen++ ; } - cmask = piimage->blue_mask ; - while ( !(cmask & 1) ) { cmask >>= 1 ; sblue++ ; } - - CREATE_IMAGE("ConvertTrueToPseudo",podata.cdata,1) - switch (piimage->bits_per_pixel) { - case 8 : - COPY_TRUE_TO_PSEUDO("ConvertTrueToPseudo",pidata.cdata,podata.cdata); - break; - case 16 : - COPY_TRUE_TO_PSEUDO("ConvertTrueToPseudo",pidata.sdata,podata.cdata); - break; - case 32 : - COPY_TRUE_TO_PSEUDO("ConvertTrueToPseudo",pidata.idata,podata.cdata); - break; - default: - /*ERROR*Unimplemented Image Visual depth*/ - Xw_set_error(64,"ConvertTrueToPseudo",&piimage->bits_per_pixel); - } - - return (poimage) ; -} - -#ifdef XW_PROTOTYPE -static XImage* ConvertPseudoToTrue(XW_EXT_WINDOW *pwindow,XImage *piimage,XColor *pcolors,int ncolors) -#else -static XImage* ConvertPseudoToTrue(pwindow,piimage,pcolors,ncolors) -XW_EXT_WINDOW *pwindow ; -XImage *piimage ; -XColor *pcolors; -int ncolors; -#endif /*XW_PROTOTYPE*/ -/* - Convert PseudoColor to TrueColor Image -*/ -{ -unsigned long ipixel,opixel ; -unsigned long lipixel = 0xFFFFFFFF ; -unsigned long mapping[MAXCOLOR]; -int i,j,ipad,isapproximate ; -float red,green,blue ; -register union { - unsigned char *cdata ; - unsigned short *sdata ; - unsigned int *idata ; -} pidata,podata; -register int x,y; -XImage *poimage = NULL ; - -#ifdef TRACE_CONVERT_IMAGE - if( Xw_get_trace() ) { - printf(" Xw_convert_image.PseudoToTrue()\n") ; - } -#endif - - for( i=0 ; ibytes_per_line - - piimage->width * piimage->bits_per_pixel/8 ; - pidata.cdata = (unsigned char*)piimage->data + piimage->xoffset; - - switch (_DEPTH) { - case 4 : - case 8 : - CREATE_IMAGE("ConvertPseudoToTrue",podata.cdata,1) - COPY_PSEUDO_TO_TRUE("ConvertPseudoToTrue",pidata.cdata,podata.cdata); - break; - case 12 : - CREATE_IMAGE("ConvertPseudoToTrue",podata.cdata,2) - COPY_PSEUDO_TO_TRUE("ConvertPseudoToTrue",pidata.cdata,podata.sdata); - break; - case 24 : - CREATE_IMAGE("ConvertPseudoToTrue",podata.cdata,4) - COPY_PSEUDO_TO_TRUE("ConvertPseudoToTrue",pidata.cdata,podata.idata); - break; - default: - /*ERROR*Unimplemented Image Visual depth*/ - Xw_set_error(64,"ConvertPseudoToTrue",&_DEPTH); - } - - - return (poimage) ; -} - -#ifdef XW_PROTOTYPE -static XImage* ConvertPseudoToPseudo(XW_EXT_WINDOW *pwindow,XImage *piimage,XColor *pcolors,int ncolors) -#else -static XImage* ConvertPseudoToPseudo(pwindow,piimage,pcolors,ncolors) -XW_EXT_WINDOW *pwindow ; -XImage *piimage ; -XColor *pcolors; -int ncolors; -#endif /*XW_PROTOTYPE*/ -/* - Convert PseudoColor to PseudoColor Image -*/ -{ -unsigned long ipixel,opixel ; -unsigned long lipixel = 0xFFFFFFFF ; -unsigned long mapping[MAXCOLOR]; -int i,j,ipad,isapproximate ; -float red,green,blue ; -register union { - unsigned char *cdata ; - unsigned short *sdata ; - unsigned int *idata ; -} pidata,podata; -register int x,y; -XImage *poimage = NULL ; - -#ifdef TRACE_CONVERT_IMAGE - if( Xw_get_trace() ) { - printf(" Xw_convert_image.PseudoToPseudo()\n") ; - } -#endif - - for( i=0 ; ibytes_per_line - - piimage->width * piimage->bits_per_pixel/8 ; - pidata.cdata = (unsigned char*)piimage->data + piimage->xoffset; - - switch (_DEPTH) { - case 4 : - case 8 : - CREATE_IMAGE("ConvertPseudoToPseudo",podata.cdata,1) - COPY_PSEUDO_TO_PSEUDO("ConvertPseudoToPseudo",pidata.cdata,podata.cdata); - break; - default: - /*ERROR*Unimplemented Image Visual depth*/ - Xw_set_error(64,"ConvertPseudoToPseudo",&_DEPTH); - } - - - return (poimage) ; -} - -#ifdef XW_PROTOTYPE -static XImage* ConvertTrueToTrue(XW_EXT_WINDOW *pwindow,XImage *piimage) -#else -static XImage* ConvertTrueToTrue(pwindow,piimage) -XW_EXT_WINDOW *pwindow ; -XImage *piimage ; -#endif /*XW_PROTOTYPE*/ -/* - Convert TrueColor to TrueColor Image -*/ -{ -unsigned long ipixel,opixel,cmask ; -unsigned long lipixel = 0xFFFFFFFF ; -//int i,j,ipad,isapproximate ; -int ipad,isapproximate ; -int sred,sgreen,sblue ; -float red,green,blue ; -register union { - unsigned char *cdata ; - unsigned short *sdata ; - unsigned int *idata ; -} pidata,podata; -register int x,y; -XImage *poimage = NULL ; - -#ifdef TRACE_CONVERT_IMAGE - if( Xw_get_trace() ) { - printf(" Xw_convert_image.TrueToTrue()\n") ; - } -#endif - - if( (_DEPTH == piimage->depth) && - (_VISUAL->red_mask == piimage->red_mask) && - (_VISUAL->green_mask == piimage->green_mask) && - (_VISUAL->blue_mask == piimage->blue_mask) ) return piimage; - - ipad = piimage->bytes_per_line - - piimage->width * piimage->bits_per_pixel/8 ; - pidata.cdata = (unsigned char*)piimage->data + piimage->xoffset; - - sred = sgreen = sblue = 0 ; - cmask = piimage->red_mask ; - while ( !(cmask & 1) ) { cmask >>= 1 ; sred++ ; } - cmask = piimage->green_mask ; - while ( !(cmask & 1) ) { cmask >>= 1 ; sgreen++ ; } - cmask = piimage->blue_mask ; - while ( !(cmask & 1) ) { cmask >>= 1 ; sblue++ ; } - - switch (_DEPTH) { - case 4 : - case 8 : - CREATE_IMAGE("ConvertTrueToTrue",podata.cdata,1) - switch (piimage->bits_per_pixel) { - case 8 : - COPY_TRUE_TO_TRUE("ConvertTrueToTrue",pidata.cdata,podata.cdata); - break; - case 16 : - COPY_TRUE_TO_TRUE("ConvertTrueToTrue",pidata.sdata,podata.cdata); - break; - case 32 : - COPY_TRUE_TO_TRUE("ConvertTrueToTrue",pidata.idata,podata.cdata); - break; - default: - /*ERROR*Unimplemented Image Visual depth*/ - Xw_set_error(64,"ConvertTrueToTrue",&piimage->bits_per_pixel); - } - break; - case 12 : - CREATE_IMAGE("ConvertTrueToTrue",podata.cdata,2) - switch (piimage->bits_per_pixel) { - case 8 : - COPY_TRUE_TO_TRUE("ConvertTrueToTrue",pidata.cdata,podata.sdata); - break; - case 16 : - COPY_TRUE_TO_TRUE("ConvertTrueToTrue",pidata.sdata,podata.sdata); - break; - case 32 : - COPY_TRUE_TO_TRUE("ConvertTrueToTrue",pidata.idata,podata.sdata); - break; - default: - /*ERROR*Unimplemented Image Visual depth*/ - Xw_set_error(64,"ConvertTrueToTrue",&piimage->bits_per_pixel); - } - break; - case 24 : - CREATE_IMAGE("ConvertTrueToTrue",podata.cdata,4) - switch (piimage->bits_per_pixel) { - case 8 : - COPY_TRUE_TO_TRUE("ConvertTrueToTrue",pidata.cdata,podata.idata); - break; - case 16 : - COPY_TRUE_TO_TRUE("ConvertTrueToTrue",pidata.sdata,podata.idata); - break; - case 32 : - COPY_TRUE_TO_TRUE("ConvertTrueToTrue",pidata.idata,podata.idata); - break; - default: - /*ERROR*Unimplemented Image Visual depth*/ - Xw_set_error(64,"ConvertTrueToTrue",&piimage->bits_per_pixel); - } - break; - default: - /*ERROR*Unimplemented Image Visual depth*/ - Xw_set_error(64,"ConvertTrueToTrue",&_DEPTH); - } - - return (poimage) ; -} diff --git a/src/Xw/Xw_def_background_color.cxx b/src/Xw/Xw_def_background_color.cxx deleted file mode 100755 index d61ec24ca5..0000000000 --- a/src/Xw/Xw_def_background_color.cxx +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_BACKGROUND_COLOR -#endif - -/* - XW_STATUS Xw_def_background_color(awindow,r,g,b): - XW_EXT_WINDOW *awindow - float r,g,b ; Red,Green,Blue color value 0. >= x <= 1. - - Update Background Color index with the specified R,G,B values . - - Returns ERROR if Extended Window or Colormap is wrong - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_def_background_color (void* awindow, - float r,float g,float b) -#else -XW_STATUS Xw_def_background_color (awindow,r,g,b) -void *awindow; -float r,g,b ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_COLORMAP *pcolormap ; -unsigned long backpixel,highpixel ; -XColor color ; -int i,index,cclass,isapproximate ; -XW_STATUS status = XW_SUCCESS; - - if ( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_def_background_color",pwindow) ; - return (XW_ERROR) ; - } - - if ( !Xw_isdefine_colormap(_COLORMAP) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_def_background_color",_COLORMAP) ; - return (XW_ERROR) ; - } - - pcolormap = _COLORMAP ; - - index = pwindow->backindex ; - - if( index >= 0 ) { - if( pcolormap->define[index] != BACKCOLOR ) { - for( i=0 ; imaxcolor ; i++ ) { - if( pcolormap->define[i] == FREECOLOR ) break; - } - - if( i < pcolormap->maxcolor ) { - index = i ; - pcolormap->define[i] = BACKCOLOR; - } - } - - if( pcolormap->mapping == Xw_TOM_READONLY ) { - cclass = StaticColor; - } else { - cclass = _CCLASS; - } - - switch ( cclass ) { - - case TrueColor : - Xw_get_color_pixel(pcolormap,r,g,b,&backpixel,&isapproximate) ; - break ; - - case PseudoColor : - if( pcolormap->mapping == Xw_TOM_COLORCUBE ) { - if( (_CGINFO.red_mult > 0) && (fabs(r-g) < 0.01) && (fabs(r-b) < 0.01) ) { - index = (int)(0.5+r*_CGINFO.red_max)*_CGINFO.red_mult; - if( _CINFO.red_max > 0 ) - index += (_CINFO.red_max+1)*(_CINFO.green_max+1)*(_CINFO.blue_max+1); - } else if( _CINFO.red_mult > 0 ) { - index = ((int)(0.5+r*_CINFO.red_max))*_CINFO.red_mult+ - ((int)(0.5+g*_CINFO.green_max))*_CINFO.green_mult+ - ((int)(0.5+b*_CINFO.blue_max))*_CINFO.blue_mult; - } else if( _CGINFO.red_mult > 0 ) { - float l = (r+g+b)/3.; - index = (int)(0.5+l*_CGINFO.red_max)*_CGINFO.red_mult; - } else { - index = 0; - } - backpixel = _CINFO.base_pixel = index; - } else if( pcolormap->define[index] == BACKCOLOR ) { - color.pixel = backpixel = pcolormap->pixels[index] ; - color.red = (unsigned short) (r * 0xFFFF) ; - color.green = (unsigned short) (g * 0xFFFF) ; - color.blue = (unsigned short) (b * 0xFFFF) ; - color.flags = DoRed|DoGreen|DoBlue ; - XStoreColor(_DISPLAY,_CINFO.colormap,&color) ; - } - break ; - - case StaticColor : - status = Xw_alloc_color(pcolormap,r,g,b,&backpixel,&isapproximate) ; - break ; - } - - if( status ) { - pwindow->backindex = index ; - pcolormap->pixels[index] = backpixel ; - } - } else { - backpixel = pcolormap->backpixel ; /* Transparent window */ - } - - if( status ) { - highpixel = pcolormap->highpixel ^ backpixel ; - XSetWindowBackground (_DISPLAY, _WINDOW, backpixel) ; - XSetBackground(_DISPLAY, pwindow->qgwind.gc, backpixel) ; - XSetBackground(_DISPLAY, pwindow->qgwind.gccopy, backpixel) ; - XSetBackground(_DISPLAY, pwindow->qgwind.gcclear, backpixel) ; - XSetBackground(_DISPLAY, pwindow->qgwind.gchigh, backpixel) ; - XSetForeground(_DISPLAY, pwindow->qgwind.gcclear, backpixel) ; - XSetForeground(_DISPLAY, pwindow->qgwind.gchigh, highpixel) ; - for( i=0 ; iqgline[i].gc, backpixel); - XSetBackground(_DISPLAY, pwindow->qgpoly[i].gc, backpixel); - XSetBackground(_DISPLAY, pwindow->qgtext[i].gc, backpixel); - XSetBackground(_DISPLAY, pwindow->qgmark[i].gc, backpixel); - } - } - -#ifdef TRACE_DEF_BACKGROUND_COLOR -if( Xw_get_trace() ) { - printf(" %d = Xw_def_background_color(%lx,%f,%f,%f)\n",status,(long ) pwindow,r,g,b) ; -} -#endif - return (status); -} diff --git a/src/Xw/Xw_def_color.cxx b/src/Xw/Xw_def_color.cxx deleted file mode 100755 index c32a57e121..0000000000 --- a/src/Xw/Xw_def_color.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_COLOR -#endif - -/* - XW_STATUS Xw_def_color(acolormap,index,r,g,b): - XW_EXT_COLORMAP *acolormap - int index ; Color index 0 >= x < MAXCOLOR - float r,g,b ; Red,Green,Blue color value 0. >= x <= 1. - - Update Color Extended colormap index with the specified R,G,B values . - - Returns ERROR if BadColor Index - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_def_color (void* acolormap, - int index,float r,float g,float b) -#else -XW_STATUS Xw_def_color (acolormap,index,r,g,b) -void *acolormap; -int index ; -float r,g,b ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XColor color ; -int cclass,isapproximate; -unsigned long pixel; -XW_STATUS status = XW_SUCCESS; - - if ( !Xw_isdefine_colorindex(pcolormap,index) ) { - /*ERROR*Bad Color Index*/ - Xw_set_error(1,"Xw_def_color",&index) ; - return (XW_ERROR) ; - } - - if( pcolormap->mapping == Xw_TOM_READONLY ) { - cclass = StaticColor; - } else { - cclass = _CCLASS; - } - - switch (cclass) { - - case TrueColor : - Xw_get_color_pixel(pcolormap,r,g,b,&pixel,&isapproximate) ; - break ; - - case PseudoColor : - if( pcolormap->mapping == Xw_TOM_COLORCUBE ) { - int kindex; - if( (_CGINFO.red_mult > 0) && (fabs(r-g) < 0.01) && (fabs(r-b) < 0.01) ) { - kindex = (int)(0.5+r*_CGINFO.red_max)*_CGINFO.red_mult; - if( _CINFO.red_max > 0 ) - kindex += (_CINFO.red_max+1)*(_CINFO.green_max+1)*(_CINFO.blue_max+1); - } else if( _CINFO.red_mult > 0 ) { - kindex = ((int)(0.5+r*_CINFO.red_max))*_CINFO.red_mult+ - ((int)(0.5+g*_CINFO.green_max))*_CINFO.green_mult+ - ((int)(0.5+b*_CINFO.blue_max))*_CINFO.blue_mult; - } else if( _CGINFO.red_mult > 0 ) { - float l = (r+g+b)/3.; - kindex = (int)(0.5+l*_CGINFO.red_max)*_CGINFO.red_mult; - } else { - kindex = 0; - } - pixel = _CINFO.base_pixel + kindex; - } else { - color.pixel = pixel = pcolormap->pixels[index] ; - color.red = (unsigned short) (r * 0xFFFF) ; - color.green = (unsigned short) (g * 0xFFFF) ; - color.blue = (unsigned short) (b * 0xFFFF) ; - color.flags = DoRed|DoGreen|DoBlue ; - XStoreColor(_CDISPLAY,_CINFO.colormap,&color) ; - } - break ; - - case StaticColor : - status = Xw_alloc_color(pcolormap,r,g,b,&pixel,&isapproximate) ; - break ; - } - - if( status ) { - pcolormap->define[index] = USERCOLOR ; - pcolormap->pixels[index] = pixel ; - } - -#ifdef TRACE_DEF_COLOR -if( Xw_get_trace() ) { - printf(" %d = Xw_def_color(%lx,%d,%f,%f,%f)\n",status,(long ) pcolormap,index,r,g,b) ; -} -#endif - return (status); -} diff --git a/src/Xw/Xw_def_colormap.cxx b/src/Xw/Xw_def_colormap.cxx deleted file mode 100755 index 64a3970d6e..0000000000 --- a/src/Xw/Xw_def_colormap.cxx +++ /dev/null @@ -1,1461 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#ifdef HAVE_CONFIG_H - #include -#endif - -#include - -#include - -/* - XW_EXT_COLORMAP* Xw_def_colormap(adisplay,pclass,ncolor,basemap,mapping): - XW_EXT_DISPLAY *adisplay Extended Display structure - Xw_TypeOfVisual pclass Visual Class,must be one of : - - Xw_TOV_STATICGRAY, - Xw_TOV_GRAYSCALE, - Xw_TOV_STATICCOLOR, - Xw_TOV_PSEUDOCOLOR, - Xw_TOV_TRUECOLOR, - Xw_TOV_DIRECTCOLOR, - Xw_TOV_DEFAULT, - Xw_TOV_PREFERRED_PSEUDOCOLOR, - Xw_TOV_PREFERRED_TRUECOLOR, - Xw_TOV_PREFERRED_OVERLAY, - Xw_TOV_OVERLAY - - int ncolor Maximum Number of color to be allocated - Aspect_Handle basemap User Colormap (Can be NULL) - Xw_TypeOfMapping Colormap mapping ,must be ONE of - - XW_TOM_HARDRAMP, - XW_TOM_SIMPLERAMP, - XW_TOM_BESTRAMP, - XW_TOM_COLORCUBE, - XW_TOM_READONLY - - Create a colormap extension with a colormap ID - compatible with the visual class required - allocate the max color cells in the colormap as if possible - depending of the actual Standard Colormap size. - NOTE than the resulting color number must be less than - the required color number depending of the System color number used . - See Xw_get_colormap_info for more Informations - - NOTE than if ncolor <= 0 this allocates the Maximum color - number in the colormap . - - Returns Colormap extension address if successuful - Returns NULL if Bad Allocation - or BadVisual class - or Bad resulting Color Number - - STATUS Xw_close_colormap(acolormap): - XW_EXT_COLORMAP* acolormap Extended Colormap address - - - Destroy The specified Extended Colormap - - Returns SUCCESS if successuful - Returns ERROR if Bad Extended Colormap - - STATUS Xw_set_colormap_mapping(acolormap,mode) - XW_EXT_COLORMAP* acolormap Extended Colormap address - Xw_TypeOfMapping mode - - Update the specified ColorMap in the requested Color Mapping - - Returns SUCCESS if successuful - Returns ERROR if Bad Extended Colormap -*/ - -#define MAXGRAY 13 -#define MAXCOLORCUBE 216 -static char SetColorCube = 'Y' ; -static char UseDefaults = 'U' ; -static int MinColors = MINCOLOR ; -static int FreColors = FRECOLOR ; -static int TrueColorMinDepth = 12 ; -static int OverlayColorMinDepth = 4 ; -static int MaxGray = MAXGRAY ; -static int MaxColorCube = MAXCOLORCUBE ; -static int EnableSunOverlay = False; -static char svalue[80] ; -static Atom DefaultAtom = 0 ; -static const char *XW_RGB_BEST_MAP = "Xw_RGB_BEST_MAP" ; - -void* Xw_def_colormap (void* adisplay,Xw_TypeOfVisual pclass, - int ncolor,Aspect_Handle basemap,Xw_TypeOfMapping mapping) -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; -XW_EXT_COLORMAP *pcolormap = NULL ; -XVisualInfo *ginfo = NULL ; -int i,j,n,b,d,acolor,mcolor,fcolor,cclass ; -unsigned long backpixel = 0; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_def_colormap",pdisplay) ; - return (NULL) ; - } - - if( Xw_get_env("Xw_USE_DEFAULTS",svalue,sizeof(svalue)) ){ - if( strlen(svalue) ) { - UseDefaults = svalue[0] ; - } - printf( " Xw_USE_DEFAULTS is '%c'\n",UseDefaults) ; - } - if( Xw_get_env("Xw_SET_COLOR_CUBE",svalue,sizeof(svalue)) ){ - if( strlen(svalue) ) { - SetColorCube = svalue[0] ; - } - printf( " Xw_SET_COLOR_CUBE is '%c'\n",SetColorCube) ; - } - if( Xw_get_env("Xw_MIN_COLORS",svalue,sizeof(svalue)) ){ - if( strlen(svalue) ) { - sscanf(svalue,"%d",&MinColors) ; - } - printf( " Xw_MIN_COLORS is %d\n",MinColors) ; - } - if( Xw_get_env("Xw_FRE_COLORS",svalue,sizeof(svalue)) ){ - if( strlen(svalue) ) { - sscanf(svalue,"%d",&FreColors) ; - } - printf( " Xw_FRE_COLORS is %d\n",FreColors) ; - } - if( pdisplay->server == XW_SERVER_IS_HP ) TrueColorMinDepth = 8; - if( Xw_get_env("Xw_SET_TRUE_COLOR_MIN_DEPTH",svalue,sizeof(svalue)) ){ - if( strlen(svalue) ) { - sscanf(svalue,"%d",&TrueColorMinDepth) ; - } - printf( " Xw_SET_TRUE_COLOR_MIN_DEPTH is %d\n",TrueColorMinDepth) ; - } - if( Xw_get_env("Xw_SET_OVERLAY_COLOR_MIN_DEPTH",svalue,sizeof(svalue)) ){ - if( strlen(svalue) ) { - sscanf(svalue,"%d",&OverlayColorMinDepth) ; - } - printf( " Xw_SET_OVERLAY_COLOR_MIN_DEPTH is %d\n",OverlayColorMinDepth) ; - } - if( Xw_get_env("Xw_MAX_GRAY",svalue,sizeof(svalue)) ){ - if( strlen(svalue) ) { - sscanf(svalue,"%d",&MaxGray) ; - } - printf( " Xw_MAX_GRAY is %d\n",MaxGray) ; - } - if( Xw_get_env("Xw_MAX_COLORCUBE",svalue,sizeof(svalue)) ){ - if( strlen(svalue) ) { - sscanf(svalue,"%d",&MaxColorCube) ; - } - printf( " Xw_MAX_COLORCUBE is %d\n",MaxColorCube) ; - } - if( Xw_get_env("Xw_ENABLE_SUNOVERLAY",svalue,sizeof(svalue)) ){ - if( svalue[0] == 'Y' ) EnableSunOverlay = True; - else EnableSunOverlay = False; - - printf( " Xw_ENABLE_SUNOVERLAY is %d\n",EnableSunOverlay) ; - } - - if( UseDefaults == 'P' ) pclass = Xw_TOV_PREFERRED_PSEUDOCOLOR ; - else if( UseDefaults == 'T' ) pclass = Xw_TOV_PREFERRED_TRUECOLOR ; - else if( UseDefaults == 'O' ) pclass = Xw_TOV_PREFERRED_OVERLAY ; - else if( UseDefaults == 'S' ) pclass = Xw_TOV_STATICCOLOR ; - else if( UseDefaults == 'Y' ) pclass = Xw_TOV_DEFAULT ; - - if( pclass == Xw_TOV_OVERLAY ) { - ginfo = Xw_get_overlay_visual_info(pdisplay, - Xw_TOV_PSEUDOCOLOR,&backpixel) ; - if( !ginfo ) return (NULL) ; - } else if( pclass == Xw_TOV_PREFERRED_OVERLAY ) { - ginfo = Xw_get_overlay_visual_info(pdisplay, - Xw_TOV_PSEUDOCOLOR,&backpixel) ; - if( !ginfo ) pclass = Xw_TOV_PREFERRED_PSEUDOCOLOR; - } - - if( !ginfo ) { - ginfo = Xw_get_visual_info(pdisplay,pclass) ; - } - - if( !ginfo ) return (NULL) ; - - if( !(pcolormap = Xw_add_colormap_structure(sizeof(XW_EXT_COLORMAP))) ) - return (NULL) ; - pcolormap->connexion = pdisplay ; - pcolormap->visual = ginfo->visual ; - pcolormap->backpixel = backpixel ; - XFree((char*)ginfo) ; - -RESTART : - - if( mapping == Xw_TOM_READONLY ) { - cclass = StaticColor; - } else { - cclass = _CCLASS; - } - - switch ( cclass ) { - - case TrueColor : - acolor = MAXCOLOR ; - pcolormap->maxucolor = acolor ; - pcolormap->maxhcolor = _CVISUAL->map_entries * - _CVISUAL->map_entries * - _CVISUAL->map_entries ; - pcolormap->info.base_pixel = 0 ; - if( (_DCLASS == TrueColor) && - (UseDefaults == 'Y' || UseDefaults == 'P') ) { - basemap = _CCOLORMAP ; - } else if( UseDefaults == 'N' ) { - basemap = 0 ; - } - - if( basemap ) { - _CINFO.colormap = basemap ; - } - - _CINFO.killid = 0 ; - _CINFO.visualid = _CVISUAL->visualid ; - if( !_CINFO.colormap ) { - _CINFO.killid = getpid(); - _CINFO.colormap = XCreateColormap(_CDISPLAY,_CROOT, - _CVISUAL,AllocNone) ; - } - break ; - - case PseudoColor : - { - unsigned long stdpixels[MAXCOLOR] ; - unsigned long usrpixels[MAXCOLOR] ; - - if( ncolor ) { - acolor = ncolor+1 ; - } else { - acolor = MAXCOLOR ; - } - mcolor = 0 ; - fcolor = 0 ; - - acolor = min(_CVISUAL->map_entries,acolor); - pcolormap->maxhcolor = min(_CVISUAL->map_entries,MAXCOLOR) ; - - _CINFO.colormap = 0 ; - _CINFO.base_pixel = 0 ; - _CINFO.red_max = _CINFO.green_max = _CINFO.blue_max = 0 ; - _CINFO.killid = 1 ; - _CINFO.visualid = _CVISUAL->visualid ; - - if( (_DCLASS == PseudoColor) && - (UseDefaults == 'Y' || UseDefaults == 'P') ) { - basemap = _CCOLORMAP ; - } else if( UseDefaults == 'N' ) { - basemap = 0 ; - } - - if( basemap ) { - _CINFO.colormap = basemap ; - } - - if( !_CINFO.colormap ) { /* Create colormap */ - _CINFO.colormap = XCreateColormap(_CDISPLAY,_CROOT, - _CVISUAL,AllocNone) ; - usrpixels[0] = 0 ; - if( !_CINFO.colormap ) { - /*ERROR*Colormap creation failed*/ - Xw_set_error(2,"Xw_def_colormap",NULL) ; - Xw_del_colormap_structure(pcolormap) ; - return (NULL) ; - } - } - /* Allocate colors */ - usrpixels[0] = 0; - while ( acolor && !XAllocColorCells(_CDISPLAY, - _CINFO.colormap,True,NULL,0,usrpixels,acolor) ) { - --acolor ; - } - /* Verify if COLORS are Contigues */ - for( i=j=1,n=b=d=0 ; i n ) { /* Take the largest hole */ - b = d ; - n = j ; - } - d = i ; - j = 1 ; - } - } - if( j > n ) { - b = d ; - n = j ; - } - /* Verify FREE Space for other applications */ - if( basemap ) { - j = pcolormap->maxhcolor - (usrpixels[n-1]+1) ; - if( b+j < fcolor ) { /* Let Free space as specified */ - j = fcolor - (b+j) ; - b += j ; n -= j ; - } - if( n < mcolor ) { /* Too few Colors */ - XFreeColors(_CDISPLAY,_CINFO.colormap,usrpixels,acolor,0); - basemap = 0 ; - goto RESTART ; - } - } - - if( mapping == Xw_TOM_BESTRAMP ) { - /* Base pixel must be EVEN */ - if( usrpixels[b] & 1 ) { - b++ ; --n ; - } - } - - if( n < acolor ) { - /* Allocate ONLY %d contiguous colors */ - if( b ) { - XFreeColors(_CDISPLAY,_CINFO.colormap,usrpixels,b,0) ; - } - if( b+n < acolor ) { - XFreeColors(_CDISPLAY,_CINFO.colormap, - &usrpixels[b+n],acolor-b-n,0) ; - } - for( i=0 ; imaxucolor = acolor ; - - if( (_CINFO.colormap != _CCOLORMAP) && - ((MinCmapsOfScreen(_CSCREEN) < 1) || - (MaxCmapsOfScreen(_CSCREEN) == 1)) ) { - /* Get the First usable color in DEFAULT colormap */ - int scolor = pcolormap->maxhcolor ; - XColor color ; - - color.flags = DoRed | DoGreen | DoBlue ; - while ( scolor && !XAllocColorCells(_CDISPLAY, - _CCOLORMAP,True,NULL,0,stdpixels,scolor) ) --scolor ; - - XFreeColors(_CDISPLAY,_CCOLORMAP,stdpixels,scolor,0) ; - - for( i=0 ; imaxhcolor ; i++ ) { - color.pixel = _CINFO.base_pixel + i ; - XQueryColor(_CDISPLAY,_CCOLORMAP,&color) ; - XStoreColor(_CDISPLAY,_CINFO.colormap,&color) ; - } - - if( scolor >= mcolor ) { - pcolormap->maxucolor = scolor ; - _CINFO.base_pixel = stdpixels[0] ; - } - - } - acolor = pcolormap->maxucolor ; - } - break ; - - case StaticColor : - { -// unsigned long usrpixel ; - if( (_DCLASS == PseudoColor) && (_CCLASS == PseudoColor) && - (UseDefaults == 'Y' || UseDefaults == 'P') ) { - basemap = _CCOLORMAP ; - } else if( UseDefaults == 'N' ) { - basemap = 0 ; - } - _CINFO.visualid = _CVISUAL->visualid ; - _CINFO.red_max = _CINFO.green_max = _CINFO.blue_max = 0 ; - _CINFO.red_mult = _CINFO.green_mult = _CINFO.blue_mult = 0 ; - _CINFO.killid = 0 ; - if( basemap ) { - _CINFO.colormap = basemap ; - } - - if( !_CINFO.colormap ) { /* Create colormap */ - _CINFO.colormap = XCreateColormap(_CDISPLAY,_CROOT, - _CVISUAL,AllocNone) ; - if( !_CINFO.colormap ) { - /*ERROR*Colormap creation failed*/ - Xw_set_error(2,"Xw_def_colormap",NULL) ; - Xw_del_colormap_structure(pcolormap) ; - return (NULL) ; - } - } - _CINFO.base_pixel = 0 ; - acolor = (ncolor > 0) ? ncolor : MAXCOLOR ; - if( _CCLASS != TrueColor ) { - pcolormap->maxhcolor = min(_CVISUAL->map_entries,MAXCOLOR) ; - } else { - pcolormap->maxhcolor = _CVISUAL->map_entries * - _CVISUAL->map_entries * - _CVISUAL->map_entries ; - } - pcolormap->maxucolor = min(acolor,pcolormap->maxhcolor); - } - break ; - - case StaticGray : - case GrayScale : - case DirectColor : - /*ERROR*Unimplemented Visual class*/ - Xw_set_error(5,"Xw_def_colormap",&pclass) ; - return (NULL) ; - } - - Xw_set_colormap_mapping(pcolormap,mapping) ; - Xw_def_highlight_color(pcolormap,1.,1.,1.) ; - - return (pcolormap); -} - -static XW_EXT_COLORMAP *PcolormapList =NULL ; - -//! Create and Insert one Extended colormap structure in the -//! EXtended colormap List -//! returns Extended colormap address if successful -//! or NULL if Bad Allocation -XW_EXT_COLORMAP* Xw_add_colormap_structure(int size) -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*) Xw_malloc(size) ; -//int i ; - - if( pcolormap ) { - pcolormap->type = COLORMAP_TYPE ; - pcolormap->link = PcolormapList ; - PcolormapList = pcolormap ; - pcolormap->connexion = NULL ; - pcolormap->visual = NULL ; - pcolormap->maxcolor = 0 ; - pcolormap->maxhcolor = 0 ; - pcolormap->maxucolor = 0 ; - pcolormap->maxwindow = 0 ; - pcolormap->mapping = (Xw_TypeOfMapping)-1 ; - pcolormap->highpixel = 0 ; - pcolormap->backpixel = 0 ; - pcolormap->info.base_pixel = 0 ; - pcolormap->info.red_max = 0 ; - pcolormap->info.red_mult = 0 ; - pcolormap->info.green_max = 0 ; - pcolormap->info.green_mult = 0 ; - pcolormap->info.blue_max = 0 ; - pcolormap->info.blue_mult = 0 ; - pcolormap->info.colormap = 0 ; - pcolormap->ginfo.base_pixel = 0 ; - pcolormap->ginfo.red_max = 0 ; - pcolormap->ginfo.red_mult = 0 ; - pcolormap->ginfo.green_max = 0 ; - pcolormap->ginfo.green_mult = 0 ; - pcolormap->ginfo.blue_max = 0 ; - pcolormap->ginfo.blue_mult = 0 ; - pcolormap->ginfo.colormap = 0 ; - } else { - /*ERROR*EXT_COLORMAP allocation failed*/ - Xw_set_error(6,"Xw_add_colormap_structure",NULL) ; - } - - return (pcolormap) ; -} - -//! Get the NEXT ColorMap structure from the List -//! returns Extended colormap address if successful -//! or NULL if No MORE Colormap is found -XW_EXT_COLORMAP* Xw_get_colormap_structure(XW_EXT_COLORMAP* pcolormap) -{ - - if( pcolormap ) return (XW_EXT_COLORMAP*)pcolormap->link ; - else return (PcolormapList) ; -} - -XW_STATUS Xw_close_colormap(void* acolormap) -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XW_STATUS status ; - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_close_colormap",pcolormap) ; - return (XW_ERROR) ; - } - - status = Xw_del_colormap_structure(pcolormap) ; - - return (status) ; -} - -//! Remove the Extended colormap address from the Extended List and -//! Free the Extended Colormap -//! returns ERROR if the colormap address is not Found in the list -//! returns SUCCESS if successful -XW_STATUS Xw_del_colormap_structure(XW_EXT_COLORMAP* pcolormap) -{ -XW_EXT_COLORMAP *fcolormap; -//int i ; - - if( !pcolormap ) return (XW_ERROR) ; - - if( pcolormap->maxwindow ) { - return (XW_ERROR) ; - } else { - if( (_CINFO.killid == (unsigned int ) getpid()) && _CINFO.colormap ) { - if( _CINFO.colormap != _CCOLORMAP ) { - XFreeColormap(_CDISPLAY,_CINFO.colormap) ; - for( fcolormap = PcolormapList ; fcolormap ; - fcolormap = (XW_EXT_COLORMAP*)fcolormap->link ) { - if( (fcolormap != pcolormap) && - (fcolormap->info.colormap == _CINFO.colormap) ) { - fcolormap->info.colormap = 0 ; - } - } - _CINFO.colormap = 0; - } - DefaultAtom = XInternAtom(_CDISPLAY,XW_RGB_BEST_MAP,True) ; - if( DefaultAtom ) { - XDeleteProperty(_CDISPLAY,_CROOT,DefaultAtom); - } - } - if( pcolormap == PcolormapList ) { - PcolormapList = (XW_EXT_COLORMAP*)pcolormap->link ; - } else { - for( fcolormap = PcolormapList ; fcolormap ; - fcolormap = (XW_EXT_COLORMAP*)fcolormap->link ) { - if( fcolormap->link == pcolormap ) { - fcolormap->link = pcolormap->link ; - break ; - } - } - } - Xw_free(pcolormap) ; - } - return (XW_SUCCESS) ; -} - -//! Set MAPPING Colormap mode -//! if mapping is SIMPLERAMP all color cells access is done -//! across the PIXEL index array . -//! if mapping is BESTRAMP all color cells access is done -//! across the PIXEL index array and an HIGHLIGHT plane is created . -//! if mapping is HARDRAMP all color cells access is done -//! directly (Make becarefull !!) -//! if mapping is COLORCUBE all color cells access is done -//! across a ColorCube PIXEL index array . -//! if mapping is READONLY all color cells access is done -//! across a readonly PIXEL index array without color allocation. -XW_STATUS Xw_set_colormap_mapping(void* acolormap,Xw_TypeOfMapping mode) -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -int status,cstatus,gstatus ; -unsigned char define[MAXCOLOR] ; -unsigned long pixels[MAXCOLOR] ; -XColor color ; -//int i,j,k,n,size,ncolor,ngcolor,nccolor=0 ; -int i,j,n,size,ncolor,ngcolor,nccolor=0 ; -unsigned int iu , ju , ku ; -//unsigned long red,green,blue,mask,rmask,gmask,bmask,pixel ; -unsigned long red,green,blue,pixel ; -XStandardColormap *cinfo = NULL,*cginfo = NULL,*pinfo = NULL; -int nmap; - - if( !pcolormap || (mode == pcolormap->mapping) ) return (XW_ERROR) ; - - for( i=0 ; idefine[i] ; - pixels[i] = pcolormap->pixels[i] ; - } - - switch (_CCLASS) { - - case Xw_TOV_TRUECOLOR : - switch (mode) { - - case Xw_TOM_SIMPLERAMP : - case Xw_TOM_READONLY : - pcolormap->maxcolor = pcolormap->maxucolor ; - pcolormap->highpixel = AllPlanes ; - switch (pcolormap->mapping) { - case Xw_TOM_READONLY : - case Xw_TOM_BESTRAMP : - case Xw_TOM_HARDRAMP : - case Xw_TOM_COLORCUBE : - break ; - default : - for( i=0 ; idefine[i] = FREECOLOR ; - pcolormap->pixels[i] = 0 ; - } - } - break ; - case Xw_TOM_BESTRAMP : - pcolormap->maxcolor = pcolormap->maxucolor ; - pcolormap->highpixel = AllPlanes ; - switch (pcolormap->mapping) { - case Xw_TOM_READONLY : - case Xw_TOM_SIMPLERAMP : - case Xw_TOM_HARDRAMP : - case Xw_TOM_COLORCUBE : - break ; - default : - for( i=0 ; idefine[i] = FREECOLOR ; - pcolormap->pixels[i] = 0 ; - } - } - break ; - case Xw_TOM_HARDRAMP : - pcolormap->maxcolor = pcolormap->maxucolor ; - pcolormap->highpixel = AllPlanes ; - switch (pcolormap->mapping) { - case Xw_TOM_READONLY : - case Xw_TOM_SIMPLERAMP : - case Xw_TOM_BESTRAMP : - case Xw_TOM_COLORCUBE : - break ; - default : - for( i=0 ; idefine[i] = FREECOLOR ; - pcolormap->pixels[i] = 0 ; - } - } - break ; - case Xw_TOM_COLORCUBE : - pcolormap->maxcolor = pcolormap->maxucolor ; - pcolormap->highpixel = AllPlanes ; - switch (pcolormap->mapping) { - case Xw_TOM_READONLY : - case Xw_TOM_SIMPLERAMP : - case Xw_TOM_BESTRAMP : - case Xw_TOM_HARDRAMP : - default : - for( i=0 ; idefine[i] = FREECOLOR ; - pcolormap->pixels[i] = 0 ; - } - nccolor = pcolormap->maxhcolor; - if( nccolor > 0 ) { - _CINFO.red_max = _CVISUAL->red_mask; - _CINFO.red_mult = 1; - while ( !(_CINFO.red_max & 0x01) ) { - _CINFO.red_max >>= 1; - _CINFO.red_mult <<= 1; - } - _CINFO.green_max = _CVISUAL->green_mask; - _CINFO.green_mult = 1; - while ( !(_CINFO.green_max & 0x01) ) { - _CINFO.green_max >>= 1; - _CINFO.green_mult <<= 1; - } - _CINFO.blue_max = _CVISUAL->blue_mask; - _CINFO.blue_mult = 1; - while ( !(_CINFO.blue_max & 0x01) ) { - _CINFO.blue_max >>= 1; - _CINFO.blue_mult <<= 1; - } - status = XmuCreateColormap(_CDISPLAY,&_CINFO); - } - ngcolor = _CVISUAL->red_mask + 1; - if( ngcolor > 0 ) { - _CGINFO.colormap = _CINFO.colormap; - _CGINFO.base_pixel = _CINFO.base_pixel; - _CGINFO.visualid = _CINFO.visualid; - _CGINFO.killid = getpid(); - _CGINFO.red_max = _CVISUAL->red_mask; - _CGINFO.red_mult = 1; - while ( !(_CGINFO.red_max & 0x01) ) { - _CGINFO.red_max >>= 1; - _CGINFO.red_mult <<= 1; - } - _CGINFO.green_max = _CVISUAL->green_mask; - _CGINFO.green_mult = 1; - while ( !(_CGINFO.green_max & 0x01) ) { - _CGINFO.green_max >>= 1; - _CGINFO.green_mult <<= 1; - } - _CGINFO.blue_max = _CVISUAL->blue_mask; - _CGINFO.blue_mult = 1; - while ( !(_CGINFO.blue_max & 0x01) ) { - _CGINFO.blue_max >>= 1; - _CGINFO.blue_mult <<= 1; - } - _CGINFO.red_mult |= _CGINFO.green_mult | _CGINFO.blue_mult; - _CGINFO.green_max = 0; - _CGINFO.green_mult = 1; - _CGINFO.blue_max = 0; - _CGINFO.blue_mult = 1; - status = XmuCreateColormap(_CDISPLAY,&_CGINFO); - } - } - break ; - } - break ; - - case Xw_TOV_STATICCOLOR : - switch (mode) { - - case Xw_TOM_SIMPLERAMP : - case Xw_TOM_READONLY : - pcolormap->maxcolor = pcolormap->maxucolor ; - pcolormap->highpixel = _CINFO.base_pixel+1 ; - switch (pcolormap->mapping) { - case Xw_TOM_READONLY : - case Xw_TOM_BESTRAMP : - case Xw_TOM_HARDRAMP : - case Xw_TOM_COLORCUBE : - break ; - default : - for( i=0 ; idefine[i] = FREECOLOR ; - pcolormap->pixels[i] = 0 ; - } - } - break ; - case Xw_TOM_BESTRAMP : - pcolormap->maxcolor = pcolormap->maxucolor ; - pcolormap->highpixel = _CINFO.base_pixel+1 ; - switch (pcolormap->mapping) { - case Xw_TOM_READONLY : - case Xw_TOM_SIMPLERAMP : - case Xw_TOM_HARDRAMP : - case Xw_TOM_COLORCUBE : - break ; - default : - for( i=0 ; idefine[i] = FREECOLOR ; - pcolormap->pixels[i] = 0 ; - } - } - break ; - case Xw_TOM_HARDRAMP : - pcolormap->maxcolor = pcolormap->maxucolor ; - pcolormap->highpixel = _CINFO.base_pixel+1 ; - switch (pcolormap->mapping) { - case Xw_TOM_READONLY : - case Xw_TOM_SIMPLERAMP : - case Xw_TOM_BESTRAMP : - case Xw_TOM_COLORCUBE : - break ; - default : - for( i=0 ; idefine[i] = FREECOLOR ; - pcolormap->pixels[i] = 0 ; - } - } - break ; - case Xw_TOM_COLORCUBE : - pcolormap->maxcolor = pcolormap->maxucolor ; - pcolormap->highpixel = _CINFO.base_pixel+1 ; - switch (pcolormap->mapping) { - case Xw_TOM_HARDRAMP : - for( i=0 ; imaxucolor ; i++ ) { - pcolormap->define[i] = define[_CINFO.base_pixel+i] ; - pcolormap->pixels[i] = pixels[_CINFO.base_pixel+i] ; - } - break ; - case Xw_TOM_SIMPLERAMP : - case Xw_TOM_READONLY : - case Xw_TOM_BESTRAMP : - default : - for( i=0 ; idefine[i] = FREECOLOR ; - pcolormap->pixels[i] = 0 ; - } - color.flags = DoRed | DoGreen | DoBlue ; - size = (int)(pow((double)pcolormap->maxucolor, - (double)1./3.)+0.1); - for( ; size > 0 ; --size ) { - nccolor = size*size*size ; - if( (nccolor <= pcolormap->maxucolor) && (nccolor <= MaxColorCube) ) break ; - } - _CINFO.red_max = size-1 ; _CINFO.red_mult = 1 ; - _CINFO.green_max = size-1 ; _CINFO.green_mult = size ; - _CINFO.blue_max = size-1 ; _CINFO.blue_mult = size*size ; - for( iu=n=0 ; iu<=_CINFO.blue_max ; iu++ ) { - blue = (_CINFO.blue_max > 0) ? - (0xFFFF*iu)/_CINFO.blue_max : 0xFFFF ; - for( ju=0 ; ju<=_CINFO.green_max ; ju++ ) { - green = (_CINFO.green_max > 0) ? - (0xFFFF*ju)/_CINFO.green_max : 0xFFFF ; - for( ku=0 ; ku<=_CINFO.red_max ; ku++,n++ ) { - red = (_CINFO.red_max > 0) ? - (0xFFFF*ku)/_CINFO.red_max : 0xFFFF ; - color.red = red ; - color.green = green ; - color.blue = blue ; - XAllocColor(_CDISPLAY,_CINFO.colormap,&color) ; - pcolormap->define[n] = SYSTEMCOLOR ; - pcolormap->pixels[n] = color.pixel ; - } - } - } - } - break ; - } - break ; - - case Xw_TOV_PSEUDOCOLOR : - switch (mode) { - - case Xw_TOM_SIMPLERAMP : - case Xw_TOM_READONLY : - pcolormap->maxcolor = pcolormap->maxucolor ; - pcolormap->highpixel = _CINFO.base_pixel+1 ; - switch (pcolormap->mapping) { - case Xw_TOM_BESTRAMP : - for( i=j=0 ; imaxucolor ; i++,j += 2 ) { - if( j >= pcolormap->maxucolor ) j = 1 ; - pcolormap->define[j] = define[i] ; - pcolormap->pixels[j] = pixels[i] ; - } - break ; - case Xw_TOM_HARDRAMP : - for( i=0 ; imaxucolor ; i++ ) { - pcolormap->define[i] = define[_CINFO.base_pixel+i] ; - pcolormap->pixels[i] = pixels[_CINFO.base_pixel+i] ; - } - break ; - case Xw_TOM_COLORCUBE : - case Xw_TOM_READONLY : - break ; - default : - for( i=0 ; imaxucolor ; i++ ) { - pcolormap->pixels[i] = _CINFO.base_pixel + i ; - pcolormap->define[i] = FREECOLOR ; - } - } - - if( mode == Xw_TOM_READONLY ) { - if( !DefaultAtom ) DefaultAtom = XInternAtom(_CDISPLAY, - XW_RGB_BEST_MAP,True) ; - if( DefaultAtom ) { - status = XGetRGBColormaps(_CDISPLAY,_CROOT, - &pinfo,&nmap,DefaultAtom); - } else status = False ; - - if( status ) { - status = False; - for( i=0 ; icolormap,&color); - if( !Xw_get_trace() ) Xw_set_synchronize(_CDISPLAY,False) ; - serror = Xw_get_error(&error,&gravity); - if( status && (error < 1000) ) { - if( _CINFO.colormap != cinfo->colormap ) { - if( _CINFO.colormap && (_CINFO.colormap != _CCOLORMAP) ) { - XFreeColormap(_CDISPLAY,_CINFO.colormap) ; - } - } - _CINFO.colormap = cinfo->colormap; - _CINFO.red_max = cinfo->red_max; - _CINFO.red_mult = cinfo->red_mult; - _CINFO.green_max = cinfo->green_max; - _CINFO.green_mult = cinfo->green_mult; - _CINFO.blue_max = cinfo->blue_max; - _CINFO.blue_mult = cinfo->blue_mult; - _CINFO.base_pixel = cinfo->base_pixel; - _CINFO.visualid = cinfo->visualid; - _CINFO.killid = cinfo->killid ; - status = True; - } else { - if( Xw_get_trace() ) - printf(" Xw_set_colormap_mapping.BAD registered COLORMAP 0x%lx\n",cinfo->colormap); - - status = False; - Xw_print_error(); - - } - } - } - - if( !status ) { - if( !pinfo ) { - nmap = 1; - pinfo = (XStandardColormap*) - malloc(sizeof(XStandardColormap)); - cinfo = &pinfo[0]; - } else if( !cinfo ) { - nmap++; - pinfo = (XStandardColormap*) realloc((char*)pinfo, - nmap*sizeof(XStandardColormap)); - cinfo = &pinfo[nmap-1]; - } - cinfo->colormap = _CINFO.colormap; - cinfo->visualid = _CINFO.visualid; - cinfo->killid = getpid(); - cinfo->base_pixel = _CINFO.base_pixel; - cinfo->red_max = _CINFO.red_max; - cinfo->green_max = _CINFO.green_max; - cinfo->blue_max = _CINFO.blue_max; - cinfo->red_mult = _CINFO.red_mult; - cinfo->green_mult = _CINFO.green_mult; - cinfo->blue_mult = _CINFO.blue_mult; - - if( !DefaultAtom ) DefaultAtom = XInternAtom(_CDISPLAY, - XW_RGB_BEST_MAP,False) ; - XSetRGBColormaps(_CDISPLAY,_CROOT,pinfo,nmap,DefaultAtom) ; - } - if( pinfo ) XFree(pinfo); - XInstallColormap(_CDISPLAY,_CINFO.colormap); - } - - break ; - - case Xw_TOM_BESTRAMP : - pcolormap->maxcolor = pcolormap->maxucolor ; - pcolormap->highpixel = _CINFO.base_pixel+1 ; - switch (pcolormap->mapping) { - case Xw_TOM_SIMPLERAMP : - for( i=j=0 ; imaxucolor ; i++,j += 2 ) { - if( j >= pcolormap->maxucolor ) j = 1 ; - pcolormap->define[i] = define[j] ; - pcolormap->pixels[i] = pixels[j] ; - } - break ; - case Xw_TOM_HARDRAMP : - for( i=j=0 ; imaxucolor ; i++,j += 2 ) { - if( j >= pcolormap->maxucolor ) j = 1 ; - pcolormap->define[i] = define[_CINFO.base_pixel+j] ; - pcolormap->pixels[i] = pixels[_CINFO.base_pixel+j] ; - } - break ; - case Xw_TOM_COLORCUBE : - case Xw_TOM_READONLY : - break ; - default : - for( i=j=0 ; imaxucolor ; i++,j += 2 ) { - if( j >= pcolormap->maxucolor ) j = 1 ; - pcolormap->pixels[i] = _CINFO.base_pixel + j ; - pcolormap->define[i] = FREECOLOR ; - } - } - break ; - - case Xw_TOM_HARDRAMP : - pcolormap->maxcolor = pcolormap->maxhcolor ; - pcolormap->highpixel = _CINFO.base_pixel+1 ; - switch (pcolormap->mapping) { - case Xw_TOM_COLORCUBE : - case Xw_TOM_READONLY : - case Xw_TOM_SIMPLERAMP : - for( i=0 ; imaxucolor ; i++ ) { - pcolormap->define[_CINFO.base_pixel+i] = define[i] ; - pcolormap->pixels[_CINFO.base_pixel+i] = pixels[i] ; - } - for( iu=0 ; iu<_CINFO.base_pixel ; iu++ ) { - pcolormap->define[iu] = SYSTEMCOLOR ; - pcolormap->pixels[iu] = iu ; - } - for( i=_CINFO.base_pixel+pcolormap->maxucolor ; - imaxhcolor ; i++ ) { - pcolormap->define[i] = SYSTEMCOLOR ; - pcolormap->pixels[i] = i ; - } - break ; - case Xw_TOM_BESTRAMP : - for( i=j=0 ; imaxucolor ; i++,j += 2 ) { - if( j >= pcolormap->maxucolor ) j = 1 ; - pcolormap->define[_CINFO.base_pixel+j] = define[i] ; - pcolormap->pixels[_CINFO.base_pixel+j] = pixels[i] ; - } - for( iu=0 ; iu<_CINFO.base_pixel ; iu++ ) { - pcolormap->define[iu] = SYSTEMCOLOR ; - pcolormap->pixels[iu] = iu ; - } - for( i=_CINFO.base_pixel+pcolormap->maxucolor ; - imaxhcolor ; i++ ) { - pcolormap->define[i] = SYSTEMCOLOR ; - pcolormap->pixels[i] = i ; - } - break ; - default : - for( i=0 ; imaxucolor ; i++ ) { - pcolormap->pixels[i] = i ; - pcolormap->define[i] = SYSTEMCOLOR ; - } - } - break ; - - case Xw_TOM_COLORCUBE : - pcolormap->maxcolor = pcolormap->maxucolor ; - switch (pcolormap->mapping) { - case Xw_TOM_HARDRAMP : - for( i=0 ; imaxucolor ; i++ ) { - pcolormap->define[i] = define[_CINFO.base_pixel+i] ; - pcolormap->pixels[i] = pixels[_CINFO.base_pixel+i] ; - } - break ; - case Xw_TOM_SIMPLERAMP : - case Xw_TOM_READONLY : - case Xw_TOM_BESTRAMP : - default : - for( i=0 ; imaxucolor ; i++ ) { - pcolormap->pixels[i] = _CINFO.base_pixel + i ; - pcolormap->define[i] = FREECOLOR ; - } - - if( SetColorCube != 'Y' ) status = False ; - else status = True ; - - ngcolor = 0; - cstatus = gstatus = False; - if( status ) { - - if( !DefaultAtom ) DefaultAtom = XInternAtom(_CDISPLAY, - XW_RGB_BEST_MAP,True) ; - if( DefaultAtom ) { - status = XGetRGBColormaps(_CDISPLAY,_CROOT, - &pinfo,&nmap,DefaultAtom); - } else status = False ; - - if( status ) { - XColor color1,color2 ; - for( i=0 ; i 0) && - (pinfo[i].green_max > 0) && - (pinfo[i].blue_max > 0) ) cinfo = &pinfo[i]; - else - if( (pinfo[i].red_max > 0) && - (pinfo[i].green_max == 0) && - (pinfo[i].blue_max == 0) ) cginfo = &pinfo[i]; - } - } - - if( cinfo && cginfo ) { - nccolor = (cinfo->red_max+1)* - (cinfo->green_max+1)* - (cinfo->blue_max+1) ; - ngcolor = cginfo->red_max+1; - ncolor = nccolor + ngcolor; - size = (int)(pow((double)pcolormap->maxucolor,(double)1./3.)); - if( (ncolor <= pcolormap->maxhcolor) && - (ncolor >= size*size*size) ) { - Colormap colormap = _CINFO.colormap; - unsigned long base_pixel = _CINFO.base_pixel; - color1.pixel = cinfo->base_pixel ; - XQueryColor(_CDISPLAY,cinfo->colormap,&color1) ; - color2.pixel = cinfo->base_pixel + nccolor - 1 ; - XQueryColor(_CDISPLAY,cinfo->colormap,&color2) ; - if( !color1.red && !color1.green && !color1.blue && - color2.red > 0xFE00 && - color2.green > 0xFE00 && - color2.blue > 0xFE00 ) { - _CINFO.colormap = cinfo->colormap; - _CINFO.red_max = cinfo->red_max; - _CINFO.red_mult = cinfo->red_mult; - _CINFO.green_max = cinfo->green_max; - _CINFO.green_mult = cinfo->green_mult; - _CINFO.blue_max = cinfo->blue_max; - _CINFO.blue_mult = cinfo->blue_mult; - _CINFO.base_pixel = cinfo->base_pixel; - _CINFO.visualid = cinfo->visualid; - _CINFO.killid = cinfo->killid ; - cstatus = True; - } - - if( cstatus && (ngcolor > 0) && - (cinfo->colormap == cginfo->colormap) && - (cginfo->base_pixel == (cinfo->base_pixel + nccolor)) ) { - color1.pixel = cginfo->base_pixel ; - XQueryColor(_CDISPLAY,cginfo->colormap,&color1) ; - color2.pixel = cginfo->base_pixel + ngcolor - 1 ; - XQueryColor(_CDISPLAY,cginfo->colormap,&color2) ; - if( !color1.red && !color1.green && !color1.blue && - color2.red > 0xFE00 && - color2.green > 0xFE00 && - color2.blue > 0xFE00 ) { - _CGINFO.colormap = cginfo->colormap; - _CGINFO.red_max = cginfo->red_max; - _CGINFO.red_mult = cginfo->red_mult; - _CGINFO.green_max = cginfo->green_max; - _CGINFO.green_mult = cginfo->green_mult; - _CGINFO.blue_max = cginfo->blue_max; - _CGINFO.blue_mult = cginfo->blue_mult; - _CGINFO.base_pixel = cginfo->base_pixel; - _CGINFO.visualid = cginfo->visualid; - _CGINFO.killid = cginfo->killid ; - gstatus = True ; - /* FREE out of range colors */ - if( colormap != cinfo->colormap ) { - if( colormap && (colormap != _CCOLORMAP) ) { - XFreeColormap(_CDISPLAY,colormap) ; - } - } else { - unsigned long lpixel = cginfo->base_pixel+ngcolor-1; - for( i=0 ; imaxucolor ; i++ ) { - pixel = base_pixel + i; - if( (pixel < cinfo->base_pixel) || - (pixel > lpixel) ) { - XFreeColors(_CDISPLAY,colormap,&pixel,1,0); - } - } - XFlush(_CDISPLAY); - } - } - } - } - } - } - } - if( !cstatus ) { /* Allocate READ-ONLY color-cube */ -// Atom RgbDefaultAtom = 0 ; - size = (int)(pow((double)MaxColorCube,(double)1./3.)+0.1); - - if( pcolormap->maxucolor > 0 ) { - XFreeColors(_CDISPLAY,_CINFO.colormap, - pcolormap->pixels,pcolormap->maxucolor,0); - pcolormap->maxucolor = 0; - } - _CINFO.visualid = _CVISUAL->visualid ; - _CINFO.killid = getpid(); - for( ; size>0 ; --size ) { - _CINFO.base_pixel = 0; - _CINFO.red_max = size-1; - _CINFO.green_max = size-1; - _CINFO.blue_max = size-1; - _CINFO.red_mult = 1; - _CINFO.green_mult = size; - _CINFO.blue_mult = size*size; - if( XmuCreateColormap(_CDISPLAY,&_CINFO) ) break; - } - nccolor = size*size*size ; - } - - if( !gstatus ) { /* Allocate READ-ONLY gray-ramp */ -// Atom GrayDefaultAtom = 0 ; - if( pcolormap->maxucolor > 0 ) { - XFreeColors(_CDISPLAY,_CINFO.colormap, - pcolormap->pixels,pcolormap->maxucolor,0); - pcolormap->maxucolor = 0; - } - ngcolor = MaxGray ; - _CGINFO.colormap = _CINFO.colormap; - _CGINFO.visualid = _CVISUAL->visualid ; - _CGINFO.killid = getpid(); - size = ngcolor; - for( ; size>0 ; size -= 2 ) { - _CGINFO.base_pixel = 0; - _CGINFO.red_max = size-1; - _CGINFO.green_max = 0; - _CGINFO.blue_max = 0; - _CGINFO.red_mult = 1; - _CGINFO.green_mult = 1; - _CGINFO.blue_mult = 1; - if( XmuCreateColormap(_CDISPLAY,&_CGINFO) ) break; - } - ngcolor = size ; - } - XInstallColormap(_CDISPLAY,_CINFO.colormap); - ncolor = nccolor + ngcolor; - pcolormap->maxucolor = ncolor; - pcolormap->maxcolor = ncolor; - for( i=0 ; idefine[i] = SYSTEMCOLOR ; - pcolormap->pixels[i] = _CINFO.base_pixel + i; - } - if( !cstatus || !gstatus ) { - if( !pinfo ) { - nmap = 2; - pinfo = (XStandardColormap*) - malloc(2*sizeof(XStandardColormap)); - cinfo = &pinfo[0]; - cginfo = &pinfo[1]; - } else if( !cinfo || !cginfo ) { - if( !cinfo ) nmap++; - if( !cginfo ) nmap++; - pinfo = (XStandardColormap*) realloc((char*)pinfo, - nmap*sizeof(XStandardColormap)); - i = nmap-1; - if( !cginfo ) { - cginfo = &pinfo[i]; --i; - } - if( !cinfo ) { - cinfo = &pinfo[i]; --i; - } - } - cinfo->colormap = _CINFO.colormap; - cinfo->visualid = _CINFO.visualid; - cinfo->killid = getpid(); - cinfo->base_pixel = _CINFO.base_pixel; - cinfo->red_max = _CINFO.red_max; - cinfo->green_max = _CINFO.green_max; - cinfo->blue_max = _CINFO.blue_max; - cinfo->red_mult = _CINFO.red_mult; - cinfo->green_mult = _CINFO.green_mult; - cinfo->blue_mult = _CINFO.blue_mult; - - cginfo->colormap = _CGINFO.colormap; - cginfo->visualid = _CGINFO.visualid; - cginfo->killid = getpid(); - cginfo->base_pixel = _CGINFO.base_pixel; - cginfo->red_max = _CGINFO.red_max; - cginfo->green_max = _CGINFO.green_max; - cginfo->blue_max = _CGINFO.blue_max; - cginfo->red_mult = _CGINFO.red_mult; - cginfo->green_mult = _CGINFO.green_mult; - cginfo->blue_mult = _CGINFO.blue_mult; - - switch (SetColorCube) { - case 'N' : - break ; - case 'Y' : - if( !DefaultAtom ) - DefaultAtom = XInternAtom(_CDISPLAY, - XW_RGB_BEST_MAP,False) ; - XSetRGBColormaps(_CDISPLAY,_CROOT, - pinfo,nmap,DefaultAtom) ; - break ; - case 'T' : - if( !DefaultAtom ) - DefaultAtom = XInternAtom(_CDISPLAY, - XW_RGB_BEST_MAP,False) ; - XSetRGBColormaps(_CDISPLAY,_CROOT, - pinfo,nmap,DefaultAtom) ; - XSetCloseDownMode(_CDISPLAY,RetainTemporary) ; - break ; - case 'P' : - if( !DefaultAtom ) - DefaultAtom = XInternAtom(_CDISPLAY, - XW_RGB_BEST_MAP,False) ; - XSetRGBColormaps(_CDISPLAY,_CROOT, - pinfo,nmap,DefaultAtom) ; - XSetCloseDownMode(_CDISPLAY,RetainPermanent) ; - if( Xw_get_trace() ) printf( - " Xw_SET_PERMANENT_COLOR_CUBE(%ld,%ld,%ld,%ld),(%ld,%ld,%ld,%ld)\n", - _CINFO.base_pixel,_CINFO.red_max, - _CINFO.green_max,_CINFO.blue_max, - _CGINFO.base_pixel,_CGINFO.red_max, - _CGINFO.green_max,_CGINFO.blue_max) ; - } - } - } - if( pinfo ) XFree(pinfo); - pcolormap->highpixel = pcolormap->pixels[pcolormap->maxcolor-1] ; - } - } - - pcolormap->mapping = mode ; - - XFlush(_CDISPLAY) ; - - return (XW_SUCCESS) ; -} - -//! Return the visual Information matching with the specified class -//! or NULL if class is not founded on this Display. -XVisualInfo* Xw_get_visual_info (XW_EXT_DISPLAY* pdisplay, - Xw_TypeOfVisual pclass) -{ - Xw_TypeOfVisual class1 = pclass; - Xw_TypeOfVisual class2 = Xw_TOV_DEFAULT; - XVisualInfo* vinfo = NULL; - XVisualInfo* ginfo = NULL; - XVisualInfo info1, info2; - int i, ninfo; - long mask1 = 0,mask2 = 0; - unsigned long backpixel; - - switch (class1) { - case Xw_TOV_DEFAULT : - class1 = (Xw_TypeOfVisual) _DCLASS ; - break ; - case Xw_TOV_PSEUDOCOLOR : - class1 = Xw_TOV_PSEUDOCOLOR ; - mask1 |= VisualColormapSizeMask; - info1.colormap_size = 256; - break ; - case Xw_TOV_PREFERRED_PSEUDOCOLOR : - if( MaxCmapsOfScreen(_DSCREEN) > 1 ) { - class1 = Xw_TOV_PSEUDOCOLOR ; - mask1 |= VisualColormapSizeMask; - info1.colormap_size = 256; - class2 = Xw_TOV_TRUECOLOR ; - } else { - class1 = (Xw_TypeOfVisual) _DCLASS ; - } - break ; - case Xw_TOV_TRUECOLOR : - class1 = Xw_TOV_TRUECOLOR ; - break ; - case Xw_TOV_OVERLAY : - ginfo = Xw_get_overlay_visual_info(pdisplay, - Xw_TOV_PSEUDOCOLOR,&backpixel); - return ginfo; - case Xw_TOV_PREFERRED_TRUECOLOR : - class1 = Xw_TOV_TRUECOLOR ; - class2 = Xw_TOV_PSEUDOCOLOR ; - mask2 |= VisualColormapSizeMask; - info2.colormap_size = 256; - break; - case Xw_TOV_PREFERRED_OVERLAY : - class1 = Xw_TOV_PSEUDOCOLOR ; - mask1 |= VisualColormapSizeMask; - info1.colormap_size = 256; - ginfo = Xw_get_overlay_visual_info(pdisplay, - Xw_TOV_PSEUDOCOLOR,&backpixel); - if( ginfo ) return ginfo; - break ; - default: - break ; - } - - if (ginfo == NULL) - { - info1.c_class = class1; - info1.screen = DefaultScreen(_DDISPLAY); - mask1 |= VisualClassMask | VisualScreenMask ; - vinfo = XGetVisualInfo(_DDISPLAY,mask1,&info1,&ninfo) ; - - if (ninfo > 0) - { - ginfo = vinfo; - for (i = 1; i < ninfo; i++) - { - if ((vinfo[i].depth > ginfo->depth && !(vinfo[i].depth == 32 && ginfo->depth == 24)) - || (vinfo[i].depth == 24 && ginfo->depth == 32) // prefer 24-bit depth over 32-bit - we do not need blend window content with desktop (see CR23792) - || (vinfo[i].visualid == _DVISUAL->visualid)) - { - ginfo = &vinfo[i]; - } - } - if ((ginfo->depth < TrueColorMinDepth) - && (class1 == Xw_TOV_TRUECOLOR)) - { - XFree ((char* )vinfo); - ginfo = vinfo = NULL; - } - } - - if (ginfo == NULL && (class2 != Xw_TOV_DEFAULT)) - { - info2.c_class = class2; - - info2.screen = DefaultScreen(_DDISPLAY); - mask2 |= VisualClassMask | VisualScreenMask; - vinfo = XGetVisualInfo(_DDISPLAY,mask2,&info2,&ninfo); - if (ninfo > 0) - { - ginfo = vinfo ; - for (i = 1; i < ninfo; i++) - { - if ((vinfo[i].depth > ginfo->depth && !(vinfo[i].depth == 32 && ginfo->depth == 24)) - || (vinfo[i].depth == 24 && ginfo->depth == 32)) // prefer 24-bit depth over 32-bit) - { - ginfo = &vinfo[i]; - } - } - if ((ginfo->depth < TrueColorMinDepth) - && (class2 == Xw_TOV_TRUECOLOR)) - { - XFree((char*)vinfo); - ginfo = vinfo = NULL; - } - } - } - } - - if( ginfo ) { - info1.visualid = ginfo->visualid ; - info1.screen = ginfo->screen ; - mask1 = VisualIDMask | VisualScreenMask ; - - ginfo = XGetVisualInfo(_DDISPLAY,mask1,&info1,&ninfo) ; - } else { - /*ERROR*Unmatchable Visual class*/ - Xw_set_error(67,"Xw_get_visual_info",&pclass) ; - } - - if( vinfo ) XFree((char*)vinfo) ; - return (ginfo) ; -} - -//! Return the Overlay visual Information matching with the specified class -//! or NULL if the overlay class is not founded on this Display. -XVisualInfo* Xw_get_overlay_visual_info(XW_EXT_DISPLAY* pdisplay,Xw_TypeOfVisual /*pclass*/,unsigned long *backpixel) -{ -XVisualInfo *vinfo = NULL,*ginfo = NULL,tinfo ; -int ninfo; -Atom oatom = XInternAtom(_DDISPLAY, "SERVER_OVERLAY_VISUALS", True); - - *backpixel = 0; - if( oatom ) { - unsigned long nitem,left; - int aformat; - Status status; - union { - unsigned char *string; - XOverlayVisualInfo *oinfo; - } prop; - Atom aatom; - status = XGetWindowProperty(_DDISPLAY, _DROOT, - oatom, 0, 100, False, - AnyPropertyType, &aatom, &aformat, - &nitem, &left, &prop.string); - nitem /= 4; - if( (status == Success) && (aformat == 32) && (nitem > 0) ) { - int i,depth = OverlayColorMinDepth,layer = 1; - for( i=0 ; (unsigned int ) i < nitem ; i++ ) { - if( prop.oinfo[i].layer < layer || - prop.oinfo[i].transparent_type == 0 ) continue; - tinfo.visualid = prop.oinfo[i].overlay_visual; - vinfo = XGetVisualInfo(_DDISPLAY,VisualIDMask,&tinfo,&ninfo); - if( vinfo && (vinfo->depth >= depth) ) { - *backpixel = prop.oinfo[i].value; - layer = prop.oinfo[i].layer; - depth = vinfo->depth; - ginfo = vinfo; - } else if( vinfo ) { - XFree(vinfo) ; vinfo = NULL; - } - } - } - - if( prop.string && (status == Success) ) Xw_free(prop.string); - - } else if( (pdisplay->server == XW_SERVER_IS_SUN) && EnableSunOverlay ) { - int mOptCode,fEvent,fError; - if( XQueryExtension(_DDISPLAY,"SUN_OVL",&mOptCode,&fEvent,&fError) ) { - tinfo.visualid = 0x2a; /* Overlay visual for SUN/ULTRA */ - vinfo = XGetVisualInfo(_DDISPLAY,VisualIDMask,&tinfo,&ninfo); - if( vinfo && (vinfo->colormap_size == 224) ) { - ginfo = vinfo; - *backpixel = 225; - } else if( vinfo ) { - XFree(vinfo) ; vinfo = NULL; - } - } - } - - if( ginfo && MaxCmapsOfScreen(_DSCREEN) < 2 && - ginfo->visualid != _DVISUAL->visualid && - ginfo->c_class == _DCLASS ) - { - XFree(ginfo); ginfo = NULL; - } - return ginfo; -} diff --git a/src/Xw/Xw_def_font.cxx b/src/Xw/Xw_def_font.cxx deleted file mode 100755 index 4d907b188d..0000000000 --- a/src/Xw/Xw_def_font.cxx +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define PRO5676 /*GG_231296 -// Calculer la hauteur exacte de la police de caracteres -// par rapport a la partie du texte situee au dessus de la -// ligne de base. -*/ - -#define TEST - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_FONT -#endif - -#define MAXNAMES 32 - -/* - STATUS Xw_def_font (afontmap,index,size,fontname): - XW_EXT_FONTMAP *afontmap - int index Font index - float size Font size in MM - char fontname[] Font description - - Update Text Font Extended fontmap index with the specified - FONT size and description - NOTE than font index 0 is the default font and cann't be REDEFINED . - NOTE than fontname can be defined in three forms : - 1) Simple form is "fmly" Ex: "helvetica" - 2) More complex form is "fmly-wght" Ex: "helvetica-bold" - 3) Full form is "-fndry-fmly-wght-slant-swdth-adstyl-pxlsz - -ptSz-resx-resy-spc-avgWdth-rgstry-encdn" - where each field must be replaced by an "*" - See Xlib User Guide for more information or /usr/bin/X11/xfontsel" - utility . - - Returns ERROR if BadFont Index or name - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_def_font (void* afontmap, - int index,float size,char* fontname) -#else -XW_STATUS Xw_def_font (afontmap,index,size,fontname) -void *afontmap; -int index ; -float size ; -char *fontname ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_FONTMAP *pfontmap = (XW_EXT_FONTMAP*)afontmap ; -Screen *screen ; -int i,j,n,prefered_size,count,psize,qsize,retry = True; -char **fontlist,*prefered_name ; -XFontStruct *tmpfont,*selected_font,*prefered_font ; -//char **fontdir ; -float rsize = fabs(size); - - if ( !Xw_isdefine_fontindex(pfontmap,index) ) { - /*ERROR*Bad Font Index*/ - Xw_set_error(7,"Xw_def_font",&index) ; - return (XW_ERROR) ; - } - - if( !fontname || !strlen(fontname) ) { - /*ERROR*Bad Font Name*/ - Xw_set_error(8,"Xw_def_font",fontname) ; - return (XW_ERROR) ; - } - - screen = ScreenOfDisplay(_FDISPLAY,DefaultScreen(_FDISPLAY)) ; - - fontlist = XListFonts(_FDISPLAY,fontname,MAXNAMES,&count) ; -RETRY: - prefered_size = - (unsigned int) (rsize*(float)WidthOfScreen(screen)/ - (float)WidthMMOfScreen(screen)) ; - prefered_font = NULL; - prefered_name = NULL; - if( count ) { - char *psub,*pfont,scalable_font[128]; - qsize = 0; - for( i=0 ; imax_bounds.ascent + - selected_font->max_bounds.descent ; - - if( !prefered_font || - (abs(psize - prefered_size) < abs(qsize - prefered_size)) ) { - tmpfont = prefered_font ; - prefered_font = selected_font ; - selected_font = tmpfont ; - qsize = psize; -#ifdef TEST - prefered_name = pfont ; -#else - prefered_name = fontlist[i] ; -#endif - } - if( selected_font && (prefered_font != selected_font) ) { - for( j=1,n=0 ; jmaxfont ; j++ ) { - if( pfontmap->fonts[j] && (selected_font->fid == - pfontmap->fonts[j]->fid) ) n++ ; - } - if( !n ) { - XFreeFont(_FDISPLAY,selected_font); - } - } - } - } - - if( pfontmap->gnames[index] ) Xw_free(pfontmap->gnames[index]) ; - if( pfontmap->snames[index] ) Xw_free(pfontmap->snames[index]) ; - pfontmap->gnames[index] = (char*) Xw_malloc(strlen(fontname)+1) ; - strcpy(pfontmap->gnames[index],fontname) ; - if( strstr(fontname,"Defaultfont") ) { - pfontmap->snames[index] = - (char*) Xw_malloc(strlen(pfontmap->snames[0])+1) ; - strcpy(pfontmap->snames[index],pfontmap->snames[0]) ; - pfontmap->fonts[index] = pfontmap->fonts[0] ; - } else if( prefered_font && prefered_name ) { - pfontmap->snames[index] = - (char*) Xw_malloc(strlen(prefered_name)+1) ; - strcpy(pfontmap->snames[index],prefered_name) ; - pfontmap->fonts[index] = prefered_font ; - } else { - pfontmap->snames[index] = - (char*) Xw_malloc(strlen(pfontmap->snames[0])+1) ; - strcpy(pfontmap->snames[index],pfontmap->snames[0]) ; - pfontmap->fonts[index] = pfontmap->fonts[0] ; - /*ERROR*Bad Font Name*/ - Xw_set_error(8,"Xw_def_font",fontname) ; - return (XW_ERROR) ; - } - -#ifdef PRO5676 - if( size < 0. && retry ) { - float ratio,tsize; - psize = (pfontmap->fonts[index])->max_bounds.ascent; - tsize = (float)psize*HeightMMOfScreen(screen)/ - (float)HeightOfScreen(screen) ; - ratio = rsize/tsize; - rsize *= ratio; - retry = False; - if( fabs(ratio - 1.) > 0.001 ) goto RETRY; - } -#endif - psize = (pfontmap->fonts[index])->max_bounds.ascent + - (pfontmap->fonts[index])->max_bounds.descent ; - rsize = (float)psize*HeightMMOfScreen(screen)/ - (float)HeightOfScreen(screen) ; - - pfontmap->gsizes[index] = size ; - pfontmap->fsizes[index] = rsize ; - pfontmap->fratios[index] = - (float)(pfontmap->fonts[index])->max_bounds.descent/ - (pfontmap->fonts[index])->max_bounds.ascent; - pfontmap->ssizey[index] = - pfontmap->ssizex[index] = pfontmap->ssizey[index] = rsize; - pfontmap->gslants[index] = pfontmap->sslants[index] = 0. ; - - if( fontlist ) XFreeFontNames(fontlist) ; - -#ifdef TRACE_DEF_FONT -if( Xw_get_trace() ) { - printf (" Xw_def_font(%lx,%d,%f,'%s')\n",(long ) pfontmap,index,size,fontname) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_def_fontmap.cxx b/src/Xw/Xw_def_fontmap.cxx deleted file mode 100755 index 60493f5db5..0000000000 --- a/src/Xw/Xw_def_fontmap.cxx +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_FONTMAP -#endif - -/* - XW_EXT_FONTMAP* Xw_def_fontmap(adisplay,nfont): - XW_EXT_DISPLAY *adisplay Extended Display structure - - int nfont Number of font cells to be allocated - - Create a fontmap extension - allocate the font cells in the fontmap as if possible - depending of the MAXFONT define . - - Returns Fontmap extension address if successuful - or NULL if ERROR - - STATUS = Xw_close_fontmap(afontmap) - XW_EXT_FONTMAP* afontmap Extended fontmap - - - Destroy The Extended TypeMap - - Returns ERROR if Bad Extended TypeMap Address - SUCCESS if successfull - -*/ - -#ifdef XW_PROTOTYPE -void* Xw_def_fontmap (void* adisplay,int nfont) -#else -void* Xw_def_fontmap (adisplay,nfont) -void *adisplay ; -int nfont ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; -XW_EXT_FONTMAP *pfontmap = NULL ; -XFontStruct *dfstruct ; -XGCValues values ; -GC gc ; -//int i,font,psize ; -int i,psize ; -char *dfstring = NULL ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_def_fontmap",pdisplay) ; - return (NULL) ; - } - - gc = DefaultGCOfScreen(_DSCREEN) ; - XGetGCValues(_DDISPLAY,gc,GCFont,&values) ; - dfstruct = XQueryFont(_DDISPLAY,XGContextFromGC(gc)) ; - for( i=0 ; in_properties ; i++ ) { - if( dfstruct->properties[i].name == XA_FONT ) { - dfstring = XGetAtomName(_DDISPLAY,dfstruct->properties[i].card32) ; - break ; - } - } - - - if( !(pfontmap = Xw_add_fontmap_structure(sizeof(XW_EXT_FONTMAP))) ) - return (NULL) ; - - if( nfont <= 0 ) nfont = MAXFONT ; - - - pfontmap->connexion = pdisplay ; - pfontmap->maxfont = min(nfont,MAXFONT) ; - pfontmap->gnames[0] = (char*) "Defaultfont"; - pfontmap->snames[0] = dfstring ; - pfontmap->fonts[0] = dfstruct ; - pfontmap->fonts[0]->fid = values.font ; - - psize = (pfontmap->fonts[0])->max_bounds.ascent + - (pfontmap->fonts[0])->max_bounds.descent ; - - pfontmap->gsizes[0] = (float)psize*HeightMMOfScreen(_DSCREEN)/ - (float)HeightOfScreen(_DSCREEN) ; - pfontmap->fsizes[0] = pfontmap->gsizes[0]; - pfontmap->fratios[0] = 0.; - pfontmap->ssizex[0] = pfontmap->ssizey[0] = pfontmap->fsizes[0] ; - pfontmap->gslants[0] = pfontmap->sslants[0] = 0. ; - -#ifdef TRACE_DEF_FONTMAP -if( Xw_get_trace() ) { - printf(" %lx = Xw_def_fontmap(%lx,%d)\n", (long ) pfontmap,(long ) adisplay,nfont) ; -} -#endif - - return (pfontmap); -} - -static XW_EXT_FONTMAP *PfontmapList =NULL ; - -#ifdef XW_PROTOTYPE -XW_EXT_FONTMAP* Xw_add_fontmap_structure(int size) -#else -XW_EXT_FONTMAP* Xw_add_fontmap_structure(size) -int size ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert one Extended fontmap structure in the - EXtended fontmap List - - returns Extended fontmap address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_FONTMAP *pfontmap = (XW_EXT_FONTMAP*) Xw_malloc(size) ; -int i ; - - if( pfontmap ) { - pfontmap->type = FONTMAP_TYPE ; - pfontmap->link = PfontmapList ; - PfontmapList = pfontmap ; - pfontmap->connexion = NULL ; - pfontmap->maxfont = 0 ; - pfontmap->maxwindow = 0 ; - for( i=0 ; ignames[i] = NULL ; - pfontmap->snames[i] = NULL ; - pfontmap->fonts[i] = NULL ; - pfontmap->gsizes[i] = 0. ; - pfontmap->fsizes[i] = 0. ; - pfontmap->ssizex[i] = 0. ; - pfontmap->ssizey[i] = 0. ; - pfontmap->gslants[i] = 0. ; - pfontmap->sslants[i] = 0. ; - pfontmap->fratios[i] = 0. ; - } - } else { - /*EXT_FONTMAP allocation failed*/ - Xw_set_error(9,"Xw_add_fontmap_structure",NULL) ; - } - - return (pfontmap) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_fontmap(void* afontmap) -#else -XW_STATUS Xw_close_fontmap(afontmap) -void* afontmap ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_FONTMAP* pfontmap = (XW_EXT_FONTMAP*) afontmap ; -XW_STATUS status ; - - if( !Xw_isdefine_fontmap(pfontmap) ) { - /*Bad EXT_FONTMAP Address*/ - Xw_set_error(51,"Xw_close_fontmap",pfontmap) ; - return (XW_ERROR) ; - } - - status = Xw_del_fontmap_structure(pfontmap) ; - -#ifdef TRACE_DEF_FONTMAP -if( Xw_get_trace() ) { - printf(" %d = Xw_close_fontmap(%lx)\n",status,(long ) pfontmap) ; -} -#endif - - return (status) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_fontmap_structure(XW_EXT_FONTMAP* afontmap) -#else -XW_STATUS Xw_del_fontmap_structure(afontmap) -XW_EXT_FONTMAP *afontmap; -#endif /*XW_PROTOTYPE*/ -/* - Remove the Extended fontmap address from the Extended List - - returns ERROR if the fontmap address is not Found in the list - returns SUCCESS if successful -*/ -{ -XW_EXT_FONTMAP *pfontmap = PfontmapList ; -int i ; - - if( !afontmap ) return (XW_ERROR) ; - - if( afontmap->maxwindow ) { - return (XW_ERROR) ; - } else { - for( i=1 ; ifonts[i] ) { - if( afontmap->gnames[i] ) Xw_free(afontmap->gnames[i]) ; - if( afontmap->snames[i] ) Xw_free(afontmap->snames[i]) ; - if( afontmap->fonts[i]->fid != afontmap->fonts[0]->fid ) - XFreeFont(_FDISPLAY,afontmap->fonts[i]) ; - } - } - - if( afontmap == pfontmap ) { - PfontmapList = (XW_EXT_FONTMAP*) afontmap->link ; - } else { - for( ; pfontmap ; pfontmap = (XW_EXT_FONTMAP*) pfontmap->link ) { - if( pfontmap->link == afontmap ) { - pfontmap->link = afontmap->link ; - break ; - } - } - } - Xw_free(afontmap) ; - } - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_def_highlight_color.cxx b/src/Xw/Xw_def_highlight_color.cxx deleted file mode 100755 index bf1cfdaaba..0000000000 --- a/src/Xw/Xw_def_highlight_color.cxx +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_HIGHLIGHT_COLOR -#endif - -/* - STATUS Xw_def_highlight_color(acolormap,r,g,b): - XW_EXT_COLORMAP *acolormap - float r,g,b ; Red,Green,Blue color value 0. >= x <= 1. - - Update Highlight Color index with the specified R,G,B values . - NOTE than highlight color is shared between all Windows - - Returns ERROR if Extended Colormap is not properly defined - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_def_highlight_color (void* acolormap, - float r,float g,float b) -#else -XW_STATUS Xw_def_highlight_color (acolormap,r,g,b) -void *acolormap; -float r,g,b ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XColor color ; -int i,cclass,index = -1,isapproximate ; -XW_STATUS status = XW_SUCCESS; -unsigned long highpixel; - - if ( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_def_highlight_color",pcolormap) ; - return (XW_ERROR) ; - } - - if( pcolormap->mapping == Xw_TOM_READONLY ) { - cclass = StaticColor; - } else { - cclass = _CCLASS; - } - - switch ( cclass ) { - - case TrueColor : - Xw_get_color_pixel(pcolormap,r,g,b,&highpixel,&isapproximate) ; - break ; - - case PseudoColor : - if( pcolormap->mapping == Xw_TOM_COLORCUBE ) { - if( (_CGINFO.red_mult > 0) && (fabs(r-g) < 0.01) && (fabs(r-b) < 0.01) ) { - index = (int)(0.5+r*_CGINFO.red_max)*_CGINFO.red_mult; - if( _CINFO.red_max > 0 ) - index += (_CINFO.red_max+1)*(_CINFO.green_max+1)*(_CINFO.blue_max+1); - } else if( _CINFO.red_mult > 0 ) { - index = ((int)(0.5+r*_CINFO.red_max))*_CINFO.red_mult+ - ((int)(0.5+g*_CINFO.green_max))*_CINFO.green_mult+ - ((int)(0.5+b*_CINFO.blue_max))*_CINFO.blue_mult; - } else if( _CGINFO.red_mult > 0 ) { - float l = (r+g+b)/3.; - index = (int)(0.5+l*_CGINFO.red_max)*_CGINFO.red_mult; - } else { - index = 0; - } - highpixel = _CINFO.base_pixel + index ; - } else if( pcolormap->mapping == Xw_TOM_BESTRAMP ) { - color.red = (unsigned short) (r * 0xFFFF) ; - color.green = (unsigned short) (g * 0xFFFF) ; - color.blue = (unsigned short) (b * 0xFFFF) ; - color.flags = DoRed|DoGreen|DoBlue ; - for( i=0 ; imaxcolor ; i++ ) { - if( (pcolormap->pixels[i] & 1) && - ((pcolormap->define[i] == FREECOLOR) || - (pcolormap->define[i] == HIGHCOLOR)) ) { - pcolormap->define[i] = HIGHCOLOR ; - color.pixel = pcolormap->pixels[i] ; - XStoreColor(_CDISPLAY,_CINFO.colormap,&color) ; - } - } - highpixel = pcolormap->pixels[1]; - } else if( pcolormap->mapping == Xw_TOM_SIMPLERAMP ) { - Xw_get_color_index(pcolormap,r,g,b,&index) ; - highpixel = _CINFO.base_pixel + index ; - } - break ; - - case StaticColor : - status = Xw_alloc_color(pcolormap,r,g,b,&highpixel,&isapproximate) ; - break ; - } - - if( status ) { - if( index >= 0 ) { - pcolormap->define[index] = HIGHCOLOR ; - } - pcolormap->highpixel = highpixel ; -#ifdef BUG_PRO3709 - Xw_reset_attrib(NULL) ; -#endif - } - -#ifdef TRACE_DEF_HIGHLIGHT_COLOR -if( Xw_get_trace() ) { - printf(" %d = Xw_def_highlight_color(%lx,%f,%f,%f)\n",status,(long ) pcolormap,r,g,b) ; -} -#endif - return (status); -} diff --git a/src/Xw/Xw_def_marker.cxx b/src/Xw/Xw_def_marker.cxx deleted file mode 100755 index c4e189936d..0000000000 --- a/src/Xw/Xw_def_marker.cxx +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_MARKER -#endif - -/* - STATUS Xw_def_marker (amarkmap,index,npoint,spoint,xpoint,ypoint): - XW_EXT_MARKMAP *amarkmap - int index Marker index 0 > x < MAXMARKER - int npoint Marker length - int *spoint Marker status point (move-draw boolean) - float *xpoint Marker X coords in space -1,+1 - float *ypoint Marker Y coords in space -1,+1 - - Update Marker Extended markmap index with the specified line marker - descriptor . - Marker point must be defined in the float space -1,+1 - - NOTE that marker index 0 is the default marker (.) - and cann't be REDEFINED . - NOTE that the marker size in Meter is decide at the draw_marker time. - - Returns ERROR if BadMarker Index or Bad marker coords - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_def_marker (void* amarkmap, - int index,int npoint,int* spoint,float *xpoint,float *ypoint) -#else -XW_STATUS Xw_def_marker (amarkmap,index,npoint,spoint,xpoint,ypoint) -void *amarkmap; -int index,npoint,*spoint; -float *xpoint,*ypoint; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_MARKMAP *pmarkmap = (XW_EXT_MARKMAP*) amarkmap ; -int i ; - - if ( !Xw_isdefine_markerindex(pmarkmap,index) ) { - /*Bad Marker Index*/ - Xw_set_error(10,"Xw_def_marker",&index) ; - return (XW_ERROR) ; - } - - if( pmarkmap->npoint[index] ) { - pmarkmap->npoint[index] = 0; - Xw_free(pmarkmap->spoint[index]); - pmarkmap->spoint[index] = NULL; - Xw_free(pmarkmap->xpoint[index]); - pmarkmap->xpoint[index] = NULL; - Xw_free(pmarkmap->ypoint[index]); - pmarkmap->ypoint[index] = NULL; - } - - if( npoint > 0 ) { - int *s = pmarkmap->spoint[index] = - (int*) Xw_malloc(npoint*sizeof(int)); - float *x = pmarkmap->xpoint[index] = - (float*) Xw_malloc(npoint*sizeof(float)); - float *y = pmarkmap->ypoint[index] = - (float*) Xw_malloc(npoint*sizeof(float)); - if( s && x && y ) { - pmarkmap->npoint[index] = npoint; - for( i=0 ; i 1 ) { - for( i=0 ; i - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_MARKMAP -#endif - -/* - XW_EXT_MARKMAP* Xw_def_markmap(adisplay,nmark): - XW_EXT_DISPLAY *adisplay Extended Display structure - - int nmark Number of marker cells to be allocated - - Create a markmap extension - allocate the marker cells in the markmap as if possible - depending of the MAXMARKER define . - - Returns Markmap extension address if successuful - or NULL if ERROR - -*/ - -#ifdef XW_PROTOTYPE -void* Xw_def_markmap (void* adisplay,int nmark) -#else -void* Xw_def_markmap (adisplay,nmark) -void *adisplay ; -int nmark ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; -XW_EXT_MARKMAP *pmarkmap = NULL ; -//int i ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_def_markmap",pdisplay) ; - return (NULL) ; - } - - if( !(pmarkmap = Xw_add_markmap_structure(sizeof(XW_EXT_MARKMAP))) ) - return (NULL) ; - - if( nmark <= 0 ) nmark = MAXMARKER ; - - pmarkmap->connexion = pdisplay ; - pmarkmap->maxmarker = min(nmark,MAXMARKER) ; - -#ifdef TRACE_DEF_MARKMAP -if( Xw_get_trace() ) { - printf(" %lx = Xw_def_markmap(%lx,%d)\n", (long ) pmarkmap,(long ) adisplay,nmark) ; -} -#endif - - return (pmarkmap); -} - -static XW_EXT_MARKMAP *PmarkmapList =NULL ; - -#ifdef XW_PROTOTYPE -XW_EXT_MARKMAP* Xw_add_markmap_structure(int size) -#else -XW_EXT_MARKMAP* Xw_add_markmap_structure(size) -int size ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert one Extended markmap structure in the - EXtended markmap List - - returns Extended markmap address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_MARKMAP *pmarkmap = (XW_EXT_MARKMAP*) Xw_malloc(size) ; -int i ; - - if( pmarkmap ) { - pmarkmap->type = MARKMAP_TYPE ; - pmarkmap->link = PmarkmapList ; - PmarkmapList = pmarkmap ; - pmarkmap->connexion = NULL ; - pmarkmap->maxmarker = 0 ; - pmarkmap->maxwindow = 0 ; - for( i=0 ; imarks[i] = 0 ; - pmarkmap->npoint[i] = 0 ; - pmarkmap->width[i] = 0 ; - pmarkmap->height[i] = 0 ; - } - } else { - /*EXT_MARKMAP Allocation failed*/ - Xw_set_error(12,"Xw_add_markmap_structure",0) ; - } - - return (pmarkmap) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_markmap(void* amarkmap) -#else -XW_STATUS Xw_close_markmap(amarkmap) -void* amarkmap ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_MARKMAP *pmarkmap = (XW_EXT_MARKMAP*) amarkmap ; -XW_STATUS status ; - - if( !Xw_isdefine_markmap(pmarkmap) ) { - /*Bad EXT_MARKMAP Address*/ - Xw_set_error(46,"Xw_close_markmap",pmarkmap) ; - return (XW_ERROR) ; - } - - status = Xw_del_markmap_structure(pmarkmap) ; - -#ifdef TRACE_DEF_MARKMAP -if( Xw_get_trace() ) { - printf(" %d = Xw_close_markmap(%lx)\n",status,(long ) pmarkmap) ; -} -#endif - - return (status) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_markmap_structure(XW_EXT_MARKMAP* amarkmap) -#else -XW_STATUS Xw_del_markmap_structure(amarkmap) -XW_EXT_MARKMAP *amarkmap; -#endif /*XW_PROTOTYPE*/ -/* - Remove the Extended markmap address from the Extended List - - returns ERROR if the markmap address is not Found in the list - returns SUCCESS if successful -*/ -{ -XW_EXT_MARKMAP *pmarkmap = PmarkmapList ; -int i ; - - if( !amarkmap ) return (XW_ERROR) ; - - if( amarkmap->maxwindow ) { - return (XW_ERROR) ; - } else { - for( i=0 ; imarks[i] ) { - XFreePixmap(_MDISPLAY,amarkmap->marks[i]) ; -// amarkmap->marks[i] = NULL; - amarkmap->marks[i] = 0; - } - if( amarkmap->npoint[i] > 0 ) { - Xw_free(amarkmap->spoint[i]); - Xw_free(amarkmap->xpoint[i]); - Xw_free(amarkmap->ypoint[i]); - amarkmap->npoint[i] = 0; - } - } - - if( amarkmap == pmarkmap ) { - PmarkmapList = (XW_EXT_MARKMAP*) amarkmap->link ; - } else { - for( ; pmarkmap ; pmarkmap = (XW_EXT_MARKMAP*) pmarkmap->link ) { - if( pmarkmap->link == amarkmap ) { - pmarkmap->link = amarkmap->link ; - break ; - } - } - } - Xw_free(amarkmap) ; - } - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_def_tile.cxx b/src/Xw/Xw_def_tile.cxx deleted file mode 100755 index 065c25cde2..0000000000 --- a/src/Xw/Xw_def_tile.cxx +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_TILE -#endif - -/* - STATUS Xw_def_tile (atilemap,index,width,height,cdata): - XW_EXT_TILEMAP *atilemap - int index Tile index 0 >= x < MAXTILE - int width Width of tile in pixels - int height Height of tile in pixels - char *cdata Tile description - - Update Polygon tile Extended tilemap index with the specified - bitmap cdata . - Datas must be defined as one char by bit cdata with value 0 or 1 - so,cdata array must be defined as char cdata[width][height] - - NOTE than tile index 0 is the default Tile (SOLID) - and cann't be REDEFINED . - - Returns ERROR if BadTile Index or Bad tile datas - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_def_tile (void* atilemap, - int index,int width,int height,char* cdata) -#else -XW_STATUS Xw_def_tile (atilemap,index,width,height,cdata) -void *atilemap; -int index ; -int width,height ; -char *cdata ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_TILEMAP *ptilemap = (XW_EXT_TILEMAP*)atilemap ; -Window root ; -Screen *screen ; -unsigned char *pattern ; -int i,j,l,m,n ; - - if ( !Xw_isdefine_tileindex(ptilemap,index) ) { - /*Bad Tile Index*/ - Xw_set_error(13,"Xw_def_tile",&index) ; - return (XW_ERROR) ; - } - - if( width <= 0 || height <= 0 ) { - /*Bad Tile size*/ - Xw_set_error(14,"Xw_def_tile",&index) ; - return (XW_ERROR) ; - } - - if( !cdata ) { - /*Bad Tile data address*/ - Xw_set_error(15,"Xw_def_tile",&index) ; - return (XW_ERROR) ; - } - - if( ptilemap->tiles[index] ) - XFreePixmap(_PDISPLAY,ptilemap->tiles[index]) ; - ptilemap->tiles[index] = 0 ; - - screen = ScreenOfDisplay(_PDISPLAY,DefaultScreen(_PDISPLAY)) ; - root = RootWindowOfScreen(screen) ; - - pattern = (unsigned char*) Xw_malloc(width*height/8) ; - pattern[0] = 0x00 ; - for( i=n=0,l=8 ; itiles[index] = XCreateBitmapFromData(_PDISPLAY,root, - (char*)pattern,width,height) ; - Xw_free(pattern) ; - - if( !ptilemap->tiles[index] ) { - /*Tile Bitmap Allocation failed*/ - Xw_set_error(16,"Xw_def_tile",&index) ; - return (XW_ERROR) ; - } - -#ifdef TRACE_DEF_TILE -if( Xw_get_trace() ) { - printf (" Xw_def_tile(%lx,%d,%d,%d,%lx)\n",(long ) ptilemap,index,width,height,(long ) cdata); -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_def_tilemap.cxx b/src/Xw/Xw_def_tilemap.cxx deleted file mode 100755 index 7495334091..0000000000 --- a/src/Xw/Xw_def_tilemap.cxx +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_TILEMAP -#endif - -/* - XW_EXT_TILEMAP* Xw_def_tilemap(adisplay,ntile): - XW_EXT_DISPLAY *adisplay Extended Display structure - - int ntile Number of tile cells to be allocated - - Create a tilemap extension - allocate the tile cells in the tilemap as if possible - depending of the MAXTILE define . - - Returns Tilemap extension address if successuful - or NULL if ERROR - -*/ - -#ifdef XW_PROTOTYPE -void* Xw_def_tilemap (void* adisplay,int ntile) -#else -void* Xw_def_tilemap (adisplay,ntile) -void *adisplay ; -int ntile ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; -XW_EXT_TILEMAP *ptilemap = NULL ; -//int i,tile ; -int i ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_def_tilemap",pdisplay) ; - return (NULL) ; - } - - if( !(ptilemap = Xw_add_tilemap_structure(sizeof(XW_EXT_TILEMAP))) ) - return (NULL) ; - - if( ntile <= 0 ) ntile = MAXTILE ; - - ptilemap->connexion = pdisplay ; - ptilemap->maxtile = min(ntile,MAXTILE) ; - - for( i=0 ; imaxtile ; i++ ) { - ptilemap->tiles[i] = 0 ; - } - -#ifdef TRACE_DEF_TILEMAP -if( Xw_get_trace() ) { - printf(" %lx = Xw_def_tilemap(%lx,%d)\n", (long ) ptilemap,(long ) adisplay,ntile) ; -} -#endif - - return (ptilemap); -} - -static XW_EXT_TILEMAP *PtilemapList =NULL ; - -#ifdef XW_PROTOTYPE -XW_EXT_TILEMAP* Xw_add_tilemap_structure(int size) -#else -XW_EXT_TILEMAP* Xw_add_tilemap_structure(size) -int size ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert one Extended tilemap structure in the - EXtended tilemap List - - returns Extended tilemap address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_TILEMAP *ptilemap = (XW_EXT_TILEMAP*) Xw_malloc(size) ; -int i ; - - if( ptilemap ) { - ptilemap->type = TILEMAP_TYPE ; - ptilemap->link = PtilemapList ; - PtilemapList = ptilemap ; - ptilemap->connexion = NULL ; - ptilemap->maxtile = 0 ; - ptilemap->maxwindow = 0 ; - for( i=0 ; itiles[i] = 0 ; - } - } else { - /*EXT_TILEMAP allocation failed*/ - Xw_set_error(17,"Xw_add_tilemap_structure",0) ; - } - - return (ptilemap) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_tilemap(void* atilemap) -#else -XW_STATUS Xw_close_tilemap(atilemap) -void* atilemap ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_TILEMAP *ptilemap = (XW_EXT_TILEMAP*)atilemap ; -XW_STATUS status ; - - if( !Xw_isdefine_tilemap(ptilemap) ) { - /*Bad EXT_TILEMAP Address*/ - Xw_set_error(49,"Xw_close_tilemap",ptilemap) ; - return (XW_ERROR) ; - } - - status = Xw_del_tilemap_structure(ptilemap) ; - -#ifdef TRACE_DEF_TILEMAP -if( Xw_get_trace() ) { - printf(" %d = Xw_close_tilemap(%lx)\n",status,(long ) ptilemap) ; -} -#endif - - return (status) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_tilemap_structure(XW_EXT_TILEMAP* atilemap) -#else -XW_STATUS Xw_del_tilemap_structure(atilemap) -XW_EXT_TILEMAP *atilemap; -#endif /*XW_PROTOTYPE*/ -/* - Remove the Extended tilemap address from the Extended List - - returns ERROR if the tilemap address is not Found in the list - returns SUCCESS if successful -*/ -{ -XW_EXT_TILEMAP *ptilemap = PtilemapList ; -int i ; - - if( !atilemap ) return (XW_ERROR) ; - - if( atilemap->maxwindow ) --atilemap->maxwindow ; - - if( atilemap->maxwindow ) { - return (XW_ERROR) ; - } else { - for( i=0 ; itiles[i] ) XFreePixmap(_PDISPLAY,atilemap->tiles[i]) ; - } - - if( atilemap == ptilemap ) { - PtilemapList = (XW_EXT_TILEMAP*) atilemap->link ; - } else { - for( ; ptilemap ; ptilemap = (XW_EXT_TILEMAP*) ptilemap->link ) { - if( ptilemap->link == atilemap ) { - ptilemap->link = atilemap->link ; - break ; - } - } - } - Xw_free(atilemap) ; - } - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_def_type.cxx b/src/Xw/Xw_def_type.cxx deleted file mode 100755 index 9765fceefd..0000000000 --- a/src/Xw/Xw_def_type.cxx +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_TYPE -#endif - -/* - STATUS Xw_def_type (atypemap,index,length,desc): - XW_EXT_TYPEMAP *atypemap - int index Line type index - int length Descriptor length - float *desc Type Descriptor - - Update Line Type Extended typemap index with the specified TYPE values . Descriptor is an array of float.Each value give the subline length - in MM .First subline is the draw part,Second the hidden part, - Thirst the drawn part ... - NOTE than type index 0 is the Default Type (SOLID) - and cann't be REDEFINED - - Returns ERROR if BadType Index - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_def_type (void* atypemap, - int index,int length,float* desc) -#else -XW_STATUS Xw_def_type (atypemap,index,length,desc) -void *atypemap; -int index ; -int length ; -float *desc ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap ; -Screen *screen ; -unsigned char *pdesc ; -int i,ptype ; - - if ( !Xw_isdefine_typeindex(ptypemap,index) ) { - /*Bad Type index*/ - Xw_set_error(18,"Xw_def_type",&index) ; - return (XW_ERROR) ; - } - - if( !desc || length < 0 ) { - /*Bad Type descriptor data*/ - Xw_set_error(19,"Xw_def_type",&index) ; - return (XW_ERROR) ; - } - - if( ptypemap->types[index] ) Xw_free(ptypemap->types[index]) ; - ptypemap->types[index] = NULL ; - - if( length ) { - ptypemap->types[index] = pdesc = (unsigned char*) Xw_malloc(length+1) ; - - screen = ScreenOfDisplay(_TDISPLAY,DefaultScreen(_TDISPLAY)) ; - - for( i=0 ; i 255 ) { - /*Bad Type descriptor data*/ - Xw_set_error(19,"Xw_def_type",&index) ; - } - pdesc[i] = (unsigned char) (ptype) ? ptype : 1 ; - } - - pdesc[length] ='\0' ; - } - -#ifdef TRACE_DEF_TYPE -if( Xw_get_trace() ) { - printf (" Xw_def_type(%lx,%d,%d,{",(long ) ptypemap,index,length); - for ( i=0 ; i - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_TYPEMAP -#endif - -/* - XW_EXT_TYPEMAP* Xw_def_typemap(adisplay,ntype): - XW_EXT_DISPLAY *adisplay Extended Display structure - - int ntype Number of type cells to be allocated - - Create a typemap extension - allocate the type cells in the typemap as if possible - depending of the MAXTYPE define . - - Returns Typemap extension address if successuful - or NULL if ERROR - - STATUS = Xw_close_typemap(atypemap) - XW_EXT_TYPEMAP* atypemap Extended typemap - - - Destroy The Extended TypeMap - - Returns ERROR if Bad Extended TypeMap Address - SUCCESS if successfull - -*/ - -#ifdef XW_PROTOTYPE -void* Xw_def_typemap (void* adisplay,int ntype) -#else -void* Xw_def_typemap (adisplay,ntype) -void *adisplay ; -int ntype ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; -XW_EXT_TYPEMAP *ptypemap = NULL ; -//int i,type ; -int i ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_def_typemap",pdisplay) ; - return (NULL) ; - } - - if( !(ptypemap = Xw_add_typemap_structure(sizeof(XW_EXT_TYPEMAP))) ) - return (NULL) ; - - if( ntype <= 0 ) ntype = MAXTYPE ; - - ptypemap->connexion = pdisplay ; - ptypemap->maxtype = min(ntype,MAXTYPE) ; - - for( i=0 ; imaxtype ; i++ ) { - ptypemap->types[i] = NULL ; - } - -#ifdef TRACE_DEF_TYPEMAP -if( Xw_get_trace() ) { - printf(" %lx = Xw_def_typemap(%lx,%d)\n", (long ) ptypemap,(long ) adisplay,ntype) ; -} -#endif - - return (ptypemap); -} - -static XW_EXT_TYPEMAP *PtypemapList =NULL ; - -#ifdef XW_PROTOTYPE -XW_EXT_TYPEMAP* Xw_add_typemap_structure(int size) -#else -XW_EXT_TYPEMAP* Xw_add_typemap_structure(size) -int size ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert one Extended typemap structure in the - EXtended typemap List - - returns Extended typemap address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*) Xw_malloc(size) ; -int i ; - - if( ptypemap ) { - ptypemap->type = TYPEMAP_TYPE ; - ptypemap->link = PtypemapList ; - PtypemapList = ptypemap ; - ptypemap->connexion = NULL ; - ptypemap->maxtype = 0 ; - ptypemap->maxwindow = 0 ; - for( i=0 ; itypes[i] = NULL ; - } else { - /*EXT_TYPEMAP Allocation failed*/ - Xw_set_error(20,"Xw_add_typemap_structure",0) ; - } - - return (ptypemap) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_typemap(void* atypemap) -#else -XW_STATUS Xw_close_typemap(atypemap) -void *atypemap ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_TYPEMAP* ptypemap = (XW_EXT_TYPEMAP*) atypemap ; -XW_STATUS status ; - - if( !Xw_isdefine_typemap(ptypemap) ) { - /*Bad EXT_TYPEMAP Address*/ - Xw_set_error(51,"Xw_close_typemap",ptypemap) ; - return (XW_ERROR) ; - } - - status = Xw_del_typemap_structure(ptypemap) ; - -#ifdef TRACE_DEF_TYPEMAP -if( Xw_get_trace() ) { - printf(" %d = Xw_close_typemap(%lx)\n",status,(long ) ptypemap) ; -} -#endif - - return (status) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_typemap_structure(XW_EXT_TYPEMAP* atypemap) -#else -XW_STATUS Xw_del_typemap_structure(atypemap) -XW_EXT_TYPEMAP *atypemap; -#endif /*XW_PROTOTYPE*/ -/* - Remove the Extended typemap address from the Extended List - - returns ERROR if the typemap address is not Found in the list - returns SUCCESS if successful -*/ -{ -XW_EXT_TYPEMAP *ptypemap = PtypemapList ; -//int i ; - - if( !atypemap ) return (XW_ERROR) ; - - if( atypemap->maxwindow ) { - return (XW_ERROR) ; - } else { - if( atypemap == ptypemap ) { - PtypemapList = (XW_EXT_TYPEMAP*) atypemap->link ; - } else { - for( ; ptypemap ; ptypemap = (XW_EXT_TYPEMAP*) ptypemap->link ) { - if( ptypemap->link == atypemap ) { - ptypemap->link = atypemap->link ; - break ; - } - } - } - Xw_free(atypemap) ; - } - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_def_width.cxx b/src/Xw/Xw_def_width.cxx deleted file mode 100755 index ce6926dbd8..0000000000 --- a/src/Xw/Xw_def_width.cxx +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_WIDTH -#endif - -/* - STATUS Xw_def_width (awidthmap,index,width): - XW_EXT_WIDTHMAP *awidthmap - int index Line width index - float width width in MM - - Update Line Width Extended widthmap index - with the specified WIDTH value . - NOTE than width index 0 is the default width (1 pixel) - and cann't be redefined . - - Returns ERROR if BadWidth Index - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_def_width (void* awidthmap,int index,float width) -#else -XW_STATUS Xw_def_width (awidthmap,index,width) -void *awidthmap ; -int index ; -float width ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*)awidthmap ; -Screen *screen ; -int pwidth ; - - if ( !Xw_isdefine_widthindex(pwidthmap,index) ) { - /*Bad Width Index*/ - Xw_set_error(21,"Xw_def_width",&index) ; - return (XW_ERROR) ; - } - - screen = ScreenOfDisplay(_WDISPLAY,DefaultScreen(_WDISPLAY)) ; - width = width * (float)HeightOfScreen(screen)/ - (float)HeightMMOfScreen(screen) ; - pwidth = (int) (0.5 + width) ; - - pwidthmap->widths[index] = 1 ; - if( width == 0. || pwidth < 0 || pwidth > 255 ) { - /*Bad Width Thickness*/ - Xw_set_error(22,"Xw_def_width",&width) ; - } - - pwidthmap->widths[index] = (unsigned char) (pwidth) ? pwidth : 1 ; - -#ifdef TRACE_DEF_WIDTH -if( Xw_get_trace() ) { - printf (" Xw_def_width(%lx,%d,%f)\n",(long ) pwidthmap,index,width) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_def_widthmap.cxx b/src/Xw/Xw_def_widthmap.cxx deleted file mode 100755 index 0f67579a1d..0000000000 --- a/src/Xw/Xw_def_widthmap.cxx +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_WIDTHMAP -#endif - -/* - XW_EXT_WIDTHMAP* Xw_def_widthmap(adisplay,nwidth): - XW_EXT_DISPLAY *adisplay Extended Display structure - - int nwidth Number of width cells to be allocated - - Create a widthmap extension - allocate the width cells in the widthmap as if possible - depending of the MAXWIDTH define . - - Returns Widthmap extension address if successful - or NULL if ERROR - - STATUS Xw_close_widthmap(awidthmap): - XW_EXT_WIDTHMAP* awidthmap Extended Widthmap address - - - Destroy The specified Extended Widthmap - - Returns SUCCESS if successuful - Returns ERROR if Bad Extended Widthmap - - -*/ - -#ifdef XW_PROTOTYPE -void* Xw_def_widthmap (void* adisplay,int nwidth) -#else -void* Xw_def_widthmap (adisplay,nwidth) -void *adisplay ; -int nwidth ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; -XW_EXT_WIDTHMAP *pwidthmap = NULL ; -//int i ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_def_widthmap",pdisplay) ; - return (NULL) ; - } - - if( !(pwidthmap = Xw_add_widthmap_structure(sizeof(XW_EXT_WIDTHMAP))) ) - return (NULL) ; - - if( nwidth <= 0 ) nwidth = MAXWIDTH ; - - pwidthmap->connexion = pdisplay ; - pwidthmap->maxwidth = min(nwidth,MAXWIDTH) ; - -#ifdef TRACE_DEF_WIDTHMAP -if( Xw_get_trace() ) { - printf(" %lx = Xw_def_widthmap(%lx,%d)\n", - (long ) pwidthmap,(long ) adisplay,nwidth) ; -} -#endif - - return (pwidthmap); -} - -static XW_EXT_WIDTHMAP *PwidthmapList =NULL ; - -#ifdef XW_PROTOTYPE -XW_EXT_WIDTHMAP* Xw_add_widthmap_structure(int size) -#else -XW_EXT_WIDTHMAP* Xw_add_widthmap_structure(size) -int size ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert one Extended widthmap structure in the - EXtended widthmap List - - returns Extended widthmap address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*) Xw_malloc(size) ; -int i ; - - if( pwidthmap ) { - pwidthmap->type = WIDTHMAP_TYPE ; - pwidthmap->link = PwidthmapList ; - PwidthmapList = pwidthmap ; - pwidthmap->connexion = NULL ; - pwidthmap->maxwidth = 0 ; - pwidthmap->maxwindow = 0 ; - for( i=0 ; iwidths[i] = 0 ; - } - } else { - /*EXT_WIDTHMAP Allocation Failed*/ - Xw_set_error(23,"Xw_add_widthmap_structure",0) ; - } - - return (pwidthmap) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_widthmap(void* awidthmap) -#else -XW_STATUS Xw_close_widthmap(awidthmap) -void* awidthmap ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*)awidthmap ; -XW_STATUS status ; - - if( !Xw_isdefine_widthmap(pwidthmap) ) { - /*Bad EXT_WIDTHMAP Address*/ - Xw_set_error(53,"Xw_close_widthmap",pwidthmap) ; - return (XW_ERROR) ; - } - - status = Xw_del_widthmap_structure(pwidthmap) ; - -#ifdef TRACE_DEF_WIDTHMAP -if( Xw_get_trace() ) { - printf(" %d = Xw_close_widthmap(%lx)\n",status,(long ) pwidthmap) ; -} -#endif - - return (status) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_widthmap_structure(XW_EXT_WIDTHMAP* awidthmap) -#else -XW_STATUS Xw_del_widthmap_structure(awidthmap) -XW_EXT_WIDTHMAP *awidthmap; -#endif /*XW_PROTOTYPE*/ -/* - Remove the Extended widthmap address from the Extended List - - returns ERROR if the widthmap address is not Found in the list - returns SUCCESS if successful -*/ -{ -XW_EXT_WIDTHMAP *pwidthmap = PwidthmapList ; -//int i ; - - if( !awidthmap ) return (XW_ERROR) ; - - if( awidthmap->maxwindow ) { - return (XW_ERROR) ; - } else { - if( awidthmap == pwidthmap ) { - PwidthmapList = (XW_EXT_WIDTHMAP*) awidthmap->link ; - } else { - for( ; pwidthmap ; pwidthmap = (XW_EXT_WIDTHMAP*) pwidthmap->link ) { - if( pwidthmap->link == awidthmap ) { - pwidthmap->link = awidthmap->link ; - break ; - } - } - } - Xw_free(awidthmap) ; - } - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_def_window.cxx b/src/Xw/Xw_def_window.cxx deleted file mode 100755 index 14505ec62c..0000000000 --- a/src/Xw/Xw_def_window.cxx +++ /dev/null @@ -1,618 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define PURIFY /*GG_220596 -Liberation memoire lors de la destruction d'une fenetre*/ - -#define S3593 /*GG130398 - OPTIMISATION MFT -> Desactiver temporairement le clipping -*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEF_WINDOW -#define TRACE_CLOSE_WINDOW -#endif - -/* - XW_EXT_WINDOW* Xw_def_window (adisplay,window,istransparent); - XW_EXT_DISPLAY *adisplay ; - Aspect_Handle window XWindow ID - int istransparent - - Create the Window Extension info - and save Window attributes - - Returns ERROR if the connection failed. - Returns extended data window structure pointer - if the connection done. - - - XW_STATUS Xw_close_window (awindow,destroy): - XW_EXT_WINDOW *awindow - int destroy - - Close the window(s) and free all structures attached to - NOTE than this Close all windows if awindow is NULL - Destroy the XWindow if destroy is TRUE; - - returns ERROR NO Extended Window address has been defined - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -void* Xw_def_window (void *adisplay,Aspect_Handle window,int istransparent) -#else -void* Xw_def_window (adisplay,window,istransparent) -void *adisplay ; -Aspect_Handle window ; -int istransparent ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; -XW_EXT_WINDOW *pwindow = NULL ; -XW_WINDOWSTATE state ; -//XWindowAttributes attributes ; -XGCValues gc_values; -int mask,maskext ; -//XEvent event ; -//int i,j,status,xc,yc,width,height ; -int i,xc,yc,width,height ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_def_window",pdisplay) ; - return (NULL) ; - } - - if( !(pwindow = Xw_add_window_structure(sizeof(XW_EXT_WINDOW))) ) - return (NULL) ; - - _DRAWABLE = _WINDOW = window ; - _PIXMAP = 0 ; - _NWBUFFER = 0 ; - _FWBUFFER = 0 ; - _BWBUFFER = 0 ; - _COLORMAP = NULL ; - _WIDTHMAP = NULL ; - _TYPEMAP = NULL ; - _FONTMAP = NULL ; - _TILEMAP = NULL ; - _MARKMAP = NULL ; - - pwindow->connexion = pdisplay ; - - state = Xw_get_window_position(pwindow,&xc,&yc,&width,&height) ; - - if( state == XW_WS_UNKNOWN ) { - /*ERROR*Bad Window Attributes*/ - Xw_del_window_structure(pwindow) ; - Xw_set_error(54,"Xw_def_window",&window) ; - return (NULL) ; - } - - pwindow->axleft = xc - width/2 ; - pwindow->axright = xc + width/2 ; - pwindow->aytop = yc - height/2 ; - pwindow->aybottom = yc + height/2 ; - pwindow->rwidth = 0 ; - pwindow->rheight = 0 ; - - pwindow->lineindex = 0 ; - pwindow->polyindex = 0 ; - pwindow->textindex = 0 ; - pwindow->markindex = 0 ; - - if( istransparent ) { - pwindow->backindex = -1 ; - } else { - pwindow->backindex = 0 ; - } - - pwindow->clipflag = True; - - for( i=0 ; iecbk[i].function = NULL ; - pwindow->ecbk[i].userdata = NULL ; - pwindow->icbk[i].function = NULL ; - } - - gc_values.function = GXcopy ; mask = GCFunction ; - gc_values.plane_mask = AllPlanes ; mask |= GCPlaneMask ; - gc_values.background = BlackPixelOfScreen(_SCREEN) ; - mask |= GCBackground ; - gc_values.foreground = WhitePixelOfScreen(_SCREEN) ; - mask |= GCForeground ; - pwindow->qgwind.gc = XCreateGC(_DISPLAY,_WINDOW, mask, &gc_values) ; - gc_values.foreground = BlackPixelOfScreen(_SCREEN) ; - pwindow->qgwind.gcclear = XCreateGC(_DISPLAY,_WINDOW, mask, &gc_values); - gc_values.graphics_exposures = False ; mask |= GCGraphicsExposures ; - gc_values.foreground = WhitePixelOfScreen(_SCREEN) ; - pwindow->qgwind.gccopy = XCreateGC(_DISPLAY,_WINDOW, mask, &gc_values) ; - gc_values.function = GXxor ; - gc_values.graphics_exposures = True ; - pwindow->qgwind.gchigh = XCreateGC(_DISPLAY,_WINDOW, mask, &gc_values) ; - gc_values.function = GXcopy ; - pwindow->qgwind.code = ~0 ; - pwindow->qgwind.pimage = NULL ; - pwindow->qgwind.method = Aspect_FM_NONE ; - pwindow->qgwind.pixmap = 0 ; - - _BINDEX = 0 ; - for( i=0 ; iqgline[i].code = ~0 ; - pwindow->qgline[i].count = 0 ; - pwindow->qgline[i].gc = XCreateGC(_DISPLAY,_WINDOW, - mask | maskext, &gc_values) ; - pwindow->qgmark[i].code = ~0; - pwindow->qgmark[i].count = 0 ; - pwindow->qgmark[i].gc = XCreateGC(_DISPLAY,_WINDOW, - mask | maskext, &gc_values) ; - gc_values.fill_style = FillSolid ; maskext = GCFillStyle ; - gc_values.fill_rule = EvenOddRule ; maskext |= GCFillRule ; - pwindow->qgpoly[i].code = ~0 ; - pwindow->qgpoly[i].count = 0 ; - pwindow->qgpoly[i].gc = XCreateGC(_DISPLAY,_WINDOW, - mask | maskext, &gc_values) ; - maskext = 0 ; - pwindow->qgtext[i].code = ~0; - pwindow->qgtext[i].count = 0 ; - pwindow->qgtext[i].gc = XCreateGC(_DISPLAY,_WINDOW, - mask | maskext, &gc_values) ; - } - - XFlush(_DISPLAY) ; - - Xw_set_window_ratio(pwindow,0.001 METER) ; - -#ifdef TRACE_DEF_WINDOW -if( Xw_get_trace() ) { - printf (" Xw_def_window(%lx,%lx,%d)\n",(long ) pdisplay,(long ) window,istransparent) ; -} -#endif - - return (pwindow); - -} - -static XW_EXT_WINDOW *PwindowList =NULL ; - -#ifdef XW_PROTOTYPE -XW_EXT_WINDOW* Xw_add_window_structure(int size) -#else -XW_EXT_WINDOW* Xw_add_window_structure(size) -int size ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert one Extended window structure in the - EXtended Window List - - returns Extended window address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) Xw_malloc(size) ; - - if( pwindow ) { - pwindow->type = WINDOW_TYPE ; - pwindow->link = PwindowList ; - pwindow->other = NULL ; - PwindowList = pwindow ; - } else { - /*ERROR*EXT_WINDOW allocation failed*/ - Xw_set_error(69,"Xw_add_window_structure",0) ; - } - - return (pwindow) ; -} - -#ifdef XW_PROTOTYPE -XW_EXT_WINDOW* Xw_get_window_structure(Window window) -#else -XW_EXT_WINDOW* Xw_get_window_structure(window) -Window window ; -#endif /*XW_PROTOTYPE*/ -/* - Return the Extended window address corresponding to the required - Window Id or NULL if not found -*/ -{ -XW_EXT_WINDOW *pwindow = PwindowList ; - - while (pwindow) { - if( pwindow->window == window ) { - break ; - } - pwindow = (XW_EXT_WINDOW*) pwindow->link ; - } - - return (pwindow) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_window (void* awindow,int destroy) -#else -XW_STATUS Xw_close_window (awindow,destroy) -void *awindow; -int destroy; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -int i ; - - if( !pwindow ) { - while( Xw_del_window_structure(NULL) ) ; - } else { - if( destroy ) { -#ifdef PURIFY - XFreeGC(_DISPLAY,pwindow->qgwind.gc); - XFreeGC(_DISPLAY,pwindow->qgwind.gcclear); - XFreeGC(_DISPLAY,pwindow->qgwind.gccopy); - XFreeGC(_DISPLAY,pwindow->qgwind.gchigh); - - for( i=0 ; iqgline[i].gc); - XFreeGC(_DISPLAY,pwindow->qgmark[i].gc); - XFreeGC(_DISPLAY,pwindow->qgpoly[i].gc); - XFreeGC(_DISPLAY,pwindow->qgtext[i].gc); - } -#endif - XDestroyWindow(_DISPLAY,_WINDOW) ; - } - Xw_del_window_structure(pwindow) ; - } - -#ifdef TRACE_CLOSE_WINDOW -if( Xw_get_trace() ) { - printf (" Xw_close_window(%lx,%d)\n",(long ) pwindow,destroy) ; -} -#endif - - return (XW_SUCCESS); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_window_structure(XW_EXT_WINDOW* pwindow) -#else -XW_STATUS Xw_del_window_structure(pwindow) -XW_EXT_WINDOW *pwindow; -#endif /*XW_PROTOTYPE*/ -/* - Remove the Extended window address or the next from the Extended List - and Free the Extended Window - - returns ERROR if the window address is not Found in the list - or NO more Window exist - returns SUCCESS if successful -*/ -{ -XW_EXT_WINDOW *qwindow = PwindowList ; -int i ; - - if( !qwindow ) return (XW_ERROR) ; - - if( pwindow == qwindow ) { - PwindowList = (XW_EXT_WINDOW*) pwindow->link ; - } else if( !pwindow ) { - if( !PwindowList ) return (XW_ERROR) ; - pwindow = PwindowList ; - PwindowList = (XW_EXT_WINDOW*) PwindowList->link ; - } else { - for( ; qwindow ; qwindow = (XW_EXT_WINDOW*) qwindow->link ) { - if( qwindow->link == pwindow ) { - qwindow->link = pwindow->link ; - break ; - } - } - } - - if( _PIXMAP ) { - Xw_close_pixmap(pwindow) ; - } - - if( _BIMAGE ) { - Xw_close_image(_BIMAGE) ; - _BIMAGE = NULL; - } - - if( _BPIXMAP ) { - Xw_close_background_pixmap(pwindow) ; - _BPIXMAP = 0; - } - - Xw_close_buffer(pwindow,0) ; - - for( i=1 ; iother ) Xw_free(pwindow->other) ; - - if( _COLORMAP && (_COLORMAP->maxwindow > 0) ) { - _COLORMAP->maxwindow -= 1; - } - - Xw_free(pwindow) ; - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_reset_attrib(XW_EXT_WINDOW* awindow) -#else -XW_STATUS Xw_reset_attrib(awindow) -XW_EXT_WINDOW *awindow ; -#endif /*XW_PROTOTYPE*/ -/* - Reset ALL Window attributes of a particular Window or ALL Windows - if NULL -*/ -{ -XW_EXT_WINDOW *pwindow ; -unsigned long highpixel,backpixel ; -int i ; - - if( !(pwindow = PwindowList) ) return (XW_ERROR) ; - - while (pwindow) { - if( !awindow || (pwindow == awindow) ) { - for( i=0 ; iqgline[i].code = ~0 ; - pwindow->qgpoly[i].code = ~0 ; - pwindow->qgtext[i].code = ~0 ; - pwindow->qgmark[i].code = ~0 ; - } - if( _COLORMAP ) { - highpixel = _COLORMAP->highpixel ; - if( pwindow->backindex < 0 ) { - backpixel = _COLORMAP->backpixel ; - } else { - backpixel = _COLORMAP->pixels[pwindow->backindex] ; - } - XSetForeground(_DISPLAY, pwindow->qgwind.gccopy, highpixel) ; - highpixel ^= backpixel ; - XSetForeground(_DISPLAY, pwindow->qgwind.gchigh, highpixel) ; - } - } - pwindow = (XW_EXT_WINDOW*) pwindow->link ; - } - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_color_attrib(XW_EXT_WINDOW* awindow, - XW_DRAWMODE mode,int color,unsigned long* hcolor, - int* function,unsigned long* planemask) -#else -XW_STATUS Xw_get_color_attrib(awindow,mode,color,hcolor,function,planemask) -XW_EXT_WINDOW *awindow ; -XW_DRAWMODE mode ; -int color ; -int *function ; -unsigned long *planemask ; -unsigned long *hcolor ; -#endif /*XW_PROTOTYPE*/ -/* - Returns the best drawing attributs color,function and planemask - depending of write mode and colormap visual class attached to this - window . - - returns ERROR if the Visual class is not authorized - returns SUCCESS if successfull -*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; - - switch ( _CLASS ) { - - case TrueColor : - - switch (mode) { - case XW_ERASE : - if( pwindow->backindex >= 0 ) - *hcolor = _COLORMAP->pixels[pwindow->backindex] ; - else *hcolor = _COLORMAP->backpixel; - *function = GXcopy ; - *planemask = AllPlanes ; - break ; - case XW_REPLACE : - *hcolor = _COLORMAP->pixels[color] ; - *function = GXcopy ; - *planemask = AllPlanes ; - break ; - case XW_XORBACK : - if( pwindow->backindex >= 0 ) - *hcolor = _COLORMAP->pixels[pwindow->backindex] - ^ _COLORMAP->pixels[color] ; - else *hcolor = _COLORMAP->backpixel - ^ _COLORMAP->pixels[color] ; - *function = GXxor ; - *planemask = AllPlanes ; - break ; - case XW_XORLIGHT : - case XW_HIGHLIGHT : - case XW_UNHIGHLIGHT : - *hcolor = _COLORMAP->highpixel ^ _COLORMAP->pixels[color] ; - *function = GXxor ; - *planemask = AllPlanes ; - break ; - } - break ; - - case PseudoColor : - - switch (mode) { - case XW_ERASE : - if( pwindow->backindex >= 0 ) - *hcolor = _COLORMAP->pixels[pwindow->backindex] ; - else *hcolor = _COLORMAP->backpixel; - *function = GXcopy ; - *planemask = AllPlanes ; - break ; - case XW_REPLACE : - *hcolor = _COLORMAP->pixels[color] ; - *function = GXcopy ; - *planemask = AllPlanes ; - break ; - case XW_XORBACK : - if( pwindow->backindex >= 0 ) - *hcolor = _COLORMAP->pixels[pwindow->backindex] - ^ _COLORMAP->pixels[color] ; - else *hcolor = _COLORMAP->backpixel - ^ _COLORMAP->pixels[color] ; - *function = GXxor ; - *planemask = AllPlanes ; - break ; - case XW_XORLIGHT : - case XW_HIGHLIGHT : - case XW_UNHIGHLIGHT : - *hcolor = _COLORMAP->highpixel ^ _COLORMAP->pixels[color] ; - *function = GXxor ; - *planemask = AllPlanes ; - break ; - } - break ; - - case StaticColor : - - switch (mode) { - case XW_ERASE : - if( pwindow->backindex >= 0 ) - *hcolor = _COLORMAP->pixels[pwindow->backindex] ; - else *hcolor = _COLORMAP->backpixel; - *function = GXcopy ; - *planemask = AllPlanes ; - break ; - case XW_REPLACE : - *hcolor = _COLORMAP->pixels[color] ; - *function = GXcopy ; - *planemask = AllPlanes ; - break ; - case XW_XORBACK : - if( pwindow->backindex >= 0 ) - *hcolor = _COLORMAP->pixels[pwindow->backindex] - ^ _COLORMAP->pixels[color] ; - else *hcolor = _COLORMAP->backpixel - ^ _COLORMAP->pixels[color] ; - *function = GXxor ; - *planemask = AllPlanes ; - break ; - case XW_XORLIGHT : - case XW_HIGHLIGHT : - case XW_UNHIGHLIGHT : - *hcolor = _COLORMAP->highpixel ^ _COLORMAP->pixels[color] ; - *function = GXxor ; - *planemask = AllPlanes ; - break ; - } - break ; - - case StaticGray : - case GrayScale : - case DirectColor : - /*ERROR*Unimplemented Visual class*/ - Xw_set_error(5,"Xw_get_color_attrib",&_CLASS) ; - return (XW_ERROR) ; - } - - return (XW_SUCCESS) ; -} - -#ifdef S3593 -#ifdef XW_PROTOTYPE -void Xw_set_clipping(void* awindow, int flag) -#else -void Xw_set_clipping(awindow,flag) -void* awindow; -int flag; -#endif -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) awindow; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_clipping",pwindow) ; - return; - } - - pwindow->clipflag = flag; -} - -#ifdef XW_PROTOTYPE -int Xw_get_clipping(void* awindow) -#else -int Xw_get_clipping(awindow) -void* awindow; -#endif -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) awindow; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_clipping",pwindow) ; - return (True) ; - } - - return pwindow->clipflag; -} -#endif /*S3593*/ diff --git a/src/Xw/Xw_draw_arc.cxx b/src/Xw/Xw_draw_arc.cxx deleted file mode 100755 index a86665d829..0000000000 --- a/src/Xw/Xw_draw_arc.cxx +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_ARC -#endif - -/* - STATUS Xw_draw_arc (awindow,xc,yc,xradius,yradius,start,angle): - XW_EXT_WINDOW *awindow - float xc,yc Arc center defined in User Space - float xradius Horizontal arc radius defined in User Space - float xradius Vertical Arc radius defined in User Space - float start Start angle defined in RADIAN - float angle Arc angle defined in RADIAN - - Display arc in current QG set by set_line_attrib . - or retain arc in buffer. - - return ERROR if bad parameter - returns SUCCESS if successful - -*/ - -#define MAXCOORD 32767 -#define MINCOORD -32768 - -static int BeginArcs = False; -static XW_EXT_ARC *parclist ; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_arc (void* awindow,float xc,float yc, - float xradius,float yradius,float start,float angle) -#else -XW_STATUS Xw_draw_arc (awindow,xc,yc,xradius,yradius,start,angle) -void *awindow; -float xc,yc,xradius,yradius,start,angle ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) awindow ; -XW_EXT_BUFFER *pbuffer ; -int narc,bindex,angle1,angle2,x,y,width,height ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_arc",pwindow) ; - return (XW_ERROR) ; - } - - if( xradius <= 0. ) { - /*ERROR*Bad arc radius*/ - Xw_set_error(115,"Xw_draw_arc",&xradius) ; - return (XW_ERROR) ; - } - - if( yradius <= 0. ) { - /*ERROR*Bad arc radius*/ - Xw_set_error(115,"Xw_draw_arc",&yradius) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - for( parclist = pbuffer->plarclist ; parclist ; - parclist = (XW_EXT_ARC*) parclist->link ) { - if( parclist->narc < MAXARCS ) break ; - } - - if( !parclist ) { - parclist = Xw_add_arc_structure(pbuffer) ; - } - - if( !parclist ) return XW_ERROR ; - - angle1 = (Standard_Integer )( start*64./DRAD ); - if( angle1 > 0 ) { - while( angle1 > MAXANGLE ) angle1 -= MAXANGLE ; - } else if( angle1 < 0 ) { - while( angle1 < -MAXANGLE ) angle1 += MAXANGLE ; - } - angle2 = (Standard_Integer ) ( angle*64./DRAD ); - if( angle2 > 0 ) { - while( angle2 > MAXANGLE ) angle2 -= MAXANGLE ; - } else if( angle2 < 0 ) { - while( angle2 < -MAXANGLE ) angle2 += MAXANGLE ; - } -//OCC186 - width = 2*PVALUE(xradius, pwindow->xratio, pwindow->yratio); - height = 2*PVALUE(yradius, pwindow->xratio, pwindow->yratio); - x = PXPOINT(xc, pwindow->xratio); - y = PYPOINT(yc, pwindow->attributes.height, pwindow->yratio); -//OCC186 - x = max(min(x,MAXCOORD),MINCOORD); - y = max(min(y,MAXCOORD),MINCOORD); - if( width < 0xFFFF && height < 0xFFFF ) { - narc = parclist->narc ; - parclist->rarcs[narc].width = width ; - parclist->rarcs[narc].height = height ; - parclist->rarcs[narc].x = x - width/2 ; - parclist->rarcs[narc].y = y - height/2 ; - parclist->rarcs[narc].angle1 = angle1 ; - parclist->rarcs[narc].angle2 = angle2 ; - parclist->narc++ ; - if( bindex > 0 ) { - pbuffer->isempty = False ; - width = (width+1)/2 ; - height = (height+1)/2 ; - pbuffer->rxmin = min(pbuffer->rxmin,x-width) ; - pbuffer->rymin = min(pbuffer->rymin,y-height) ; - pbuffer->rxmax = max(pbuffer->rxmax,x+width) ; - pbuffer->rymax = max(pbuffer->rymax,y+height) ; - } else if( !BeginArcs ) { - int index = pwindow->lineindex ; - Xw_draw_pixel_arcs(pwindow,parclist,pwindow->qgline[index].gc) ; - parclist->narc = 0 ; - } - } else { - /*ERROR*Too big arc radius*/ - Xw_set_error(116,"Xw_draw_arc",0) ; - return (XW_ERROR) ; - } - -#ifdef TRACE_DRAW_ARC -if( Xw_get_trace() > 2 ) { - printf(" Xw_draw_arc(%lx,%f,%f,%f,%f,%f,%f\n", - (long ) pwindow,xc,yc,xradius,yradius,start,angle); -} -#endif - - return (XW_SUCCESS); -} - -/* - STATUS Xw_begin_arcs (awindow,narc): - XW_EXT_WINDOW *awindow - int narc Not used - - - Begin a set of arcs which must be filled by Xw_draw_arc and - closed by Xw_close_arcs - - returns ERROR if bad extended window address - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_begin_arcs(void* awindow,int narc) -#else -XW_STATUS Xw_begin_arcs(awindow,narc) -void *awindow ; -int narc ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_begin_arcs",pwindow) ; - return (XW_ERROR) ; - } - - if( BeginArcs ) Xw_close_arcs(pwindow); - - BeginArcs = True; - -#ifdef TRACE_DRAW_ARC -if( Xw_get_trace() > 2 ) { - printf(" Xw_begin_arcs(%lx,%d)\n",(long ) pwindow,narc) ; -} -#endif - return (XW_SUCCESS) ; -} - -/* - STATUS Xw_close_arcs (awindow): - XW_EXT_WINDOW *awindow - - Close the set of arcs - - returns ERROR if bad extended window address - returns SUCCESS successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_arcs(void* awindow) -#else -XW_STATUS Xw_close_arcs(awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -int bindex ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_close_arcs",pwindow) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - if( BeginArcs && !bindex ) { - int index = pwindow->lineindex ; - for( parclist = _BUFFER(bindex).plarclist ; parclist ; - parclist = (XW_EXT_ARC*) parclist->link ) { - if( parclist->narc > 0 ) { - Xw_draw_pixel_arcs(pwindow,parclist,pwindow->qgline[index].gc) ; - parclist->narc = 0 ; - } else break ; - } - } - - BeginArcs = False; - -#ifdef TRACE_DRAW_ARC -if( Xw_get_trace() > 2 ) { - printf(" Xw_close_arcs(%lx)\n",(long ) pwindow) ; -} -#endif - return (XW_SUCCESS) ; -} - - -#ifdef XW_PROTOTYPE -void Xw_draw_pixel_arcs (XW_EXT_WINDOW* pwindow,XW_EXT_ARC* parclist,GC gc) -#else -void Xw_draw_pixel_arcs (pwindow,parclist,gc) -XW_EXT_WINDOW *pwindow; -XW_EXT_ARC *parclist; -GC gc; -#endif /*XW_PROTOTYPE*/ -{ - if( parclist->isupdated ) { - XDrawArcs(_DISPLAY,_DRAWABLE,gc,parclist->uarcs,parclist->narc) ; - } else { - XDrawArcs(_DISPLAY,_DRAWABLE,gc,parclist->rarcs,parclist->narc) ; - } - -} - -#ifdef XW_PROTOTYPE -XW_EXT_ARC* Xw_add_arc_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_ARC* Xw_add_arc_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended arc structure in the - arc List - - returns Extended arc address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_ARC *parc ; - - parc = (XW_EXT_ARC*) Xw_malloc(sizeof(XW_EXT_ARC)) ; - if( parc ) { - parc->link = pbuflist->plarclist ; - parc->isupdated = False ; - parc->narc = 0 ; - pbuflist->plarclist = parc ; - } else { - /*ERROR*EXT_ARC Allocation failed*/ - Xw_set_error(35,"Xw_add_arc_structure",NULL) ; - } - - return (parc) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_arc_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_arc_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended arc structure in the - arc List - - SUCCESS always -*/ -{ -XW_EXT_ARC *parc,*qarc ; - - for( parc = pbuflist->plarclist ; parc ; parc = qarc ) { - qarc = (XW_EXT_ARC*)parc->link ; - Xw_free(parc) ; - } - pbuflist->plarclist = NULL ; - - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_draw_buffer.cxx b/src/Xw/Xw_draw_buffer.cxx deleted file mode 100755 index 51a648cc4f..0000000000 --- a/src/Xw/Xw_draw_buffer.cxx +++ /dev/null @@ -1,2189 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define CTS50025 /*GG_080997 -Preinitialiser la police de caracteres du buffer sinon - plantage au chargement -*/ - -#define PRO11005 /*GG_131197 -// La couleur de fond du paragraphe n'est pas respectee -// En mode Highlight,on ne voit plus les textes. -*/ - - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_BUFFER -#endif - -#define XROTATE(x,y) (x*cosa + y*sina) -#define YROTATE(x,y) (y*cosa - x*sina) -#define UNKNOWN_BUFFER 0 -#define MOVE_BUFFER 1 -#define ROTATE_BUFFER 2 -#define SCALE_BUFFER 3 - -/* - STATUS Xw_draw_buffer (awindow,bufferid) - XW_EXT_WINDOW *awindow - int bufferid - - Draw one retain buffer of primitives at screen - - Returns ERROR if the extended window address is badly defined - or Buffer is empty - or Buffer is already drawn at screen - or Buffer is not opened - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_buffer (void* awindow,int bufferid) -#else -XW_STATUS Xw_draw_buffer (awindow,bufferid) -void *awindow; -int bufferid; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -XW_STATUS status ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_buffer",pwindow) ; - return (XW_ERROR) ; - } - - if( bufferid > 0 ) { - pbuffer = Xw_get_buffer_structure(pwindow,bufferid) ; - if( !pbuffer ) { - /*ERROR*BUFFER is not opened*/ - Xw_set_error(119,"Xw_draw_buffer",&bufferid) ; - return (XW_ERROR) ; - } - } else { - pbuffer = &_BUFFER(-bufferid) ; - if( !pbuffer->bufferid ) { - /*ERROR*BUFFER is not opened*/ - return (XW_SUCCESS) ; - } - } - - if( pbuffer->isempty ) return XW_ERROR ; - - if( pbuffer->isdrawn && (QGMODE(pbuffer->code) == XW_XORBACK) ) - return XW_ERROR ; - - pbuffer->isdrawn = True ; - - status = Xw_redraw_buffer(pwindow,pbuffer) ; - - if( !pbuffer->isretain && (QGTYPE(pbuffer->code) == XW_ENABLE) ) { - int x,y,w,h ; - if( pbuffer->isupdated ) { - x = pbuffer->uxmin - 1 ; - y = pbuffer->uymin - 1 ; - w = pbuffer->uxmax - x + 1 ; - h = pbuffer->uymax - y + 1 ; - } else { - x = pbuffer->rxmin - 1 ; - y = pbuffer->rymin - 1 ; - w = pbuffer->rxmax - x + 1 ; - h = pbuffer->rymax - y + 1 ; - } - - if( x < 0 ) x = 0 ; - if( y < 0 ) y = 0 ; - if( x+w > _WIDTH ) w = _WIDTH - x ; - if( y+h > _HEIGHT ) h = _HEIGHT - y ; - - if( _NWBUFFER > 0 ) { - XCopyArea(_DISPLAY,_BWBUFFER,_FWBUFFER, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } else if( _PIXMAP ) { - XCopyArea(_DISPLAY,_PIXMAP,_WINDOW, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } - XFlush(_DISPLAY) ; - } - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_draw_buffer(%lx,%d)\n",(long ) pwindow,bufferid) ; - } -#endif - - return status ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_redraw_buffer (XW_EXT_WINDOW *pwindow,XW_EXT_BUFFER *pbuffer) -#else -XW_STATUS Xw_redraw_buffer (pwindow,pbuffer) -XW_EXT_WINDOW *pwindow; -XW_EXT_BUFFER *pbuffer ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_IMAGE *pimaglist ; -XW_EXT_POLY *ppolylist ; -XW_EXT_LINE *plinelist ; -XW_EXT_SEGMENT *pseglist ; -XW_EXT_LTEXT *pltextlist ; -XW_EXT_PTEXT *pptextlist ; -XW_EXT_ARC *parclist ; -XW_EXT_PMARKER *ppmarklist ; -XW_EXT_LMARKER *plmarklist ; -XW_EXT_POINT *ppntlist ; - - if( QGTYPE(pbuffer->code) == XW_ENABLE ) { - _DRAWABLE = (_NWBUFFER > 0) ? _BWBUFFER : _PIXMAP ; - } else { - _DRAWABLE = (_NWBUFFER > 0) ? _FWBUFFER : _WINDOW ; - } - - for( pimaglist = pbuffer->pimaglist ; pimaglist ; - pimaglist = (XW_EXT_IMAGE*)pimaglist->link ) { - if( pimaglist->nimage > 0 ) { - Xw_draw_pixel_images(pwindow,pimaglist, - pbuffer->gcf,pbuffer->gcf); - } else break ; - } - - for( ppolylist = pbuffer->ppolylist ; ppolylist ; - ppolylist = (XW_EXT_POLY*)ppolylist->link ) { - if( ppolylist->npoly > 0 ) { -#ifdef PRO11005 - Xw_draw_pixel_polys(pwindow,ppolylist,NULL,pbuffer->gcf); -#else - Xw_draw_pixel_polys(pwindow,ppolylist,pbuffer->gcf,NULL); -#endif - } else break ; - } - - for( parclist = pbuffer->pparclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - Xw_draw_pixel_polyarcs(pwindow,parclist,pbuffer->gcf,NULL); - } else break ; - } - - for( pseglist = pbuffer->pseglist ; pseglist ; - pseglist = (XW_EXT_SEGMENT*)pseglist->link ) { - if( pseglist->nseg > 0 ) { - Xw_draw_pixel_segments(pwindow,pseglist,pbuffer->gcf); - } else break ; - } - - for( plinelist = pbuffer->plinelist ; plinelist ; - plinelist = (XW_EXT_LINE*)plinelist->link ) { - if( plinelist->nline > 0 ) { - Xw_draw_pixel_lines(pwindow,plinelist,pbuffer->gcf); - } else break ; - } - - for( parclist = pbuffer->plarclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - Xw_draw_pixel_arcs(pwindow,parclist,pbuffer->gcf); - } else break ; - } - - for( pltextlist = pbuffer->pltextlist ; pltextlist ; - pltextlist = (XW_EXT_LTEXT*)pltextlist->link ) { - if( pltextlist->ntext > 0 ) { - Xw_draw_pixel_texts(pwindow,pltextlist, - pbuffer->gcf,pbuffer->code); - } else break ; - } - - for( ppmarklist = pbuffer->ppmarklist ; ppmarklist ; - ppmarklist = (XW_EXT_PMARKER*)ppmarklist->link ) { - if( ppmarklist->nmark > 0 ) { - Xw_draw_pixel_pmarkers(pwindow,ppmarklist,pbuffer->gcf); - } else break ; - } - - for( plmarklist = pbuffer->plmarklist ; plmarklist ; - plmarklist = (XW_EXT_LMARKER*)plmarklist->link ) { - if( plmarklist->nmark > 0 ) { - Xw_draw_pixel_lmarkers(pwindow,plmarklist,pbuffer->gcf); - } else break ; - } - - for( pptextlist = pbuffer->pptextlist ; pptextlist ; - pptextlist = (XW_EXT_PTEXT*)pptextlist->link ) { - if( pptextlist->ntext > 0 ) { - Xw_draw_pixel_polytexts(pwindow,pptextlist, - pbuffer->gcf,NULL,pbuffer->gcf,pbuffer->code); - } else break ; - } - - for( ppntlist = pbuffer->ppntlist ; ppntlist ; - ppntlist = (XW_EXT_POINT*)ppntlist->link ) { - if( ppntlist->npoint > 0 ) { - Xw_draw_pixel_points(pwindow,ppntlist,pbuffer->gcf); - } else break ; - } - - XFlush(_DISPLAY) ; - - return (XW_SUCCESS); -} - -/* - STATUS Xw_erase_buffer (awindow,bufferid) - XW_EXT_WINDOW *awindow - int bufferid - - Erase one retain buffer of primitives from screen - - Returns ERROR if the extended window address is badly defined - or Buffer is empty - or Buffer is already erase from screen - or Buffer is not opened - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_erase_buffer (void* awindow,int bufferid) -#else -XW_STATUS Xw_erase_buffer (awindow,bufferid) -void *awindow; -int bufferid; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -XW_STATUS status = XW_SUCCESS ; -int x,y,w,h ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_erase_buffer",pwindow) ; - return (XW_ERROR) ; - } - - if( bufferid > 0 ) { - pbuffer = Xw_get_buffer_structure(pwindow,bufferid) ; - if( !pbuffer ) { - /*ERROR*BUFFER is not opened*/ - Xw_set_error(119,"Xw_erase_buffer",&bufferid) ; - return (XW_ERROR) ; - } - } else { - pbuffer = &_BUFFER(-bufferid) ; - if( !pbuffer->bufferid ) { - /*ERROR*BUFFER is not opened*/ - return (XW_SUCCESS) ; - } - } - - if( pbuffer->isempty ) return XW_ERROR ; - - if( !pbuffer->isdrawn && (QGMODE(pbuffer->code) == XW_XORBACK) ) - return XW_ERROR ; - - pbuffer->isdrawn = False ; - if( pbuffer->isupdated ) { - x = pbuffer->uxmin - 1 ; - y = pbuffer->uymin - 1 ; - w = pbuffer->uxmax - x + 1 ; - h = pbuffer->uymax - y + 1 ; - } else { - x = pbuffer->rxmin - 1 ; - y = pbuffer->rymin - 1 ; - w = pbuffer->rxmax - x + 1 ; - h = pbuffer->rymax - y + 1 ; - } - - if( x < 0 ) x = 0 ; - if( y < 0 ) y = 0 ; - if( x+w > _WIDTH ) w = _WIDTH - x ; - if( y+h > _HEIGHT ) h = _HEIGHT - y ; - - if( QGMODE(pbuffer->code) == XW_REPLACE ) { - /* Restore from MIN-MAX buffer pixmap */ - if( _NWBUFFER > 0 ) { - XCopyArea(_DISPLAY,_BWBUFFER,_FWBUFFER, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } else if( _PIXMAP ) { - XCopyArea(_DISPLAY,_PIXMAP,_WINDOW, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } else { - XClearArea(_DISPLAY,_WINDOW,x,y,w,h,False); - } - XFlush(_DISPLAY) ; - } else if( QGMODE(pbuffer->code) == XW_XORBACK ) { - status = Xw_redraw_buffer(pwindow,pbuffer) ; - if( !pbuffer->isretain && (QGTYPE(pbuffer->code) == XW_ENABLE) ) { - if( _NWBUFFER > 0 ) { - XCopyArea(_DISPLAY,_BWBUFFER,_FWBUFFER, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } else if( _PIXMAP ) { - XCopyArea(_DISPLAY,_PIXMAP,_WINDOW, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } - XFlush(_DISPLAY) ; - } - } - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_erase_buffer(%lx,%d)\n",(long ) pwindow,bufferid) ; - } -#endif - return status ; -} - -/* - XW_STATUS Xw_clear_buffer (awindow,bufferid) - XW_EXT_WINDOW *awindow - int bufferid - - Erase and Clear one retain buffer of primitives from screen - - Returns ERROR if the extended window address is badly defined - or Buffer is empty - or Buffer is not opened - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_clear_buffer (void* awindow,int bufferid) -#else -XW_STATUS Xw_clear_buffer (awindow,bufferid) -void *awindow; -int bufferid ; -#endif /*PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -XW_EXT_IMAGE *pimaglist ; -XW_EXT_POLY *ppolylist ; -XW_EXT_LINE *plinelist ; -XW_EXT_SEGMENT *pseglist ; -XW_EXT_LTEXT *pltextlist ; -XW_EXT_PTEXT *pptextlist ; -XW_EXT_ARC *parclist ; -XW_EXT_PMARKER *ppmarklist ; -XW_EXT_LMARKER *plmarklist ; -XW_EXT_POINT *ppntlist ; -XW_EXT_POINT *plinedesc ; -XW_EXT_CHAR *ptextdesc ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_clear_buffer",pwindow) ; - return (XW_ERROR) ; - } - - if( bufferid > 0 ) { - pbuffer = Xw_get_buffer_structure(pwindow,bufferid) ; - if( !pbuffer ) { - /*ERROR*BUFFER is not opened*/ - Xw_set_error(119,"Xw_clear_buffer",&bufferid) ; - return (XW_ERROR) ; - } - } else { - pbuffer = &_BUFFER(-bufferid) ; - if( !pbuffer->bufferid ) { - /*ERROR*BUFFER is not opened*/ - return (XW_SUCCESS) ; - } - } - - if( pbuffer->isempty ) return XW_ERROR ; - - if( pbuffer->isdrawn ) Xw_erase_buffer(pwindow,bufferid) ; - - pbuffer->isempty = True ; - pbuffer->isupdated = UNKNOWN_BUFFER ; - pbuffer->rxmin = _WIDTH ; - pbuffer->rymin = _HEIGHT ; - pbuffer->rxmax = 0 ; - pbuffer->rymax = 0 ; - pbuffer->xscale = 1. ; - pbuffer->dxscale = 1. ; - pbuffer->yscale = 1. ; - pbuffer->dyscale = 1. ; - pbuffer->angle = 0. ; - pbuffer->dangle = 0. ; - pbuffer->dxpivot = 0 ; - pbuffer->dypivot = 0 ; - - for( pimaglist = pbuffer->pimaglist ; pimaglist ; - pimaglist = (XW_EXT_IMAGE*)pimaglist->link ) { - if( pimaglist->nimage > 0 ) { - pimaglist->isupdated = False ; - pimaglist->nimage = 0 ; - } else break ; - } - - for( ppolylist = pbuffer->ppolylist ; ppolylist ; - ppolylist = (XW_EXT_POLY*)ppolylist->link ) { - if( ppolylist->npoly > 0 ) { - ppolylist->isupdated = False ; - ppolylist->npoly = 0 ; - } else break ; - } - - for( parclist = pbuffer->pparclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - parclist->isupdated = False ; - parclist->narc = 0 ; - } else break ; - } - - for( pseglist = pbuffer->pseglist ; pseglist ; - pseglist = (XW_EXT_SEGMENT*)pseglist->link ) { - if( pseglist->nseg > 0 ) { - pseglist->isupdated = False ; - pseglist->nseg = 0 ; - } else break ; - } - - for( plinelist = pbuffer->plinelist ; plinelist ; - plinelist = (XW_EXT_LINE*)plinelist->link ) { - if( plinelist->nline > 0 ) { - plinelist->isupdated = False ; - plinelist->nline = 0 ; - } else break ; - } - - for( parclist = pbuffer->plarclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - parclist->isupdated = False ; - parclist->narc = 0 ; - } else break ; - } - - for( pltextlist = pbuffer->pltextlist ; pltextlist ; - pltextlist = (XW_EXT_LTEXT*)pltextlist->link ) { - if( pltextlist->ntext > 0 ) { - pltextlist->isupdated = False ; - pltextlist->ntext = 0 ; - } else break ; - } - - for( pptextlist = pbuffer->pptextlist ; pptextlist ; - pptextlist = (XW_EXT_PTEXT*)pptextlist->link ) { - if( pptextlist->ntext > 0 ) { - pptextlist->isupdated = False ; - pptextlist->ntext = 0 ; - } else break ; - } - - for( ppmarklist = pbuffer->ppmarklist ; ppmarklist ; - ppmarklist = (XW_EXT_PMARKER*)ppmarklist->link ) { - if( ppmarklist->nmark > 0 ) { - ppmarklist->isupdated = False ; - ppmarklist->nmark = 0 ; - ppmarklist->npoint = 0 ; - } else break ; - } - - for( plmarklist = pbuffer->plmarklist ; plmarklist ; - plmarklist = (XW_EXT_LMARKER*)plmarklist->link ) { - if( plmarklist->nmark > 0 ) { - plmarklist->isupdated = False ; - plmarklist->nmark = 0 ; - plmarklist->nseg = 0 ; - } else break ; - } - - for( ppntlist = pbuffer->ppntlist ; ppntlist ; - ppntlist = (XW_EXT_POINT*)ppntlist->link ) { - if( ppntlist->npoint > 0 ) { - ppntlist->isupdated = False ; - ppntlist->npoint = 0 ; - } else break ; - } - - for( plinedesc = pbuffer->plinedesc ; plinedesc ; - plinedesc = (XW_EXT_POINT*)plinedesc->link ) { - if( plinedesc->npoint > 0 ) { - plinedesc->isupdated = False ; - plinedesc->npoint = 0 ; - } else break ; - } - - for( ptextdesc = pbuffer->ptextdesc ; ptextdesc ; - ptextdesc = (XW_EXT_CHAR*)ptextdesc->link ) { - if( ptextdesc->nchar > 0 ) { - ptextdesc->nchar = 0 ; - } else break ; - } - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_clear_buffer(%lx,%d)\n",(long ) pwindow,bufferid) ; - } -#endif - - return (XW_SUCCESS); -} - -/* - XW_STATUS Xw_open_buffer - (awindow,bufferid,xpivot,ypivot,width,color,font,drawmode) - XW_EXT_WINDOW *awindow - int bufferid - float xpivot,ypivot buffer hit point - int widthindex - int colorindex - int fontindex - XW_DRAWMODE drawmode - - Open one retain buffer - - Returns ERROR if the extended window address is badly defined - or Buffer identification is <= 0 - Returns SUCCESS if successful - - Note that if the buffer is already opened,this is reset with the - new hit point. - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_open_buffer - (void* awindow,int bufferid,float xpivot,float ypivot, - int width,int color,int font,XW_DRAWMODE drawmode) -#else -XW_STATUS Xw_open_buffer - (awindow,bufferid,xpivot,ypivot,width,color,font,drawmode) -void *awindow; -int bufferid ; -float xpivot,ypivot ; -int width ; -int color ; -int font ; -XW_DRAWMODE drawmode ; -#endif /*PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -XGCValues gc_values ; -//XFontStruct *pfontinfo ; -int i,mask = 0 ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_open_buffer",pwindow) ; - return (XW_ERROR) ; - } - - if( bufferid <= 0 ) { - /*ERROR*Bad BUFFER identification*/ - Xw_set_error(122,"Xw_open_buffer",&bufferid) ; - return (XW_ERROR) ; - } - - if( drawmode != XW_REPLACE && drawmode != XW_XORBACK ) { - /*ERROR*Bad Buffer drawing mode*/ - Xw_set_error(125,"Xw_open_buffer",&drawmode) ; - drawmode = XW_XORBACK ; - } - - if ( !Xw_isdefine_width(_WIDTHMAP,width) ) { - /*ERROR*Bad Defined Width*/ - Xw_set_error(52,"Xw_open_buffer",&width) ; - width = 0 ; - } - - if ( !Xw_isdefine_color(_COLORMAP,color) ) { - /*ERROR*Bad Defined Color*/ - Xw_set_error(41,"Xw_open_buffer",&color) ; - color = 0 ; - } - - if ( !Xw_isdefine_font(_FONTMAP,font) ) { - /*WARNING*Bad Defined Font*/ - Xw_set_error(43,"Xw_open_buffer",&font) ; - font = 0 ; - } - - pbuffer = Xw_get_buffer_structure(pwindow,bufferid) ; - if( pbuffer ) { - /*ERROR*BUFFER is already opened - Xw_set_error(120,"Xw_open_buffer",&bufferid) ; -*/ - if( pbuffer->isdrawn ) { - Xw_erase_buffer(pwindow,bufferid) ; - } - } else { - for( i=1 ; ibufferid = bufferid; - pbuffer->gcf = XCreateGC(_DISPLAY,_WINDOW, 0, NULL) ; - pbuffer->gcb = XCreateGC(_DISPLAY,_WINDOW, 0, NULL) ; - } - -//OCC186 - pbuffer->xpivot = PXPOINT(xpivot, pwindow->xratio) ; - pbuffer->ypivot = PYPOINT(ypivot, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 - - mask = GCFont | GCFunction | GCForeground | GCBackground ; - mask |= GCLineWidth ; - XGetGCValues(_DISPLAY,pwindow->qgwind.gccopy,mask,&gc_values) ; - pbuffer->code = 0 ; - if( width > 0 ) { -#ifdef BUG /* Conflicting with SETFONT */ - pbuffer->code = QGSETWIDTH(pbuffer->code,width) ; -#endif - gc_values.line_width = _WIDTHMAP->widths[width] ; - /* gc_values.line_style = LineSolid ; */ - } - if( color > 0 ) { - pbuffer->code = QGSETCOLOR(pbuffer->code,color) ; - gc_values.foreground = _COLORMAP->pixels[color] ; - } - if( font >= 0 ) { - pbuffer->code = QGSETFONT(pbuffer->code,font) ; - gc_values.font = _FONTMAP->fonts[font]->fid ; - } - if( drawmode == XW_REPLACE ) { - pbuffer->code = QGSETMODE(pbuffer->code,XW_REPLACE) ; - gc_values.function = GXcopy ; - } else if( drawmode == XW_XORBACK ) { - pbuffer->code = QGSETMODE(pbuffer->code,XW_XORBACK) ; - gc_values.function = GXxor ; - gc_values.foreground ^= gc_values.background ; - } - XChangeGC(_DISPLAY,pbuffer->gcf,mask,&gc_values) ; - gc_values.function = GXcopy ; - gc_values.foreground = gc_values.background ; - XChangeGC(_DISPLAY,pbuffer->gcb,mask,&gc_values) ; - -#ifdef CTS50025 - Xw_set_text_attrib (pwindow,color,0,font,XW_REPLACE); -#endif - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_open_buffer(%lx,%d,%f,%f)\n", - (long ) pwindow,bufferid,xpivot,ypivot) ; - } -#endif - return (XW_SUCCESS); -} - -/* - XW_STATUS Xw_close_buffer (awindow,bufferid) - XW_EXT_WINDOW *awindow - int bufferid - - Close the retain buffer - - Returns ERROR if the extended window address is badly defined - or Buffer is not opened - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_buffer (void* awindow,int bufferid) -#else -XW_STATUS Xw_close_buffer (awindow,bufferid) -void *awindow; -int bufferid ; -#endif /*PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -//int i ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_close_buffer",pwindow) ; - return (XW_ERROR) ; - } - - if( bufferid > 0 ) { - pbuffer = Xw_get_buffer_structure(pwindow,bufferid) ; - if( !pbuffer ) { - /*ERROR*BUFFER is not opened*/ - Xw_set_error(119,"Xw_close_buffer",&bufferid) ; - return (XW_ERROR) ; - } - } else if( bufferid < 0 ) { - pbuffer = &_BUFFER(-bufferid) ; - if( !pbuffer->bufferid ) { - /*ERROR*BUFFER is not opened*/ - return (XW_SUCCESS) ; - } - } else { - pbuffer = &_BUFFER(0) ; - } - - if( !pbuffer->isempty ) { - Xw_clear_buffer(pwindow,bufferid) ; - } - - if( pbuffer->gcf ) { - XFreeGC(_DISPLAY,pbuffer->gcf) ; - pbuffer->gcf = NULL ; - } - if( pbuffer->gcb ) { - XFreeGC(_DISPLAY,pbuffer->gcb) ; - pbuffer->gcb = NULL ; - } - pbuffer->code = 0 ; - pbuffer->bufferid = 0; - Xw_del_text_desc_structure(pbuffer) ; - Xw_del_line_desc_structure(pbuffer) ; - Xw_del_image_structure(pbuffer) ; - Xw_del_point_structure(pbuffer) ; - Xw_del_segment_structure(pbuffer) ; - Xw_del_polyline_structure(pbuffer) ; - Xw_del_arc_structure(pbuffer) ; - Xw_del_polyarc_structure(pbuffer) ; - Xw_del_polygone_structure(pbuffer) ; - Xw_del_text_structure(pbuffer) ; - Xw_del_polytext_structure(pbuffer) ; - Xw_del_lmarker_structure(pbuffer) ; - Xw_del_pmarker_structure(pbuffer) ; - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_close_buffer(%lx,%d)\n",(long ) pwindow,bufferid) ; - } -#endif - return (XW_SUCCESS); -} - -/* - XW_STATUS Xw_set_buffer (awindow,bufferid) - XW_EXT_WINDOW *awindow - int bufferid - - Activate the retain buffer for drawing - - Returns ERROR if the extended window address is badly defined - or Buffer is not opened - Returns SUCCESS if successful - -*/ -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_buffer (void* awindow,int bufferid) -#else -XW_STATUS Xw_set_buffer (awindow,bufferid) -void *awindow; -int bufferid ; -#endif /*PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -int i ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_buffer",pwindow) ; - return (XW_ERROR) ; - } - - if( bufferid > 0 ) { - for( i=1 ; ibufferid ) break ; - } - if( i < MAXBUFFERS ) { - _BINDEX = i ; - if( QGMODE(pbuffer->code) == XW_REPLACE ) { - pbuffer->code = QGSETTYPE(pbuffer->code,XW_DISABLE) ; - } else { - if( _PIXMAP || _NWBUFFER > 0 ) { - pbuffer->code = QGSETTYPE(pbuffer->code,XW_ENABLE) ; - } else { - pbuffer->code = QGSETTYPE(pbuffer->code,XW_DISABLE) ; - } - } - } else { - /*ERROR*BUFFER is not opened*/ - Xw_set_error(119,"Xw_set_buffer",&bufferid) ; - return (XW_ERROR) ; - } - } else { - _BINDEX = 0 ; - } - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_set_buffer(%lx,%d)\n",(long ) pwindow,bufferid) ; - } -#endif - return (XW_SUCCESS); -} - -/* - XW_STATUS Xw_get_buffer_status (awindow,bufferid,isopen,isdrawn,isempty) - XW_EXT_WINDOW *awindow - int bufferid - int *isopen - int *isdrawn - int *isempty - - Get the status info of one retain buffer - - Returns ERROR if the extended window address is badly defined - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_buffer_status (void* awindow,int bufferid,int* isopen,int* isdrawn,int* isempty) -#else -XW_STATUS Xw_get_buffer_status (awindow,bufferid,isopen,isdrawn,isempty) -void *awindow; -int bufferid ; -int* isopen; -int* isdrawn; -int* isempty; -#endif /*PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_BUFFER *pbuffer ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_buffer_status",pwindow) ; - return (XW_ERROR) ; - } - - pbuffer = Xw_get_buffer_structure(pwindow,bufferid) ; - - *isopen = *isdrawn = *isempty = False ; - - if( pbuffer ) { - *isopen = True ; - *isdrawn = pbuffer->isdrawn ; - *isempty = pbuffer->isempty ; - } - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_get_buffer_status(%lx,%d,%d,%d,%d)\n", - (long ) pwindow,bufferid,*isopen,*isdrawn,*isempty) ; - } -#endif - return (XW_SUCCESS); - -} - -/* - XW_STATUS Xw_get_buffer_info (awindow,bufferid,xpivot,ypivot,xscale,yscale,angle) - XW_EXT_WINDOW *awindow - int bufferid - float *xpivot returned buffer position - float *ypivot returned buffer position - float *xscale returned buffer scale - float *yscale returned buffer scale - float *angle returned buffer orientation - - Get the transform infos of one retain buffer - - Returns ERROR if the extended window address is badly defined - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_buffer_info (void* awindow,int bufferid,float *xpivot,float *ypivot,float *xscale,float *yscale,float *angle) -#else -XW_STATUS Xw_get_buffer_info (awindow,bufferid,xpivot,ypivot,xscale,yscale,angle) -void *awindow; -int bufferid ; -float *xpivot,*ypivot ; -float *xscale,*yscale ; -float *angle ; -#endif /*PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_BUFFER *pbuffer ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_buffer_info",pwindow) ; - return (XW_ERROR) ; - } - - pbuffer = Xw_get_buffer_structure(pwindow,bufferid) ; - if( !pbuffer ) { - /*ERROR*BUFFER is not opened*/ - Xw_set_error(119,"Xw_get_buffer_info",&bufferid) ; - return (XW_ERROR) ; - } - - *xpivot = UXPOINT(pbuffer->xpivot+pbuffer->dxpivot) ; - *ypivot = UYPOINT(pbuffer->ypivot+pbuffer->dypivot) ; - *xscale = pbuffer->xscale*pbuffer->dxscale ; - *yscale = pbuffer->yscale*pbuffer->dyscale ; - *angle = pbuffer->angle+pbuffer->dangle ; - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_get_buffer_info(%lx,%d,%f,%f,%f,%f,%f)\n", - (long ) pwindow,bufferid,*xpivot,*ypivot,*xscale,*yscale,*angle) ; - } -#endif - return (XW_SUCCESS); - -} - -#ifdef XW_PROTOTYPE -XW_EXT_BUFFER* Xw_get_buffer_structure(XW_EXT_WINDOW *pwindow,int bufferid) -#else -XW_EXT_BUFFER* Xw_get_buffer_structure(pwindow,bufferid) -XW_EXT_WINDOW *pwindow; -int bufferid; -#endif /*XW_PROTOTYPE*/ -{ -int i ; - - if( bufferid <= 0 ) return NULL ; - - for( i=1 ; iisupdated ) return XW_ERROR ; - - for( pimaglist = pbuffer->pimaglist ; pimaglist ; - pimaglist = (XW_EXT_IMAGE*)pimaglist->link ) { - if( pimaglist->nimage > 0 ) { - pimaglist->isupdated = False ; - for( i=0 ; inimage ; i++ ) { - pimaglist->rpoints[i].x = pimaglist->upoints[i].x ; - pimaglist->rpoints[i].y = pimaglist->upoints[i].y ; - } - } else break ; - } - - for( parclist = pbuffer->pparclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - parclist->isupdated = False ; - for( i=0 ; inarc ; i++ ) { - parclist->rarcs[i].x = parclist->uarcs[i].x ; - parclist->rarcs[i].y = parclist->uarcs[i].y ; - parclist->rarcs[i].width = parclist->uarcs[i].width ; - parclist->rarcs[i].height = parclist->uarcs[i].height ; - parclist->rarcs[i].angle1 = parclist->uarcs[i].angle1 ; - parclist->rarcs[i].angle2 = parclist->uarcs[i].angle2 ; - - } - } else break ; - } - - for( pseglist = pbuffer->pseglist ; pseglist ; - pseglist = (XW_EXT_SEGMENT*)pseglist->link ) { - if( pseglist->nseg > 0 ) { - pseglist->isupdated = False ; - for( i=0 ; inseg ; i++ ) { - pseglist->rsegments[i].x1 = pseglist->usegments[i].x1 ; - pseglist->rsegments[i].y1 = pseglist->usegments[i].y1 ; - pseglist->rsegments[i].x2 = pseglist->usegments[i].x2 ; - pseglist->rsegments[i].y2 = pseglist->usegments[i].y2 ; - } - } else break ; - } - - for( parclist = pbuffer->plarclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - parclist->isupdated = False ; - for( i=0 ; inarc ; i++ ) { - parclist->rarcs[i].x = parclist->uarcs[i].x ; - parclist->rarcs[i].y = parclist->uarcs[i].y ; - parclist->rarcs[i].width = parclist->uarcs[i].width ; - parclist->rarcs[i].height = parclist->uarcs[i].height ; - parclist->rarcs[i].angle1 = parclist->uarcs[i].angle1 ; - parclist->rarcs[i].angle2 = parclist->uarcs[i].angle2 ; - } - } else break ; - } - - for( pltextlist = pbuffer->pltextlist ; pltextlist ; - pltextlist = (XW_EXT_LTEXT*)pltextlist->link ) { - if( pltextlist->ntext > 0 ) { - pltextlist->isupdated = False ; - for( i=0 ; intext ; i++ ) { - pltextlist->rpoints[i].x = pltextlist->upoints[i].x ; - pltextlist->rpoints[i].y = pltextlist->upoints[i].y ; - pltextlist->rangles[i] = pltextlist->uangles[i] ; - pltextlist->rscalex[i] = pltextlist->uscalex[i] ; - pltextlist->rscaley[i] = pltextlist->uscaley[i] ; - } - } else break ; - } - - for( pptextlist = pbuffer->pptextlist ; pptextlist ; - pptextlist = (XW_EXT_PTEXT*)pptextlist->link ) { - if( pptextlist->ntext > 0 ) { - pptextlist->isupdated = False ; - for( i=0 ; intext ; i++ ) { - pptextlist->rpoints[i].x = pptextlist->upoints[i].x ; - pptextlist->rpoints[i].y = pptextlist->upoints[i].y ; - pptextlist->rangles[i] = pptextlist->uangles[i] ; - pptextlist->rscalex[i] = pptextlist->uscalex[i] ; - pptextlist->rscaley[i] = pptextlist->uscaley[i] ; - } - } else break ; - } - - for( ppmarklist = pbuffer->ppmarklist ; ppmarklist ; - ppmarklist = (XW_EXT_PMARKER*)ppmarklist->link ) { - if( ppmarklist->nmark > 0 ) { - ppmarklist->isupdated = False ; - for( i=0 ; inmark ; i++ ) { - ppmarklist->rcenters[i].x = ppmarklist->ucenters[i].x ; - ppmarklist->rcenters[i].y = ppmarklist->ucenters[i].y ; - } - for( i=0 ; inpoint ; i++ ) { - ppmarklist->rpoints[i].x = ppmarklist->upoints[i].x ; - ppmarklist->rpoints[i].y = ppmarklist->upoints[i].y ; - } - } else break ; - } - - for( plmarklist = pbuffer->plmarklist ; plmarklist ; - plmarklist = (XW_EXT_LMARKER*)plmarklist->link ) { - if( plmarklist->nmark > 0 ) { - plmarklist->isupdated = False ; - for( i=0 ; inmark ; i++ ) { - plmarklist->rcenters[i].x = plmarklist->ucenters[i].x ; - plmarklist->rcenters[i].y = plmarklist->ucenters[i].y ; - } - for( i=0 ; inseg ; i++ ) { - plmarklist->rsegments[i].x1 = plmarklist->usegments[i].x1 ; - plmarklist->rsegments[i].y1 = plmarklist->usegments[i].y1 ; - plmarklist->rsegments[i].x2 = plmarklist->usegments[i].x2 ; - plmarklist->rsegments[i].y2 = plmarklist->usegments[i].y2 ; - } - } else break ; - } - - for( ppntlist = pbuffer->ppntlist ; ppntlist ; - ppntlist = (XW_EXT_POINT*)ppntlist->link ) { - if( ppntlist->npoint > 0 ) { - ppntlist->isupdated = False ; - for( i=0 ; inpoint ; i++ ) { - ppntlist->rpoints[i].x = ppntlist->upoints[i].x ; - ppntlist->rpoints[i].y = ppntlist->upoints[i].y ; - } - } else break ; - } - - for( ppolylist = pbuffer->ppolylist ; ppolylist ; - ppolylist = (XW_EXT_POLY*)ppolylist->link ) { - if( ppolylist->npoly > 0 ) { - ppolylist->isupdated = False ; - } else break ; - } - - for( plinelist = pbuffer->plinelist ; plinelist ; - plinelist = (XW_EXT_LINE*)plinelist->link ) { - if( plinelist->nline > 0 ) { - plinelist->isupdated = False ; - } else break ; - } - - for( plinedesc = pbuffer->plinedesc ; plinedesc ; - plinedesc = (XW_EXT_POINT*)plinedesc->link ) { - if( plinedesc->npoint > 0 ) { - plinedesc->isupdated = False ; - for( i=0 ; inpoint ; i++ ) { - plinedesc->rpoints[i].x = plinedesc->upoints[i].x ; - plinedesc->rpoints[i].y = plinedesc->upoints[i].y ; - } - } else break ; - } - - pbuffer->xpivot += pbuffer->dxpivot ; - pbuffer->ypivot += pbuffer->dypivot ; - pbuffer->dxpivot = pbuffer->dypivot = 0 ; - - pbuffer->angle += pbuffer->dangle ; - pbuffer->dangle = 0. ; - - pbuffer->xscale *= pbuffer->dxscale ; - pbuffer->yscale *= pbuffer->dyscale ; - pbuffer->dxscale = pbuffer->dyscale = 1. ; - - pbuffer->rxmin = pbuffer->uxmin ; - pbuffer->rymin = pbuffer->uymin ; - pbuffer->rxmax = pbuffer->uxmax ; - pbuffer->rymax = pbuffer->uymax ; - - pbuffer->isupdated = UNKNOWN_BUFFER ; - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_update_buffer(%lx,%d)\n",(long ) pwindow,pbuffer->bufferid) ; - } -#endif - - return (XW_SUCCESS); -} - -/* - STATUS Xw_move_buffer (awindow,bufferid,xpivot,ypivot) - XW_EXT_WINDOW *awindow - int bufferid - float xpivot,ypivot new DWU pivot point location - - Move & display one retain buffer of primitives at screen - - Returns ERROR if the extended window address is badly defined - or Buffer is empty - or Buffer is not opened - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_move_buffer (void* awindow,int bufferid,float pivotx,float pivoty) -#else -XW_STATUS Xw_move_buffer (awindow,bufferid,pivotx,pivoty) -void *awindow; -int bufferid; -float pivotx,pivoty; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -XW_EXT_IMAGE *pimaglist ; -XW_EXT_POLY *ppolylist ; -XW_EXT_LINE *plinelist ; -XW_EXT_SEGMENT *pseglist ; -XW_EXT_LTEXT *pltextlist ; -XW_EXT_PTEXT *pptextlist ; -XW_EXT_ARC *parclist ; -XW_EXT_PMARKER *ppmarklist ; -XW_EXT_LMARKER *plmarklist ; -XW_EXT_POINT *ppntlist ; -XW_EXT_POINT *plinedesc ; -int i,dx,dy,xpivot,ypivot ; -int rxmin,rymin,rxmax,rymax ; -int uxmin,uymin,uxmax,uymax ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_move_buffer",pwindow) ; - return (XW_ERROR) ; - } - - pbuffer = Xw_get_buffer_structure(pwindow,bufferid) ; - if( !pbuffer ) { - /*ERROR*BUFFER is not opened*/ - Xw_set_error(119,"Xw_move_buffer",&bufferid) ; - return (XW_ERROR) ; - } - - if( pbuffer->isempty ) return XW_ERROR ; - - pbuffer->isretain = True ; - if( pbuffer->isdrawn ) { - Xw_erase_buffer(pwindow,bufferid) ; - } - - if( pbuffer->isupdated != MOVE_BUFFER ) { - if( pbuffer->isupdated ) Xw_update_buffer(pwindow,pbuffer) ; - } - -//OCC186 - xpivot = PXPOINT(pivotx, pwindow->xratio) ; - ypivot = PYPOINT(pivoty, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 - - dx = xpivot - pbuffer->xpivot ; - dy = ypivot - pbuffer->ypivot ; - - rxmin = pbuffer->rxmin ; - rymin = pbuffer->rymin ; - rxmax = pbuffer->rxmax ; - rymax = pbuffer->rymax ; - - if( pbuffer->isupdated ) { - uxmin = pbuffer->uxmin ; - uymin = pbuffer->uymin ; - uxmax = pbuffer->uxmax ; - uymax = pbuffer->uymax ; - } else { - uxmin = rxmin ; uymin = rymin ; - uxmax = rxmax ; uymax = rymax ; - } - - if( dx || dy ) { - - for( pimaglist = pbuffer->pimaglist ; pimaglist ; - pimaglist = (XW_EXT_IMAGE*)pimaglist->link ) { - if( pimaglist->nimage > 0 ) { - pimaglist->isupdated = True ; - for( i=0 ; inimage ; i++ ) { - pimaglist->upoints[i].x = pimaglist->rpoints[i].x + dx ; - pimaglist->upoints[i].y = pimaglist->rpoints[i].y + dy ; - } - } else break ; - } - - for( parclist = pbuffer->pparclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - parclist->isupdated = True ; - for( i=0 ; inarc ; i++ ) { - parclist->uarcs[i].x = parclist->rarcs[i].x + dx ; - parclist->uarcs[i].y = parclist->rarcs[i].y + dy ; - parclist->uarcs[i].width = parclist->rarcs[i].width ; - parclist->uarcs[i].height = parclist->rarcs[i].height ; - parclist->uarcs[i].angle1 = parclist->rarcs[i].angle1 ; - parclist->uarcs[i].angle2 = parclist->rarcs[i].angle2 ; - - } - } else break ; - } - - for( pseglist = pbuffer->pseglist ; pseglist ; - pseglist = (XW_EXT_SEGMENT*)pseglist->link ) { - if( pseglist->nseg > 0 ) { - pseglist->isupdated = True ; - for( i=0 ; inseg ; i++ ) { - pseglist->usegments[i].x1 = pseglist->rsegments[i].x1 + dx ; - pseglist->usegments[i].y1 = pseglist->rsegments[i].y1 + dy ; - pseglist->usegments[i].x2 = pseglist->rsegments[i].x2 + dx ; - pseglist->usegments[i].y2 = pseglist->rsegments[i].y2 + dy ; - } - } else break ; - } - - for( parclist = pbuffer->plarclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - parclist->isupdated = True ; - for( i=0 ; inarc ; i++ ) { - parclist->uarcs[i].x = parclist->rarcs[i].x + dx ; - parclist->uarcs[i].y = parclist->rarcs[i].y + dy ; - parclist->uarcs[i].width = parclist->rarcs[i].width ; - parclist->uarcs[i].height = parclist->rarcs[i].height ; - parclist->uarcs[i].angle1 = parclist->rarcs[i].angle1 ; - parclist->uarcs[i].angle2 = parclist->rarcs[i].angle2 ; - } - } else break ; - } - - for( pltextlist = pbuffer->pltextlist ; pltextlist ; - pltextlist = (XW_EXT_LTEXT*)pltextlist->link ) { - if( pltextlist->ntext > 0 ) { - pltextlist->isupdated = True ; - for( i=0 ; intext ; i++ ) { - pltextlist->upoints[i].x = pltextlist->rpoints[i].x + dx ; - pltextlist->upoints[i].y = pltextlist->rpoints[i].y + dy ; - pltextlist->uangles[i] = pltextlist->rangles[i] ; - pltextlist->uscalex[i] = pltextlist->rscalex[i] ; - pltextlist->uscaley[i] = pltextlist->rscaley[i] ; - } - } else break ; - } - - for( pptextlist = pbuffer->pptextlist ; pptextlist ; - pptextlist = (XW_EXT_PTEXT*)pptextlist->link ) { - if( pptextlist->ntext > 0 ) { - pptextlist->isupdated = True ; - for( i=0 ; intext ; i++ ) { - pptextlist->upoints[i].x = pptextlist->rpoints[i].x + dx ; - pptextlist->upoints[i].y = pptextlist->rpoints[i].y + dy ; - pptextlist->uangles[i] = pptextlist->rangles[i] ; - pptextlist->uscalex[i] = pptextlist->rscalex[i] ; - pptextlist->uscaley[i] = pptextlist->rscaley[i] ; - } - } else break ; - } - - for( ppmarklist = pbuffer->ppmarklist ; ppmarklist ; - ppmarklist = (XW_EXT_PMARKER*)ppmarklist->link ) { - if( ppmarklist->nmark > 0 ) { - ppmarklist->isupdated = True ; - for( i=0 ; inmark ; i++ ) { - ppmarklist->ucenters[i].x = ppmarklist->rcenters[i].x + dx ; - ppmarklist->ucenters[i].y = ppmarklist->rcenters[i].y + dy ; - } - for( i=0 ; inpoint ; i++ ) { - ppmarklist->upoints[i].x = ppmarklist->rpoints[i].x + dx ; - ppmarklist->upoints[i].y = ppmarklist->rpoints[i].y + dy ; - } - } else break ; - } - - for( plmarklist = pbuffer->plmarklist ; plmarklist ; - plmarklist = (XW_EXT_LMARKER*)plmarklist->link ) { - if( plmarklist->nmark > 0 ) { - plmarklist->isupdated = True ; - for( i=0 ; inmark ; i++ ) { - plmarklist->ucenters[i].x = plmarklist->rcenters[i].x + dx ; - plmarklist->ucenters[i].y = plmarklist->rcenters[i].y + dy ; - } - for( i=0 ; inseg ; i++ ) { - plmarklist->usegments[i].x1 = plmarklist->rsegments[i].x1 + dx ; - plmarklist->usegments[i].y1 = plmarklist->rsegments[i].y1 + dy ; - plmarklist->usegments[i].x2 = plmarklist->rsegments[i].x2 + dx ; - plmarklist->usegments[i].y2 = plmarklist->rsegments[i].y2 + dy ; - } - } else break ; - } - - for( ppntlist = pbuffer->ppntlist ; ppntlist ; - ppntlist = (XW_EXT_POINT*)ppntlist->link ) { - if( ppntlist->npoint > 0 ) { - ppntlist->isupdated = True ; - for( i=0 ; inpoint ; i++ ) { - ppntlist->upoints[i].x = ppntlist->rpoints[i].x + dx ; - ppntlist->upoints[i].y = ppntlist->rpoints[i].y + dy ; - } - } else break ; - } - - for( ppolylist = pbuffer->ppolylist ; ppolylist ; - ppolylist = (XW_EXT_POLY*)ppolylist->link ) { - if( ppolylist->npoly > 0 ) { - ppolylist->isupdated = True ; - } else break ; - } - - for( plinelist = pbuffer->plinelist ; plinelist ; - plinelist = (XW_EXT_LINE*)plinelist->link ) { - if( plinelist->nline > 0 ) { - plinelist->isupdated = True ; - } else break ; - } - - for( plinedesc = pbuffer->plinedesc ; plinedesc ; - plinedesc = (XW_EXT_POINT*)plinedesc->link ) { - if( plinedesc->npoint > 0 ) { - plinedesc->isupdated = True ; - for( i=0 ; inpoint ; i++ ) { - plinedesc->upoints[i].x = plinedesc->rpoints[i].x + dx ; - plinedesc->upoints[i].y = plinedesc->rpoints[i].y + dy ; - } - } else break ; - } - - pbuffer->dxpivot = dx ; - pbuffer->dypivot = dy ; - - pbuffer->uxmin = pbuffer->rxmin + dx ; - pbuffer->uymin = pbuffer->rymin + dy ; - pbuffer->uxmax = pbuffer->rxmax + dx ; - pbuffer->uymax = pbuffer->rymax + dy ; - - uxmin = min(uxmin,pbuffer->uxmin) ; - uymin = min(uymin,pbuffer->uymin) ; - uxmax = max(uxmax,pbuffer->uxmax) ; - uymax = max(uymax,pbuffer->uymax) ; - - pbuffer->isupdated = MOVE_BUFFER ; - - } - - Xw_draw_buffer(pwindow,bufferid) ; - - if( QGTYPE(pbuffer->code) == XW_ENABLE ) { - int x = uxmin - 1 ; - int y = uymin - 1 ; - int w = uxmax - x + 1 ; - int h = uymax - y + 1 ; - - if( x < 0 ) x = 0 ; - if( y < 0 ) y = 0 ; - if( x+w > _WIDTH ) w = _WIDTH - x ; - if( y+h > _HEIGHT ) h = _HEIGHT - y ; - - if( _NWBUFFER > 0 ) { - XCopyArea(_DISPLAY,_BWBUFFER,_FWBUFFER, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } else if( _PIXMAP ) { - XCopyArea(_DISPLAY,_PIXMAP,_WINDOW, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } - XFlush(_DISPLAY) ; - } - pbuffer->isretain = False ; - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_move_buffer(%lx,%d,%d,%d)\n", - (long ) pwindow,bufferid,xpivot,ypivot) ; - } -#endif - - return (XW_SUCCESS); -} - -/* - STATUS Xw_rotate_buffer (awindow,bufferid,angle) - XW_EXT_WINDOW *awindow - int bufferid - float angle Last orientation since the creation time - - Rotate & display one retain buffer of primitives at screen - - Returns ERROR if the extended window address is badly defined - or Buffer is empty - or Buffer is not opened - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_rotate_buffer (void* awindow,int bufferid,float angle) -#else -XW_STATUS Xw_rotate_buffer (awindow,bufferid,angle) -void *awindow; -int bufferid; -float angle; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -XW_EXT_IMAGE *pimaglist ; -XW_EXT_POLY *ppolylist ; -XW_EXT_LINE *plinelist ; -XW_EXT_SEGMENT *pseglist ; -XW_EXT_LTEXT *pltextlist ; -XW_EXT_PTEXT *pptextlist ; -XW_EXT_ARC *parclist ; -XW_EXT_PMARKER *ppmarklist ; -XW_EXT_LMARKER *plmarklist ; -XW_EXT_POINT *ppntlist ; -XW_EXT_POINT *plinedesc ; -int i,j,n,x,y,dx,dy,xp,yp,angle1 ; -int rxmin,rymin,rxmax,rymax ; -int uxmin,uymin,uxmax,uymax ; -float a,cosa,sina ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_rotate_buffer",pwindow) ; - return (XW_ERROR) ; - } - - pbuffer = Xw_get_buffer_structure(pwindow,bufferid) ; - if( !pbuffer ) { - /*ERROR*BUFFER is not opened*/ - Xw_set_error(119,"Xw_rotate_buffer",&bufferid) ; - return (XW_ERROR) ; - } - - if( pbuffer->isempty ) return XW_ERROR ; - - pbuffer->isretain = True ; - if( pbuffer->isdrawn ) { - Xw_erase_buffer(pwindow,bufferid) ; - } - - if( pbuffer->isupdated != ROTATE_BUFFER ) { - if( pbuffer->isupdated ) Xw_update_buffer(pwindow,pbuffer) ; - } - - xp = pbuffer->xpivot ; - yp = pbuffer->ypivot ; - - rxmin = pbuffer->rxmin ; - rymin = pbuffer->rymin ; - rxmax = pbuffer->rxmax ; - rymax = pbuffer->rymax ; - - if( pbuffer->isupdated ) { - uxmin = pbuffer->uxmin ; - uymin = pbuffer->uymin ; - uxmax = pbuffer->uxmax ; - uymax = pbuffer->uymax ; - } else { - uxmin = rxmin ; uymin = rymin ; - uxmax = rxmax ; uymax = rymax ; - } - - if( angle != pbuffer->dangle ) { - int dxmin = rxmin - xp ; - int dymin = rymin - yp ; - int dxmax = rxmax - xp ; - int dymax = rymax - yp ; - - cosa = cos((double)angle) ; - sina = sin((double)angle) ; - - for( pimaglist = pbuffer->pimaglist ; pimaglist ; - pimaglist = (XW_EXT_IMAGE*)pimaglist->link ) { - if( pimaglist->nimage > 0 ) { - pimaglist->isupdated = True ; - for( i=0 ; inimage ; i++ ) { - x = pimaglist->rpoints[i].x - xp ; - y = pimaglist->rpoints[i].y - yp ; - pimaglist->upoints[i].x = (short int )( xp + XROTATE(x,y) ); - pimaglist->upoints[i].y = (short int )( yp + YROTATE(x,y) ); - } - } else break ; - } - - for( parclist = pbuffer->pparclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - parclist->isupdated = True ; - for( i=0 ; inarc ; i++ ) { - x = parclist->rarcs[i].x + parclist->rarcs[i].width/2 - xp ; - y = parclist->rarcs[i].y + parclist->rarcs[i].height/2 - yp ; - parclist->uarcs[i].x = (short int )( xp + XROTATE(x,y) - - (int)parclist->rarcs[i].width/2 ); - parclist->uarcs[i].y = (short int )( yp + YROTATE(x,y) - - (int)parclist->rarcs[i].height/2 ); - angle1 = (int )( parclist->rarcs[i].angle1 + angle*64./DRAD ); - if( angle1 > 0 ) { - while( angle1 > MAXANGLE ) angle1 -= MAXANGLE ; - } else if( angle1 < 0 ) { - while( angle1 < -MAXANGLE ) angle1 += MAXANGLE ; - } - parclist->uarcs[i].angle1 = angle1 ; - parclist->uarcs[i].angle2 = parclist->rarcs[i].angle2 ; - } - } else break ; - } - - for( pseglist = pbuffer->pseglist ; pseglist ; - pseglist = (XW_EXT_SEGMENT*)pseglist->link ) { - if( pseglist->nseg > 0 ) { - pseglist->isupdated = True ; - for( i=0 ; inseg ; i++ ) { - x = pseglist->rsegments[i].x1 - xp ; - y = pseglist->rsegments[i].y1 - yp ; - pseglist->usegments[i].x1 = (short int )( xp + XROTATE(x,y) ); - pseglist->usegments[i].y1 = (short int )( yp + YROTATE(x,y) ); - x = pseglist->rsegments[i].x2 - xp ; - y = pseglist->rsegments[i].y2 - yp ; - pseglist->usegments[i].x2 = (short int )( xp + XROTATE(x,y) ); - pseglist->usegments[i].y2 = (short int )( yp + YROTATE(x,y) ); - } - } else break ; - } - - for( parclist = pbuffer->plarclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - parclist->isupdated = True ; - for( i=0 ; inarc ; i++ ) { - x = parclist->rarcs[i].x + parclist->rarcs[i].width/2 - xp ; - y = parclist->rarcs[i].y + parclist->rarcs[i].height/2 - yp ; - parclist->uarcs[i].x = (short int )( xp + XROTATE(x,y) - - (int)parclist->rarcs[i].width/2 ); - parclist->uarcs[i].y = (short int )( yp + YROTATE(x,y) - - (int)parclist->rarcs[i].height/2 ); - angle1 = (int )( parclist->rarcs[i].angle1 + angle*64./DRAD ); - if( angle1 > 0 ) { - while( angle1 > MAXANGLE ) angle1 -= MAXANGLE ; - } else if( angle1 < 0 ) { - while( angle1 < -MAXANGLE ) angle1 += MAXANGLE ; - } - parclist->uarcs[i].angle1 = angle1 ; - parclist->uarcs[i].angle2 = parclist->rarcs[i].angle2 ; - } - } else break ; - } - - for( pltextlist = pbuffer->pltextlist ; pltextlist ; - pltextlist = (XW_EXT_LTEXT*)pltextlist->link ) { - if( pltextlist->ntext > 0 ) { - pltextlist->isupdated = True ; - for( i=0 ; intext ; i++ ) { - x = pltextlist->rpoints[i].x - xp ; - y = pltextlist->rpoints[i].y - yp ; - pltextlist->upoints[i].x = (short int )( xp + XROTATE(x,y) ); - pltextlist->upoints[i].y = (short int )( yp + YROTATE(x,y) ); - a = pltextlist->rangles[i] + angle ; - if( a > 0. ) { - while( a > 2.*M_PI ) a -= 2.*M_PI ; - } else if( a < 0. ) { - while( a < -2.*M_PI ) a += 2.*M_PI ; - } - pltextlist->uangles[i] = a ; - pltextlist->uscalex[i] = pltextlist->rscalex[i] ; - pltextlist->uscaley[i] = pltextlist->rscaley[i] ; - } - } else break ; - } - - for( pptextlist = pbuffer->pptextlist ; pptextlist ; - pptextlist = (XW_EXT_PTEXT*)pptextlist->link ) { - if( pptextlist->ntext > 0 ) { - pptextlist->isupdated = True ; - for( i=0 ; intext ; i++ ) { - x = pptextlist->rpoints[i].x - xp ; - y = pptextlist->rpoints[i].y - yp ; - pptextlist->upoints[i].x = (short int )( xp + XROTATE(x,y) ); - pptextlist->upoints[i].y = (short int )( yp + YROTATE(x,y) ); - a = pptextlist->rangles[i] + angle ; - if( a > 0. ) { - while( a > 2.*M_PI ) a -= 2.*M_PI ; - } else if( a < 0. ) { - while( a < -2.*M_PI ) a += 2.*M_PI ; - } - pptextlist->uangles[i] = a ; - pptextlist->uscalex[i] = pptextlist->rscalex[i] ; - pptextlist->uscaley[i] = pptextlist->rscaley[i] ; - } - } else break ; - } - - for( ppmarklist = pbuffer->ppmarklist ; ppmarklist ; - ppmarklist = (XW_EXT_PMARKER*)ppmarklist->link ) { - if( ppmarklist->nmark > 0 ) { - ppmarklist->isupdated = True ; - for( i=n=0 ; inmark ; i++ ) { - x = ppmarklist->rcenters[i].x - xp ; - y = ppmarklist->rcenters[i].y - yp ; - dx = (int )( XROTATE(x,y) - x ); - dy = (int )( YROTATE(x,y) - y ); - ppmarklist->ucenters[i].x = ppmarklist->rcenters[i].x + dx ; - ppmarklist->ucenters[i].y = ppmarklist->rcenters[i].y + dy ; - for( j=0 ; jmarks[i] ; j++,n++ ) { - ppmarklist->upoints[n].x = ppmarklist->rpoints[n].x + dx ; - ppmarklist->upoints[n].y = ppmarklist->rpoints[n].y + dy ; - } - } - } else break ; - } - - for( plmarklist = pbuffer->plmarklist ; plmarklist ; - plmarklist = (XW_EXT_LMARKER*)plmarklist->link ) { - if( plmarklist->nmark > 0 ) { - plmarklist->isupdated = True ; - for( i=n=0 ; inmark ; i++ ) { - x = plmarklist->rcenters[i].x - xp ; - y = plmarklist->rcenters[i].y - yp ; - dx = (int )( XROTATE(x,y) - x ); - dy = (int )( YROTATE(x,y) - y ); - plmarklist->ucenters[i].x = plmarklist->rcenters[i].x + dx ; - plmarklist->ucenters[i].y = plmarklist->rcenters[i].y + dy ; - for( j=0 ; jmarks[i] ; j++,n++ ) { - plmarklist->usegments[n].x1 = plmarklist->rsegments[n].x1 + dx ; - plmarklist->usegments[n].y1 = plmarklist->rsegments[n].y1 + dy ; - plmarklist->usegments[n].x2 = plmarklist->rsegments[n].x2 + dx ; - plmarklist->usegments[n].y2 = plmarklist->rsegments[n].y2 + dy ; - } - } - } else break ; - } - - for( ppntlist = pbuffer->ppntlist ; ppntlist ; - ppntlist = (XW_EXT_POINT*)ppntlist->link ) { - if( ppntlist->npoint > 0 ) { - ppntlist->isupdated = True ; - for( i=0 ; inpoint ; i++ ) { - x = ppntlist->rpoints[i].x - xp ; - y = ppntlist->rpoints[i].y - yp ; - ppntlist->upoints[i].x = (short int )( xp + XROTATE(x,y) ); - ppntlist->upoints[i].y = (short int )( yp + YROTATE(x,y) ); - } - } else break ; - } - - for( ppolylist = pbuffer->ppolylist ; ppolylist ; - ppolylist = (XW_EXT_POLY*)ppolylist->link ) { - if( ppolylist->npoly > 0 ) { - ppolylist->isupdated = True ; - } else break ; - } - - for( plinelist = pbuffer->plinelist ; plinelist ; - plinelist = (XW_EXT_LINE*)plinelist->link ) { - if( plinelist->nline > 0 ) { - plinelist->isupdated = True ; - } else break ; - } - - for( plinedesc = pbuffer->plinedesc ; plinedesc ; - plinedesc = (XW_EXT_POINT*)plinedesc->link ) { - if( plinedesc->npoint > 0 ) { - plinedesc->isupdated = True ; - for( i=0 ; inpoint ; i++ ) { - x = plinedesc->rpoints[i].x - xp ; - y = plinedesc->rpoints[i].y - yp ; - plinedesc->upoints[i].x = (short int )( xp + XROTATE(x,y) ); - plinedesc->upoints[i].y = (short int )( yp + YROTATE(x,y) ); - } - } else break ; - } - - pbuffer->dangle = angle ; - pbuffer->uxmin = _WIDTH ; - pbuffer->uymin = _HEIGHT ; - pbuffer->uxmax = 0 ; - pbuffer->uymax = 0 ; - - x = (int )( xp + XROTATE(dxmin,dymin) ); - pbuffer->uxmin = min(pbuffer->uxmin,x) ; - pbuffer->uxmax = max(pbuffer->uxmax,x) ; - y = (int )( yp + YROTATE(dxmin,dymin) ); - pbuffer->uymin = min(pbuffer->uymin,y) ; - pbuffer->uymax = max(pbuffer->uymax,y) ; - - x = (int )( xp + XROTATE(dxmax,dymin) ); - pbuffer->uxmin = min(pbuffer->uxmin,x) ; - pbuffer->uxmax = max(pbuffer->uxmax,x) ; - y = (int )( yp + YROTATE(dxmax,dymin) ); - pbuffer->uymin = min(pbuffer->uymin,y) ; - pbuffer->uymax = max(pbuffer->uymax,y) ; - - x = (int )( xp + XROTATE(dxmin,dymax) ); - pbuffer->uxmin = min(pbuffer->uxmin,x) ; - pbuffer->uxmax = max(pbuffer->uxmax,x) ; - y = (int )( yp + YROTATE(dxmin,dymax) ); - pbuffer->uymin = min(pbuffer->uymin,y) ; - pbuffer->uymax = max(pbuffer->uymax,y) ; - - x = (int )( xp + XROTATE(dxmax,dymax) ); - pbuffer->uxmin = min(pbuffer->uxmin,x) ; - pbuffer->uxmax = max(pbuffer->uxmax,x) ; - y = (int )( yp + YROTATE(dxmax,dymax) ); - pbuffer->uymin = min(pbuffer->uymin,y) ; - pbuffer->uymax = max(pbuffer->uymax,y) ; - - uxmin = min(uxmin,pbuffer->uxmin) ; - uymin = min(uymin,pbuffer->uymin) ; - uxmax = max(uxmax,pbuffer->uxmax) ; - uymax = max(uymax,pbuffer->uymax) ; - - pbuffer->isupdated = ROTATE_BUFFER ; - - } - - Xw_draw_buffer(pwindow,bufferid) ; - - if( QGTYPE(pbuffer->code) == XW_ENABLE ) { - int x = uxmin - 1 ; - int y = uymin - 1 ; - int w = uxmax - x + 1 ; - int h = uymax - y + 1 ; - - if( x < 0 ) x = 0 ; - if( y < 0 ) y = 0 ; - if( x+w > _WIDTH ) w = _WIDTH - x ; - if( y+h > _HEIGHT ) h = _HEIGHT - y ; - - if( _NWBUFFER > 0 ) { - XCopyArea(_DISPLAY,_BWBUFFER,_FWBUFFER, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } else if( _PIXMAP ) { - XCopyArea(_DISPLAY,_PIXMAP,_WINDOW, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } - XFlush(_DISPLAY) ; - } - pbuffer->isretain = False ; - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_rotate_buffer(%lx,%d,%f)\n",(long ) pwindow,bufferid,angle) ; - } -#endif - - return (XW_SUCCESS); -} - -/* - STATUS Xw_scale_buffer (awindow,bufferid,xscale,yscale) - XW_EXT_WINDOW *awindow - int bufferid - float xscale,yscale Last scale factors since the creation time - - scale & display one retain buffer of primitives at screen - - Returns ERROR if the extended window address is badly defined - or one of scale factor is <= 0. - or Buffer is empty - or Buffer is not opened - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_scale_buffer (void* awindow,int bufferid,float xscale,float yscale) -#else -XW_STATUS Xw_scale_buffer (awindow,bufferid,xscale,yscale) -void *awindow; -int bufferid; -float xscale,yscale; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -XW_EXT_IMAGE *pimaglist ; -XW_EXT_POLY *ppolylist ; -XW_EXT_LINE *plinelist ; -XW_EXT_SEGMENT *pseglist ; -XW_EXT_LTEXT *pltextlist ; -XW_EXT_PTEXT *pptextlist ; -XW_EXT_ARC *parclist ; -XW_EXT_PMARKER *ppmarklist ; -XW_EXT_LMARKER *plmarklist ; -XW_EXT_POINT *ppntlist ; -XW_EXT_POINT *plinedesc ; -int i,j,n,x,y,dx,dy,xp,yp ; -int rxmin,rymin,rxmax,rymax ; -int uxmin,uymin,uxmax,uymax ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_scale_buffer",pwindow) ; - return (XW_ERROR) ; - } - - pbuffer = Xw_get_buffer_structure(pwindow,bufferid) ; - if( !pbuffer ) { - /*ERROR*BUFFER is not opened*/ - Xw_set_error(119,"Xw_scale_buffer",&bufferid) ; - return (XW_ERROR) ; - } - - if( xscale <= 0. ) { ; - /*ERROR*Bad BUFFER scale factor*/ - Xw_set_error(123,"Xw_scale_buffer",&xscale) ; - return (XW_ERROR) ; - } - - if( yscale <= 0. ) { ; - /*ERROR*Bad BUFFER scale factor*/ - Xw_set_error(123,"Xw_scale_buffer",&yscale) ; - return (XW_ERROR) ; - } - - if( pbuffer->isempty ) return XW_ERROR ; - - pbuffer->isretain = True ; - if( pbuffer->isdrawn ) { - Xw_erase_buffer(pwindow,bufferid) ; - } - - if( pbuffer->isupdated != SCALE_BUFFER ) { - if( pbuffer->isupdated ) Xw_update_buffer(pwindow,pbuffer) ; - } - - xp = pbuffer->xpivot ; - yp = pbuffer->ypivot ; - - rxmin = pbuffer->rxmin ; - rymin = pbuffer->rymin ; - rxmax = pbuffer->rxmax ; - rymax = pbuffer->rymax ; - - if( pbuffer->isupdated ) { - uxmin = pbuffer->uxmin ; - uymin = pbuffer->uymin ; - uxmax = pbuffer->uxmax ; - uymax = pbuffer->uymax ; - } else { - uxmin = rxmin ; uymin = rymin ; - uxmax = rxmax ; uymax = rymax ; - } - - if( xscale != pbuffer->xscale || yscale != pbuffer->yscale ) { - int dxmin = rxmin - xp ; - int dymin = rymin - yp ; - int dxmax = rxmax - xp ; - int dymax = rymax - yp ; - - for( pimaglist = pbuffer->pimaglist ; pimaglist ; - pimaglist = (XW_EXT_IMAGE*)pimaglist->link ) { - if( pimaglist->nimage > 0 ) { - pimaglist->isupdated = True ; - for( i=0 ; inimage ; i++ ) { - x = pimaglist->rpoints[i].x - xp ; - y = pimaglist->rpoints[i].y - yp ; - dx = ROUND(xscale*x) - x ; dy = ROUND(yscale*y) - y ; - pimaglist->upoints[i].x = pimaglist->rpoints[i].x + dx ; - pimaglist->upoints[i].y = pimaglist->rpoints[i].y + dy ; - } - } else break ; - } - - for( parclist = pbuffer->pparclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - parclist->isupdated = True ; - for( i=0 ; inarc ; i++ ) { - dx = parclist->rarcs[i].width/2 ; - dy = parclist->rarcs[i].height/2 ; - x = parclist->rarcs[i].x + dx - xp ; - y = parclist->rarcs[i].y + dy - yp ; - x = ROUND(xscale*x) ; y = ROUND(yscale*y) ; - dx = ROUND(xscale*dx) ; dy = ROUND(yscale*dy) ; - parclist->uarcs[i].width = 2*dx ; - parclist->uarcs[i].height = 2*dy ; - parclist->uarcs[i].x = xp + x - dx ; - parclist->uarcs[i].y = yp + y - dy ; - parclist->uarcs[i].angle1 = parclist->rarcs[i].angle1 ; - parclist->uarcs[i].angle2 = parclist->rarcs[i].angle2 ; - } - } else break ; - } - - for( pseglist = pbuffer->pseglist ; pseglist ; - pseglist = (XW_EXT_SEGMENT*)pseglist->link ) { - if( pseglist->nseg > 0 ) { - pseglist->isupdated = True ; - for( i=0 ; inseg ; i++ ) { - x = pseglist->rsegments[i].x1 - xp ; - y = pseglist->rsegments[i].y1 - yp ; - dx = ROUND(xscale*x) - x ; dy = ROUND(yscale*y) - y ; - pseglist->usegments[i].x1 = pseglist->rsegments[i].x1 + dx ; - pseglist->usegments[i].y1 = pseglist->rsegments[i].y1 + dy ; - x = pseglist->rsegments[i].x2 - xp ; - y = pseglist->rsegments[i].y2 - yp ; - dx = ROUND(xscale*x) - x ; dy = ROUND(yscale*y) - y ; - pseglist->usegments[i].x2 = pseglist->rsegments[i].x2 + dx ; - pseglist->usegments[i].y2 = pseglist->rsegments[i].y2 + dy ; - } - } else break ; - } - - for( parclist = pbuffer->plarclist ; parclist ; - parclist = (XW_EXT_ARC*)parclist->link ) { - if( parclist->narc > 0 ) { - parclist->isupdated = True ; - for( i=0 ; inarc ; i++ ) { - dx = parclist->rarcs[i].width/2 ; - dy = parclist->rarcs[i].height/2 ; - x = parclist->rarcs[i].x + dx - xp ; - y = parclist->rarcs[i].y + dy - yp ; - x = ROUND(xscale*x) ; y = ROUND(yscale*y) ; - dx = ROUND(xscale*dx) ; dy = ROUND(yscale*dy) ; - parclist->uarcs[i].width = 2*dx ; - parclist->uarcs[i].height = 2*dy ; - parclist->uarcs[i].x = xp + x - dx ; - parclist->uarcs[i].y = yp + y - dy ; - parclist->uarcs[i].angle1 = parclist->rarcs[i].angle1 ; - parclist->uarcs[i].angle2 = parclist->rarcs[i].angle2 ; - } - } else break ; - } - - for( pltextlist = pbuffer->pltextlist ; pltextlist ; - pltextlist = (XW_EXT_LTEXT*)pltextlist->link ) { - if( pltextlist->ntext > 0 ) { - pltextlist->isupdated = True ; - for( i=0 ; intext ; i++ ) { - x = pltextlist->rpoints[i].x - xp ; - y = pltextlist->rpoints[i].y - yp ; - dx = ROUND(xscale*x) - x ; dy = ROUND(yscale*y) - y ; - pltextlist->upoints[i].x = pltextlist->rpoints[i].x + dx ; - pltextlist->upoints[i].y = pltextlist->rpoints[i].y + dy ; - pltextlist->uangles[i] = pltextlist->rangles[i] ; - pltextlist->uscalex[i] = pltextlist->rscalex[i] * xscale; - pltextlist->uscaley[i] = pltextlist->rscaley[i] * yscale; - } - } else break ; - } - - for( pptextlist = pbuffer->pptextlist ; pptextlist ; - pptextlist = (XW_EXT_PTEXT*)pptextlist->link ) { - if( pptextlist->ntext > 0 ) { - pptextlist->isupdated = True ; - for( i=0 ; intext ; i++ ) { - x = pptextlist->rpoints[i].x - xp ; - y = pptextlist->rpoints[i].y - yp ; - dx = ROUND(xscale*x) - x ; dy = ROUND(yscale*y) - y ; - pptextlist->upoints[i].x = pptextlist->rpoints[i].x + dx ; - pptextlist->upoints[i].y = pptextlist->rpoints[i].y + dy ; - pptextlist->uangles[i] = pptextlist->rangles[i] ; - pptextlist->uscalex[i] = pptextlist->rscalex[i] * xscale; - pptextlist->uscaley[i] = pptextlist->rscaley[i] * yscale; - } - } else break ; - } - - for( ppmarklist = pbuffer->ppmarklist ; ppmarklist ; - ppmarklist = (XW_EXT_PMARKER*)ppmarklist->link ) { - if( ppmarklist->nmark > 0 ) { - ppmarklist->isupdated = True ; - for( i=n=0 ; inmark ; i++ ) { - x = ppmarklist->rcenters[i].x - xp ; - y = ppmarklist->rcenters[i].y - yp ; - dx = ROUND(xscale*x) - x ; dy = ROUND(yscale*y) - y ; - ppmarklist->ucenters[i].x = ppmarklist->rcenters[i].x + dx ; - ppmarklist->ucenters[i].y = ppmarklist->rcenters[i].y + dy ; - for( j=0 ; jmarks[i] ; j++,n++ ) { - ppmarklist->upoints[n].x = ppmarklist->rpoints[n].x + dx ; - ppmarklist->upoints[n].y = ppmarklist->rpoints[n].y + dy ; - } - } - } else break ; - } - - for( plmarklist = pbuffer->plmarklist ; plmarklist ; - plmarklist = (XW_EXT_LMARKER*)plmarklist->link ) { - if( plmarklist->nmark > 0 ) { - plmarklist->isupdated = True ; - for( i=n=0 ; inmark ; i++ ) { - x = plmarklist->rcenters[i].x - xp ; - y = plmarklist->rcenters[i].y - yp ; - dx = ROUND(xscale*x) - x ; dy = ROUND(yscale*y) - y ; - plmarklist->ucenters[i].x = plmarklist->rcenters[i].x + dx ; - plmarklist->ucenters[i].y = plmarklist->rcenters[i].y + dy ; - for( j=0 ; jmarks[i] ; j++,n++ ) { - plmarklist->usegments[n].x1 = plmarklist->rsegments[n].x1 + dx ; - plmarklist->usegments[n].y1 = plmarklist->rsegments[n].y1 + dy ; - plmarklist->usegments[n].x2 = plmarklist->rsegments[n].x2 + dx ; - plmarklist->usegments[n].y2 = plmarklist->rsegments[n].y2 + dy ; - } - } - } else break ; - } - - for( ppntlist = pbuffer->ppntlist ; ppntlist ; - ppntlist = (XW_EXT_POINT*)ppntlist->link ) { - if( ppntlist->npoint > 0 ) { - ppntlist->isupdated = True ; - for( i=0 ; inpoint ; i++ ) { - x = ppntlist->rpoints[i].x - xp ; - y = ppntlist->rpoints[i].y - yp ; - dx = ROUND(xscale*x) - x ; dy = ROUND(yscale*y) - y ; - ppntlist->upoints[i].x = ppntlist->rpoints[i].x + dx ; - ppntlist->upoints[i].y = ppntlist->rpoints[i].y + dy ; - } - } else break ; - } - - for( ppolylist = pbuffer->ppolylist ; ppolylist ; - ppolylist = (XW_EXT_POLY*)ppolylist->link ) { - if( ppolylist->npoly > 0 ) { - ppolylist->isupdated = True ; - } else break ; - } - - for( plinelist = pbuffer->plinelist ; plinelist ; - plinelist = (XW_EXT_LINE*)plinelist->link ) { - if( plinelist->nline > 0 ) { - plinelist->isupdated = True ; - } else break ; - } - - for( plinedesc = pbuffer->plinedesc ; plinedesc ; - plinedesc = (XW_EXT_POINT*)plinedesc->link ) { - if( plinedesc->npoint > 0 ) { - plinedesc->isupdated = True ; - for( i=0 ; inpoint ; i++ ) { - x = plinedesc->rpoints[i].x - xp ; - y = plinedesc->rpoints[i].y - yp ; - dx = ROUND(xscale*x) - x ; dy = ROUND(yscale*y) - y ; - plinedesc->upoints[i].x = plinedesc->rpoints[i].x + dx ; - plinedesc->upoints[i].y = plinedesc->rpoints[i].y + dy ; - } - } else break ; - } - - pbuffer->dxscale = xscale ; - pbuffer->dyscale = yscale ; - x = ROUND(xscale*dxmin) ; y = ROUND(yscale*dymin) ; - pbuffer->uxmin = xp + x ; - pbuffer->uymin = yp + y ; - x = ROUND(xscale*dxmax) ; y = ROUND(yscale*dymax) ; - pbuffer->uxmax = xp + x ; - pbuffer->uymax = yp + y ; - - uxmin = min(uxmin,pbuffer->uxmin) ; - uymin = min(uymin,pbuffer->uymin) ; - uxmax = max(uxmax,pbuffer->uxmax) ; - uymax = max(uymax,pbuffer->uymax) ; - - pbuffer->isupdated = SCALE_BUFFER ; - - } - - Xw_draw_buffer(pwindow,bufferid) ; - - if( QGTYPE(pbuffer->code) == XW_ENABLE ) { - int x = uxmin - 1 ; - int y = uymin - 1 ; - int w = uxmax - x + 1 ; - int h = uymax - y + 1 ; - - if( x < 0 ) x = 0 ; - if( y < 0 ) y = 0 ; - if( x+w > _WIDTH ) w = _WIDTH - x ; - if( y+h > _HEIGHT ) h = _HEIGHT - y ; - - if( _NWBUFFER > 0 ) { - XCopyArea(_DISPLAY,_BWBUFFER,_FWBUFFER, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } else if( _PIXMAP ) { - XCopyArea(_DISPLAY,_PIXMAP,_WINDOW, - pwindow->qgwind.gccopy,x,y,w,h,x,y) ; - } - XFlush(_DISPLAY) ; - } - pbuffer->isretain = False ; - -#ifdef TRACE_DRAW_BUFFER - if( Xw_get_trace() ) { - printf (" Xw_scale_buffer(%lx,%d,%f,%f)\n", - (long ) pwindow,bufferid,xscale,yscale) ; - } -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_draw_image.cxx b/src/Xw/Xw_draw_image.cxx deleted file mode 100755 index 38937354c3..0000000000 --- a/src/Xw/Xw_draw_image.cxx +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define BUC0056 /*GG_300496 -Protection contre zoom trop grand*/ - - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_IMAGE -#endif - -/* - STATUS Xw_draw_image (awindow,aimage,xc,yc): - XW_EXT_WINDOW *awindow - XW_EXT_IMAGEDATA *aimage Image structure - float xc,yc Image center location in user space - - Draw an image to the window at the required Center location - NOTE than current Window position and Size is taken - - returns ERROR if NO Image is defined or Image is outside of the window - returns SUCCESS if successful - -*/ - -#ifdef BUC0056 -#define MAXCOORD 32767 -#define MINCOORD -32768 -#endif - -static XW_EXT_IMAGE *pimaglist ; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_image (void* awindow,void* aimage,float xc,float yc) -#else -XW_STATUS Xw_draw_image (awindow,aimage,xc,yc) -void *awindow; -void *aimage ; -float xc,yc ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*)aimage ; -XW_EXT_BUFFER *pbuffer ; -//int color,nimage,bindex,x,y,width,height ; -int nimage,bindex,x,y,width,height ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_image",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_image(pimage) ) { - /*ERROR*Bad EXT_IMAGEDATA Address*/ - Xw_set_error(25,"Xw_draw_image",pimage) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - for( pimaglist = pbuffer->pimaglist ; pimaglist ; - pimaglist = (XW_EXT_IMAGE*) pimaglist->link ) { - if( pimaglist->nimage < MAXIMAGES ) break ; - } - - if( !pimaglist ) { - pimaglist = Xw_add_image_structure(pbuffer) ; - } - -//OCC186 - x = PXPOINT(xc, pwindow->xratio) ; - y = PYPOINT(yc, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 - -#ifdef BUC0056 - x = max(min(x,MAXCOORD),MINCOORD); - y = max(min(y,MAXCOORD),MINCOORD); -#endif - width = (_ZIMAGE) ? _ZIMAGE->width : _IIMAGE->width ; - height = (_ZIMAGE) ? _ZIMAGE->height : _IIMAGE->height ; - nimage = pimaglist->nimage ; - pimaglist->pimagdata[nimage] = pimage ; - pimaglist->rpoints[nimage].x = x ; - pimaglist->rpoints[nimage].y = y ; - pimaglist->nimage++ ; - if( bindex ) { - pbuffer->isempty = False ; - width = (width+3)/2 ; - height = (height+3)/2 ; - pbuffer->rxmin = min(pbuffer->rxmin,x-width) ; - pbuffer->rymin = min(pbuffer->rymin,y-height) ; - pbuffer->rxmax = max(pbuffer->rxmax,x+width) ; - pbuffer->rymax = max(pbuffer->rymax,y+height) ; - } else { - Xw_draw_pixel_images(pwindow,pimaglist,pwindow->qgwind.gccopy,NULL); - pimaglist->nimage = 0 ; - } - -#ifdef TRACE_DRAW_IMAGE -if( Xw_get_trace() ) { - printf (" Xw_draw_image(%lx,%lx,%f,%f)\n",(long ) pwindow,(long ) pimage,xc,yc) ; -} -#endif - - return (XW_SUCCESS); -} - -#ifdef XW_PROTOTYPE -void Xw_draw_pixel_images (XW_EXT_WINDOW* pwindow,XW_EXT_IMAGE* pimaglist, - GC gcimag,GC gcline) -#else -void Xw_draw_pixel_images (pwindow,pimaglist,gcimag,gcline) -XW_EXT_WINDOW *pwindow; -XW_EXT_IMAGE *pimaglist ; -GC gcimag,gcline ; -#endif -{ -XW_EXT_IMAGEDATA *pimage; -unsigned int width,height; -XImage *pximage; -int i,x,y; - - for( i=0 ; inimage ; i++ ) { - pimage = pimaglist->pimagdata[i] ; - pximage = (_ZIMAGE) ? _ZIMAGE : _IIMAGE; - width = pximage->width; - height = pximage->height; - if( pimaglist->isupdated ) { - x = pimaglist->upoints[i].x - width/2 ; - y = pimaglist->upoints[i].y - height/2 ; - } else { - x = pimaglist->rpoints[i].x - width/2 ; - y = pimaglist->rpoints[i].y - height/2 ; - } - if( gcimag ) { - XPutImage(_DISPLAY,_DRAWABLE,gcimag,pximage,0,0,x,y,width,height) ; - } - if( gcline ) { - XDrawRectangle(_DISPLAY,_DRAWABLE,gcline,x-1,y-1,width+2,height+2) ; - } - } -} - -#ifdef XW_PROTOTYPE -XW_EXT_IMAGE* Xw_add_image_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_IMAGE* Xw_add_image_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended image structure in the - image List - - returns Extended image address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_IMAGE *pimage ; -int i ; - - pimage = (XW_EXT_IMAGE*) Xw_malloc(sizeof(XW_EXT_IMAGE)) ; - if( pimage ) { - pimage->link = pbuflist->pimaglist ; - pimage->isupdated = False ; - pimage->nimage = 0 ; - for( i=0 ; ipimagdata[i] = NULL ; - } - pbuflist->pimaglist = pimage ; - } else { - /*ERROR*EXT_IMAGE Allocation failed*/ - Xw_set_error(27,"Xw_add_image_structure",NULL) ; - } - - return (pimage) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_image_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_image_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended image structure in the - image List - - SUCCESS always -*/ -{ -XW_EXT_IMAGE *pimag,*qimag ; -int i ; - - for( pimag = pbuflist->pimaglist ; pimag ; pimag = qimag ) { - qimag = (XW_EXT_IMAGE*)pimag->link ; - for( i=0 ; inimage ; i++ ) { - if( pimag->pimagdata[i] ) - Xw_del_imagedata_structure(pimag->pimagdata[i]) ; - } - Xw_free(pimag) ; - } - pbuflist->pimaglist = NULL ; - - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_draw_line.cxx b/src/Xw/Xw_draw_line.cxx deleted file mode 100755 index 859b79e79b..0000000000 --- a/src/Xw/Xw_draw_line.cxx +++ /dev/null @@ -1,535 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define S3593 /*GG_130398 -OPTIMISATION MFT - Activer le clipping de maniere optionnelle -*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_LINE -#endif - -/* - STATUS Xw_draw_line (awindow,npoint,x,y): - XW_EXT_WINDOW *awindow - int npoint Polyline point number - float *x,*y Points Arrays - - - Display continuous line in current QG set by set_line_attrib . - Note that lines can be buffered depending of the DisplayMode context - and Flush at Xw_flush time . - - returns ERROR if npoint > MAXPOINTS - returns SUCCESS always - -*/ - -static int BeginLine = -1 ; -static XW_EXT_LINE *plinelist ; -static XW_EXT_POINT *plinedesc ; -static XSegment segment; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_line (void* awindow,int npoint,float* px,float* py) -#else -XW_STATUS Xw_draw_line (awindow,npoint,px,py) -void *awindow; -int npoint ; -float *px,*py ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) awindow ; -XW_EXT_BUFFER *pbuffer ; -int i,nline,ldesc,bindex; -int x,y,lx=0,ly=0 ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_line",pwindow) ; - return (XW_ERROR) ; - } - - if( npoint > MAXPOINTS ) { - npoint = MAXPOINTS; - /*ERROR*Too many points in LINE*/ - Xw_set_error(28,"Xw_draw_line",&npoint) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - for( plinelist = pbuffer->plinelist ; plinelist ; - plinelist = (XW_EXT_LINE*)plinelist->link ) { - if( plinelist->nline < MAXLINES ) break ; - } - - if( !plinelist ) { - plinelist = Xw_add_polyline_structure(pbuffer) ; - } - - if( !plinelist ) return XW_ERROR ; - - for( plinedesc = pbuffer->plinedesc ; plinedesc ; - plinedesc = (XW_EXT_POINT*)plinedesc->link ) { - if( plinedesc->npoint + npoint <= MAXPOINTS ) break ; - } - - if( !plinedesc ) { - plinedesc = Xw_add_line_desc_structure(pbuffer) ; - } - - if( !plinedesc ) return XW_ERROR ; - - nline = plinelist->nline ; - ldesc = plinedesc->npoint ; - plinelist->plines[nline] = &plinedesc->rpoints[ldesc] ; - for( i=0 ; ixratio) ; - y = PYPOINT(py[i], pwindow->attributes.height, pwindow->yratio) ; -//OCC186 -#ifdef S3593 - if( pwindow->clipflag ) { -#endif - if( i > 0 ) { - int status; - status = Xw_clip_segment(pwindow,lx,ly,x,y,&segment); - if( status >= 0 ) { - if( (i < 2) || (status & 0xF ) ) { - plinedesc->rpoints[ldesc].x = segment.x1 ; - plinedesc->rpoints[ldesc].y = segment.y1 ; - ldesc++; - if( bindex > 0 ) { - int xx = segment.x1,yy = segment.y1; - pbuffer->rxmin = min(pbuffer->rxmin,xx) ; - pbuffer->rymin = min(pbuffer->rymin,yy) ; - pbuffer->rxmax = max(pbuffer->rxmax,xx) ; - pbuffer->rymax = max(pbuffer->rymax,yy) ; - } - } - plinedesc->rpoints[ldesc].x = segment.x2 ; - plinedesc->rpoints[ldesc].y = segment.y2 ; - ldesc++; - if( bindex > 0 ) { - int xx = segment.x2,yy = segment.y2; - pbuffer->rxmin = min(pbuffer->rxmin,xx) ; - pbuffer->rymin = min(pbuffer->rymin,yy) ; - pbuffer->rxmax = max(pbuffer->rxmax,xx) ; - pbuffer->rymax = max(pbuffer->rymax,yy) ; - } - } - } - lx = x; ly = y; -#ifdef S3593 - } else { - plinedesc->rpoints[ldesc].x = x ; - plinedesc->rpoints[ldesc].y = y ; - ldesc++ ; - if( bindex > 0 ) { - pbuffer->rxmin = min(pbuffer->rxmin,x) ; - pbuffer->rymin = min(pbuffer->rymin,y) ; - pbuffer->rxmax = max(pbuffer->rxmax,x) ; - pbuffer->rymax = max(pbuffer->rymax,y) ; - } - } -#endif - } - plinelist->lines[nline] = ldesc - plinedesc->npoint ; - if( plinelist->lines[nline] > 1 ) { - plinedesc->npoint = ldesc ; - plinelist->nline++ ; - if( bindex > 0 ) { - pbuffer->isempty = False ; - } else if( BeginLine < 0 ) { - int index = pwindow->lineindex ; - Xw_draw_pixel_lines(pwindow,plinelist,pwindow->qgline[index].gc); - plinelist->nline = 0 ; - plinedesc->npoint = 0 ; - } - } - -#ifdef TRACE_DRAW_LINE -if( Xw_get_trace() > 2 ) { - printf(" Xw_draw_line(%lx,%d)\n",(long ) pwindow,npoint) ; - for( i=0 ; inline ; i++ ) { - npoint = plinelist->lines[i] ; - ppoint = plinelist->plines[i] ; - if( plinelist->isupdated ) { - ppoint += MAXPOINTS ; - } - if( ppoint && npoint > 1 ) { - XDrawLines(_DISPLAY,_DRAWABLE,gc,ppoint,npoint,CoordModeOrigin) ; - } - } -} - -/* - STATUS Xw_begin_line (awindow,npoint): - XW_EXT_WINDOW *awindow - int npoint Polyline point number - - - Begin Polyline which must be filled by Xw_line_point and - closed by Xw_close_line - - returns ERROR if npoint > MAXPOINTS - returns SUCCESS if successful - -*/ - -static int Npoint = 0; -static int Lx,Ly; -#ifdef XW_PROTOTYPE -XW_STATUS Xw_begin_line(void* awindow,int npoint) -#else -XW_STATUS Xw_begin_line(awindow,npoint) -void *awindow ; -int npoint ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_BUFFER *pbuffer ; -int nline,ldesc,bindex ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_begin_line",pwindow) ; - return (XW_ERROR) ; - } - - if( npoint > MAXPOINTS ) { - npoint = MAXPOINTS ; - /*ERROR*Too many points in LINE*/ - Xw_set_error(28,"Xw_begin_line",&npoint) ; - return (XW_ERROR) ; - } - - if( BeginLine >= 0 ) Xw_close_line(pwindow); - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - for( plinelist = pbuffer->plinelist ; plinelist ; - plinelist = (XW_EXT_LINE*)plinelist->link ) { - if( plinelist->nline < MAXLINES ) break ; - } - - if( !plinelist ) { - plinelist = Xw_add_polyline_structure(pbuffer) ; - } - - if( !plinelist ) return XW_ERROR ; - - for( plinedesc = pbuffer->plinedesc ; plinedesc ; - plinedesc = (XW_EXT_POINT*)plinedesc->link ) { - if( plinedesc->npoint + npoint <= MAXPOINTS ) break ; - } - - if( !plinedesc ) { - plinedesc = Xw_add_line_desc_structure(pbuffer) ; - } - - if( !plinedesc ) return XW_ERROR ; - - nline = plinelist->nline ; - ldesc = plinedesc->npoint ; - plinelist->lines[nline] = Npoint = 0 ; - plinelist->plines[nline] = &plinedesc->rpoints[ldesc] ; - BeginLine = ldesc ; - -#ifdef TRACE_DRAW_LINE -if( Xw_get_trace() > 2 ) { - printf(" Xw_begin_line(%lx,%d)\n",(long ) pwindow,npoint) ; -} -#endif - return (XW_SUCCESS) ; -} - -/* - STATUS Xw_line_point (awindow,x,y): - XW_EXT_WINDOW *awindow - float x,y New point to add in polyline in user-space coordinates - - Fill Polyline with one point more - - returns ERROR if Too Many Points in polylines - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_line_point(void* awindow,float x,float y) -#else -XW_STATUS Xw_line_point(awindow,x,y) -void *awindow ; -float x,y ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_BUFFER *pbuffer ; -int bindex,xi,yi ; - - if( BeginLine >= 0 ) { - int ldesc = plinedesc->npoint ; - if( ldesc >= MAXPOINTS ) { - /*ERROR*Too many points in LINE*/ - Xw_set_error(28,"Xw_line_point",&ldesc) ; - Xw_close_line(pwindow) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; -//OCC186 - xi = PXPOINT(x, pwindow->xratio) ; - yi = PYPOINT(y, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 -#ifdef S3593 - if( pwindow->clipflag ) { -#endif - if( Npoint > 0 ) { - int status; - status = Xw_clip_segment(pwindow,Lx,Ly,xi,yi,&segment); - if( status >= 0 ) { - if( (Npoint < 2) || (status & 0xF ) ) { - plinedesc->rpoints[ldesc].x = segment.x1 ; - plinedesc->rpoints[ldesc].y = segment.y1 ; - ldesc++; - if( bindex > 0 ) { - int xx = segment.x1,yy = segment.y1; - pbuffer->isempty = False ; - pbuffer->rxmin = min(pbuffer->rxmin,xx) ; - pbuffer->rymin = min(pbuffer->rymin,yy) ; - pbuffer->rxmax = max(pbuffer->rxmax,xx) ; - pbuffer->rymax = max(pbuffer->rymax,yy) ; - } - } - plinedesc->rpoints[ldesc].x = segment.x2 ; - plinedesc->rpoints[ldesc].y = segment.y2 ; - ldesc++; - if( bindex > 0 ) { - int xx = segment.x2,yy = segment.y2; - pbuffer->isempty = False ; - pbuffer->rxmin = min(pbuffer->rxmin,xx) ; - pbuffer->rymin = min(pbuffer->rymin,yy) ; - pbuffer->rxmax = max(pbuffer->rxmax,xx) ; - pbuffer->rymax = max(pbuffer->rymax,yy) ; - } - } - } - Lx = xi; Ly = yi; -#ifdef S3593 - } else { - plinedesc->rpoints[ldesc].x = xi ; - plinedesc->rpoints[ldesc].y = yi ; - ldesc++; - if( bindex > 0 ) { - pbuffer->isempty = False ; - pbuffer->rxmin = min(pbuffer->rxmin,xi) ; - pbuffer->rymin = min(pbuffer->rymin,yi) ; - pbuffer->rxmax = max(pbuffer->rxmax,xi) ; - pbuffer->rymax = max(pbuffer->rymax,yi) ; - } - } -#endif - Npoint++; - plinedesc->npoint = ldesc ; - } - -#ifdef TRACE_DRAW_LINE -if( Xw_get_trace() > 3 ) { - printf(" Xw_line_point(%lx,%f,%f)\n",(long ) pwindow,x,y) ; -} -#endif - return (XW_SUCCESS) ; -} - -/* - STATUS Xw_close_line (awindow): - XW_EXT_WINDOW *awindow - - Close the Polyline - - returns ERROR if Polyline is empty - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_line(void* awindow) -#else -XW_STATUS Xw_close_line(awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; - - if( BeginLine >= 0 ) { - int nline = plinelist->nline ; - int ldesc = plinedesc->npoint ; - int bindex = _BINDEX ; - plinelist->lines[nline] = ldesc - BeginLine ; - plinelist->nline++ ; - - if( !bindex ) { - int index = pwindow->lineindex ; - Xw_draw_pixel_lines(pwindow,plinelist,pwindow->qgline[index].gc) ; - plinelist->nline = 0 ; - plinedesc->npoint = 0 ; - } - BeginLine = -1 ; - } - -#ifdef TRACE_DRAW_LINE -if( Xw_get_trace() > 2 ) { - printf(" Xw_close_line(%lx)\n",(long ) pwindow) ; -} -#endif - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_EXT_LINE* Xw_add_polyline_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_LINE* Xw_add_polyline_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended polyline structure in the - polyline List - - returns Extended polyline address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_LINE *pline ; - - pline = (XW_EXT_LINE*) Xw_malloc(sizeof(XW_EXT_LINE)) ; - if( pline ) { - pline->link = pbuflist->plinelist ; - pline->isupdated = False ; - pline->nline = 0 ; - pbuflist->plinelist = pline ; - } else { - /*ERROR*EXT_LINE allocation failed*/ - Xw_set_error(30,"Xw_add_polyline_structure",NULL) ; - } - - return (pline) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_polyline_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_polyline_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended polyline structure in the - polyline List - - SUCCESS always -*/ -{ -XW_EXT_LINE *pline,*qline ; - - for( pline = pbuflist->plinelist ; pline ; pline = qline ) { - qline = (XW_EXT_LINE*)pline->link ; - Xw_free(pline) ; - } - pbuflist->plinelist = NULL ; - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_EXT_POINT* Xw_add_line_desc_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_POINT* Xw_add_line_desc_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended line_desc structure in the - line_desc List - - returns Extended line_desc address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_POINT *pdesc ; - - pdesc = (XW_EXT_POINT*) Xw_malloc(sizeof(XW_EXT_POINT)) ; - if( pdesc ) { - pdesc->link = pbuflist->plinedesc ; - pdesc->npoint = 0 ; - pbuflist->plinedesc = pdesc ; - } else { - /*ERROR*EXT_POINT allocation failed*/ - Xw_set_error(117,"Xw_add_line_desc_structure",NULL) ; - } - - return (pdesc) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_line_desc_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_line_desc_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended line_desc structure in the - line_desc List - - SUCCESS always -*/ -{ -XW_EXT_POINT *pdesc,*qdesc ; - - for( pdesc = pbuflist->plinedesc ; pdesc ; pdesc = qdesc ) { - qdesc = (XW_EXT_POINT*)pdesc->link ; - Xw_free(pdesc) ; - } - pbuflist->plinedesc = NULL ; - - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_draw_marker.cxx b/src/Xw/Xw_draw_marker.cxx deleted file mode 100755 index 4d41f8a2ef..0000000000 --- a/src/Xw/Xw_draw_marker.cxx +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define BUC0056 /*GG_300496 -Protection contre zoom trop grand*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_MARKER -#endif - -/* - STATUS Xw_draw_marker (awindow,index,x,y,width,height,angle): - XW_EXT_WINDOW *awindow - int index Marker index - float x,y Marker position in user space - float width,height Marker size in MM. - float angle Marker orientation in RAD - - - Display polyline & polygones marker in current QG set - by set_marker_attrib . - Note that markers can be buffered depending of the DisplayMode context - and Flush at Xw_flush time . - - returns SUCCESS always - -*/ - -#ifdef BUC0056 -#define MAXCOORD 32767 -#define MINCOORD -32768 -#endif - -static int BeginMarkers = False ; -static XW_EXT_LMARKER *plmarklist ; -static XW_EXT_PMARKER *ppmarklist ; - -#define XROTATE(x,y) (x*cosa - y*sina) -#define YROTATE(x,y) (x*sina + y*cosa) - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_marker (void* awindow,int index, - float x,float y,float width,float height,float angle) -#else -XW_STATUS Xw_draw_marker (awindow,index,x,y,width,height,angle) -void *awindow; -int index; -float x,y ; -float width,height; -float angle; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_DISPLAY *pdisplay = pwindow->connexion; -XW_EXT_BUFFER *pbuffer ; -int i,np,type,bindex,rotate = False ; -int ix,iy,ix1,iy1,ix2,iy2,sm,*ps; -int npoint,nseg,nmark ; -float xm,ym,cosa=0,sina=0,*px,*py; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_marker",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_marker(_MARKMAP,index) ) { - /*ERROR*Bad Defined Marker*/ - Xw_set_error(77,"Xw_draw_marker",&index) ; - return (XW_ERROR) ; - } - - type = QGTYPE(pwindow->qgmark[pwindow->markindex].code); - np = _MARKMAP->npoint[index] ; -//OCC186 - ix = PXPOINT(x, pwindow->xratio) ; - iy = PYPOINT(y, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 - -#ifdef BUC0056 - if( ix < MINCOORD || ix > MAXCOORD ) return XW_SUCCESS; - if( iy < MINCOORD || iy > MAXCOORD ) return XW_SUCCESS; -#endif - - if( angle != 0. ) { - rotate = True; - cosa = cos((double)angle); - sina = sin((double)angle); - } - - if( np >= MAXPOINTS ) { - np = MAXPOINTS-1; - /*ERROR*Too many points in MARKER*/ - Xw_set_error(112,"Xw_draw_marker",&np) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - if( bindex > 0 ) type = 0 ; /* Poly markers will be disable */ - - ppmarklist = NULL ; - if( type > 0 ) { - - for( ppmarklist = pbuffer->ppmarklist ; ppmarklist ; - ppmarklist = (XW_EXT_PMARKER*) ppmarklist->link ) { - if( (ppmarklist->nmark < MAXPMARKERS) && - (ppmarklist->npoint + np < MAXPOINTS) ) break ; - } - - if( !ppmarklist ) { - ppmarklist = Xw_add_pmarker_structure(pbuffer) ; - } - - if( !ppmarklist ) return XW_ERROR ; - - npoint = ppmarklist->npoint ; - nmark = ppmarklist->nmark ; - ix1 = ix ; iy1 = iy ; - ps = _MARKMAP->spoint[index]; - px = _MARKMAP->xpoint[index]; - py = _MARKMAP->ypoint[index]; - for( i=0 ; irpoints[npoint].x = ix2 ; - ppmarklist->rpoints[npoint].y = iy2 ; - if( sm || !i ) npoint++; - else break; - ix1 = ix2; iy1 = iy2; - } - ppmarklist->marks[nmark] = npoint - ppmarklist->npoint; - ppmarklist->npoint = npoint ; - ppmarklist->rcenters[nmark].x = ix ; - ppmarklist->rcenters[nmark].y = iy ; - ppmarklist->nmark++ ; - - } - - for( plmarklist = pbuffer->plmarklist ; plmarklist ; - plmarklist = (XW_EXT_LMARKER*) plmarklist->link ) { - if( (plmarklist->nmark < MAXLMARKERS) && - (plmarklist->nseg + np < MAXPOINTS) ) break ; - } - - if( !plmarklist ) { - plmarklist = Xw_add_lmarker_structure(pbuffer) ; - } - - if( !plmarklist ) return XW_ERROR ; - - nseg = plmarklist->nseg ; - nmark = plmarklist->nmark ; - ix1 = ix ; iy1 = iy ; - ps = _MARKMAP->spoint[index]; - px = _MARKMAP->xpoint[index]; - py = _MARKMAP->ypoint[index]; - for( i=0 ; irsegments[nseg].x1 = ix1 ; - plmarklist->rsegments[nseg].y1 = iy1 ; - plmarklist->rsegments[nseg].x2 = ix2 ; - plmarklist->rsegments[nseg].y2 = iy2 ; - nseg++; - } - ix1 = ix2; iy1 = iy2; - } - plmarklist->marks[nmark] = nseg - plmarklist->nseg; - plmarklist->nseg = nseg ; - plmarklist->rcenters[nmark].x = ix ; - plmarklist->rcenters[nmark].y = iy ; - plmarklist->nmark++ ; - - if( bindex > 0 ) { - int w = (PMMXVALUE(width)+1)/2 ; - int h = (PMMYVALUE(height)+1)/2 ; - pbuffer->isempty = False ; - pbuffer->rxmin = min(pbuffer->rxmin,ix-w) ; - pbuffer->rymin = min(pbuffer->rymin,iy-h) ; - pbuffer->rxmax = max(pbuffer->rxmax,ix+w) ; - pbuffer->rymax = max(pbuffer->rymax,iy+h) ; - } else if( !BeginMarkers ) { - if( ppmarklist ) { - int index = pwindow->polyindex ; - Xw_draw_pixel_pmarkers(pwindow,ppmarklist, - pwindow->qgpoly[index].gc); - ppmarklist->nmark = 0 ; - ppmarklist->npoint = 0 ; - } - if( plmarklist ) { - int index = pwindow->markindex ; - Xw_draw_pixel_lmarkers(pwindow,plmarklist, - pwindow->qgmark[index].gc); - plmarklist->nmark = 0 ; - plmarklist->nseg = 0 ; - } - } - -#ifdef TRACE_DRAW_MARKER -if( Xw_get_trace() > 2 ) { - printf(" Xw_draw_marker(%lx,%d,%f,%f,%f,%f,%f)\n", - (long ) pwindow,index,x,y,width,height,angle) ; -} -#endif - - return (XW_SUCCESS); -} - -/* - STATUS Xw_begin_markers (awindow,nmarker): - XW_EXT_WINDOW *awindow - int nmarker Not used - - - Begin a set of markers which must be filled by Xw_draw_marker and - closed by Xw_close_markers - - returns ERROR if bad extended window address - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_begin_markers(void* awindow,int nmarker) -#else -XW_STATUS Xw_begin_markers(awindow,nmarker) -void *awindow ; -int nmarker ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_begin_markers",pwindow) ; - return (XW_ERROR) ; - } - - if( BeginMarkers ) Xw_close_markers(pwindow); - - BeginMarkers = True; - -#ifdef TRACE_DRAW_MARKER -if( Xw_get_trace() > 2 ) { - printf(" Xw_begin_markers(%lx,%d)\n",(long ) pwindow,nmarker) ; -} -#endif - return (XW_SUCCESS) ; -} - -/* - STATUS Xw_close_markers (awindow): - XW_EXT_WINDOW *awindow - - Close the set of markers - - returns ERROR if bad extended window address - returns SUCCESS successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_markers(void* awindow) -#else -XW_STATUS Xw_close_markers(awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_BUFFER *pbuffer ; -int bindex ; - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - if( BeginMarkers && !bindex ) { - int index = pwindow->polyindex ; - for( ppmarklist = pbuffer->ppmarklist ; ppmarklist ; - ppmarklist = (XW_EXT_PMARKER*) ppmarklist->link ) { - if( ppmarklist->nmark > 0 ) { - Xw_draw_pixel_pmarkers(pwindow,ppmarklist, - pwindow->qgpoly[index].gc) ; - ppmarklist->nmark = 0 ; - ppmarklist->npoint = 0 ; - } else break ; - } - index = pwindow->markindex ; - for( plmarklist = pbuffer->plmarklist ; plmarklist ; - plmarklist = (XW_EXT_LMARKER*) plmarklist->link ) { - if( plmarklist->nseg > 0 ) { - Xw_draw_pixel_lmarkers(pwindow,plmarklist, - pwindow->qgmark[index].gc) ; - plmarklist->nmark = 0 ; - plmarklist->nseg = 0 ; - } else break ; - } - } - - BeginMarkers = False; - -#ifdef TRACE_DRAW_MARKER -if( Xw_get_trace() > 2 ) { - printf(" Xw_close_markers(%lx)\n",(long ) pwindow) ; -} -#endif - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -void Xw_draw_pixel_pmarkers (XW_EXT_WINDOW* pwindow,XW_EXT_PMARKER* pmarklist,GC gc) -#else -void Xw_draw_pixel_pmarkers (pwindow,pmarklist,gc) -XW_EXT_WINDOW *pwindow; -XW_EXT_PMARKER *pmarklist; -GC gc ; -#endif /*XW_PROTOTYPE*/ -{ -int i,j,npoint ; -XPoint *ppoint ; - - for( i=j=0 ; inmark ; i++,j += npoint ) { - npoint = pmarklist->marks[i] ; - if( pmarklist->isupdated ) { - ppoint = &pmarklist->upoints[j] ; - } else { - ppoint = &pmarklist->rpoints[j] ; - } - if( npoint > 2 ) { - XFillPolygon(_DISPLAY,_DRAWABLE,gc,ppoint,npoint, - Nonconvex,CoordModeOrigin) ; - } - } -} - -#ifdef XW_PROTOTYPE -void Xw_draw_pixel_lmarkers (XW_EXT_WINDOW* pwindow,XW_EXT_LMARKER* pmarklist,GC gc) -#else -void Xw_draw_pixel_lmarkers (pwindow,pmarklist,gc) -XW_EXT_WINDOW *pwindow; -XW_EXT_LMARKER *pmarklist; -GC gc ; -#endif /*XW_PROTOTYPE*/ -{ - - if( pmarklist->isupdated ) { - XDrawSegments(_DISPLAY,_DRAWABLE,gc, - pmarklist->usegments,pmarklist->nseg) ; - } else { - XDrawSegments(_DISPLAY,_DRAWABLE,gc, - pmarklist->rsegments,pmarklist->nseg) ; - } - -} - -#ifdef XW_PROTOTYPE -XW_EXT_LMARKER* Xw_add_lmarker_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_LMARKER* Xw_add_lmarker_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended marker structure in the - marker List - - returns Extended marker address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_LMARKER *pmarker ; - - pmarker = (XW_EXT_LMARKER*) Xw_malloc(sizeof(XW_EXT_LMARKER)) ; - if( pmarker ) { - pmarker->link = pbuflist->plmarklist ; - pmarker->isupdated = False ; - pmarker->nmark = 0 ; - pmarker->nseg = 0 ; - pbuflist->plmarklist = pmarker ; - } else { - /*ERROR*EXT_MARKER Allocation failed*/ - Xw_set_error(31,"Xw_add_marker_structure",NULL) ; - } - - return (pmarker) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_lmarker_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_lmarker_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended marker structure in the - marker List - - SUCCESS always -*/ -{ -XW_EXT_LMARKER *pmarker,*qmarker ; - - for( pmarker = pbuflist->plmarklist ; pmarker ; pmarker = qmarker ) { - qmarker = (XW_EXT_LMARKER*)pmarker->link ; - Xw_free(pmarker) ; - } - pbuflist->plmarklist = NULL ; - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_EXT_PMARKER* Xw_add_pmarker_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_PMARKER* Xw_add_pmarker_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended marker structure in the - marker List - - returns Extended marker address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_PMARKER *pmarker ; - - pmarker = (XW_EXT_PMARKER*) Xw_malloc(sizeof(XW_EXT_PMARKER)) ; - if( pmarker ) { - pmarker->link = pbuflist->ppmarklist ; - pmarker->isupdated = False ; - pmarker->nmark = 0 ; - pmarker->npoint = 0 ; - pbuflist->ppmarklist = pmarker ; - } else { - /*ERROR*EXT_MARKER Allocation failed*/ - Xw_set_error(31,"Xw_add_marker_structure",NULL) ; - } - - return (pmarker) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_pmarker_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_pmarker_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended marker structure in the - marker List - - SUCCESS always -*/ -{ -XW_EXT_PMARKER *pmarker,*qmarker ; - - for( pmarker = pbuflist->ppmarklist ; pmarker ; pmarker = qmarker ) { - qmarker = (XW_EXT_PMARKER*)pmarker->link ; - Xw_free(pmarker) ; - } - pbuflist->ppmarklist = NULL ; - - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_draw_point.cxx b/src/Xw/Xw_draw_point.cxx deleted file mode 100755 index acf0535dbd..0000000000 --- a/src/Xw/Xw_draw_point.cxx +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#define BUC0056 /*GG_300496 -Protection contre zoom trop grand*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_POINT -#endif - -/* - STATUS Xw_draw_point (awindow,x,y): - XW_EXT_WINDOW *awindow - float x,y Point position in user space - - - Display point in current QG set by set_marker_attrib . - Note that points can be buffered depending of the DisplayMode context - and Flush at Xw_flush time . - - returns SUCCESS always - -*/ - -#ifdef BUC0056 -#define MAXCOORD 32767 -#define MINCOORD -32768 -#endif - -static int BeginPoints = False ; -static XW_EXT_POINT *ppntlist = NULL ; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_point (void* awindow,float x,float y) -#else -XW_STATUS Xw_draw_point (awindow,x,y) -void *awindow; -float x,y ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -int npnt,bindex,ix,iy ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_point",pwindow) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - for( ppntlist = pbuffer->ppntlist ; ppntlist ; - ppntlist = (XW_EXT_POINT*) ppntlist->link ) { - if( ppntlist->npoint < MAXPOINTS ) break ; - } - - if( !ppntlist ) { - ppntlist = Xw_add_point_structure(pbuffer) ; - } - - if( !ppntlist ) return XW_ERROR ; - -//OCC186 - ix = PXPOINT(x, pwindow->xratio) ; - iy = PYPOINT(y, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 - -#ifdef BUC0056 - if( ix < MINCOORD || ix > MAXCOORD ) return XW_SUCCESS; - if( iy < MINCOORD || iy > MAXCOORD ) return XW_SUCCESS; -#endif - npnt = ppntlist->npoint ; - ppntlist->rpoints[npnt].x = ix ; - ppntlist->rpoints[npnt].y = iy ; - ppntlist->npoint++ ; - - if( bindex > 0 ) { - pbuffer->isempty = False ; - pbuffer->rxmin = min(pbuffer->rxmin,ix) ; - pbuffer->rymin = min(pbuffer->rymin,iy) ; - pbuffer->rxmax = max(pbuffer->rxmax,ix) ; - pbuffer->rymax = max(pbuffer->rymax,iy) ; - } else if( !BeginPoints ) { - int index = pwindow->markindex ; - Xw_draw_pixel_points(pwindow,ppntlist,pwindow->qgmark[index].gc) ; - ppntlist->npoint = 0 ; - } - -#ifdef TRACE_DRAW_POINT -if( Xw_get_trace() > 2 ) { - printf(" Xw_draw_point(%lx,%f,%f)\n",(long ) pwindow,x,y) ; -} -#endif - - return (XW_SUCCESS); -} - -/* - STATUS Xw_begin_points (awindow,npoint): - XW_EXT_WINDOW *awindow - int npoint Not used - - - Begin a set of points which must be filled by Xw_draw_point and - closed by Xw_close_points - - returns ERROR if bad extended window address - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_begin_points(void* awindow,int npoint) -#else -XW_STATUS Xw_begin_points(awindow,npoint) -void *awindow ; -int npoint ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_begin_points",pwindow) ; - return (XW_ERROR) ; - } - - if( BeginPoints ) Xw_close_points(pwindow); - - BeginPoints = True; - -#ifdef TRACE_DRAW_POINT -if( Xw_get_trace() > 2 ) { - printf(" Xw_begin_points(%lx,%d)\n",(long ) pwindow,npoint) ; -} -#endif - return (XW_SUCCESS) ; -} - -/* - STATUS Xw_close_points (awindow): - XW_EXT_WINDOW *awindow - - Close the set of points - - returns ERROR if bad extended window address - returns SUCCESS successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_points(void* awindow) -#else -XW_STATUS Xw_close_points(awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_BUFFER *pbuffer ; -int bindex ; - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - if( BeginPoints && !bindex ) { - int index = pwindow->lineindex ; - for( ppntlist = pbuffer->ppntlist ; ppntlist ; - ppntlist = (XW_EXT_POINT*) ppntlist->link ) { - if( ppntlist->npoint > 0 ) { - Xw_draw_pixel_points(pwindow,ppntlist,pwindow->qgmark[index].gc) ; - ppntlist->npoint = 0 ; - } else break ; - } - } - - BeginPoints = False; - -#ifdef TRACE_DRAW_POINT -if( Xw_get_trace() > 2 ) { - printf(" Xw_close_points(%lx)\n",(long ) pwindow) ; -} -#endif - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -void Xw_draw_pixel_points(XW_EXT_WINDOW *pwindow,XW_EXT_POINT* ppntlist,GC gc) -#else -void Xw_draw_pixel_points(pwindow,ppntlist,gc) -XW_EXT_WINDOW *pwindow ; -XW_EXT_POINT *ppntlist ; -GC gc ; -#endif /*XW_PROTOTYPE*/ -{ - - if( ppntlist->isupdated ) { - XDrawPoints(_DISPLAY,_DRAWABLE,gc,ppntlist->upoints, - ppntlist->npoint,CoordModeOrigin) ; - } else { - XDrawPoints(_DISPLAY,_DRAWABLE,gc,ppntlist->rpoints, - ppntlist->npoint,CoordModeOrigin) ; - } -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_point_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_point_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended point structure in the - point List - - SUCCESS always -*/ -{ -XW_EXT_POINT *ppoint,*qpoint ; - - for( ppoint = pbuflist->ppntlist ; ppoint ; ppoint = qpoint ) { - qpoint = (XW_EXT_POINT*)ppoint->link ; - Xw_free(ppoint) ; - } - pbuflist->ppntlist = NULL ; - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_EXT_POINT* Xw_add_point_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_POINT* Xw_add_point_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended point structure in the - point List - - returns Extended point address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_POINT *ppoint ; - - ppoint = (XW_EXT_POINT*) Xw_malloc(sizeof(XW_EXT_POINT)) ; - if( ppoint ) { - ppoint->link = pbuflist->ppntlist ; - ppoint->isupdated = False ; - ppoint->npoint = 0 ; - pbuflist->ppntlist = ppoint ; - } else { - /*ERROR*EXT_POINT Allocation failed*/ - Xw_set_error(117,"Xw_add_point_structure",NULL) ; - } - - return (ppoint) ; -} diff --git a/src/Xw/Xw_draw_poly.cxx b/src/Xw/Xw_draw_poly.cxx deleted file mode 100755 index f486055504..0000000000 --- a/src/Xw/Xw_draw_poly.cxx +++ /dev/null @@ -1,600 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define BUC40223 /*GG_070797 -Protection contre zoom trop grand*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_POLY -#endif - -/* - STATUS Xw_draw_poly (awindow,npoint,px,py): - XW_EXT_WINDOW *awindow - int npoint Polygone point number - float *px,*py Polygone points - - - Display continuous poly in current QG set by set_poly_attrib . - Note that polys can be buffered depending of the DisplayMode context - and Flush at Xw_flush time . - - returns ERROR if npoint > MAXPOINTS - returns SUCCESS if successful - -*/ - -static int FirstPolyPoint = -1 ; -static int FirstPolyLine = -1 ; -static int FirstPathPoint = -1 ; -static XW_EXT_POLY *ppolylist ; -static XW_EXT_POINT *plinedesc ; -static XSegment segment; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_poly (void* awindow,int npoint,float* px,float* py) -#else -XW_STATUS Xw_draw_poly (awindow,npoint,px,py) -void *awindow; -int npoint ; -float *px,*py ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -int i,npoly,ldesc,bindex; -int x=0,y=0,lx=0,ly=0 ; -XPoint *ppoint ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_poly",pwindow) ; - return (XW_ERROR) ; - } - - if( npoint >= MAXPOINTS ) { - npoint = MAXPOINTS-1 ; - /*ERROR*Too many points in POLYGONE*/ - Xw_set_error(28,"Xw_draw_poly",&npoint) ; - return (XW_ERROR) ; - } - - if( npoint < 3 ) { - /*WARNING*POLYGONE is Empty !!!*/ - Xw_set_error(33,"Xw_draw_poly",&npoint) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - for( ppolylist = pbuffer->ppolylist ; ppolylist ; - ppolylist = (XW_EXT_POLY*)ppolylist->link ) { - if( ppolylist->npoly < MAXPOLYS ) break ; - } - - if( !ppolylist ) { - ppolylist = Xw_add_polygone_structure(pbuffer) ; - } - - if( !ppolylist ) return XW_ERROR ; - - for( plinedesc = pbuffer->plinedesc ; plinedesc ; - plinedesc = (XW_EXT_POINT*)plinedesc->link ) { - if( plinedesc->npoint + npoint < MAXPOINTS ) break ; - } - - if( !plinedesc ) { - plinedesc = Xw_add_line_desc_structure(pbuffer) ; - } - - if( !plinedesc ) return XW_ERROR ; - - npoly = ppolylist->npoly ; - ldesc = plinedesc->npoint ; - ppolylist->ppolys[npoly] = ppoint = &plinedesc->rpoints[ldesc] ; - for( i=0 ; ixratio) ; - y = PYPOINT(py[i], pwindow->attributes.height, pwindow->yratio) ; -//OCC186 -#ifdef BUC40223 - if( i > 0 ) { - int status; - status = Xw_clip_segment(pwindow,lx,ly,x,y,&segment); - if( status >= 0 ) { - if( (i < 2) || (status & 0xF ) ) { - plinedesc->rpoints[ldesc].x = segment.x1 ; - plinedesc->rpoints[ldesc].y = segment.y1 ; - ldesc++; - if( bindex > 0 ) { - int xx = segment.x1,yy = segment.y1; - pbuffer->rxmin = min(pbuffer->rxmin,xx) ; - pbuffer->rymin = min(pbuffer->rymin,yy) ; - pbuffer->rxmax = max(pbuffer->rxmax,xx) ; - pbuffer->rymax = max(pbuffer->rymax,yy) ; - } - } - plinedesc->rpoints[ldesc].x = segment.x2 ; - plinedesc->rpoints[ldesc].y = segment.y2 ; - ldesc++; - if( bindex > 0 ) { - int xx = segment.x2,yy = segment.y2; - pbuffer->rxmin = min(pbuffer->rxmin,xx) ; - pbuffer->rymin = min(pbuffer->rymin,yy) ; - pbuffer->rxmax = max(pbuffer->rxmax,xx) ; - pbuffer->rymax = max(pbuffer->rymax,yy) ; - } - } - } - lx = x; ly = y; -#else - plinedesc->rpoints[ldesc].x = x ; - plinedesc->rpoints[ldesc].y = y ; - ldesc++ ; - if( bindex > 0 ) { - pbuffer->rxmin = min(pbuffer->rxmin,x) ; - pbuffer->rymin = min(pbuffer->rymin,y) ; - pbuffer->rxmax = max(pbuffer->rxmax,x) ; - pbuffer->rymax = max(pbuffer->rymax,y) ; - } -#endif - } - if( ppoint->x != x || ppoint->y != y ) { - plinedesc->rpoints[ldesc].x = ppoint->x ; - plinedesc->rpoints[ldesc].y = ppoint->y ; - ldesc++ ; - } - ppolylist->polys[npoly] = ldesc - plinedesc->npoint ; - ppolylist->paths[npoly] = ppolylist->polys[npoly] ; - if( ppolylist->polys[npoly] > 3 ) { - ppolylist->npoly++ ; - plinedesc->npoint = ldesc ; - - if( bindex > 0 ) { - pbuffer->isempty = False ; - } else if( FirstPolyPoint < 0 ) { - int polyindex = pwindow->polyindex ; - int lineindex = pwindow->lineindex ; - GC gcpoly = (QGTILE(pwindow->qgpoly[polyindex].code)) ? - pwindow->qgpoly[polyindex].gc : NULL ; - GC gcline = (QGTYPE(pwindow->qgpoly[polyindex].code)) ? - pwindow->qgline[lineindex].gc : NULL ; - Xw_draw_pixel_polys(pwindow,ppolylist,gcpoly,gcline); - ppolylist->npoly = 0 ; - plinedesc->npoint = 0 ; - } - } - -#ifdef TRACE_DRAW_POLY -if( Xw_get_trace() > 2 ) { - printf(" Xw_draw_poly(%lx,%d)\n",(long ) pwindow,npoint) ; - for( i=0 ; inpoly ; i++ ) { - npolypoint = ppolylist->polys[i] ; - npathpoint = ppolylist->paths[i] ; - ppoint = ppolylist->ppolys[i] ; - if( ppolylist->isupdated ) { - ppoint += MAXPOINTS ; - } - if( gcpoly ) { - if( npolypoint > 0 ) { - npoint = npolypoint; count = 0; - chr_region = 0; - } - if( npoint > npathpoint ) { - if( npathpoint > 3 ) { - if( chr_region == 0 ) { - chr_region = - XPolygonRegion(ppoint,npathpoint-1,EvenOddRule); - } else { - Region chr_pathreg = - XPolygonRegion(ppoint,npathpoint-1,EvenOddRule); - Region chr_xorreg = XCreateRegion (); - XXorRegion (chr_region, chr_pathreg, chr_xorreg); - XDestroyRegion (chr_region); - chr_region = chr_xorreg; - } - } - count += npathpoint; - if( count >= npoint && chr_region ) { - XRectangle rect; - XSetRegion(_DISPLAY,gcpoly,chr_region); - XClipBox(chr_region,&rect); - XFillRectangles(_DISPLAY,_DRAWABLE,gcpoly,&rect,1); - XDestroyRegion(chr_region); - XSetClipMask(_DISPLAY,gcpoly,None); - } - } else if( npoint > 3 ) { - shape = (npoint > 4) ? Nonconvex : Convex; - XFillPolygon(_DISPLAY,_DRAWABLE,gcpoly,ppoint,npoint-1, - shape,CoordModeOrigin) ; - - } - } - if( gcline && (gcpoly != gcline) && (npathpoint > 3) ) { - XDrawLines(_DISPLAY,_DRAWABLE,gcline, - ppoint,npathpoint,CoordModeOrigin) ; - } - } -} - -/* - STATUS Xw_begin_poly (awindow,npoint,npath): - XW_EXT_WINDOW *awindow - int npoint Estimated polygone point number - int npath Estimated polygone path number - - - Begin Polygone which must be filled by Xw_poly_point and - closed by Xw_close_poly - - returns ERROR if npoint > MAXPOINTS - or npath > MAXPOLYS - returns SUCCESS if successful - -*/ - -static int Npoint = 0; -static int Lx,Ly; -#ifdef XW_PROTOTYPE -XW_STATUS Xw_begin_poly(void* awindow,int npoint,int npath) -#else -XW_STATUS Xw_begin_poly(awindow,npoint,npath) -void *awindow ; -int npoint,npath ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -int npoly,ldesc,bindex ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_begin_poly",pwindow) ; - return (XW_ERROR) ; - } - - if( npoint >= MAXPOINTS ) { - npoint = MAXPOINTS-1 ; - /*ERROR*Too many points in POLYGONE*/ - Xw_set_error(32,"Xw_begin_poly",&npoint) ; - return (XW_ERROR) ; - } - - if( npath >= MAXPOLYS ) { - npath = MAXPOLYS-1 ; - /*ERROR*Too many paths in POLYGONE*/ - Xw_set_error(32,"Xw_begin_poly",&npath) ; - return (XW_ERROR) ; - } - - if( FirstPolyPoint >= 0 ) Xw_close_poly(pwindow) ; - - bindex = _BINDEX ; - for( ppolylist = _BUFFER(bindex).ppolylist ; ppolylist ; - ppolylist = (XW_EXT_POLY*)ppolylist->link ) { - if( (ppolylist->npoly + npath) < MAXPOLYS ) break ; - } - - if( !ppolylist ) { - ppolylist = Xw_add_polygone_structure(&_BUFFER(bindex)) ; - } - - if( !ppolylist ) return XW_ERROR ; - - for( plinedesc = _BUFFER(bindex).plinedesc ; plinedesc ; - plinedesc = (XW_EXT_POINT*)plinedesc->link ) { - if( (plinedesc->npoint + npoint) < MAXPOINTS ) break ; - } - - if( !plinedesc ) { - plinedesc = Xw_add_line_desc_structure(&_BUFFER(bindex)) ; - } - - if( !plinedesc ) return XW_ERROR ; - - npoly = ppolylist->npoly ; - ldesc = plinedesc->npoint ; - ppolylist->polys[npoly] = 0 ; - ppolylist->paths[npoly] = Npoint = 0 ; - ppolylist->ppolys[npoly] = &plinedesc->rpoints[ldesc] ; - FirstPolyPoint = FirstPathPoint = ldesc ; - FirstPolyLine = npoly; - - -#ifdef TRACE_DRAW_POLY -if( Xw_get_trace() > 2 ) { - printf(" Xw_begin_poly(%lx,%d,%d)\n",(long ) pwindow,npoint,npath) ; -} -#endif - return (XW_SUCCESS) ; -} - -/* - STATUS Xw_poly_point (awindow,x,y): - XW_EXT_WINDOW *awindow - float x,y New point to add in polygone in user-space coordinates - - Fill Polygone with one point more - - returns ERROR if Too Many Points in polygones - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_poly_point(void* awindow,float x,float y) -#else -XW_STATUS Xw_poly_point(awindow,x,y) -void *awindow ; -float x,y ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_BUFFER *pbuffer ; -int bindex,xi,yi ; - - if( FirstPolyPoint >= 0 ) { - int ldesc = plinedesc->npoint ; - if( ldesc >= MAXPOINTS ) { - /*ERROR*Too many points in POLYGONE*/ - Xw_set_error(32,"Xw_poly_point",&ldesc) ; - Xw_close_poly(pwindow) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; -//OCC186 - xi = PXPOINT(x, pwindow->xratio) ; - yi = PYPOINT(y, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 -#ifdef BUC40223 - if( Npoint > 0 ) { - int status; - status = Xw_clip_segment(pwindow,Lx,Ly,xi,yi,&segment); - if( status >= 0 ) { - if( (Npoint < 2) || (status & 0xF ) ) { - plinedesc->rpoints[ldesc].x = segment.x1 ; - plinedesc->rpoints[ldesc].y = segment.y1 ; - ldesc++; plinedesc->npoint++ ; - if( bindex > 0 ) { - int xx = segment.x1,yy = segment.y1; - pbuffer = &_BUFFER(bindex) ; - pbuffer->isempty = False ; - pbuffer->rxmin = min(pbuffer->rxmin,xx) ; - pbuffer->rymin = min(pbuffer->rymin,yy) ; - pbuffer->rxmax = max(pbuffer->rxmax,xx) ; - pbuffer->rymax = max(pbuffer->rymax,yy) ; - } - } - plinedesc->rpoints[ldesc].x = segment.x2 ; - plinedesc->rpoints[ldesc].y = segment.y2 ; - plinedesc->npoint++ ; - if( bindex > 0 ) { - int xx = segment.x2,yy = segment.y2; - pbuffer = &_BUFFER(bindex) ; - pbuffer->isempty = False ; - pbuffer->rxmin = min(pbuffer->rxmin,xx) ; - pbuffer->rymin = min(pbuffer->rymin,yy) ; - pbuffer->rxmax = max(pbuffer->rxmax,xx) ; - pbuffer->rymax = max(pbuffer->rymax,yy) ; - } - } - } - Lx = xi; Ly = yi; - Npoint++; -#else - plinedesc->rpoints[ldesc].x = xi ; - plinedesc->rpoints[ldesc].y = yi ; - plinedesc->npoint++ ; - if( bindex > 0 ) { - pbuffer = &_BUFFER(bindex) ; - pbuffer->isempty = False ; - pbuffer->rxmin = min(pbuffer->rxmin,xi) ; - pbuffer->rymin = min(pbuffer->rymin,yi) ; - pbuffer->rxmax = max(pbuffer->rxmax,xi) ; - pbuffer->rymax = max(pbuffer->rymax,yi) ; - } -#endif - } - -#ifdef TRACE_DRAW_POLY -if( Xw_get_trace() > 3 ) { - printf(" Xw_poly_point(%lx,%f,%f)\n",(long ) pwindow,x,y) ; -} -#endif - return (XW_SUCCESS) ; -} - -/* - STATUS Xw_close_path (awindow): - XW_EXT_WINDOW *awindow - - Close the Polygone path - - returns ERROR if TOO many path - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_path(void* awindow) -#else -XW_STATUS Xw_close_path(awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -#ifdef TRACE_DRAW_POLY -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -#endif - - if( FirstPolyPoint >= 0 ) { - int npoly = ppolylist->npoly ; - int ldesc = plinedesc->npoint ; - - if( plinedesc->rpoints[FirstPathPoint].x != plinedesc->rpoints[ldesc-1].x || - plinedesc->rpoints[FirstPathPoint].y != plinedesc->rpoints[ldesc-1].y ) { - plinedesc->rpoints[ldesc].x = plinedesc->rpoints[FirstPathPoint].x ; - plinedesc->rpoints[ldesc].y = plinedesc->rpoints[FirstPathPoint].y ; - plinedesc->npoint++ ; ldesc++ ; - } - ppolylist->polys[FirstPolyLine] = ldesc - FirstPolyPoint ; - ppolylist->paths[npoly] = ldesc - FirstPathPoint ; - FirstPathPoint = ldesc; - if( ppolylist->npoly < MAXPOLYS ) { - ppolylist->npoly = ++npoly ; - ppolylist->polys[npoly] = 0 ; - ppolylist->paths[npoly] = Npoint = 0 ; - ppolylist->ppolys[npoly] = &plinedesc->rpoints[ldesc] ; - } else { - /*ERROR*Too many paths in POLYGONE*/ - Xw_set_error(32,"Xw_close_path",&ppolylist->npoly) ; - return (XW_ERROR) ; - } - } - -#ifdef TRACE_DRAW_POLY -if( Xw_get_trace() > 2 ) { - printf(" Xw_close_path(%lx)\n",(long ) pwindow) ; -} -#endif - return (XW_SUCCESS) ; -} - -/* - STATUS Xw_close_poly (awindow): - XW_EXT_WINDOW *awindow - - Close the Polygone - - returns ERROR if Polygone is empty - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_poly(void* awindow) -#else -XW_STATUS Xw_close_poly(awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; - - if( FirstPolyPoint >= 0 ) { - - if( plinedesc->npoint > FirstPathPoint ) Xw_close_path(pwindow); - - if( !_BINDEX ) { - int polyindex = pwindow->polyindex ; - int lineindex = pwindow->lineindex ; - GC gcpoly = (QGTILE(pwindow->qgpoly[polyindex].code)) ? - pwindow->qgpoly[polyindex].gc : NULL ; - GC gcline = (QGTYPE(pwindow->qgpoly[polyindex].code)) ? - pwindow->qgline[lineindex].gc : NULL ; - Xw_draw_pixel_polys(pwindow,ppolylist,gcpoly,gcline); - ppolylist->npoly = 0 ; - plinedesc->npoint = 0 ; - } - FirstPolyPoint = -1 ; - } - -#ifdef TRACE_DRAW_POLY -if( Xw_get_trace() > 2 ) { - printf(" Xw_close_poly(%lx)\n",(long ) pwindow) ; -} -#endif - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_EXT_POLY* Xw_add_polygone_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_POLY* Xw_add_polygone_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended polygone structure in the - polygone List - - returns Extended polygone address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_POLY *ppoly ; - - ppoly = (XW_EXT_POLY*) Xw_malloc(sizeof(XW_EXT_POLY)) ; - if( ppoly ) { - ppoly->link = pbuflist->ppolylist ; - ppoly->isupdated = False ; - ppoly->npoly = 0 ; - pbuflist->ppolylist = ppoly ; - } else { - /*ERROR*EXT_POLYGONE allocation failed*/ - Xw_set_error(34,"Xw_add_polygone_structure",NULL) ; - } - - return (ppoly) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_polygone_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_polygone_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended polygone structure in the - polygone List - - SUCCESS always -*/ -{ -XW_EXT_POLY *ppoly,*qpoly ; - - for( ppoly = pbuflist->ppolylist ; ppoly ; ppoly = qpoly ) { - qpoly = (XW_EXT_POLY*)ppoly->link ; - Xw_free(ppoly) ; - } - pbuflist->ppolylist = NULL ; - - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_draw_polyarc.cxx b/src/Xw/Xw_draw_polyarc.cxx deleted file mode 100755 index 54cb86b7d7..0000000000 --- a/src/Xw/Xw_draw_polyarc.cxx +++ /dev/null @@ -1,326 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_POLYARC -#endif - -/* - STATUS Xw_draw_polyarc (awindow,xc,yc,xradius,yradius,start,angle): - XW_EXT_WINDOW *awindow - float xc,yc Arc center defined in User Space - float xradius Horizontal arc radius defined in User Space - float xradius Vertical Arc radius defined in User Space - float start Start angle defined in RADIAN - float angle Arc angle defined in RADIAN - - Display arc in current QG set by set_poly_attrib . - or retain arcs in buffer. - - returns ERROR if bad parameter - returns SUCCESS if successfull - -*/ - -#define MAXCOORD 32767 -#define MINCOORD -32768 - -static int BeginArcs = False; -static XW_EXT_ARC *parclist ; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_polyarc (void* awindow,float xc,float yc, - float xradius,float yradius,float start,float angle) -#else -XW_STATUS Xw_draw_polyarc (awindow,xc,yc,xradius,yradius,start,angle) -void *awindow; -float xc,yc,xradius,yradius,start,angle ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) awindow ; -XW_EXT_BUFFER *pbuffer ; -int narc,bindex,angle1,angle2,x,y,width,height ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_polyarc",pwindow) ; - return (XW_ERROR) ; - } - - if( xradius <= 0. ) { - /*ERROR*Bad arc radius*/ - Xw_set_error(115,"Xw_draw_polyarc",&xradius) ; - return (XW_ERROR) ; - } - - if( yradius <= 0. ) { - /*ERROR*Bad arc radius*/ - Xw_set_error(115,"Xw_draw_polyarc",&yradius) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - for( parclist = pbuffer->pparclist ; parclist ; - parclist = (XW_EXT_ARC*) parclist->link ) { - if( parclist->narc < MAXARCS ) break ; - } - - if( !parclist ) { - parclist = Xw_add_polyarc_structure(pbuffer) ; - } - - if( !parclist ) return XW_ERROR ; - - angle1 = (int )( start*64./DRAD ); - if( angle1 > 0 ) { - while( angle1 > MAXANGLE ) angle1 -= MAXANGLE ; - } else if( angle1 < 0 ) { - while( angle1 < -MAXANGLE ) angle1 += MAXANGLE ; - } - angle2 = (int )( angle*64./DRAD ); - if( angle2 > 0 ) { - while( angle2 > MAXANGLE ) angle2 -= MAXANGLE ; - } else if( angle2 < 0 ) { - while( angle2 < -MAXANGLE ) angle2 += MAXANGLE ; - } -//OCC186 - width = 2*PVALUE(xradius, pwindow->xratio, pwindow->yratio) ; - height = 2*PVALUE(yradius, pwindow->xratio, pwindow->yratio) ; - x = PXPOINT(xc, pwindow->xratio) ; - y = PYPOINT(yc, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 - x = max(min(x,MAXCOORD),MINCOORD); - y = max(min(y,MAXCOORD),MINCOORD); - if( width < 0xFFFF && height < 0xFFFF ) { - narc = parclist->narc ; - parclist->rarcs[narc].width = width ; - parclist->rarcs[narc].height = height ; - parclist->rarcs[narc].x = x - width/2 ; - parclist->rarcs[narc].y = y - height/2 ; - parclist->rarcs[narc].angle1 = angle1 ; - parclist->rarcs[narc].angle2 = angle2 ; - parclist->narc++ ; - if( bindex > 0 ) { - pbuffer->isempty = False ; - width = (width+1)/2 ; - height = (height+1)/2 ; - pbuffer->rxmin = min(pbuffer->rxmin,x-width) ; - pbuffer->rymin = min(pbuffer->rymin,y-height) ; - pbuffer->rxmax = max(pbuffer->rxmax,x+width) ; - pbuffer->rymax = max(pbuffer->rymax,y+height) ; - } else if( !BeginArcs ) { - int polyindex = pwindow->polyindex ; - int lineindex = pwindow->lineindex ; - GC gcpoly = pwindow->qgpoly[polyindex].gc ; - GC gcline = (QGTYPE(pwindow->qgpoly[polyindex].code)) ? - pwindow->qgline[lineindex].gc : NULL ; - Xw_draw_pixel_polyarcs(pwindow,parclist,gcpoly,gcline); - parclist->narc = 0 ; - } - } else { - /*ERROR*Too big arc radius*/ - Xw_set_error(116,"Xw_draw_polyarc",0) ; - return (XW_ERROR) ; - } - -#ifdef TRACE_DRAW_POLYARC -if( Xw_get_trace() > 2 ) { - printf(" Xw_draw_polyarc(%lx,%f,%f,%f,%f,%f,%f\n", - (long ) pwindow,xc,yc,xradius,yradius,start,angle); -} -#endif - - return (XW_SUCCESS); -} - -/* - STATUS Xw_begin_polyarcs (awindow,narc): - XW_EXT_WINDOW *awindow - int narc Not used - - - Begin a set of arcs which must be filled by Xw_draw_polyarc and - closed by Xw_close_polyarcs - - returns ERROR if bad extended window address - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_begin_polyarcs(void* awindow,int narc) -#else -XW_STATUS Xw_begin_polyarcs(awindow,narc) -void *awindow ; -int narc ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_begin_polyarcs",pwindow) ; - return (XW_ERROR) ; - } - - if( BeginArcs ) Xw_close_polyarcs(pwindow); - - BeginArcs = True; - -#ifdef TRACE_DRAW_POLYARC -if( Xw_get_trace() > 2 ) { - printf(" Xw_begin_polyarcs(%lx,%d)\n",(long ) pwindow,narc) ; -} -#endif - return (XW_SUCCESS) ; -} - -/* - STATUS Xw_close_polyarcs (awindow): - XW_EXT_WINDOW *awindow - - Close the set of arcs - - returns ERROR if bad extended window address - returns SUCCESS successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_polyarcs(void* awindow) -#else -XW_STATUS Xw_close_polyarcs(awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -int bindex ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_close_polyarcs",pwindow) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - if( BeginArcs && !bindex ) { - int polyindex = pwindow->polyindex ; - int lineindex = pwindow->lineindex ; - GC gcpoly = pwindow->qgpoly[polyindex].gc ; - GC gcline = (QGTYPE(pwindow->qgpoly[polyindex].code)) ? - pwindow->qgline[lineindex].gc : NULL ; - for( parclist = _BUFFER(bindex).pparclist ; parclist ; - parclist = (XW_EXT_ARC*) parclist->link ) { - if( parclist->narc > 0 ) { - Xw_draw_pixel_polyarcs(pwindow,parclist,gcpoly,gcline); - parclist->narc = 0 ; - } else break ; - } - } - - BeginArcs = False; - -#ifdef TRACE_DRAW_POLYARC -if( Xw_get_trace() > 2 ) { - printf(" Xw_close_polyarcs(%lx)\n",(long ) pwindow) ; -} -#endif - return (XW_SUCCESS) ; -} - - -#ifdef XW_PROTOTYPE -void Xw_draw_pixel_polyarcs (XW_EXT_WINDOW* pwindow,XW_EXT_ARC* parclist, - GC gcpoly,GC gcline) -#else -void Xw_draw_pixel_polyarcs (pwindow,parclist,gcpoly,gcline) -XW_EXT_WINDOW *pwindow; -XW_EXT_ARC *parclist; -GC gcpoly,gcline; -#endif /*XW_PROTOTYPE*/ -{ - - if( parclist->isupdated ) { - XFillArcs(_DISPLAY,_DRAWABLE,gcpoly,parclist->uarcs,parclist->narc) ; - if( gcline && (gcpoly != gcline) ) { - XDrawArcs(_DISPLAY,_DRAWABLE,gcline,parclist->uarcs,parclist->narc) ; - } - } else { - XFillArcs(_DISPLAY,_DRAWABLE,gcpoly,parclist->rarcs,parclist->narc) ; - if( gcline && (gcpoly != gcline) ) { - XDrawArcs(_DISPLAY,_DRAWABLE,gcline,parclist->rarcs,parclist->narc) ; - } - } -} - -#ifdef XW_PROTOTYPE -XW_EXT_ARC* Xw_add_polyarc_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_ARC* Xw_add_polyarc_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended arc structure in the - arc List - - returns Extended arc address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_ARC *parc ; - - parc = (XW_EXT_ARC*) Xw_malloc(sizeof(XW_EXT_ARC)) ; - if( parc ) { - parc->link = pbuflist->pparclist ; - parc->isupdated = 0 ; - parc->narc = 0 ; - pbuflist->pparclist = parc ; - } else { - /*ERROR*EXT_ARC Allocation failed*/ - Xw_set_error(35,"Xw_add_polyarc_structure",NULL) ; - } - - return (parc) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_polyarc_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_polyarc_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended arc structure in the - arc List - - SUCCESS always -*/ -{ -XW_EXT_ARC *parc,*qarc ; - - for( parc = pbuflist->pparclist ; parc ; parc = qarc ) { - qarc = (XW_EXT_ARC*)parc->link ; - Xw_free(parc) ; - } - pbuflist->pparclist = NULL ; - - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_draw_polytext.cxx b/src/Xw/Xw_draw_polytext.cxx deleted file mode 100755 index a4e07e8dd3..0000000000 --- a/src/Xw/Xw_draw_polytext.cxx +++ /dev/null @@ -1,459 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define GG002 /*GG_020197 -Renvoyer la hauteur du texte et non de la font -*/ - -#define GG010 /*GG_150197 - Ameliorer la conformiter de l'underline vis a vis de WORLD -*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_POLYTEXT -#endif - -/* - STATUS Xw_draw_polytext (awindow,x,y,text,angle,marge,mode): - XW_EXT_WINDOW *awindow - float x,y Position of the beginning of text in world coordinate - char text[] String to display - float angle Rotated text angle - float marge Margin text ratio - int mode 1 si outline - - Display text in current QG set by set_text_attrib . - - returns ERROR if text length > MAXCHARS - returns SUCCESS if successful - -*/ - -#define MAXCOORD 32767 -#define MINCOORD -32768 - -#define XROTATE(x,y) (x*cosa + y*sina) -#define YROTATE(x,y) (y*cosa - x*sina) - -static XW_EXT_PTEXT *ptextlist ; -static XW_EXT_CHAR *ptextdesc ; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_polytext (void* awindow,float x,float y, - char* text,float angle,float marge,int mode) -#else -XW_STATUS Xw_draw_polytext (awindow,x,y,text,angle,marge,mode) -void *awindow; -float x,y ; -float angle ; -float marge ; -char *text ; -int mode ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -int ntext,nchar,length,bindex,ix,iy,textindex,textfont,texttype ; -XW_ATTRIB textcode; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_polytext",pwindow) ; - return (XW_ERROR) ; - } - - if( marge < 0. || marge > 1. ) { - /*ERROR*Bad poly text margin*/ - Xw_set_error(124,"Xw_draw_polytext",&marge) ; - return (XW_ERROR) ; - } - - length = strlen(text) ; - if( length+1 > MAXCHARS ) { - length = MAXCHARS-1 ; - /*ERROR*Too big text string*/ - Xw_set_error(38,"Xw_draw_polytext",&length) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - for( ptextlist = pbuffer->pptextlist ; ptextlist ; - ptextlist = (XW_EXT_PTEXT*)ptextlist->link ) { - if( ptextlist->ntext < MAXPTEXTS ) break ; - } - - if( !ptextlist ) { - ptextlist = Xw_add_polytext_structure(pbuffer) ; - } - - if( !ptextlist ) return XW_ERROR ; - - for( ptextdesc = pbuffer->ptextdesc ; ptextdesc ; - ptextdesc = (XW_EXT_CHAR*)ptextdesc->link ) { - if( ptextdesc->nchar + length < MAXCHARS ) break ; - } - - if( !ptextdesc ) { - ptextdesc = Xw_add_text_desc_structure(pbuffer) ; - } - - if( !ptextdesc ) return XW_ERROR ; - -//OCC186 - ix = PXPOINT(x, pwindow->xratio) ; - iy = PYPOINT(y, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 - - ix = max(min(ix,MAXCOORD),MINCOORD); - iy = max(min(iy,MAXCOORD),MINCOORD); - - textindex = pwindow->textindex ; - textcode = pwindow->qgtext[textindex].code ; - textfont = QGFONT(textcode); - texttype = QGTYPE(textcode); - if( mode ) texttype |= XW_EXTENDEDTEXT_OUTLINE ; - - ntext = ptextlist->ntext ; - nchar = ptextdesc->nchar ; - ptextlist->modes[ntext] = texttype ; - ptextlist->texts[ntext] = length ; - ptextlist->ptexts[ntext] = &ptextdesc->chars[nchar] ; - ptextlist->rpoints[ntext].x = ix ; - ptextlist->rpoints[ntext].y = iy ; - ptextlist->rscalex[ntext] = 1. ; - ptextlist->rscaley[ntext] = 1. ; - ptextlist->slants[ntext] = 0. ; - strcpy(ptextlist->ptexts[ntext],text) ; - if( angle > 0. ) { - while( angle > 2.*M_PI ) angle -= 2.*M_PI ; - } else if( angle < 0. ) { - while( angle < -2.*M_PI ) angle += 2.*M_PI ; - } - ptextlist->rangles[ntext] = angle ; - ptextlist->marges[ntext] = marge ; - nchar += length+1 ; - ptextlist->ntext++ ; - ptextdesc->nchar = nchar ; - - if( bindex > 0 ) { - int dm ; - XFontStruct *pfontinfo = _FONTMAP->fonts[textfont] ; -#ifdef GG002 - int xmin,ymin,xmax,ymax,dir,fascent,fdescent; - XCharStruct overall; - XTextExtents(pfontinfo,text,length, - &dir,&fascent,&fdescent,&overall); - xmin = overall.lbearing; - xmax = overall.width; - ymin = -overall.ascent; - ymax = overall.descent; -#else - int xmin = 0 ; - int xmax = XTextWidth(pfontinfo,text,length) ; - int ymin = -pfontinfo->ascent ; - int ymax = pfontinfo->descent ; -#endif - dm = (int )( marge*(ymax-ymin)+0.5 ); - xmin -= dm ; ymin -= dm ; xmax += dm ; ymax += dm ; - - pbuffer->isempty = False ; - if( texttype & XW_EXTENDEDTEXT_UNDERLINE ) { -#ifdef GG010 - if( _FONTMAP->fratios[textfont] <= 0. ) -#endif - ymax += 2*max(2,(ymax-ymin)/8) ; - } -// if( abs(angle) > 0. ) { - if( fabs(angle) > 0. ) { - float cosa = cos((double)angle) ; - float sina = sin((double)angle) ; - int tx,ty ; - tx = (int )( ix + XROTATE(xmin,ymin) ); - ty = (int )( iy + YROTATE(xmin,ymin) ); - pbuffer->rxmin = min(pbuffer->rxmin,tx) ; - pbuffer->rymin = min(pbuffer->rymin,ty) ; - pbuffer->rxmax = max(pbuffer->rxmax,tx) ; - pbuffer->rymax = max(pbuffer->rymax,ty) ; - tx = (int )( ix + XROTATE(xmax,ymax) ); - ty = (int )( iy + YROTATE(xmax,ymax) ); - pbuffer->rxmin = min(pbuffer->rxmin,tx) ; - pbuffer->rymin = min(pbuffer->rymin,ty) ; - pbuffer->rxmax = max(pbuffer->rxmax,tx) ; - pbuffer->rymax = max(pbuffer->rymax,ty) ; - tx = (int )( ix + XROTATE(xmax,ymin) ); - ty = (int )( iy + YROTATE(xmax,ymin) ); - pbuffer->rxmin = min(pbuffer->rxmin,tx) ; - pbuffer->rymin = min(pbuffer->rymin,ty) ; - pbuffer->rxmax = max(pbuffer->rxmax,tx) ; - pbuffer->rymax = max(pbuffer->rymax,ty) ; - tx = (int )( ix + XROTATE(xmin,ymax) ); - ty = (int )( iy + YROTATE(xmin,ymax) ); - pbuffer->rxmin = min(pbuffer->rxmin,tx) ; - pbuffer->rymin = min(pbuffer->rymin,ty) ; - pbuffer->rxmax = max(pbuffer->rxmax,tx) ; - pbuffer->rymax = max(pbuffer->rymax,ty) ; - } else { - pbuffer->rxmin = min(pbuffer->rxmin,ix+xmin) ; - pbuffer->rymin = min(pbuffer->rymin,iy+ymin) ; - pbuffer->rxmax = max(pbuffer->rxmax,ix+xmax) ; - pbuffer->rymax = max(pbuffer->rymax,iy+ymax) ; - } - } else { - int polyindex = pwindow->polyindex ; - int lineindex = pwindow->lineindex ; - GC gctext = pwindow->qgtext[textindex].gc ; - GC gcpoly = (QGTILE(pwindow->qgpoly[polyindex].code)) ? - pwindow->qgpoly[polyindex].gc : NULL ; - GC gcline = (QGTYPE(pwindow->qgpoly[polyindex].code)) ? - pwindow->qgline[lineindex].gc : NULL ; - Xw_draw_pixel_polytexts(pwindow,ptextlist, - gctext,gcpoly,gcline,textcode) ; - ptextlist->ntext = 0 ; - ptextdesc->nchar = 0 ; - } - - -#ifdef TRACE_DRAW_POLYTEXT -if( Xw_get_trace() > 2 ) { - printf(" Xw_draw_polytext(%lx,%f,%f,'%s',%f,%f)\n", - (long ) pwindow,x,y,text,angle,marge) ; -} -#endif - - return (XW_SUCCESS); -} - -#ifdef XW_PROTOTYPE -void Xw_draw_pixel_polytexts(XW_EXT_WINDOW* pwindow,XW_EXT_PTEXT* ptextlist, - GC gctext,GC gcpoly,GC gcline,XW_ATTRIB code) -#else -void Xw_draw_pixel_polytexts(pwindow,ptextlist,gctext,gcpoly,gcline,code) -XW_EXT_WINDOW *pwindow ; -XW_EXT_PTEXT *ptextlist ; -GC gctext,gcpoly,gcline ; -XW_ATTRIB code ; -#endif /*XW_PROTOTYPE*/ -{ -int i,ix,iy,mode,length,font = QGFONT(code),type = QGTYPE(code) ; -float angle,marge,cosa,sina ; -char *pchar ; -XPoint points[5] ; - - for( i=0 ; intext ; i++ ) { - length = ptextlist->texts[i] ; - if( length <= 0 ) continue ; - if( ptextlist->isupdated ) { - ix = ptextlist->upoints[i].x ; - iy = ptextlist->upoints[i].y ; - angle = ptextlist->uangles[i] ; - } else { - ix = ptextlist->rpoints[i].x ; - iy = ptextlist->rpoints[i].y ; - angle = ptextlist->rangles[i] ; - } - mode = ptextlist->modes[i] ; - marge = ptextlist->marges[i] ; - pchar = ptextlist->ptexts[i] ; - if( type & XW_EXTENDEDTEXT_MINHEIGHT ) { -//OCC186 - int rcx = max(4,PVALUE(FROMMILLIMETER(_FONTMAP->ssizex[font]), - pwindow->xratio, pwindow->yratio)/3); - int rcy = max(4,PVALUE(FROMMILLIMETER(_FONTMAP->ssizey[font]), - pwindow->xratio, pwindow->yratio)/3); -//OCC186 - if( angle == 0. ) { - XFillArc(_DISPLAY,_DRAWABLE,gctext, - ix-rcx,iy-rcy,2*rcx,2*rcy,0,360*64) ; - } else { - int dx,dy ; - cosa = cos((double)angle) ; - sina = sin((double)angle) ; - dx = (int )( XROTATE(0,rcx) ); - dy = (int )( YROTATE(0,rcy) ); - XFillArc(_DISPLAY,_DRAWABLE,gctext, - ix-dx,iy-dy,2*rcx,2*rcy,0,360*64) ; - } - } else { - XFontStruct *pfontinfo = _FONTMAP->fonts[font] ; - int dm,du = 0; -#ifdef GG002 - int xmin,ymin,xmax,ymax,dir,fascent,fdescent; - XCharStruct overall; - XTextExtents(pfontinfo,pchar,length, - &dir,&fascent,&fdescent,&overall); - xmin = overall.lbearing; - xmax = overall.width; - ymin = -overall.ascent; - ymax = overall.descent; -#else - int xmin = 0 ; - int xmax = XTextWidth(pfontinfo,pchar,length) ; - int ymin = -pfontinfo->ascent ; - int ymax = pfontinfo->descent ; -#endif - if( type & XW_EXTENDEDTEXT_UNDERLINE ) { -#ifdef GG010 - if( _FONTMAP->fratios[font] > 0. ) { -//OCC186 - du = PVALUE(0.6*_FONTMAP->fratios[font]* - FROMMILLIMETER(_FONTMAP->ssizey[font]), - pwindow->xratio, pwindow->yratio); -//OCC186 - } else { - du = max(2,(ymax-ymin)/8) ; - ymax += 2*du ; - } -#else - du = max(2,(ymax-ymin)/8) ; - ymax += 2*du ; -#endif - } - dm = (int )( marge*(ymax-ymin)+0.5 ); - xmin -= dm ; ymin -= dm ; xmax += dm ; ymax += dm ; - if( angle == 0. ) { - if( gcpoly ) { - XFillRectangle(_DISPLAY,_DRAWABLE,gcpoly, - ix+xmin,iy+ymin,xmax-xmin,ymax-ymin) ; - } - if( gcline && (gcline != gcpoly) ) { - XDrawRectangle(_DISPLAY,_DRAWABLE,gcline, - ix+xmin,iy+ymin,xmax-xmin,ymax-ymin) ; - } - if( type & XW_EXTENDEDTEXT_UNDERLINE ) { -#ifdef GG010 - xmin += dm ; xmax -= dm ; ymax = du ; -#else - xmin += dm ; xmax -= dm ; ymax -= dm + du ; -#endif - XDrawLine(_DISPLAY,_DRAWABLE,gctext, - ix+xmin,iy+ymax,ix+xmax,iy+ymax) ; - } - XDrawString(_DISPLAY,_DRAWABLE,gctext,ix,iy,pchar,length) ; - } else { - int j,tx,ty,w ; - float dx,dy ; - - XFontStruct *pfontinfo = _FONTMAP->fonts[font] ; - cosa = cos((double)angle) ; - sina = sin((double)angle) ; - dx = XROTATE(xmin,ymin) ; - dy = YROTATE(xmin,ymin) ; - points[0].x = ix + ROUND(dx) ; - points[0].y = iy + ROUND(dy) ; - dx = XROTATE(xmax,ymin) ; - dy = YROTATE(xmax,ymin) ; - points[1].x = ix + ROUND(dx) ; - points[1].y = iy + ROUND(dy) ; - dx = XROTATE(xmax,ymax) ; - dy = YROTATE(xmax,ymax) ; - points[2].x = ix + ROUND(dx) ; - points[2].y = iy + ROUND(dy) ; - dx = XROTATE(xmin,ymax) ; - dy = YROTATE(xmin,ymax) ; - points[3].x = ix + ROUND(dx) ; - points[3].y = iy + ROUND(dy) ; - points[4].x = points[0].x ; - points[4].y = points[0].y ; - if( gcpoly ) { - XFillPolygon(_DISPLAY,_DRAWABLE,gcpoly,points,4, - Convex,CoordModeOrigin) ; - } - if( gcline && (gcline != gcpoly) ) { - XDrawLines(_DISPLAY,_DRAWABLE,gcline,points,5, - CoordModeOrigin) ; - } - if( type & XW_EXTENDEDTEXT_UNDERLINE ) { - int x1,y1,x2,y2 ; -#ifdef GG010 - xmin += dm ; xmax -= dm ; ymax = du ; -#else - xmin += dm ; xmax -= dm ; ymax -= dm + du ; -#endif - x1 = (int )( XROTATE(xmin,ymax) ); - y1 = (int )( YROTATE(xmin,ymax) ); - x2 = (int )( XROTATE(xmax,ymax) ); - y2 = (int )( YROTATE(xmax,ymax) ); - XDrawLine(_DISPLAY,_DRAWABLE,gctext,ix+x1,iy+y1,ix+x2,iy+y2) ; } - for( j=tx=ty=0 ; jlink = pbuflist->pptextlist ; - ptext->isupdated = 0 ; - ptext->ntext = 0 ; - pbuflist->pptextlist = ptext ; - } else { - /*ERROR*EXT_TEXT Allocation failed*/ - Xw_set_error(39,"Xw_add_polytext_structure",NULL) ; - } - - return (ptext) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_polytext_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_polytext_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended polytext structure in the - text List - - SUCCESS always -*/ -{ -XW_EXT_PTEXT *ptext,*qtext ; - - for( ptext = pbuflist->pptextlist ; ptext ; ptext = qtext ) { - qtext = (XW_EXT_PTEXT*)ptext->link ; - Xw_free(ptext) ; - } - pbuflist->pptextlist = NULL ; - - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_draw_segment.cxx b/src/Xw/Xw_draw_segment.cxx deleted file mode 100755 index dce1741fb6..0000000000 --- a/src/Xw/Xw_draw_segment.cxx +++ /dev/null @@ -1,399 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#define S3593 /*GG_130398 -OPTIMISATION MFT - Activer le clipping de maniere optionnelle -*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_SEGMENT -#endif - -static XW_EXT_SEGMENT *pseglist ; -static int BeginSegments = False ; - -/* - STATUS Xw_draw_segment (awindow,x1,y1,x2,y2): - XW_EXT_WINDOW *awindow - float x1,y1 First point Coordinates defined in User Space - float x2,y2 Second point Coordinates defined in User Space - - Display segment in current QG set by set_line_attrib . - Note that segments can be buffered depending of the DisplayMode context - and Flush at Xw_flush time . - - returns SUCCESS always - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_segment (void* awindow,float x1,float y1,float x2,float y2) -#else -XW_STATUS Xw_draw_segment (awindow,x1,y1,x2,y2) -void *awindow; -float x1,y1,x2,y2 ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -int status ; -int nseg,bindex; -int ix1,iy1,ix2,iy2 ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_segment",pwindow) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - for( pseglist = pbuffer->pseglist ; pseglist ; - pseglist = (XW_EXT_SEGMENT*)pseglist->link ) { - if( pseglist->nseg < MAXSEGMENTS ) break ; - } - - if( !pseglist ) { - pseglist = Xw_add_segment_structure(pbuffer) ; - } - - - if( !pseglist ) return XW_ERROR ; - -//OCC186 - ix1 = PXPOINT(x1, pwindow->xratio) ; - iy1 = PYPOINT(y1, pwindow->attributes.height, pwindow->yratio) ; - ix2 = PXPOINT(x2, pwindow->xratio) ; - iy2 = PYPOINT(y2, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 - - nseg = pseglist->nseg ; - -#ifdef S3593 - if( pwindow->clipflag ) { -#endif - status = Xw_clip_segment(pwindow,ix1,iy1,ix2,iy2, - &pseglist->rsegments[nseg]); - if( status < 0 ) return (XW_SUCCESS); -#ifdef S3593 - } else { - pseglist->rsegments[nseg].x1 = ix1 ; - pseglist->rsegments[nseg].y1 = iy1 ; - pseglist->rsegments[nseg].x2 = ix2 ; - pseglist->rsegments[nseg].y2 = iy2 ; - } -#endif - pseglist->nseg++ ; - - if( bindex > 0 ) { - pbuffer->isempty = False ; - if( ix1 < ix2 ) { - pbuffer->rxmin = min(pbuffer->rxmin,ix1) ; - pbuffer->rxmax = max(pbuffer->rxmax,ix2) ; - } else { - pbuffer->rxmin = min(pbuffer->rxmin,ix2) ; - pbuffer->rxmax = max(pbuffer->rxmax,ix1) ; - } - if( iy1 < iy2 ) { - pbuffer->rymin = min(pbuffer->rymin,iy1) ; - pbuffer->rymax = max(pbuffer->rymax,iy2) ; - } else { - pbuffer->rymin = min(pbuffer->rymin,iy2) ; - pbuffer->rymax = max(pbuffer->rymax,iy1) ; - } - } else if( !BeginSegments ) { - int index = pwindow->lineindex ; - Xw_draw_pixel_segments(pwindow,pseglist,pwindow->qgline[index].gc) ; - pseglist->nseg = 0 ; - } - -#ifdef TRACE_DRAW_SEGMENT -if( Xw_get_trace() > 2 ) { - printf(" Xw_draw_segment(%lx,%f,%f,%f,%f\n",(long ) pwindow,x1,y1,x2,y2) ; -} -#endif - - return (XW_SUCCESS); -} - -#ifdef XW_PROTOTYPE -void Xw_draw_pixel_segments(XW_EXT_WINDOW* pwindow,XW_EXT_SEGMENT *pseglist,GC gc) -#else -void Xw_draw_pixel_segments(pwindow,pseglist,gc) -XW_EXT_WINDOW *pwindow; -XW_EXT_SEGMENT *pseglist; -GC gc ; -#endif /*XW_PROTOTYPE*/ -{ - - if( pseglist->isupdated ) { - XDrawSegments(_DISPLAY,_DRAWABLE,gc, - pseglist->usegments,pseglist->nseg) ; - } else { - XDrawSegments(_DISPLAY,_DRAWABLE,gc, - pseglist->rsegments,pseglist->nseg) ; - } - -#ifdef TRACE_DRAW_SEGMENT -if( Xw_get_trace() > 2 ) { - printf(" %d = Xw_draw_pixel_segments(%lx,%lx,%lx\n",pseglist->nseg,(long ) pwindow,(long ) pseglist,(long ) gc) ; -} -#endif -} - -/* - STATUS Xw_begin_segments (awindow,nsegment): - XW_EXT_WINDOW *awindow - int nsegment Not used - - - Begin a set of segments which must be filled by Xw_draw_segment and - closed by Xw_close_segments - - returns ERROR if bad extended window address - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_begin_segments(void* awindow,int nsegment) -#else -XW_STATUS Xw_begin_segments(awindow,nsegment) -void *awindow ; -int nsegment ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_begin_segments",pwindow) ; - return (XW_ERROR) ; - } - - if( BeginSegments ) Xw_close_segments(pwindow); - - BeginSegments = True; - -#ifdef TRACE_DRAW_LINE -if( Xw_get_trace() > 2 ) { - printf(" Xw_begin_segments(%x,%d)\n",pwindow,nsegment) ; -} -#endif - return (XW_SUCCESS) ; -} - -/* - STATUS Xw_close_segments (awindow): - XW_EXT_WINDOW *awindow - - Close the set of segments - - returns ERROR if bad extended window address - returns SUCCESS successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_segments(void* awindow) -#else -XW_STATUS Xw_close_segments(awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_BUFFER *pbuffer ; -int bindex ; - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - if( BeginSegments && !bindex ) { - int index = pwindow->lineindex ; - for( pseglist = pbuffer->pseglist ; pseglist ; - pseglist = (XW_EXT_SEGMENT*)pseglist->link ) { - if( pseglist->nseg ) { - Xw_draw_pixel_segments(pwindow,pseglist, - pwindow->qgline[index].gc) ; - pseglist->nseg = 0 ; - } else break ; - } - } - - BeginSegments = False; - -#ifdef TRACE_DRAW_SEGMENT -if( Xw_get_trace() > 2 ) { - printf(" Xw_close_segments(%lx)\n",(long ) pwindow) ; -} -#endif - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_EXT_SEGMENT* Xw_add_segment_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_SEGMENT* Xw_add_segment_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended segment structure in the - segment List - - returns Extended segment address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_SEGMENT *pseg ; - - pseg = (XW_EXT_SEGMENT*) Xw_malloc(sizeof(XW_EXT_SEGMENT)) ; - if( pseg ) { - pseg->link = pbuflist->pseglist ; - pseg->isupdated = False ; - pseg->nseg = 0 ; - pbuflist->pseglist = pseg ; - } else { - /*ERROR*EXT_SEGMENT Allocation failed*/ - Xw_set_error(35,"Xw_add_segment_structure",NULL) ; - } - - return (pseg) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_segment_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_segment_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended segment structure in the - segment List - - SUCCESS always -*/ -{ -XW_EXT_SEGMENT *pseg,*qseg ; - - for( pseg = pbuflist->pseglist ; pseg ; pseg = qseg ) { - qseg = (XW_EXT_SEGMENT*)pseg->link ; - Xw_free(pseg) ; - } - pbuflist->pseglist = NULL ; - - return (XW_SUCCESS) ; -} - -#define MINXCOORD -32768 -#define MAXXCOORD 32767 -#define MINYCOORD -32768 -#define MAXYCOORD 32767 - -#ifdef XW_PROTOTYPE -int Xw_clip_segment (XW_EXT_WINDOW* pwindow,int x1,int y1,int x2,int y2,XSegment* pseg) -#else -int Xw_clip_segment (pwindow,x1,y1,x2,y2,pseg) -XW_EXT_WINDOW *pwindow; -int x1,y1,x2,y2; -XSegment *pseg; -#endif /*XW_PROTOTYPE*/ -/* - Clip a segment when one coord is < MINCOORD or > MAXCOORD. - Returns the clipped segment and a clip bit-mask status : - - 0 Nothing is clipped - 1 X first point is clipped on MAX - 2 X first point is clipped on MIN - 4 Y first point is clipped on MAX - 8 Y first point is clipped on MIN - 16 X second point is clipped on MAX - 32 X second point is clipped on MIN - 64 Y second point is clipped on MAX - 128 Y second point is clipped on MIN - -1 segment is out of space. -*/ -{ -int xx1 = x1,yy1 = y1,xx2 = x2,yy2 = y2; -int status = 0; - - if( xx1 > MAXXCOORD ) { - if( xx2 < MAXXCOORD ) { - float rap = (float)(yy2 - yy1)/(xx2 - xx1); - yy1 += (int)((MAXXCOORD - xx1) * rap); - xx1 = MAXXCOORD; - status |= 1; - } else return -1; - } else if( xx1 < MINXCOORD ) { - if( xx2 > MINXCOORD ) { - float rap = (float)(yy2 - yy1)/(xx2 - xx1); - yy1 += (int)((MINXCOORD - xx1) * rap); - xx1 = MINXCOORD; - status |= 2; - } else return -1; - } - - if( yy1 > MAXYCOORD ) { - if( yy2 < MAXYCOORD ) { - float rap = (float)(xx2 - xx1)/(yy2 - yy1); - xx1 += (int)((MAXYCOORD - yy1) * rap); - yy1 = MAXYCOORD; - status |= 4; - } else return -1; - } else if( yy1 < MINYCOORD ) { - if( yy2 > MINYCOORD ) { - float rap = (float)(xx2 - xx1)/(yy2 - yy1); - xx1 += (int)((MINYCOORD - yy1) * rap); - yy1 = MINYCOORD; - status |= 8; - } else return -1; - } - - if( xx2 > MAXXCOORD ) { - float rap = (float)(yy2 - yy1)/(xx2 - xx1); - yy2 = yy1 + (int)((MAXXCOORD - xx1) * rap); - xx2 = MAXXCOORD; - status |= 16; - } else if( xx2 < MINXCOORD ) { - float rap = (float)(yy2 - yy1)/(xx2 - xx1); - yy2 = yy1 + (int)((MINXCOORD - xx1) * rap); - xx2 = MINXCOORD; - status |= 32; - } - - if( yy2 > MAXYCOORD ) { - float rap = (float)(xx2 - xx1)/(yy2 - yy1); - xx2 = xx1 + (int)((MAXYCOORD - yy1) * rap); - yy2 = MAXYCOORD; - status |= 64; - } else if( yy2 < MINYCOORD ) { - float rap = (float)(xx2 - xx1)/(yy2 - yy1); - xx2 = xx1 + (int)((MINYCOORD - yy1) * rap); - yy2 = MINYCOORD; - status |= 128; - } - - pseg->x1 = xx1; - pseg->y1 = yy1; - pseg->x2 = xx2; - pseg->y2 = yy2; - - return status; -} diff --git a/src/Xw/Xw_draw_text.cxx b/src/Xw/Xw_draw_text.cxx deleted file mode 100755 index b7dfd28f88..0000000000 --- a/src/Xw/Xw_draw_text.cxx +++ /dev/null @@ -1,469 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define GG002 /*GG_020197 -Renvoyer la hauteur du texte et non de la font -*/ - -#define GG010 /*GG_150197 - Ameliorer la conformiter de l'underline vis a vis de WORLD -*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DRAW_TEXT -#endif - -/* - STATUS Xw_draw_text (awindow,x,y,text,angle,mode): - XW_EXT_WINDOW *awindow - float x,y Position of the beginning of text in world coordinate - char text[] String to display - float angle Rotated text angle - mode 1 si outline - - Display text in current QG set by set_text_attrib . - - returns ERROR if text length > MAXCHARS - returns SUCCESS if successful - -*/ - -#define MAXCOORD 32767 -#define MINCOORD -32768 - -#define XROTATE(x,y) (x*cosa + y*sina) -#define YROTATE(x,y) (y*cosa - x*sina) - -static XW_EXT_LTEXT *ptextlist ; -static XW_EXT_CHAR *ptextdesc ; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_text (void* awindow,float x,float y,char* text,float angle,int mode) -#else -XW_STATUS Xw_draw_text (awindow,x,y,text,angle,mode) -void *awindow; -float x,y ; -float angle ; -char *text ; -int mode ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_BUFFER *pbuffer ; -int ntext,nchar,length,bindex,ix,iy,textindex,textfont,texttype ; -XW_ATTRIB textcode; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_draw_text",pwindow) ; - return (XW_ERROR) ; - } - - length = strlen(text) ; - if( length+1 > MAXCHARS ) { - length = MAXCHARS-1 ; - /*ERROR*Too big text string*/ - Xw_set_error(38,"Xw_draw_text",&length) ; - return (XW_ERROR) ; - } - - bindex = _BINDEX ; - pbuffer = &_BUFFER(bindex) ; - for( ptextlist = pbuffer->pltextlist ; ptextlist ; - ptextlist = (XW_EXT_LTEXT*)ptextlist->link ) { - if( ptextlist->ntext < MAXLTEXTS ) break ; - } - - if( !ptextlist ) { - ptextlist = Xw_add_text_structure(pbuffer) ; - } - - if( !ptextlist ) return XW_ERROR ; - - for( ptextdesc = pbuffer->ptextdesc ; ptextdesc ; - ptextdesc = (XW_EXT_CHAR*)ptextdesc->link ) { - if( ptextdesc->nchar + length < MAXCHARS ) break ; - } - - if( !ptextdesc ) { - ptextdesc = Xw_add_text_desc_structure(pbuffer) ; - } - - if( !ptextdesc ) return XW_ERROR ; - -//OCC186 - ix = PXPOINT(x, pwindow->xratio) ; - iy = PYPOINT(y, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 - - ix = max(min(ix,MAXCOORD),MINCOORD); - iy = max(min(iy,MAXCOORD),MINCOORD); - - textindex = pwindow->textindex ; - textcode = pwindow->qgtext[textindex].code ; - textfont = QGFONT(textcode); - texttype = QGTYPE(textcode); - if( mode ) texttype |= XW_EXTENDEDTEXT_OUTLINE ; - - ntext = ptextlist->ntext ; - nchar = ptextdesc->nchar ; - ptextlist->modes[ntext] = texttype ; - ptextlist->texts[ntext] = length ; - ptextlist->ptexts[ntext] = &ptextdesc->chars[nchar] ; - ptextlist->rpoints[ntext].x = ix ; - ptextlist->rpoints[ntext].y = iy ; - ptextlist->rscalex[ntext] = 1. ; - ptextlist->rscaley[ntext] = 1. ; - ptextlist->slants[ntext] = 0. ; - strcpy(ptextlist->ptexts[ntext],text) ; - if( angle > 0. ) { - while( angle > 2.*M_PI ) angle -= 2.*M_PI ; - } else if( angle < 0. ) { - while( angle < -2.*M_PI ) angle += 2.*M_PI ; - } - ptextlist->rangles[ntext] = angle ; - - nchar += length+1 ; - ptextlist->ntext++ ; - ptextdesc->nchar = nchar ; - - if( bindex > 0 ) { - XFontStruct *pfontinfo = _FONTMAP->fonts[textfont] ; -#ifdef GG002 - int xmin,ymin,xmax,ymax,dir,fascent,fdescent; - XCharStruct overall; - XTextExtents(pfontinfo,text,length, - &dir,&fascent,&fdescent,&overall); - xmin = overall.lbearing; - xmax = overall.width; - ymin = -overall.ascent; - ymax = overall.descent; -#else - int xmin = 0 ; - int xmax = XTextWidth(pfontinfo,text,length) ; - int ymin = -pfontinfo->ascent ; - int ymax = pfontinfo->descent ; -#endif - pbuffer->isempty = False ; - if( texttype & XW_EXTENDEDTEXT_UNDERLINE ) { -#ifdef GG010 - if( _FONTMAP->fratios[textfont] <= 0. ) -#endif - ymax += 2*max(2,(ymax-ymin)/8) ; - } -// if( abs(angle) > 0. ) { - if( fabs(angle) > 0. ) { - float cosa = cos((double)angle) ; - float sina = sin((double)angle) ; - int tx,ty ; - tx = (int )( ix + XROTATE(xmin,ymin) ); - ty = (int )( iy + YROTATE(xmin,ymin) ); - pbuffer->rxmin = min(pbuffer->rxmin,tx) ; - pbuffer->rymin = min(pbuffer->rymin,ty) ; - pbuffer->rxmax = max(pbuffer->rxmax,tx) ; - pbuffer->rymax = max(pbuffer->rymax,ty) ; - tx = (int )( ix + XROTATE(xmax,ymax) ); - ty = (int )( iy + YROTATE(xmax,ymax) ); - pbuffer->rxmin = min(pbuffer->rxmin,tx) ; - pbuffer->rymin = min(pbuffer->rymin,ty) ; - pbuffer->rxmax = max(pbuffer->rxmax,tx) ; - pbuffer->rymax = max(pbuffer->rymax,ty) ; - tx = (int )( ix + XROTATE(xmax,ymin) ); - ty = (int )( iy + YROTATE(xmax,ymin) ); - pbuffer->rxmin = min(pbuffer->rxmin,tx) ; - pbuffer->rymin = min(pbuffer->rymin,ty) ; - pbuffer->rxmax = max(pbuffer->rxmax,tx) ; - pbuffer->rymax = max(pbuffer->rymax,ty) ; - tx = (int )( ix + XROTATE(xmin,ymax) ); - ty = (int )( iy + YROTATE(xmin,ymax) ); - pbuffer->rxmin = min(pbuffer->rxmin,tx) ; - pbuffer->rymin = min(pbuffer->rymin,ty) ; - pbuffer->rxmax = max(pbuffer->rxmax,tx) ; - pbuffer->rymax = max(pbuffer->rymax,ty) ; - } else { - pbuffer->rxmin = min(pbuffer->rxmin,ix+xmin) ; - pbuffer->rymin = min(pbuffer->rymin,iy+ymin) ; - pbuffer->rxmax = max(pbuffer->rxmax,ix+xmax) ; - pbuffer->rymax = max(pbuffer->rymax,iy+ymax) ; - } - } else { - int index = pwindow->textindex ; - Xw_draw_pixel_texts(pwindow,ptextlist, - pwindow->qgtext[index].gc, - pwindow->qgtext[index].code) ; - ptextlist->ntext = 0 ; - ptextdesc->nchar = 0 ; - } - - -#ifdef TRACE_DRAW_TEXT -if( Xw_get_trace() > 2 ) { - printf(" Xw_draw_text(%lx,%f,%f,'%s',%f)\n",(long ) pwindow,x,y,text,angle) ; -} -#endif - - return (XW_SUCCESS); -} - -#ifdef XW_PROTOTYPE -void Xw_draw_pixel_texts(XW_EXT_WINDOW* pwindow,XW_EXT_LTEXT* ptextlist, - GC gctext,XW_ATTRIB code) -#else -void Xw_draw_pixel_texts(pwindow,ptextlist,gctext,code) -XW_EXT_WINDOW *pwindow ; -XW_EXT_LTEXT *ptextlist ; -GC gctext ; -XW_ATTRIB code ; -#endif /*XW_PROTOTYPE*/ -{ -int i,ix,iy,mode,length,font = QGFONT(code),type = QGTYPE(code) ; -float angle,cosa,sina ; -char *pchar ; - - for( i=0 ; intext ; i++ ) { - length = ptextlist->texts[i] ; - if( length <= 0 ) continue ; - if( ptextlist->isupdated ) { - ix = ptextlist->upoints[i].x ; - iy = ptextlist->upoints[i].y ; - angle = ptextlist->uangles[i] ; - } else { - ix = ptextlist->rpoints[i].x ; - iy = ptextlist->rpoints[i].y ; - angle = ptextlist->rangles[i] ; - } - mode = ptextlist->modes[i] ; - pchar = ptextlist->ptexts[i] ; - if( type & XW_EXTENDEDTEXT_MINHEIGHT ) { -//OCC186 - int rcx = max(4,PVALUE(FROMMILLIMETER(_FONTMAP->ssizex[font]), - pwindow->xratio, pwindow->yratio)/3); - int rcy = max(4,PVALUE(FROMMILLIMETER(_FONTMAP->ssizey[font]), - pwindow->xratio, pwindow->yratio)/3); -//OCC186 - if( angle == 0. ) { - XFillArc(_DISPLAY,_DRAWABLE,gctext, - ix-rcx,iy-rcy,2*rcx,2*rcy,0,360*64) ; - } else { - int dx,dy ; - cosa = cos((double)angle) ; - sina = sin((double)angle) ; - dx = (int )( XROTATE(0,rcx) ); - dy = (int )( YROTATE(0,rcy) ); - XFillArc(_DISPLAY,_DRAWABLE,gctext, - ix-dx,iy-dy,2*rcx,2*rcy,0,360*64) ; - } - } else { - XFontStruct *pfontinfo = _FONTMAP->fonts[font] ; - int xmin,ymin,xmax,ymax ; - if( angle == 0. ) { - if( type & XW_EXTENDEDTEXT_UNDERLINE ) { -#ifdef GG002 - int dir,fascent,fdescent; - XCharStruct overall; - XTextExtents(pfontinfo,pchar,length, - &dir,&fascent,&fdescent,&overall); - xmin = overall.lbearing; - xmax = overall.width; - ymin = -overall.ascent; - ymax = overall.descent; -#else - xmin = 0 ; - xmax = XTextWidth(pfontinfo,pchar,length) ; - ymin = -pfontinfo->ascent ; - ymax = pfontinfo->descent ; -#endif -#ifdef GG010 - if( _FONTMAP->fratios[font] > 0. ) { -//OCC186 - ymax = PVALUE(0.6*_FONTMAP->fratios[font]* - FROMMILLIMETER(_FONTMAP->ssizey[font]), - pwindow->xratio, pwindow->yratio); -//OCC186 - } else { - ymax = max(2,(ymax-ymin)/8) ; - } -#else - ymax += max(2,(ymax-ymin)/8) ; -#endif - XDrawLine(_DISPLAY,_DRAWABLE,gctext, - ix+xmin,iy+ymax,ix+xmax,iy+ymax) ; - } - XDrawString(_DISPLAY,_DRAWABLE,gctext,ix,iy,pchar,length) ; - } else { - int w,j,tx,ty ; - cosa = cos((double)angle) ; - sina = sin((double)angle) ; - - if( type & XW_EXTENDEDTEXT_UNDERLINE ) { - int x1,y1,x2,y2 ; -#ifdef GG002 - int dir,fascent,fdescent; - XCharStruct overall; - XTextExtents(pfontinfo,pchar,length, - &dir,&fascent,&fdescent,&overall); - xmin = overall.lbearing; - xmax = overall.width; - ymin = -overall.ascent; - ymax = overall.descent; -#else - xmin = 0 ; - xmax = XTextWidth(pfontinfo,pchar,length) ; - ymin = -pfontinfo->ascent ; - ymax = pfontinfo->descent ; -#endif -#ifdef GG010 - if( _FONTMAP->fratios[font] > 0. ) { -//OCC186 - ymax = PVALUE(0.6*_FONTMAP->fratios[font]* - FROMMILLIMETER(_FONTMAP->ssizey[font]), - pwindow->xratio, pwindow->yratio); -//OCC186 - } else { - ymax = max(2,(ymax-ymin)/8) ; - } -#else - ymax += max(2,(ymax-ymin)/8) ; -#endif - x1 = (int )( XROTATE(xmin,ymax) ); - y1 = (int )( YROTATE(xmin,ymax) ); - x2 = (int )( XROTATE(xmax,ymax) ); - y2 = (int )( YROTATE(xmax,ymax) ); - XDrawLine(_DISPLAY,_DRAWABLE,gctext, - ix+x1,iy+y1,ix+x2,iy+y2) ; - } - for( j=tx=ty=0 ; jlink = pbuflist->pltextlist ; - ptext->isupdated = False ; - ptext->ntext = 0 ; - pbuflist->pltextlist = ptext ; - } else { - /*ERROR*EXT_TEXT Allocation failed*/ - Xw_set_error(39,"Xw_add_text_structure",NULL) ; - } - - return (ptext) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_text_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_text_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended text structure in the - text List - - SUCCESS always -*/ -{ -XW_EXT_LTEXT *ptext,*qtext ; - - for( ptext = pbuflist->pltextlist ; ptext ; ptext = qtext ) { - qtext = (XW_EXT_LTEXT*)ptext->link ; - Xw_free(ptext) ; - } - pbuflist->pltextlist = NULL ; - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_EXT_CHAR* Xw_add_text_desc_structure(XW_EXT_BUFFER* pbuflist ) -#else -XW_EXT_CHAR* Xw_add_text_desc_structure(pbuflist ) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert at end one Extended char structure in the - char List - - returns Extended char address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_CHAR *pchar ; - - pchar = (XW_EXT_CHAR*) Xw_malloc(sizeof(XW_EXT_CHAR)) ; - if( pchar ) { - pchar->link = pbuflist->ptextdesc ; - pchar->nchar = 0 ; - pbuflist->ptextdesc = pchar ; - } else { - /*ERROR*EXT_CHAR Allocation failed*/ - Xw_set_error(118,"Xw_add_text_desc_structure",NULL) ; - } - - return (pchar) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_text_desc_structure(XW_EXT_BUFFER* pbuflist) -#else -XW_STATUS Xw_del_text_desc_structure(pbuflist) -XW_EXT_BUFFER *pbuflist ; -#endif /*XW_PROTOTYPE*/ -/* - Remove ALL Extended char structure in the - char List - - SUCCESS always -*/ -{ -XW_EXT_CHAR *pchar,*qchar ; - - for( pchar = pbuflist->ptextdesc ; pchar ; pchar = qchar ) { - qchar = (XW_EXT_CHAR*)pchar->link ; - Xw_free(pchar) ; - } - pbuflist->ptextdesc = NULL ; - - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_draw_zoomed_image.cxx b/src/Xw/Xw_draw_zoomed_image.cxx deleted file mode 100755 index 5768444e87..0000000000 --- a/src/Xw/Xw_draw_zoomed_image.cxx +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#include - -#ifdef TRACE -# define TRACE_DRAW_ZOOMED_IMAGE -#endif - -/* - STATUS Xw_draw_zoomed_image (awindow,aimage,xc,yc,zoom): - XW_EXT_WINDOW *awindow Drawable - XW_EXT_IMAGEDATA *aimage Image structure - float xc,yc Image center location in user space - float zoom Image zoom factor - - Draw an image to the window at the required Center location - with required zoom factor. - - returns ERROR if NO Image is defined or Image is outside of the window - returns SUCCESS if successful -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_draw_zoomed_image (void* awindow, void* aimage, float xc, float yc, float zoom) -#else -XW_STATUS Xw_draw_zoomed_image (awindow, aimage, xc, yc, zoom) -void *awindow; -void *aimage; -float xc, yc, zoom; -#endif // XW_PROTOTYPE -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*)aimage; -// XW_EXT_BUFFER *pbuffer; - XImage *pximage, *qximage; - int wWidth, wHeight, xC, yC, wp, hp, dxp, dyp, isize; - int x, y, xp, yp, xn, yn, xq, yq, nxC, nyC; - unsigned long pixel; - float ratio; - -#ifdef TRACE_DRAW_ZOOMED_IMAGE - if (Xw_get_trace ()) - printf ("Xw_draw_zoomed_image(%lx, %lx, xc=%f, yc=%f, zoom=%f)\n",(long ) pwindow,(long ) pimage,xc,yc,zoom); -#endif // TRACE_DRAW_ZOOMED_IMAGE - - if (!Xw_isdefine_window(pwindow)) { - // ERROR*Bad EXT_WINDOW Address - Xw_set_error(24,"Xw_draw_zoomed_image",pwindow); - return (XW_ERROR); - } - - if (!Xw_isdefine_image(pimage)) { - // ERROR*Bad EXT_IMAGEDATA Address - Xw_set_error(25,"Xw_draw_zoomed_image",pimage); - return (XW_ERROR); - } - - if (zoom <= 0.) { - // ERROR*Bad Image Zoom factor - Xw_set_error(113,"Xw_draw_zoomed_image",&zoom) ; - return (XW_ERROR); - } - - if (Xw_get_window_size(pwindow, &wWidth, &wHeight) != XW_SUCCESS) { - // ERROR*Get Window Size - printf (" ***Xw_draw_zoomed_image : BAD call to Xw_get_window_size()\n"); - return (XW_ERROR); - } - printf ("\nXw_draw_zoomed_image info -> window size (%d x %d)\n", wWidth, wHeight); - -//OCC186 - xC = PXPOINT (xc, pwindow->xratio); - yC = PYPOINT (yc, pwindow->attributes.height, pwindow->yratio); -//OCC186 - printf ("Xw_draw_zoomed_image info -> image center (%d, %d)\n", xC, yC); - - pximage = pimage->pximage ; - qximage = (XImage*) Xw_malloc(sizeof(XImage)); - - if (!qximage) { - // ERROR*XImage Allocation failed - Xw_set_error (60, "Xw_draw_zoomed_image",NULL); - return (XW_ERROR); - } - - Xw_bytecopy ((char*)pximage, (char*)qximage, sizeof(XImage)); - - wp = pximage->width; - hp = pximage->height; - dxp = dyp = 0; - ratio = (float) wp/hp; - qximage->width = (int )( wp * zoom ); - qximage->height = (int )( hp * zoom ); - nxC = wWidth / 2; - nyC = wHeight / 2; - - if (qximage->width > wWidth || qximage->height > wHeight) { -// int rw = qximage->width, rh = qximage->height; - - // Set new image size -#ifdef DEBUG - printf (" ***Xw_draw_zoomed_image (%f). Image size is too big (%d x %d)\n",zoom,qximage->width,qximage->height); -#endif - if (qximage->width > wWidth ) qximage->width = wWidth; - if (qximage->height > wHeight) qximage->height = wHeight; -#ifdef DEBUG - printf ("Xw_draw_zoomed_image info -> image will be truncated to (%d x %d)\n",qximage->width,qximage->height); -#endif - - // Part of an original image to be zoomed (size of it) - wp = (int )( qximage->width / zoom + 1); - hp = (int )( qximage->height / zoom + 1); - - // Offset inside the original image - dxp = (int )( (pximage->width - wp) / 2 - (xC - qximage->width / 2) / zoom ); - dyp = (int )( (pximage->height - hp) / 2 - (yC - qximage->height / 2) / zoom ); - - // Correct image size, offset and center - if (dxp < 0) { - nxC -= (int )( dxp*zoom/2); - qximage->width += (int )( dxp*zoom); - dxp = 0; - } else if (dxp + wp > pximage->width) { - nxC -= (int )( (dxp + wp - pximage->width)*zoom/2); - qximage->width -= (int )( (dxp + wp - pximage->width)*zoom); - wp = pximage->width - dxp; - } - - if (dyp < 0) { - nyC -= (int )( dyp*zoom/2); - qximage->height += (int )( dyp*zoom); - dyp = 0; - } else if (dyp + hp > pximage->height) { - nyC -= (int )( (dyp + hp - pximage->height)*zoom/2); - qximage->height -= (int )( (dyp + hp - pximage->height)*zoom); - hp = pximage->height - dyp; - } -#ifdef DEBUG - printf ("Xw_draw_zoomed_image info -> WP = %d, HP = %d\n", wp, hp); - printf ("Xw_draw_zoomed_image info -> DX = %d, DY = %d\n", dxp, dyp); - printf ("Xw_draw_zoomed_image info -> New point (%d, %d)\n", nxC, nyC); - printf ("Xw_draw_zoomed_image info -> final image size is (%d x %d)\n\n",qximage->width,qximage->height); -#endif - } - - // Truncate image if it is visible (i.e. part of it) - if (qximage->width > 0. && qximage->height > 0.) { - qximage->bytes_per_line = qximage->width * (pximage->bitmap_pad/8); - isize = qximage->bytes_per_line * qximage->height; - qximage->data = (char*) Xw_malloc (isize); - - if (!qximage->data) { - // ERROR*XImage Allocation failed - Xw_set_error (60,"Xw_draw_zoomed_image",NULL); - return (XW_ERROR); - } - - // Zoom image - for (yp = yq = 0; yp < hp; yq = yn, yp++) { - yn = (int) ((yp+1)*zoom+0.5); - if (yn >= qximage->height) yn = qximage->height-1; - for (xp = xq = 0; xp < wp; xq = xn, xp++) { - xn = (int) ((xp+1)*zoom+0.5); - if (xn >= qximage->width) xn = qximage->width-1; - pixel = XGetPixel(pximage,xp+dxp,yp+dyp) ; - if (((xn-xq) > 1) || ((yn-yq) > 1)) { - for (y = yq; y < yn; y++) - for (x = xq; x < xn; x++) - XPutPixel (qximage, x, y, pixel); - } else { - XPutPixel (qximage, xq, yq, pixel); - } - } - } - - if (_ZIMAGE && (_ZIMAGE != _IIMAGE)) - XDestroyImage (_ZIMAGE); - - _ZIMAGE = qximage; - pimage->zoom = zoom; - - // Draw zoomed image at the new location - return Xw_draw_image (awindow, pimage, UXPOINT(nxC), UYPOINT(nyC)); - } - - return XW_SUCCESS; -} diff --git a/src/Xw/Xw_erase_area.cxx b/src/Xw/Xw_erase_area.cxx deleted file mode 100755 index 8b27db764d..0000000000 --- a/src/Xw/Xw_erase_area.cxx +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ERASE_AREA -#endif - -/* - STATUS Xw_erase_area (awindow,px,py,pwidth,pheight) - XW_EXT_WINDOW *awindow - int px,py area center given in PIXELS - int pwidth,pheight area size given in PIXELS - - Erase the attached Drawable area . - - returns ERROR if NO attached pixmap exist or - area is out of window - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_erase_area (void* awindow, - int px,int py,int pwidth,int pheight) -#else -XW_STATUS Xw_erase_area (awindow,px,py,pwidth,pheight) -void *awindow; -int px,py,pwidth,pheight ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -int i ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_erase_area",pwindow) ; - return (XW_ERROR) ; - } - - if( (px + pwidth/2) < 0 || (px - pwidth/2) > _WIDTH || - (py + pheight/2) < 0 || (py - pheight/2) > _HEIGHT ) { - /*WARNING*Try to Erase outside the window*/ - Xw_set_error(40,"Xw_erase_area",pwindow) ; - return (XW_ERROR) ; - } - - px -= pwidth/2 ; py -= pheight/2 ; - - if( _BPIXMAP ) { - XCopyArea(_DISPLAY,_BPIXMAP,_DRAWABLE,pwindow->qgwind.gccopy, - px,py,pwidth,pheight,px,py) ; - } else { - if( _DRAWABLE == _WINDOW ) { - XClearArea(_DISPLAY,_WINDOW,px,py,pwidth,pheight,False) ; - } else { - XFillRectangle(_DISPLAY,_DRAWABLE,pwindow->qgwind.gcclear, - px,py,pwidth,pheight) ; - } - } - - for( i=1 ; i px+pwidth ) continue ; - if( ymax < py || ymin > py+pheight ) continue ; - Xw_erase_buffer(pwindow,-i) ; - } - } - - XFlush(_DISPLAY) ; - -#ifdef TRACE_ERASE_AREA -if( Xw_get_trace() > 1 ) { - printf(" Xw_erase_area(%lx,%d,%d,%d,%d)\n",(long ) pwindow,px,py,pwidth,pheight); -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_erase_window.cxx b/src/Xw/Xw_erase_window.cxx deleted file mode 100755 index cc88fba518..0000000000 --- a/src/Xw/Xw_erase_window.cxx +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ERASE_WINDOW -#endif - -/* - STATUS Xw_erase_window (awindow) - XW_EXT_WINDOW *awindow - - Erase the entire drawable. - - returns SUCCESS always - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_erase_window (void* awindow) -#else -XW_STATUS Xw_erase_window (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -int i ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_erase_window",pwindow) ; - return (XW_ERROR) ; - } - - if( _BPIXMAP ) { - XCopyArea(_DISPLAY,_BPIXMAP,_DRAWABLE,pwindow->qgwind.gccopy, - 0,0,_WIDTH,_HEIGHT,0,0) ; - } else { - if( _DRAWABLE == _WINDOW ) { - XClearWindow(_DISPLAY,_WINDOW) ; - } else { - XFillRectangle(_DISPLAY,_DRAWABLE,pwindow->qgwind.gcclear, - 0,0,_WIDTH,_HEIGHT) ; - } - } - - for( i=0 ; i 1 ) { - printf(" Xw_erase_window(%lx)\n",(long ) pwindow) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_flush.cxx b/src/Xw/Xw_flush.cxx deleted file mode 100755 index 6c5108ad63..0000000000 --- a/src/Xw/Xw_flush.cxx +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_FLUSH -#endif - -/* - STATUS Xw_flush (awindow,synchro) - XW_EXT_WINDOW *awindow - - Flush all primitives in the previous window . - - Returns SUCCESS always - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_flush (void* awindow,int synchro) -#else -XW_STATUS Xw_flush (awindow,synchro) -void *awindow; -int synchro; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_flush",pwindow) ; - return (XW_ERROR) ; - } - - if( synchro ) { - XSync(_DISPLAY,False) ; - } else { - XFlush(_DISPLAY) ; - } - - if( (_DRAWABLE == _PIXMAP) || (_DRAWABLE == _BWBUFFER) ) - Xw_restore_window (pwindow) ; - - -#ifdef TRACE_FLUSH -if( Xw_get_trace() ) { - printf (" Xw_flush(%lx)\n",(long ) pwindow) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_gamma_image.cxx b/src/Xw/Xw_gamma_image.cxx deleted file mode 100755 index 5ccf9283c7..0000000000 --- a/src/Xw/Xw_gamma_image.cxx +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -// JR 01.02.100 : convert of float to int : (int ) - -#include - -/* ifdef then trace on */ -#ifdef TRACE -# define TRACE_GAMMA_IMAGE -#endif - -/* - XW_STATUS Xw_gamma_image (aimage,gamma): - XW_EXT_IMAGEDATA *aimage Image where apply the gamma correction - float gamma gamma value to apply (>0.) - - Apply a GAMMA correction to an image - - returns ERROR if bad gamma value - returns SUCCESS if successfull - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_gamma_image (void* aimage,float gamma) -#else -XW_STATUS Xw_gamma_image (aimage,gamma) -void *aimage; -float gamma ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*)aimage ; -XImage *pximage; -int wp,hp,xp,yp,ired,igreen,iblue; -unsigned long cmask,npixel,gpixel = 0,opixel = 0; -int sred,sgreen,sblue ; -float red,green,blue ; - - if( !Xw_isdefine_image(pimage) ) { - /*ERROR*Bad EXT_IMAGE Address*/ - Xw_set_error(25,"Xw_gamma_image",pimage) ; - return (XW_ERROR) ; - } - - if( gamma <= 0. ) { - /*ERROR*Bad Image GAMMA value*/ - return (XW_ERROR) ; - } - - if( gamma == 1.0 ) return XW_SUCCESS; - - pximage = pimage->pximage; - - if( !pximage->red_mask || !pximage->green_mask || !pximage->blue_mask ) { - printf(" *** Xw_gamma_image.Cann't apply the gamma correction to this image\n"); - return (XW_ERROR) ; - } - - gamma = 1./gamma; - - wp = pximage->width; hp = pximage->height; - - sred = sgreen = sblue = 0 ; - cmask = pximage->red_mask ; - while ( !(cmask & 1) ) { cmask >>= 1 ; sred++ ; } - cmask = pximage->green_mask ; - while ( !(cmask & 1) ) { cmask >>= 1 ; sgreen++ ; } - cmask = pximage->blue_mask ; - while ( !(cmask & 1) ) { cmask >>= 1 ; sblue++ ; } - - for( yp=0 ; yp> sred) & cmask; - igreen = (npixel >> sgreen) & cmask; - iblue = (npixel >> sblue) & cmask; - - red = (float)(ired)/(float)cmask; - green = (float)(igreen)/(float)cmask; - blue = (float)(iblue)/(float)cmask; - - red = min(1.,pow(double(red),double(gamma))); - green = min(1.,pow(double(green),double(gamma))); - blue = min(1.,pow(double(blue),double(gamma))); - - ired = (int )( red * cmask); - igreen = (int )( green * cmask); - iblue = (int )( blue * cmask); - - gpixel = (ired << sred) | (igreen << sgreen) | (iblue << sblue); -/* -printf(" npixel %ld gpixel %ld cmask %ld sred %d sgreen %d sblue %d\n", -npixel,gpixel,cmask,sred,sgreen,sblue); -*/ - } - XPutPixel(pximage,xp,yp,gpixel) ; - } - } - -#ifdef TRACE_GAMMA_IMAGE -if( Xw_get_trace() ) { - printf (" Xw_gamma_image(%lx,%f)\n",(long ) pimage,gamma); -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_background_color.cxx b/src/Xw/Xw_get_background_color.cxx deleted file mode 100755 index 6a11a19d5a..0000000000 --- a/src/Xw/Xw_get_background_color.cxx +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_BACKGROUND_COLOR -#endif - -/* - STATUS Xw_get_background_color(awindow,r,g,b): - XW_EXT_WINDOW *awindow Window extension structure - float *r,*g,*b ; Return Red,Green,Blue color value 0. >= x <= 1. - - Get R,G,B Background Color values from Default index . - - Returns ERROR if Extended Window Address is badly defined - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_background_color (void* awindow,float* r,float* g,float* b) -#else -XW_STATUS Xw_get_background_color (awindow,r,g,b) -void *awindow; -float *r,*g,*b ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -unsigned long pixel; - - if ( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXTENDED Window ADDRESS*/ - Xw_set_error(24,"Xw_get_background_color",pwindow) ; - return (XW_ERROR) ; - } - - if( pwindow->backindex >= 0 ) { - switch ( _CLASS ) { - case PseudoColor : - case StaticColor : - case TrueColor : - Xw_get_color (_COLORMAP,pwindow->backindex,r,g,b,&pixel) ; - break ; - - default : - /*Unmatchable Visual class*/ - Xw_set_error(67,"Xw_get_background_color",&_CLASS) ; - return (XW_ERROR) ; - } - } else { - *r = *g = *b = 1. ; - } - - -#ifdef TRACE_GET_BACKGROUND_COLOR -if( Xw_get_trace() ) { - printf(" Xw_get_background_color(%lx,%f,%f,%f)\n",(long ) pwindow,*r,*g,*b) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_background_image.cxx b/src/Xw/Xw_get_background_image.cxx deleted file mode 100755 index a8aefef0b2..0000000000 --- a/src/Xw/Xw_get_background_image.cxx +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -/* -// GG IMP060200 Xw_get_background_image signatuire change -*/ -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_BACKGROUND_IMAGE -#endif - -/* - XW_STATUS Xw_get_background_image (awindow,xc,yc,width,height): - XW_EXT_WINDOW *awindow - int xc,yc Image center location in pixels - int width,height Image size in pixels - - Get the window Background from the actual Window - at the required Center location - - returns ERROR if Image is outside of the window - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_background_image (void* awindow, - int xc,int yc,int width,int height) -#else -XW_STATUS Xw_get_background_image (awindow,xc,yc,width,height) -void *awindow; -int xc,yc ; -int width,height ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_DISPLAY *pdisplay = pwindow->connexion ; -XW_STATUS status ; -XImage *pimage ; -int wx,wy ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_background_image",pwindow) ; - return (XW_ERROR) ; - } - - wx = xc - width/2 ; - wy = yc - height/2 ; - - if( _DGRAB ) { - wx += _X ; wy += _Y ; - if( (wx + width) < 0 || wx > _DWIDTH || - (wy + height) < 0 || wy > _DHEIGHT ) { - /*WARNING*Try to Get Image from outside the display*/ - Xw_set_error(45,"Xw_get_background_image",0) ; - return (XW_ERROR) ; - } - pimage = XGetImage(_DISPLAY,_DROOT,wx,wy, - width,height,AllPlanes,ZPixmap) ; - } else { - if( (wx + width) < 0 || wx > _WIDTH || - (wy + height) < 0 || wy > _HEIGHT ) { - /*WARNING*Try to Get Image from outside the window*/ - Xw_set_error(45,"Xw_get_background_image",0) ; - return (XW_ERROR) ; - } - pimage = XGetImage(_DISPLAY,_WINDOW,wx,wy, - width,height,AllPlanes,ZPixmap) ; - } - - if( _BPIXMAP ) Xw_close_background_pixmap(pwindow) ; - - if( _PIXMAP || _NWBUFFER > 0 ) { - status = Xw_open_background_pixmap(pwindow) ; - if( !status ) return (XW_ERROR) ; - for( wx=0 ; wx<_WIDTH ; wx += width ) { - for( wy=0 ; wy<_HEIGHT ; wy += height ) { - XPutImage(_DISPLAY,_BPIXMAP,pwindow->qgwind.gccopy, - pimage,0,0,wx,wy,width,height) ; - } - } - } else { - Pixmap pixmap = XCreatePixmap(_DISPLAY,_WINDOW, - width,height,_DEPTH); - if( !pixmap ) return (XW_ERROR) ; - XPutImage(_DISPLAY,pixmap,pwindow->qgwind.gccopy, - pimage,0,0,wx,wy,width,height) ; - XSetWindowBackgroundPixmap(_DISPLAY,_WINDOW,pixmap) ; - XFlush(_DISPLAY) ; - XFreePixmap(_DISPLAY,pixmap) ; - } - - Xw_erase_window(pwindow) ; - -#ifdef TRACE_GET_BACKGROUND_IMAGE -if( Xw_get_trace() ) { - printf (" Xw_get_background_image(%lx,%d,%d,%d,%d)\n", - (long ) pwindow,xc,yc,width,height); -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_background_index.cxx b/src/Xw/Xw_get_background_index.cxx deleted file mode 100755 index d899ecb4ec..0000000000 --- a/src/Xw/Xw_get_background_index.cxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_BACKGROUND_INDEX -#endif - -/* - STATUS Xw_get_background_index(awindow,index): - XW_EXT_WINDOW *awindow Window extension structure - int *index ; Returned index - - - Gets current background index. - - Returns ERROR if Extended Window Address is badly defined - Returns SUCCESS if Successful -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_background_index (void* awindow,int* index) -#else -XW_STATUS Xw_get_background_index (awindow,index) -void *awindow; -int *index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - - if ( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXTENDED Window ADDRESS*/ - Xw_set_error(24,"Xw_get_background_index",pwindow) ; - return (XW_ERROR) ; - } - - *index = pwindow->backindex ; - -#ifdef TRACE_GET_BACKGROUND_INDEX -if( Xw_get_trace() ) { - printf(" Xw_get_background_index(%lx,%d)\n",(long ) pwindow,*index) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_background_pixel.cxx b/src/Xw/Xw_get_background_pixel.cxx deleted file mode 100755 index 460d122a72..0000000000 --- a/src/Xw/Xw_get_background_pixel.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_BACKGROUND_PIXEL -#endif - -/* - STATUS Xw_get_background_pixel(awindow,pixel): - XW_EXT_WINDOW *awindow Window extension structure - unsigned long *pixel ; Return Color pixel depending of Visual Class - - Returns ERROR if Window or background pixel is not defined properly - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_background_pixel(void* awindow, unsigned long* pixel) -#else -XW_STATUS Xw_get_background_pixel(awindow,pixel) -void *awindow ; -unsigned long *pixel ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_STATUS status = XW_SUCCESS ; - - *pixel = 0; - - if( !pwindow ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error( 24,"Xw_get_background_pixel",pwindow ) ; - return( XW_ERROR ) ; - } - if( pwindow->backindex < 0 ) { - *pixel = _COLORMAP->backpixel; - } else if( Xw_isdefine_color(_COLORMAP,pwindow->backindex) ) { - *pixel = _COLORMAP->pixels[pwindow->backindex]; - } else { - status = XW_ERROR; - } - -#ifdef TRACE_GET_BACKGROUND_PIXEL -if( Xw_get_trace() > 3 ) { - printf(" %d = Xw_get_background_pixel(%lx,%lx)\n", - status,(long ) pwindow,*pixel) ; -} -#endif - - return( status ) ; -} diff --git a/src/Xw/Xw_get_color.cxx b/src/Xw/Xw_get_color.cxx deleted file mode 100755 index 76123db9b3..0000000000 --- a/src/Xw/Xw_get_color.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_COLOR -#endif - -/* - STATUS Xw_get_color(acolormap,index,r,g,b,pixel): - XW_EXT_COLORMAP *acolormap Colormap extension structure - int index ; Color index 0 >= x < MAXCOLOR - float *r,*g,*b ; Return Red,Green,Blue color value 0. >= x <= 1. - unsigned long *pixel ; - - Get R,G,B Color values from index . - - Returns ERROR if BadColor Index or color is not defined - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_color (void* acolormap,int index,float* r,float* g,float* b,unsigned long *pixel) -#else -XW_STATUS Xw_get_color (acolormap,index,r,g,b,pixel) -void *acolormap; -int index ; -float *r,*g,*b ; -unsigned long *pixel ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap; -XColor color ; - - *pixel = 0; - *r = *g = *b = 0.; - - if ( !Xw_isdefine_colorindex(pcolormap,index) ) { - /*ERROR*Bad color Index*/ - Xw_set_error(1,"Xw_get_color",&index) ; - return (XW_ERROR) ; - } - - - switch ( _CCLASS ) { - - case PseudoColor : - case StaticColor : - color.pixel = pcolormap->pixels[index] ; - XQueryColor(_CDISPLAY,_CINFO.colormap,&color) ; - *r = (float)color.red/0xFFFF ; - *g = (float)color.green/0xFFFF ; - *b = (float)color.blue/0xFFFF ; - break ; - - case TrueColor : - { unsigned long mask = _CVISUAL->map_entries-1 ; - unsigned long red,green,blue ; - unsigned long rmask = _CVISUAL->red_mask ; - unsigned long gmask = _CVISUAL->green_mask ; - unsigned long bmask = _CVISUAL->blue_mask ; - - color.pixel = pcolormap->pixels[index] ; - red = color.pixel & rmask ; - while ( !(rmask & 0x01) ) { rmask >>= 1; red >>= 1; } - - green = color.pixel & gmask ; - while ( !(gmask & 0x01) ) { gmask >>= 1; green >>= 1; } - - blue = color.pixel & bmask ; - while ( !(bmask & 0x01) ) { bmask >>= 1; blue >>= 1; } - - *r = (float)red/mask ; - *g = (float)green/mask ; - *b = (float)blue/mask ; - } - break ; - - default : - /*Unmatchable Visual class*/ - Xw_set_error(67,"Xw_get_color",&_CCLASS) ; - return (XW_ERROR) ; - } - - *pixel = color.pixel ; - - -#ifdef TRACE_GET_COLOR -if( Xw_get_trace() > 1 ) { - printf(" Xw_get_color(%lx,%d,%f,%f,%f,%lx)\n",(long ) pcolormap,index,*r,*g,*b,*pixel) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_color_index.cxx b/src/Xw/Xw_get_color_index.cxx deleted file mode 100755 index 71feae79c8..0000000000 --- a/src/Xw/Xw_get_color_index.cxx +++ /dev/null @@ -1,325 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define PRO9517 /*GG_280897 -// Ameliorer le critere de comparaison de 2 couleurs -// sinon ROUGE = VERT = BLEU !!! -*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_COLOR_INDEX -#endif - -/* - STATUS Xw_get_color_index(acolormap,r,g,b,index): - XW_EXT_COLORMAP *acolormap Colormap extension structure - float r,g,b ; Red,Green,Blue color value 0. >= x <= 1. - int *index ; Return Color index 0 >= x < MAXCOLOR - - Gets the nearest color index from R,G,B Color values. - - Returns ERROR if BadColor Index or color is not defined - Returns SUCCESS if Successful - -*/ - -#define XTEST 1 -#ifdef TEST /* Optim. No more necessary with XQueryColors() */ -#define MAX_COLRS 256 -static int indice = 0; -static int indice_max = 0; -static XW_EXT_COLORMAP *qcolormap = NULL; -static float tab_ind[MAX_COLRS][4]; -#endif - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_color_index(void* acolormap,float r,float g,float b,int* index) -#else -XW_STATUS Xw_get_color_index(acolormap,r,g,b,index) -void *acolormap ; -float r,g,b ; -int *index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XW_STATUS status = XW_ERROR ; -XColor colors[MAXCOLOR] ; -int color_indexs[MAXCOLOR] ; -register int i,j,n ; -int curind = -1,freeind = -1,isapproximate ; -#ifdef PRO9517 -int drmin,dgmin,dbmin; -#else -float curdist,newdist ; -float dr,dg,db ; -#endif - - if( !pcolormap ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error( 42,"Xw_get_color_index",pcolormap ) ; - return( XW_ERROR ) ; - } - - if( _CCLASS != TrueColor ) { - if( pcolormap->mapping == Xw_TOM_COLORCUBE ) { - if( (_CGINFO.red_mult > 0) && (fabs(r-g) < 0.01) && (fabs(r-b) < 0.01) ) { - curind = (int)(0.5+r*_CGINFO.red_max)*_CGINFO.red_mult; - if( _CINFO.red_max > 0 ) curind += (_CINFO.red_max+1)*(_CINFO.green_max+1)*(_CINFO.blue_max+1); - } else if( _CINFO.red_mult > 0 ) { - curind = ((int)(0.5+r*_CINFO.red_max))*_CINFO.red_mult+ - ((int)(0.5+g*_CINFO.green_max))*_CINFO.green_mult+ - ((int)(0.5+b*_CINFO.blue_max))*_CINFO.blue_mult; - } else if( _CGINFO.red_mult > 0 ) { - float l = (r+g+b)/3.; - curind = (int)(0.5+l*_CGINFO.red_max)*_CGINFO.red_mult; - } else { - curind = 0; - } - if( pcolormap->pixels[curind] == curind +_CINFO.base_pixel ) - status = XW_SUCCESS ; - else curind = -1 ; - } - } - - if( curind < 0 ) { -#ifdef TEST - if (pcolormap != qcolormap) { - for (i=0; i= 0. ) { - if ((tab_ind[i][1] == r) && - (tab_ind[i][2] == g) && - (tab_ind[i][3] == b)) { - *index = curind = (int) tab_ind[i][0]; - status = XW_SUCCESS; -#ifdef TRACE_GET_COLOR_INDEX -if( Xw_get_trace() > 3 ) { - printf(" %d = Xw_get_color_index(%x,%f,%f,%f,=%d/0x%x)\n", - status,pcolormap,r,g,b,curind,pcolormap->pixels[curind]) ; -} -#endif - return (status); - } - } - } -#endif - -#ifdef PRO9517 - drmin = dgmin = dbmin = 65536; -#else - newdist = 4.0 ; - curdist = 4.0 ; -#endif - curind = -1 ; - - for( i=n=0 ; imaxcolor ; i++ ) { - if( Xw_isdefine_color( pcolormap,i ) == XW_SUCCESS ) { - if( n < pcolormap->maxhcolor ) { - colors[n].pixel = pcolormap->pixels[i]; - color_indexs[n] = i; - n++; - } else { - for( j=0 ; jpixels[i] ) break; - } - if( j >= n ) { - /* Too many entrys in the virtual colormap */ - Xw_set_error(129,"Xw_get_color_index",pcolormap ) ; - } - } - } else { - if( freeind < 0 ) freeind = i ; - } - } - - if( _CCLASS != TrueColor ) { - if( n > 0 ) { - XQueryColors(_CDISPLAY,_CINFO.colormap,colors,n) ; -#ifdef PRO9517 - { - unsigned long rred = (long unsigned int )( r * 0xFFFF); - unsigned long rgreen = (long unsigned int )( g * 0xFFFF); - unsigned long rblue = (long unsigned int )( b * 0xFFFF); - int dr,dg,db; - for( i=0 ; i> 8; - aLocalInt = rgreen - colors[i].green ; dg = abs( aLocalInt ) >> 8; - aLocalInt = rblue - colors[i].blue ; db = abs( aLocalInt ) >> 8; - //#else - // dr = abs( rred - colors[i].red ) >> 8; - // dg = abs( rgreen - colors[i].green ) >> 8; - // db = abs( rblue - colors[i].blue ) >> 8; - //#endif - if( (dr <= drmin) && (dg <= dgmin) && (db <= dbmin) ) { - drmin = dr; dgmin = dg; dbmin = db; - curind = color_indexs[i]; - if( !dr && !dg && !db ) break; - } - } - } -#else - for( i=0 ; ((i 0 ) { -// unsigned long mask = _CVISUAL->map_entries-1 ; - unsigned long red,green,blue,rmask,gmask,bmask ; -#ifdef PRO9517 - { - unsigned long rred = (long unsigned int )( r * (1 << _CVISUAL->bits_per_rgb) - 1); - unsigned long rgreen = (long unsigned int )( g * (1 << _CVISUAL->bits_per_rgb) - 1); - unsigned long rblue = (long unsigned int )( b * (1 << _CVISUAL->bits_per_rgb) - 1); - int dr,dg,db; - for( i=0 ; ired_mask; - red = colors[i].pixel & rmask ; - while ( !(rmask & 0x01) ) { rmask >>= 1; red >>= 1; } - - gmask = _CVISUAL->green_mask; - green = colors[i].pixel & gmask ; - while ( !(gmask & 0x01) ) { gmask >>= 1; green >>= 1; } - - bmask = _CVISUAL->blue_mask; - blue = colors[i].pixel & bmask ; - while ( !(bmask & 0x01) ) { bmask >>= 1; blue >>= 1; } - - //#if defined(_AIX) || defined(__hpux) - int aLocalInt = rred - red ; dr = abs(aLocalInt); - aLocalInt = rgreen - green ; dg = abs(aLocalInt); - aLocalInt = rblue - blue ; db = abs(aLocalInt); - //#else - // dr = abs( rred - red ); - // dg = abs( rgreen - green ); - // db = abs( rblue - blue ); - //#endif - if( (dr <= drmin) && (dg <= dgmin) && (db <= dbmin) ) { - drmin = dr; dgmin = dg; dbmin = db; - curind = color_indexs[i]; - if( !dr && !dg && !db ) break; - } - } - } -#else - for( i=0 ; ((ired_mask; - red = colors[i].pixel & rmask ; - while ( !(rmask & 0x01) ) { rmask >>= 1; red >>= 1; } - - gmask = _CVISUAL->green_mask; - green = colors[i].pixel & gmask ; - while ( !(gmask & 0x01) ) { gmask >>= 1; green >>= 1; } - - bmask = _CVISUAL->blue_mask; - blue = colors[i].pixel & bmask ; - while ( !(bmask & 0x01) ) { bmask >>= 1; blue >>= 1; } - - dr = (float)red/mask - r ; - dg = (float)green/mask - g ; - db = (float)blue/mask - b ; - newdist = dr*dr + dg*dg + db*db ; - - if( newdist < curdist ) { - curind = color_indexs[i] ; - curdist = newdist ; - } - } -#endif - } - } - -#ifdef PRO9517 - if( drmin > 0 || dgmin > 0 || dbmin > 0 ) { -#else - if( curdist > 0.0 ) { -#endif - if( freeind < 0 ) { - unsigned long pixel; - if( Xw_alloc_color(pcolormap,r,g,b,&pixel,&isapproximate) ) { - for( i=0 ; imaxcolor ; i++ ) { - if( pixel == pcolormap->pixels[i] ) break; - } - if( i < pcolormap->maxcolor ) { - curind = i; - } - } - } else { - if( Xw_def_color(pcolormap,freeind,r,g,b) ) { - curind = freeind ; - } - } - } - - if( curind >= 0 ) { - status = XW_SUCCESS ; -#ifdef TEST - tab_ind[indice][0] = curind ; - tab_ind[indice][1] = r ; - tab_ind[indice][2] = g ; - tab_ind[indice][3] = b ; - /* - * Une fois que le tableau est plein, il faut le - * parcourir completement, donc on ne touche plus - * a indice_max. - */ - indice ++ ; - if( indice < MAX_COLRS ) { - indice_max = max(indice_max,indice); - } else { - indice = 0 ; /* on repart a 0 */ -#ifdef TRACE_GET_COLOR_INDEX - if( Xw_get_trace() > 1 ) { - printf(" ************************\n") ; - printf(" Xw_get_color_index, full array\n") ; - printf(" ************************\n") ; - } -#endif - } -#endif - } - - } - - *index = curind ; - -#ifdef TRACE_GET_COLOR_INDEX -if( Xw_get_trace() > 3 ) { - printf(" %d = Xw_get_color_index(%lx,%f,%f,%f,#%d/0x%lx)\n", - status,(long ) pcolormap,r,g,b,curind,(long ) pcolormap->pixels[curind]) ; -} -#endif - - return( status ) ; -} diff --git a/src/Xw/Xw_get_color_name.cxx b/src/Xw/Xw_get_color_name.cxx deleted file mode 100755 index 15e62415e9..0000000000 --- a/src/Xw/Xw_get_color_name.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_COLOR_NAME -#endif - -/* - STATUS Xw_get_color_name (acolormap,colorname,r,g,b): - XW_EXT_COLORMAP *acolormap - char *colorname Name of color from file /usr/lib/X11/rgb.txt - float *r,*g,*b Returns Color values in [0,1] space - - Returns ERROR if Name is not founded in the database - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_color_name (void* acolormap, - const char* colorname,float* r,float* g,float* b) -#else -XW_STATUS Xw_get_color_name (acolormap,colorname,r,g,b) -void *acolormap ; -const char *colorname ; -float *r,*g,*b ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XColor color ; -//int red,green,blue ; - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_get_color_name",pcolormap) ; - return (XW_ERROR) ; - } - if( XParseColor(_CDISPLAY,_CINFO.colormap,colorname,&color) ) { - *r = (float)color.red/0xFFFF ; - *g = (float)color.green/0xFFFF; - *b = (float)color.blue/0xFFFF ; - } else return (XW_ERROR) ; - -#ifdef TRACE_GET_COLOR_NAME -if( Xw_get_trace() ) { - printf (" Xw_get_color_name(%lx,%s,%f,%f,%f)\n", - (long ) pcolormap,colorname,*r,*g,*b); -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_color_pixel.cxx b/src/Xw/Xw_get_color_pixel.cxx deleted file mode 100755 index 3713cdf83a..0000000000 --- a/src/Xw/Xw_get_color_pixel.cxx +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_COLOR_PIXEL -#endif - -/* - STATUS Xw_get_color_pixel(acolormap,r,g,b,pixel,isapproximate): - XW_EXT_COLORMAP *acolormap Colormap extension structure - float r,g,b ; Red,Green,Blue color value 0. >= x <= 1. - unsigned long *pixel ; Return Color pixel depending of Visual Class - bool isapproximate ; - - Gets the nearest color pixel from R,G,B Color values. - - Returns ERROR if Colormap is not defined properly - Returns SUCCESS if Successful - -*/ - -#define TEST 1 -#ifdef TEST /* Optim. no more necessary with XQueryColors */ -#define MAX_COLRS 256 -static int indice = 0; -static int indice_max = 0; -static XW_EXT_COLORMAP *qcolormap = NULL; -static float tab_ind[MAX_COLRS][4]; -#endif - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_color_pixel(void* acolormap, - float r,float g,float b,unsigned long* pixel,int *isapproximate) -#else -XW_STATUS Xw_get_color_pixel(acolormap,r,g,b,pixel,isapproximate) -void *acolormap ; -float r,g,b ; -unsigned long *pixel ; -int *isapproximate; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XW_STATUS status = XW_ERROR ; -//XColor colors[MAXCOLOR] ; -//int color_indexs[MAXCOLOR] ; -//register i,j,n ; -register int i ; - - *pixel = 0; - if( !pcolormap ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error( 42,"Xw_get_color_pixel",pcolormap ) ; - return( XW_ERROR ) ; - } - - *isapproximate = False; - if( _CCLASS == TrueColor ) { - unsigned long mask = _CVISUAL->map_entries-1 ; - unsigned long red = (unsigned long) (r * mask) ; - unsigned long green = (unsigned long) (g * mask) ; - unsigned long blue = (unsigned long) (b * mask) ; - - mask = _CVISUAL->red_mask; - while ( !(mask & 0x01) ) { mask >>= 1; red <<= 1; } - mask = _CVISUAL->green_mask; - while ( !(mask & 0x01) ) { mask >>= 1; green <<= 1; } - mask = _CVISUAL->blue_mask; - while ( !(mask & 0x01) ) { mask >>= 1; blue <<= 1; } - *pixel = red|green|blue ; - status = XW_SUCCESS ; - } else if( pcolormap->mapping == Xw_TOM_COLORCUBE ) { - int curind = 0; - if( (_CGINFO.red_mult > 0) && (fabs(r-g) < 0.01) && (fabs(r-b) < 0.01) ) { - curind = (int)(0.5+r*_CGINFO.red_max)*_CGINFO.red_mult; - if( _CINFO.red_max > 0 ) curind += (_CINFO.red_max+1)*(_CINFO.green_max+1)*(_CINFO.blue_max+1); - } else if( _CINFO.red_mult > 0 ) { - curind = ((int)(0.5+r*_CINFO.red_max))*_CINFO.red_mult+ - ((int)(0.5+g*_CINFO.green_max))*_CINFO.green_mult+ - ((int)(0.5+b*_CINFO.blue_max))*_CINFO.blue_mult; - } else if( _CGINFO.red_mult > 0 ) { - float l = (r+g+b)/3.; - curind = (int)(0.5+l*_CGINFO.red_max)*_CGINFO.red_mult; - } - *pixel = _CINFO.base_pixel + curind ; - if( pcolormap->pixels[curind] == *pixel ) status = XW_SUCCESS ; - } - - if( !status ) { - -#ifdef TEST - if (pcolormap != qcolormap) { - for (i=0; i= 0.) { - if ((tab_ind[i][1] == r) && - (tab_ind[i][2] == g) && - (tab_ind[i][3] == b)) { - *pixel = (int) tab_ind[i][0]; - status = XW_SUCCESS; - break; - } - } - } -#endif - - if( !status ) { - status = Xw_alloc_color(pcolormap,r,g,b,pixel,isapproximate) ; - -#ifdef TEST - if( status ) { - tab_ind[indice][0] = *pixel ; - tab_ind[indice][1] = r ; - tab_ind[indice][2] = g ; - tab_ind[indice][3] = b ; - /* - * Une fois que le tableau est plein, il faut le - * parcourir completement, donc on ne touche plus - * a indice_max. - */ - indice ++ ; - if( indice < MAX_COLRS ) { - indice_max = max(indice_max,indice); - } else { - indice = 0 ; /* on repart a 0 */ -#ifdef TRACE_GET_COLOR_PIXEL - if( Xw_get_trace() > 1 ) { - printf(" ************************\n") ; - printf(" Xw_get_color_pixel, full array\n") ; - printf(" ************************\n") ; - } -#endif - } - } -#endif - } - } - - -#ifdef TRACE_GET_COLOR_PIXEL -if( Xw_get_trace() > 3 ) { - printf(" %d = Xw_get_color_pixel(%lx,%f,%f,%f,%lx,%d)\n", - status,(long ) pcolormap,r,g,b,*pixel,*isapproximate) ; -} -#endif - - return( status ) ; -} diff --git a/src/Xw/Xw_get_colormap_info.cxx b/src/Xw/Xw_get_colormap_info.cxx deleted file mode 100755 index 41a59adec2..0000000000 --- a/src/Xw/Xw_get_colormap_info.cxx +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_COLORMAP_INFO -#endif - -/* - XW_STATUS Xw_get_colormap_info (acolormap,visual,tclass,visualid, - mcolor,scolor,ucolor,dcolor,fcolor): - XW_EXT_COLORMAP *acolormap - Aspect_Handle **visual Return Visual structure address - Xw_TypeOfVisual *tclass Return Visual Class of the creating colormap - int *visualid Return the visual identificator - int *mcolor Return the maximum color number of the colormap - int *scolor Return the System Color base pixel used in the colormap - int *ucolor Return the User color number used in the colormap - int *dcolor Return the User color number defined in the colormap - int *fcolor Return the First Free User color index in the colormap - - NOTE than if fcolor is < 0 No more free colors exist in the colormap - Returns ERROR if the Extended Colormap is not defined - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_colormap_info (void* acolormap, - Aspect_Handle** visual, - Xw_TypeOfVisual* tclass, - int* visualid, - int* mcolor,int* scolor, - int* ucolor,int* dcolor,int* fcolor) -#else -XW_STATUS Xw_get_colormap_info (acolormap,visual,tclass,visualid,mcolor,scolor,ucolor,dcolor,fcolor) -void *acolormap; -Aspect_Handle **visual ; -Xw_TypeOfVisual *tclass ; -int *visualid; -int *mcolor,*scolor,*ucolor,*dcolor,*fcolor ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap; -int i ; - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_get_colormap_info",pcolormap) ; - return (XW_ERROR) ; - } - - *visual = (Aspect_Handle*) _CVISUAL ; - *tclass = (Xw_TypeOfVisual) _CCLASS ; - *visualid = _CVISUAL->visualid; - *mcolor = pcolormap->maxhcolor ; - *scolor = _CINFO.base_pixel ; - *ucolor = pcolormap->maxucolor ; - *dcolor = 0 ; - *fcolor = -1 ; - for( i=0 ; i< *ucolor ; i++ ) { - if( (pcolormap->define[i] != FREECOLOR) && - (pcolormap->define[i] != HIGHCOLOR)) (*dcolor)++ ; - else if( *fcolor < 0 ) *fcolor = i ; - } - -#ifdef TRACE_GET_COLORMAP_INFO -if( Xw_get_trace() ) { - printf (" Xw_get_colormap_info(%lx,%lx,%d,%d,%d,%d,%d,%d,%d)\n", - (long ) pcolormap,(long ) *visual,*tclass,*visualid,*mcolor,*scolor,*ucolor,*dcolor,*fcolor) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_colormap_visual.cxx b/src/Xw/Xw_get_colormap_visual.cxx deleted file mode 100755 index 942f01eef0..0000000000 --- a/src/Xw/Xw_get_colormap_visual.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_COLORMAP_VISUAL -#endif - -/* - Xw_TypeOfVisual Xw_get_colormap_visual (acolormap): - XW_EXT_COLORMAP *acolormap - - Returns the colormap Visual class ,must be one of : - - STATICGRAY,GRAYSCALE,STATICCOLOR,PSEUDOCOLOR, - TRUECOLOR,DIRECTCOLOR -*/ - -#ifdef XW_PROTOTYPE -Xw_TypeOfVisual Xw_get_colormap_visual (void* acolormap) -#else -Xw_TypeOfVisual Xw_get_colormap_visual (acolormap) -void *acolormap; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap; - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_get_colormap_visual",pcolormap) ; - return (Xw_TOV_DEFAULT) ; - } - -#ifdef TRACE_GET_COLORMAP_VISUAL -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_colormap_visual(%lx)\n",_CCLASS,(long ) pcolormap) ; -} -#endif - - return (Xw_TypeOfVisual) _CCLASS ; -} diff --git a/src/Xw/Xw_get_colormap_xid.cxx b/src/Xw/Xw_get_colormap_xid.cxx deleted file mode 100755 index b7ecb1c01d..0000000000 --- a/src/Xw/Xw_get_colormap_xid.cxx +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_COLORMAP_XID -#endif - -/* - Aspect_Handle Xw_get_colormap_xid (acolormap): - XW_EXT_COLORMAP *acolormap - - Returns the colormap XId - -*/ - -#ifdef XW_PROTOTYPE -Aspect_Handle Xw_get_colormap_xid (void* acolormap) -#else -Aspect_Handle Xw_get_colormap_xid (acolormap) -void *acolormap; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap; - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_get_colormap_xid",pcolormap) ; - return (0) ; - } - -#ifdef TRACE_GET_COLORMAP_XID -if( Xw_get_trace() > 1 ) { - printf (" %lx = Xw_get_colormap_xid(%lx)\n",(long ) _CINFO.colormap,(long ) pcolormap) ; -} -#endif - - return (_CINFO.colormap) ; -} - -#ifdef TRACE -#define TRACE_GET_COLORMAP_COLORCUBE -#endif - -/* - XW_STATUS Xw_get_colormap_colorcube (acolormap, - colormap,visualid,base_pixel,red_max,red_mult, - green_max,green_mult,blue_max,blue_mult): - XW_EXT_COLORMAP *acolormap - Aspect_Handle *colormap - int *visualid - int *base_pixel,*red_max,*red_mult,*green_max,*green_mult,*blue_max,*blue_mult - - Returns TRUE if the colormap provide a color-cube definition - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_colormap_colorcube (void* acolormap, - Aspect_Handle *colormap,int *visualid,int *base_pixel, - int *red_max,int *red_mult,int *green_max,int *green_mult, - int *blue_max,int *blue_mult) -#else -XW_STATUS Xw_get_colormap_colorcube (acolormap, - colormap,visualid,base_pixel,red_max,red_mult,green_max,green_mult, - blue_max,blue_mult) -void *acolormap; -Aspect_Handle *colormap; -int *visualid; -int *base_pixel,*red_max,*red_mult,*green_max,*green_mult,*blue_max,*blue_mult; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap; -XW_STATUS status = XW_SUCCESS; - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_get_colormap_colorcube",pcolormap) ; - return (XW_ERROR) ; - } - - *colormap = _CINFO.colormap; - *visualid = _CINFO.visualid; - *base_pixel = _CINFO.base_pixel; - *red_max = _CINFO.red_max; - *red_mult = _CINFO.red_mult; - *green_max = _CINFO.green_max; - *green_mult = _CINFO.green_mult; - *blue_max = _CINFO.blue_max; - *blue_mult = _CINFO.blue_mult; - - if( _CINFO.red_mult <= 0 ) { - status = XW_ERROR; - } - -#ifdef TRACE_GET_COLORMAP_COLORCUBE -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_colormap_colorcube(%lx,%lx,%d,%d,%d,%d,%d,%d,%d,%d)\n", - status,(long ) pcolormap,*colormap,*visualid,*base_pixel,*red_max,*red_mult, - *green_max,*green_mult,*blue_max,*blue_mult) ; -} -#endif - - return (status) ; -} - -#ifdef TRACE -#define TRACE_GET_COLORMAP_GRAYRAMP -#endif - -/* - XW_STATUS Xw_get_colormap_grayramp (acolormap, - colormap,visualid,base_pixel,gray_max,gray_mult): - XW_EXT_COLORMAP *acolormap - Aspect_Handle *colormap - int *visualid - int *base_pixel,*gray_max,*gray_mult - - Returns TRUE if the colormap provide a gray_ramp definition - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_colormap_grayramp (void* acolormap, - Aspect_Handle *colormap,int *visualid,int *base_pixel, - int *gray_max,int *gray_mult) -#else -XW_STATUS Xw_get_colormap_grayramp (acolormap, - colormap,visualid,base_pixel,gray_max,gray_mult) -void *acolormap; -Aspect_Handle *colormap; -int *visualid; -int *base_pixel,*gray_max,*gray_mult; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap; -XW_STATUS status = XW_SUCCESS; - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_get_colormap_grayramp",pcolormap) ; - return (XW_ERROR) ; - } - - *colormap = _CGINFO.colormap; - *visualid = _CGINFO.visualid; - *base_pixel = _CGINFO.base_pixel; - *gray_max = _CGINFO.red_max; - *gray_mult = _CGINFO.red_mult; - - if( _CGINFO.red_mult <= 0 ) { - status = XW_ERROR; - } - -#ifdef TRACE_GET_COLORMAP_GRAYRAMP -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_colormap_grayramp(%lx,%lx,%d,%d,%d,%d)\n", - status,(long ) pcolormap,*colormap,*visualid,*base_pixel,*gray_max,*gray_mult); -} -#endif - - return (status) ; -} diff --git a/src/Xw/Xw_get_cursor_position.cxx b/src/Xw/Xw_get_cursor_position.cxx deleted file mode 100755 index bb0570aa76..0000000000 --- a/src/Xw/Xw_get_cursor_position.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_CURSOR_POSITION -#endif - -/* - XW_STATUS Xw_get_cursor_position (awindow,x,y) - XW_EXT_WINDOW *awindow - int *x,*y Returned Window relative Cursor position - - Get the Window cursor position - - Returns XW_ERROR if the cursor is out of the window - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_cursor_position (void *awindow,int *x,int *y) -#else -XW_STATUS Xw_get_cursor_position (awindow,x,y) -void *awindow ; -int *x,*y ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -//XW_EXT_DISPLAY *pdisplay = pwindow->connexion ; -int status ; -Window root,child ; -int root_x,root_y ; -unsigned int key ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_cursor_position",pwindow) ; - return (XW_ERROR) ; - } - - status = XQueryPointer(_DISPLAY,_WINDOW,&root,&child, - &root_x,&root_y,x,y,&key) ; - if( *x < 0 || *y < 0 || *x > _WIDTH || *y > _HEIGHT ) status = XW_ERROR ; - -#ifdef TRACE_GET_CURSOR_POSITION -if( Xw_get_trace() > 2 ) { - printf (" Xw_get_cursor_position(%lx,%d,%d)\n",(long ) pwindow,*x,*y) ; -} -#endif - return (XW_STATUS) status; - -} diff --git a/src/Xw/Xw_get_display_info.cxx b/src/Xw/Xw_get_display_info.cxx deleted file mode 100755 index 4115bef118..0000000000 --- a/src/Xw/Xw_get_display_info.cxx +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_DISPLAY_INFO -#endif - -/* - XW_STATUS Xw_get_display_info (adisplay,display,root,colormap,tclass,depth): - XW_EXT_DISPLAY *adisplay Extended Display structure - Aspect_Handle **display Display XID - Aspect_Handle *root Root XID - Aspect_Handle *colormap Default Colormap XID - Xw_TypeOfVisual *tclass Default Visual Class - int *depth Default Depth - - Returns the X display attributes of a connexion - - returns XW_ERROR if something is wrong - returns XW_SUCCESS else - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_display_info (void *adisplay,Aspect_Handle **display,Aspect_Handle *root,Aspect_Handle *colormap,Xw_TypeOfVisual *tclass,int *depth) -#else -XW_STATUS Xw_get_display_info (adisplay,display,root,colormap,tclass,depth) -void *adisplay ; -Aspect_Handle **display; -Aspect_Handle *root; -Aspect_Handle *colormap; -Xw_TypeOfVisual *tclass; -int *depth ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_display_info",pdisplay) ; - return (XW_ERROR) ; - } - - *display = (Aspect_Handle*) _DDISPLAY ; - *root = _DROOT ; - *tclass = (Xw_TypeOfVisual) _DCLASS ; - *colormap = _DCOLORMAP ; - *depth = DefaultDepthOfScreen(_DSCREEN) ; - -#ifdef TRACE_GET_DISPLAY_INFO -if( Xw_get_trace() > 1 ) { - printf (" Xw_get_display_info(%lx,%lx,%lx,%lx,%d,%d)\n", - (long ) adisplay,(long ) *display,*root,*colormap,*tclass,*depth) ; -} -#endif - - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_get_display_visual.cxx b/src/Xw/Xw_get_display_visual.cxx deleted file mode 100755 index aba9717bf4..0000000000 --- a/src/Xw/Xw_get_display_visual.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_DISPLAY_VISUAL -#endif - -/* - Xw_TypeOfVisual Xw_get_display_visual (adisplay,pclass): - XW_EXT_DISPLAY *adisplay Extended Display structure - Xw_TypeOfVisual pclass Preferred Visual Class - - Returns the X display attributes of a connexion - - returns XW_DEFAULT_VISUAL if something is wrong - returns the best Visual class if Successfull - -*/ - -#ifdef XW_PROTOTYPE -Xw_TypeOfVisual Xw_get_display_visual (void *adisplay,Xw_TypeOfVisual pclass) -#else -Xw_TypeOfVisual Xw_get_display_visual (adisplay,pclass) -void *adisplay ; -Xw_TypeOfVisual pclass; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; -Xw_TypeOfVisual rclass = Xw_TOV_DEFAULT ; -XVisualInfo *ginfo ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_display_visual",pdisplay) ; - return (rclass) ; - } - - if( !(ginfo = Xw_get_visual_info(pdisplay,pclass)) ) return (rclass) ; - -#if defined(__cplusplus) || defined(c_plusplus) - rclass = (Xw_TypeOfVisual) ginfo->visual->c_class ; -#else - rclass = (Xw_TypeOfVisual) ginfo->visual->class ; -#endif - - XFree((char*)ginfo) ; - - -#ifdef TRACE_GET_DISPLAY_VISUAL -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_display_visual(%lx,%d)\n",rclass,(long ) adisplay,pclass) ; -} -#endif - - return (rclass) ; -} diff --git a/src/Xw/Xw_get_double_buffer.cxx b/src/Xw/Xw_get_double_buffer.cxx deleted file mode 100755 index 98825e0ca8..0000000000 --- a/src/Xw/Xw_get_double_buffer.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_DOUBLE_BUFFER -#endif - -/* - DOUBLEBUFFERMODE Xw_get_double_buffer (awindow) - XW_EXT_WINDOW *awindow - - Returns the double_buffering status for this window . - - returns SUCCESS always -*/ - -#ifdef XW_PROTOTYPE -XW_DOUBLEBUFFERMODE Xw_get_double_buffer (void* awindow) -#else -XW_DOUBLEBUFFERMODE Xw_get_double_buffer (awindow) -XW_EXT_WINDOW *awindow; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_DOUBLEBUFFERMODE state ; - - if( (_PIXMAP && (_DRAWABLE == _PIXMAP)) || - (_NWBUFFER > 0 && (_DRAWABLE == _BWBUFFER)) ) state = XW_ENABLE ; - else state = XW_DISABLE ; - -#ifdef TRACE_GET_DOUBLE_BUFFER -if( Xw_get_trace() ) { - printf(" %d = Xw_get_double_buffer(%lx)\n",state,(long ) pwindow) ; -} -#endif - - return (state); -} diff --git a/src/Xw/Xw_get_env.cxx b/src/Xw/Xw_get_env.cxx deleted file mode 100755 index 248a3616e3..0000000000 --- a/src/Xw/Xw_get_env.cxx +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_ENV -#define TRACE_PUT_ENV -#endif - -/* - STATUS Xw_get_env (symbol,value,length): - char *symbol Symbol string to read - char *value return Symbol value to fill - int length Value max length in chars - - Get external Symbol value (Set by setenv UNIX) - - Returns ERROR if No symbol exist - or Length is too small for value - Returns SUCCESS if Successful - - STATUS Xw_put_env (symbol,value): - char *symbol Symbol string to write - char *value Symbol value to write - - Put external Symbol value (Set by putenv UNIX) - - Returns ERROR if symbol is empty - Returns SUCCESS if Successful -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_env (const char* symbol,char* value,int length) -#else -XW_STATUS Xw_get_env (symbol,value,length) -const char *symbol; -char *value ; -int length ; -#endif /*XW_PROTOTYPE*/ -{ -char *string ; - - if( !(string = getenv (symbol)) ) { - if( Xw_get_trace() > 1 ) - printf("*UNDEFINED SYMBOL*Xw_get_env('%s',...)\n",symbol); - return (XW_ERROR); - } - - if( strlen(string) >= (unsigned int ) length ) return (XW_ERROR) ; - - strcpy(value,string) ; - -#ifdef TRACE_GET_ENV -if( Xw_get_trace() > 1 ) { - printf (" '%s' = Xw_get_env('%s','%s',%d)\n",value,symbol,string,length) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_filename.cxx b/src/Xw/Xw_get_filename.cxx deleted file mode 100755 index d2bba3b3d9..0000000000 --- a/src/Xw/Xw_get_filename.cxx +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -/* PRO12499 OPTIMISATION & DEBUG GG_100398 -// Utiliser plutot une variable statique que allouer de - la memoire. -*/ - -#define IMP010200 /* GG - Add protection when NO extension is defined - and the path contains a '.' -*/ - -#include -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_FILENAME -#endif - -/* - char* Xw_get_filename (filename,extension): - char *filename Filename to translate - char *extension File extension - - Translate Filename depending of environment and extension - - Returns Updated Filename depending of environment and extension - or Returns NULL is translating can't be done - - NOTE: Filename can be given under the forms : - - 1) xxxxxx.ext - 2) xxxxxx (.extension is added) - 3) /usr/..../xxxxxx.ext - 4) $XXXXX/yyyyyy.ext ($XXXXX symbol is get and insert - -*/ -#define MAXSTRING 512 -static char string1[MAXSTRING]; -static char string2[MAXSTRING]; - -#ifdef XW_PROTOTYPE -char* Xw_get_filename (char* filename,const char* extension) -#else -char* Xw_get_filename (filename,extension) -char *filename ; -const char *extension ; -#endif /*XW_PROTOTYPE*/ -{ -char *pname,*pext,*pslash; - - if( !filename || strlen(filename) > MAXSTRING ) { - printf (" *TOO BIG PATH*Xw_get_filename('%s','%s')\n", - filename,extension) ; - return (NULL) ; - } - - pname = strcpy(string1,filename) ; - - if( *pname == '$' ) { - pname = (char*) strchr(string1,'/') ; - if( pname ) { /* Filename is $XXXX/yyyyy */ - XW_STATUS status; - *pname = '\0' ; - status = Xw_get_env(&string1[1],string2,MAXSTRING) ; - *pname = '/' ; - if( status ) { - if( (strlen(string2) + strlen(pname) + 1) < MAXSTRING ) { - pname = strcat(string2,pname) ; - } else { - printf (" *TOO BIG SYMBOL PATH*Xw_get_filename('%s','%s')\n", - filename,extension) ; - return NULL; - } - } - } - } - - pext = strrchr(pname,'.') ; -#ifdef IMP010200 - pslash = strrchr(pname,'/') ; - if( pext && (pslash > pext) ) pext = NULL; -#endif - - if( !pext ) { /* Add file extension ".extension" */ - if( (strlen(pname) + strlen(extension) + 2) < MAXSTRING ) { - strcat(pname,".") ; - strcat(pname,extension) ; - } else { - printf (" *TOO BIG EXTENSION*Xw_get_filename('%s','%s')\n", - filename,extension) ; - return NULL; - } - } - -#ifdef TRACE_GET_FILENAME -if( Xw_get_trace() > 1 ) { - printf (" '%s'= Xw_get_filename('%s','%s')\n",pname,filename,extension) ; -} -#endif - - return (pname); -} diff --git a/src/Xw/Xw_get_font.cxx b/src/Xw/Xw_get_font.cxx deleted file mode 100755 index 3f598aa602..0000000000 --- a/src/Xw/Xw_get_font.cxx +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_FONT -#endif - -/* - char* Xw_get_font (afontmap,index,size,bheight): - XW_EXT_FONTMAP *afontmap - int index font index - float *size font size in MM - float *bheight baseline font height in MM - - Get Line Font Extended fontmap FONT values from index . - - Returns NULL if BadFont Index or font is not defined - Returns font string address if Successful - -*/ - -#ifdef XW_PROTOTYPE -char* Xw_get_font (void* afontmap,int index,float *size,float *bheight) -#else -char* Xw_get_font (afontmap,index,size,bheight) -void *afontmap; -int index ; -float *size ; -float *bheight ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_FONTMAP *pfontmap = (XW_EXT_FONTMAP*)afontmap; -//XW_EXT_DISPLAY *pdisplay = pfontmap->connexion; -char *font = NULL; -//int i ; - - *size = *bheight = 0.; - if ( !Xw_isdefine_font(pfontmap,index) ) { - /*ERROR*Bad defined font*/ - Xw_set_error(43,"Xw_get_font",&index) ; - return (NULL) ; - } - - if( pfontmap->snames[index] ) font = pfontmap->snames[index] ; - else if( pfontmap->gnames[index] ) font = pfontmap->gnames[index]; - - if( !font ) { - /*ERROR*Bad defined font*/ - Xw_set_error(43,"Xw_get_font",&index); - return NULL; - } - - *size = pfontmap->fsizes[index]; - *bheight = *size * pfontmap->fratios[index]; - -#ifdef TRACE_GET_FONT -if( Xw_get_trace() > 1 ) { - printf (" '%s' = Xw_get_font(%lx,%d,%f,%f)\n",font,(long ) pfontmap,index,*size,*bheight) ; -} -#endif - - return (font); -} diff --git a/src/Xw/Xw_get_font_index.cxx b/src/Xw/Xw_get_font_index.cxx deleted file mode 100755 index a2a98bfbe4..0000000000 --- a/src/Xw/Xw_get_font_index.cxx +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_FONT_INDEX -#endif - -/* - STATUS Xw_get_font_index(afontmap,size,fontname,index): - - XW_EXT_FONTMAP *afontmap Fontmap extension structure - float size ; Font size in MM - char *fontname ; Font descriptor ended with '\0' - int *index ; Return Font index 0 >= x < MAXFONT - - Gets the nearest font index from Font Descriptor. - - Returns ERROR if BadFont Index or font is not defined - Returns SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_font_index(void* afontmap,float size,char* fontname,int* index) -#else -XW_STATUS Xw_get_font_index(afontmap,size,fontname,index) -void *afontmap ; -float size ; -char *fontname ; -int *index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_FONTMAP *pfontmap = (XW_EXT_FONTMAP*)afontmap ; -XW_STATUS status = XW_ERROR ; -int i,j ; - - if( !pfontmap ) { - /*ERROR*Bad EXT_FONTMAP Address*/ - Xw_set_error( 44,"Xw_get_font_index",pfontmap ) ; - return( XW_ERROR ) ; - } - - if( fontname && strlen(fontname) ) { - - for( i=j=0 ; imaxfont ; i++ ) { - if( pfontmap->gnames[i] ) { - if( !strcmp(fontname,pfontmap->gnames[i]) ) { - if( fabs(size-pfontmap->gsizes[i]) < 0.1 ) break; - } - } else if( !j ) j = i ; - } - - if( imaxfont ) { - *index = i ; - status = XW_SUCCESS ; - } else { - *index = j ; - status = Xw_def_font (pfontmap,j,size,fontname) ; - } - } else { - *index = 0 ; - status = XW_SUCCESS ; - } - -#ifdef TRACE_GET_FONT_INDEX -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_get_font_index(%lx,%f,'%s',%d)\n", - status,(long ) pfontmap,size,fontname,*index) ; -} -#endif - - return( status ) ; -} diff --git a/src/Xw/Xw_get_fontmap_info.cxx b/src/Xw/Xw_get_fontmap_info.cxx deleted file mode 100755 index b149ae6d70..0000000000 --- a/src/Xw/Xw_get_fontmap_info.cxx +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_FONTMAP_INFO -#endif - -/* - STATUS Xw_get_fontmap_info (afontmap,mfont,ufont,dfont,ffont): - XW_EXT_FONTMAP *afontmap - int *mfont Return the maximum font number of the fontmap - int *ufont Return the User font number used in the fontmap - int *dfont Return the User font number defined in the fontmap - int *ffont Return the First Free User font index in the fontmap - NOTE than if ffont is 0 No more Free font exist in the fontmap - - Returns ERROR if the Extended Fontmap is not defined - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_fontmap_info (void* afontmap, - int* mfont,int* ufont,int* dfont,int* ffont) -#else -XW_STATUS Xw_get_fontmap_info (afontmap,mfont,ufont,dfont,ffont) -void *afontmap; -int *mfont,*ufont,*dfont,*ffont ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_FONTMAP *pfontmap = (XW_EXT_FONTMAP*)afontmap; -int i ; - - if( !Xw_isdefine_fontmap(pfontmap) ) { - /*ERROR*Bad EXT_FONTMAP Address*/ - Xw_set_error(44,"Xw_get_fontmap_info",pfontmap) ; - return (XW_ERROR) ; - } - - *mfont = MAXFONT ; - *ufont = pfontmap->maxfont ; - *dfont = 0 ; - *ffont = -1 ; - for( i=0 ; i< *ufont ; i++ ) { - if( pfontmap->fonts[i] ) (*dfont)++ ; - else if( i && *ffont < 0 ) *ffont = i ; - } - -#ifdef TRACE_GET_FONTMAP_INFO -if( Xw_get_trace() ) { - printf (" Xw_get_fontmap_info(%lx,%d,%d,%d,%d)\n", - (long ) pfontmap,*mfont,*ufont,*dfont,*ffont) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_highlight_color.cxx b/src/Xw/Xw_get_highlight_color.cxx deleted file mode 100755 index 15b3aff53f..0000000000 --- a/src/Xw/Xw_get_highlight_color.cxx +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_HIGHLIGHT_COLOR -#define TRACE_GET_HIGHLIGHT_PIXEL -#endif - -/* - XW_STATUS Xw_get_highlight_color(acolormap,r,g,b): - XW_EXT_COLORMAP *acolormap Colormap extension structure - float *r,*g,*b ; Returns Red,Green,Blue color value 0. >= x <= 1. - - Get R,G,B Highlight Color values from Default index . - - Returns ERROR if Extended Colormap Address is badly defined - Returns SUCCESS if Successful - - XW_STATUS Xw_get_highlight_pixel(acolormap,pixel): - XW_EXT_COLORMAP *acolormap Colormap extension structure - unsigned long *pixel; Returns HighLight pixel - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_highlight_color (void* acolormap, - float* r,float* g,float* b) -#else -XW_STATUS Xw_get_highlight_color (acolormap,r,g,b) -void *acolormap; -float *r,*g,*b ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap; -XColor color ; - - if ( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXTENDED Colormap ADDRESS*/ - Xw_set_error(42,"Xw_get_highlight_color",pcolormap) ; - return (XW_ERROR) ; - } - - switch ( _CCLASS ) { - - case PseudoColor : - case StaticColor : - color.pixel = pcolormap->highpixel ; - XQueryColor(_CDISPLAY,_CINFO.colormap,&color) ; - *r = (float)color.red/0xFFFF ; - *g = (float)color.green/0xFFFF ; - *b = (float)color.blue/0xFFFF ; - break ; - - case TrueColor : - { unsigned long mask = _CVISUAL->map_entries-1 ; - unsigned long red,green,blue ; - unsigned long rmask = _CVISUAL->red_mask ; - unsigned long gmask = _CVISUAL->green_mask ; - unsigned long bmask = _CVISUAL->blue_mask ; - - color.pixel = pcolormap->highpixel ; - red = color.pixel & rmask ; - while ( !(rmask & 0x01) ) { rmask >>= 1; red >>= 1; } - - green = color.pixel & gmask ; - while ( !(gmask & 0x01) ) { gmask >>= 1; green >>= 1; } - - blue = color.pixel & bmask ; - while ( !(bmask & 0x01) ) { bmask >>= 1; blue >>= 1; } - - *r = (float)red/mask ; - *g = (float)green/mask ; - *b = (float)blue/mask ; - } - break ; - - default : - /*Unmatchable Visual class*/ - Xw_set_error(67,"Xw_get_highlight_color",&_CCLASS) ; - return (XW_ERROR) ; - } - - - -#ifdef TRACE_GET_HIGHLIGHT_COLOR -if( Xw_get_trace() > 1 ) { - printf(" Xw_get_highlight_color(%lx,%f,%f,%f)\n",(long ) pcolormap,*r,*g,*b) ; -} -#endif - - return (XW_SUCCESS); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_highlight_pixel (void* acolormap,unsigned long *pixel) -#else -XW_STATUS Xw_get_highlight_pixel (acolormap,pixel) -void *acolormap; -unsigned long *pixel; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap; -//XColor color ; - - if ( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXTENDED Colormap ADDRESS*/ - Xw_set_error(42,"Xw_get_highlight_pixel",pcolormap) ; - return (XW_ERROR) ; - } - - *pixel = pcolormap->highpixel ; - -#ifdef TRACE_GET_HIGHLIGHT_PIXEL -if( Xw_get_trace() > 1 ) { - printf(" Xw_get_highlight_pixel(%lx,%lx)\n",(long ) pcolormap,*pixel) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_image.cxx b/src/Xw/Xw_get_image.cxx deleted file mode 100755 index 95632d9bb4..0000000000 --- a/src/Xw/Xw_get_image.cxx +++ /dev/null @@ -1,270 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#include - -/* -// GG PRO4521 05/08/96 -// Capture an image across all the window memory plans. -// GG PRO6633 21/08/97 -// Avoid crash when image size is NULL. -// GG IMP060200 -// Capture an image from any pixmap. -*/ -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef HAVE_X11_EXTENSIONS_READDISPLAY_H -#include -#endif - -#ifdef HAVE_X11_EXTENSIONS_TRANSOLV_H -#include -#endif - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_IMAGE -#endif - -/* - XW_EXT_IMAGEDATA* Xw_get_image (awindow,aimageinfo,xc,yc,width,height): - XW_EXT_WINDOW *awindow - XW_USERDATA *aimageinfo Image Informations Address - int xc,yc Image center location in pixels - int width,height Image size in pixels - - Get an image from the window at the required Center location - NOTE than current Window position and size are taken. - - returns The image descriptor address if successful - returns NULL if BadAllocation or Image is outside of the window - - XW_EXT_IMAGEDATA* Xw_get_image_from_pixmap (awindow,aimageinfo,pixmap,xc,yc,width,height): - XW_EXT_WINDOW *awindow - XW_USERDATA *aimageinfo Image Informations Address - Aspect_Handle pixmap, - int xc,yc Image center location in pixels - int width,height Image size in pixels - - Get an image from any pixmap at the required Center location and size - - returns The image descriptor address if successful - returns NULL if BadAllocation or Image is outside of the pixmap - -*/ - -#ifdef XW_PROTOTYPE -void* Xw_get_image (void* awindow, void *aimageinfo, - int xc,int yc,int width,int height) -#else -void* Xw_get_image (awindow,aimageinfo,xc,yc,width,height) -void *awindow; -void *aimageinfo ; -int xc,yc ; -int width,height ; -#endif // XW_PROTOTYPE -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_DISPLAY *pdisplay = pwindow->connexion ; -XW_EXT_IMAGEDATA *pimage ; -int wx,wy; -#if defined(HAVE_X11_EXTENSIONS_READDISPLAY_H) || defined(HAVE_X11_EXTENSIONS_TRANSOLV_H) -int mOptCode,fEvent,fError; -#endif - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_image",pwindow) ; - return (NULL) ; - } - - if( width <= 0 || height <= 0 ) return NULL; - - wx = xc - width/2 ; - wy = yc - height/2 ; - - if( wx < 0 ) wx = 0; - if( wy < 0 ) wy = 0; - - if( !(pimage = Xw_add_imagedata_structure(sizeof(XW_EXT_IMAGEDATA))) ) - return (NULL) ; - - pimage->pimageinfo = aimageinfo ; - - if( _DGRAB ) { - wx += _X ; wy += _Y ; - if( (wx + width) < 0 || wx > _DWIDTH || - (wy + height) < 0 || wy > _DHEIGHT ) { - Xw_del_imagedata_structure(pimage) ; - /*WARNING*Try to Get Image from outside the display*/ - Xw_set_error(45,"Xw_get_image",0) ; - return (NULL) ; - } - - if( width > _DWIDTH ) width = _DWIDTH; - if( height > _DHEIGHT ) height = _DHEIGHT; - if( wx + width > _DWIDTH ) width = _DWIDTH - wx; - if( wy + height > _DHEIGHT ) height = _DHEIGHT - wy; - - _ICOLORMAP = NULL ; - _IIMAGE = NULL ; -#ifdef HAVE_X11_EXTENSIONS_READDISPLAY_H - if( XQueryExtension(_DISPLAY,"ReadDisplay",&mOptCode,&fEvent,&fError) ) { - XGrabServer(_DISPLAY); - XSync(_DISPLAY,False); - _IIMAGE = XReadDisplay(_DISPLAY,_DROOT,wx,wy,width,height,0,0); - XUngrabServer(_DISPLAY); - XSync(_DISPLAY,False); - } -#endif // HAVE_X11_EXTENSIONS_READDISPLAY_H -#ifdef HAVE_X11_EXTENSIONS_TRANSOLV_H - if( XQueryExtension(_DISPLAY,"SUN_OVL",&mOptCode,&fEvent,&fError) ) { - XGrabServer(_DISPLAY); - XSync(_DISPLAY,False); - _IIMAGE = XReadScreen(_DISPLAY,_DROOT,wx,wy,width,height,False); - XUngrabServer(_DISPLAY); - XSync(_DISPLAY,False); - } -#endif // HAVE_X11_EXTENSIONS_TRANSOLV_H - if( !_IIMAGE ) - _IIMAGE = XGetImage(_DISPLAY,_DROOT,wx,wy, - width,height,AllPlanes,ZPixmap) ; - } else { - if( (wx + width) < 0 || wx > _WIDTH || - (wy + height) < 0 || wy > _HEIGHT ) { - Xw_del_imagedata_structure(pimage) ; - /*WARNING*Try to Get Image from outside the window*/ - Xw_set_error(45,"Xw_get_image",0) ; - return (NULL) ; - } - - if( width > _WIDTH ) width = _WIDTH; - if( height > _HEIGHT ) height = _HEIGHT; - if( wx + width > _WIDTH ) width = _WIDTH - wx; - if( wy + height > _HEIGHT ) height = _HEIGHT - wy; - - _ICOLORMAP = _COLORMAP ; - _IIMAGE = NULL; -#ifdef HAVE_X11_EXTENSIONS_READDISPLAY_H - if( XQueryExtension(_DISPLAY,"ReadDisplay",&mOptCode,&fEvent,&fError) ) - { - unsigned int flag = XRD_IGNORE_LAYER_1 | XRD_IGNORE_LAYER_2 | - XRD_IGNORE_LAYER_MINUS_1; - int rx,ry; - Window child; - XGrabServer(_DISPLAY); - XSync(_DISPLAY,False); - XTranslateCoordinates(_DISPLAY,_WINDOW,_DROOT,wx,wy,&rx,&ry,&child); - _IIMAGE = XReadDisplay(_DISPLAY,_WINDOW,rx,ry,width,height,flag,0); - XUngrabServer(_DISPLAY); - XSync(_DISPLAY,False); - } -#endif // HAVE_X11_EXTENSIONS_READDISPLAY_H -#ifdef HAVE_X11_EXTENSIONS_TRANSOLV_H - if( XQueryExtension(_DISPLAY,"SUN_OVL",&mOptCode,&fEvent,&fError) ) - { - XGrabServer(_DISPLAY); - XSync(_DISPLAY,False); - _IIMAGE = XReadScreen(_DISPLAY,_WINDOW,wx,wy,width,height,False); - XUngrabServer(_DISPLAY); - XSync(_DISPLAY,False); - } -#endif // HAVE_X11_EXTENSIONS_TRANSOLV_H - if( !_IIMAGE ) - _IIMAGE = XGetImage(_DISPLAY,_WINDOW,wx,wy, - width,height,AllPlanes,ZPixmap) ; - } - - if( !_IIMAGE ) { - Xw_del_imagedata_structure(pimage) ; - /*WARNING*XImage allocation failed*/ - Xw_set_error(60,"Xw_get_image",0) ; - return (NULL) ; - } - else if( _IIMAGE->depth > 24 ) _IIMAGE->depth = 24; - -#ifdef TRACE_GET_IMAGE -if( Xw_get_trace() ) { - printf (" %lx = Xw_get_image(%lx,%lx,%d,%d,%d,%d)\n", - (long ) pimage,(long ) pwindow,(long ) aimageinfo,xc,yc,width,height); -} -#endif - - return (pimage); -} - -#ifdef XW_PROTOTYPE -void* Xw_get_image_from_pixmap (void* awindow, void *aimageinfo, - Aspect_Handle pixmap, int xc,int yc,int width,int height) -#else -void* Xw_get_image_from_pixmap (awindow,aimageinfo,pixmap,xc,yc,width,height) -void *awindow; -void *aimageinfo ; -Aspect_Handle pixmap; -int xc,yc ; -int width,height ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -// XW_EXT_DISPLAY *pdisplay = pwindow->connexion ; -XW_EXT_IMAGEDATA *pimage ; -int wx,wy; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_image_from_pixmap",pwindow) ; - return (NULL) ; - } - - if( pixmap == 0 || width <= 0 || height <= 0 ) return NULL; - - wx = xc - width/2 ; - wy = yc - height/2 ; - - if( wx < 0 ) wx = 0; - if( wy < 0 ) wy = 0; - - if( !(pimage = Xw_add_imagedata_structure(sizeof(XW_EXT_IMAGEDATA))) ) - return (NULL) ; - pimage->pimageinfo = aimageinfo ; - - _IIMAGE = XGetImage(_DISPLAY,pixmap,wx,wy, - width,height,AllPlanes,ZPixmap) ; - - if( !_IIMAGE ) { - Xw_del_imagedata_structure(pimage) ; - /*WARNING*XImage allocation failed*/ - Xw_set_error(60,"Xw_get_image_from_pixmap",0) ; - return (NULL) ; - } else { - _IIMAGE->red_mask = _VISUAL->red_mask; - _IIMAGE->green_mask = _VISUAL->green_mask; - _IIMAGE->blue_mask = _VISUAL->blue_mask; - if( _IIMAGE->depth > 24 ) _IIMAGE->depth = 24; - } - -#ifdef TRACE_GET_IMAGE -if( Xw_get_trace() ) { - printf (" %lx = Xw_get_image_from_pixmap(%lx,%lx,%lx,%d,%d,%d,%d)\n", - (long ) pimage,(long ) pwindow,(long ) aimageinfo, pixmap,xc,yc,width,height); -} -#endif - - return (pimage); -} diff --git a/src/Xw/Xw_get_image_info.cxx b/src/Xw/Xw_get_image_info.cxx deleted file mode 100755 index 1a35f6fff0..0000000000 --- a/src/Xw/Xw_get_image_info.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_IMAGE_INFO -#endif - -/* - XW_STATUS Xw_get_image_info (aimage,zoom,width,height,depth): - XW_EXT_IMAGEDATA *aimage Image - float *zoom returned Zoom factor - int *width,*height returned Image pixel size - int *depth returned Image planes depth. - - Get image size and zoom factor. - - returns ERROR if bad image extended address - returns SUCCESS if successfull - -* - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_image_info (void* aimage,float *zoom,int* width,int* height,int *depth) -#else -XW_STATUS Xw_get_image_info (aimage,zoom,width,height,depth) -void *aimage; -float *zoom; -int *width; -int *height; -int *depth; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*)aimage; - - if( !Xw_isdefine_image(pimage) ) { - /*ERROR*Bad EXT_IMAGE Address*/ - Xw_set_error(25,"Xw_get_image_info",pimage) ; - return (XW_ERROR) ; - } - - *zoom = pimage->zoom; - *width = _IIMAGE->width; - *height = _IIMAGE->height; - *depth = _IIMAGE->depth; - -#ifdef TRACE_GET_IMAGE_INFO -if( Xw_get_trace() ) { - printf (" Xw_get_image_info('%lx',%f,%d,%d,%d)\n",(long ) aimage, - *zoom,*width,*height,*depth); -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_marker_index.cxx b/src/Xw/Xw_get_marker_index.cxx deleted file mode 100755 index 451bb82be4..0000000000 --- a/src/Xw/Xw_get_marker_index.cxx +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_MARKER_INDEX -#endif - -/* - XW_STATUS Xw_get_marker_index(amarkmap,length,spoint,xpoint,ypoint,index): - - XW_EXT_MARKMAP *amarkmap Markmap extension structure - int length ; Style Descriptor length - int *spoint; Marker status point vector - float *xpoint; Marker x coordinate vector - float *ypoint; Marker y coordinate vector - int *index ; Return Marker index 0 >= x < MAXMARKER - - Gets the nearest marker index from Style Descriptor values. - - Returns XW_ERROR if BadMarker Index or marker is not defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_marker_index(void *amarkmap,int length, - int *spoint, float *xpoint, float *ypoint, int *index) -#else -XW_STATUS Xw_get_marker_index(amarkmap,length,spoint,xpoint,ypoint,index) -void *amarkmap ; -int length ; -int *spoint; -float *xpoint; -float *ypoint; -int *index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_MARKMAP *pmarkmap = (XW_EXT_MARKMAP*) amarkmap ; -XW_STATUS status = XW_ERROR ; -int i,j,k,l ; - - if( !pmarkmap ) { - /*ERROR*Bad EXT_MARKMAP Address*/ - Xw_set_error( 46,"Xw_get_marker_index",pmarkmap ) ; - return( XW_ERROR ) ; - } - - if( length > 0 ) { - for( i=k=0 ; imaxmarker ; i++ ) { - l = pmarkmap->npoint[i]; - if( l == length ) { - int *s = pmarkmap->spoint[i]; - float *x = pmarkmap->xpoint[i]; - float *y = pmarkmap->ypoint[i]; - for( j=0 ; j= l ) break; - } else if( !l && !k ) k = i ; - } - - if( imaxmarker ) { - *index = i ; - status = XW_SUCCESS ; - } else { - *index = k ; - status = Xw_def_marker (pmarkmap,k,length,spoint,xpoint,ypoint) ; - } - } else { - *index = 0 ; - status = XW_SUCCESS ; - } - -#ifdef TRACE_GET_MARKER_INDEX -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_get_marker_index(%lx,%d,%d)\n", - status,(long ) pmarkmap,length,*index) ; -} -#endif - - return( status ) ; -} diff --git a/src/Xw/Xw_get_markmap_info.cxx b/src/Xw/Xw_get_markmap_info.cxx deleted file mode 100755 index d67d816973..0000000000 --- a/src/Xw/Xw_get_markmap_info.cxx +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_MARKMAP_INFO -#endif - -/* - STATUS Xw_get_markmap_info (amarkmap,mmark,umark,dmark,fmark): - XW_EXT_MARKMAP *amarkmap - int *mmark Return the maximum marker number of the markmap - int *umark Return the User marker number used in the markmap - int *dmark Return the User marker number defined in the markmap - int *fmark Return the First free marker index in the markmap - NOTE than if fmark is < 0 No more Free Marker exist in the markmap - - Returns ERROR if the Extended Markmap is not defined - Returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_markmap_info (void* amarkmap, - int* mmark,int* umark,int* dmark,int* fmark) -#else -XW_STATUS Xw_get_markmap_info (amarkmap,mmark,umark,dmark,fmark) -void *amarkmap; -int *mmark,*umark,*dmark,*fmark ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_MARKMAP *pmarkmap = (XW_EXT_MARKMAP*) amarkmap; -int i ; - - if( !Xw_isdefine_markmap(pmarkmap) ) { - /*ERROR*Bad EXT_MARKMAP Address */ - Xw_set_error(46,"Xw_get_markmap_info",pmarkmap) ; - return (XW_ERROR) ; - } - - *mmark = MAXMARKER ; - *umark = pmarkmap->maxmarker ; - *dmark = 1 ; - *fmark = -1 ; - for( i=0 ; i< *umark ; i++ ) { - if( pmarkmap->marks[i] ) (*dmark)++ ; - else if( i && *fmark < 0 ) *fmark = i ; - } - -#ifdef TRACE_GET_MARKMAP_INFO -if( Xw_get_trace() ) { - printf (" Xw_get_markmap_info(%lx,%d,%d,%d,%d)\n", - (long ) pmarkmap,*mmark,*umark,*dmark,*fmark) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_mmscreen_pixelvalue.cxx b/src/Xw/Xw_get_mmscreen_pixelvalue.cxx deleted file mode 100755 index 1d3e8fe05f..0000000000 --- a/src/Xw/Xw_get_mmscreen_pixelvalue.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_MMSCREEN_PIXELVALUE -#endif - -/* - float Xw_get_mmscreen_pixelvalue (adisplay,pv): - XW_EXT_DISPLAY *adisplay - int pv Pixel Values - - Returns Screen value from Pixel value in MM - -*/ - -#ifdef XW_PROTOTYPE -float Xw_get_mmscreen_pixelvalue(void* adisplay,int pv) -#else -float Xw_get_mmscreen_pixelvalue(adisplay,pv) -void *adisplay; -int pv ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay; -float sv ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_mmscreen_pixelvalue",pdisplay) ; - return (XW_ERROR) ; - } - - sv = (MMPXVALUE(pv) + MMPYVALUE(pv))/2. ; - -#ifdef TRACE_GET_MMSCREEN_PIXELVALUE -if( Xw_get_trace() > 1 ) { - printf (" %f = Xw_get_mmscreen_pixelvalue(%lx,%d)\n",sv,(long ) pdisplay,pv) ; -} -#endif - - return (sv); -} diff --git a/src/Xw/Xw_get_pixel.cxx b/src/Xw/Xw_get_pixel.cxx deleted file mode 100755 index ce51a00fe0..0000000000 --- a/src/Xw/Xw_get_pixel.cxx +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_PIXEL -#endif - -/* - STATUS Xw_get_pixel (aimage,x,y,index,npixel): - XW_EXT_IMAGEDATA *aimage - int x,y Pixel position - int *index return Pixel color index - int *npixel return Pixel number filled with - the same color index - - Extract pixels index from an existing IMAGE created by Xw_get_image - or fill with Xw_put_pixel - - returns ERROR if No image is defined - or No pixel color is defined - or Pixel position is wrong (Outside of image) - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_pixel (void* aimage,int x,int y,int* index,int* npixel) -#else -XW_STATUS Xw_get_pixel (aimage,x,y,index,npixel) -XW_EXT_IMAGEDATA *aimage ; -int x,y ; -int *index,*npixel ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*) aimage ; -register union { - char *data ; - unsigned char *cdata ; - unsigned short *sdata ; - unsigned long *ldata ; -} data ; -int i=0,fpixel,simage ; -unsigned long lpixel=0 ; -XImage *pximage; - - if( !Xw_isdefine_image(pimage) ) { - /*ERROR*Bad EXT_IMAGEDATA Address*/ - Xw_set_error(25,"Xw_get_pixel",pimage) ; - return (XW_ERROR) ; - } - - pximage = (_ZIMAGE) ? _ZIMAGE : _IIMAGE; - fpixel = x*pximage->width + y ; - simage = pximage->height*pximage->width ; - - if( x < 0 || y < 0 || (fpixel >= simage) ) { - /*ERROR*Bad PIXEL position*/ - Xw_set_error(47,"Xw_get_pixel",&simage) ; - return (XW_ERROR) ; - } - - switch (pximage->bitmap_pad) { - case 8 : - { register unsigned char cpixel ; - data.data = pximage->data + (fpixel) ; simage -= fpixel ; - cpixel = *data.cdata ; - for( i=1 ; idata + (fpixel<<1) ; simage -= fpixel ; - spixel = *data.sdata ; - for( i=1 ; idata + (fpixel<<2) ; simage -= fpixel; - lpixel = *data.ldata ; - for( i=1 ; imaxcolor ; i++ ) { - if( _ICOLORMAP->define[i] && - (lpixel == _ICOLORMAP->pixels[i]) ) break ; - } - if( i < _ICOLORMAP->maxcolor ) { - *index = i ; - } else { - /*ERROR*Bad Defined Color*/ - Xw_set_error(41,"Xw_get_pixel",&index) ; - return (XW_ERROR) ; - } - -#ifdef TRACE_GET_PIXEL -if( Xw_get_trace() > 2 ) { - printf (" Xw_get_pixel(%lx,%d,%d,%ld,%ld)\n", - (long ) pimage,x,y,(long ) index,(long ) npixel) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_pixel_mmscreenvalue.cxx b/src/Xw/Xw_get_pixel_mmscreenvalue.cxx deleted file mode 100755 index 9a46bc662a..0000000000 --- a/src/Xw/Xw_get_pixel_mmscreenvalue.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_PIXEL_MMSCREENVALUE -#endif - -/* - int Xw_get_pixel_mmscreenvalue (adisplay,sv): - XW_EXT_DISPLAY *adisplay - float sv MM Screen Values - - Returns pixel value from MM Screen value - -*/ - -#ifdef XW_PROTOTYPE -int Xw_get_pixel_mmscreenvalue(void* adisplay,float sv) -#else -int Xw_get_pixel_mmscreenvalue(adisplay,sv) -void *adisplay; -float sv ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay; -int pv ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_pixel_mmscreenvalue",pdisplay) ; - return (0) ; - } - - pv = (PMMXVALUE(sv) + PMMYVALUE(sv))/2 ; - -#ifdef TRACE_GET_PIXEL_MMSCREENVALUE -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_pixel_mmscreenvalue(%lx,%f)\n",pv,(long ) pdisplay,sv) ; -} -#endif - - return (pv); -} diff --git a/src/Xw/Xw_get_pixel_screencoord.cxx b/src/Xw/Xw_get_pixel_screencoord.cxx deleted file mode 100755 index b74fd1d63c..0000000000 --- a/src/Xw/Xw_get_pixel_screencoord.cxx +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_PIXEL_SCREENCOORD -#endif - -/* - STATUS Xw_get_screen_pixelcoord (adisplay,sx,sy,px,py): - XW_EXT_DISPLAY *adisplay - float sx,sy Screen Coordinates defined in DSU Space - int px,py Returns Screen Coordinates defined in Pixels - - Get screen coordinate from Screen in DSU Space - - returns ERROR if resulting Pixel Coordinate is outside the screen - or the if Extended Window address is not defined - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_pixel_screencoord(void* adisplay,float sx,float sy,int* px,int* py) -#else -XW_STATUS Xw_get_pixel_screencoord(adisplay,sx,sy,px,py) -void *adisplay; -float sx,sy ; -int *px,*py ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay; -int displaywidth ; -int displayheight ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_pixel_screencoord",pdisplay) ; - return (XW_ERROR) ; - } - - displaywidth = WidthOfScreen(_DSCREEN) ; - displayheight = HeightOfScreen(_DSCREEN) ; - - *px = (int)(sx*(float)displaywidth) ; - *py = (int)((1.-sy)*(float)displayheight) ; - - if( *px < 0 || *px >= displaywidth || *py < 0 || *py >= displayheight ) - return (XW_ERROR); - -#ifdef TRACE_GET_PIXEL_SCREENCOORD -if( Xw_get_trace() > 1 ) { - printf (" Xw_get_pixel_screencoord(%lx,%f,%f,%d,%d)\n",(long ) pdisplay,sx,sy,*px,*py) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_pixel_screenvalue.cxx b/src/Xw/Xw_get_pixel_screenvalue.cxx deleted file mode 100755 index 262754bd53..0000000000 --- a/src/Xw/Xw_get_pixel_screenvalue.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_PIXEL_SCREENVALUE -#endif - -/* - int Xw_get_pixel_screenvalue (adisplay,sv): - XW_EXT_DISPLAY *adisplay - float sv Screen Values in [0,1] Space - - Returns pixel value from screen value - -*/ - -#ifdef XW_PROTOTYPE -int Xw_get_pixel_screenvalue(void* adisplay,float sv) -#else -int Xw_get_pixel_screenvalue(adisplay,sv) -void *adisplay; -float sv ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay; -int pv ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_pixel_screenvalue",pdisplay) ; - return (0) ; - } - - pv = (int)(sv*min(WidthOfScreen(_DSCREEN),HeightOfScreen(_DSCREEN))) ; - -#ifdef TRACE_GET_PIXEL_SCREENVALUE -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_pixel_screenvalue(%lx,%f)\n",pv,(long ) pdisplay,sv) ; -} -#endif - - return (pv); -} diff --git a/src/Xw/Xw_get_pixel_windowcoord.cxx b/src/Xw/Xw_get_pixel_windowcoord.cxx deleted file mode 100755 index 00505b4a66..0000000000 --- a/src/Xw/Xw_get_pixel_windowcoord.cxx +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_PIXEL_WINDOWCOORD -#endif - -/* - STATUS Xw_get_pixel_windowcoord (awindow,ux,uy,px,py): - XW_EXT_WINDOW *awindow - float ux,uy Window Coordinates defined in DWU space - int *px,*py Returns Window Coordinates defined in Pixels - - Get transformed coordinate from User Space to Pixel Space - - NOTE than the current mapping defined by Xw_set_mapping is apply - - returns ERROR if User Coordinate is outside the window - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_pixel_windowcoord(void* awindow,float ux,float uy,int* px,int* py) -#else -XW_STATUS Xw_get_pixel_windowcoord(awindow,ux,uy,px,py) -void *awindow; -float ux,uy ; -int *px,*py ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_DISPLAY *pdisplay = pwindow->connexion ; - -//OCC186 - *px = PXPOINT(ux, pwindow->xratio) ; - *py = PYPOINT(uy, pwindow->attributes.height, pwindow->yratio) ; -//OCC186 - -#ifdef TRACE_GET_PIXEL_WINDOWCOORD -if( Xw_get_trace() > 1 ) { - printf (" Xw_get_pixel_windowcoord(%lx,%f,%f,%d,%d)\n",(long ) pwindow,ux,uy,*px,*py) ; -} -#endif - - if( !_DGRAB && (*px < 0 || *px > _WIDTH || *py < 0 || *py > _HEIGHT) ) - return (XW_ERROR); - else return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_pixel_windowvalue.cxx b/src/Xw/Xw_get_pixel_windowvalue.cxx deleted file mode 100755 index f8a1752a66..0000000000 --- a/src/Xw/Xw_get_pixel_windowvalue.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_PIXEL_WINDOWVALUE -#endif - -/* - int Xw_get_pixel_windowvalue (awindow,uv): - XW_EXT_WINDOW *awindow - float uv User Value defined in DWU space - - Returns Pixel value from transformed User Value - - NOTE than the current mapping defined by Xw_set_mapping is apply - -*/ - -#ifdef XW_PROTOTYPE -int Xw_get_pixel_windowvalue(void *awindow,float uv) -#else -int Xw_get_pixel_windowvalue(awindow,uv) -void *awindow; -float uv ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - int pv ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_pixel_windowvalue",pwindow) ; - return (0) ; - } - -//OCC186 - pv = PVALUE( uv, pwindow->xratio, pwindow->yratio ); -//OCC186 - -#ifdef TRACE_GET_PIXEL_WINDOWVALUE -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_pixel_windowvalue(%lx,%f)\n",pv,(long ) pwindow,uv) ; -} -#endif - return (pv) ; -} diff --git a/src/Xw/Xw_get_rgbpixel.cxx b/src/Xw/Xw_get_rgbpixel.cxx deleted file mode 100755 index a5da8c55f1..0000000000 --- a/src/Xw/Xw_get_rgbpixel.cxx +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_RGBPIXEL -#endif - -/* - STATUS Xw_get_rgbpixel (aimage,x,y,r,g,b,npixel): - XW_EXT_IMAGEDATA *aimage - int x,y Pixel position - float *r,*g,*b return R,G,B Pixel values - int *npixel return Pixel number filled with - the same color index - - Extract RGB pixels from an existing IMAGE created by Xw_get_image - - returns ERROR if Extended Image is not defined - or VISUAL Image type is not TRUECOLOR - or Pixel position is wrong (Outside of image) - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_rgbpixel (void* aimage, - int x,int y,float* r,float* g,float* b,int* npixel) -#else -XW_STATUS Xw_get_rgbpixel (aimage,x,y,r,g,b,npixel) -void *aimage ; -int x,y ; -float *r,*g,*b ; -int *npixel ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*) aimage ; -XW_EXT_COLORMAP *pcolormap = pimage->pcolormap ; -union { - char *data ; - unsigned char *cdata ; - unsigned short *sdata ; - unsigned long *ldata ; -} data ; -int i=0,fpixel,simage ; -unsigned long pixel=0 ; -XColor color ; -XImage *pximage; - - if( !Xw_isdefine_image(pimage) ) { - /*ERROR*Bad EXT_IMAGEDATA Address*/ - Xw_set_error(25,"Xw_get_rgbpixel",pimage) ; - return (XW_ERROR) ; - } - - pximage = (_ZIMAGE) ? _ZIMAGE : _IIMAGE ; - fpixel = x*pximage->width + y ; - simage = pximage->height*pximage->width ; - - if( x < 0 || y < 0 || (fpixel >= simage) ) { - /*ERROR*Bad PIXEL position*/ - Xw_set_error(47,"Xw_get_rgbpixel",&simage) ; - return (XW_ERROR) ; - } - - switch (pximage->bitmap_pad) { - case 8 : - data.data = pximage->data + (fpixel) ; simage -= fpixel ; - pixel = (unsigned long) *data.cdata ; - for( i=1 ; idata + (fpixel<<1) ; simage -= fpixel ; - pixel = (unsigned long) *data.sdata ; - for( i=1 ; idata + (fpixel<<2) ; simage -= fpixel ; - pixel = (unsigned long) *data.ldata ; - for( i=1 ; imap_entries-1 ; - unsigned long red,green,blue ; - unsigned long rmask = _CVISUAL->red_mask ; - unsigned long gmask = _CVISUAL->green_mask ; - unsigned long bmask = _CVISUAL->blue_mask ; - - red = pixel & rmask ; - while ( !(rmask & 0x01) ) { rmask >>= 1; red >>= 1; } - - green = pixel & gmask ; - while ( !(gmask & 0x01) ) { gmask >>= 1; green >>= 1; } - - blue = pixel & bmask ; - while ( !(bmask & 0x01) ) { bmask >>= 1; blue >>= 1; } - - *r = (float)red/mask ; - *g = (float)green/mask ; - *b = (float)blue/mask ; - } - break ; - - case PseudoColor : - color.pixel = pixel ; - XQueryColor(_CDISPLAY,_CINFO.colormap,&color) ; - *r = (float) color.red/0xFFFF ; - *g = (float) color.green/0xFFFF ; - *b = (float) color.blue/0xFFFF ; - break ; - default : - /*ERROR*Unimplemented Visual Class*/ - Xw_set_error(5,"Xw_get_rgbpixel",&_CCLASS) ; - return (XW_ERROR) ; - } - -#ifdef TRACE_GET_RGBPIXEL - printf (" Xw_get_rgbpixel(%lx,%d,%d,%f,%f,%f,%d)\n", - (long ) pimage,x,y,*r,*g,*b,*npixel) ; -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_screen_pixelcoord.cxx b/src/Xw/Xw_get_screen_pixelcoord.cxx deleted file mode 100755 index 54fdd0c953..0000000000 --- a/src/Xw/Xw_get_screen_pixelcoord.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_SCREEN_PIXELCOORD -#endif - -/* - XW_STATUS Xw_get_screen_pixelcoord (adisplay,px,py,sx,sy): - XW_EXT_DISPLAY *adisplay - int px,py Screen Coordinates defined in Pixels - float *sx,*sy Returns Screen Coordinates defined in [0,1] Space - - Get screen coordinate from Pixel Space to [0,1] Space - - returns XW_ERROR if Pixel Coordinate is outside the screen - or the if Extended Window address is not defined - returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_screen_pixelcoord(void *adisplay,int px,int py,float *sx,float *sy) -#else -XW_STATUS Xw_get_screen_pixelcoord(adisplay,px,py,sx,sy) -void *adisplay; -int px,py ; -float *sx,*sy ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay; - int displaywidth ; - int displayheight ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_screen_pixelcoord",pdisplay) ; - return (XW_ERROR) ; - } - - displaywidth = WidthOfScreen(_DSCREEN) ; - displayheight = HeightOfScreen(_DSCREEN) ; - - *sx = (float)px/(float)displaywidth ; - *sy = 1. - (float)py/(float)displayheight ; - - if( px < 0 || px >= displaywidth || py < 0 || py >= displayheight ) - return (XW_ERROR); - -#ifdef TRACE_GET_SCREEN_PIXELCOORD -if( Xw_get_trace() ) -printf (" Xw_get_screen_pixelcoord(%lx,%d,%d,%f,%f)\n",(long ) pdisplay,px,py,*sx,*sy) ; -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_screen_pixelvalue.cxx b/src/Xw/Xw_get_screen_pixelvalue.cxx deleted file mode 100755 index af48c4f780..0000000000 --- a/src/Xw/Xw_get_screen_pixelvalue.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -#ifdef TRACE -#define TRACE_GET_SCREEN_PIXELVALUE -#endif - -/* - float Xw_get_screen_pixelvalue (adisplay,pv): - XW_EXT_DISPLAY *adisplay - int pv Pixel Values - - Returns screen value from Pixel value in [0,1] Space - -*/ - -#ifdef XW_PROTOTYPE -float Xw_get_screen_pixelvalue(void *adisplay,int pv) -#else -float Xw_get_screen_pixelvalue(adisplay,pv) -void *adisplay; -int pv ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay; -float sv ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_screen_pixelvalue",pdisplay) ; - return (0.) ; - } - - sv = (float)pv/min(WidthOfScreen(_DSCREEN),HeightOfScreen(_DSCREEN)) ; - -#ifdef TRACE_GET_SCREEN_PIXELVALUE -if( Xw_get_trace() > 1 ) { - printf (" %f = Xw_get_screen_pixelvalue(%lx,%d)\n",sv,(long ) pdisplay,pv) ; -} -#endif - - return (sv); -} diff --git a/src/Xw/Xw_get_screen_size.cxx b/src/Xw/Xw_get_screen_size.cxx deleted file mode 100755 index 373d46ffa5..0000000000 --- a/src/Xw/Xw_get_screen_size.cxx +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_SCREEN_SIZE -#define TRACE_GET_MMSCREEN_SIZE -#endif - -/* - XW_STATUS Xw_get_screen_size (adisplay,width,height): - XW_EXT_DISPLAY *adisplay - int *width - int *depth - - Get Screen Width and Height in Pixels - - Returns XW_ERROR if Ext_Display address is wrong - Returns XW_SUCCESS always - - XW_STATUS Xw_get_mmscreen_size (adisplay,width,height): - XW_EXT_DISPLAY *adisplay - int *width - int *depth - - Get Screen Width and Height in Millimeters - - Returns XW_ERROR if Ext_Display address is wrong - Returns XW_SUCCESS always - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_screen_size (void *adisplay,int *width,int *height) -#else -XW_STATUS Xw_get_screen_size (adisplay,width,height) -void *adisplay; -int *width ; -int *height ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_screen_size",pdisplay) ; - return (XW_ERROR) ; - } - - *width = _DWIDTH ; - *height = _DHEIGHT ; - - -#ifdef TRACE_GET_SCREEN_SIZE -if( Xw_get_trace() ) { - printf (" Xw_get_screen_size(%lx,%d,%d)\n",(long ) pdisplay,*width,*height) ; -} -#endif - - return (XW_SUCCESS); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_mmscreen_size (void *adisplay,float *width,float *height) -#else -XW_STATUS Xw_get_mmscreen_size (adisplay,width,height) -void *adisplay; -float *width ; -float *height ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_mmscreen_size",pdisplay) ; - return (XW_ERROR) ; - } - - *width = WidthMMOfScreen(_DSCREEN) ; - *height = HeightMMOfScreen(_DSCREEN) ; - -#ifdef TRACE_GET_SCREEN_SIZE -if( Xw_get_trace() ) { - printf (" Xw_get_mmscreen_size(%lx,%f,%f)\n",(long ) pdisplay,*width,*height) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_text_size.cxx b/src/Xw/Xw_get_text_size.cxx deleted file mode 100755 index f61611be4c..0000000000 --- a/src/Xw/Xw_get_text_size.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define GG002 /*GG_020197 -Renvoyer la hauteur du texte et non de la font -*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_TEXT_SIZE -#endif - -/* - XW_STATUS Xw_get_text_size (awindow,index,string,width,height,xoffset,yoffset): - XW_EXT_WINDOW *awindow - int index Font Index - char *string String to evaluate - float *width,*height Returned String size in DWU - float *xoffset,*yoffset Returned text offsets from the text boundary box. - - Evaluate String size depending of the specified font Index. - - Returns XW_ERROR if Font Index is NOT defined - Returns XW_SUCCESS if successfull - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_text_size (void *awindow,int index,char *string,float *width,float *height,float *xoffset,float *yoffset) -#else -XW_STATUS Xw_get_text_size (awindow,index,string,width,height,xoffset,yoffset) -void *awindow; -int index ; -char *string ; -float *width,*height,*xoffset,*yoffset ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - - *width = *height = *xoffset = *yoffset = 0.; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_text_size",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_font(_FONTMAP,index) ) { - /*ERROR*Bad Font Index*/ - Xw_set_error(7,"Xw_get_text_size",&index) ; - return (XW_ERROR) ; - } - -#ifdef GG002 - { - int dir,fascent,fdescent; - XCharStruct overall; - XTextExtents(_FONTMAP->fonts[index],string,strlen(string), - &dir,&fascent,&fdescent,&overall); - *width = UVALUE(overall.width); - *height = UVALUE(overall.ascent + overall.descent); - *xoffset = UVALUE(overall.lbearing); - *yoffset = UVALUE(overall.descent); - } -#else /* Renvoyer la hauteur du texte et non de la font */ - *width = UVALUE(XTextWidth(_FONTMAP->fonts[index], - string,strlen(string))) ; - - *height = UVALUE((_FONTMAP->fonts[index])->ascent + - (_FONTMAP->fonts[index])->descent) ; - *xoffset = 0.; - *yoffset = UVALUE((_FONTMAP->fonts[index])->descent) ; -#endif - - -#ifdef TRACE_GET_TEXT_SIZE -if( Xw_get_trace() > 1 ) { - printf (" Xw_get_text_size(%lx,'%s',%f,%f,%f,%f\n", - (long ) awindow,string,*width,*height,*xoffset,*yoffset) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_tilemap_info.cxx b/src/Xw/Xw_get_tilemap_info.cxx deleted file mode 100755 index 8c2cfee16b..0000000000 --- a/src/Xw/Xw_get_tilemap_info.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_TILEMAP_INFO -#endif - -/* - XW_STATUS Xw_get_tilemap_info (atilemap,mtile,utile,dtile,ftile): - XW_EXT_TILEMAP *atilemap - int *mtile Return the maximum tile number of the tilemap - int *utile Return the User tile number used in the tilemap - int *dtile Return the User tile number defined in the tilemap - int *ftile Return the First free tile index in the tilemap - NOTE than if ftile is < 0 No more Free Tile exist in the tilemap - - Returns XW_ERROR if the Extended Tilemap is not defined - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_tilemap_info (void *atilemap,int *mtile,int *utile,int *dtile,int *ftile) -#else -XW_STATUS Xw_get_tilemap_info (atilemap,mtile,utile,dtile,ftile) -void *atilemap; -int *mtile,*utile,*dtile,*ftile ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_TILEMAP *ptilemap = (XW_EXT_TILEMAP*)atilemap; - int i ; - - if( !Xw_isdefine_tilemap(ptilemap) ) { - /*ERROR*Bad EXT_TILEMAP Address */ - Xw_set_error(49,"Xw_get_tilemap_info",ptilemap) ; - return (XW_ERROR) ; - } - - *mtile = MAXTILE ; - *utile = ptilemap->maxtile ; - *dtile = 1 ; - *ftile = -1 ; - for( i=0 ; i< *utile ; i++ ) { - if( ptilemap->tiles[i] ) (*dtile)++ ; - else if( i && *ftile < 0 ) *ftile = i ; - } - -#ifdef TRACE_GET_TILEMAP_INFO -if( Xw_get_trace() ) { - printf (" Xw_get_tilemap_info(%lx,%d,%d,%d,%d)\n", - (long ) ptilemap,*mtile,*utile,*dtile,*ftile) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_type.cxx b/src/Xw/Xw_get_type.cxx deleted file mode 100755 index b1d06c94f3..0000000000 --- a/src/Xw/Xw_get_type.cxx +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_TYPE -#endif - -/* - XW_STATUS Xw_get_type (atypemap,index,length,desc): - XW_EXT_TYPEMAP *atypemap - int index Line type index - int *length Returned Descriptor Length - float *desc Returned Type descriptor - - Get Line Type Extended typemap TYPE descriptor from index . - NOTE than length can be NULL for Solid line - - Returns XW_ERROR if BadType Index - or type is not defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_type (void *atypemap,int index,int *length,float *desc) -#else -XW_STATUS Xw_get_type (atypemap,index,length,desc) -void *atypemap; -int index ; -int *length ; -float *desc ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap; -Screen *screen ; -unsigned char *ptype ; -int i ; - - if ( !Xw_isdefine_type(ptypemap,index) ) { - /*ERROR*Bad Defined Type*/ - Xw_set_error(50,"Xw_get_type",&index) ; - return (XW_ERROR) ; - } - - screen = ScreenOfDisplay(_TDISPLAY,DefaultScreen(_TDISPLAY)) ; - *length = 0 ; - if(( ptype = ptypemap->types[index] )) { - *length = strlen((char*)ptype) ; - for( i=0 ; i<*length ; i++ ) { - desc[i] = (float)ptype[i]*WidthMMOfScreen(screen)/ - (float)WidthOfScreen(screen) ; - } - } - -#ifdef TRACE_GET_TYPE -if( Xw_get_trace() > 1 ) { - printf (" Xw_get_type(%lx,%d,%d,{",(long ) ptypemap,index,*length) ; - for ( i=0 ; i<*length-1 ; i++ ) printf("%f,",desc[i]) ; - printf("%f})\n",desc[*length-1]) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_type_index.cxx b/src/Xw/Xw_get_type_index.cxx deleted file mode 100755 index a21180a27d..0000000000 --- a/src/Xw/Xw_get_type_index.cxx +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_TYPE_INDEX -#endif - -/* - XW_STATUS Xw_get_type_index(atypemap,desc,length,index): - - XW_EXT_TYPEMAP *atypemap Typemap extension structure - float desc[] ; Style Descriptor Values - int length ; Stle Descriptor length - int *index ; Return Type index 0 >= x < MAXTYPE - - Gets the nearest type index from Style Descriptor values. - - Returns XW_ERROR if BadType Index or type is not defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_type_index(void *atypemap,float desc[],int length,int *index) -#else -XW_STATUS Xw_get_type_index(atypemap,desc,length,index) -void *atypemap ; -float desc[] ; -int length ; -int *index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap ; -XW_STATUS status = XW_ERROR ; -int i,j,ptype ; - - if( !ptypemap ) { - /*ERROR*Bad EXT_TYPEMAP Address*/ - Xw_set_error( 51,"Xw_get_type_index",ptypemap ) ; - return( XW_ERROR ) ; - } - - if( length ) { - unsigned char *pdesc = (unsigned char*) Xw_malloc(length+1) ; - Screen *screen = ScreenOfDisplay(_TDISPLAY,DefaultScreen(_TDISPLAY)) ; - - for( i=0 ; imaxtype ; i++ ) { - if( ptypemap->types[i] ) { - if( !strcmp((char*)pdesc,(char*)ptypemap->types[i]) ) break; - } else if( !j ) j = i ; - } - - if( imaxtype ) { - *index = i ; - status = XW_SUCCESS ; - } else { - *index = j ; - status = Xw_def_type (ptypemap,j,length,desc) ; - } - Xw_free(pdesc) ; - } else { - *index = 0 ; - status = XW_SUCCESS ; - } - -#ifdef TRACE_GET_TYPE_INDEX -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_get_type_index(%lx,%f,%d,%d)\n", - status,(long ) ptypemap,desc[0],length,*index) ; -} -#endif - - return( status ) ; -} diff --git a/src/Xw/Xw_get_typemap_info.cxx b/src/Xw/Xw_get_typemap_info.cxx deleted file mode 100755 index 225470d486..0000000000 --- a/src/Xw/Xw_get_typemap_info.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_TYPEMAP_INFO -#endif - -/* - XW_STATUS Xw_get_typemap_info (atypemap,mtype,utype,dtype,ftype): - XW_EXT_TYPEMAP *atypemap - int *mtype Return the maximum type number of the typemap - int *utype Return the User type number used in the typemap - int *dtype Return the User type number defined in the typemap - int *ftype Return the First Free type index in the typemap - NOTE than if ftype < 0 , No more Free type exist in the typemap - - Returns XW_ERROR if the Extended Typemap is not defined - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_typemap_info (void *atypemap,int *mtype,int *utype,int *dtype,int *ftype) -#else -XW_STATUS Xw_get_typemap_info (atypemap,mtype,utype,dtype,ftype) -void *atypemap; -int *mtype,*utype,*dtype,*ftype ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap; - int i ; - - if( !Xw_isdefine_typemap(ptypemap) ) { - /*ERROR*Bad EXT_TYPEMAP Address*/ - Xw_set_error(51,"Xw_get_typemap_info",ptypemap) ; - return (XW_ERROR) ; - } - - *mtype = MAXTYPE ; - *utype = ptypemap->maxtype ; - *dtype = 1 ; - *ftype = -1 ; - for( i=0 ; i< *utype ; i++ ) { - if( ptypemap->types[i] ) (*dtype)++ ; - else if( i && *ftype < 0 ) *ftype = i ; - } - -#ifdef TRACE_GET_TYPEMAP_INFO -if( Xw_get_trace() ) { - printf (" Xw_get_typemap_info(%lx,%d,%d,%d,%d)\n", - (long ) ptypemap,*mtype,*utype,*dtype,*ftype) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_width.cxx b/src/Xw/Xw_get_width.cxx deleted file mode 100755 index 8c24ebebd5..0000000000 --- a/src/Xw/Xw_get_width.cxx +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_WIDTH -#endif - -/* - XW_STATUS Xw_get_width (awidthmap,index,width): - XW_EXT_WIDTHMAP *awidthmap - int index Line width index - float *width width in MM - - Get Line Width Extended widthmap WIDTH value from index . - - Returns XW_ERROR if BadWidth Index or Width is not defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_width (void *awidthmap,int index,float *width) -#else -XW_STATUS Xw_get_width (awidthmap,index,width) -void *awidthmap; -int index ; -float *width ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*)awidthmap; -Screen *screen ; - - if ( !Xw_isdefine_width(pwidthmap,index) ) { - /*ERROR*Bad Defined Width*/ - Xw_set_error(52,"Xw_get_width",&index) ; - return (XW_ERROR) ; - } - - screen = ScreenOfDisplay(_WDISPLAY,DefaultScreen(_WDISPLAY)) ; - - *width = (float)pwidthmap->widths[index] * - (float)WidthMMOfScreen(screen)/(float)WidthOfScreen(screen) ; - -#ifdef TRACE_GET_WIDTH -if( Xw_get_trace() > 1 ) { - printf (" Xw_get_width(%lx,%d,%f)\n",(long ) pwidthmap,index,*width) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_width_index.cxx b/src/Xw/Xw_get_width_index.cxx deleted file mode 100755 index 64d930f5a4..0000000000 --- a/src/Xw/Xw_get_width_index.cxx +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_WIDTH_INDEX -#endif - -/* - XW_STATUS Xw_get_width_index(awidthmap,width,index): - - XW_EXT_WIDTHMAP *awidthmap Widthmap extension structure - float width ; Line Width in MM - int *index ; Return Width index 0 >= x < MAXWIDTH - - Gets the nearest width index from width. - - Returns XW_ERROR if BadWidth Index or width is not defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_width_index(void *awidthmap,float width,int *index) -#else -XW_STATUS Xw_get_width_index(awidthmap,width,index) -void *awidthmap ; -float width ; -int *index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*)awidthmap ; -XW_STATUS status = XW_ERROR ; -Screen *screen ; -int i,j,k,pwidth ; - - if( !pwidthmap ) { - /*ERROR*Bad EXT_WIDTHMAP Address*/ - Xw_set_error( 53,"Xw_get_width_index",pwidthmap ) ; - return( XW_ERROR ) ; - } - - screen = ScreenOfDisplay(_WDISPLAY,DefaultScreen(_WDISPLAY)) ; - - pwidth = (int) (0.5 + width * (float)HeightOfScreen(screen)/ - (float)HeightMMOfScreen(screen)) ; - - pwidth = (pwidth) ? pwidth : 1 ; - - for( i=j=k=0 ; imaxwidth ; i++ ) { - if( pwidthmap->widths[i] ) { - if( pwidth == pwidthmap->widths[i] ) break; - else if( abs(pwidth - pwidthmap->widths[i]) < - abs(pwidth - pwidthmap->widths[k]) ) k = i; - } else if( !j ) j = i ; - } - - if( imaxwidth ) { - *index = i ; - status = XW_SUCCESS ; - } else if( j > 0 ) { - *index = j ; - status = Xw_def_width (pwidthmap,j,width) ; - } else { - *index = k ; - status = XW_SUCCESS ; - } - -#ifdef TRACE_GET_WIDTH_INDEX -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_get_width_index(%lx,%f,%d) is %d\n", - status,(long ) pwidthmap,width,*index,pwidthmap->widths[*index]) ; -} -#endif - - return( status ) ; -} diff --git a/src/Xw/Xw_get_widthmap_info.cxx b/src/Xw/Xw_get_widthmap_info.cxx deleted file mode 100755 index 4c5517a99a..0000000000 --- a/src/Xw/Xw_get_widthmap_info.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_WIDTHMAP_INFO -#endif - -/* - XW_STATUS Xw_get_widthmap_info (awidthmap,mwidth,uwidth,dwidth,fwidth): - XW_EXT_WIDTHMAP *awidthmap - int *mwidth Return the maximum width number of the widthmap - int *uwidth Return the User width number used in the widthmap - int *dwidth Return the User width number defined in the widthmap - int *fwidth Return the First Free width index in the widthmap - NOTE than if fwidth < 0 , No more Free width exist in the widthmap - - Returns XW_ERROR if the Extended Widthmap is not defined - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_widthmap_info (void *awidthmap,int *mwidth,int *uwidth,int *dwidth,int *fwidth) -#else -XW_STATUS Xw_get_widthmap_info (awidthmap,mwidth,uwidth,dwidth,fwidth) -void *awidthmap; -int *mwidth,*uwidth,*dwidth,*fwidth ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*)awidthmap; - int i ; - - if( !Xw_isdefine_widthmap(pwidthmap) ) { - /*ERROR*Bad EXT_WIDTHMAP Address*/ - Xw_set_error(53,"Xw_get_widthmap_info",pwidthmap) ; - return (XW_ERROR) ; - } - - *mwidth = MAXWIDTH ; - *uwidth = pwidthmap->maxwidth ; - *dwidth = 1 ; - *fwidth = -1 ; - for( i=0 ; i< *uwidth ; i++ ) { - if( pwidthmap->widths[i] ) (*dwidth)++ ; - else if( i && *fwidth < 0 ) *fwidth = i ; - } - -#ifdef TRACE_GET_WIDTHMAP_INFO -if( Xw_get_trace() ) { - printf (" Xw_get_widthmap_info(%lx,%d,%d,%d,%d)\n", - (long ) pwidthmap,*mwidth,*uwidth,*dwidth,*fwidth) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_window_info.cxx b/src/Xw/Xw_get_window_info.cxx deleted file mode 100755 index 7def249345..0000000000 --- a/src/Xw/Xw_get_window_info.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_WINDOW_INFO -#endif - -/* - XW_STATUS Xw_get_window_info (awindow,window,pixmap,root,colormap, - vclass,depth,visualid): - XW_EXT_WINDOW *awindow Extended Window structure - Aspect_Handle *window Window XID - Aspect_Handle *pixmap Pixmap XID or 0 if DoubleBuffering is DISABLE - Aspect_Handle *root Root XID - Aspect_Handle *colormap Colormap XID - Xw_TypeOfVisual *vclass Visual Class - int *depth Planes depth - int *visualid visualid - - Returns the X window attributes of an existing window - - returns XW_ERROR if something is wrong - returns XW_SUCCESS else - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_window_info (void *awindow,Aspect_Handle *window,Aspect_Handle *pixmap, - Aspect_Handle *root,Aspect_Handle *colormap,Xw_TypeOfVisual *vclass,int *depth,int *visualid) -#else -XW_STATUS Xw_get_window_info (awindow,window,pixmap,root,colormap,vclass,depth,visualid) -void *awindow; -Aspect_Handle *window; -Aspect_Handle *pixmap; -Aspect_Handle *root; -Aspect_Handle *colormap; -Xw_TypeOfVisual *vclass; -int *depth; -int *visualid; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XWindowAttributes attributes ; - - if ( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_window_info",pwindow) ; - return (XW_ERROR) ; - } - - if( !XGetWindowAttributes(_DISPLAY,_WINDOW,&attributes) ) { - /*ERROR*Bad Window Attributes*/ - Xw_set_error(54,"Xw_get_window_info",&_WINDOW) ; - return (XW_ERROR) ; - } - - *window = _WINDOW ; - *pixmap = _PIXMAP ; - *root = attributes.root ; -#if defined(__cplusplus) || defined(c_plusplus) - *vclass = (Xw_TypeOfVisual) attributes.visual->c_class ; -#else - *vclass = (Xw_TypeOfVisual) attributes.visual->class ; -#endif - *depth = attributes.depth ; - *colormap = attributes.colormap ; - *visualid = attributes.visual->visualid ; - -#ifdef TRACE_GET_WINDOW_INFO -if( Xw_get_trace() > 1 ) { - printf (" Xw_get_window_info(%lx,%lx,%lx,%lx,%lx,%d,%d,%d)\n", - (long ) awindow,(long ) *window,(long ) *pixmap,(long ) *root,(long ) *colormap,*vclass,*depth,*visualid) ; -} -#endif - - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_get_window_pixelcoord.cxx b/src/Xw/Xw_get_window_pixelcoord.cxx deleted file mode 100755 index 2e10dcc0f8..0000000000 --- a/src/Xw/Xw_get_window_pixelcoord.cxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_WINDOW_PIXELCOORD -#endif - -/* - XW_STATUS Xw_get_window_pixelcoord (awindow,px,py,ux,uy): - XW_EXT_WINDOW *awindow - int px,py Window Coordinates defined in Pixels - float *ux,*uy Returns Window Coordinates defined in User Space - - Get transformed coordinate from Pixel Space to DWU space - - returns XW_ERROR if Pixel Coordinate is outside the window - returns SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_window_pixelcoord(void *awindow,int px,int py,float *ux,float *uy) -#else -XW_STATUS Xw_get_window_pixelcoord(awindow,px,py,ux,uy) -void *awindow; -int px,py ; -float *ux,*uy ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -//XW_EXT_DISPLAY *pdisplay = pwindow->connexion ; -float size ; - - size = ( _WIDTH >= _HEIGHT) ? _WIDTH : _HEIGHT ; - *ux = UXPOINT(px) ; - *uy = UYPOINT(py) ; - -#ifdef TRACE_GET_WINDOW_PIXELCOORD -if ( Xw_get_trace() > 1 ) { - printf (" Xw_get_window_pixelcoord(%lx,%d,%d,%f,%f)\n",(long ) pwindow,px,py,*ux,*uy) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_get_window_pixelvalue.cxx b/src/Xw/Xw_get_window_pixelvalue.cxx deleted file mode 100755 index 7de2d5fd51..0000000000 --- a/src/Xw/Xw_get_window_pixelvalue.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_WINDOW_PIXELVALUE -#endif - -/* - float Xw_get_window_pixelvalue (awindow,pv): - XW_EXT_WINDOW *awindow - int pv Pixel Values - - Returns DWU value from Pixel value - -*/ - -#ifdef XW_PROTOTYPE -float Xw_get_window_pixelvalue(void *awindow,int pv) -#else -float Xw_get_window_pixelvalue(awindow,pv) -void *awindow; -int pv ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -float uv ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_window_pixelvalue",pwindow) ; - return (XW_ERROR) ; - } - - uv = UVALUE(pv) ; - -#ifdef TRACE_GET_WINDOW_PIXELVALUE -if( Xw_get_trace() > 1 ) { - printf (" %f = Xw_get_window_pixelvalue(%lx,%d)\n",uv,(long ) pwindow,pv) ; -} -#endif - - return (uv); -} diff --git a/src/Xw/Xw_get_window_position.cxx b/src/Xw/Xw_get_window_position.cxx deleted file mode 100755 index 7be214b54e..0000000000 --- a/src/Xw/Xw_get_window_position.cxx +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_WINDOW_POSITION -#define TRACE_SET_WINDOW_POSITION -#define TRACE_GET_WINDOW_SIZE -#define TRACE_GET_WINDOW_STATE -#endif - -/* - WINDOWSTATE Xw_get_window_position (awindow,xc,yc,width,height): - XW_EXT_WINDOW *awindow - int *xc,*yc,*width,*height - - Returns the window Center position & Size in Pixel space - of the X window - - returns Window status,must be : - - POP The window is at the top of the screen - PUSH The window is at the bottom of the screen - ICONIFY The window is not mapped at the screen - UNKNOWN The window state is Unknown - - - STATUS Xw_set_window_position (awindow,xc,yc,width,height): - XW_EXT_WINDOW *awindow - int xc,yc,width,height - - Sets the window Center position & Size in Pixel space - of the X window - - returns ERROR if ExtendedWindowAddress is missing - returns SUCCESS if Successfull - - STATUS Xw_get_window_size (awindow,width,height): - XW_EXT_WINDOW *awindow - int *width,*height - - Returns the window Size in Pixel space - of the X window - - WINDOWSTATE Xw_get_window_state (awindow): - XW_EXT_WINDOW *awindow - - Returns the Window status,must be : - - POP The window is at the top of the screen - PUSH The window is at the bottom of the screen - ICONIFY The window is not mapped at the screen - UNKNOWN The window state is Unknown -*/ - -#ifdef XW_PROTOTYPE -XW_WINDOWSTATE Xw_get_window_position (void *awindow,int *xc,int *yc,int *width,int *height) -#else -XW_WINDOWSTATE Xw_get_window_position (awindow,xc,yc,width,height) -void *awindow; -int *xc,*yc,*width,*height ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - XW_WINDOWSTATE state ; - Window child ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_window_position",pwindow) ; - return (XW_WS_UNKNOWN) ; - } - - XFlush(_DISPLAY) ; - - if( !XGetWindowAttributes(_DISPLAY,_WINDOW,&_ATTRIBUTES) ) { - /*ERROR*Bad Window Attributes*/ - Xw_set_error(54,"Xw_get_window_position",&_WINDOW) ; - return (XW_WS_UNKNOWN) ; - } - XTranslateCoordinates(_DISPLAY,_ROOT,_WINDOW,0,0,&_X,&_Y,&child) ; - _X = -_X ; _Y = -_Y ; - *xc = _X + _WIDTH/2 ; - *yc = _Y + _HEIGHT/2 ; - *width = _WIDTH ; - *height = _HEIGHT ; - switch (_STATE) { - case IsUnmapped : - state = XW_ICONIFY ; - break ; - case IsUnviewable : - state = XW_PUSH ; - break ; - case IsViewable : - state = XW_MAP ; - break ; - - default : - state = XW_WS_UNKNOWN ; - } - -#ifdef TRACE_GET_WINDOW_POSITION -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_window_position(%lx,%d,%d,%d,%d)\n", - state,(long ) pwindow,*xc,*yc,*width,*height) ; -} -#endif - - return (state) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_window_position (void *awindow,int xc,int yc,int width,int height) -#else -XW_STATUS Xw_set_window_position (awindow,xc,yc,width,height) -void *awindow ; -int xc,yc,width,height ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - int awidth,aheight,xleft,ytop,mask = 0 ; - XWindowChanges values ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_window_position",pwindow) ; - return (XW_ERROR) ; - } - - xleft = xc - width/2 ; - if( abs(xleft - pwindow->axleft) > 2 ) { - values.x = xleft ; mask |= CWX ; - } - - ytop = yc - height/2 ; - if( abs(ytop - pwindow->aytop) > 2 ) { - values.y = ytop ; mask |= CWY ; - } - - awidth = pwindow->axright - pwindow->axleft + 1 ; - if( abs(width - awidth) > 2 ) { - values.width = width ; mask |= CWWidth ; - } - - aheight = pwindow->aybottom - pwindow->aytop + 1 ; - if( abs(height - aheight) > 2 ) { - values.height = height ; mask |= CWHeight ; - } - - if( mask ) { - XConfigureWindow(_DISPLAY,_WINDOW,mask,&values) ; - XSync(_DISPLAY,True) ; - } - -#ifdef TRACE_SET_WINDOW_POSITION -if( Xw_get_trace() > 1 ) { - printf (" Xw_set_window_position(%lx,%d,%d,%d,%d)\n", - (long ) pwindow,xc,yc,width,height) ; -} -#endif - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_window_size (void *awindow,int *width,int *height) -#else -XW_STATUS Xw_get_window_size (awindow,width,height) -void *awindow; -int *width,*height ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_window_size",pwindow) ; - return (XW_ERROR) ; - } - - if( (_WIDTH > 0) && (_HEIGHT > 0) ) { - *width = _WIDTH ; - *height = _HEIGHT ; - } else { - int xc,yc; - Xw_get_window_position (pwindow,&xc,&yc,width,height); - } - -#ifdef TRACE_GET_WINDOW_SIZE -if( Xw_get_trace() > 1 ) { - printf (" Xw_get_window_size(%lx,%d,%d)\n",(long ) pwindow,*width,*height) ; -} -#endif - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -XW_WINDOWSTATE Xw_get_window_state (void *awindow) -#else -XW_WINDOWSTATE Xw_get_window_state (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - XW_WINDOWSTATE state ; - - if( (_WIDTH > 0) && (_HEIGHT > 0) ) { - switch (_STATE) { - case IsUnmapped : - state = XW_ICONIFY ; - break ; - case IsUnviewable : - state = XW_PUSH ; - break ; - case IsViewable : - state = XW_MAP ; - break ; - - default : - state = XW_WS_UNKNOWN ; - } - } else { - int xc,yc,w,h; - state = Xw_get_window_position (pwindow,&xc,&yc,&w,&h); - } - -#ifdef TRACE_GET_WINDOW_STATE -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_window_state(%lx)\n",state,(long ) pwindow) ; -} -#endif - - return state; -} diff --git a/src/Xw/Xw_get_window_visual.cxx b/src/Xw/Xw_get_window_visual.cxx deleted file mode 100755 index 94fa9094a3..0000000000 --- a/src/Xw/Xw_get_window_visual.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_GET_WINDOW_VISUAL -#endif - -/* - Xw_TypeOfVisual Xw_get_window_visual (awindow): - XW_EXT_WINDOW *awindow - - Returns the window Visual class ,must be one of : - - Xw_TOV_STATICGRAY, - Xw_TOV_GRAYSCALE, - Xw_TOV_STATICCOLOR, - Xw_TOV_PSEUDOCOLOR, - Xw_TOV_TRUECOLOR, - Xw_TOV_DIRECTCOLOR -*/ - -#ifdef XW_PROTOTYPE -Xw_TypeOfVisual Xw_get_window_visual (void *awindow) -#else -Xw_TypeOfVisual Xw_get_window_visual (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_window_visual",pwindow) ; - return (Xw_TOV_DEFAULT) ; - } - -#ifdef TRACE_GET_WINDOW_VISUAL -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_window_visual(%lx)\n",_CLASS,(long ) pwindow) ; -} -#endif - - return (Xw_TypeOfVisual) _CLASS; -} diff --git a/src/Xw/Xw_isdefine_color.cxx b/src/Xw/Xw_isdefine_color.cxx deleted file mode 100755 index d9bf6f1425..0000000000 --- a/src/Xw/Xw_isdefine_color.cxx +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_COLOR -#endif - -/* - XW_STATUS Xw_isdefine_color(acolormap,index): - XW_EXT_COLORMAP *acolormap Colormap extension structure - int index ; Color index 0 >= x < MAXCOLOR - - Returns XW_ERROR if BadColor index or Color is not define - Returns XW_SUCCESS if Color is defined - -*/ -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_color (void* acolormap, int index) -#else -XW_STATUS Xw_isdefine_color (acolormap,index) -void *acolormap; -int index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XW_STATUS status = XW_ERROR ; -//int i ; - - if( pcolormap && ((index < 0) || - ((index >= 0) && (index < pcolormap->maxcolor) && - (pcolormap->define[index]))) ) { - status = XW_SUCCESS ; - } - -#ifdef TRACE_ISDEFINE_COLOR -if( Xw_get_trace() > 2 ) { - printf(" %d = Xw_isdefine_color(%lx,%d)\n",status,(long ) pcolormap,index) ; -} -#endif - - return (status); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_colorindex (XW_EXT_COLORMAP* acolormap, int index) -#else -XW_STATUS Xw_isdefine_colorindex (acolormap,index) -XW_EXT_COLORMAP *acolormap; -int index ; -#endif /*XW_PROTOTYPE*/ -/* - Verify Index range Only -*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XW_STATUS status = XW_ERROR ; - - if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) ) { - status = XW_SUCCESS ; - } - -#ifdef TRACE_ISDEFINE_COLOR -if( Xw_get_trace() > 2 ) { - printf(" %d = Xw_isdefine_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ; -} -#endif - - return (status) ; -} -#ifdef XW_PROTOTYPE -XW_STATUS Xw_ifsystem_colorindex (XW_EXT_COLORMAP* acolormap, int index) -#else -XW_STATUS Xw_ifsystem_colorindex (acolormap,index) -XW_EXT_COLORMAP *acolormap; -int index ; -#endif /*XW_PROTOTYPE*/ -/* - Check if System color index -*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XW_STATUS status = XW_ERROR ; - - if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) && - (pcolormap->define[index] == SYSTEMCOLOR) ) { - status = XW_SUCCESS ; - } - -#ifdef TRACE_ISDEFINE_COLOR -if( Xw_get_trace() > 2 ) { - printf(" %d = Xw_ifsystem_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ; -} -#endif - - return (status) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_ifimage_colorindex (XW_EXT_COLORMAP* acolormap, int index) -#else -XW_STATUS Xw_ifimage_colorindex (acolormap,index) -XW_EXT_COLORMAP *acolormap; -int index ; -#endif /*XW_PROTOTYPE*/ -/* - Check if image color index -*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XW_STATUS status = XW_ERROR ; - - if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) && - (pcolormap->define[index] == IMAGECOLOR) ) { - status = XW_SUCCESS ; - } - -#ifdef TRACE_ISDEFINE_COLOR -if( Xw_get_trace() > 2 ) { - printf(" %d = Xw_ifimage_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ; -} -#endif - - return (status) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_ifbackground_colorindex (XW_EXT_COLORMAP* acolormap, int index) -#else -XW_STATUS Xw_ifbackground_colorindex (acolormap,index) -XW_EXT_COLORMAP *acolormap; -int index ; -#endif /*XW_PROTOTYPE*/ -/* - Check if background color index -*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XW_STATUS status = XW_ERROR ; - - if( pcolormap && ((index < 0) || - ((index >= 0) && (index < pcolormap->maxcolor) && - (pcolormap->define[index] == BACKCOLOR))) ) { - status = XW_SUCCESS ; - } - -#ifdef TRACE_ISDEFINE_COLOR -if( Xw_get_trace() > 2 ) { - printf(" %d = Xw_ifbackground_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ; -} -#endif - - return (status) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_ifhighlight_colorindex (XW_EXT_COLORMAP* acolormap, int index) -#else -XW_STATUS Xw_ifhighlight_colorindex (acolormap,index) -XW_EXT_COLORMAP *acolormap; -int index ; -#endif /*XW_PROTOTYPE*/ -/* - Check if highlight color index -*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XW_STATUS status = XW_ERROR ; - - if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) && - (pcolormap->define[index] == HIGHCOLOR) ) { - status = XW_SUCCESS ; - } - -#ifdef TRACE_ISDEFINE_COLOR -if( Xw_get_trace() > 2 ) { - printf(" %d = Xw_ifhighlight_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ; -} -#endif - - return (status) ; -} diff --git a/src/Xw/Xw_isdefine_colormap.cxx b/src/Xw/Xw_isdefine_colormap.cxx deleted file mode 100755 index 37e22fc626..0000000000 --- a/src/Xw/Xw_isdefine_colormap.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_COLORMAP -#endif - -/* - XW_STATUS Xw_isdefine_colormap (acolormap): - XW_EXT_COLORMAP *acolormap - - - Returns XW_ERROR if Extended Colormap address is not properly defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_colormap (void* acolormap) -#else -XW_STATUS Xw_isdefine_colormap (acolormap) -void* acolormap; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; -XW_STATUS status = XW_ERROR ; - - if( pcolormap && (pcolormap->type == COLORMAP_TYPE) ) { - status = XW_SUCCESS ; - } - - -#ifdef TRACE_ISDEFINE_COLORMAP -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_isdefine_colormap(%lx)\n",status,(long ) pcolormap) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_isdefine_display.cxx b/src/Xw/Xw_isdefine_display.cxx deleted file mode 100755 index 018c9342ea..0000000000 --- a/src/Xw/Xw_isdefine_display.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_DISPLAY -#endif - -/* - XW_STATUS Xw_isdefine_display (adisplay): - XW_EXT_DISPLAY *adisplay - - - Returns XW_ERROR if Extended Window address is not properly defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_display (void *adisplay) -#else -XW_STATUS Xw_isdefine_display (adisplay) -void *adisplay; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay; -XW_STATUS status = XW_ERROR ; - - if( pdisplay && (pdisplay->type == DISPLAY_TYPE) ) { - status = XW_SUCCESS ; - } - - -#ifdef TRACE_ISDEFINE_DISPLAY -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_isdefine_display(%lx)\n",status,(long ) pdisplay) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_isdefine_font.cxx b/src/Xw/Xw_isdefine_font.cxx deleted file mode 100755 index 5ef5d1791c..0000000000 --- a/src/Xw/Xw_isdefine_font.cxx +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_FONT -#endif - -/* - XW_STATUS Xw_isdefine_font (afontmap,index): - XW_EXT_FONTMAP *afontmap - int index font index - - Returns XW_ERROR if BadFont Index or font is not defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_font (void* afontmap,int index) -#else -XW_STATUS Xw_isdefine_font (afontmap,index) -void* afontmap; -int index; -#endif /*XW_PROTOTYPE*/ - -{ -XW_EXT_FONTMAP *pfontmap = (XW_EXT_FONTMAP*)afontmap; -XW_STATUS status = XW_ERROR ; - - if ( index ) { - if ( pfontmap && (index < pfontmap->maxfont) && - pfontmap->fonts[index] ) { - status = XW_SUCCESS ; - } - } else status = XW_SUCCESS ; - -#ifdef TRACE_ISDEFINE_FONT -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_font(%lx,%d)\n",status,(long ) pfontmap,index) ; -} -#endif - - return (status); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_fontindex (XW_EXT_FONTMAP* afontmap,int index) -#else -XW_STATUS Xw_isdefine_fontindex (afontmap,index) -XW_EXT_FONTMAP* afontmap; -int index; -#endif /*XW_PROTOTYPE*/ -/* - Verify Range index only -*/ -{ -XW_EXT_FONTMAP *pfontmap = (XW_EXT_FONTMAP*)afontmap; -XW_STATUS status = XW_ERROR ; - - if ( pfontmap && (index > 0) && (index < pfontmap->maxfont) ) { - status = XW_SUCCESS ; - } - -#ifdef TRACE_ISDEFINE_FONT -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_fontindex(%lx,%d)\n",status,(long ) pfontmap,index) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_isdefine_fontmap.cxx b/src/Xw/Xw_isdefine_fontmap.cxx deleted file mode 100755 index ef095bedfd..0000000000 --- a/src/Xw/Xw_isdefine_fontmap.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_FONTMAP -#endif - -/* - XW_STATUS Xw_isdefine_fontmap (afontmap): - XW_EXT_FONTMAP *afontmap - - - Returns XW_ERROR if Extended Fontmap address is not properly defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_fontmap (void* afontmap) -#else -XW_STATUS Xw_isdefine_fontmap (afontmap) -void* afontmap; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_FONTMAP *pfontmap = (XW_EXT_FONTMAP*)afontmap; -XW_STATUS status = XW_ERROR ; - - if( pfontmap && (pfontmap->type == FONTMAP_TYPE) ) { - status = XW_SUCCESS ; - } - - -#ifdef TRACE_ISDEFINE_FONTMAP -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_isdefine_fontmap(%lx)\n",status,(long ) pfontmap) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_isdefine_image.cxx b/src/Xw/Xw_isdefine_image.cxx deleted file mode 100755 index 9534eddf8a..0000000000 --- a/src/Xw/Xw_isdefine_image.cxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_IMAGE -#endif - -/* - XW_STATUS Xw_isdefine_image (aimage): - XW_EXT_IMAGEDATA *aimage - - - Returns XW_ERROR if Extended Image address is not properly defined - Returns XW_SUCCESS if Successful - -*/ -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_image (void* aimage) -#else -XW_STATUS Xw_isdefine_image (aimage) -void* aimage; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*) aimage; -XW_STATUS status = XW_ERROR ; - - if( pimage && (pimage->type == IMAGE_TYPE) && _IIMAGE ) { - status = XW_SUCCESS ; - } - - -#ifdef TRACE_ISDEFINE_IMAGE -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_isdefine_image(%lx)\n",status,(long ) pimage) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_isdefine_marker.cxx b/src/Xw/Xw_isdefine_marker.cxx deleted file mode 100755 index e5db82d931..0000000000 --- a/src/Xw/Xw_isdefine_marker.cxx +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_MARKER -#endif - -/* - XW_STATUS Xw_isdefine_marker (amarkmap,index): - XW_EXT_MARKMAP *amarkmap - int index marker index - - Returns XW_ERROR if BadMarker Index or marker is not defined - Returns XW_SUCCESS if Successful - -*/ -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_marker (void *amarkmap,int index) -#else -XW_STATUS Xw_isdefine_marker (amarkmap,index) -void *amarkmap; -int index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_MARKMAP *pmarkmap = (XW_EXT_MARKMAP*) amarkmap; -XW_STATUS status = XW_ERROR ; - - if( index > 0 ) { - if ( pmarkmap && (index < pmarkmap->maxmarker) && - (pmarkmap->npoint[index] > 0) ) { - return (XW_SUCCESS) ; - } - } else status = XW_SUCCESS ; - - -#ifdef TRACE_ISDEFINE_MARKER -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_marker(%lx,%d)\n",status,(long ) pmarkmap,index) ; -} -#endif - - return (status); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_markerindex (XW_EXT_MARKMAP *amarkmap,int index) -#else -XW_STATUS Xw_isdefine_markerindex (amarkmap,index) -XW_EXT_MARKMAP *amarkmap; -int index ; -#endif /*XW_PROTOTYPE*/ -/* - Verify Marker range index Only -*/ -{ -XW_EXT_MARKMAP *pmarkmap = amarkmap; -XW_STATUS status = XW_ERROR ; - - if( pmarkmap && (index > 0) && (index < pmarkmap->maxmarker) ) { - return (XW_SUCCESS) ; - } - -#ifdef TRACE_ISDEFINE_MARKER -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_markerindex(%lx,%d)\n",status,(long ) pmarkmap,index) ; -} -#endif - return (status) ; -} diff --git a/src/Xw/Xw_isdefine_markmap.cxx b/src/Xw/Xw_isdefine_markmap.cxx deleted file mode 100755 index ca9f150999..0000000000 --- a/src/Xw/Xw_isdefine_markmap.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_MARKMAP -#endif - -/* - XW_STATUS Xw_isdefine_markmap (amarkmap): - XW_EXT_MARKMAP *amarkmap - - - Returns XW_ERROR if Extended Markmap address is not properly defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_markmap (void *amarkmap) -#else -XW_STATUS Xw_isdefine_markmap (amarkmap) -void *amarkmap; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_MARKMAP *pmarkmap = (XW_EXT_MARKMAP*) amarkmap; -XW_STATUS status = XW_ERROR ; - - if( pmarkmap && (pmarkmap->type == MARKMAP_TYPE) ) { - status = XW_SUCCESS ; - } - - -#ifdef TRACE_ISDEFINE_MARKMAP -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_isdefine_markmap(%lx)\n",status,(long ) pmarkmap) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_isdefine_tile.cxx b/src/Xw/Xw_isdefine_tile.cxx deleted file mode 100755 index 782451de3f..0000000000 --- a/src/Xw/Xw_isdefine_tile.cxx +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_TILE -#endif - -/* - XW_STATUS Xw_isdefine_tile (atilemap,index): - XW_EXT_TILEMAP *atilemap - int index tile index - - Returns XW_ERROR if BadTile Index or tile is not defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_tile (void *atilemap,int index) -#else -XW_STATUS Xw_isdefine_tile (atilemap,index) -void *atilemap; -int index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_TILEMAP *ptilemap = (XW_EXT_TILEMAP*)atilemap; -XW_STATUS status = XW_ERROR ; - - if( index ) { - if ( ptilemap && (index < ptilemap->maxtile) - && ptilemap->tiles[index] ) { - status = XW_SUCCESS ; - } - } else status = XW_SUCCESS ; - - -#ifdef TRACE_ISDEFINE_TILE -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_tile(%lx,%d)\n",status,(long ) ptilemap,index) ; -} -#endif - - return (status); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_tileindex (XW_EXT_TILEMAP *atilemap,int index) -#else -XW_STATUS Xw_isdefine_tileindex (atilemap,index) -XW_EXT_TILEMAP *atilemap; -int index ; -#endif /*XW_PROTOTYPE*/ -/* - Verify Tile index Range Only -*/ -{ -XW_EXT_TILEMAP *ptilemap = (XW_EXT_TILEMAP*)atilemap; -XW_STATUS status = XW_ERROR ; - - if( ptilemap && (index > 0 ) && (index < ptilemap->maxtile) ) { - status = XW_SUCCESS ; - } - -#ifdef TRACE_ISDEFINE_TILE -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_tileindex(%lx,%d)\n",status,(long ) ptilemap,index) ; -} -#endif - - return (status) ; -} diff --git a/src/Xw/Xw_isdefine_tilemap.cxx b/src/Xw/Xw_isdefine_tilemap.cxx deleted file mode 100755 index c83608eb35..0000000000 --- a/src/Xw/Xw_isdefine_tilemap.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_TILEMAP -#endif - -/* - XW_STATUS Xw_isdefine_tilemap (atilemap): - XW_EXT_TILEMAP *atilemap - - - Returns XW_ERROR if Extended Tilemap address is not properly defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_tilemap (void *atilemap) -#else -XW_STATUS Xw_isdefine_tilemap (atilemap) -void *atilemap; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_TILEMAP *ptilemap = (XW_EXT_TILEMAP*)atilemap; -XW_STATUS status = XW_ERROR ; - - if( ptilemap && (ptilemap->type == TILEMAP_TYPE) ) { - status = XW_SUCCESS ; - } - - -#ifdef TRACE_ISDEFINE_TILEMAP -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_isdefine_tilemap(%lx)\n",status,(long ) ptilemap) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_isdefine_type.cxx b/src/Xw/Xw_isdefine_type.cxx deleted file mode 100755 index dafbb2ca9f..0000000000 --- a/src/Xw/Xw_isdefine_type.cxx +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_TYPE -#endif - -/* - XW_STATUS Xw_isdefine_type (atypemap,index): - XW_EXT_TYPEMAP *atypemap - int index Line type index - - - Returns XW_ERROR if BadType Index or type is not defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_type (void *atypemap,int index) -#else -XW_STATUS Xw_isdefine_type (atypemap,index) -void *atypemap; -int index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap; -XW_STATUS status = XW_ERROR ; - - if ( index ) { - if ( ptypemap && (index < ptypemap->maxtype) && - ptypemap->types[index] ) { - status = XW_SUCCESS ; - } - } else status = XW_SUCCESS ; - - -#ifdef TRACE_ISDEFINE_TYPE -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_type(%lx,%d)\n",status,(long ) ptypemap,index) ; -} -#endif - - return (status); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_typeindex (XW_EXT_TYPEMAP *atypemap,int index) -#else -XW_STATUS Xw_isdefine_typeindex (atypemap,index) -XW_EXT_TYPEMAP *atypemap; -int index ; -#endif /*XW_PROTOTYPE*/ -/* - Verify type index range Only -*/ -{ -XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap; -XW_STATUS status = XW_ERROR ; - - if( ptypemap && (index > 0) && (index < ptypemap->maxtype) ) { - status = XW_SUCCESS ; - } - -#ifdef TRACE_ISDEFINE_TYPE -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_typeindex(%lx,%d)\n",status,(long ) ptypemap,index) ; -} -#endif - - return (status) ; -} diff --git a/src/Xw/Xw_isdefine_typemap.cxx b/src/Xw/Xw_isdefine_typemap.cxx deleted file mode 100755 index 83a7c24059..0000000000 --- a/src/Xw/Xw_isdefine_typemap.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_TYPEMAP -#endif - -/* - XW_STATUS Xw_isdefine_typemap (atypemap): - XW_EXT_TYPEMAP *atypemap - - - Returns XW_ERROR if Extended Typemap address is not properly defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_typemap (void *atypemap) -#else -XW_STATUS Xw_isdefine_typemap (atypemap) -void *atypemap; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap; -XW_STATUS status = XW_ERROR ; - - if( ptypemap && (ptypemap->type == TYPEMAP_TYPE) ) { - status = XW_SUCCESS ; - } - - -#ifdef TRACE_ISDEFINE_TYPEMAP -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_isdefine_typemap(%lx)\n",status,(long ) ptypemap) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_isdefine_width.cxx b/src/Xw/Xw_isdefine_width.cxx deleted file mode 100755 index daa48f86f6..0000000000 --- a/src/Xw/Xw_isdefine_width.cxx +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_DEFINE_WIDTH -#endif - -/* - XW_STATUS Xw_isdefine_width (awidthmap,index): - XW_EXT_WIDTHMAP *awidthmap - int index Line width index - - Returns XW_ERROR if BadWidth Index or Width is not defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_width (void *awidthmap,int index) -#else -XW_STATUS Xw_isdefine_width (awidthmap,index) -void *awidthmap; -int index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*)awidthmap; -XW_STATUS status = XW_ERROR ; - - if( index ) { - if ( pwidthmap && (index < pwidthmap->maxwidth) && - (pwidthmap->widths[index] > 0) ) { - status = XW_SUCCESS ; - } - } else status = XW_SUCCESS ; - -#ifdef TRACE_DEFINE_WIDTH -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_width(%lx,%d)\n",status,(long ) pwidthmap,index) ; -} -#endif - - return (status); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_widthindex (XW_EXT_WIDTHMAP *awidthmap,int index) -#else -XW_STATUS Xw_isdefine_widthindex (awidthmap,index) -XW_EXT_WIDTHMAP *awidthmap; -int index ; -#endif /*XW_PROTOTYPE*/ -/* - Verify Width index range Only -*/ -{ -XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*)awidthmap; -XW_STATUS status = XW_ERROR ; - - if ( pwidthmap && (index > 0) && (index < pwidthmap->maxwidth) ) { - status = XW_SUCCESS ; - } - -#ifdef TRACE_DEFINE_WIDTH -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_widthindex(%lx,%d)\n",status,(long ) pwidthmap,index) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_isdefine_widthmap.cxx b/src/Xw/Xw_isdefine_widthmap.cxx deleted file mode 100755 index 9bc290e78b..0000000000 --- a/src/Xw/Xw_isdefine_widthmap.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_WIDTHMAP -#endif - -/* - XW_STATUS Xw_isdefine_widthmap (awidthmap): - XW_EXT_WIDTHMAP *awidthmap - - - Returns XW_ERROR if Extended Widthmap address is not properly defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_widthmap (void *awidthmap) -#else -XW_STATUS Xw_isdefine_widthmap (awidthmap) -void *awidthmap; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*)awidthmap; -XW_STATUS status = XW_ERROR ; - - if( pwidthmap && (pwidthmap->type == WIDTHMAP_TYPE) ) { - status = XW_SUCCESS ; - } - - -#ifdef TRACE_ISDEFINE_WIDTHMAP -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_isdefine_widthmap(%lx)\n",status,(long ) pwidthmap) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_isdefine_window.cxx b/src/Xw/Xw_isdefine_window.cxx deleted file mode 100755 index a6e66f99ab..0000000000 --- a/src/Xw/Xw_isdefine_window.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_ISDEFINE_WINDOW -#endif - -/* - XW_STATUS Xw_isdefine_window (awindow): - XW_EXT_WINDOW *awindow - - - Returns XW_ERROR if Extended Window address is not properly defined - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_isdefine_window (void *awindow) -#else -XW_STATUS Xw_isdefine_window (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_STATUS status = XW_ERROR ; - - if( pwindow && (pwindow->type == WINDOW_TYPE) ) { - status = XW_SUCCESS ; - } - - -#ifdef TRACE_ISDEFINE_WINDOW -if( Xw_get_trace() > 2 ) { - printf (" %d = Xw_isdefine_window(%lx)\n",status,(long ) pwindow) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_load_bmp_image.cxx b/src/Xw/Xw_load_bmp_image.cxx deleted file mode 100755 index 57f3f71eee..0000000000 --- a/src/Xw/Xw_load_bmp_image.cxx +++ /dev/null @@ -1,464 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -/* - * Created: zov : 23-Apr-1998 : Loads BMP image from file - * - - XW_EXT_IMAGEDATA* Xw_load_bmp_image (awindow,aimageinfo,fimage,ppcolors,pncolors) - XW_EXT_WINDOW *awindow - XW_USERDATA *aimageinfo - XColor **ppcolors - address of pointer to array of used colors to return - int *pncolors - address of a variable to return length of the array in - - Gets an image from a file. - Note, that the file must be BMP formatted. - - Returns the image descriptor address if successful; or NULL if failed. -*/ - -#include -#include - - -typedef unsigned int DWORD; /* 32-bit signed */ -typedef int LONG; /* 32-bit unsigned */ -typedef unsigned short WORD; /* 16-bit unsigned */ - -typedef struct tagBITMAPFILEHEADER { -/* WORD bfType;*/ - DWORD bfSize; - DWORD bfReserved; - DWORD bfOffBits; - DWORD dwHeaderSize; -} BITMAPFILEHEADER; - -typedef struct tagBITMAPINFOHEADER { -/* DWORD biSize; */ - LONG biWidth; - LONG biHeight; - WORD biPlanes; - WORD biBitCount; - DWORD biCompression; - DWORD biSizeImage; - LONG biXPelsPerMeter; - LONG biYPelsPerMeter; - DWORD biClrUsed; - DWORD biClrImportant; -} BITMAPINFOHEADER; - -/* constants for the biCompression field */ -#define BI_RGB 0 -#define BI_RLE8 1 -#define BI_RLE4 2 -#define BI_BITFIELDS 3 - - -typedef struct tagBITMAPCOREHEADER { -/* DWORD bcSize; */ - WORD bcWidth; - WORD bcHeight; - WORD bcPlanes; /* 1 */ - WORD bcBitCount; /* 1,4,8 or 24 */ -} BITMAPCOREHEADER; - - -typedef struct tagRGBQUAD { - BYTE rgbBlue; - BYTE rgbGreen; - BYTE rgbRed; - BYTE rgbReserved; -} RGBQUAD; - - -#define LOW_VAL_AT_LOW_ADDR (*(char*)&__swaptest) -static unsigned long __swaptest = 1; - -static WORD _TestSwapWORD (WORD __w) -{ - return LOW_VAL_AT_LOW_ADDR ? __w: - ((__w&0xFF) << 8) | ((__w&0xFF00) >> 8); -} - -static DWORD _TestSwapDWORD (DWORD __dw) -{ - return LOW_VAL_AT_LOW_ADDR ? __dw: - ((__dw&0x000000FF) << 24) | ((__dw&0x0000FF00) << 8) - | ((__dw&0xFF0000) >> 8) | ((__dw&0xFF000000) >> 24); -} - - -XW_EXT_IMAGEDATA* Xw_load_bmp_image(void *awindow, void *aimageinfo, char *filename, - int fimage, XColor **ppcolors, int *pncolors) -{ -// XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW *)awindow; - XW_EXT_IMAGEDATA *pimage = NULL; -// XW_STATUS status; - XImage *pximage = NULL; - XColor *pcolors = NULL; - char *wname = NULL, *pidata = NULL; -// BYTE byte; - int i, isize, ncolors, bytes_per_line, x, y, width, height; - int hasColormap, hasMask, isInsideOut, isOS2Format; - - BITMAPFILEHEADER bmfh; /* Standard BMP file header */ - BITMAPINFOHEADER bmih; /* Windows BMP header */ - BITMAPCOREHEADER bmch; /* OS/2 BMP header */ - RGBQUAD colors256 [256]; /* color table (up to 256 entries) */ - BYTE *pData, *pbData=NULL; /* pointer to bitmap pixels */ - BYTE *ptrByte; - - DWORD dwRMask, dwGMask, dwBMask; - int nRMult, nGMult, nBMult; - int nBitCount, iCompression; - - - if (2 != lseek (fimage, 2, SEEK_SET) /* skip 'BM' signature */ - || sizeof (bmfh) != read (fimage, (char *)&bmfh, sizeof (bmfh))) - goto _ExitReadError; - - - /* Detect format using the size field (.biSize or .bcSize) */ - isOS2Format = _TestSwapDWORD (bmfh.dwHeaderSize) == sizeof (bmch) + 4; - if (!isOS2Format && sizeof (bmih) != read (fimage, (char *)&bmih, sizeof (bmih)) - || isOS2Format && sizeof (bmch) != read (fimage, (char *)&bmch, sizeof (bmch))) - goto _ExitReadError; - - - nBitCount = _TestSwapWORD (isOS2Format? bmch.bcBitCount: bmih.biBitCount); - if (nBitCount != 1 && nBitCount != 4 && nBitCount != 8 - && nBitCount != 16 && nBitCount != 24 && nBitCount != 32 - || isOS2Format && (nBitCount == 16 || nBitCount == 32)) { -#ifdef DEB - fprintf (stderr, "\r\nXw_load_bmp_image: " - "Error: Wrong count of bits per pixel (%d) specified!", nBitCount); -#endif /*DEB*/ - goto _ExitReadError; - } - - iCompression = isOS2Format? BI_RGB: _TestSwapDWORD (bmih.biCompression); - hasColormap = nBitCount <= 8; - hasMask = iCompression == BI_BITFIELDS; - ncolors = hasColormap ? 1 << nBitCount: 0; - width = isOS2Format ? _TestSwapWORD (bmch.bcWidth) - : _TestSwapDWORD (bmih.biWidth); - height = isOS2Format ? _TestSwapWORD (bmch.bcHeight) - : _TestSwapDWORD (bmih.biHeight); - isInsideOut = !isOS2Format && height < 0; - height = isInsideOut? -height: height; - bytes_per_line = width * nBitCount; - bytes_per_line = (bytes_per_line>>3) + (bytes_per_line&0x7 ? 1: 0); - bytes_per_line += (bytes_per_line&0x3)? (4-(bytes_per_line&0x3)): 0; - - if (hasColormap) { - - /* Retreive array of colors (as RGBQUAD sequence). */ - /* Note, that there can be less then ncolors colors. */ - isize = ncolors * sizeof (RGBQUAD); - if (0 >= read (fimage, (char *)&colors256, isize)) - goto _ExitReadError; - - if (! (pcolors = (XColor*) Xw_calloc(ncolors, sizeof(XColor)))) - goto _ExitAllocError; - - for (i=0; i>= 1) - nRMult++; - for (i=dwGMask; (i&1)^1; i >>= 1) - nGMult++; - for (i=dwBMask; (i&1)^1; i >>= 1) - nBMult++; - } - else - dwBMask = 0x000000ff, dwGMask = 0x0000ff00, dwRMask = 0x00ff0000, - nBMult = 0, nGMult = 8, nRMult = 16; - - - -#ifdef DEBUG - fprintf (stderr, "\r\nXw_load_bmp_image: Format: %s Dimensions: %dx%d" - " BitCount: %d Compression: %d", isOS2Format? "OS/2": "Windows", - width, height, nBitCount, iCompression); -#endif /*DEBUG*/ - - - - /* Allocate the pixel buffer and load raw data from file */ - i = _TestSwapDWORD (bmfh.bfOffBits); - isize = _TestSwapDWORD (bmfh.bfSize) - i; - if (! (pData = (BYTE *) Xw_malloc(isize))) - goto _ExitAllocError; - - pbData = pData; - - - if (i != lseek (fimage, i, SEEK_SET) - || isize != read (fimage, (char *)pData, isize)) - goto _ExitReadError; - - - - if (iCompression == BI_RLE4 || iCompression == BI_RLE8) { - - if (! (pbData = (BYTE *) Xw_malloc(width*height))) { - - pbData = pData; - goto _ExitAllocError; - } - - /* Note, that it is possible that "spots" could appear - * after decompressing the data encoded using RLE algorith. - * The method assumes that the image is drawn to an already - * defined background. That's why I have to fill in these - * probable spots with some color (I have chosen 0-indexed one). - */ - memset (pbData, 0, width*height); - - - /* Decompress the data to array of 8-bit color indices */ - x = 0; - y = 0; - - ptrByte = pData; - - for (;;) { - - BYTE bPixCount = *ptrByte++; - BYTE bCode, bColor; - - if (bPixCount) { - - bColor = *ptrByte++; - - /*fprintf (stderr, "[%02x S]", (int)bPixCount);*/ - if (iCompression == BI_RLE8) - while (bPixCount--) - pbData [width*y + x++] = bColor; - - else { - BYTE bColor0 = (bColor & 0xf0) >> 4; - BYTE bColor1 = bColor & 0x0f; - - i = 0; - while (bPixCount--) - pbData [width*y + x++] = i++ & 1 ? bColor1: bColor0; - } - - continue; - } - - - /* Zero code has been reached. */ - /* Do the command specified in the second byte. */ - bCode = *ptrByte++; - - if (!bCode) /* EOL */ - x = 0, y++ /*,fprintf (stderr, "\r\n")*/; - - else if (bCode == 1) /* EOF */ - break; - - else if (bCode == 2) { /* Delta */ - - x += (unsigned) *ptrByte++; - y += (unsigned) *ptrByte++; - /*fprintf (stderr, "[POS=%d,%d]", x, y);*/ - } - else { /* Absolute mode */ - - bPixCount = bCode; - - /*fprintf (stderr, "[%02x D]", (int)bPixCount);*/ - if (iCompression == BI_RLE8) - while (bPixCount--) - pbData [width*y + x++] = *ptrByte++; - - else { - i = 0; - while (bPixCount--) - pbData [width*y + x++] = i++ & 1 ? *ptrByte & 0x0f - : (*ptrByte++ & 0xf0) >> 4; - } - - - /* each run must aligned on a word boundary */ - if (iCompression == BI_RLE8 && (bCode & 1) - || iCompression == BI_RLE4 && (bCode & 3)) - ptrByte ++; - } - } - - - bytes_per_line = width; - nBitCount = 8; - - Xw_free (pData); - } - /* else * data isn't comressed. Can just use the raw data */ - - - /* Alloc image data (pidata) and fill in the buffer with RGBQUAD's */ - isize = width*height; - if (! (pidata = (char *) Xw_malloc (hasColormap? isize: isize*4))) - goto _ExitAllocError; - - x = 0; - y = isInsideOut? 0: height-1; - - for (i=0; i>1))&0x0f: (*(pbLine+(x>>1))&0xf0) >> 4; break; - case 1: - { int iBit = 7 - (x&7); - dwValue = (*(pbLine+(x>>3)) & (1 <>iBit; - } break; /* next bit */ - } - - if (hasColormap) - *(((BYTE *) pidata) + i) = (BYTE) dwValue; /* put index into colormap */ - else - *(((DWORD *) pidata) + i) = (DWORD) dwValue; /* put RGB */ - - - if (++x == width) { - - x = 0; - y += isInsideOut? 1: -1; - } - } - - - /* Allocate the Image structure */ - if (! (pximage = (XImage*) Xw_malloc(sizeof(XImage)))) - goto _ExitAllocError; - - /* Allocate the Extended Image structure */ - if(! (pimage = Xw_add_imagedata_structure (sizeof(XW_EXT_IMAGEDATA)))) - goto _ExitError; - - - /* Initialize the input image */ - pimage->pimageinfo = aimageinfo; - _IIMAGE = pximage; - _IIMAGE->data = pidata; - _IIMAGE->width = (int) width; - _IIMAGE->height = (int) height; - _IIMAGE->xoffset = 0; - _IIMAGE->format = (int) ZPixmap; - _IIMAGE->byte_order = (int) LSBFirst; - _IIMAGE->bitmap_unit = hasColormap? 8: 32; - _IIMAGE->bitmap_bit_order = (int) LSBFirst; - _IIMAGE->bitmap_pad = hasColormap? 8: 32; - _IIMAGE->depth = (int) 24; - _IIMAGE->bits_per_pixel = hasColormap? 8: 32; - _IIMAGE->bytes_per_line = hasColormap? width: width*4; - _IIMAGE->red_mask = hasColormap? 0: dwRMask; - _IIMAGE->green_mask = hasColormap? 0: dwGMask; - _IIMAGE->blue_mask = hasColormap? 0: dwBMask; - _IIMAGE->obdata = NULL; - _XInitImageFuncPtrs (_IIMAGE); - - - /* Return array of colors */ - *ppcolors = pcolors; - *pncolors = ncolors; - - if (wname) Xw_free (wname); - if (pbData) Xw_free (pbData); - - -#ifdef DEBUG - fprintf (stderr, "\r\nXw_load_bmp_image: Operation completed successfully.\r\n"); -#endif /*DEBUG*/ - - - /* Successfully loaded */ - return (pimage); - - - -_ExitReadError: - fprintf (stderr, "\r\nXw_load_bmp_image: Error reading %s!", filename); - goto _ExitError; - - -_ExitAllocError: - fprintf (stderr, "\r\nXw_load_bmp_image: Error: Out of memory!"); - - -_ExitError: - -#ifdef DEB - fprintf (stderr, "\r\nXw_load_bmp_image: An error occured! Returning NULL."); -#endif /*DEB*/ - - if (pbData) Xw_free (pbData); - if (pximage) Xw_free (pximage); - if (pidata) Xw_free (pidata); - if (pimage) Xw_free (pidata); - if (pcolors) Xw_free (pcolors); - - return (NULL); -} diff --git a/src/Xw/Xw_load_gif_image.cxx b/src/Xw/Xw_load_gif_image.cxx deleted file mode 100755 index 1d5d9f84a5..0000000000 --- a/src/Xw/Xw_load_gif_image.cxx +++ /dev/null @@ -1,427 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -/* - * Created: zov : 22-Apr-1998 : Loads GIF image from file - * - - XW_EXT_IMAGEDATA* Xw_load_gif_image (awindow,aimageinfo,fimage,ppcolors,pncolors) - XW_EXT_WINDOW *awindow - XW_USERDATA *aimageinfo - XColor **ppcolors - address of pointer to array of used colors to return - int *pncolors - address of a variable to return length of the array in - - Gets an image from a file. - Note, that the file must be GIF formatted. - - Returns the image descriptor address if successful; or NULL if failed. -*/ - -#define PURIFY /*GG+STT 11/01/99 -// Avoid Free memory leak. -*/ - -#include -#include - - -#define _ADD_PIXEL(idx) \ -{ \ - if (y < height) *(pidata + y*width + x) = ((unsigned char)(idx)); \ - if (++x == width) { \ - x = 0; \ - if (!isInterlace) ++y; \ - else switch (pass) { \ - case 0: y += 8; if (y >= height) ++pass, y = 4; break; \ - case 1: y += 8; if (y >= height) ++pass, y = 2; break; \ - case 2: y += 4; if (y >= height) ++pass, y = 1; break; \ - default: y += 2; \ - } \ - } \ -} - -/* Note, -** Portions Copyright (c) of CISIGRAPH SOFTWARE. -** -** Permission to use, copy, modify, and distribute this software and its -** documentation for any purpose and without fee is hereby granted, provided -** that the above copyright notice appear in all copies and that both that -** copyright notice and this permission notice appear in supporting -** documentation. This software is provided "as is" without express or -** implied warranty. -*/ - -XW_EXT_IMAGEDATA *Xw_load_gif_image (void *awindow,void *aimageinfo,char *filename,int fimage, - XColor **ppcolors, int *pncolors) -{ -// XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW *)awindow; - XW_EXT_IMAGEDATA *pimage = NULL; -// XW_STATUS status; - XImage *pximage = NULL; - XColor *pcolors = NULL; - char *wname = NULL, *pidata = NULL; - unsigned char byte, byte1; - unsigned *OutCode=NULL, *Prefix=NULL, *Suffix=NULL, - BitMask, CodeSize, ClearCode, EOFCode, FreeCode, x, y, pass, width, height, - InitCodeSize, MaxCode, ReadMask, FirstFree, OutCount, BitOffset, - ByteOffset, Code, CurCode, OldCode=0, FinChar=0, InCode; - long lFileSize; -// int i, isize, dataSize, ncolors; - int i, ncolors; -static unsigned char *pchFileStream_start = NULL, - *pchFileStream, *ptr1, *rasterPtr = NULL; - int isInterlace, hasColormap; - - - if (-1 == (lFileSize = lseek (fimage, 0, SEEK_END)) - || NULL == (pchFileStream_start = (unsigned char *) Xw_malloc (lFileSize)) - || 0 != lseek (fimage, 0, SEEK_SET) - || lFileSize != read (fimage, (char *)pchFileStream_start, lFileSize) - ) - goto _ExitReadError; - - pchFileStream = pchFileStream_start + 10; - - - byte = *pchFileStream++; /* Color descriptor byte (M#CR0#BP) */ - hasColormap = byte & 0x80; - ncolors = hasColormap ? 1<<((byte & 0x07) + 1): 1<<8; - BitMask = ncolors - 1; - -#ifdef DEBUG - fprintf (stderr, "\r\nXw_load_gif_image: GIF contains %d colors.", - hasColormap? ncolors: 0); -#endif /*DEBUG*/ - - pchFileStream += 2; /* Skip background byte and following zero byte */ - - if (ncolors > 0) { /* Allocate Color Table entries */ - - if (! (pcolors = (XColor*) Xw_calloc(ncolors, sizeof(XColor)))) - goto _ExitAllocError; - - for (i=0; i<...><...><0> - */ - while (*pchFileStream == '!') { - - pchFileStream += 2; /* skip code byte followed '!' sign */ - - while (*pchFileStream) - pchFileStream += (unsigned)(1 + *(unsigned char *)pchFileStream); - - pchFileStream ++; - } - - - - if (*pchFileStream++ != ',') { /* must be an image descriptor */ - -#ifdef DEB - fprintf (stderr, "\r\nXw_load_gif_image: Error: There's no separator" - " following the colormap"); -#endif /*DEB*/ - - goto _ExitReadError; - } - - - pchFileStream += 2*2; /* Skip image left & top offsets*/ - width = (unsigned) *pchFileStream++; - width += ((unsigned)*pchFileStream++) << 8; - height = (unsigned) *pchFileStream++; - height += ((unsigned)*pchFileStream++) << 8; - - - byte = *pchFileStream++; - - isInterlace = byte & 0x40; - - if (byte & 0x80) { - - fprintf (stderr, "\r\nXw_load_gif_image:" - " Can't read GIF image with locally defined colormap!\r\n"); - goto _ExitReadError; - } - - -#ifdef DEBUG - fprintf (stderr, "\r\nXw_load_gif_image: Dimensions: %dx%d" - " Interlace mode: %s", - width, height, isInterlace? "ON": "OFF"); -#endif /*DEBUG*/ - - - - /* Allocate the pixel buffer */ - if (! (rasterPtr = (unsigned char *) Xw_malloc(lFileSize))) - goto _ExitAllocError; - - - OutCode = (unsigned *)Xw_malloc(1025 * sizeof (unsigned)); - Prefix = (unsigned *)Xw_malloc(4096 * sizeof (unsigned)); - Suffix = (unsigned *)Xw_malloc(4096 * sizeof (unsigned)); - - if (!OutCode || !Prefix || !Suffix) - goto _ExitAllocError; - - - - /* Decode compressed raster data. */ - CodeSize = *pchFileStream++; - ClearCode = 1 << CodeSize; - EOFCode = ClearCode + 1; - FreeCode = FirstFree = EOFCode + 1; - - ++CodeSize; - - InitCodeSize = CodeSize; - MaxCode = 1 << CodeSize; - ReadMask = MaxCode - 1; - - ptr1 = rasterPtr; - - /* Read encoded data to a continuous array pointed to by rsterPtr */ - do { - byte = byte1 = *pchFileStream++; - - while (byte--) - *ptr1++ = *pchFileStream++; - - if ((long) (ptr1 - rasterPtr) > lFileSize) /* Currupt file */ - goto _ExitReadError; - } - while (byte1); - - Xw_free (pchFileStream_start); /* The file data has been already read */ - pchFileStream_start = NULL; - - - - if (! (pidata = (char *) Xw_malloc (width*height))) - goto _ExitAllocError; - - - x = y = pass = OutCount = BitOffset = ByteOffset = 0; - - /* Fetch the next code (3 to 12 bits) from the raster data stream */ - Code = rasterPtr[0] + (((unsigned) rasterPtr[1]) << 8); - if (CodeSize >= 8) - Code += ((unsigned) rasterPtr[2]) << 16; - - Code >>= BitOffset & 0x7; - BitOffset += CodeSize; - Code &= ReadMask; - - - while (Code != EOFCode) { - - - if (Code == ClearCode) { - - /* Read the next code */ - CodeSize = InitCodeSize; - MaxCode = 1 << CodeSize; - ReadMask = MaxCode - 1; - FreeCode = FirstFree; - ByteOffset = BitOffset >> 3; - Code = rasterPtr[ByteOffset]; - - Code = rasterPtr[ByteOffset] - + (((unsigned) rasterPtr[ByteOffset + 1]) << 8); - if (CodeSize >= 8) - Code += ((unsigned) rasterPtr[ByteOffset + 2]) << 16; - - Code >>= BitOffset & 0x7; - BitOffset += CodeSize; - Code &= ReadMask; - - CurCode = OldCode = Code; - FinChar = CurCode & BitMask; - - _ADD_PIXEL (FinChar); - } - else { - - CurCode = InCode = Code; - - if (CurCode >= FreeCode) { - - CurCode = OldCode; - OutCode[OutCount++] = FinChar; - } - - while (CurCode > BitMask) { - - if (OutCount > 1024) - goto _ExitReadError; - - OutCode [OutCount++] = Suffix [CurCode]; - CurCode = Prefix [CurCode]; - } - - FinChar = CurCode & BitMask; - OutCode [OutCount++] = FinChar; - - for (i = OutCount - 1; i >= 0; --i) - _ADD_PIXEL (OutCode [i]); - - OutCount = 0; - Prefix [FreeCode] = OldCode; - Suffix [FreeCode] = FinChar; - OldCode = InCode; - ++FreeCode; - - if (FreeCode >= MaxCode) { - - if (CodeSize < 12) { - - ++CodeSize; - MaxCode <<= 1; - ReadMask = (1 << CodeSize) - 1; - } - } - } - - ByteOffset = BitOffset >> 3; - Code = (unsigned) rasterPtr[ByteOffset]; - Code = (unsigned) rasterPtr[ByteOffset] - + (((unsigned) rasterPtr[ByteOffset + 1]) << 8); - if (CodeSize >= 8) - Code += ((unsigned) rasterPtr[ByteOffset + 2]) << 16; - - Code >>= (BitOffset & 0x7); - BitOffset += CodeSize; - Code &= ReadMask; - } - - - /* Allocate the Image structure */ - if (! (pximage = (XImage*) Xw_malloc(sizeof(XImage)))) - goto _ExitAllocError; - - /* Allocate the Extended Image structure */ - if(! (pimage = Xw_add_imagedata_structure (sizeof(XW_EXT_IMAGEDATA)))) - goto _ExitError; - - - /* Initialize the input image */ - pimage->pimageinfo = aimageinfo; - _IIMAGE = pximage; - _IIMAGE->data = pidata; - _IIMAGE->width = (int) width; - _IIMAGE->height = (int) height; - _IIMAGE->xoffset = (int) 0; - _IIMAGE->format = (int) ZPixmap; - _IIMAGE->byte_order = (int) LSBFirst; - _IIMAGE->bitmap_unit = (int) 8; - _IIMAGE->bitmap_bit_order = (int) LSBFirst; - _IIMAGE->bitmap_pad = (int) 8; - _IIMAGE->depth = (int) 24; - _IIMAGE->bits_per_pixel = (int) 8; - _IIMAGE->bytes_per_line = (int) width; - _IIMAGE->red_mask = 0; - _IIMAGE->green_mask = 0; - _IIMAGE->blue_mask = 0; - _IIMAGE->obdata = NULL ; - _XInitImageFuncPtrs (_IIMAGE); - - - /* Return array of colors */ - *ppcolors = pcolors; - *pncolors = ncolors; - - if (wname) Xw_free(wname); - - -#ifdef DEBUG - fprintf (stderr, "\r\nXw_load_gif_image: Operation completed successfully.\r\n"); -#endif /*DEBUG*/ - - - /* Successfully loaded */ - -#ifdef PURIFY - if (rasterPtr) Xw_free (rasterPtr); - if (OutCode) Xw_free (OutCode); - if (Prefix) Xw_free (Prefix); - if (Suffix) Xw_free (Suffix); -#endif - return (pimage); - - - -_ExitReadError: - - /*ERROR*Unable to read Image data - Xw_set_error(61,"Xw_load_gif_image",filename); - */ - fprintf (stderr, "\r\nXw_load_gif_image: Error reading %s!", filename); - goto _ExitError; - - -_ExitAllocError: - /*ERROR*Bad Image allocation - Xw_set_error(60,"Xw_load_gif_image",0); - */ - fprintf (stderr, "\r\nXw_load_gif_image: Error: Out of memory!"); - - -_ExitError: - -#ifdef DEB - fprintf (stderr, "\r\nXw_load_gif_image: An error occured! Returning NULL."); -#endif /*DEB*/ - - if (pchFileStream_start) Xw_free (pchFileStream_start); - if (pximage) Xw_free (pximage); - if (rasterPtr) Xw_free (rasterPtr); - if (pidata) Xw_free (pidata); - if (pimage) Xw_free (pidata); - if (pcolors) Xw_free (pcolors); - if (OutCode) Xw_free (OutCode); - if (Prefix) Xw_free (Prefix); - if (Suffix) Xw_free (Suffix); - - return (NULL); -} - -#undef _ADD_PIXEL diff --git a/src/Xw/Xw_load_icons.cxx b/src/Xw/Xw_load_icons.cxx deleted file mode 100755 index 64a92db6db..0000000000 --- a/src/Xw/Xw_load_icons.cxx +++ /dev/null @@ -1,1203 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define NO_PERF01 /*GG_160996 -// Mesure de performances sur l'iconification -*/ - -#define CTS17035 /*GG_191296 -// Chargement conditionnel des icones -// Syntaxe: -// #ifdef code cond value -// code : DEPTH,CLASS or SCREEN_SIZE -// cond : > ou >= ou < ou <= ou == ou != -// value: valeur entiere ou real fonction du code -// #else -// #endif -*/ - -#define QUANTIFY /*GG_180297 -// Charger dynamiquement les icones au fur et a mesure -// de leur utilisation -*/ - -#define PRO16753 /* GG 261198 -// 1) Don't free pname because this pointer is a -// static address in Xw_get_filename() space. -// 2) Increments nicons value in Xw_load_icons -// 3) Flush pixmap filling (XPutImage) before returning. -*/ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#ifdef PERF01 -# ifdef HAVE_TIME_H -# include -# endif -#endif - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_LOAD_ICONS -#define TRACE_SAVE_ICONS -#define TRACE_CLEAR_ICONS -#define TRACE_SHOW_ICONS -#define TRACE_SAVE_ICONS -#define TRACE_GET_ICON_PIXMAP -#define TRACE_CREATE_ICON_PIXMAP -#define TRACE_GET_ICON_SIZE -#define TRACE_GET_ICON_NAME -#define TRACE_GET_ICON -#define TRACE_PUT_ICON -#define TRACE_PUT_ICON_NAME -#define TRACE_PUT_WINDOW_ICON -#define TRACE_DEL_ICON -#endif - -/* - int Xw_load_icons (awindow,dirname): - XW_EXT_WINDOW *awindow - char *dirname Icon File Directory name - - LOAD Icons File directory - - NOTE : Icons File must be ".ifd" postfixed file and contains - the sets of icons to be loaded in the IconBox - Each Icon is a complete filename of type ".xwd" followed - bye the icon-name . - - e.g : - - Sample.ifd is my Icons File directory and contains : - - chrono.xwd 'chrono' - $DIRICON/clock.xwd 'montre' - /usr/users/gg/XWD/toys.xwd 'toys' - - - returns 0 if something is failed. - returns the number of loaded icons if successfull. - - int Xw_save_icons (awindow): - XW_EXT_WINDOW *awindow - - SAVE just created Icons in corresponding .xwd files. - - returns 0 if something is failed. - returns the number of saved icons if successfull. - - STATUS Xw_show_icons (awindow): - XW_EXT_WINDOW *awindow - - SHOW Icons to the Screen - - Returns ERROR if IconBox is Empty - Returns SUCCESS if successfull - - int Xw_clear_icons (awindow,dirname): - XW_EXT_WINDOW *awindow - char *dirname Icon File Directory name - - CLEAR the corresponding "dirname" Icons in the IconBox - or ALL icons if dirname is NULL - or ALL Added icons if dirname is "" - - Returns 0 if nothing has been cleared - Returns the cleared icons number if successfull - - - static XW_EXT_ICON* Xw_put_icon (awindow,iconname): - XW_EXT_WINDOW *awindow - char *iconname Icon name - - ADD an Icon in the IconBox but DON'T load it. - - Returns Icon Ext Address if Successfull - Returns NULL if Icon don't exist - - static XW_EXT_ICON* Xw_get_icon (awindow,iconname): - XW_EXT_WINDOW *awindow - char *iconname Icon name - - GET the Image associated to the Icon in the IconBox - - Returns Icon Ext Address if Successfull - Returns NULL if Icon don't exist - - STATUS Xw_put_window_icon (awindow,fwindow,iconname,width,height): - XW_EXT_WINDOW *awindow - XW_EXT_WINDOW *fwindow - char *iconname Icon name - int width,height Icon size - - ADD an Icon of size width,height in the IconBox - from the Full Window background fwindow - - Returns ERROR if name is wrong - Returns SUCCESS if successfull - - Aspect_Handle Xw_get_icon_pixmap (awindow,width,height,iconname): - XW_EXT_WINDOW *awindow - int width,height Pixmap Size - char *iconname Icon name - - GET the Pixmap associated to the Icon in the IconBox - - Returns Pixmap Xid if Successfull - Returns NULL if Icon don't exist - - Xw_STATUS Xw_get_icon_size (awindow,iconname,width,height): - XW_EXT_WINDOW *awindow - char *iconname Icon name - int *width,*height Returned Pixmap Size - - GET the Pixmap associated to the Icon in the IconBox - - Returns ERROR if Iconname is not Known - Returns SUCCES if Successfull - - char* Xw_get_icon_name (awindow,index): - XW_EXT_WINDOW *awindow - int index Icon Index >1 & <= IconNumber - - GET the Icon Name from the IconBox Index - - Returns IconName if Successfull - Returns NULL if Index is wrong -*/ - -#include - -static char ShowIconBox = 'U' ; - -#ifdef CTS17035 -#define IFD_CODE_UNKNOWN 0 -#define IFD_CODE_DEPTH 1 -#define IFD_CODE_CLASS 2 -#define IFD_CODE_SCREEN_SIZE 3 -static int ifd_code = IFD_CODE_UNKNOWN; -#define IFD_COND_UNKNOWN 0 -#define IFD_COND_EQUAL 1 -#define IFD_COND_GREATER 2 -#define IFD_COND_LESS 3 -#define IFD_COND_GREATER_OR_EQUAL 4 -#define IFD_COND_LESS_OR_EQUAL 5 -#define IFD_COND_NOT_EQUAL 6 -#define IFD_COND_SKIP 7 -#define IFD_COND_KEEP 8 -static int ifd_cond = IFD_COND_UNKNOWN; -static int ifd_ivalue = 0; -static float ifd_rvalue = 0.; -static char ifd_svalue[256]; -#endif - -// Unused : -#ifdef DEB -#ifdef XW_PROTOTYPE -static int Strcmp(char* cs1,char* cs2) /* For optimization */ -#else -static int Strcmp(cs1,cs2) /* For optimization */ -char *cs1,*cs2; -#endif -{ -union { - int *i; - char *c; -} u1,u2; -int i,n = max(strlen(cs1),strlen(cs2))/sizeof(int); - - u1.c = cs1; u2.c = cs2; - - for( i=0 ; i 0 ) { - ShowIconBox = ifd_svalue[0] ; - } - printf( " Xw_SHOW_ICONBOX is '%c'\n",ShowIconBox) ; - } - - status = Xw_get_color_name(_COLORMAP,"Green",&r,&g,&b) ; - - if( status ) { - status = Xw_get_color_index(_COLORMAP,r,g,b,&index) ; - if( status ) Xw_set_line_attrib(pwindow,index,0,0,XW_REPLACE) ; - } - - status = Xw_get_color_name(_COLORMAP,"White",&r,&g,&b) ; - - if( status ) { - status = Xw_get_color_index(_COLORMAP,r,g,b,&index) ; - if( status ) Xw_set_text_attrib(pwindow,index,0,0,XW_REPLACE) ; - } - - pname = Xw_get_filename(dirname,"ifd") ; - - if( pname ) ficon = fopen(pname,"r") ; - - if( !ficon ) { - /*ERROR*Bad ICON File Directory Name */ - Xw_set_error(100,"Xw_load_icons",pname) ; - return (0) ; - } - -#ifndef PRO16753 - Xw_free(pname) ; -#endif - /* READ Icon File Directory */ - while( !feof(ficon) ) { - skip = False ; - status = fscanf(ficon,"%s%c",filename,&lf) ; - if( filename[0] == '#' ) { -#ifdef CTS17035 - char code[80],cond[80],value[80]; - code[0] = cond[0] = value[0] = '\0'; - if( !strncmp(filename,"#if",3) ) { - status = fscanf(ficon,"%s%c",code,&lf) ; - if( lf != '\n' ) status = fscanf(ficon,"%s%c",cond,&lf) ; - if( lf != '\n' ) status = fscanf(ficon,"%s%c",value,&lf) ; -#ifdef TRACE - if( Xw_get_trace() ) - printf(" #ifdef '%s' '%s' '%s'\n",code,cond,value); -#endif - ifd_code = IFD_CODE_UNKNOWN; - ifd_cond = IFD_COND_UNKNOWN; - ifd_ivalue = 0; - ifd_rvalue = 0.; - ifd_svalue[0] = '\0'; - if( !strcmp(code,"DEPTH") ) { - ifd_code = IFD_CODE_DEPTH; - } else if( !strcmp(code,"CLASS") ) { - ifd_code = IFD_CODE_CLASS; - } else if( !strcmp(code,"SCREEN_SIZE") ) { - ifd_code = IFD_CODE_SCREEN_SIZE; - } - if( !strcmp(cond,">") ) { - ifd_cond = IFD_COND_GREATER; - } else if( !strcmp(cond,">=") ) { - ifd_cond = IFD_COND_GREATER_OR_EQUAL; - } else if( !strcmp(cond,"<") ) { - ifd_cond = IFD_COND_LESS; - } else if( !strcmp(cond,"<=") ) { - ifd_cond = IFD_COND_LESS_OR_EQUAL; - } else if( !strcmp(cond,"==") ) { - ifd_cond = IFD_COND_EQUAL; - } else if( !strcmp(cond,"!=") ) { - ifd_cond = IFD_COND_NOT_EQUAL; - } - switch (ifd_code) { - case IFD_CODE_DEPTH: - sscanf(value,"%d",&ifd_ivalue); - switch (ifd_cond) { - case IFD_COND_GREATER: - if( _DEPTH > ifd_ivalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_GREATER_OR_EQUAL: - if( _DEPTH >= ifd_ivalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_LESS: - if( _DEPTH < ifd_ivalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_LESS_OR_EQUAL: - if( _DEPTH <= ifd_ivalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_EQUAL: - if( _DEPTH == ifd_ivalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_NOT_EQUAL: - if( _DEPTH != ifd_ivalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - default: - fprintf(stderr,"*Xw_load_icons.Unrecognize key cond '%s'\n",cond); - ifd_cond = IFD_COND_SKIP; - } - break; - case IFD_CODE_CLASS: - sscanf(value,"%s",&ifd_svalue[0]); - ifd_ivalue = 0; - if( !strcmp(ifd_svalue,"PseudoColor") ) - ifd_ivalue = PseudoColor; - else if( !strcmp(ifd_svalue,"TrueColor") ) - ifd_ivalue = TrueColor; - switch (ifd_cond) { - case IFD_COND_EQUAL: - if( _CLASS == ifd_ivalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_NOT_EQUAL: - if( _CLASS != ifd_ivalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - default: - fprintf(stderr,"*Xw_load_icons.Unrecognize key cond '%s'\n",cond); - ifd_cond = IFD_COND_SKIP; - } - break; - case IFD_CODE_SCREEN_SIZE: - sscanf(value,"%f",&ifd_rvalue); - wsize = (float) WidthMMOfScreen(_SCREEN)/25.4; - hsize = (float) HeightMMOfScreen(_SCREEN)/25.4; - ssize = sqrt(wsize*wsize + hsize*hsize); - switch (ifd_cond) { - case IFD_COND_GREATER: - if( ssize > ifd_rvalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_GREATER_OR_EQUAL: - if( ssize >= ifd_rvalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_LESS: - if( ssize < ifd_rvalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_LESS_OR_EQUAL: - if( ssize <= ifd_rvalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_EQUAL: - if( ssize == ifd_rvalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - case IFD_COND_NOT_EQUAL: - if( ssize != ifd_rvalue ) ifd_cond = IFD_COND_KEEP; - else ifd_cond = IFD_COND_SKIP; - break; - default: - fprintf(stderr,"*Xw_load_icons.Unrecognize key cond '%s'\n",cond); - ifd_cond = IFD_COND_SKIP; - } - break; - default: - fprintf(stderr,"*Xw_load_icons.Unrecognize key code '%s'\n",code); - ifd_cond = IFD_COND_SKIP; - } - } else if( !strncmp(filename,"#else",5) ) { -#ifdef TRACE - if( Xw_get_trace() ) - printf(" #else\n"); -#endif - switch (ifd_cond) { - case IFD_COND_UNKNOWN: - break; - case IFD_COND_SKIP: - ifd_cond = IFD_COND_KEEP; - break; - case IFD_COND_KEEP: - ifd_cond = IFD_COND_SKIP; - break; - } - } else if( !strncmp(filename,"#endif",6) ) { -#ifdef TRACE - if( Xw_get_trace() ) - printf(" #endif\n"); -#endif - ifd_code = IFD_CODE_UNKNOWN; - ifd_cond = IFD_COND_UNKNOWN; - ifd_ivalue = 0; - ifd_rvalue = 0.; - ifd_svalue[0] = '\0'; - } -#endif - while( lf != '\n' ) status = fscanf(ficon,"%c",&lf) ; - skip = True ; - } else if( lf != '\n' ) { -#ifdef CTS17035 - if( ifd_cond == IFD_COND_SKIP ) skip = True; -#endif - status = fscanf(ficon,"%s%c",iconname,&lf) ; - while( lf != '\n' ) status = fscanf(ficon,"%c",&lf) ; - if( iconname[0] == '#' ) { - fprintf(stderr,"*Xw_load_icons*Unimplemented Default Icon Name %s\n", - filename); - } - } else { - skip = True ; - } - - if( ferror(ficon) ) break ; - - if( skip ) continue ; - piconinfo = Xw_put_icon (pwindow,iconname) ; - if( piconinfo ) { - piconinfo->pfile = (char*) strdup(filename); -#ifdef PRO16753 - nicons++; -#endif - } - } - - fclose(ficon) ; - - -#ifdef TRACE_LOAD_ICONS -if( Xw_get_trace() ) { - printf (" %d = Xw_load_icons(%lx,'%s')\n",nicons,(long ) pwindow,dirname); -} -#endif - - return (nicons); -} - -#ifdef XW_PROTOTYPE -static XW_EXT_ICON* Xw_put_icon(XW_EXT_WINDOW* pwindow,char* iconname) -#else -static XW_EXT_ICON* Xw_put_icon(pwindow,iconname) -XW_EXT_WINDOW *pwindow ; -char *iconname ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_ICON *piconinfo ; - - piconinfo = (XW_EXT_ICON*) Xw_malloc(sizeof(XW_EXT_ICON)) ; - - if( piconinfo ) { - piconinfo->type = ICON_TYPE ; - piconinfo->pname = (char*) strdup(iconname); - piconinfo->pfile = NULL; - piconinfo->pimage = NULL ; - piconinfo->pixmap = 0 ; - piconinfo->update = 0 ; - piconinfo->link = pwindow->other; - pwindow->other = piconinfo; - } else { - /*ERROR*EXT_ICON allocation failed*/ - Xw_set_error(101,"Xw_put_icon",NULL) ; - return (NULL) ; - } - -#ifdef TRACE_PUT_ICON_NAME -if( Xw_get_trace() > 1 ) { - printf (" %lx = Xw_put_icon(%lx,'%s')\n",(long ) piconinfo,(long ) pwindow,iconname); -} -#endif - - return (piconinfo) ; - -} - -#ifdef XW_PROTOTYPE -static XW_EXT_ICON* Xw_get_icon(XW_EXT_WINDOW* pwindow,char* iconname) -#else -static XW_EXT_ICON* Xw_get_icon(pwindow,iconname) -XW_EXT_WINDOW *pwindow ; -char *iconname ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_ICON *piconinfo ; - - for( piconinfo=(XW_EXT_ICON*) pwindow->other ; piconinfo ; - piconinfo=(XW_EXT_ICON*) piconinfo->link ) { - if( !strcmp(piconinfo->pname,iconname) ) break; - } - -#ifdef TRACE_GET_ICON -if( Xw_get_trace() > 1 ) { - printf (" %lx = Xw_get_icon(%lx,'%s')\n",(long ) piconinfo,(long ) pwindow,iconname); -} -#endif - - return (piconinfo) ; - -} - -#ifdef XW_PROTOTYPE -static XW_STATUS Xw_del_icon(XW_EXT_WINDOW* pwindow,char* iconname) -#else -static XW_STATUS Xw_del_icon(pwindow,iconname) -XW_EXT_WINDOW *pwindow ; -char *iconname ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_ICON *piconinfo,*qiconinfo = (XW_EXT_ICON*) pwindow->other ; -XW_STATUS status = XW_SUCCESS; - - for( piconinfo=qiconinfo ; piconinfo ; - qiconinfo=piconinfo,piconinfo=(XW_EXT_ICON*) piconinfo->link ) { - if( !strcmp(piconinfo->pname,iconname) ) break; - } - - if( piconinfo ) { - if( piconinfo == qiconinfo ) { - pwindow->other = piconinfo->link; - } else { - qiconinfo->link = piconinfo->link; - } - if( piconinfo->pname ) Xw_free(piconinfo->pname); - if( piconinfo->pfile ) Xw_free(piconinfo->pfile); - if( piconinfo->pixmap ) XFreePixmap(_DISPLAY,piconinfo->pixmap); - if( piconinfo->pimage ) Xw_close_image(piconinfo->pimage); - Xw_free(piconinfo); - } else { - status = XW_ERROR; - } - -#ifdef TRACE_DEL_ICON -if( Xw_get_trace() > 1 ) { - printf (" %d = Xw_get_icon(%lx,'%s')\n",status,(long ) pwindow,iconname); -} -#endif - - return (status) ; - -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_put_window_icon(void* awindow,void *fwindow,char* iconname,int width,int height) -#else -XW_STATUS Xw_put_window_icon(awindow,fwindow,iconname,width,height) -void *awindow ; -void *fwindow ; -char *iconname ; -int width; -int height; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_WINDOW *qwindow = (XW_EXT_WINDOW*)fwindow ; -XW_EXT_DISPLAY *pdisplay; -XW_EXT_IMAGEDATA *pimage ; -XW_EXT_ICON *piconinfo = NULL; -XW_WINDOWSTATE state ; -XW_STATUS status ; -//int iimage,iwidth,iheight,wxc,wyc,wwidth,wheight ; -int iwidth,iheight,wxc,wyc,wwidth,wheight ; -float xi,yi ; -//unsigned long bpixel = 0; -#ifdef PERF01 -time_t t_start,t_finish; -#endif - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_put_window_icon",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_window(qwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_put_window_icon",qwindow) ; - return (XW_ERROR) ; - } - - piconinfo = Xw_get_icon(pwindow,iconname) ; - - if( piconinfo ) { /* Take the same place for the new icon */ - if( piconinfo->pimage ) Xw_close_image(piconinfo->pimage); -// piconinfo->pimage = NULL; - piconinfo->pimage = 0; - if( piconinfo->pixmap ) XFreePixmap(_DISPLAY,piconinfo->pixmap); -// piconinfo->pixmap = NULL; - piconinfo->pixmap = 0; - } else { - piconinfo = Xw_put_icon(pwindow,iconname) ; - if( !piconinfo ) { - return (XW_ERROR) ; - } - } - - pdisplay = pwindow->connexion; - if( width <= 0 ) width = _DWIDTH; - if( height <= 0 ) height = _DHEIGHT; - - state = Xw_get_window_position(qwindow, - &wxc,&wyc,&wwidth,&wheight) ; - - status = Xw_get_window_pixelcoord(qwindow,wwidth/2,wheight/2,&xi,&yi) ; - -#ifdef PERF01 - time(&t_start); -#endif - pimage = (XW_EXT_IMAGEDATA*) Xw_get_image (qwindow,NULL,(int)xi,(int)yi,wwidth,wheight) ; - - if( !pimage || !_IIMAGE ) { - Xw_del_icon(pwindow,iconname) ; - return (XW_ERROR) ; - } -#ifdef PERF01 - time(&t_finish); - printf(" Image CAPTURE time is %lf\n",difftime(t_finish,t_start)); -#endif - - status = XW_SUCCESS ; - piconinfo->pimage = pimage; - piconinfo->update = True; - iwidth = _IIMAGE->width ; - iheight = _IIMAGE->height ; - if( iwidth > width || iheight > width ) { /* ZOOM Icon */ - float zoom = (float)min(width,height)/(float)max(iwidth,iheight) ; -#ifdef PERF01 - time(&t_start); -#endif - status = Xw_zoom_image(pimage,zoom) ; - if( _ZIMAGE && (_ZIMAGE != _IIMAGE) ) { - XDestroyImage(_IIMAGE); - pimage->zoom = 1.; - _IIMAGE = _ZIMAGE; - _ZIMAGE = NULL; - } - -#ifdef PERF01 - time(&t_finish); - printf(" Image ZOOM time is %lf\n",difftime(t_finish,t_start)); -#endif - } - -#ifdef PERF01 - time(&t_start); -#endif - status = Xw_convert_image(pwindow,pimage,NULL,0) ; -#ifdef PERF01 - time(&t_finish); - printf(" Image CONVERT time is %lf\n",difftime(t_finish,t_start)); -#endif - if( !status ) { - Xw_del_icon(pwindow,iconname) ; - Xw_set_error(114,"Xw_put_window_icon",NULL) ; - return (XW_ERROR) ; - } - - if( ShowIconBox == 'Y' ) Xw_show_icons(pwindow) ; - -#ifdef TRACE_PUT_WINDOW_ICON -if( Xw_get_trace() ) { - printf (" %d = Xw_put_window_icons(%lx,%lx,'%s',%d,%d)\n", - status,(long ) awindow,(long ) qwindow,iconname,width,height); -} -#endif - - return (status) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_show_icons (void* awindow) -#else -XW_STATUS Xw_show_icons (awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_IMAGEDATA *pimage; -XW_EXT_ICON *piconinfo ; -//XW_WINDOWSTATE state ; -XW_STATUS status ; -float xi,yi,tw,th,x0,y0,iw,ih ; -//int i,j,n,wxc,wyc,wsize,wxi,wyi,nimage = 0,maximagewidth = 0,maximageheight = 0 ; -int i,j,wxc,wyc,wsize,wxi,wyi,nimage = 0,maximagewidth = 0,maximageheight = 0 ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(25,"Xw_show_icons",pwindow) ; - return (XW_ERROR) ; - } - - /* Compute IconBox Size */ - for( piconinfo=(XW_EXT_ICON*) pwindow->other ; piconinfo ; - piconinfo=(XW_EXT_ICON*) piconinfo->link ) { - if(( pimage = piconinfo->pimage )) { - nimage++; - maximagewidth = max(maximagewidth,_IIMAGE->width); - maximageheight = max(maximageheight,_IIMAGE->height); - } - } - - if( !nimage ) { - /*ERROR*EMPTY IconBox*/ - Xw_set_error(102,"Xw_show_icons",0) ; - return (XW_ERROR) ; - } - - - { - int wwidth,wheight,usize = 1+(int)sqrt((double)nimage-1) ; - XW_WINDOWSTATE state ; - - state = Xw_get_window_position(pwindow, - &wxc,&wyc,&wwidth,&wheight) ; - wsize = min(wwidth,wheight)/max(maximagewidth,maximageheight) ; - - if( usize > wsize ) { /* Grows IconBox */ - wsize = usize ; - status = Xw_set_window_position(pwindow, - wxc,wyc,wsize*maximagewidth,wsize*maximageheight) ; - Xw_resize_window(pwindow) ; - } - } - - /* POP and erase IconBox */ - status = Xw_set_window_state(pwindow,XW_POP) ; - - status = Xw_erase_window(pwindow) ; - - nimage = 0 ; - for( piconinfo=(XW_EXT_ICON*) pwindow->other ; piconinfo ; - piconinfo=(XW_EXT_ICON*) piconinfo->link ) { - if(( pimage = piconinfo->pimage )) { - i = nimage%wsize ; j = nimage/wsize ; - wxi = i*maximagewidth+maximagewidth/2 ; - wyi = j*maximageheight+maximageheight/2 ; - status = Xw_get_window_pixelcoord(pwindow,wxi,wyi,&xi,&yi) ; - Xw_draw_image(pwindow,piconinfo->pimage,xi,yi) ; - Xw_get_text_size(pwindow,0,piconinfo->pname,&tw,&th,&x0,&y0) ; - Xw_draw_text(pwindow,xi-tw/2.,yi-th/2.,piconinfo->pname,0.,0) ; - iw = Xw_get_window_pixelvalue(pwindow,_IIMAGE->width) ; - ih = Xw_get_window_pixelvalue(pwindow,_IIMAGE->height) ; - Xw_begin_line(pwindow,5) ; - Xw_line_point(pwindow,xi-iw/2.,yi-ih/2.) ; - Xw_line_point(pwindow,xi-iw/2.,yi+ih/2.) ; - Xw_line_point(pwindow,xi+iw/2.,yi+ih/2.) ; - Xw_line_point(pwindow,xi+iw/2.,yi-ih/2.) ; - Xw_line_point(pwindow,xi-iw/2.,yi-ih/2.) ; - Xw_close_line(pwindow) ; - } - } - - Xw_flush(pwindow,False) ; - -#ifdef TRACE_SHOW_ICONS -if( Xw_get_trace() ) { - printf (" Xw_show_icons(%lx)\n",(long ) awindow); -} -#endif - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -int Xw_save_icons (void* awindow) -#else -int Xw_save_icons (awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -//XW_EXT_IMAGEDATA *pimage ; -//XW_EXT_IMAGE *pimaglist ; -XW_EXT_ICON *piconinfo ; -//int n,nimage = 0 ; -int nimage = 0 ; -//XW_STATUS status; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(25,"Xw_save_icons",pwindow) ; - return (0) ; - } - - for( piconinfo=(XW_EXT_ICON*) pwindow->other ; piconinfo ; - piconinfo=(XW_EXT_ICON*) piconinfo->link ) { - if( piconinfo->pimage && piconinfo->update ) { - if( Xw_save_image(pwindow,piconinfo->pimage,piconinfo->pname) ) { - nimage++; - piconinfo->update = False; - } - } - } - -#ifdef TRACE_SAVE_ICONS -if( Xw_get_trace() ) { - printf (" %d = Xw_save_icons(%lx)\n",nimage,(long ) awindow); -} -#endif - - return (nimage) ; -} - -#ifdef XW_PROTOTYPE -int Xw_clear_icons (void* awindow,char *dirname) -#else -int Xw_clear_icons (awindow,dirname) -void *awindow ; -char *dirname; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_ICON *piconinfo,*qiconinfo ; -int status ; -FILE *ficon = NULL; -char *pname,filename[256],iconname[80],lf ; -//int n,f,skip,nicons = 0 ; -int skip,nicons = 0 ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_clear_icons",pwindow) ; - return (0) ; - } - - if( dirname && (int)strlen(dirname) > 0 ) { - - pname = Xw_get_filename(dirname,"ifd") ; - - if( pname ) ficon = fopen(pname,"r") ; - - if( !ficon ) { - /*ERROR*Bad ICON File Directory Name */ - Xw_set_error(100,"Xw_clear_icons",pname) ; - return (0) ; - } - -#ifndef PRO16753 - Xw_free(pname) ; -#endif - /* READ Icon File Directory */ - while( !feof(ficon) ) { - skip = False ; - status = fscanf(ficon,"%s%c",filename,&lf) ; - if( filename[0] == '#' ) { - while( lf != '\n' ) status = fscanf(ficon,"%c",&lf) ; - skip = True ; - } else if( lf != '\n' ) { - status = fscanf(ficon,"%s%c",iconname,&lf) ; - while( lf != '\n' ) status = fscanf(ficon,"%c",&lf) ; - if( iconname[0] == '#' ) { - fprintf(stderr,"*Xw_load_icons*Unimplemented Default Icon Name %s\n", - filename); - } - } else { - skip = True ; - } - - if( ferror(ficon) ) break ; - - if( skip ) continue ; - - Xw_del_icon(pwindow,iconname); - - } - - fclose(ficon) ; - } else if( pwindow->other ) { - for( piconinfo=(XW_EXT_ICON*) pwindow->other ; piconinfo ; - piconinfo=qiconinfo ) { - qiconinfo = (XW_EXT_ICON*) piconinfo->link; - nicons++; - if( piconinfo->pname ) Xw_free(piconinfo->pname); - if( piconinfo->pfile ) Xw_free(piconinfo->pfile); - if( piconinfo->pixmap ) XFreePixmap(_DISPLAY,piconinfo->pixmap); - if( piconinfo->pimage ) Xw_close_image(piconinfo->pimage); - Xw_free(piconinfo); - } - pwindow->other = NULL; - } - - if( nicons && ShowIconBox == 'Y' ) Xw_show_icons(pwindow) ; - -#ifdef TRACE_CLEAR_ICONS -if( Xw_get_trace() ) { - if( dirname ) - printf (" %d = Xw_clear_icons(%lx,'%s')\n",nicons,(long ) awindow,dirname); - else - printf (" %d = Xw_clear_icons(%lx,NULL)\n",nicons,(long ) awindow); -} -#endif - - return (nicons) ; -} - -#ifdef XW_PROTOTYPE -static Aspect_Handle Xw_create_icon_pixmap (XW_EXT_WINDOW* pwindow,int width,int height,XW_EXT_IMAGEDATA *pimage) -#else -static Aspect_Handle Xw_create_icon_pixmap ( pwindow,width,height,pimage) -XW_EXT_WINDOW* pwindow ; -int width ; -int height ; -XW_EXT_IMAGEDATA *pimage; -#endif /*XW_PROTOTYPE*/ -{ -XImage *pximage = (_ZIMAGE) ? _ZIMAGE : _IIMAGE ; -Pixmap pixmap ; -int iwidth = pximage->width ; -int iheight = pximage->height ; -int wx,wy,ix,iy ; -int error,gravity ; -char *serror; - - if( width == 0 ) width = iwidth ; - wx = (width - iwidth)/2 ; ix = 0 ; - if( wx < 0 ) { - ix = -wx ; wx = 0 ; iwidth = width ; - } - - if( height == 0 ) height = iheight ; - wy = (height - iheight)/2 ; iy = 0 ; - if( wy < 0 ) { - iy = -wy ; wy = 0 ; iheight = height ; - } - - Xw_print_error(); - if( !Xw_get_trace() ) Xw_set_synchronize(_DISPLAY,True) ; - pixmap = XCreatePixmap(_DISPLAY,_WINDOW,width,height,_DEPTH) ; - if( !Xw_get_trace() ) Xw_set_synchronize(_DISPLAY,False) ; - - serror = Xw_get_error(&error,&gravity); - if( !pixmap || (error > 1000) ) { - Xw_set_error(104,"Xw_create_icon_pixmap",0) ; - return (0) ; - } - - if( wx > 0 || wy > 0 ) { - XFillRectangle(_DISPLAY,pixmap,pwindow->qgwind.gccopy, - 0,0,width,height) ; - } - - XPutImage(_DISPLAY,pixmap,pwindow->qgwind.gccopy, - pximage,ix,iy,wx,wy,iwidth,iheight) ; - -#ifdef PRO16753 - XFlush(_DISPLAY); -#endif - - -#ifdef TRACE_CREATE_ICON_PIXMAP -if( Xw_get_trace() ) { - printf (" %lx = Xw_create_icon_pixmap(%lx,%d,%d,%lx)\n", - (long ) pixmap,(long ) pwindow,width,height,(long ) pimage); -} -#endif - - return pixmap ; -} - -#ifdef XW_PROTOTYPE -Aspect_Handle Xw_get_icon_pixmap (void* awindow,int width,int height,char* filename) -#else -Aspect_Handle Xw_get_icon_pixmap ( awindow,width,height,filename) -void* awindow ; -int width ; -int height ; -char* filename ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_ICON *piconinfo ; -//XW_STATUS status ; -char iconname[256]; -char *piconname = filename; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_icon_pixmap",pwindow) ; - return (0) ; - } - - if( !filename || (int)strlen(filename) <= 0 ) { - /*ERROR*Bad Icon Name*/ - Xw_set_error(103,"Xw_get_icon_pixmap",filename) ; - return (0) ; - } - /* Get icon directly from the file */ - if( filename[0] == '/' || filename[0] == '$' ) { - char *ps1 = strrchr(filename,'/'); - char *ps2 = strrchr(filename,'.'); - if( !ps1 ) { - /*ERROR*Bad Icon Name*/ - Xw_set_error(103,"Xw_get_icon_pixmap",filename) ; - return (0) ; - } - ps1++; - if( ps2 ) { - int n = min(256,ps2-ps1); - strncpy(iconname,filename,n); - } else { - strcpy(iconname,ps1); - } - piconname = iconname; - } - - if( !(piconinfo = Xw_get_icon(pwindow,piconname)) ) { - /* Add a new icon in icon-box */ - piconinfo = Xw_put_icon(pwindow,piconname); - if( piconinfo ) { - piconinfo->pfile = (char*) strdup(filename); - } else { - return 0; - } - } - - if( !piconinfo->pixmap ) { - XW_EXT_IMAGEDATA *pimage; - if( !piconinfo->pimage ) { - piconinfo->pimage = (XW_EXT_IMAGEDATA*) - Xw_load_image (pwindow,NULL,piconinfo->pfile) ; - } - - if(( pimage = piconinfo->pimage )) { - XImage *pximage = (_ZIMAGE) ? _ZIMAGE : _IIMAGE ; - if( width == 0 ) width = pximage->width ; - if( height == 0 ) height = pximage->height ; - piconinfo->pixmap = - Xw_create_icon_pixmap(pwindow,width,height,piconinfo->pimage) ; - } - } - -#ifdef TRACE_GET_ICON_PIXMAP -if( Xw_get_trace() ) { - printf (" %lx = Xw_get_icon_pixmap(%lx,%d,%d,'%s')\n", - (long ) piconinfo->pixmap,(long ) awindow,width,height,filename); -} -#endif - - return (piconinfo->pixmap) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_get_icon_size (void* awindow,char* iconname,int *width,int *height) -#else -XW_STATUS Xw_get_icon_size ( awindow,iconname,width,height) -void* awindow ; -char* iconname ; -int *width ; -int *height ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_ICON *piconinfo ; -XW_EXT_IMAGEDATA *pimage ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_icon_size",pwindow) ; - return (XW_ERROR) ; - } - - *width = *height = 0; - - if(( piconinfo = Xw_get_icon(pwindow,iconname) )) { - if( !piconinfo->pimage ) { - piconinfo->pimage = (XW_EXT_IMAGEDATA*) - Xw_load_image (pwindow,NULL,piconinfo->pfile) ; - } - - if(( pimage = piconinfo->pimage )) { - *width = _IIMAGE->width ; - *height = _IIMAGE->height ; - } else { - return (XW_ERROR) ; - } - } else { - /*ERROR*Bad Icon Name*/ - Xw_set_error(103,"Xw_get_icon_size",iconname) ; - return (XW_ERROR) ; - } - -#ifdef TRACE_GET_ICON_PIXMAP -if( Xw_get_trace() ) { - printf (" Xw_get_icon_size(%lx,'%s',%d,%d)\n", - (long ) awindow,iconname,*width,*height); -} -#endif - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -char* Xw_get_icon_name (void* awindow,int index) -#else -char* Xw_get_icon_name ( awindow,index) -void* awindow ; -int index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_ICON *piconinfo ; -char *iconname ; -int n ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_get_icon_name",pwindow) ; - return (NULL) ; - } - - for( n=1,piconinfo=(XW_EXT_ICON*) pwindow->other ; piconinfo ; - piconinfo = (XW_EXT_ICON*) piconinfo->link,n++ ) { - if( n == index ) break; - } - - if( !piconinfo ) { - /*ERROR*Bad Icon index*/ - Xw_set_error(106,"Xw_get_icon_name",&index) ; - return (NULL) ; - } - - iconname = piconinfo->pname ; - -#ifdef TRACE_GET_ICON_NAME -if( Xw_get_trace() ) { - printf (" '%s' = Xw_get_icon_name(%lx,%d)\n",iconname,(long ) awindow,index); -} -#endif - - return (iconname) ; -} diff --git a/src/Xw/Xw_load_image.cxx b/src/Xw/Xw_load_image.cxx deleted file mode 100755 index 8b65ccfac8..0000000000 --- a/src/Xw/Xw_load_image.cxx +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -/* - * Modified: zov : 21-Apr-1998 : Reads a BMP/GIF/XWD image from file - * - - XW_EXT_IMAGEDATA* Xw_load_image (awindow,aimageinfo,filename): - XW_EXT_WINDOW *awindow - XW_USERDATA *aimageinfo - char *filename - XWD/BMP/GIF file name - - Get an image from a file named filename. - - Returns the image descriptor address if successful, - or NULL if an error occured. - - Note! - It is strictly recommended to pass the filename with extension. - Otherwise an extension env(CSF_DefaultImageFormat) is appended. - In fact, it doesn't matter what extension has been used, because - file format will be automatically detected. (zov) -*/ - -#define PRO16753 /* GG 261198 -// 1) Don't free pname because this pointer is a -// static address in Xw_get_filename() space. -// 2) open() C function return a int number < 0 -// when the open failed. -*/ - -#include -#ifdef HAVE_CONFIG_H -# include -#endif -#include -#ifdef HAVE_STRINGS_H -# include -#endif - -#ifdef TRACE -#define TRACE_LOAD_IMAGE -#endif - -#ifdef XW_PROTOTYPE -XW_EXT_IMAGEDATA* Xw_load_xwd_image (void*, void*, char*, int, XColor**, int*); -XW_EXT_IMAGEDATA* Xw_load_bmp_image (void*, void*, char*, int, XColor**, int*); -XW_EXT_IMAGEDATA* Xw_load_gif_image (void*, void*, char*, int, XColor**, int*); - -void* Xw_load_image (void *awindow,void *aimageinfo,char *filename) -#else -XW_EXT_IMAGEDATA* Xw_load_xwd_image (); -XW_EXT_IMAGEDATA* Xw_load_bmp_image (); -XW_EXT_IMAGEDATA* Xw_load_gif_image (); - -void* Xw_load_image (awindow,aimageinfo,filename) - void *awindow; - void *aimageinfo; - char *filename ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW *)awindow; - XW_EXT_IMAGEDATA *pimage; - XW_STATUS status; - XColor *pcolors = NULL; - int ncolors = 0, fimage = 0; - // char *wname = NULL, *pname, *pchDefExt, achHeader[8]; - char *pname, *pchDefExt, achHeader[8]; - - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_load_image",pwindow) ; - return (NULL) ; - } - - - /* Append desired extension to the file name if no ext. has been specified */ - pchDefExt = getenv ("CSF_DefaultImageFormat"); - pname = Xw_get_filename (filename,(char*)( pchDefExt? pchDefExt: "xwd")); - - -#ifdef DEBUG - fprintf (stderr, "\r\nXw_load_image: Loading '%s' (extended name: %s)...", - filename, pname? pname: "NULL"); -#endif /*DEBUG*/ - - - /* Open the file - * and detect the image format using signature - */ - if (pname) { - - static int _bFirstTime = 1; - if (_bFirstTime) { - - _bFirstTime = 0; - - if (!pchDefExt) - fprintf (stderr, - "\r\nWarning: variable CSF_DefaultImageFormat is undefined!" - " Assuming 'xwd'.\r\n"); - else if (strlen (pchDefExt) != 3 || - 0 != strcasecmp (pchDefExt, "xwd") - && 0 != strcasecmp (pchDefExt, "bmp") - && 0 != strcasecmp (pchDefExt, "gif")) - fprintf (stderr, - "\r\nWarning: value '%s' of CSF_DefaultImageFormat " - "is incorrect!\r\n", pchDefExt); - } - - fimage = open (pname, O_RDONLY); - -#ifndef PRO16753 - Xw_free (pname); -#endif - } - -#ifdef PRO16753 - if( fimage < 0 ) { -#else - if (!fimage) { -#endif - - fprintf (stderr, "\r\nXw_load_image: Error: " - "Can't open file '%s'!", filename); - return (NULL); - } - if (read (fimage, achHeader,sizeof (achHeader)) != sizeof (achHeader)) { - - fprintf (stderr, "\r\nXw_load_image: Error: " - "Can't read file '%s' to determine format!", filename); - close(fimage); - return (NULL); - } - - lseek (fimage, 0, SEEK_SET); - - - /* - * Detect file format; then load the image - * and obtain array of colors used - */ - if (0 == strncmp (achHeader, "GIF87a", 6)) - pimage = Xw_load_gif_image (pwindow, aimageinfo, filename, - fimage, &pcolors, &ncolors); - else if (0 == strncmp (achHeader, "GIF89a", 6)) { - - fprintf (stderr, - "\r\nXw_load_image: Warning: GIF89a format specified (file %s).", - filename); - pimage = Xw_load_gif_image (pwindow, aimageinfo, filename, - fimage, &pcolors, &ncolors); - } - else if (0 == strncmp (achHeader, "BM", 2)) - pimage = Xw_load_bmp_image (pwindow, aimageinfo, filename, - fimage, &pcolors, &ncolors); - else /* Then it must be XWD */ - pimage = Xw_load_xwd_image (pwindow, aimageinfo, filename, - fimage, &pcolors, &ncolors); - - close (fimage); - - - if (! pimage) { - - fprintf (stderr, "\r\nXw_load_image: Error: Failed to read %s!", - filename); - close(fimage); - return (NULL); - } - - - /* Color relocation: - * Converse image to what the window format supports. - */ - status = Xw_convert_image (pwindow, pimage, pcolors, ncolors); - - if (pcolors) - Xw_free(pcolors); - - if( status == XW_ERROR ) { - Xw_del_imagedata_structure (pimage) ; - return (NULL) ; - } - - -#ifdef TRACE_LOAD_IMAGE - if( Xw_get_trace() ) { - printf (" %lx = Xw_load_image(%lx,'%s')\n",(long ) pimage,(long ) pwindow,filename); - } -#endif - return (pimage); -} diff --git a/src/Xw/Xw_load_xwd_image.cxx b/src/Xw/Xw_load_xwd_image.cxx deleted file mode 100755 index 6a874cbbb1..0000000000 --- a/src/Xw/Xw_load_xwd_image.cxx +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -/* - * Created: zov : 17-Apr-1998 : Loads XWD image from file - * Note: Adapted from Xw_load_image.c - * - - XW_EXT_IMAGEDATA* Xw_load_xwd_image (awindow,aimageinfo,fimage,ppcolors,pncolors) - XW_EXT_WINDOW *awindow - XW_USERDATA *aimageinfo - XColor **ppcolors - address of pointer to array of used colors to return - int *pncolors - address of a variable to return length of the array in - - Gets an image from a file. - Note, that the file must be XWD formatted. - - Returns the image descriptor address if successful; or NULL if failed. -*/ - -#include -#include - - -#define SWAPTEST (*(char*)&swaptest) -static unsigned long swaptest = 1; - -static void SwapLong (register char* bp,register unsigned n) -/* - Swap long ints depending on CPU -*/ -{ - register char c; - register char *ep = bp + n; - register char *sp; - - while (bp < ep) { - sp = bp + 3; - c = *sp; - *sp = *bp; - *bp++ = c; - sp = bp + 1; - c = *sp; - *sp = *bp; - *bp++ = c; - bp += 2; - } -} - -static void SwapShort (register char* bp, register unsigned n) -/* - Swap short ints depending on CPU -*/ -{ - register char c; - register char *ep = bp + n; - - while (bp < ep) { - c = *bp; - *bp = *(bp + 1); - bp++; - *bp++ = c; - } -} - -XW_EXT_IMAGEDATA* Xw_load_xwd_image (void *awindow,void *aimageinfo,char *filename,int fimage, - XColor **ppcolors, int *pncolors) -{ -// XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW *)awindow; - XW_EXT_IMAGEDATA *pimage; -// XW_STATUS status; - XWDFileHeader *pheader; - XImage *pximage; - XColor *pcolors = NULL; - char *wname = NULL, *pidata; - int i, isize; - - - isize = sizeof (XWDFileHeader); - if (!(pheader = (_xwd_file_header*) Xw_malloc (isize))) { - /*ERROR*Bad Image allocation*/ - Xw_set_error (60,"Xw_load_xwd_image",0) ; - return (NULL) ; - } - - if (read(fimage,pheader,isize) != isize) { - /*ERROR*Unable to read XWD file header*/ - Xw_set_error (56,"Xw_load_xwd_image",filename); - Xw_free (pheader); - return (NULL); - } - - if (SWAPTEST) SwapLong ((char*) pheader, isize); - - /* Is it XWD file format ? */ - if (pheader->file_version != XWD_FILE_VERSION) { - /*ERROR*Bad XWD file format*/ - Xw_set_error (57,"Xw_load_xwd_image",filename); - Xw_free (pheader); - return (NULL); - } - - if (pheader->header_size < (unsigned int ) isize) { - /*ERROR*Bad XWD file format*/ - Xw_set_error (57,"Xw_load_xwd_image",filename); - Xw_free (pheader); - return (NULL); - } - - /* Check for image format */ - if (pheader->pixmap_format != ZPixmap) { - /*ERROR*Bad XWD Pixmap format*/ - Xw_set_error (58,"Xw_load_xwd_image",filename); - Xw_free (pheader); - return (NULL); - } - - /* Read a window name */ - isize = pheader->header_size - isize ; - if (isize > 0) { - - if (! (wname = (char*) Xw_malloc(isize))) { - /*ERROR*Bad Image allocation*/ - Xw_set_error(60,"Xw_load_xwd_image",0); - Xw_free(pheader); - return (NULL); - } - - if(read (fimage, wname, isize) != isize) { - /*ERROR*Unable to read Image data*/ - Xw_set_error(61,"Xw_load_xwd_image",filename) ; - Xw_free (wname); - Xw_free (pheader); - return (NULL) ; - } - } - - /* Allocate the Image structure */ - if (! (pximage = (XImage*) Xw_malloc(sizeof(XImage)))) { - /*ERROR*Bad Image allocation*/ - Xw_set_error(60,"Xw_load_xwd_image",0); - if (wname) Xw_free(wname); - Xw_free(pheader) ; - return (NULL); - } - - if (pheader->ncolors > 0) { - /* Allocate the Color Table entries */ - if (! (pcolors = (XColor*) Xw_calloc(pheader->ncolors, sizeof(XColor)))) { - /*ERROR*Bad Image allocation*/ - Xw_set_error (60,"Xw_load_xwd_image",0); - if (wname) Xw_free(wname); - Xw_free (pximage); - Xw_free (pheader); - return (NULL); - } - - /* Read the Color Table entries */ - isize = sizeof(XWDColor) * pheader->ncolors; - if (read (fimage, (char *)pcolors, isize) != isize) { - /*ERROR*Unable to read Image data*/ - Xw_set_error(61,"Xw_load_xwd_image",filename); - if (wname) Xw_free(wname); - Xw_free (pximage); - Xw_free (pcolors); - Xw_free (pheader); - return (NULL) ; - } - - /* 32->64 bits conversion if any*/ - if (sizeof(XColor) > sizeof(XWDColor)) { - XWDColor *qcolors = (XWDColor*) pcolors ; - for( i=pheader->ncolors-1 ; i>=0 ; --i ) { - pcolors[i].pad = qcolors[i].pad; - pcolors[i].flags = qcolors[i].flags; - pcolors[i].blue = qcolors[i].blue; - pcolors[i].green = qcolors[i].green; - pcolors[i].red = qcolors[i].red; - pcolors[i].pixel = qcolors[i].pixel; - } - } - - if (SWAPTEST) { - for (i=0 ; (unsigned int ) incolors ; i++) { - SwapLong((char*) &pcolors[i].pixel,sizeof(long)); - SwapShort((char*) &pcolors[i].red,3*sizeof(short)); - } - } - } /* end if # colors > 0 */ - - - /* Allocate the pixel buffer */ - isize = pheader->bytes_per_line*pheader->pixmap_height; - if (! (pidata = (char *) Xw_malloc(isize))) { - /*ERROR*Bad Image allocation*/ - Xw_set_error (60,"Xw_load_xwd_image",0); - if (wname) Xw_free(wname); - Xw_free (pximage); - if (pcolors) Xw_free(pcolors); - Xw_free(pheader); - return (NULL); - } - - /* Read the pixel buffer */ - if (read (fimage,pidata,isize) != isize) { - /*ERROR*Unable to read Image data*/ - Xw_set_error (61,"Xw_load_xwd_image",filename); - if (wname) Xw_free(wname); - Xw_free (pidata); - Xw_free (pximage); - if (pcolors) Xw_free (pcolors); - Xw_free (pheader); - return (NULL); - } - - - /* Allocate the Extended Image structure */ - if(! (pimage = Xw_add_imagedata_structure(sizeof(XW_EXT_IMAGEDATA)))) { - if (wname) Xw_free(wname); - Xw_free(pidata); - Xw_free(pximage); - if (pcolors) Xw_free(pcolors); - Xw_free(pheader); - return (NULL); - } - - /* Initialize the input image */ - pimage->pimageinfo = aimageinfo; - _IIMAGE = pximage; - _IIMAGE->data = pidata; - _IIMAGE->width = (int) pheader->pixmap_width; - _IIMAGE->height = (int) pheader->pixmap_height; - _IIMAGE->xoffset = (int) pheader->xoffset; - _IIMAGE->format = (int) pheader->pixmap_format; - _IIMAGE->byte_order = (int) pheader->byte_order; - _IIMAGE->bitmap_unit = (int) pheader->bitmap_unit; - _IIMAGE->bitmap_bit_order = (int) pheader->bitmap_bit_order; - _IIMAGE->bitmap_pad = (int) pheader->bitmap_pad; - _IIMAGE->depth = (int) pheader->pixmap_depth; - _IIMAGE->bits_per_pixel = (int) pheader->bits_per_pixel; - _IIMAGE->bytes_per_line = (int) pheader->bytes_per_line; - _IIMAGE->red_mask = pheader->red_mask; - _IIMAGE->green_mask = pheader->green_mask; - _IIMAGE->blue_mask = pheader->blue_mask; - _IIMAGE->obdata = NULL ; - _XInitImageFuncPtrs (_IIMAGE); - - - /* Return array of colors */ - *ppcolors = pcolors; - *pncolors = pheader->ncolors; - - if (wname) Xw_free(wname); - if (pheader) Xw_free(pheader); - - - return (pimage); -} diff --git a/src/Xw/Xw_open_display.cxx b/src/Xw/Xw_open_display.cxx deleted file mode 100755 index f0918decd9..0000000000 --- a/src/Xw/Xw_open_display.cxx +++ /dev/null @@ -1,606 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define TEST /* GG_220998 -// Ne pas detruire ls structure display qui peut etre -// utilisee par plusieurs windows d'ou plantage -// a la destruction (pb de liberation du static destructeur) -*/ - -#define RIC120302 /* GG Add Xw_set_display function to pass -// Display structure directly -// Add Xw_get_display_name function to retrieve -// the display string. -*/ - -#include -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_OPEN_DISPLAY -#define TRACE_CLOSE_DISPLAY -#define TRACE_GET_DISPLAY -#define TRACE_GET_DISPLAY_NAME -#define TRACE_SET_DISPLAY -#endif - -/* - - XW_EXT_DISPLAY* Xw_open_display(displayname) - - char *displayname ; Display Name must be "NODE:[:]server.screen" - or NULL if default screen. - Return the ext display address corresponding to the required displayname - or NULL if name is wrong or Display is protected - - XW_EXT_DISPLAY* Xw_get_display(connexion) - - char *connexion ; Display Name must be "NODE:[:]server.screen" - or NULL if default screen. - Return the ext display address corresponding to the required displayname - or NULL if Display is no more open - - char* Xw_get_display_name(adisplay) - - XW_EXT_DISPLAY* adisplay ; - - Returns the display name. - - - XW_EXT_DISPLAY* Xw_set_display(vdisplay) - - Display* vdisplay ; Display structure pointer. - Return the ext display address corresponding to the required displayname - or NULL if vdisplay is NULL - - XW_STATUS Xw_close_display(adisplay) - - XW_EXT_DISPLAY* adisplay ; - - Close ALL ressources attached to this display - - int Xw_get_plane_layer(adisplay,visualid); - - XW_EXT_DISPLAY* adisplay - int visualid - - Returns the plane layer ID from the Visual ID. - -*/ - -#ifdef XW_PROTOTYPE -int Xw_get_plane_layer(void* adisplay,int visualid) -#else -int Xw_get_plane_layer(adisplay,visualid) -void* adisplay; -int visualid; -#endif /*XW_PROTOTYPE*/ -/* - GETS the plane layer ID from visual ID -*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*) adisplay ; -static Atom oatom = 0; -int layer = 0; - - if( !oatom ) { - oatom = XInternAtom(_DDISPLAY, "SERVER_OVERLAY_VISUALS", True); - } - if( oatom ) { - unsigned long nitem,left; - int aformat; - Status status; - union { - unsigned char *string; - XOverlayVisualInfo *oinfo; - } prop; - Atom aatom; - status = XGetWindowProperty(_DDISPLAY, _DROOT, - oatom, 0, 100, False, - AnyPropertyType, &aatom, &aformat, - &nitem, &left, &prop.string); - nitem /= 4; - if( (status == Success) && (aformat == 32) && (nitem > 0) ) { - int i; - for( i=0 ; (unsigned int ) i < nitem ; i++ ) { - if( prop.oinfo[i].overlay_visual == visualid ) { - layer = prop.oinfo[i].layer; - break; - } - } - } - } else if( pdisplay->server == XW_SERVER_IS_SUN ) { - int mOptCode,fEvent,fError; - if( XQueryExtension(_DDISPLAY,"SUN_OVL",&mOptCode,&fEvent,&fError) ) { - if( visualid == 0x2a ) layer = 1; - } - } - - return layer; -} - -extern int Xw_error_handler() ; - -#ifdef XW_PROTOTYPE -void* Xw_open_display(char* connexion) -#else -void* Xw_open_display(connexion) -char *connexion ; -#endif /*XW_PROTOTYPE*/ -/* - OPEN the display and - Return the display address corresponding to the required displayname - or NULL if name is wrong or Display is protected -*/ -{ -XW_EXT_DISPLAY *pdisplay ; -//XW_STATUS status ; -char *vendor ; - - pdisplay = (XW_EXT_DISPLAY*) Xw_get_display(connexion) ; - - if( !pdisplay ) { - pdisplay = Xw_add_display_structure(sizeof(XW_EXT_DISPLAY)) ; - } - - if( !pdisplay ) return (NULL) ; - - if( !_DDISPLAY ) { - _DDISPLAY = XOpenDisplay(connexion) ; - if( _DDISPLAY ) { - vendor = ServerVendor(_DDISPLAY) ; - if( !strncmp(vendor,"DEC",3) ) - pdisplay->server = XW_SERVER_IS_DEC ; - else if( !strncmp(vendor,"Sil",3) ) - pdisplay->server = XW_SERVER_IS_SGI ; - else if( !strncmp(vendor,"Sun",3) ) - pdisplay->server = XW_SERVER_IS_SUN ; - else if( !strncmp(vendor,"Hew",3) ) - pdisplay->server = XW_SERVER_IS_HP ; - else pdisplay->server = XW_SERVER_IS_UNKNOWN ; - pdisplay->gname = (char*)strdup(connexion) ; - - _DSCREEN = DefaultScreenOfDisplay(_DDISPLAY) ; - _DVISUAL = DefaultVisualOfScreen(_DSCREEN) ; - _DCOLORMAP = DefaultColormapOfScreen(_DSCREEN) ; - _DROOT = RootWindowOfScreen(_DSCREEN) ; - _DWIDTH = WidthOfScreen(_DSCREEN) ; - _DHEIGHT = HeightOfScreen(_DSCREEN) ; - _DGC = DefaultGCOfScreen(_DSCREEN) ; - XSetFunction(_DDISPLAY,_DGC,GXxor) ; - - if( Xw_get_trace() > 0 ) { - Xw_set_synchronize(_DDISPLAY,True) ; - } else { - Xw_set_synchronize(_DDISPLAY,False) ; - XSetErrorHandler(Xw_error_handler) ; - } - -#ifdef TRACE_OPEN_DISPLAY -if( Xw_get_trace() ) { - printf (" Xw_Server_Vendor is '%s' on Display '%s->%s'\n", - vendor,connexion,DisplayString(_DDISPLAY)); - printf(" Xw_ProtocolVersion is %d,Revision is %d\n", - ProtocolVersion(_DDISPLAY),ProtocolRevision(_DDISPLAY)); -} -#endif - } else { - /*ERROR*Bad Display connexion*/ - Xw_set_error(66,"Xw_open_display",connexion) ; - Xw_del_display_structure(pdisplay) ; - pdisplay = NULL ; - } - } - -#ifdef TRACE_OPEN_DISPLAY -if( Xw_get_trace() ) { - printf (" %lx = Xw_open_display('%s')\n",(long ) pdisplay,connexion) ; -} -#endif - - return (pdisplay) ; -} - -/*RIC120302*/ -#ifdef XW_PROTOTYPE -char* Xw_get_display_name(void* adisplay) -#else -char* Xw_get_display_name(aDisplay) -void* adisplay; -#endif /*XW_PROTOTYPE*/ -/* - Retrieve the display name -*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; -char *connexion; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_get_display_name",pdisplay) ; - return (NULL) ; - } - - connexion = DisplayString(_DDISPLAY); - -#ifdef TRACE_GET_DISPLAY_NAME -if( Xw_get_trace() ) { - printf (" '%s' = Xw_get_display_name(%x)\n", connexion, (long ) pdisplay) ; -} -#endif - return connexion; -} - -#ifdef XW_PROTOTYPE -void* Xw_set_display(void *vdisplay) -#else -void* Xw_open_display(vdisplay) -void *vdisplay ; -#endif /*XW_PROTOTYPE*/ -/* - REGISTER the display and - Return the ext display address - or NULL if the vdisplay is wrong -*/ -{ -XW_EXT_DISPLAY *pdisplay ; -//XW_STATUS status ; -char *vendor,*connexion ; - - if( !vdisplay ) return (NULL) ; - - connexion = DisplayString((Display*)vdisplay); - pdisplay = (XW_EXT_DISPLAY*) Xw_get_display(connexion) ; - - if( !pdisplay ) { - pdisplay = Xw_add_display_structure(sizeof(XW_EXT_DISPLAY)) ; - } - - if( !pdisplay ) return (NULL) ; - - if( !_DDISPLAY ) { - _DDISPLAY = (Display*)vdisplay ; - vendor = ServerVendor(_DDISPLAY) ; - if( !strncmp(vendor,"DEC",3) ) - pdisplay->server = XW_SERVER_IS_DEC ; - else if( !strncmp(vendor,"Sil",3) ) - pdisplay->server = XW_SERVER_IS_SGI ; - else if( !strncmp(vendor,"Sun",3) ) - pdisplay->server = XW_SERVER_IS_SUN ; - else if( !strncmp(vendor,"Hew",3) ) - pdisplay->server = XW_SERVER_IS_HP ; - else pdisplay->server = XW_SERVER_IS_UNKNOWN ; - pdisplay->gname = (char*)strdup(connexion) ; - - _DSCREEN = DefaultScreenOfDisplay(_DDISPLAY) ; - _DVISUAL = DefaultVisualOfScreen(_DSCREEN) ; - _DCOLORMAP = DefaultColormapOfScreen(_DSCREEN) ; - _DROOT = RootWindowOfScreen(_DSCREEN) ; - _DWIDTH = WidthOfScreen(_DSCREEN) ; - _DHEIGHT = HeightOfScreen(_DSCREEN) ; - _DGC = DefaultGCOfScreen(_DSCREEN) ; - XSetFunction(_DDISPLAY,_DGC,GXxor) ; - - if( Xw_get_trace() > 0 ) { - Xw_set_synchronize(_DDISPLAY,True) ; - } else { - Xw_set_synchronize(_DDISPLAY,False) ; - XSetErrorHandler(Xw_error_handler) ; - } - -#ifdef TRACE_SET_DISPLAY -if( Xw_get_trace() ) { - printf (" Xw_Server_Vendor is '%s' on Display '%s->%s'\n", - vendor,connexion,DisplayString(_DDISPLAY)); - printf(" Xw_ProtocolVersion is %d,Revision is %d\n", - ProtocolVersion(_DDISPLAY),ProtocolRevision(_DDISPLAY)); -} -#endif - } - -#ifdef TRACE_SET_DISPLAY -if( Xw_get_trace() ) { - printf (" %lx = Xw_set_display(%x = '%s')\n", - (long ) pdisplay,vdisplay,connexion) ; -} -#endif - - return (pdisplay) ; -} -/*RIC120302*/ - -static XW_EXT_DISPLAY *PdisplayList = NULL ; - -#ifdef XW_PROTOTYPE -void* Xw_get_display(char* uname) -#else -void* Xw_get_display(uname) -char *uname ; -#endif /*XW_PROTOTYPE*/ -/* - Return the display address corresponding to the required displayname - or NULL if Display is no more open -*/ -{ -XW_EXT_DISPLAY *pdisplay ; - - for( pdisplay=PdisplayList ; pdisplay ; - pdisplay = (XW_EXT_DISPLAY*) pdisplay->link ) { - if( pdisplay->display ) { - if( !uname || !strlen(uname) || - !strcmp(pdisplay->gname,uname) ) break ; - } - } - - return (pdisplay) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_display(void* adisplay) -#else -XW_STATUS Xw_close_display(adisplay) -void *adisplay ; -#endif /*XW_PROTOTYPE*/ -/* - Close the Display -*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*)adisplay ; - - if( !Xw_isdefine_display(pdisplay) ) { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error(96,"Xw_close_display",pdisplay) ; - return (XW_ERROR) ; - } - - if( !pdisplay ) { - while( Xw_del_display_structure(NULL) ) ; - } else { -#ifndef TEST - Xw_del_display_structure(pdisplay) ; -#endif - } - -#ifdef TRACE_CLOSE_DISPLAY -if( Xw_get_trace() ) { - printf (" Xw_close_display(%lx)\n",(long ) pdisplay) ; -} -#endif - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -void Xw_set_synchronize(Display* display,int state) -#else -void Xw_set_synchronize(display,state) -Display *display ; -int state ; -#endif /*XW_PROTOTYPE*/ -/* - Set Synchronization on display or ALL display if NULL -*/ -{ -XW_EXT_DISPLAY *pdisplay ; -//int i,sync = (state > 0) ? True : False ; -int sync = (state > 0) ? True : False ; - - if( display ) { - XSynchronize(display,sync) ; - } else { - for( pdisplay=PdisplayList ; pdisplay ; - pdisplay = (XW_EXT_DISPLAY*) pdisplay->link) { - XSynchronize(_DDISPLAY,sync) ; - } - } -} - -#ifdef XW_PROTOTYPE -XW_EXT_DISPLAY* Xw_add_display_structure(int size) -#else -XW_EXT_DISPLAY* Xw_add_display_structure(size) -int size ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert one Extended display structure in the - EXtended Display List - - returns Extended display address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_DISPLAY *pdisplay = (XW_EXT_DISPLAY*) Xw_malloc(size) ; - - if( pdisplay ) { - pdisplay->type = DISPLAY_TYPE ; - pdisplay->link = PdisplayList ; - pdisplay->display = NULL ; - pdisplay->screen = NULL ; - pdisplay->visual = NULL ; - pdisplay->colormap = 0 ; - pdisplay->rootwindow = 0 ; - pdisplay->grabwindow = 0 ; - pdisplay->gamma = 0. ; - pdisplay->gname = NULL ; - PdisplayList = pdisplay ; - } else { - /*ERROR*EXT_DISPLAY allocation failed*/ - Xw_set_error(94,"Xw_add_display_structure",0) ; - } - - return (pdisplay) ; -} - -#ifdef XW_PROTOTYPE -XW_EXT_DISPLAY* Xw_get_display_structure(Display *display) -#else -XW_EXT_DISPLAY* Xw_get_display_structure(display) -Display *display ; -#endif /*XW_PROTOTYPE*/ -/* - Return the Extended display address corresponding to the required - Display Id or NULL if not found -*/ -{ -XW_EXT_DISPLAY *pdisplay = PdisplayList ; - - while (pdisplay) { - if( _DDISPLAY == display ) { - break ; - } - pdisplay = (XW_EXT_DISPLAY*) pdisplay->link ; - } - - return (pdisplay) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_display_structure(XW_EXT_DISPLAY* pdisplay) -#else -XW_STATUS Xw_del_display_structure(pdisplay) -XW_EXT_DISPLAY *pdisplay; -#endif /*XW_PROTOTYPE*/ -/* - Remove the Extended display address or the next from the Extended List - and Free the Extended Display - - returns ERROR if the display address is not Found in the list - or NO more Display exist - returns SUCCESS if successful -*/ -{ -XW_EXT_DISPLAY *qdisplay = PdisplayList ; -//int i ; - - if( !qdisplay ) return (XW_ERROR) ; - - if( pdisplay == qdisplay ) { - PdisplayList = (XW_EXT_DISPLAY*) pdisplay->link ; - } else if( !pdisplay ) { - if( !PdisplayList ) return (XW_ERROR) ; - pdisplay = PdisplayList ; - PdisplayList = (XW_EXT_DISPLAY*) PdisplayList->link ; - } else { - for( ; qdisplay ; qdisplay = (XW_EXT_DISPLAY*) qdisplay->link ) { - if( qdisplay->link == pdisplay ) { - qdisplay->link = pdisplay->link ; - break ; - } - } - } -#ifdef BUG - if( _DDISPLAY ) XCloseDisplay(_DDISPLAY) ; -#endif - - if( pdisplay->gname ) Xw_free(pdisplay->gname); - Xw_free(pdisplay) ; - - return (XW_SUCCESS) ; -} - -#ifndef Xw_malloc -void* Xw_malloc(size) -int size ; -/* - Dynamic Memory allocation of char size -*/ -{ -void *address ; - - address = malloc(size) ; - - return (address) ; -} -#endif - -#ifndef Xw_calloc -void* Xw_calloc(length,size) -int length,size ; -/* - Dynamic Memory allocation of char length*size and set memory to 0 -*/ -{ -void *address ; - - address = calloc(length,size) ; - - return (address) ; -} -#endif - -#ifndef Xw_free -void Xw_free(address) -void *address ; -/* - Free Dynamic memory -*/ -{ - free(address) ; -} -#endif - -#ifdef XW_PROTOTYPE -void Xw_longcopy (register long* from,register long* to,register unsigned n) -#else -void Xw_longcopy (from,to,n) - register long *from,*to ; - register unsigned n; -#endif -/* - Copy long from to ... -*/ -{ - while ( n ) { - *to++ = *from++ ; - --n ; - } -} - -#ifdef XW_PROTOTYPE -void Xw_shortcopy (register short* from,register short* to,register unsigned n) -#else -void Xw_shortcopy (from,to,n) - register short *from,*to ; - register unsigned n; -#endif -/* - Copy short from to ... -*/ -{ - while ( n ) { - *to++ = *from++ ; - --n ; - } -} - -#ifdef XW_PROTOTYPE -void Xw_bytecopy (register char* from,register char* to,register unsigned n) -#else -void Xw_bytecopy (from,to,n) - register char *from,*to ; - register unsigned n; -#endif -/* - Copy byte from to ... -*/ -{ - while ( n ) { - *to++ = *from++ ; - --n ; - } -} diff --git a/src/Xw/Xw_open_image.cxx b/src/Xw/Xw_open_image.cxx deleted file mode 100755 index ac0e8ecbe2..0000000000 --- a/src/Xw/Xw_open_image.cxx +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_OPEN_IMAGE -#endif - -/* - XW_EXT_IMAGEDATA Xw_open_image (awindow,aimageinfo,width,height): - XW_EXT_WINDOW *awindow ; - XW_USERDATA *aimageinfo ; Image identifier - int width,height Image size in pixels - - Open an Image in the same Window visual as defined - NOTE than this image can be filled with Xw_put_pixel - - Returns The image extension address if Successful - returns NULL if BadAllocation - - XW_STATUS Xw_close_image (aimage): - XW_EXT_IMAGEDATA *aimage Extended Image address - - Close an Image - - returns SUCCESS always - - XW_EXT_IMAGEDATA* Xw_get_image_handle (awindow,aimageinfo): - XW_EXT_WINDOW *awindow ; - XW_USERDATA aimageinfo Image identifier - - returns the Image handle associated to the image ID - or NULL if no image exist. - -*/ - -#ifdef XW_PROTOTYPE -void* Xw_open_image (void *awindow,void *aimageinfo,int width,int height) -#else -void* Xw_open_image (awindow,aimageinfo,width,height) -void *awindow ; -void *aimageinfo ; -int width,height ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_IMAGEDATA *pimage ; -XW_EXT_COLORMAP *pcolormap ; -//int i,pad ; -int pad = 0; -char *cdata = NULL; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_open_image",pwindow) ; - return (NULL) ; - } - - switch (_DEPTH) { - case 8 : - pad = 1 ; - break ; - case 12 : - case 16 : - pad = 2 ; - break ; - case 24 : - pad = 4 ; - break ; - case 48 : - case 64 : - pad = 8 ; - break ; - default : - /*ERROR*Unimplemented Image Visual depth*/ - Xw_set_error(64,"Xw_open_image",&_DEPTH) ; - return (NULL) ; - } - - if( !(cdata = (char*) Xw_calloc(width*height,pad)) ) { - /*ERROR*XImage Allocation failed*/ - Xw_set_error(60,"Xw_open_image",0) ; - return (NULL) ; - } - - if( !(pimage = Xw_add_imagedata_structure(sizeof(XW_EXT_IMAGEDATA))) ) { - Xw_free(cdata); - return (NULL) ; - } - - pimage->pimageinfo = aimageinfo ; - pimage->pcolormap = pcolormap = _COLORMAP ; - _IIMAGE = XCreateImage(_CDISPLAY,_CVISUAL,_DEPTH, - ZPixmap,0,cdata,width,height,pad*8,width*pad) ; - if( !_IIMAGE ) { - /*ERROR*XImage Creation failed*/ - Xw_set_error(62,"Xw_open_image",0) ; - Xw_del_imagedata_structure(pimage) ; - } - -#ifdef TRACE_OPEN_IMAGE -if( Xw_get_trace() ) { - printf (" %lx = Xw_open_image(%lx,%lx,%d,%d)\n",(long ) pimage,(long ) pwindow,(long ) aimageinfo, - width,height); -} -#endif - - return (pimage); -} - -static XW_EXT_IMAGEDATA *PimageList =NULL ; - -#ifdef XW_PROTOTYPE -XW_EXT_IMAGEDATA* Xw_add_imagedata_structure(int size) -#else -XW_EXT_IMAGEDATA* Xw_add_imagedata_structure(size) -int size ; -#endif /*XW_PROTOTYPE*/ -/* - Create and Insert one Extended image structure in the - EXtended image List - - returns Extended image address if successful - or NULL if Bad Allocation -*/ -{ -XW_EXT_IMAGEDATA *pimage ; -//int i ; - - pimage = (XW_EXT_IMAGEDATA*) Xw_malloc(size) ; - - if( pimage ) { - pimage->type = IMAGE_TYPE ; - pimage->link = PimageList ; - PimageList = pimage ; - pimage->pcolormap = NULL ; - pimage->zoom = 1.; - pimage->pximage = NULL ; - pimage->zximage = NULL ; - pimage->maxwindow = 0 ; - } else { - /*ERROR*EXT_IMAGE allocation failed*/ - Xw_set_error(27,"Xw_open_image",0) ; - } - - return (pimage) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_image (void* aimage) -#else -XW_STATUS Xw_close_image (aimage) -void *aimage; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*) aimage ; - - Xw_del_imagedata_structure(pimage) ; - -#ifdef TRACE_CLOSE_IMAGE -if( Xw_get_trace() ) { - printf (" Xw_close_image(%x)\n",pimage); -} -#endif - - return (XW_SUCCESS); -} - -#ifdef XW_PROTOTYPE -void* Xw_get_image_handle (void* awindow,void *aimageinfo) -#else -void* Xw_get_image_handle (awindow,aimageinfo) -void *awindow ; -void *aimageinfo ; -#endif /*XW_PROTOTYPE*/ -{ -#ifdef TRACE_OPEN_IMAGE -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -#endif -XW_EXT_IMAGEDATA *pimage ; - - for( pimage = PimageList ; pimage ; - pimage = (XW_EXT_IMAGEDATA*) pimage->link ) { - if( pimage->pimageinfo == aimageinfo ) break ; - } - -#ifdef TRACE_OPEN_IMAGE -if( Xw_get_trace() ) { - printf (" %lx = Xw_get_image_handle(%lx,%lx)\n",(long ) pimage,(long ) pwindow,(long ) aimageinfo); -} -#endif - - return (pimage) ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_del_imagedata_structure(XW_EXT_IMAGEDATA *aimage) -#else -XW_STATUS Xw_del_imagedata_structure(aimage) -XW_EXT_IMAGEDATA *aimage; -#endif /*XW_PROTOTYPE*/ -/* - Remove the Extended image address from the Extended List and - Free the Extended Image - - returns ERROR if the image address is not Found in the list - returns XW_SUCCESS if successful -*/ -{ -XW_EXT_IMAGEDATA *pimage = aimage ; -//int i ; - - if( !pimage ) return (XW_ERROR) ; - - if( pimage->maxwindow ) --pimage->maxwindow ; - - if( pimage->maxwindow ) { - return (XW_ERROR) ; - } else { - if( _IIMAGE ) XDestroyImage(_IIMAGE) ; - if( _ZIMAGE ) XDestroyImage(_ZIMAGE) ; - if( pimage == PimageList ) { - PimageList = (XW_EXT_IMAGEDATA*) pimage->link ; - } else { - for( pimage = PimageList ; pimage ; - pimage = (XW_EXT_IMAGEDATA*) pimage->link ) { - if( pimage->link == aimage ) { - pimage->link = aimage->link ; - break ; - } - } - } - Xw_free(aimage) ; - } - return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_open_pixmap.cxx b/src/Xw/Xw_open_pixmap.cxx deleted file mode 100755 index 85d7bf47ad..0000000000 --- a/src/Xw/Xw_open_pixmap.cxx +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#ifdef HAVE_X11_EXTENSIONS_MULTIBUF_H -# include -#endif - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_OPEN_PIXMAP -#define TRACE_OPEN_BACKGROUND_PIXMAP -#define TRACE_CLOSE_PIXMAP -#define TRACE_CLOSE_BACKGROUND_PIXMAP -#endif - -/* - XW_STATUS Xw_open_pixmap (awindow) - XW_EXT_WINDOW *awindow - - Open a DoubleBuffer PIXMAP depending of the Window size - - returns ERROR if NO More PIXMAP is available on this Window - returns SUCCESS if successful - - XW_STATUS Xw_open_background_pixmap (awindow) - XW_EXT_WINDOW *awindow - - Open a Background PIXMAP depending of the Window size - - returns ERROR if NO More PIXMAP is available on this Window - returns SUCCESS if successful - - XW_STATUS Xw_close_pixmap (awindow) - XW_EXT_WINDOW *awindow - - Close the DoubleBuffer PIXMAP attached to this Window - - returns ERROR if NO More PIXMAP exist - returns SUCCESS if successful - - XW_STATUS Xw_close_background_pixmap (awindow) - XW_EXT_WINDOW *awindow - - Close the Background PIXMAP attached to this Window - - returns ERROR if NO More PIXMAP exist - returns SUCCESS if successful -*/ - -static char SetDoubleBuffer = '\0' ; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_open_pixmap (void *awindow) -#else -XW_STATUS Xw_open_pixmap (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_DISPLAY *pdisplay = pwindow->connexion; -int error,gravity ; -char svalue[4] ; -XW_STATUS status = XW_ERROR; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_open_pixmap",pwindow) ; - return (XW_ERROR) ; - } - - if( SetDoubleBuffer == '\0' ) { - SetDoubleBuffer = 'U' ; - if( Xw_get_env("Xw_SET_DOUBLE_BUFFER",svalue,sizeof(svalue)) ) { - if( strlen(svalue) ) { - SetDoubleBuffer = svalue[0] ; - } - printf(" Xw_SET_DOUBLE_BUFFER is '%c'\n",SetDoubleBuffer) ; - } - } - - if( (SetDoubleBuffer == 'B') && - (pdisplay->server == XW_SERVER_IS_SUN) && (_DEPTH != 24) ) { - SetDoubleBuffer = 'P'; /* BUG sur SUN */ - /*WARNING*MultiBufferingExtension is not accessible here*/ - Xw_set_error(126,"Xw_open_pixmap",pwindow) ; - } - -#ifndef HAVE_X11_EXTENSIONS_MULTIBUF_H - if( SetDoubleBuffer == 'B' ) { - SetDoubleBuffer = 'P'; /* MULTIBUF unavailable under SGI IRIX 6.5 */ - /*WARNING*MultiBufferingExtension is not accessible here*/ - Xw_set_error(126,"Xw_open_pixmap",pwindow) ; - } -#else - if( SetDoubleBuffer == 'B' ) { - if( _NWBUFFER == 0 ) { - int mOptCode,fEvent,fError,maxmono,maxstereo ; - XmbufBufferInfo *pmono,*pstereo ; - if( XQueryExtension(_DISPLAY,"Multi-Buffering", - &mOptCode,&fEvent,&fError) && - XmbufGetScreenInfo(_DISPLAY,_WINDOW, - &maxmono,&pmono,&maxstereo,&pstereo) ) { - _NWBUFFER = XmbufCreateBuffers(_DISPLAY,_WINDOW,2, - MultibufferUpdateActionUntouched, - MultibufferUpdateHintFrequent, - &_FWBUFFER) ; - } - if( _NWBUFFER == 2 ) { - XFillRectangle(_DISPLAY,_BWBUFFER,pwindow->qgwind.gcclear, - 0,0,_WIDTH,_HEIGHT) ; - } else { - if( _NWBUFFER > 0 ) XmbufDestroyBuffers(_DISPLAY,_WINDOW) ; - _NWBUFFER = 0 ; - _BWBUFFER = 0 ; - _FWBUFFER = 0 ; - } - SetDoubleBuffer = 'P'; - /*WARNING*MultiBufferingExtension is not accessible here*/ - Xw_set_error(126,"Xw_open_pixmap",pwindow) ; - } - } -#endif - - if( (SetDoubleBuffer == 'U') || - (SetDoubleBuffer == 'Y') || - (SetDoubleBuffer == 'P') ) { - if( !_PIXMAP ) { - Xw_print_error(); - if( !Xw_get_trace() ) Xw_set_synchronize(_DISPLAY,True) ; - _PIXMAP = XCreatePixmap(_DISPLAY,_WINDOW,_WIDTH,_HEIGHT,_DEPTH) ; - if( !Xw_get_trace() ) Xw_set_synchronize(_DISPLAY,False) ; - - Xw_get_error(&error,&gravity); - if( _PIXMAP && (error < 1000) ) { - XFillRectangle(_DISPLAY,_PIXMAP,pwindow->qgwind.gcclear, - 0,0,_WIDTH,_HEIGHT) ; - } else { - /*ERROR*DISABLE Double Buffer*/ - _PIXMAP = 0 ; - Xw_set_error(71,"Xw_open_pixmap",0) ; - } - } - } - - if( _PIXMAP || _NWBUFFER ) status = XW_SUCCESS; - -#ifdef TRACE_OPEN_PIXMAP -if( Xw_get_trace() ) { - printf(" %d = Xw_open_pixmap(%lx)\n",status,(long ) pwindow) ; -} -#endif - - return (status); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_pixmap (void *awindow) -#else -XW_STATUS Xw_close_pixmap (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_open_pixmap",pwindow) ; - return (XW_ERROR) ; - } - -#ifdef HAVE_X11_EXTENSIONS_MULTIBUF_H - if( _NWBUFFER > 0 ) XmbufDestroyBuffers(_DISPLAY,_WINDOW) ; -#endif - if( _PIXMAP ) XFreePixmap(_DISPLAY,_PIXMAP) ; - XFlush(_DISPLAY) ; - _PIXMAP = 0 ; - _NWBUFFER = 0 ; - _BWBUFFER = 0 ; - _FWBUFFER = 0 ; - _DRAWABLE = _WINDOW ; - -#ifdef TRACE_CLOSE_PIXMAP -if( Xw_get_trace() ) { - printf(" Xw_close_pixmap(%lx)\n",(long ) pwindow) ; -} -#endif - - return XW_SUCCESS ; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_open_background_pixmap (void *awindow) -#else -XW_STATUS Xw_open_background_pixmap (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -int error,gravity ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_open_background_pixmap",pwindow) ; - return (XW_ERROR) ; - } - - if( _BPIXMAP ) Xw_close_background_pixmap(awindow) ; - - Xw_print_error(); - if( !Xw_get_trace() ) Xw_set_synchronize(_DISPLAY,True) ; - _BPIXMAP = XCreatePixmap(_DISPLAY,_WINDOW,_WIDTH,_HEIGHT,_DEPTH) ; - if( !Xw_get_trace() ) Xw_set_synchronize(_DISPLAY,False) ; - - Xw_get_error(&error,&gravity); - if( !_BPIXMAP || (error >= 1000) ) { - /*ERROR*DISABLE Double Buffer*/ - _BPIXMAP = 0 ; - Xw_set_error(71,"Xw_open_background_pixmap",0) ; - return (XW_ERROR) ; - } - - XFillRectangle(_DISPLAY,_BPIXMAP,pwindow->qgwind.gcclear,0,0,_WIDTH,_HEIGHT); - -#ifdef TRACE_OPEN_BACKGROUND_PIXMAP -if( Xw_get_trace() ) { - printf(" Xw_open_background_pixmap(%lx)\n",(long ) pwindow) ; -} -#endif - - return (XW_SUCCESS); -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_close_background_pixmap (void *awindow) -#else -XW_STATUS Xw_close_background_pixmap (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_close_background_pixmap",pwindow) ; - return (XW_ERROR) ; - } - - if( _BPIXMAP ) { - XFreePixmap(_DISPLAY,_BPIXMAP) ; - XFlush(_DISPLAY) ; - _BPIXMAP = 0 ; - } else { - return (XW_ERROR) ; - } - -#ifdef TRACE_CLOSE_BACKGROUND_PIXMAP -if( Xw_get_trace() ) { - printf(" Xw_close_background_pixmap(%lx)\n",(long ) pwindow) ; -} -#endif -return (XW_SUCCESS) ; -} diff --git a/src/Xw/Xw_open_window.cxx b/src/Xw/Xw_open_window.cxx deleted file mode 100755 index 1b3c089f13..0000000000 --- a/src/Xw/Xw_open_window.cxx +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#include -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_OPEN_WINDOW -#define TRACE_OPEN_DISPLAY -#endif - -/* - Aspect_Handle Xw_open_window (adisplay,class,parent,sxc,syc, - swidth,sheight,title,istransparent): - XW_EXT_DISPLAY *adisplay Extended Display structure - Xw_TypeOfVisual class ; must be one of : - Xw_TOV_STATICGRAY, - Xw_TOV_GRAYSCALE, - Xw_TOV_STATICCOLOR, - Xw_TOV_PSEUDOCOLOR, - Xw_TOV_TRUECOLOR, - Xw_TOV_DIRECTCOLOR, - Xw_TOV_DEFAULT - Xw_TOV_PREFERRED_PSEUDOCOLOR, - Xw_TOV_PREFERRED_TRUECOLOR - Aspect_Handle parent ; Parent Window (ROOT if 0) - - float sxc,syc ; Window center position in [0,1] space - float swidth,sheight Window size in [0,1] space - char *title ; Banner Title NULL if default. - int istransparent TRUE for transparent window - - Create the window depending of the requested visual class - on the specified display name - - returns XW_ERROR if Display string or Visual class is wrong - returns his ID if successful . - -*/ - -#define BORDER 0 - -#ifdef XW_PROTOTYPE -Aspect_Handle Xw_open_window (void* adisplay, - Xw_TypeOfVisual aclass, - Aspect_Handle parent, - float sxc, - float syc, - float swidth, - float sheight, - char* title, - int istransparent) -#else -Aspect_Handle Xw_open_window (adisplay, aclass, parent, sxc, syc, swidth, sheight, title, istransparent) -void *adisplay; -Xw_TypeOfVisual aclass; -Aspect_Handle parent; -float sxc, syc, swidth, sheight; -char *title; -int istransparent; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY* pdisplay = (XW_EXT_DISPLAY* )adisplay; -Window window; -XSetWindowAttributes wattr; -unsigned long mask = 0; - - if (!Xw_isdefine_display (pdisplay)) - { - /*ERROR*Bad EXT_DISPLAY Address*/ - Xw_set_error (96, "Xw_open_window", pdisplay); - return (0) ; - } - - if (swidth <= 0.0 || sheight <= 0.0) - { - /*ERROR*Coordinate must be in [0,1] space*/ - Xw_set_error (91, "Xw_open_window", 0); - return (0); - } - - XVisualInfo* ginfo = Xw_get_visual_info (pdisplay, aclass); - if (!ginfo) return (0); - - Standard_Integer aParentSizeX, aParentSizeY; - if (parent) - { - XWindowAttributes attributes; - if( !XGetWindowAttributes(_DDISPLAY, parent, &attributes)) - { - /*ERROR*Bad Window Attributes*/ - Xw_set_error (54, "Xw_open_window", &parent); - return (0); - } - aParentSizeX = attributes.width; - aParentSizeY = attributes.height; - wattr.override_redirect = True ; mask |= CWOverrideRedirect; - } - else - { - parent = _DROOT; - aParentSizeX = _DWIDTH; - aParentSizeY = _DHEIGHT; - } - Standard_Integer aPxLeft, aPxTop, aPxWidth, aPxHeight; - Aspect_Convert::ConvertCoordinates (aParentSizeX, aParentSizeY, - sxc, syc, swidth, sheight, - aPxLeft, aPxTop, aPxWidth, aPxHeight); - Aspect_Convert::FitIn (aParentSizeX, aParentSizeY, - aPxLeft, aPxTop, aPxWidth, aPxHeight); - - wattr.event_mask = ExposureMask | StructureNotifyMask; - mask |= CWEventMask; - wattr.backing_store = NotUseful; - mask |= CWBackingStore; - wattr.border_pixel = WhitePixel (_DDISPLAY, DefaultScreen (_DDISPLAY)); - mask |= CWBorderPixel; - if (!istransparent) - { - wattr.background_pixel = BlackPixel (_DDISPLAY, DefaultScreen (_DDISPLAY)); - mask |= CWBackPixel; - } - wattr.colormap = XCreateColormap (_DDISPLAY, parent, - ginfo->visual, AllocNone); - mask |= CWColormap ; - - window = XCreateWindow (_DDISPLAY, parent, - aPxLeft, aPxTop, aPxWidth, aPxHeight, BORDER, - ginfo->depth, InputOutput, ginfo->visual, - mask, &wattr); - - if (window && (parent == _DROOT)) - { - XSizeHints hints; - hints.x = aPxLeft; hints.y = aPxTop; hints.flags = PPosition; - hints.width = aPxWidth; hints.height = aPxHeight; hints.flags |= PSize; - XSetStandardProperties (_DDISPLAY, window, title, title, None, - NULL, 0, &hints); - } - - XFree ((char* )ginfo); - XFlush (_DDISPLAY); - -#ifdef TRACE_OPEN_WINDOW - if (Xw_get_trace()) - { - printf (" %lx = Xw_open_window(%lx,%d,%f,%f,%f,%f,'%s')\n", - (long )window, (long )adisplay, aclass, sxc, syc, swidth, sheight, title); - } -#endif - return (window); -} diff --git a/src/Xw/Xw_put_background_image.cxx b/src/Xw/Xw_put_background_image.cxx deleted file mode 100755 index d53ad72984..0000000000 --- a/src/Xw/Xw_put_background_image.cxx +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_PUT_BACKGROUND_IMAGE -#define TRACE_CLEAR_BACKGROUND_IMAGE -#endif - -#define OCC153 // bad memory management - -/* - STATUS Xw_put_background_image (awindow,image,method): - XW_EXT_WINDOW *awindow - XW_EXT_IMAGEDATA *image Image structure - Aspect_FillMethod method Image fill method - - Draw an image to the window background according to the fill method. - - returns ERROR if NO Image is defined - returns SUCCESS if successful - - STATUS Xw_clear_background_image (awindow): - XW_EXT_WINDOW *awindow - - Clear the window background image - - returns SUCCESS allways - - STATUS Xw_update_background_image(awindow) - XW_EXT_WINDOW *awindow - - Updates the window background from an image - according to the window size and fill method - - returns SUCCESS if successful - - - STATUS Xw_set_background_pixmap(awindow,apixmap) - XW_EXT_WINDOW *awindow - Pixmap apixmap - - Updates the window background from a user pixmap - - - returns SUCCESS if successful - - STATUS Xw_get_background_pixmap(awindow,apixmap) - XW_EXT_WINDOW *awindow - Pixmap *apixmap - - Returns the current background pixmap coming from - an image or a user pixmap -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_put_background_image (void* awindow,void* aimage,Aspect_FillMethod method) -#else -XW_STATUS Xw_put_background_image (awindow,aimage,method) -void *awindow; -void *aimage ; -Aspect_FillMethod method; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*) aimage ; -XW_STATUS status ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_put_background_image",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_image(pimage) ) { - /*ERROR*Bad EXT_IMAGEDATA Address*/ - Xw_set_error(25,"Xw_put_background_image",pimage) ; - return (XW_ERROR) ; - } - -#ifdef OCC153 - if( _BIMAGE ) - { - if (_BIMAGE != pimage) - { - Xw_close_image(_BIMAGE); - _BIMAGE = pimage; - } - } - else - { - _BIMAGE = pimage; - } -#else - if( _BIMAGE ) Xw_close_image(_BIMAGE); - _BIMAGE = pimage; -#endif - _BMETHOD = method; - - status = Xw_update_background_image(pwindow); - -#ifdef TRACE_PUT_BACKGROUND_IMAGE -if( Xw_get_trace() ) - printf (" Xw_put_background_image(%lx,%lx)\n",(long ) pwindow,(long ) pimage) ; -#endif - - return status; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_clear_background_image (void* awindow) -#else -XW_STATUS Xw_clear_background_image (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; - - if( _BIMAGE ) { - Xw_close_image( _BIMAGE ); - _BIMAGE = NULL; - } - - if( _BPIXMAP ) { - XFreePixmap(_DISPLAY,_BPIXMAP) ; - _BPIXMAP = 0 ; - } - - XSetWindowBackgroundPixmap(_DISPLAY,_WINDOW,0) ; - - Xw_erase_window(pwindow) ; - -#ifdef TRACE_CLEAR_BACKGROUND_IMAGE -if( Xw_get_trace() ) { - printf (" Xw_clear_background_image(%lx)\n",(long ) pwindow) ; -} -#endif - - return XW_SUCCESS; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_update_background_image(void* awindow) -#else -XW_STATUS Xw_update_background_image(awindow) -void *awindow; -#endif -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_IMAGEDATA *pimage = _BIMAGE; -XW_STATUS status; -int ix,iy,iwidth,iheight,wx,wy; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_update_background_image",pwindow) ; - return (XW_ERROR) ; - } - - if( !pimage ) return XW_ERROR; - - ix = iy = wx = wy = 0 ; - iwidth = _IIMAGE->width; - iheight = _IIMAGE->height; - XImage *pximage = _IIMAGE ; - if( _BMETHOD == Aspect_FM_NONE ) { - if( iwidth > _WIDTH ) { - iwidth = _WIDTH; - } - if( iheight > _HEIGHT ) { - iheight = _HEIGHT; - } - } else if( _BMETHOD == Aspect_FM_CENTERED ) { - wx = (_WIDTH - iwidth)/2; - if( wx < 0 ) { ix = -wx; wx = 0; iwidth = _WIDTH; } - wy = (_HEIGHT - iheight)/2; - if( wy < 0 ) { iy = -wy; wy = 0; iheight = _HEIGHT; } - } else if( _BMETHOD == Aspect_FM_STRETCH ) { - float zoom = 1.; - if( iwidth != _WIDTH ) { - zoom = (float)_WIDTH/iwidth; - iwidth *= (int)zoom; iheight *= (int)zoom; - } - if( iheight != _HEIGHT ) { - zoom *= (float)_HEIGHT/iheight; - iwidth *= (int)zoom; iheight *= (int)zoom; - } - if( _ZIMAGE && (zoom == pimage->zoom) ) { - pximage = _ZIMAGE; - } else { - status = Xw_zoom_image(pimage,zoom); - if( status ) { - iwidth = _ZIMAGE->width; - iheight = _ZIMAGE->height; - wx = (_WIDTH - iwidth)/2; - if( wx < 0 ) { ix = -wx; wx = 0; iwidth = _WIDTH; } - wy = (_HEIGHT - iheight)/2; - if( wy < 0 ) { iy = -wy; wy = 0; iheight = _HEIGHT; } - pximage = _ZIMAGE; - } - } - } - - if( _BPIXMAP ) Xw_close_background_pixmap(pwindow) ; - - status = Xw_open_background_pixmap(pwindow) ; - if( !status ) return (XW_ERROR) ; - - if( _BMETHOD != Aspect_FM_TILED ) { - XPutImage(_DISPLAY,_BPIXMAP,pwindow->qgwind.gccopy, - pximage,ix,iy,wx,wy,iwidth,iheight) ; - } else { - for( wy=0 ; wy<_HEIGHT ; wy += iheight ) { - for( wx=0 ; wx<_WIDTH ; wx += iwidth ) { - XPutImage(_DISPLAY,_BPIXMAP,pwindow->qgwind.gccopy, - pximage,ix,iy,wx,wy,iwidth,iheight) ; - } - } - } - XSetWindowBackgroundPixmap(_DISPLAY,_WINDOW,_BPIXMAP) ; - - Xw_erase_window(pwindow) ; - -#ifdef TRACE_PUT_BACKGROUND_IMAGE - if( Xw_get_trace() ) - printf (" Xw_update_background_image(%lx)\n",(long ) pwindow) ; -#endif - - return (XW_SUCCESS); -} - -#ifdef XW_PROTOTYPE - XW_STATUS Xw_set_background_pixmap( void * awindow, Aspect_Handle apixmap ) -#else - XW_STATUS Xw_set_background_pixmap( awindow, apixmap ) - void * awindow; - Aspect_Handle apixmap; -#endif -{ - XW_EXT_WINDOW * pwindow = ( XW_EXT_WINDOW * ) awindow; - - if ( !Xw_isdefine_window( pwindow ) ) { - Xw_set_error( 24, "Xw_set_background_pixmap", pwindow ); - return( XW_ERROR ); - } - - if ( !apixmap ) return XW_ERROR; - - if( _BIMAGE ) { - Xw_close_image(_BIMAGE); - _BIMAGE = NULL; - } - - if( _BPIXMAP ) XFreePixmap( _DISPLAY, _BPIXMAP ); - - _BPIXMAP = apixmap; - - XSetWindowBackgroundPixmap( _DISPLAY,_WINDOW,_BPIXMAP); - - Xw_erase_window(pwindow) ; - - return( XW_SUCCESS ); - -#ifdef TRACE_PUT_BACKGROUND_IMAGE - if( Xw_get_trace() ) - printf (" Xw_update_background_image(%lx)\n",(long ) pwindow) ; -#endif -} - -#ifdef XW_PROTOTYPE - XW_STATUS Xw_get_background_pixmap( void * awindow, Aspect_Handle& apixmap ) -#else - XW_STATUS Xw_get_background_pixmap( awindow, apixmap ) - void * awindow; - Aspect_Handle& apixmap; -#endif -{ - XW_EXT_WINDOW * pwindow = ( XW_EXT_WINDOW * ) awindow; - - if ( !Xw_isdefine_window( pwindow ) ) { - Xw_set_error( 24, "Xw_get_background_pixmap", pwindow ); - return( XW_ERROR ); - } - - if ( !_BPIXMAP ) return( XW_ERROR ); - - apixmap = _BPIXMAP; - - return ( XW_SUCCESS ); -} diff --git a/src/Xw/Xw_put_pixel.cxx b/src/Xw/Xw_put_pixel.cxx deleted file mode 100755 index e3d348185c..0000000000 --- a/src/Xw/Xw_put_pixel.cxx +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -/* -#define TRACE_PUT_PIXEL -*/ -#endif - -/* - XW_STATUS Xw_put_pixel (aimage,x,y,index,npixel): - XW_EXT_IMAGEDATA *aimage - int x,y Pixel position - int index Pixel color index - int npixel Pixel number to fill with the same color index - - Fill an existing IMAGE created by Xw_open_image from Pixel index - - returns XW_ERROR if Extended Image is not defined - or Color is not defined - or Pixel position is wrong (Outside of image) - returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_put_pixel (void *aimage,int x,int y,int index,int npixel) -#else -XW_STATUS Xw_put_pixel (aimage,x,y,index,npixel) -void *aimage ; -int x,y,index,npixel ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*) aimage ; -register union { - char *data ; - unsigned char *cdata ; - unsigned short *sdata ; - unsigned long *ldata ; -} data ; -unsigned long lpixel ; -register int np ; -int fpixel,epixel,simage ; -XImage *pximage; - - if( !Xw_isdefine_image(pimage) ) { - /*ERROR*Bad EXT_IMAGEDATA Address*/ - Xw_set_error(25,"Xw_put_pixel",pimage) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_color(_ICOLORMAP,index) ) { - /*ERROR*Bad Defined Color at index*/ - Xw_set_error(41,"Xw_put_pixel",&index) ; - return (XW_ERROR) ; - } - - pximage = (_ZIMAGE) ? _ZIMAGE : _IIMAGE; - simage = pximage->height*pximage->width ; - fpixel = x*pximage->width + y ; - epixel = fpixel + npixel - 1 ; - - if( x < 0 || y < 0 || (epixel >= simage) ) { - /*WARNING*Bad PIXEL position*/ - Xw_set_error(47,"Xw_put_pixel",&simage) ; - return (XW_ERROR) ; - } - - lpixel = _ICOLORMAP->pixels[index] ; - switch (pximage->bitmap_pad) { - case 8 : - { register unsigned char cpixel = (unsigned char) lpixel ; - data.data = pximage->data + (fpixel) ; - for( np=npixel ; np ; --np ) *data.cdata++ = cpixel ; - } - break ; - case 16 : - { register unsigned short spixel = (unsigned short) lpixel ; - data.data = pximage->data + (fpixel<<1) ; - for( np=npixel ; np ; --np ) *data.sdata++ = spixel ; - } - break ; - case 32 : - data.data = pximage->data + (fpixel<<2) ; - for( np=npixel ; np ; --np ) *data.ldata++ = lpixel ; - } - -#ifdef TRACE_PUT_PIXEL - printf (" Xw_put_pixel(%x,%d,%d,%d,%d)\n", - pimage,x,y,index,npixel) ; -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_put_rgbpixel.cxx b/src/Xw/Xw_put_rgbpixel.cxx deleted file mode 100755 index e30da512f6..0000000000 --- a/src/Xw/Xw_put_rgbpixel.cxx +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -/* -#define TRACE_PUT_RGBPIXEL -*/ -#endif - -/* - XW_STATUS Xw_put_rgbpixel (aimage,x,y,r,g,b,npixel): - XW_EXT_IMAGEDATA image *aimage - int x,y Pixel position - float r,g,b Pixel color index - int npixel Pixel number to fill with the same color index - - Fill an existing IMAGE created by Xw_open_image with R,G,B values - - returns XW_ERROR if Extended Image is not defined - or VISUAL Image class is not TRUECOLOR - or Pixel position is wrong (Outside of image) - returns XW_SUCCESS if successful - -*/ -#ifdef XW_PROTOTYPE -XW_STATUS Xw_put_rgbpixel (void *aimage,int x,int y,float r,float g,float b,int npixel) -#else -XW_STATUS Xw_put_rgbpixel (aimage,x,y,r,g,b,npixel) -void *aimage ; -int x,y,npixel ; -float r,g,b ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*)aimage; -XW_EXT_COLORMAP *pcolormap = pimage->pcolormap; -union { - char *data ; - unsigned char *cdata ; - unsigned short *sdata ; - unsigned long *ldata ; -} data ; -int fpixel,lpixel,simage,index,isapproximate ; -register int np ; -unsigned long pixel ; -XW_STATUS status ; -XImage *pximage; - - if( !Xw_isdefine_image(pimage) ) { - /*ERROR*Bad EXT_IMAGEDATA Address*/ - Xw_set_error(25,"Xw_put_rgbpixel",pimage) ; - return (XW_ERROR) ; - } - - switch ( _CCLASS ) { - case TrueColor : - status = Xw_get_color_pixel(_ICOLORMAP,r,g,b,&pixel,&isapproximate) ; - break ; - - case PseudoColor : - status = Xw_get_color_index(_ICOLORMAP,r,g,b,&index) ; - pixel = _ICOLORMAP->pixels[index] ; - break ; - - default : - /*ERROR*Unimplemented Visual class*/ - Xw_set_error(5,"Xw_put_rgbpixel",&_CCLASS) ; - return (XW_ERROR) ; - } - - pximage = (_ZIMAGE) ? _ZIMAGE : _IIMAGE; - simage = pximage->height*pximage->width ; - fpixel = x*pximage->width + y ; - lpixel = fpixel + npixel - 1 ; - - if( x < 0 || y < 0 || (lpixel >= simage) ) { - /*WARNING*Bad PIXEL position*/ - Xw_set_error(47,"Xw_put_rgbpixel",&simage) ; - return (XW_ERROR) ; - } - - switch (pximage->bitmap_pad) { - case 8 : - data.data = pximage->data + (fpixel) ; - for( np=npixel ; np ; --np ) - *data.cdata++ = (unsigned char) pixel ; - break ; - case 16 : - data.data = pximage->data + (fpixel<<1) ; - for( np=npixel ; np ; --np ) - *data.sdata++ = (unsigned short) pixel ; - break ; - case 32 : - data.data = pximage->data + (fpixel<<2) ; - for( np=npixel ; np ; --np ) - *data.ldata++ = (unsigned long) pixel ; - } - -#ifdef TRACE_PUT_RGBPIXEL - printf (" Xw_put_rgbpixel(%x,%d,%d,%f,%f,%f,%d)\n", - pimage,x,y,r,g,b,npixel) ; -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_resize_window.cxx b/src/Xw/Xw_resize_window.cxx deleted file mode 100755 index 29ecfc2453..0000000000 --- a/src/Xw/Xw_resize_window.cxx +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_RESIZE_WINDOW -#endif - -/* - Aspect_TypeOfResize Xw_resize_window (awindow) - XW_EXT_WINDOW *awindow - - returns TypeOfResize method ,can be : -*/ - -#ifdef XW_PROTOTYPE -XW_RESIZETYPE Xw_resize_window (void *awindow) -#else -XW_RESIZETYPE Xw_resize_window (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -int xc,yc,width,height ; -XW_WINDOWSTATE state ; -XW_DOUBLEBUFFERMODE dbmode ; -XW_STATUS status ; -XW_RESIZETYPE mode = XW_TOR_UNKNOWN ; -int xleft,ytop,xright,ybottom,mask = 0 ; - - state = Xw_get_window_position(pwindow,&xc,&yc,&width,&height) ; - - if( state != XW_ICONIFY ) { - /* Get Border Resize method */ - xleft = xc - width/2 ; - xright = xc + width/2 ; - ytop = yc - height/2 ; - ybottom = yc + height/2 ; - - if( abs(xleft - pwindow->axleft) > 2 ) mask |= 1 ; - if( abs(xright - pwindow->axright) > 2 ) mask |= 2 ; - if( abs(ytop - pwindow->aytop) > 2 ) mask |= 4 ; - if( abs(ybottom - pwindow->aybottom) > 2 ) mask |= 8 ; - - switch (mask) { - case 0 : - mode = XW_NO_BORDER ; - break ; - case 1 : - mode = XW_LEFT_BORDER ; - break ; - case 2 : - mode = XW_RIGHT_BORDER ; - break ; - case 4 : - mode = XW_TOP_BORDER ; - break ; - case 5 : - mode = XW_LEFT_AND_TOP_BORDER ; - break ; - case 6 : - mode = XW_TOP_AND_RIGHT_BORDER ; - break ; - case 8 : - mode = XW_BOTTOM_BORDER ; - break ; - case 9 : - mode = XW_BOTTOM_AND_LEFT_BORDER ; - break ; - case 10 : - mode = XW_RIGHT_AND_BOTTOM_BORDER ; - break ; - default : - mode = XW_TOR_UNKNOWN ; - break ; - } - - pwindow->axleft = xleft ; - pwindow->axright = xright ; - pwindow->aytop = ytop ; - pwindow->aybottom = ybottom ; - - } - - if( mode != XW_NO_BORDER ) { - dbmode = Xw_get_double_buffer(pwindow) ; - _DRAWABLE = 0 ; - if( _PIXMAP || _NWBUFFER > 0 ) Xw_close_pixmap(awindow) ; - status = Xw_set_double_buffer(pwindow,dbmode) ; - } - -#ifdef TRACE_RESIZE_WINDOW -if( Xw_get_trace() ) { - printf(" %d = Xw_resize_window(%lx)\n",mode,(long ) pwindow) ; -} -#endif - - return (mode); -} diff --git a/src/Xw/Xw_restore_area.cxx b/src/Xw/Xw_restore_area.cxx deleted file mode 100755 index 1ec9036f0a..0000000000 --- a/src/Xw/Xw_restore_area.cxx +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_RESTORE_AREA -#endif - -/* - STATUS Xw_restore_area (awindow,px,py,pwidth,pheight): - XW_EXT_WINDOW *awindow - int px,py area center given in PIXELS - int pwidth,pheight area size given in PIXELS - - Redraw the window area from the attached pixmap - - returns XW_ERROR if NO attached pixmap exist or - area is out of window - returns XW_SUCCESS if successful -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_restore_area (void *awindow, - int px,int py,int pwidth,int pheight) -#else -XW_STATUS Xw_restore_area (awindow,px,py,pwidth,pheight) -void *awindow; -int px,py,pwidth,pheight ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -//XGCValues gc_values ; -//int function,color,mask = 0 ; -//unsigned long planemask,hcolor ; - - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_restore_area",pwindow) ; - return (XW_ERROR) ; - } - - if( (px + pwidth/2) < 0 || (px - pwidth/2) > _WIDTH || - (py + pheight/2) < 0 || (py - pheight/2) > _HEIGHT ) { - /*WARNING*Bad AREA position*/ - Xw_set_error(68,"Xw_restore_area",0) ; - return (XW_ERROR) ; - } - - px -= pwidth/2 ; py -= pheight/2 ; - XFlush(_DISPLAY) ; - if( _NWBUFFER > 0 ) { - XCopyArea(_DISPLAY,_BWBUFFER,_FWBUFFER,pwindow->qgwind.gccopy, - px,py,pwidth,pheight,px,py) ; - } else if( _PIXMAP ) { - XCopyArea(_DISPLAY,_PIXMAP,_WINDOW,pwindow->qgwind.gccopy, - px,py,pwidth,pheight,px,py) ; - } else return (XW_ERROR) ; - - XFlush(_DISPLAY) ; - -#ifdef TRACE_RESTORE_AREA -if( Xw_get_trace() ) { - printf (" Xw_restore_area(%lx,%d,%d,%d,%d)\n", - (long ) pwindow,px,py,pwidth,pheight) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_restore_window.cxx b/src/Xw/Xw_restore_window.cxx deleted file mode 100755 index 0c92cf7600..0000000000 --- a/src/Xw/Xw_restore_window.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_RESTORE_WINDOW -#endif - -/* - XW_STATUS Xw_restore_window (awindow): - XW_EXT_WINDOW *awindow - - Redraw the window from the attched pixmap - - returns XW_ERROR if NO attached pixmap exist - returns XW_SUCCESS if successful -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_restore_window (void *awindow) -#else -XW_STATUS Xw_restore_window (awindow) -void *awindow; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -//XGCValues gc_values ; -//int function,color,mask = 0 ; -//unsigned long planemask,hcolor ; - - XFlush(_DISPLAY) ; - if( _NWBUFFER > 0 ) { - XCopyArea(_DISPLAY,_BWBUFFER,_FWBUFFER,pwindow->qgwind.gccopy, - 0,0,_WIDTH,_HEIGHT,0,0) ; - } else if( _PIXMAP ) { - XCopyArea(_DISPLAY,_PIXMAP,_WINDOW,pwindow->qgwind.gccopy, - 0,0,_WIDTH,_HEIGHT,0,0) ; - } else return (XW_ERROR) ; - - XFlush(_DISPLAY) ; - -#ifdef TRACE_RESTORE_WINDOW -if( Xw_get_trace() ) { - printf (" Xw_restore_window(%lx)\n",(long ) pwindow) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_save_image.cxx b/src/Xw/Xw_save_image.cxx deleted file mode 100755 index f759c3c166..0000000000 --- a/src/Xw/Xw_save_image.cxx +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -/* - * Modified: zov : 17-Apr-1998 : Saves an image as .BMP, .GIF or .XWD file - * - - XW_STATUS Xw_save_image (awindow,aimage,filename): - XW_EXT_WINDOW *awindow - XW_EXT_IMAGEDATA *aimage - char *filename XWD Image name - - Saves an image to an XWD, BMP or GIF file depending on given filename. - - returns SUCCESS if successfull; - otherwise returns ERROR - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#include -#ifdef HAVE_STRINGS_H -# include -#endif - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_save_image_adv (Display *aDisplay,Window aWindow,XWindowAttributes aWinAttr,XImage *aPximage,Colormap aColormap,int aNcolors,char *filename) -#else -XW_STATUS Xw_save_image_adv (aDisplay,aWindow,aWinAttr,aPximage,aColormap,aNcolors,filename) -Display *aDisplay; -Window aWindow; -XWindowAttributes aWinAttr; -XImage *aPximage; -Colormap aColormap; -int ncolors; -char *filename; -#endif /*XW_PROTOTYPE*/ -{ - if (aWinAttr.visual->c_class != TrueColor) - { - std::cerr << "Visual Type not supported!"; - return XW_ERROR; - } - - const bool isBigEndian = (aPximage->byte_order == MSBFirst); - Image_PixMap::ImgFormat aFormat = (aPximage->bits_per_pixel == 32) - ? (isBigEndian ? Image_PixMap::ImgRGB32 : Image_PixMap::ImgBGR32) - : (isBigEndian ? Image_PixMap::ImgRGB : Image_PixMap::ImgBGR); - Image_PixMap aWrapper; - aWrapper.InitWrapper (aFormat, (Standard_Byte* )aPximage->data, aPximage->width, aPximage->height, aPximage->bytes_per_line); - aWrapper.SetTopDown (true); - - Image_AlienPixMap anAlienImage; - return (anAlienImage.InitCopy (aWrapper) && anAlienImage.Save (filename)) ? XW_SUCCESS : XW_ERROR; -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_save_image (void *awindow,void *aimage,char *filename) -#else -XW_STATUS Xw_save_image (awindow,aimage,filename) -void *awindow; -void *aimage; -char *filename ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW* pwindow = (XW_EXT_WINDOW* )awindow; - if (!Xw_isdefine_window (pwindow)) - { // ERROR Bad EXT_WINDOW Address - Xw_set_error (24, "Xw_save_image", pwindow); - return (XW_ERROR); - } - - XW_EXT_IMAGEDATA* pimage = (XW_EXT_IMAGEDATA* )aimage; - if (!Xw_isdefine_image (pimage)) - { // ERROR Bad EXT_IMAGEDATA Address - Xw_set_error (25, "Xw_save_image", pimage); - return (XW_ERROR); - } - - XImage* pximage = (_ZIMAGE) ? _ZIMAGE : _IIMAGE; - return Xw_save_image_adv (_DISPLAY, _WINDOW, _ATTRIBUTES, pximage, - _COLORMAP->info.colormap, _COLORMAP->maxhcolor, - filename); -} diff --git a/src/Xw/Xw_set_background_index.cxx b/src/Xw/Xw_set_background_index.cxx deleted file mode 100755 index f00dd3b742..0000000000 --- a/src/Xw/Xw_set_background_index.cxx +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_BACKGROUND_INDEX -#endif - -/* - XW_STATUS Xw_set_background_index(awindow,index): - XW_EXT_WINDOW *awindow - int index Background Index in the colormap - - Update Background Color index . - - Returns XW_ERROR if Extended Window or Colormap is wrong - or Index is not defined . - Returns XW_SUCCESS if Successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_background_index (void *awindow,int index) -#else -XW_STATUS Xw_set_background_index (awindow,index) -void *awindow; -int index ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -unsigned long backpixel,highpixel ; -int i ; - - if ( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_background_index",pwindow) ; - return (XW_ERROR) ; - } - - if( index >= 0 ) { - if ( !Xw_isdefine_colorindex(_COLORMAP,index) ) { - /*ERROR*Bad Defined Color Index*/ - Xw_set_error(41,"Xw_set_background_index",&index) ; - return (XW_ERROR) ; - } - backpixel = _COLORMAP->pixels[index] ; - _COLORMAP->define[index] = BACKCOLOR ; - } else { - backpixel = _COLORMAP->backpixel ; - } - highpixel = _COLORMAP->highpixel ; - XSetForeground(_DISPLAY, pwindow->qgwind.gccopy, highpixel) ; - highpixel ^= backpixel ; - - XSetWindowBackground (_DISPLAY, _WINDOW, backpixel) ; - XSetBackground(_DISPLAY, pwindow->qgwind.gc, backpixel) ; - XSetBackground(_DISPLAY, pwindow->qgwind.gccopy, backpixel) ; - XSetBackground(_DISPLAY, pwindow->qgwind.gcclear, backpixel) ; - XSetBackground(_DISPLAY, pwindow->qgwind.gchigh, backpixel) ; - XSetForeground(_DISPLAY, pwindow->qgwind.gcclear, backpixel) ; - XSetForeground(_DISPLAY, pwindow->qgwind.gchigh, highpixel) ; - for( i=0 ; iqgline[i].gc, backpixel); - XSetBackground(_DISPLAY, pwindow->qgpoly[i].gc, backpixel); - XSetBackground(_DISPLAY, pwindow->qgtext[i].gc, backpixel); - XSetBackground(_DISPLAY, pwindow->qgmark[i].gc, backpixel); - } - pwindow->backindex = index ; - -#ifdef TRACE_SET_BACKGROUND_INDEX -if( Xw_get_trace() ) { - printf(" Xw_set_background_index(%lx,%d)\n",(long ) pwindow,index) ; -} -#endif - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_set_colormap.cxx b/src/Xw/Xw_set_colormap.cxx deleted file mode 100755 index 49e184e6c9..0000000000 --- a/src/Xw/Xw_set_colormap.cxx +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#define GG012 /*GG_150796 -// Installer correctement la colormap meme sur une fenetre -// dont le visual est TrueColor. -*/ - -#define GG013 /*GG_151096 -// Ne pas chercher a installer la colormap demande -// lorsque les visualid sont differents. -*/ - -#define PRO14951 /*GG_200798 -// Ne pas modifier la couleur du background de la fenetre -*/ - - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_COLORMAP -#endif - -/* - XW_STATUS Xw_set_colormap(awindow,acolormap): - XW_EXT_WINDOW *awindow - XW_EXT_COLORMAP *acolormap - - Set a colormap to an existing window - - Returns XW_ERROR if Bad Visual matching between Window and Colormap - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_colormap (void *awindow,void *acolormap) -#else -XW_STATUS Xw_set_colormap (awindow,acolormap) -void *awindow; -void *acolormap ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_colormap",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_colormap(pcolormap) ) { - /*ERROR*Bad EXT_COLORMAP Address*/ - Xw_set_error(42,"Xw_set_colormap",pcolormap) ; - return (XW_ERROR) ; - } - - if( _CLASS != _CCLASS ) { - /*ERROR*Unmatchable Visual class*/ - Xw_set_error(67,"Xw_set_colormap",&_CCLASS) ; - return (XW_ERROR) ; - } - - _COLORMAP = pcolormap ; - _COLORMAP->maxwindow++ ; - - if( _COLORMAP->info.colormap ) { -#ifdef GG012 - XW_EXT_DISPLAY *pdisplay = pwindow->connexion; - Window *ptree,root,parent,shell = _WINDOW; - unsigned int tcount ; - Colormap colormap = _COLORMAP->info.colormap; - -#ifdef GG013 - if( _COLORMAP->info.visualid != _VISUAL->visualid ) { - colormap = _ATTRIBUTES.colormap; - } -#endif - XSetWindowColormap(_DISPLAY,_WINDOW,colormap) ; - if( _VISUAL->visualid != _DVISUAL->visualid ) { - XInstallColormap(_DISPLAY,colormap); - while( shell ) { /* Find the top level shell window */ - if( XQueryTree(_DISPLAY,shell,&root,&parent,&ptree,&tcount) ) { - if( tcount ) XFree((char*)ptree); - if( root == parent ) break; - shell = parent; - } else break; - } - if( shell ) { - Window *pgetwindows,*psetwindows; - int wcount; - if( XGetWMColormapWindows(_DISPLAY,shell,&pgetwindows,&wcount) ) { - if(( psetwindows = (Window*) Xw_calloc(wcount+1,sizeof(Window)) )) { - int i,j; - for( i=j=0; iinfo.colormap) ; - XSetWMColormapWindows(_DISPLAY,parent,&_WINDOW,1) ; - } -#endif - -#ifndef PRO14951 - Xw_set_background_index(pwindow,pwindow->backindex); -#endif - } - - XFlush(_DISPLAY) ; - -#ifdef TRACE_SET_COLORMAP -if( Xw_get_trace() ) { - printf(" Xw_set_colormap(%lx,%lx)\n",(long ) pwindow,(long ) pcolormap) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_set_double_buffer.cxx b/src/Xw/Xw_set_double_buffer.cxx deleted file mode 100755 index aa15180f2f..0000000000 --- a/src/Xw/Xw_set_double_buffer.cxx +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_DOUBLE_BUFFER -#endif - -/* - XW_STATUS Xw_set_double_buffer (awindow, state) - XW_EXT_WINDOW *awindow - DOUBLEBUFFERMODE state ; - - Sets the double_buffering status of the window . - - returns ERROR if Double Buffering is not XW_ENABLE on this station - returns XW_SUCCESS if successful -*/ - -static char SetDoubleBuffer = '\0' ; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_double_buffer (void *awindow, XW_DOUBLEBUFFERMODE state) -#else -XW_STATUS Xw_set_double_buffer (awindow, state) -void *awindow; -XW_DOUBLEBUFFERMODE state ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_STATUS status = XW_SUCCESS; -char svalue[4] ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_double_buffer",pwindow) ; - return (XW_ERROR) ; - } - - if( SetDoubleBuffer == '\0' ) { - SetDoubleBuffer = 'U' ; - if( Xw_get_env("Xw_SET_DOUBLE_BUFFER",svalue,sizeof(svalue)) ) { - if( strlen(svalue) ) { - SetDoubleBuffer = svalue[0] ; - } - printf(" Xw_SET_DOUBLE_BUFFER is '%c'\n",SetDoubleBuffer) ; - } - } - - if( (SetDoubleBuffer == 'Y') ) { - state = XW_ENABLE ; - } else if( SetDoubleBuffer == 'N' ) { - state = XW_DISABLE ; - } - - if( state == XW_DISABLE ) { - if( _NWBUFFER > 0 ) { - if( _DRAWABLE == _FWBUFFER ) return (XW_SUCCESS); - _DRAWABLE = _FWBUFFER ; - } else { - if( _DRAWABLE == _WINDOW ) return (XW_SUCCESS); - _DRAWABLE = _WINDOW ; - } - } else if( state == XW_ENABLE ) { - if( !_PIXMAP && !_NWBUFFER ) { - status = Xw_open_pixmap(awindow) ; - } - if( _NWBUFFER > 0 ) { - _DRAWABLE = _BWBUFFER ; - } else if( _PIXMAP ) { - _DRAWABLE = _PIXMAP ; - } else { - _DRAWABLE = _WINDOW ; - } - } - -#ifdef TRACE_SET_DOUBLE_BUFFER -if( Xw_get_trace() ) { - printf(" Xw_set_double_buffer(%lx,%d)\n",(long ) pwindow,state) ; -} -#endif - - return (status); -} diff --git a/src/Xw/Xw_set_event.cxx b/src/Xw/Xw_set_event.cxx deleted file mode 100755 index 05a55878f2..0000000000 --- a/src/Xw/Xw_set_event.cxx +++ /dev/null @@ -1,321 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_EVENT -#endif - -/* - XW_STATUS Xw_set_event (awindow,eventtype,acallback,auserdata) - XW_EXT_WINDOW *awindow - EVENTTYPE eventtype must be one of : - - MOUSEBUTTON - MOUSEBUTTON1 - MOUSEBUTTON2 - MOUSEBUTTON3 - MOUSEMOVE - MOUSEMOVEWITHBUTTON - MOUSEMOVEWITHBUTTON1 - MOUSEMOVEWITHBUTTON2 - MOUSEMOVEWITHBUTTON3 - KEYBOARD - ENTERWINDOW - RESIZEWINDOW - MOVEWINDOW - ICONIFYWINDOW - EXPOSEWINDOW - ALLEVENT - - XW_CALLBACK acallback CallBack Routine Address (Can be NULL) - XW_USERDATA auserdata Associated UserData Address (Can be NULL) - - Associate an CallBack routine to the window - This Routine is call when any Event of type EVENTTYPE is - received at Xw_wait_event time - NOTE than if callback is NULL ,this remove the corresponding - event of type EVENTTYPE . - - Callback programming example : - { - static XW_CALLBACK any_callback(event,data) - XW_EVENT *event ; - XW_USERDATA *data ; - { - printf(" This trap ANY Xw_event of type %d from Ext_window %x\n", - event->type,event->any.awindow); - } - - Xw_set_event(ext_window,XW_ALLEVENT,any_callback,user_data) ; - - } - - Returns XW_ERROR if Extended Window address is undefined - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_event (void *awindow, - XW_EVENTTYPE eventtype, - XW_CALLBACK acallback, - XW_USERDATA *auserdata) -#else -XW_STATUS Xw_set_event (awindow,eventtype,acallback,auserdata) -void *awindow ; -XW_EVENTTYPE eventtype ; -XW_CALLBACK acallback ; -XW_USERDATA *auserdata ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -int i,function = False ; -long mask = 0 ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_event",pwindow) ; - return (XW_ERROR) ; - } - - switch (eventtype) { - case XW_MOUSEBUTTON : - pwindow->ecbk[XW_MOUSEBUTTON1].function = acallback ; - pwindow->ecbk[XW_MOUSEBUTTON1].userdata = auserdata ; - pwindow->ecbk[XW_MOUSEBUTTON2].function = acallback ; - pwindow->ecbk[XW_MOUSEBUTTON2].userdata = auserdata ; - pwindow->ecbk[XW_MOUSEBUTTON3].function = acallback ; - pwindow->ecbk[XW_MOUSEBUTTON3].userdata = auserdata ; - function = pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - break ; - case XW_MOUSEBUTTON1 : - pwindow->ecbk[XW_MOUSEBUTTON1].function = acallback ; - pwindow->ecbk[XW_MOUSEBUTTON1].userdata = auserdata ; - function = pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - break ; - case XW_MOUSEBUTTON2 : - pwindow->ecbk[XW_MOUSEBUTTON2].function = acallback ; - pwindow->ecbk[XW_MOUSEBUTTON2].userdata = auserdata ; - function = pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - break ; - case XW_MOUSEBUTTON3 : - pwindow->ecbk[XW_MOUSEBUTTON3].function = acallback ; - pwindow->ecbk[XW_MOUSEBUTTON3].userdata = auserdata ; - function = pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - break ; - case XW_MOUSEMOVE : - pwindow->ecbk[XW_MOUSEMOVE].function = acallback ; - pwindow->ecbk[XW_MOUSEMOVE].userdata = auserdata ; - function = pwindow->icbk[XW_MOUSEMOVE].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = PointerMotionMask ; - break ; - case XW_MOUSEMOVEWITHBUTTON : - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function = acallback ; - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].userdata = auserdata ; - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function = acallback ; - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].userdata = auserdata ; - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function = acallback ; - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].userdata = auserdata ; - function = pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - function = pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVE].function || - pwindow->icbk[XW_MOUSEMOVE].function ; - if( !function ) mask |= ButtonMotionMask ; - break ; - case XW_MOUSEMOVEWITHBUTTON1 : - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function = acallback ; - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].userdata = auserdata ; - function = pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - function = pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVE].function || - pwindow->icbk[XW_MOUSEMOVE].function ; - if( !function ) mask |= ButtonMotionMask ; - break ; - case XW_MOUSEMOVEWITHBUTTON2 : - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function = acallback ; - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].userdata = auserdata ; - function = pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - function = pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVE].function || - pwindow->icbk[XW_MOUSEMOVE].function ; - if( !function ) mask |= ButtonMotionMask ; - break ; - case XW_MOUSEMOVEWITHBUTTON3 : - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function = acallback ; - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].userdata = auserdata ; - function = pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - function = pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVE].function || - pwindow->icbk[XW_MOUSEMOVE].function ; - if( !function ) mask |= ButtonMotionMask ; - break ; - case XW_KEYBOARD : - pwindow->ecbk[XW_KEYBOARD].function = acallback ; - pwindow->ecbk[XW_KEYBOARD].userdata = auserdata ; - mask = KeyPressMask | KeyReleaseMask ; - break ; - case XW_ENTERWINDOW : - pwindow->ecbk[XW_ENTERWINDOW].function = acallback ; - pwindow->ecbk[XW_ENTERWINDOW].userdata = auserdata ; - mask = EnterWindowMask ; - break ; - case XW_MOVEWINDOW : - pwindow->ecbk[XW_MOVEWINDOW].function = acallback ; - pwindow->ecbk[XW_MOVEWINDOW].userdata = auserdata ; - if( !pwindow->ecbk[XW_RESIZEWINDOW].function ) - mask = StructureNotifyMask ; - break ; - case XW_RESIZEWINDOW : - pwindow->ecbk[XW_RESIZEWINDOW].function = acallback ; - pwindow->ecbk[XW_RESIZEWINDOW].userdata = auserdata ; - if( !pwindow->ecbk[XW_MOVEWINDOW].function ) - mask = StructureNotifyMask ; - break ; - case XW_ICONIFYWINDOW : - pwindow->ecbk[XW_ICONIFYWINDOW].function = acallback ; - pwindow->ecbk[XW_ICONIFYWINDOW].userdata = auserdata ; - break ; - case XW_EXPOSEWINDOW : - pwindow->ecbk[XW_EXPOSEWINDOW].function = acallback ; - pwindow->ecbk[XW_EXPOSEWINDOW].userdata = auserdata ; - mask = ExposureMask ; - break ; - - case XW_ALLEVENT : - for( i=0 ; iecbk[i].function = acallback ; - pwindow->ecbk[i].userdata = auserdata ; - } - pwindow->ecbk[XW_ALLEVENT].function = NULL ; - pwindow->ecbk[XW_ALLEVENT].userdata = NULL ; - mask = ButtonPressMask | ButtonReleaseMask ; - mask |= PointerMotionMask | ButtonMotionMask ; - mask |= KeyPressMask | KeyReleaseMask ; - mask |= EnterWindowMask ; - mask |= StructureNotifyMask ; - mask |= ExposureMask ; - break ; - } - - if( mask ) { - if( acallback ) _EVENT_MASK |= mask; - else _EVENT_MASK &= ~mask ; - XSelectInput(_DISPLAY,_WINDOW,_EVENT_MASK) ; - } - -#ifdef TRACE_SET_EVENT -if( Xw_get_trace() ) { - printf (" Xw_set_event(%lx,%d,%lx,%lx)\n", - (long ) pwindow,eventtype,(long ) acallback,(long ) auserdata) ; -} -#endif - return (XW_SUCCESS); - -} diff --git a/src/Xw/Xw_set_extended_text_attrib.cxx b/src/Xw/Xw_set_extended_text_attrib.cxx deleted file mode 100755 index 112acbea3c..0000000000 --- a/src/Xw/Xw_set_extended_text_attrib.cxx +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_EXTENDED_TEXT_ATTRIB -#endif - -/* - XW_ATTRIB Xw_set_extended_text_attrib (awindow,color,font,mode,attribs): - XW_EXT_WINDOW *awindow - int color ; Color index to used 0 >= x < MAXCOLOR - int font ; Font index to used 0 >= x < MAXFONT - DRAWMODE mode ; Draw Mode must be one of DRAWMODE enum - EXTENDEDTEXT *attrib ; Text attributes descriptor - - Set Text Color,Font and extended current graphic attrib . - - Returns Selected Text Attribute Index if successful - Returns 0 if Bad Color,Font Index or extended attributes - -*/ - -#ifdef XW_PROTOTYPE -XW_ATTRIB Xw_set_extended_text_attrib (void *awindow,int color,int font,XW_DRAWMODE mode,XW_EXTENDEDTEXT *attribs) -#else -XW_ATTRIB Xw_set_extended_text_attrib (awindow,color,font,mode,attribs) -void *awindow; -int color,font ; -XW_DRAWMODE mode ; -XW_EXTENDEDTEXT *attribs; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XGCValues gc_values ; -XW_ATTRIB code ; -int i,j,k,function,mask= 0,type = 0 ; -unsigned long planemask,hcolor ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_extended_text_attrib",pwindow) ; - return (0) ; - } - - if( _BINDEX > 0 ) return (1) ; - - if ( !Xw_isdefine_color(_COLORMAP,color) ) { - /*ERROR*Bad Defined Color*/ - Xw_set_error(41,"Xw_set_extended_text_attrib",&color) ; - return (0) ; - } - - if ( !Xw_isdefine_font(_FONTMAP,font) ) { - /*WARNING*Bad Defined Font*/ - Xw_set_error(43,"Xw_set_extended_text_attrib",&font) ; - font = 0 ; - } - - if( !_FONTMAP || !_FONTMAP->fonts[font] ) font = 0 ; - - code = QGCODE(color,type,font,mode) ; - - if( code == pwindow->qgtext[pwindow->textindex].code ) { - /* The last index computed is already set*/ - pwindow->qgtext[pwindow->textindex].count++ ; - return (pwindow->textindex+1) ; - } - - for( i=j=0,k=MAXQG ; iqgtext[i].code ) k = i ; - if( pwindow->qgtext[i].count < pwindow->qgtext[j].count ) j = i; - } - - if( k < MAXQG ) { - /* A GC index already exist,use it */ - pwindow->textindex = k ; - pwindow->qgtext[k].count++ ; - return (k+1) ; - } - - pwindow->textindex = j ; - pwindow->qgtext[j].count = 1 ; - - Xw_get_color_attrib(pwindow,mode,color,&hcolor,&function,&planemask); - if( mode != QGMODE(pwindow->qgtext[j].code) ) { - mask |= GCFunction | GCPlaneMask | GCForeground ; - gc_values.function = function ; - gc_values.plane_mask = planemask ; - gc_values.foreground = hcolor ; - } else if( color != QGCOLOR(pwindow->qgtext[j].code) ) { - mask |= GCForeground; - gc_values.foreground = hcolor ; - } - - if( font != QGFONT(pwindow->qgtext[j].code) ) { - if( _FONTMAP && _FONTMAP->fonts[font] ) { - mask |= GCFont ; - gc_values.font = _FONTMAP->fonts[font]->fid ; - } - } - -/* - the extended text attribs will be treated hear more later - by using XFLD fonts if any -*/ - - k = j+1 ; - - if( mask ) { - XChangeGC(_DISPLAY,pwindow->qgtext[j].gc,mask,&gc_values) ; - pwindow->qgtext[j].code = code ; - -#ifdef TRACE_SET_EXTENDED_TEXT_ATTRIB -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_set_extended_text_attrib(%lx,%d,%d,%d,%lx)\n", - k,(long ) pwindow,color,font,mode,(long ) attribs) ; -} -#endif - } - - return (k) ; -} diff --git a/src/Xw/Xw_set_fontmap.cxx b/src/Xw/Xw_set_fontmap.cxx deleted file mode 100755 index 0c06bc6869..0000000000 --- a/src/Xw/Xw_set_fontmap.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_FONTMAP -#endif - -/* - XW_STATUS Xw_set_fontmap(awindow,afontmap): - XW_EXT_WINDOW *awindow - XW_EXT_FONTMAP *afontmap - - Set a fontmap to an existing window - - Returns XW_ERROR if Bad Fontmap - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_fontmap (void *awindow,void *afontmap) -#else -XW_STATUS Xw_set_fontmap (awindow,afontmap) -void *awindow; -void *afontmap ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_FONTMAP *pfontmap = (XW_EXT_FONTMAP*)afontmap ; - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_fontmap",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_fontmap(pfontmap) ) { - /*ERROR*Bad EXT_FONTMAP Address*/ - Xw_set_error(44,"Xw_set_fontmap",pfontmap) ; - return (XW_ERROR) ; - } - - _FONTMAP = pfontmap ; - _FONTMAP->maxwindow++ ; - -#ifdef TRACE_SET_FONTMAP -if( Xw_get_trace() ) { - printf(" Xw_set_fontmap(%lx,%lx)\n",(long ) pwindow,(long ) pfontmap) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_set_hard_cursor.cxx b/src/Xw/Xw_set_hard_cursor.cxx deleted file mode 100755 index 773f07e11a..0000000000 --- a/src/Xw/Xw_set_hard_cursor.cxx +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_HARD_CURSOR -#endif - -/* - XW_STATUS Xw_set_hard_cursor (awindow,type,grab,r,g,b) - XW_EXT_WINDOW *awindow - unsigned int type Cursor shape id - float r,g,b Cursor Color components in [0,1] space - int grab Grabbing flag . - - Associate the cursor to the window - cursor must be one of "/usr/include/X11/cursorfont.h" - NOTE than : - 1) If grabbing flag is True,the cursor is grabbed to this Window, - You can received Mouse Events outside of this Window . - 2) If type is 0,this deactivated the hard cursor . - - Returns XW_ERROR if cursorId is out of range - Returns XW_SUCCESS if successful - -*/ - -static Cursor CursorList[MAXCURSOR] ; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_hard_cursor (void *awindow,int type,int grab,float r,float g,float b) -#else -XW_STATUS Xw_set_hard_cursor (awindow,type,grab,r,g,b) -void *awindow ; -int type; -float r,g,b ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_EXT_DISPLAY *pdisplay = pwindow->connexion ; -XColor fcolor,bcolor ; -XW_STATUS status ; -int index,grabstatus ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_hard_cursor",pwindow) ; - return (XW_ERROR) ; - } - - if( type < 0 || type >= MAXCURSOR ) { - /*WARNING*Bad Cursor type*/ - Xw_set_error(70,"Xw_set_hard_cursor",&type) ; - return (XW_ERROR) ; - } - - if( type ) { - if( !CursorList[type] ) { - CursorList[type] = XCreateFontCursor(_DISPLAY,type) ; - } - - status = Xw_get_color_index(_COLORMAP,r,g,b,&index) ; - if( !status ) return (XW_ERROR) ; - fcolor.pixel = _COLORMAP->pixels[index] ; - fcolor.red = (short unsigned int )( r * 0xFFFF) ; - fcolor.green = (short unsigned int )( g * 0xFFFF) ; - fcolor.blue = (short unsigned int )( b * 0xFFFF) ; - if( _CLASS != TrueColor ) { - XQueryColor(_DISPLAY,_COLORMAP->info.colormap,&fcolor) ; - } - - status = Xw_get_color_index(_COLORMAP,1.-r,1.-g,1.-b,&index) ; - if( !status ) return (XW_ERROR) ; - bcolor.pixel = _COLORMAP->pixels[index] ; - bcolor.red = (short unsigned int )( (1.-r) * 0xFFFF) ; - bcolor.green = (short unsigned int )( (1.-g) * 0xFFFF) ; - bcolor.blue = (short unsigned int )( (1.-b) * 0xFFFF) ; - if( _CLASS != TrueColor ) { - XQueryColor(_DISPLAY,_COLORMAP->info.colormap,&bcolor) ; - } - - XRecolorCursor(_DISPLAY,CursorList[type],&fcolor,&bcolor) ; - - if( grab ) { - grabstatus = XGrabPointer(_DISPLAY,_WINDOW,False,_EVENT_MASK, - GrabModeAsync,GrabModeAsync, - _DROOT,CursorList[type],CurrentTime); - if( grabstatus == GrabSuccess ) { - _DGRAB = _WINDOW ; - } else { - /*Cann't GRAB Cursor id on this Window*/ - Xw_set_error(98,"Xw_set_hard_cursor",&type) ; - return (XW_ERROR) ; - } - } else { - if( _DGRAB ) { - _DGRAB = 0 ; - XUngrabPointer(_DISPLAY,CurrentTime) ; - } - XDefineCursor(_DISPLAY,_WINDOW,CursorList[type]) ; - } - } else { - if( grab ) { - grabstatus = XGrabPointer(_DISPLAY,_WINDOW,False,_EVENT_MASK, - GrabModeAsync,GrabModeAsync, - _DROOT,None,CurrentTime); - if( grabstatus == GrabSuccess ) { - _DGRAB = _WINDOW ; - } else { - /*Cann't GRAB Cursor id on this Window*/ - Xw_set_error(98,"Xw_set_hard_cursor",&type) ; - return (XW_ERROR) ; - } - } else { - if( _DGRAB ) { - _DGRAB = 0 ; - XUngrabPointer(_DISPLAY,CurrentTime) ; - } - XUndefineCursor(_DISPLAY,_WINDOW) ; - } - } - -#ifdef TRACE_SET_HARD_CURSOR -if( Xw_get_trace() ) { - printf (" Xw_set_hard_cursor(%lx,%d,%d,%f,%f,%f)\n", - (long ) pwindow,type,grab,r,g,b) ; -} -#endif - return (XW_SUCCESS); - -} diff --git a/src/Xw/Xw_set_internal_event.cxx b/src/Xw/Xw_set_internal_event.cxx deleted file mode 100755 index 8c2018f98c..0000000000 --- a/src/Xw/Xw_set_internal_event.cxx +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_INTERNAL_EVENT -#endif - -/* - XW_STATUS Xw_set_internal_event (awindow,eventtype,acallback) - XW_EXT_WINDOW *awindow - EVENTTYPE eventtype must be one of : - - MOUSEBUTTON - MOUSEBUTTON1 - MOUSEBUTTON2 - MOUSEBUTTON3 - MOUSEMOVE - MOUSEMOVEWITHBUTTON - MOUSEMOVEWITHBUTTON1 - MOUSEMOVEWITHBUTTON2 - MOUSEMOVEWITHBUTTON3 - KEYBOARD - ENTERWINDOW - RESIZEWINDOW - MOVEWINDOW - ICONIFYWINDOW - EXPOSEWINDOW - ALLEVENT - - XW_ICALLBACK acallback Internal CallBack Routine Address - (Can be NULL) - - Associate an Internal CallBack routine to the window - This Routine is call when any Event of type EVENTTYPE is - received at Xw_wait_event time and MUST be One of Internal KNOWN routine - NOTE than if callback is NULL ,this remove the corresponding - event of type EVENTTYPE . - - Callback programming example : - { - Internal defined routine - extern XW_ICALLBACK Xw_rubber_band(XW_EVENT* event) ; - - Xw_set_internal_event(ext_window,MOUSEMOVEWITHBUTTON3, - Xw_rubber_band) ; - - } - - Returns XW_ERROR if Extended Window address is undefined - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_internal_event (XW_EXT_WINDOW *awindow, - XW_EVENTTYPE eventtype, - XW_ICALLBACK acallback) -#else -XW_STATUS Xw_set_internal_event (awindow,eventtype,acallback) -XW_EXT_WINDOW *awindow ; -XW_EVENTTYPE eventtype ; -XW_ICALLBACK acallback ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -int function = False ; -long mask=0 ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_internal_event",pwindow) ; - return (XW_ERROR) ; - } - - switch (eventtype) { - case XW_MOUSEBUTTON : - pwindow->icbk[XW_MOUSEBUTTON1].function = acallback ; - pwindow->icbk[XW_MOUSEBUTTON2].function = acallback ; - pwindow->icbk[XW_MOUSEBUTTON3].function = acallback ; - function = pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - break ; - case XW_MOUSEBUTTON1 : - pwindow->icbk[XW_MOUSEBUTTON1].function = acallback ; - function = pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - break ; - case XW_MOUSEBUTTON2 : - pwindow->icbk[XW_MOUSEBUTTON2].function = acallback ; - function = pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - break ; - case XW_MOUSEBUTTON3 : - pwindow->icbk[XW_MOUSEBUTTON3].function = acallback ; - function = pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - break ; - case XW_MOUSEMOVE : - pwindow->icbk[XW_MOUSEMOVE].function = acallback ; - function = pwindow->ecbk[XW_MOUSEMOVE].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = PointerMotionMask ; - break ; - case XW_MOUSEMOVEWITHBUTTON : - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function = acallback ; - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function = acallback ; - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function = acallback ; - function = pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - function = pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVE].function || - pwindow->ecbk[XW_MOUSEMOVE].function ; - if( !function ) mask |= ButtonMotionMask ; - break ; - case XW_MOUSEMOVEWITHBUTTON1 : - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function = acallback ; - function = pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - function = pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVE].function || - pwindow->ecbk[XW_MOUSEMOVE].function ; - if( !function ) mask |= ButtonMotionMask ; - break ; - case XW_MOUSEMOVEWITHBUTTON2 : - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function = acallback ; - function = pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - function = pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVE].function || - pwindow->ecbk[XW_MOUSEMOVE].function ; - if( !function ) mask |= ButtonMotionMask ; - break ; - case XW_MOUSEMOVEWITHBUTTON3 : - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function = acallback ; - function = pwindow->icbk[XW_MOUSEBUTTON1].function || - pwindow->icbk[XW_MOUSEBUTTON2].function || - pwindow->icbk[XW_MOUSEBUTTON3].function || - pwindow->ecbk[XW_MOUSEBUTTON1].function || - pwindow->ecbk[XW_MOUSEBUTTON2].function || - pwindow->ecbk[XW_MOUSEBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function ; - if( !function ) mask = ButtonPressMask | ButtonReleaseMask ; - function = pwindow->icbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->icbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON1].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON2].function || - pwindow->ecbk[XW_MOUSEMOVEWITHBUTTON3].function || - pwindow->icbk[XW_MOUSEMOVE].function || - pwindow->ecbk[XW_MOUSEMOVE].function ; - if( !function ) mask |= ButtonMotionMask ; - break ; - - default : - /*Unimplemented Internal Event*/ - Xw_set_error(96,"Xw_set_internal_event",&eventtype) ; - return (XW_ERROR) ; - } - - if( mask ) { - if( acallback ) _EVENT_MASK |= mask; - else _EVENT_MASK &= ~mask ; - XSelectInput(_DISPLAY,_WINDOW,_EVENT_MASK) ; - } - -#ifdef TRACE_SET_INTERNAL_EVENT -if( Xw_get_trace() ) { - printf (" Xw_set_internal_event(%lx,%d,%lx)\n", - (long ) pwindow,eventtype,(long ) acallback) ; -} -#endif - return (XW_SUCCESS); - -} diff --git a/src/Xw/Xw_set_line_attrib.cxx b/src/Xw/Xw_set_line_attrib.cxx deleted file mode 100755 index 4936f7719a..0000000000 --- a/src/Xw/Xw_set_line_attrib.cxx +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_LINE_ATTRIB -#define TRACE_GET_LINE_ATTRIB -#endif - -/* - XW_ATTRIB Xw_set_line_attrib (awindow,color,type,width,mode): - XW_EXT_WINDOW *awindow - int color ; Color index to used 0 >= x < MAXCOLOR - int type ; Type index to used 0 >= x < MAXTYPE - int width ; Width index to used 0 >= x < MAXWIDTH - XW_DRAWMODE mode ; Draw Mode must be one of DRAWMODE enum - - Set Line Color,Type and Width current graphic attrib . - - Returns Selected Line Graphic Attribute Index if successful - Returns 0 if Bad Color,Type or Width Index - -*/ - -#ifdef XW_PROTOTYPE -XW_ATTRIB Xw_set_line_attrib (void *awindow,int color,int type,int width,XW_DRAWMODE mode) -#else -XW_ATTRIB Xw_set_line_attrib (awindow,color,type,width,mode) -void *awindow; -int color,type,width ; -XW_DRAWMODE mode ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XGCValues gc_values ; -XW_ATTRIB code ; -int i,j,k,function,mask = 0 ; -unsigned long planemask,hcolor ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_line_attrib",pwindow) ; - return (0) ; - } - - if( _BINDEX > 0 ) return (1) ; - - if ( !Xw_isdefine_color(_COLORMAP,color) ) { - /*ERROR*Bad Defined Color*/ - Xw_set_error(41,"Xw_set_line_attrib",&color) ; - return (0) ; - } - if ( !Xw_isdefine_type(_TYPEMAP,type) ) { - /*WARNING*Bad Defined Type*/ - Xw_set_error(50,"Xw_set_line_attrib",&type) ; - type = 0 ; - } - if ( !Xw_isdefine_width(_WIDTHMAP,width) ) { - /*WARNING*Bad Defined Width*/ - Xw_set_error(52,"Xw_set_line_attrib",&width) ; - width = 0 ; - } - - if( !_TYPEMAP || !_TYPEMAP->types[type] ) type = 0 ; - if( !_WIDTHMAP || (_WIDTHMAP->widths[width] <= 1) ) width = 0 ; - - code = QGCODE(color,type,width,mode) ; - if( code == pwindow->qgline[pwindow->lineindex].code ) { - /* The last index computed is already set*/ - pwindow->qgline[pwindow->lineindex].count++ ; - return (pwindow->lineindex+1) ; - } - - for( i=j=0,k=MAXQG ; iqgline[i].code ) k = i ; - if( pwindow->qgline[i].count < pwindow->qgline[j].count ) j = i; - } - - if( k < MAXQG ) { - /* A GC index already exist,use it */ - pwindow->lineindex = k ; - pwindow->qgline[k].count++ ; - return (k+1) ; - } - - pwindow->lineindex = j ; - pwindow->qgline[j].count = 1 ; - - Xw_get_color_attrib(pwindow,mode,color,&hcolor,&function,&planemask); - if( mode != QGMODE(pwindow->qgline[j].code) ) { - mask |= GCFunction | GCPlaneMask | GCForeground ; - gc_values.function = function ; - gc_values.plane_mask = planemask ; - gc_values.foreground = hcolor ; - } else if( color != QGCOLOR(pwindow->qgline[j].code) ) { - mask |= GCForeground ; - gc_values.foreground = hcolor ; - } - - if( width != QGWIDTH(pwindow->qgline[j].code) ) { - mask |= GCLineWidth ; - if( width > 0 ) { - gc_values.line_width = (_WIDTHMAP->widths[width] > 1) ? - _WIDTHMAP->widths[width] : 0 ; - } else { - gc_values.line_width = 0 ; - } - } - - if( type != QGTYPE(pwindow->qgline[j].code) ) { - mask |= GCLineStyle ; - if( type > 0 ) { - gc_values.line_style = LineOnOffDash ; - XSetDashes(_DISPLAY,pwindow->qgline[j].gc,0, - (char*)_TYPEMAP->types[type],strlen((char*)_TYPEMAP->types[type])) ; - } else { - gc_values.line_style = LineSolid ; - } - } - - k = j+1 ; - - if( mask ) { - XChangeGC(_DISPLAY,pwindow->qgline[j].gc,mask,&gc_values) ; - pwindow->qgline[j].code = code ; - -#ifdef TRACE_SET_LINE_ATTRIB -if( Xw_get_trace() ) { - printf(" %d = Xw_set_line_attrib(%lx,%d,%d,%d,%d)\n", - k,(long ) pwindow,color,type,width,mode) ; -} -#endif - } - - return (k) ; -} - -/* - XW_ATTRIB Xw_get_poly_attrib (awindow,color,type,width,mode): - XW_EXT_WINDOW *awindow - int *color ; Returns current Color index - int *type ; Returns current Type - int *width ; Returns current Width index - DRAWMODE *mode ; Returns current Draw Mode - - Returns Selected Polyline Attribute Index - -*/ - -#ifdef XW_PROTOTYPE -XW_ATTRIB Xw_get_line_attrib (void *awindow,int *color,int *type,int *width,XW_DRAWMODE *mode) -#else -XW_ATTRIB Xw_get_line_attrib (awindow,color,type,width,mode) -void *awindow; -int *color,*width ; -int *type ; -XW_DRAWMODE *mode ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_ATTRIB code; -int j,k; - - j = pwindow->lineindex; k = j+1; - - code = pwindow->qgline[j].code; - - *color = QGCOLOR(code); - *type = QGTYPE(code); - *width = QGWIDTH(code); - *mode = (XW_DRAWMODE) QGMODE(code); - -#ifdef TRACE_GET_LINE_ATTRIB -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_get_line_attrib(%lx,%d,%d,%d,%d)\n", - k,(long ) pwindow,*color,*type,*width,*mode) ; -} -#endif - - return code; -} diff --git a/src/Xw/Xw_set_marker_attrib.cxx b/src/Xw/Xw_set_marker_attrib.cxx deleted file mode 100755 index d37051f0db..0000000000 --- a/src/Xw/Xw_set_marker_attrib.cxx +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_MARKER_ATTRIB -#endif - -/* - XW_ATTRIB Xw_set_marker_attrib (awindow,color,type,width,mode): - XW_EXT_WINDOW *awindow - int color ; Color index to used 0 >= x < MAXCOLOR - int type ; Type can be TRUE if marker must be filled with the - set_poly_attrib attributes - int width ; Width index to used 0 >= x < MAXWIDTH - DRAWMODE mode ; Draw Mode must be one of DRAWMODE enum - - Set Marker Color,Type and Marker current graphic attrib . - - Returns Selected Marker Attribute Index if successful - Returns 0 if Bad Color,Type or Marker Index - -*/ - -#ifdef XW_PROTOTYPE -XW_ATTRIB Xw_set_marker_attrib (void *awindow,int color,int type,int width,XW_DRAWMODE mode) -#else -XW_ATTRIB Xw_set_marker_attrib (awindow,color,type,width,mode) -void *awindow; -int color,type ; -int width ; -XW_DRAWMODE mode ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XGCValues gc_values ; -XW_ATTRIB code ; -int i,j,k,function,mask = 0; -unsigned long planemask,hcolor ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_marker_attrib",pwindow) ; - return (0) ; - } - - if( _BINDEX > 0 ) return (1) ; - - if ( !Xw_isdefine_color(_COLORMAP,color) ) { - /*ERROR*Bad Defined Color*/ - Xw_set_error(41,"Xw_set_marker_attrib",&color) ; - return (0) ; - } - - if ( !Xw_isdefine_width(_WIDTHMAP,width) ) { - /*WARNING*Bad Defined Width*/ - Xw_set_error(52,"Xw_set_marker_attrib",&width) ; - width = 0 ; - } - - if( !_WIDTHMAP || (_WIDTHMAP->widths[width] <= 1) ) width = 0 ; - - code = QGCODE(color,type,width,mode) ; - if( code == pwindow->qgmark[pwindow->markindex].code ) { - /* The last index computed is already set*/ - pwindow->qgmark[pwindow->markindex].count++ ; - return (pwindow->markindex+1) ; - } - - for( i=j=0,k=MAXQG ; iqgmark[i].code ) k = i ; - if( pwindow->qgmark[i].count < pwindow->qgmark[j].count ) j = i; - } - - if( k < MAXQG ) { - /* A GC index already exist,use it */ - pwindow->markindex = k ; - pwindow->qgmark[k].count++ ; - return (k+1) ; - } - - pwindow->markindex = j ; - pwindow->qgmark[j].count = 1 ; - - Xw_get_color_attrib(pwindow,mode,color,&hcolor,&function,&planemask); - if( mode != QGMODE(pwindow->qgmark[j].code) ) { - mask |= GCFunction | GCPlaneMask | GCForeground ; - gc_values.function = function ; - gc_values.plane_mask = planemask ; - gc_values.foreground = hcolor ; - } else if( color != QGCOLOR(pwindow->qgmark[j].code) ) { - mask |= GCForeground; - gc_values.foreground = hcolor ; - } - - if( width != QGWIDTH(pwindow->qgmark[j].code) ) { - mask |= GCLineWidth ; - if( width > 0 ) { - gc_values.line_width = _WIDTHMAP->widths[width] ; - } else { - gc_values.line_width = 0 ; - } - } - - k = j+1 ; - - if( mask ) { - XChangeGC(_DISPLAY,pwindow->qgmark[j].gc,mask,&gc_values) ; - pwindow->qgmark[j].code = code ; - -#ifdef TRACE_SET_MARKER_ATTRIB -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_set_marker_attrib(%lx,%d,%d,%d,%d)\n", - k,(long ) pwindow,color,type,width,mode) ; -} -#endif - } - - return (k) ; -} diff --git a/src/Xw/Xw_set_markmap.cxx b/src/Xw/Xw_set_markmap.cxx deleted file mode 100755 index ff2e9b2f01..0000000000 --- a/src/Xw/Xw_set_markmap.cxx +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_MARKMAP -#endif - -/* - XW_STATUS Xw_set_markmap(awindow,amarkmap): - XW_EXT_WINDOW *awindow - XW_EXT_MARKMAP *amarkmap - - Set a markmap to an existing window - - Returns XW_ERROR if Bad Markmap - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_markmap (void *awindow,void *amarkmap) -#else -XW_STATUS Xw_set_markmap (awindow,amarkmap) -void *awindow; -void *amarkmap ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_MARKMAP *pmarkmap = (XW_EXT_MARKMAP*) amarkmap ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_markmap",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_markmap(pmarkmap) ) { - /*ERROR*Bad EXT_MARKMAP Address*/ - Xw_set_error(46,"Xw_set_markmap",pmarkmap) ; - return (XW_ERROR) ; - } - - _MARKMAP = pmarkmap ; - _MARKMAP->maxwindow++ ; - -#ifdef TRACE_SET_MARKMAP -if( Xw_get_trace() ) { - printf(" Xw_set_markmap(%lx,%lx)\n",(long ) pwindow,(long ) pmarkmap) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_set_poly_attrib.cxx b/src/Xw/Xw_set_poly_attrib.cxx deleted file mode 100755 index c0a31216c8..0000000000 --- a/src/Xw/Xw_set_poly_attrib.cxx +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#define PRO4391 /*GG_040696 -// Traitement des polygones transparents. -*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_POLY_ATTRIB -#define TRACE_GET_POLY_ATTRIB -#endif - -/* - XW_ATTRIB Xw_set_poly_attrib (awindow,color,type,tile,mode): - XW_EXT_WINDOW *awindow - int color ; Color index to used 0 >= x < MAXCOLOR - int type ; Type can be TRUE if EDGES must be Draw with the - set_line_attrib attributes - int tile ; Tile index to used x < MAXTILE - DRAWMODE mode ; Draw Mode must be one of DRAWMODE enum - - Set Poly Color,Type and Tile current graphic attrib . - NOTE than if tile is < 0 the poly background is transparente. - - Returns Selected Polygon Attribute Index if successful - Returns 0 if Bad Color,Type or Tile Index - -*/ - -#ifdef XW_PROTOTYPE -XW_ATTRIB Xw_set_poly_attrib (void *awindow,int color,int type,int tile,XW_DRAWMODE mode) -#else -XW_ATTRIB Xw_set_poly_attrib (awindow,color,type,tile,mode) -void *awindow; -int color,tile ; -int type ; -XW_DRAWMODE mode ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XGCValues gc_values ; -XW_ATTRIB code ; -int i,j,k,function,mask = 0 ; -unsigned long planemask,hcolor ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_poly_attrib",pwindow) ; - return (0) ; - } - - if( _BINDEX > 0 ) return (1) ; - - if ( !Xw_isdefine_color(_COLORMAP,color) ) { - /*ERROR*Bad Defined Color*/ - Xw_set_error(41,"Xw_set_poly_attrib",&color) ; - return (0) ; - } - - if( tile > 0 ) { - if ( !Xw_isdefine_tile(_TILEMAP,tile) ) { - /*WARNING*Bad Defined Tile*/ - Xw_set_error(78,"Xw_set_poly_attrib",&tile) ; -#ifdef PRO4391 - tile = 1 ; - } - } else if( tile < 0 ) { - tile = 0; - } else { - tile = 1; - } -#else - tile = 0 ; - } - } - - if( !_TILEMAP || !_TILEMAP->tiles[tile] ) tile = 0 ; -#endif - - code = QGCODE(color,type,tile,mode) ; - if( code == pwindow->qgpoly[pwindow->polyindex].code ) { - /* The last index computed is already set*/ - pwindow->qgpoly[pwindow->polyindex].count++ ; - return (pwindow->polyindex+1) ; - } - - for( i=j=0,k=MAXQG ; iqgpoly[i].code ) k = i ; - if( pwindow->qgpoly[i].count < pwindow->qgpoly[j].count ) j = i; - } - - if( k < MAXQG ) { - /* A GC index already exist,use it */ - pwindow->polyindex = k ; - pwindow->qgpoly[k].count++ ; - return (k+1) ; - } - - pwindow->polyindex = j ; - pwindow->qgpoly[j].count = 1 ; - - Xw_get_color_attrib(pwindow,mode,color,&hcolor,&function,&planemask); - if( mode != QGMODE(pwindow->qgpoly[j].code) ) { - mask |= GCFunction | GCPlaneMask | GCForeground ; - gc_values.function = function ; - gc_values.plane_mask = planemask ; - gc_values.foreground = hcolor ; - } else if( color != QGCOLOR(pwindow->qgpoly[j].code) ) { - mask |= GCForeground; - gc_values.foreground = hcolor ; - } - - if( tile != QGTILE(pwindow->qgpoly[j].code) ) { - mask |= GCFillStyle ; -#ifdef PRO4391 - if( (tile > 0) && _TILEMAP && _TILEMAP->tiles[tile] ) { -#else - if( tile > 0 ) { -#endif - mask |= GCStipple ; - gc_values.fill_style = FillOpaqueStippled ; - gc_values.stipple = _TILEMAP->tiles[tile] ; - } else { - gc_values.fill_style = FillSolid ; - } - } - - k = j+1 ; - - if( mask ) { - XChangeGC(_DISPLAY,pwindow->qgpoly[j].gc,mask,&gc_values) ; - pwindow->qgpoly[j].code = code ; - -#ifdef TRACE_SET_POLY_ATTRIB -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_set_poly_attrib(%lx,%d,%d,%d,%d)\n", - k,(long ) pwindow,color,type,tile,mode) ; -} -#endif - } - - return (k) ; -} - -/* - XW_ATTRIB Xw_get_poly_attrib (awindow,color,type,tile,mode): - XW_EXT_WINDOW *awindow - int *color ; Returns current Color index - int *type ; Returns current Type - int *tile ; Returns current Tile index - DRAWMODE *mode ; Returns current Draw Mode - - Returns Selected Polygon Attribute Index - -*/ - -#ifdef XW_PROTOTYPE -XW_ATTRIB Xw_get_poly_attrib (void *awindow,int *color,int *type,int *tile,XW_DRAWMODE *mode) -#else -XW_ATTRIB Xw_get_poly_attrib (awindow,color,type,tile,mode) -void *awindow; -int *color,*tile ; -int *type ; -XW_DRAWMODE *mode ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_ATTRIB code; -int j,k; - - j = pwindow->polyindex; k = j+1; - - code = pwindow->qgpoly[j].code; - - *color = QGCOLOR(code); - *type = QGTYPE(code); - *tile = QGTILE(code) > 1 ? QGTILE(code) : QGTILE(code) - 1; - *mode = (XW_DRAWMODE) QGMODE(code); - -#ifdef TRACE_GET_POLY_ATTRIB -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_get_poly_attrib(%lx,%d,%d,%d,%d)\n", - k,(long ) pwindow,*color,*type,*tile,*mode) ; -} -#endif - - return code; -} diff --git a/src/Xw/Xw_set_soft_cursor.cxx b/src/Xw/Xw_set_soft_cursor.cxx deleted file mode 100755 index d236ca6499..0000000000 --- a/src/Xw/Xw_set_soft_cursor.cxx +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_SOFT_CURSOR -#endif - -/* - XW_STATUS Xw_set_soft_cursor (awindow,type,button) - XW_EXT_WINDOW *awindow - XW_CURSORTYPE type - int button Mouse Button number (1 to 3) - - Associate the soft cursor to the window and a mouse button - Soft cursor is activated when Mouse Button is press - drawn when mouse move with button press - and Unactivated when Mouse Button is Release - - Returns XW_ERROR if button is out of range - Returns XW_SUCCESS if successful - -*/ - -static int Start = False ; -static XPoint points[100] ; - -#ifdef XW_PROTOTYPE -static XW_STATUS Xw_rubberline_cursor(XW_EVENT *event) ; -static XW_STATUS Xw_rubberband_cursor(XW_EVENT *event) ; -static XW_STATUS Xw_userdefined_cursor(XW_EVENT *event) ; -static void DrawLines(XW_EXT_WINDOW *pwindow,XPoint *points,int npoint) ; -XW_STATUS Xw_set_soft_cursor (void *awindow,XW_CURSORTYPE type,int button) -#else -static XW_STATUS Xw_rubberline_cursor() ; -static XW_STATUS Xw_rubberband_cursor() ; -static XW_STATUS Xw_userdefined_cursor() ; -static void DrawLines() ; -XW_STATUS Xw_set_soft_cursor (awindow,type,button) -void *awindow ; -XW_CURSORTYPE type; -int button ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XW_STATUS status ; -XW_EVENTTYPE mask1=(XW_EVENTTYPE ) 0 ,mask2=(XW_EVENTTYPE ) 0 ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_soft_cursor",pwindow) ; - return (XW_ERROR) ; - } - - if( button <= 0 || button > 3 ) { - /*WARNING*Bad Mouse button number*/ - Xw_set_error(70,"Xw_set_soft_cursor",&button) ; - return (XW_ERROR) ; - } - - if( button == 1 ) { - mask1 = XW_MOUSEBUTTON1 ; mask2 = XW_MOUSEMOVEWITHBUTTON1 ; - } else if( button == 2 ) { - mask1 = XW_MOUSEBUTTON2 ; mask2 = XW_MOUSEMOVEWITHBUTTON2 ; - } else if( button == 3 ) { - mask1 = XW_MOUSEBUTTON3 ; mask2 = XW_MOUSEMOVEWITHBUTTON3 ; - } - - switch (type) { - - case XW_WITHOUT_CURSOR : - status = Xw_set_internal_event(pwindow,mask1,NULL) ; - status = Xw_set_internal_event(pwindow,mask2,NULL) ; - break ; - case XW_RUBBERLINE_CURSOR : - status = Xw_set_internal_event(pwindow,mask1, - Xw_rubberline_cursor) ; - status = Xw_set_internal_event(pwindow,mask2, - Xw_rubberline_cursor) ; - break ; - case XW_RUBBERBAND_CURSOR : - status = Xw_set_internal_event(pwindow,mask1, - Xw_rubberband_cursor) ; - status = Xw_set_internal_event(pwindow,mask2, - Xw_rubberband_cursor) ; - break ; - case XW_USERDEFINED_CURSOR : - status = Xw_set_internal_event(pwindow,mask1, - Xw_userdefined_cursor) ; - status = Xw_set_internal_event(pwindow,mask2, - Xw_userdefined_cursor) ; - break ; -#ifndef DEB - default: - break ; -#endif - } - - -#ifdef TRACE_SET_SOFT_CURSOR -if( Xw_get_trace() ) { - printf (" Xw_set_soft_cursor(%lx,%d,%d)\n",(long ) pwindow,type,button) ; -} -#endif - return (XW_SUCCESS); - -} - -#ifdef XW_PROTOTYPE -static XW_STATUS Xw_rubberline_cursor(XW_EVENT *event) -#else -static XW_STATUS Xw_rubberline_cursor(event) -XW_EVENT *event ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) event->any.awindow ; - -#ifdef TRACE_SET_SOFT_CURSOR -if( Xw_get_trace() > 2 ) { - printf (" Xw_rubberline_cursor(%lx,%d)\n", - (long ) event->any.awindow,event->any.type) ; -} -#endif - - switch (event->any.type) { - - case XW_MOUSEBUTTON1 : - case XW_MOUSEBUTTON2 : - case XW_MOUSEBUTTON3 : - if( Start ) { - Start = False ; - DrawLines(pwindow,points,2) ; - } else { - points[0].x = event->mousebutton.x ; - points[0].y = event->mousebutton.y ; - } - break ; - - case XW_MOUSEMOVEWITHBUTTON1 : - case XW_MOUSEMOVEWITHBUTTON2 : - case XW_MOUSEMOVEWITHBUTTON3 : - if( Start ) { - DrawLines(pwindow,points,2) ; - } - Start = True ; - points[1].x = event->mousemovewithbutton.x - points[0].x ; - points[1].y = event->mousemovewithbutton.y - points[0].y ; - DrawLines(pwindow,points,2) ; - XFlush(_DISPLAY) ; - break ; -#ifndef DEB - default: - break ; -#endif - } - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -static XW_STATUS Xw_rubberband_cursor(XW_EVENT *event) -#else -static XW_STATUS Xw_rubberband_cursor(event) -XW_EVENT *event ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*) event->any.awindow ; - -#ifdef TRACE_SET_SOFT_CURSOR -if( Xw_get_trace() > 2 ) { - printf (" Xw_rubberband_cursor(%lx,%d)\n", - (long ) event->any.awindow,event->any.type) ; -} -#endif - - switch (event->any.type) { - - case XW_MOUSEBUTTON1 : - case XW_MOUSEBUTTON2 : - case XW_MOUSEBUTTON3 : - if( Start ) { - Start = False ; - DrawLines(pwindow,points,5) ; - } else { - points[0].x = event->mousebutton.x ; - points[0].y = event->mousebutton.y ; - } - break ; - - case XW_MOUSEMOVEWITHBUTTON1 : - case XW_MOUSEMOVEWITHBUTTON2 : - case XW_MOUSEMOVEWITHBUTTON3 : - if( Start ) { - DrawLines(pwindow,points,5) ; - } - Start = True ; - points[1].x = 0 ; - points[1].y = event->mousemovewithbutton.y - points[0].y ; - points[2].x = event->mousemovewithbutton.x - points[0].x ; - points[2].y = 0 ; - points[3].x = 0 ; - points[3].y = -points[1].y ; - points[4].x = -points[2].x ; - points[4].y = 0 ; - DrawLines(pwindow,points,5) ; - XFlush(_DISPLAY) ; - break ; -#ifndef DEB - default: - break ; -#endif - } - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -static XW_STATUS Xw_userdefined_cursor(XW_EVENT *event) -#else -static XW_STATUS Xw_userdefined_cursor(event) -XW_EVENT *event ; -#endif /*XW_PROTOTYPE*/ -{ -#ifdef TRACE_SET_SOFT_CURSOR -if( Xw_get_trace() > 2 ) { - printf (" Xw_userdefined_cursor(%lx,%d)\n", - (long ) event->any.awindow,event->any.type) ; -} -#endif - Xw_set_error(97,"Xw_userdefined_cursor",&event->any.type) ; - - return (XW_SUCCESS) ; -} - -#ifdef XW_PROTOTYPE -static void DrawLines(XW_EXT_WINDOW *pwindow,XPoint *points,int npoint) -#else -static void DrawLines(pwindow,points,npoint) -XW_EXT_WINDOW *pwindow ; -XPoint *points ; -int npoint ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_DISPLAY *pdisplay = pwindow->connexion ; - - if( _DGRAB ) { - int xs = points[0].x,ys = points[0].y ; - - points[0].x += _X ; points[0].y += _Y ; - XDrawLines(_DISPLAY,_DROOT,_DGC,points,npoint,CoordModePrevious) ; - points[0].x = xs ; points[0].y = ys ; - } else { - XDrawLines(_DISPLAY,_WINDOW,pwindow->qgwind.gchigh, - points,npoint,CoordModePrevious) ; - } -} diff --git a/src/Xw/Xw_set_text_attrib.cxx b/src/Xw/Xw_set_text_attrib.cxx deleted file mode 100755 index 50b8b9601b..0000000000 --- a/src/Xw/Xw_set_text_attrib.cxx +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_TEXT_ATTRIB -#define TRACE_GET_TEXT_ATTRIB -#endif - -/* - XW_ATTRIB Xw_set_text_attrib (awindow,color,type,font,mode): - XW_EXT_WINDOW *awindow - int color ; Color index to used 0 >= x < MAXCOLOR - int type ; Type index to used 0 >= x < MAXTYPE - int font ; Font index to used 0 >= x < MAXFONT - DRAWMODE mode ; Draw Mode must be one of DRAWMODE enum - - Set Text Color,Type and Font current graphic attrib . - - Returns Selected Text Attribute Index if successful - Returns 0 if Bad Color,Type or Font Index - -*/ - -#ifdef XW_PROTOTYPE -XW_ATTRIB Xw_set_text_attrib (void *awindow,int color,int type,int font,XW_DRAWMODE mode) -#else -XW_ATTRIB Xw_set_text_attrib (awindow,color,type,font,mode) -void *awindow; -int color,type,font ; -XW_DRAWMODE mode ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XGCValues gc_values ; -XW_ATTRIB code ; -int i,j,k,function,mask= 0 ; -unsigned long planemask,hcolor ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_text_attrib",pwindow) ; - return (0) ; - } - - if( _BINDEX > 0 ) return (1) ; - - if ( !Xw_isdefine_color(_COLORMAP,color) ) { - /*ERROR*Bad Defined Color*/ - Xw_set_error(41,"Xw_set_text_attrib",&color) ; - return (0) ; - } - - if( type != 0 ) { - /*ERROR*Unimplemented Text type*/ - Xw_set_error(81,"Xw_set_text_attrib",&type) ; - type = 0 ; - } - - if ( !Xw_isdefine_font(_FONTMAP,font) ) { - /*WARNING*Bad Defined Font*/ - Xw_set_error(43,"Xw_set_text_attrib",&font) ; - font = 0 ; - } - - if( !_FONTMAP || !_FONTMAP->fonts[font] ) font = 0 ; - - code = QGCODE(color,type,font,mode) ; - if( code == pwindow->qgtext[pwindow->textindex].code ) { - /* The last index computed is already set*/ - pwindow->qgtext[pwindow->textindex].count++ ; - return (pwindow->textindex+1) ; - } - - for( i=j=0,k=MAXQG ; iqgtext[i].code ) k = i ; - if( pwindow->qgtext[i].count < pwindow->qgtext[j].count ) j = i; - } - - if( k < MAXQG ) { - /* A GC index already exist,use it */ - pwindow->textindex = k ; - pwindow->qgtext[k].count++ ; - return (k+1) ; - } - - pwindow->textindex = j ; - pwindow->qgtext[j].count = 1 ; - - Xw_get_color_attrib(pwindow,mode,color,&hcolor,&function,&planemask); - if( mode != QGMODE(pwindow->qgtext[j].code) ) { - mask |= GCFunction | GCPlaneMask | GCForeground ; - gc_values.function = function ; - gc_values.plane_mask = planemask ; - gc_values.foreground = hcolor ; - } else if( color != QGCOLOR(pwindow->qgtext[j].code) ) { - mask |= GCForeground; - gc_values.foreground = hcolor ; - } - - if( type != QGTYPE(pwindow->qgtext[j].code) ) { - } - - if( font != QGFONT(pwindow->qgtext[j].code) ) { - if( _FONTMAP && _FONTMAP->fonts[font] ) { - mask |= GCFont ; - gc_values.font = _FONTMAP->fonts[font]->fid ; - } - } - - k = j+1 ; - - if( mask ) { - XChangeGC(_DISPLAY,pwindow->qgtext[j].gc,mask,&gc_values) ; - pwindow->qgtext[j].code = code ; - -#ifdef TRACE_SET_TEXT_ATTRIB -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_set_text_attrib(%lx,%d,%d,%d,%d)\n", - k,(long ) pwindow,color,type,font,mode) ; -} -#endif - } - - return (k) ; -} - -/* - XW_ATTRIB Xw_get_text_attrib (awindow,color,type,font,mode): - XW_EXT_WINDOW *awindow - int *color ; Returns current Color index - int *type ; Returns current Type - int *font ; Returns current Font index - DRAWMODE *mode ; Returns current Draw Mode - - Returns Selected Polygon Attribute Index - -*/ - -#ifdef XW_PROTOTYPE -XW_ATTRIB Xw_get_text_attrib (void *awindow,int *color,int *type,int *font,XW_DRAWMODE *mode) -#else -XW_ATTRIB Xw_get_text_attrib (awindow,color,type,font,mode) -void *awindow; -int *color,*font ; -int *type ; -XW_DRAWMODE *mode ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_ATTRIB code; -int j,k; - - j = pwindow->textindex; k = j+1; - - code = pwindow->qgtext[j].code; - - *color = QGCOLOR(code); - *type = QGTYPE(code); - *font = QGFONT(code); - *mode = (XW_DRAWMODE) QGMODE(code); - -#ifdef TRACE_GET_TEXT_ATTRIB -if( Xw_get_trace() > 1 ) { - printf(" %d = Xw_get_text_attrib(%lx,%d,%d,%d,%d)\n", - k,(long ) pwindow,*color,*type,*font,*mode) ; -} -#endif - - return code; -} diff --git a/src/Xw/Xw_set_tilemap.cxx b/src/Xw/Xw_set_tilemap.cxx deleted file mode 100755 index cb3f0c7275..0000000000 --- a/src/Xw/Xw_set_tilemap.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_TILEMAP -#endif - -/* - XW_STATUS Xw_set_tilemap(awindow,atilemap): - XW_EXT_WINDOW *awindow - XW_EXT_TILEMAP *atilemap - - Set a tilemap to an existing window - - Returns XW_ERROR if Bad Tilemap - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_tilemap (void *awindow,void *atilemap) -#else -XW_STATUS Xw_set_tilemap (awindow,atilemap) -void *awindow; -void *atilemap ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_TILEMAP *ptilemap = (XW_EXT_TILEMAP*)atilemap ; - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_colormap",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_tilemap(ptilemap) ) { - /*ERROR*Bad EXT_TILEMAP Address*/ - Xw_set_error(49,"Xw_set_tilemap",ptilemap) ; - return (XW_ERROR) ; - } - - _TILEMAP = ptilemap ; - _TILEMAP->maxwindow++ ; - -#ifdef TRACE_SET_TILEMAP -if( Xw_get_trace() ) { - printf(" Xw_set_tilemap(%lx,%lx)\n",(long ) pwindow,(long ) ptilemap) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_set_trace.cxx b/src/Xw/Xw_set_trace.cxx deleted file mode 100755 index 17be3bbb44..0000000000 --- a/src/Xw/Xw_set_trace.cxx +++ /dev/null @@ -1,851 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -/*********************************************************************** - - FONCTION : - ---------- - Classe GUI_WidgetTools : - - HISTORIQUE DES MODIFICATIONS : - -------------------------------- - ??-??-?? : ??? ; Creation. - 19-01-98 : GG ; Xw_error_handler() - Ignorer les messages d'erreur en provenance de - XConfigureWindow (arrive souvent avec MOTIF). - -************************************************************************/ - -#include -#include -#include - - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_TRACE -#endif - -#define MAXERROR 8 -#define MAXERRORSTRING 512 - -static int Nerror = 0 ; -static int Lstring = 0 ; -static char ErrorString[MAXERRORSTRING] ; -static char *PErrorString ; -static char *ErrorMessag[MAXERROR] ; -static char *ErrorRoutine[MAXERROR] ; -static int ErrorCount[MAXERROR] ; -static int ErrorCode[MAXERROR] ; -static int ErrorGravity[MAXERROR] ; -static int TraceLevel = 0 ; -static int ErrorLevel = 4 ; -static int TestMask = 0 ; - -/* - void Xw_set_trace (tracelevel,errorlevel): - int tracelevel ; - int errorlevel ; - - ENABLE/DISABLE Xw package Trace or Error printing - - TraceLevel can have the value : - - 0: Disable trace printing (DEFAULT) - 1: Print All first level routines calls tiny - 2: Print routines calls offen but with a low amount of - trace info . - 3: Print routines calls offen with an amount of infos . - - NOTE than XSynchronize is call depending of the Trace level - - ErrorLevel can have the value : - - 0: Disable Error printing - 1: Print any Errors or Warnings (DEFAULT) - 2: Print high and low gravity errors - 3: Print only high gravity errors - 4: Print only Unimplemented errors - -=============================================================================== - - char* Xw_get_error(error,gravity) - int *error ; - int *gravity ; - - Returns the last Error Code,Gravity and Messag found if any - - Returns Messag string if any Error has been found - Returns NULL if No Error has been found - -=============================================================================== - - STATUS Xw_print_error() - - Print Error Stack - - Returns XW_ERROR if no erreur exist - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -void Xw_set_trace(int tracelevel,int errorlevel) -#else -void Xw_set_trace(tracelevel,errorlevel) -int tracelevel ; -int errorlevel ; -#endif /*XW_PROTOTYPE*/ -{ - - TraceLevel = tracelevel ; - ErrorLevel = errorlevel ; - - if( Xw_get_env("Xw_TEST",ErrorString,sizeof(ErrorString)) ){ - if( strlen(ErrorString) ) { - sscanf(ErrorString,"%x",&TestMask) ; - } - printf(" Xw_TEST is %x\n",TestMask) ; - } - - if( Xw_get_env("Xw_SET_TRACE",ErrorString,sizeof(ErrorString)) ){ - if( strlen(ErrorString) ) { - sscanf(ErrorString,"%d %d",&TraceLevel,&ErrorLevel) ; - } - printf(" Xw_SET_TRACE is %d %d\n",TraceLevel,ErrorLevel) ; - } - - Xw_set_synchronize(NULL,TraceLevel) ; -} - -#ifdef XW_PROTOTYPE -int Xw_test(unsigned long mask) -#else -int Xw_test(mask) -unsigned long mask; -#endif /*XW_PROTOTYPE*/ -/* - Returns TRUE if mask & TestMask is != 0 -*/ -{ - if( mask & TestMask ) return (True) ; - else return (False) ; -} - -#ifdef XW_PROTOTYPE -int Xw_get_trace() -#else -int Xw_get_trace() -#endif /*XW_PROTOTYPE*/ -/* - Returns the Trace level -*/ -{ - return (TraceLevel) ; -} - -/* - void Xw_set_error(code,routine,param): - int code Error Number - char *routine Routine name from error occurs - void *param Associated Error value - - Set Error Message And Print eventually depending of Error trace level . - - Returns NONE - -*/ - -#ifdef XW_PROTOTYPE -void Xw_set_error(int code,const char *routine,void* param) -#else -void Xw_set_error(code,routine,param) -int code ; -const char *routine ; -void *param ; -#endif /*XW_PROTOTYPE*/ -{ -union { - void *pv ; - char *pc ; - short *ps ; - int *pi ; - long *pl ; - float *pf ; -} value ; -char error[512] ; -int gravity ; - - value.pv = param ; - - switch (code) { - case 1 : - gravity = 1 ; - sprintf(error,"Bad Color Index %d",*value.pi) ; - break ; - case 2 : - gravity = 3 ; - sprintf(error,"Colormap creation failed") ; - break ; - case 3 : - gravity = 3 ; - sprintf(error,"USER Colormap %lx allocation failed",(long ) *value.pl) ; - break ; - case 4 : - gravity = 3 ; - sprintf(error,"STD Colormap %lx allocation failed",(long ) *value.pl) ; - break ; - case 5 : - gravity = 4 ; - sprintf(error,"Unimplemented Visual class %d",*value.pi) ; - break ; - case 6 : - gravity = 3 ; - sprintf(error,"EXT_COLORMAP allocation failed") ; - break ; - case 7 : - gravity = 1 ; - sprintf(error,"Bad Font Index %d",*value.pi) ; - break ; - case 8 : - gravity = 1 ; - if( value.pc ) sprintf(error,"Bad Font Name '%s'",value.pc) ; - else sprintf(error,"Bad Font Name address") ; - break ; - case 9 : - gravity = 3 ; - sprintf(error,"EXT_FONTMAP allocation failed") ; - break ; - case 10 : - gravity = 1 ; - sprintf(error,"Bad Marker Index %d",*value.pi) ; - break ; - case 11 : - gravity = 2 ; - sprintf(error,"Marker Allocation failed") ; - break ; - case 12 : - gravity = 3 ; - sprintf(error,"EXT_MARKMAP allocation failed") ; - break ; - case 13 : - gravity = 1 ; - sprintf(error,"Bad Tile Index %d",*value.pi) ; - break ; - case 14 : - gravity = 1 ; - sprintf(error,"Bad Tile Index %d Size",*value.pi) ; - break ; - case 15 : - gravity = 1 ; - sprintf(error,"Bad Tile %d Data",*value.pi) ; - break ; - case 16 : - gravity = 2 ; - sprintf(error,"Tile Bitmap Allocation failed") ; - break ; - case 17 : - gravity = 3 ; - sprintf(error,"EXT_TILEMAP allocation failed") ; - break ; - case 18 : - gravity = 1 ; - sprintf(error,"Bad Type Index %d",*value.pi) ; - break ; - case 19 : - gravity = 1 ; - sprintf(error,"Bad Type %d Data",*value.pi) ; - break ; - case 20 : - gravity = 3 ; - sprintf(error,"EXT_TYPEMAP allocation failed") ; - break ; - case 21 : - gravity = 1 ; - sprintf(error,"Bad Width Index %d",*value.pi) ; - break ; - case 22 : - gravity = 1 ; - sprintf(error,"Bad Width Thickness %f",*value.pf) ; - break ; - case 23 : - gravity = 3 ; - sprintf(error,"EXT_WIDTHMAP allocation failed") ; - break ; - case 24 : - gravity = 3 ; - sprintf(error,"Bad EXT_WINDOW Address %lx",(long ) value.pl) ; - break ; - case 25 : - gravity = 3 ; - sprintf(error,"Bad EXT_IMAGEDATA Address %lx",(long ) value.pl) ; - break ; - case 26 : - gravity = 1 ; - sprintf(error,"Try to Draw Image %lx outside the window",(long ) value.pl) ; - break ; - case 27 : - gravity = 3 ; - sprintf(error,"EXT_IMAGE allocation failed") ; - break ; - case 28 : - gravity = 2 ; - sprintf(error,"Too many points in POLYLINE,max is %d",*value.pi) ; - break ; - case 29 : - gravity = 1 ; - sprintf(error,"POLYLINE is empty !!!") ; - break ; - case 30 : - gravity = 3 ; - sprintf(error,"EXT_POLYLINE allocation failed") ; - break ; - case 31 : - gravity = 3 ; - sprintf(error,"EXT_MARKER allocation failed") ; - break ; - case 32 : - gravity = 2 ; - sprintf(error,"Too many points in POLYGONE,max is %d",*value.pi) ; - break ; - case 33 : - gravity = 1 ; - sprintf(error,"POLYGONE is empty !!!") ; - break ; - case 34 : - gravity = 3 ; - sprintf(error,"EXT_POLYGONE allocation failed") ; - break ; - case 35 : - gravity = 3 ; - sprintf(error,"EXT_SEGMENT allocation failed") ; - break ; - case 36 : - gravity = 3 ; - sprintf(error,"Bad EXT_POLYLINE Address") ; - break ; - case 37 : - gravity = 3 ; - sprintf(error,"Bad EXT_POLYGONE Address") ; - break ; - case 38 : - gravity = 2 ; - sprintf(error,"Too big TEXT string,max is %d",*value.pi) ; - break ; - case 39 : - gravity = 3 ; - sprintf(error,"EXT_TEXT allocation failed") ; - break ; - case 40 : - gravity = 1 ; - sprintf(error,"Try to Erase outside the window %lx",(long ) value.pl) ; - break ; - case 41 : - gravity = 2 ; - sprintf(error,"Bad Defined Color at index %d",*value.pi) ; - break ; - case 42 : - gravity = 3 ; - sprintf(error,"Bad EXT_COLORMAP Address %lx",(long ) value.pl) ; - break ; - case 43 : - gravity = 1 ; - sprintf(error,"Bad Defined Font at index %d",*value.pi) ; - break ; - case 44 : - gravity = 3 ; - sprintf(error,"Bad EXT_FONTMAP Address %lx",(long ) value.pl) ; - break ; - case 45 : - gravity = 1 ; - sprintf(error,"Try to Get Image from outside the window") ; - break ; - case 46 : - gravity = 3 ; - sprintf(error,"Bad EXT_MARKMAP Address %lx",(long ) value.pl) ; - break ; - case 47 : - gravity = 1 ; - sprintf(error,"Bad PIXEL position,max is %d",*value.pi) ; - break ; - case 48 : - gravity = 3 ; - sprintf(error,"Visual %d must be TRUECOLOR",*value.pi) ; - break ; - case 49 : - gravity = 3 ; - sprintf(error,"Bad EXT_TILEMAP Address %lx",(long ) value.pl) ; - break ; - case 50 : - gravity = 1 ; - sprintf(error,"Bad Defined Type at index %d",*value.pi) ; - break ; - case 51 : - gravity = 3 ; - sprintf(error,"Bad EXT_TYPEMAP Address %lx",(long ) value.pl) ; - break ; - case 52 : - gravity = 1 ; - sprintf(error,"Bad Defined Width at index %d",*value.pi) ; - break ; - case 53 : - gravity = 3 ; - sprintf(error,"Bad EXT_WIDTHMAP Address %lx",(long ) value.pl) ; - break ; - case 54 : - gravity = 3 ; - sprintf(error,"Bad Window %lx Attributes",(long ) *value.pl) ; - break ; - case 55 : - gravity = 2 ; - if(value.pc) sprintf(error,"Bad XWD FileName '%s'",value.pc) ; - else sprintf(error,"Bad XWD FileName %lx",(long ) value.pc) ; - break ; - case 56 : - gravity = 2 ; - sprintf(error,"Unable to read XWD File Header of '%s'",value.pc) ; - break ; - case 57 : - gravity = 2 ; - sprintf(error,"Bad XWD File format of '%s'",value.pc) ; - break ; - case 58 : - gravity = 2 ; - sprintf(error,"Bad XWD Pixmap format of '%s'",value.pc) ; - break ; - case 59 : - gravity = 4 ; - sprintf(error,"Unimplemented Image Visual class %d",*value.pi) ; - break ; - case 60 : - gravity = 3 ; - sprintf(error,"XImage Allocation failed"); - break ; - case 61 : - gravity = 3 ; - sprintf(error,"Unable to read Image data of '%s'",value.pc) ; - break ; - case 62 : - gravity = 3 ; - sprintf(error,"XImage Creation failed"); - break ; - case 63 : - gravity = 3 ; - sprintf(error,"No more FREE pixel in Colormap %lx",(long ) *value.pl); - break ; - case 64 : - gravity = 4 ; - sprintf(error,"Unimplemented Image Visual depth %d",*value.pi) ; - break ; - case 65 : - gravity = 3 ; - sprintf(error,"Display Stack OVERFLOW") ; - break ; - case 66 : - gravity = 3 ; - if( value.pc ) sprintf(error,"Bad Display connexion '%s'",value.pc); - else sprintf(error,"Bad Display connexion '%lx'",(long ) value.pc); - break ; - case 67 : - gravity = 3 ; - sprintf(error,"Unmatchable Visual class %d",*value.pi) ; - break ; - case 68 : - gravity = 1 ; - sprintf(error,"Bad AREA position") ; - break ; - case 69 : - gravity = 3 ; - sprintf(error,"EXT_WINDOW allocation failed") ; - break ; - case 70 : - gravity = 1 ; - sprintf(error,"Bad Cursor Index %d",*value.pi) ; - break ; - case 71 : - gravity = 1 ; - sprintf(error,"Double Buffering is DISABLE") ; - break ; - case 72 : - gravity = 1 ; - sprintf(error,"Lose RETAIN lines buffer attrib %x",*value.pi) ; - break ; - case 73 : - gravity = 1 ; - sprintf(error,"Lose RETAIN polygons buffer attrib %x",*value.pi) ; - break ; - case 74 : - gravity = 1 ; - sprintf(error,"Lose RETAIN texts buffer attrib %x",*value.pi) ; - break ; - case 75 : - gravity = 1 ; - sprintf(error,"Lose RETAIN markers buffer attrib %x",*value.pi) ; - break ; - case 76 : - gravity = 1 ; - sprintf(error,"Bad Mapping Size %f",*value.pf) ; - break ; - case 77 : - gravity = 1 ; - sprintf(error,"Bad Defined Marker at index %d",*value.pi) ; - break ; - case 78 : - gravity = 1 ; - sprintf(error,"Bad Defined Tile at index %d",*value.pi) ; - break ; - case 79 : - gravity = 4 ; - sprintf(error,"Unimplemented Marker type %d",*value.pi) ; - break ; - case 80 : - gravity = 4 ; - sprintf(error,"Unimplemented Polygon type %d",*value.pi) ; - break ; - case 81 : - gravity = 4 ; - sprintf(error,"Unimplemented Text type %d",*value.pi) ; - break ; - case 82 : - gravity = 3 ; - sprintf(error,"Bad Line Attrib %lx",(long ) *value.pl) ; - break ; - case 83 : - gravity = 3 ; - sprintf(error,"Bad Polygon Attrib %lx",(long ) *value.pl) ; - break ; - case 84 : - gravity = 3 ; - sprintf(error,"Bad Text Attrib %lx",(long ) *value.pl) ; - break ; - case 85 : - gravity = 3 ; - sprintf(error,"Bad Marker Attrib %lx",(long ) *value.pl) ; - break ; - case 86 : - gravity = 1 ; - sprintf(error,"Unimplemented EVENT type %d",*value.pi) ; - break ; - case 87 : - gravity = 1 ; - sprintf(error,"Use def_background_color instead on index %d", - *value.pi) ; - break ; - case 88 : - gravity = 2 ; - sprintf(error,"Bad RGB file name %s",value.pc) ; - break ; - case 89 : - gravity = 1 ; - sprintf(error,"Bad Named Color %s",value.pc) ; - break ; - case 90 : - gravity = 3 ; - sprintf(error,"Unable to Create DisplayPostScript Context") ; - break ; - case 91 : - gravity = 2 ; - sprintf(error,"Coordinate must be in [0,1] space") ; - break ; - case 92 : - gravity = 2 ; - sprintf(error,"ColorCube Creation failed width %d Colors",*value.pi) ; - break ; - case 93 : - gravity = 2 ; - sprintf(error,"ColorCube Allocation failed"); - break ; - case 94 : - gravity = 3 ; - sprintf(error,"EXT_DISPLAY allocation failed") ; - break ; - case 95 : - gravity = 1 ; - sprintf(error,"Bad Mouse Button number %d",*value.pi) ; - break ; - case 96 : - gravity = 3 ; - sprintf(error,"Bad EXT_DISPLAY Address %lx",(long ) value.pl) ; - break ; - case 97 : - gravity = 1 ; - sprintf(error,"Unimplemented Internal Event number %d",*value.pi) ; - break ; - case 98 : - gravity = 1 ; - sprintf(error,"Can't GRAB Cursor id %d on this Window",*value.pi) ; - break ; - case 99 : - gravity = 3 ; - sprintf(error,"Can't OPEN IconBox Window") ; - break ; - case 100 : - gravity = 1 ; - if( value.pc ) - sprintf(error,"Can't OPEN Icon File Directory '%s'",value.pc); - else sprintf(error,"Can't OPEN Icon File Directory '%lx'",(long ) value.pc); - break ; - case 101 : - gravity = 3 ; - sprintf(error,"EXT_ICON allocation failed") ; - break ; - case 102 : - gravity = 1 ; - sprintf(error,"Icon Box is EMPTY !") ; - break ; - case 103 : - gravity = 1 ; - if( value.pc ) - sprintf(error,"Bad Icon Name '%s'",value.pc); - else sprintf(error,"Bad Icon Name '%lx'",(long ) value.pc); - break ; - case 104 : - gravity = 3 ; - sprintf(error,"PIXMAP allocation failed") ; - break ; - case 105 : - gravity = 1 ; - sprintf(error,"Allocates ONLY %d contiguous colors",*value.pi); - break ; - case 106 : - gravity = 1 ; - sprintf(error,"Bad Icon Index %d",*value.pi); - break ; - case 107 : - gravity = 1 ; - sprintf(error,"XImage BAD pixel color %x",*value.pi); - break ; - case 108 : - gravity = 1 ; - sprintf(error,"BAD Icon Name size,must be < %d",*value.pi); - break ; - case 109 : - gravity = 1 ; - if( value.pc ) - sprintf(error,"Bad Icon FileName '%s'",value.pc); - else sprintf(error,"Bad Icon FileName '%lx'",(long ) value.pc); - break ; - case 110 : - gravity = 1 ; - sprintf(error,"No more FREE pixel in STD Colormap %d",*value.pi); - break ; - case 111 : - gravity = 2 ; - sprintf(error,"Too many SEGMENTS,max is %d",*value.pi) ; - break ; - case 112 : - gravity = 2 ; - sprintf(error,"Too many points in MARKER,max is %d",*value.pi) ; - break ; - case 113 : - gravity = 2 ; - sprintf(error,"Bad Image zoom factor %f",*value.pf) ; - break ; - case 114 : - gravity = 2 ; - sprintf(error,"Bad Image translation") ; - break ; - case 115 : - gravity = 2 ; - sprintf(error,"Bad arc radius %f",*value.pf) ; - break ; - case 116 : - gravity = 1 ; - sprintf(error,"Too big arc radius") ; - break ; - case 117 : - gravity = 3 ; - sprintf(error,"EXT_POINT allocation failed") ; - break ; - case 118 : - gravity = 3 ; - sprintf(error,"EXT_CHAR allocation failed") ; - break ; - case 119 : - gravity = 2 ; - sprintf(error,"BUFFER %d is not opened",*value.pi) ; - break ; - case 120 : - gravity = 1 ; - sprintf(error,"BUFFER %d is already opened",*value.pi) ; - break ; - case 121 : - gravity = 3 ; - sprintf(error,"Too many opened BUFFERS,max is %d",*value.pi) ; - break ; - case 122 : - gravity = 3 ; - sprintf(error,"Bad BUFFER identification %d",*value.pi) ; - break ; - case 123 : - gravity = 2 ; - sprintf(error,"Bad BUFFER scale factor %f",*value.pf) ; - break ; - case 124 : - gravity = 1 ; - sprintf(error,"Bad margin poly text ratio %f",*value.pf) ; - break ; - case 125 : - gravity = 1 ; - sprintf(error,"Bad BUFFER drawing mode %d",*value.pi) ; - break ; - case 126 : - gravity = 1 ; - sprintf(error,"MultiBuffering Extension is not accessible here") ; - break ; - case 127 : - gravity = 1 ; - sprintf(error,"Bad Color Index Allocation %d",*value.pi) ; - break ; - case 128 : - gravity = 3 ; - sprintf(error,"XDPS_EXT_WINDOW allocation failed") ; - break ; - case 129 : - gravity = 1 ; - sprintf(error,"Too many entry in the virtual colormap %lx",(long ) value.pl) ; - break ; - case 130 : - gravity = 1; - sprintf(error,"Too big ZOOM factor (%f)", *value.pf); - break; - default : - gravity = 4 ; - if( code >= 1000 ) { - sprintf(error,"code %d/'%s'\n",code-1000,value.pc) ; - } else { - sprintf(error,"Bad Error Code %d",code) ; - } - } - - if( gravity > ErrorLevel ) { - printf("*Xw_Error_%d*%s from %s routine\n",gravity,error,routine) ; - } else { /* Put Messag in Error Stack */ - int lr = strlen(routine) + 1 ; - int lm = strlen(error) + 1 ; - int i = 0 ; - - if( Nerror > 0 ) { - for( i=0 ; i= MAXERROR) || (Lstring + lr + lm > MAXERRORSTRING) ) { - /* Stack Overflow */ - printf("*Xw_Error*Stack OVERFLOW,use Xw_get_error a lot !!!\n") ; - Xw_print_error() ; - } - - ErrorCode[Nerror] = code ; /* Push Error Stack */ - ErrorGravity[Nerror] = gravity ; - ErrorCount[Nerror] = 1 ; - ErrorRoutine[Nerror] = &ErrorString[Lstring] ; - strcpy(&ErrorString[Lstring],routine) ; Lstring += lr ; - ErrorMessag[Nerror] = &ErrorString[Lstring] ; - strcpy(&ErrorString[Lstring],error) ; Lstring += lm ; - Nerror++ ; - } - } -} - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_print_error() -#else -XW_STATUS Xw_print_error() -#endif /*XW_PROTOTYPE*/ -/* - Print Error Stack - - Returns XW_ERROR if no erreur exist - Returns XW_SUCCESS if successful -*/ -{ -XW_STATUS status = XW_SUCCESS ; -int i ; - - if( Nerror ) { - for( i=0 ; i 0 ) { - *error = ErrorCode[Nerror-1] ; - *gravity = ErrorGravity[Nerror-1] ; - PErrorString = ErrorMessag[Nerror-1] ; - --Nerror ; /* Pop Error Stack */ - Lstring -= strlen(ErrorMessag[Nerror]) + - strlen(ErrorRoutine[Nerror]) + 2 ; - } else { - *error = 0 ; - *gravity = 0 ; - PErrorString = NULL ; - } - - return (PErrorString) ; -} - -#ifdef XW_PROTOTYPE -int Xw_error_handler(Display *display,XErrorEvent *event) -#else -int Xw_error_handler(display,event) -Display *display ; -XErrorEvent *event ; -#endif /*XW_PROTOTYPE*/ -{ - if( TraceLevel != 0 ) { - XmuPrintDefaultErrorMessage(display,event,stderr); - } else { - char xerrormessag[128] ; - if( event->request_code != X_ConfigureWindow -#ifndef DEBUG - && event->request_code != X_ChangeWindowAttributes //error reproduced for several X servers (Mandriva 2008) -#endif - ) { - XGetErrorText(display,event->error_code,xerrormessag,sizeof(xerrormessag)) - ; - Xw_set_error(1000+event->error_code,"Xw_error_handler",xerrormessag) ; - } - } - return True; -} diff --git a/src/Xw/Xw_set_typemap.cxx b/src/Xw/Xw_set_typemap.cxx deleted file mode 100755 index ea70c8933c..0000000000 --- a/src/Xw/Xw_set_typemap.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_TYPEMAP -#endif - -/* - XW_STATUS Xw_set_typemap(awindow,atypemap): - XW_EXT_WINDOW *awindow - XW_EXT_TYPEMAP *atypemap - - Set a typemap to an existing window - - Returns XW_ERROR if Bad Typemap - Returns XW_SUCCESS if successful - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_typemap (void *awindow,void *atypemap) -#else -XW_STATUS Xw_set_typemap (awindow,atypemap) -void *awindow; -void *atypemap ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - XW_EXT_TYPEMAP *ptypemap = (XW_EXT_TYPEMAP*)atypemap ; - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_typemap",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_typemap(ptypemap) ) { - /*ERROR*Bad EXT_TYPEMAP Address*/ - Xw_set_error(20,"Xw_set_typemap",ptypemap) ; - return (XW_ERROR) ; - } - - _TYPEMAP = ptypemap ; - _TYPEMAP->maxwindow++ ; - -#ifdef TRACE_SET_TYPEMAP -if( Xw_get_trace() ) { - printf(" Xw_set_typemap(%lx,%lx)\n",(long ) pwindow,(long ) ptypemap) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_set_widthmap.cxx b/src/Xw/Xw_set_widthmap.cxx deleted file mode 100755 index 00144301a1..0000000000 --- a/src/Xw/Xw_set_widthmap.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_WIDTHMAP -#endif - -/* - XW_STATUS Xw_set_widthmap(awindow,awidthmap): - XW_EXT_WINDOW *awindow - XW_EXT_WIDTHMAP *awidthmap - - Set a widthmap to an existing window - - Returns XW_ERROR if Bad Widthmap - Returns XW_SUCCESS if successful - -*/ -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_widthmap (void *awindow,void *awidthmap) -#else -XW_STATUS Xw_set_widthmap (awindow,awidthmap) -void *awindow; -void *awidthmap ; -#endif /*XW_PROTOTYPE*/ -{ - - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*)awidthmap ; - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_colormap",pwindow) ; - return (XW_ERROR) ; - } - - if( !Xw_isdefine_widthmap(pwidthmap) ) { - /*ERROR*Bad EXT_WIDTHMAP Address*/ - Xw_set_error(23,"Xw_set_widthmap",pwidthmap) ; - return (XW_ERROR) ; - } - - _WIDTHMAP = pwidthmap ; - _WIDTHMAP->maxwindow++ ; - -#ifdef TRACE_SET_WIDTHMAP -if( Xw_get_trace() ) { - printf(" Xw_set_widthmap(%lx,%lx)\n",(long ) pwindow,(long ) pwidthmap) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_set_window_ratio.cxx b/src/Xw/Xw_set_window_ratio.cxx deleted file mode 100755 index 120f1f6a74..0000000000 --- a/src/Xw/Xw_set_window_ratio.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define CTS50024 /*GG_090997 -// Attention avec les nouvelles machines SGI (O2), -// le pitch vertical n'est pas identique au pitch horizontal. -*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_WINDOW_RATIO -#endif - -/* - XW_STATUS Xw_set_window_ratio (awindow, ratio): - XW_EXT_WINDOW *awindow - float ratio ; - - Update the window ratio.Is defined as the ratio between - the Window User Size and the Window Pixel size - DEFAULT is METER - - returns XW_SUCCESS always -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_window_ratio (void *awindow , float ratio) -#else -XW_STATUS Xw_set_window_ratio (awindow , ratio) -void *awindow; -float ratio ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; -XW_EXT_DISPLAY *pdisplay = pwindow->connexion ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_set_window_ratio",pwindow) ; - return (XW_ERROR) ; - } - -#ifdef CTS50024 - pwindow->xratio = (MMPXVALUE(1) + MMPYVALUE(1)) * ratio / 2. ; - pwindow->yratio = pwindow->xratio; -#else - pwindow->xratio = MMPXVALUE(1) * ratio ; - pwindow->yratio = MMPYVALUE(1) * ratio ; -#endif - -#ifdef TRACE_SET_WINDOW_RATIO -if( Xw_get_trace() ) { - printf (" Xw_set_window_ratio(%lx,%f)\n",(long ) pwindow,ratio) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_set_window_state.cxx b/src/Xw/Xw_set_window_state.cxx deleted file mode 100755 index 10ff8eb64a..0000000000 --- a/src/Xw/Xw_set_window_state.cxx +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#define TEST /*GG_050198 -// Synchroniser le changement d'etat d'une fentre -*/ - -#include - - /* ifdef then trace on */ -#ifdef TRACE -#define TRACE_SET_WINDOW_STATE -#endif - -/* - XW_STATUS Xw_set_window_state (awindow, state): - XW_EXT_WINDOW *awindow - WINDOWSTATE state ; - - Update the window state ,must be : - - POP if the window must be viewable above all others . - PUSH if the window must be behind all others . - ICONIFY if the window must be iconify . - UNKNOWN if the window must be only Mapped as his old state - - returns XW_SUCCESS always -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_set_window_state (void *awindow , XW_WINDOWSTATE rstate) -#else -XW_STATUS Xw_set_window_state (awindow , rstate) -void *awindow; -XW_WINDOWSTATE rstate ; -#endif /*XW_PROTOTYPE*/ -{ - XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow; - int xc,yc,width,height ; - - - /* - * wait_event ajoute par CAL le 21/03/95 pour pouvoir faire des tests - * sur SGI. En effet, lorsque le display est une SGI, on est bloque - * sur XWindowEvent. A analyser avec GG. - */ - XW_WINDOWSTATE state ; - -#ifndef TEST - int wait_event = False ; - char svalue[4] ; - if( Xw_get_env("Xw_WAIT_EVENT",svalue,sizeof(svalue)) ) { - wait_event = True ; - printf(" Xw_WAIT_EVENT is %d\n",wait_event) ; - } -#endif - - switch (rstate) { - case XW_MAP : - if( Xw_get_window_position(pwindow,&xc,&yc,&width,&height) - == XW_ICONIFY ){ -// XEvent event ; - - XMapWindow(_DISPLAY,_WINDOW) ; - XFlush(_DISPLAY) ; -#ifdef TEST - do { - state = - Xw_get_window_position(pwindow,&xc,&yc,&width,&height) ; - } while ( state == XW_ICONIFY ); -#else - if( _EVENT_MASK & ExposureMask ) { - if( wait_event ) - XWindowEvent(_DISPLAY,_WINDOW,ExposureMask,&event) ; - } - Xw_get_window_position(pwindow,&xc,&yc,&width,&height) ; -#endif - pwindow->axleft = xc - width/2 ; - pwindow->axright = xc + width/2 ; - pwindow->aytop = yc - height/2 ; - pwindow->aybottom = yc + height/2 ; - } - break ; - - case XW_POP : - if( Xw_get_window_position(pwindow,&xc,&yc,&width,&height) - != XW_ICONIFY ){ - XRaiseWindow(_DISPLAY,_WINDOW) ; - } else { -// XEvent event ; - - XMapRaised(_DISPLAY,_WINDOW) ; - XFlush(_DISPLAY) ; -#ifdef TEST - do { - state = - Xw_get_window_position(pwindow,&xc,&yc,&width,&height) ; - } while ( state == XW_ICONIFY ); -#else - if( _EVENT_MASK & ExposureMask ) { - if( wait_event ) - XWindowEvent(_DISPLAY,_WINDOW,ExposureMask,&event) ; - } - Xw_get_window_position(pwindow,&xc,&yc,&width,&height) ; -#endif - pwindow->axleft = xc - width/2 ; - pwindow->axright = xc + width/2 ; - pwindow->aytop = yc - height/2 ; - pwindow->aybottom = yc + height/2 ; - } - break ; - - case XW_PUSH : - XLowerWindow(_DISPLAY,_WINDOW) ; - break ; - - case XW_ICONIFY : - XIconifyWindow(_DISPLAY,_WINDOW,DefaultScreen(_DISPLAY)) ; - break ; -#ifndef DEB - default: - break ; -#endif - } - XFlush(_DISPLAY) ; - -#ifdef TRACE_SET_WINDOW_STATE -if( Xw_get_trace() ) { - printf (" Xw_set_window_state(%lx,%d)\n",(long ) pwindow,rstate) ; -} -#endif - - return (XW_SUCCESS); -} diff --git a/src/Xw/Xw_wait_event.cxx b/src/Xw/Xw_wait_event.cxx deleted file mode 100755 index 19a2049128..0000000000 --- a/src/Xw/Xw_wait_event.cxx +++ /dev/null @@ -1,315 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - - -#include - -/* ifdef then trace on */ -#ifdef TRACE -#define TRACE_WAIT_EVENT -#endif - -/* - STATUS Xw_wait_event (awindow) - XW_EXT_WINDOW *awindow - - Wait any event activated by Xw_set_event in any Window - and CALL the associated call_back routine if defined - NOTE than if call_back returns ERROR this go outside the WAIT - event loop . - - Returns ERROR always - -*/ - -static XW_CALLBACK ecbk ; -static XW_ICALLBACK icbk ; - -static char keystring[32] ; -static KeySym modifier = 0 ; - -static XW_EVENT xwevent ; - -static Window LastEventWindow = 0 ; - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_wait_event (void* awindow) -#else -XW_STATUS Xw_wait_event (awindow) -void *awindow ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_WINDOW *pwindow = (XW_EXT_WINDOW*)awindow ; -XEvent xevent ; -XW_STATUS status = XW_SUCCESS ; -XW_USERDATA *userdata ; -int lstring,xbutton=0,ybutton=0,bbutton = 0,mbutton = False ; -KeySym keysym ; -XComposeStatus key_status ; - - if( !Xw_isdefine_window(pwindow) ) { - /*ERROR*Bad EXT_WINDOW Address*/ - Xw_set_error(24,"Xw_wait_event",pwindow) ; - return (XW_ERROR) ; - } - - while ( status == XW_SUCCESS ) { - XNextEvent(_DISPLAY,&xevent) ; - - xwevent.any.type = XW_ALLEVENT ; - if( LastEventWindow != xevent.xany.window ) { - LastEventWindow = xevent.xany.window ; - xwevent.any.awindow = pwindow = - Xw_get_window_structure(LastEventWindow) ; - } - -#ifdef TRACE_WAIT_EVENT -if( Xw_get_trace() > 3 ) { - printf (" Xw_event(%lx,%d)\n",(long ) pwindow,xevent.type) ; -} -#endif - if( pwindow ) { - switch (xevent.type) { - case KeyPress : - lstring = XLookupString( &xevent.xkey, - keystring, sizeof(keystring), &keysym , &key_status ) ; - if( lstring ) { - xwevent.any.type = XW_KEYBOARD ; - xwevent.keyboard.modifier = modifier ; - xwevent.keyboard.keycode = 0 ; - xwevent.keyboard.state = True ; - xwevent.keyboard.string = &keystring[0] ; - xwevent.keyboard.x = xevent.xkey.x ; - xwevent.keyboard.y = xevent.xkey.y ; - } else { - if( IsModifierKey(keysym) ) { - modifier = keysym ; - } else { - xwevent.any.type = XW_KEYBOARD ; - xwevent.keyboard.modifier = modifier ; - xwevent.keyboard.keycode = keysym ; - xwevent.keyboard.state = True ; - xwevent.keyboard.string = NULL ; - xwevent.keyboard.x = xevent.xkey.x ; - xwevent.keyboard.y = xevent.xkey.y ; - } - } - break ; - case KeyRelease : - lstring = XLookupString( &xevent.xkey, - keystring, sizeof(keystring), &keysym , &key_status ) ; - if( IsModifierKey(keysym) ) { - modifier = 0 ; - } - break ; - case ButtonPress : - bbutton = xevent.xbutton.button ; - xbutton = xevent.xbutton.x ; - ybutton = xevent.xbutton.y ; - mbutton = False ; - if( xevent.xbutton.button == 1 ) - xwevent.any.type = XW_MOUSEBUTTON1 ; - else if( xevent.xbutton.button == 2 ) - xwevent.any.type = XW_MOUSEBUTTON2 ; - else if( xevent.xbutton.button == 3 ) - xwevent.any.type = XW_MOUSEBUTTON3 ; - xwevent.mousebutton.button = bbutton ; - xwevent.mousebutton.state = True ; - xwevent.mousebutton.modifier = modifier ; - xwevent.mousebutton.x = xbutton ; - xwevent.mousebutton.y = ybutton ; - break ; - case ButtonRelease : - if( mbutton ) { - if( xevent.xbutton.button == 1 ) - xwevent.any.type = XW_MOUSEBUTTON1 ; - else if( xevent.xbutton.button == 2 ) - xwevent.any.type = XW_MOUSEBUTTON2 ; - else if( xevent.xbutton.button == 3 ) - xwevent.any.type = XW_MOUSEBUTTON3 ; - xwevent.mousebutton.button = bbutton ; - xwevent.mousebutton.state = False ; - xwevent.mousebutton.modifier = modifier ; - xwevent.mousebutton.x = xevent.xbutton.x ; - xwevent.mousebutton.y = xevent.xbutton.y ; - } - bbutton = 0 ; - mbutton = False ; - break ; - case MotionNotify : - if( bbutton ) { - int dx,dy ; - - while( XCheckTypedWindowEvent(_DISPLAY,LastEventWindow, - MotionNotify,&xevent) ) ; - if( !mbutton ) { - dx = xevent.xmotion.x - xbutton ; - dy = xevent.xmotion.y - ybutton ; - if( (abs(dx) + abs(dy)) > 6 ) { - mbutton = True ; - } - } - - if( mbutton ) { - if( bbutton == 1 ) - xwevent.any.type = XW_MOUSEMOVEWITHBUTTON1 ; - else if( bbutton == 2 ) - xwevent.any.type = XW_MOUSEMOVEWITHBUTTON2 ; - else if( bbutton == 3 ) - xwevent.any.type = XW_MOUSEMOVEWITHBUTTON3 ; - xwevent.mousemovewithbutton.button = bbutton ; - xwevent.mousemovewithbutton.state = True ; - xwevent.mousemovewithbutton.modifier = modifier ; - xwevent.mousemovewithbutton.x = xevent.xmotion.x; - xwevent.mousemovewithbutton.y = xevent.xmotion.y; - } - } else { - while( XCheckTypedWindowEvent(_DISPLAY,LastEventWindow, - MotionNotify,&xevent) ) ; - xwevent.any.type = XW_MOUSEMOVE ; - xwevent.mousemove.modifier = modifier ; - xwevent.mousemove.x = xevent.xmotion.x ; - xwevent.mousemove.y = xevent.xmotion.y ; - } - break ; - case EnterNotify : - xwevent.any.type = XW_ENTERWINDOW ; - break ; - case Expose : - if( !xevent.xexpose.count ) { - int x1 = xevent.xexpose.x ; - int y1 = xevent.xexpose.y ; - int x2 = x1 + xevent.xexpose.width ; - int y2 = y1 + xevent.xexpose.height ; - - xwevent.any.type = XW_EXPOSEWINDOW ; - xwevent.windowexpose.xc = (x1+x2)/2 ; - xwevent.windowexpose.yc = (y1+y2)/2 ; - xwevent.windowexpose.width = (x2-x1) ; - xwevent.windowexpose.height = (y2-y1) ; - while( XCheckWindowEvent(_DISPLAY,LastEventWindow, - ExposureMask,&xevent) ) { - if( !xevent.xexpose.count ) { - int nx1 = xevent.xexpose.x ; - int ny1 = xevent.xexpose.y ; - int nx2 = nx1 + xevent.xexpose.width ; - int ny2 = ny1 + xevent.xexpose.height ; - - x1 = min(x1,nx1) ; y1 = min(y1,ny1) ; - x2 = max(x2,nx2) ; y2 = max(y2,ny2) ; - xwevent.windowexpose.xc = (x1+x2)/2 ; - xwevent.windowexpose.yc = (y1+y2)/2 ; - xwevent.windowexpose.width = (x2-x1) ; - xwevent.windowexpose.height = (y2-y1) ; - } - } - } - break ; - case ConfigureNotify : - { - int xc = _X + _WIDTH/2 ; - int yc = _Y + _HEIGHT/2 ; - int width = _WIDTH ; - int height = _HEIGHT ; - - pwindow->rwidth = xevent.xconfigure.width ; - pwindow->rheight = xevent.xconfigure.height ; - Xw_get_window_position(pwindow, - &xwevent.windowresize.xc, - &xwevent.windowresize.yc, - &xwevent.windowresize.width, - &xwevent.windowresize.height) ; - if( (width != xwevent.windowresize.width) || - (height != xwevent.windowresize.height) ) - xwevent.any.type = XW_RESIZEWINDOW ; - else if( (xc != xwevent.windowresize.xc) || - (yc != xwevent.windowresize.yc) ) - xwevent.any.type = XW_MOVEWINDOW ; - } - break ; - case ResizeRequest : - { - int xc = _X + _WIDTH/2 ; - int yc = _Y + _HEIGHT/2 ; - int width = _WIDTH ; - int height = _HEIGHT ; - - pwindow->rwidth = xevent.xresizerequest.width ; - pwindow->rheight = xevent.xresizerequest.height ; - Xw_get_window_position(pwindow, - &xwevent.windowresize.xc, - &xwevent.windowresize.yc, - &xwevent.windowresize.width, - &xwevent.windowresize.height) ; - if( (width != xwevent.windowresize.width) || - (height != xwevent.windowresize.height) ) - xwevent.any.type = XW_RESIZEWINDOW ; - else if( (xc != xwevent.windowresize.xc) || - (yc != xwevent.windowresize.yc) ) - xwevent.any.type = XW_MOVEWINDOW ; - } - break ; - case UnmapNotify : - xwevent.any.type = XW_ICONIFYWINDOW ; - break ; - case MapNotify : - case ReparentNotify : - case NoExpose : - case ClientMessage : - case GraphicsExpose : - case DestroyNotify : - case CreateNotify : - break ; - case LeaveNotify : - case FocusIn : - case FocusOut : - case KeymapNotify : - case ConfigureRequest : - case GravityNotify : - case CirculateNotify : - case CirculateRequest : - case PropertyNotify : - case SelectionClear : - case SelectionRequest : - case SelectionNotify : - case ColormapNotify : - case MappingNotify : - case VisibilityNotify : - case MapRequest : - /*WARNING*Unimplemented EVENT type*/ - Xw_set_error(86,"Xw_wait_event",&xevent.type) ; - break ; - } - - if(( icbk = pwindow->icbk[xwevent.any.type].function )) { - status = (*icbk)(&xwevent) ; - } - if(( ecbk = pwindow->ecbk[xwevent.any.type].function )) { - userdata = pwindow->ecbk[xwevent.any.type].userdata ; - status = (*ecbk)(&xwevent,userdata) ; - } - } - } - -#ifdef TRACE_WAIT_EVENT -if( Xw_get_trace() ) { - printf (" Xw_wait_event(%lx)\n",(long ) pwindow) ; -} -#endif - return (status); - -} diff --git a/src/Xw/Xw_zoom_image.cxx b/src/Xw/Xw_zoom_image.cxx deleted file mode 100755 index 79b367c12a..0000000000 --- a/src/Xw/Xw_zoom_image.cxx +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) 1999-2012 OPEN CASCADE SAS -// -// The content of this file is subject to the Open CASCADE Technology Public -// License Version 6.5 (the "License"). You may not use the content of this file -// except in compliance with the License. Please obtain a copy of the License -// at http://www.opencascade.org and read it completely before using this file. -// -// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its -// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -// -// The Original Code and all software distributed under the License is -// distributed on an "AS IS" basis, without warranty of any kind, and the -// Initial Developer hereby disclaims all such warranties, including without -// limitation, any warranties of merchantability, fitness for a particular -// purpose or non-infringement. Please see the License for the specific terms -// and conditions governing the rights and limitations under the License. - -#include - -#define MAXISIZE 1600*1200 - -/* ifdef then trace on */ -#ifdef TRACE -# define TRACE_ZOOM_IMAGE -#endif - -/* - XW_STATUS Xw_zoom_image (aimage,zoom): - XW_EXT_IMAGEDATA *aimage Image to ZOOM - float zoom Zoom Coef to apply (>0.) - - Apply a ZOOM factor to an image - - returns ERROR if bad zoom factor - returns SUCCESS if successfull - -*/ - -#ifdef XW_PROTOTYPE -XW_STATUS Xw_zoom_image (void* aimage,float zoom) -#else -XW_STATUS Xw_zoom_image (aimage,zoom) -void *aimage; -float zoom ; -#endif /*XW_PROTOTYPE*/ -{ -XW_EXT_IMAGEDATA *pimage = (XW_EXT_IMAGEDATA*)aimage ; -XImage *pximage,*qximage ; -int i,j,isize,wp,hp,xp,yp,xq,yq,xn,yn,dxp,dyp,npixel,num_pixel[MAXCOLOR] ; -unsigned long pixel,bpixel,tab_pixel[MAXCOLOR]; -float ratio; - - - if( !Xw_isdefine_image(pimage) ) { - /*ERROR*Bad EXT_IMAGE Address*/ - Xw_set_error(25,"Xw_zoom_image",pimage) ; - return (XW_ERROR) ; - } - - if( zoom <= 0. ) { - /*ERROR*Bad Image Zoom factor*/ - Xw_set_error(113,"Xw_zoom_image",&zoom) ; - return (XW_ERROR) ; - } - - pximage = pimage->pximage ; - qximage = (XImage*) Xw_malloc(sizeof(XImage)) ; - - if( !qximage ) { - /*ERROR*XImage Allocation failed*/ - Xw_set_error(60,"Xw_zoom_image",NULL) ; - return (XW_ERROR) ; - } - - Xw_bytecopy((char*)pximage,(char*)qximage,sizeof(XImage)) ; - - wp = pximage->width; hp = pximage->height; - ratio = (float)wp/hp; - qximage->width = (int )( wp * zoom ); - qximage->height = (int )( hp * zoom ); - dxp = dyp = 0; - - double datasize = qximage->width*qximage->height; - if (datasize > MAXISIZE) { - // ERROR*ZOOM factor is too big - printf(" ***Xw_zoom_image(%f).Too BIG zoom, full image can't be zoomed.\n",zoom); - Xw_set_error(130, "Xw_zoom_image", &zoom); - return (XW_ERROR); - } - - if (fabs(zoom - pimage->zoom) < 0.01) { - return XW_SUCCESS; - } - - qximage->bytes_per_line = qximage->width * (pximage->bitmap_pad/8) ; - isize = qximage->bytes_per_line * qximage->height ; - qximage->data = (char*) Xw_malloc(isize) ; - - if( !qximage->data ) { - /*ERROR*XImage Allocation failed*/ - Xw_set_error(60,"Xw_zoom_image",NULL) ; - return (XW_ERROR) ; - } - - bpixel = XGetPixel(pximage,0,0) ; - - if( zoom > 1. ) { - for( yp=yq=0 ; yp= qximage->height ) yn = qximage->height-1 ; - for( xp=xq=0 ; xp= qximage->width ) xn = qximage->width-1 ; - pixel = XGetPixel(pximage,xp+dxp,yp+dyp) ; - if( ((xn-xq) > 1) || ((yn-yq) > 1) ) { - register int x,y; - for( y=yq ; yheight ; yp=yn,yq++ ) { - yn = (int )( (yq+1)/zoom+0.5 ); - if( yn >= pximage->height ) yn = pximage->height-1 ; - for( xp=xq=0 ; xqwidth ; xp=xn,xq++ ) { - xn = (int )( (xq+1)/zoom+0.5 ); - if( xn >= pximage->width ) xn = pximage->width-1 ; - if( xn-1 > xp && yn-1 > yp ) { - register int x,y,ipixel = 0; - npixel = 0; - for( y=yp ; y= npixel ) ipixel = 0; - } - if( i >= npixel ) { - ipixel = npixel; - num_pixel[npixel] = 1; - tab_pixel[npixel] = pixel; - if( npixel < MAXCOLOR-1 ) npixel++; - } - } - } - } - - if( npixel > 0 ) { - j = 0; - for( i=1 ; i num_pixel[j] ) j = i; - } - bpixel = pixel = tab_pixel[j]; - } else { - pixel = bpixel; - } - } else { - pixel = XGetPixel(pximage,xp,yp) ; - } - XPutPixel(qximage,xq,yq,pixel) ; - } - } - } - - if( _ZIMAGE && (_ZIMAGE != _IIMAGE) ) { - XDestroyImage(_ZIMAGE); - } - - _ZIMAGE = qximage; - pimage->zoom = zoom; - -#ifdef TRACE_ZOOM_IMAGE -if( Xw_get_trace() ) { - printf (" Xw_zoom_image(%lx,%f)\n",(long ) pimage,zoom); -} -#endif - - return (XW_SUCCESS); -} diff --git a/tests/bugs/vis/bug23123 b/tests/bugs/vis/bug23123 index 3c0866363d..f74496b93b 100755 --- a/tests/bugs/vis/bug23123 +++ b/tests/bugs/vis/bug23123 @@ -15,14 +15,14 @@ XShow D vfit vsetdispmode 1 -if { [string compare $tcl_platform(platform) "windows"] != 0 } { - set x1 150 - set y1 210 -} else { - set x1 240 - set y1 299 -} -checkcolor $x1 $y1 0.67 0.67 0.67 +puts "Point color test:" +set x1 310 +set y1 225 +set r1 0.04 +set g1 0.04 +set b1 0.67 + +checkcolor $x1 $y1 $r1 $g1 $b1 set only_screen 1 -- 2.20.1