Patch level : 01.00 0282

Files correlati     : f23.dir f23.trr f9.dir f9.trr

Bug                 :
Aggiornamento FePA
This commit is contained in:
Alessandro Bonazzi 2025-06-09 01:21:21 +02:00
parent ba7dcc8f09
commit 9404d2ea54
36 changed files with 43437 additions and 4 deletions

117
build/agalib01.sln Normal file
View File

@ -0,0 +1,117 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2002
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AgaLib01", "AgaLib01.vcxproj", "{2D38A763-3D74-4338-9362-B891784EC90E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xi", "xi.vcxproj", "{3A5B0119-6DAD-4407-9EE1-3B739B0581E8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xvaga01", "xvaga01.vcxproj", "{4A2FC619-2461-4F58-8F1D-92FA153E39A2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xvapp", "xvapp.vcxproj", "{153C04B0-1F72-4DA9-8AC1-7DF76FFACFD2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xvtdb", "xvtdb.vcxproj", "{9C91BACF-9A70-4973-B8CC-FA3D2AF9867C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xvslt", "xvslt.vcxproj", "{7ECF3959-40CC-4BAA-A5E1-8699789AC386}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base64", "..\libraries\libb64\base64\VisualStudioProject\base64.vcxproj", "{0B094121-DC64-4D74-AFA0-750B83F800D0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gfm", "gfm.vcxproj", "{37C3DDAE-3A63-4C1C-A419-242141B262ED}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cb6", "Cb6.vcxproj", "{99683594-420F-4DD9-BB41-7DC48278B931}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pdflib", "pdflib_dll.vcxproj", "{A294C667-27A9-4125-82AF-5093447505EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pdflibwrap", "pdflibwrap.vcxproj", "{21876C3B-F5A9-4AAA-9D58-F8DDDAF6F10C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Uno", "Uno.vcxproj", "{8B0477F1-5D74-46C3-97B6-8879E2460A71}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2D38A763-3D74-4338-9362-B891784EC90E}.Debug|Win32.ActiveCfg = Debug|Win32
{2D38A763-3D74-4338-9362-B891784EC90E}.Debug|Win32.Build.0 = Debug|Win32
{2D38A763-3D74-4338-9362-B891784EC90E}.Debug|x64.ActiveCfg = Debug|Win32
{2D38A763-3D74-4338-9362-B891784EC90E}.Release|Win32.ActiveCfg = Release|Win32
{2D38A763-3D74-4338-9362-B891784EC90E}.Release|Win32.Build.0 = Release|Win32
{2D38A763-3D74-4338-9362-B891784EC90E}.Release|x64.ActiveCfg = Release|Win32
{3A5B0119-6DAD-4407-9EE1-3B739B0581E8}.Debug|Win32.ActiveCfg = Debug|Win32
{3A5B0119-6DAD-4407-9EE1-3B739B0581E8}.Debug|Win32.Build.0 = Debug|Win32
{3A5B0119-6DAD-4407-9EE1-3B739B0581E8}.Debug|x64.ActiveCfg = Debug|Win32
{3A5B0119-6DAD-4407-9EE1-3B739B0581E8}.Release|Win32.ActiveCfg = Release|Win32
{3A5B0119-6DAD-4407-9EE1-3B739B0581E8}.Release|Win32.Build.0 = Release|Win32
{3A5B0119-6DAD-4407-9EE1-3B739B0581E8}.Release|x64.ActiveCfg = Release|Win32
{4A2FC619-2461-4F58-8F1D-92FA153E39A2}.Debug|Win32.ActiveCfg = Debug|Win32
{4A2FC619-2461-4F58-8F1D-92FA153E39A2}.Debug|Win32.Build.0 = Debug|Win32
{4A2FC619-2461-4F58-8F1D-92FA153E39A2}.Debug|x64.ActiveCfg = Debug|Win32
{4A2FC619-2461-4F58-8F1D-92FA153E39A2}.Release|Win32.ActiveCfg = Release|Win32
{4A2FC619-2461-4F58-8F1D-92FA153E39A2}.Release|Win32.Build.0 = Release|Win32
{4A2FC619-2461-4F58-8F1D-92FA153E39A2}.Release|x64.ActiveCfg = Release|Win32
{153C04B0-1F72-4DA9-8AC1-7DF76FFACFD2}.Debug|Win32.ActiveCfg = Debug|Win32
{153C04B0-1F72-4DA9-8AC1-7DF76FFACFD2}.Debug|Win32.Build.0 = Debug|Win32
{153C04B0-1F72-4DA9-8AC1-7DF76FFACFD2}.Debug|x64.ActiveCfg = Debug|Win32
{153C04B0-1F72-4DA9-8AC1-7DF76FFACFD2}.Release|Win32.ActiveCfg = Release|Win32
{153C04B0-1F72-4DA9-8AC1-7DF76FFACFD2}.Release|Win32.Build.0 = Release|Win32
{153C04B0-1F72-4DA9-8AC1-7DF76FFACFD2}.Release|x64.ActiveCfg = Release|Win32
{9C91BACF-9A70-4973-B8CC-FA3D2AF9867C}.Debug|Win32.ActiveCfg = Release|Win32
{9C91BACF-9A70-4973-B8CC-FA3D2AF9867C}.Debug|Win32.Build.0 = Release|Win32
{9C91BACF-9A70-4973-B8CC-FA3D2AF9867C}.Debug|x64.ActiveCfg = Debug|Win32
{9C91BACF-9A70-4973-B8CC-FA3D2AF9867C}.Release|Win32.ActiveCfg = Release|Win32
{9C91BACF-9A70-4973-B8CC-FA3D2AF9867C}.Release|Win32.Build.0 = Release|Win32
{9C91BACF-9A70-4973-B8CC-FA3D2AF9867C}.Release|x64.ActiveCfg = Release|Win32
{7ECF3959-40CC-4BAA-A5E1-8699789AC386}.Debug|Win32.ActiveCfg = Debug|Win32
{7ECF3959-40CC-4BAA-A5E1-8699789AC386}.Debug|Win32.Build.0 = Debug|Win32
{7ECF3959-40CC-4BAA-A5E1-8699789AC386}.Debug|x64.ActiveCfg = Debug|Win32
{7ECF3959-40CC-4BAA-A5E1-8699789AC386}.Release|Win32.ActiveCfg = Release|Win32
{7ECF3959-40CC-4BAA-A5E1-8699789AC386}.Release|Win32.Build.0 = Release|Win32
{7ECF3959-40CC-4BAA-A5E1-8699789AC386}.Release|x64.ActiveCfg = Release|Win32
{0B094121-DC64-4D74-AFA0-750B83F800D0}.Debug|Win32.ActiveCfg = Debug|Win32
{0B094121-DC64-4D74-AFA0-750B83F800D0}.Debug|Win32.Build.0 = Debug|Win32
{0B094121-DC64-4D74-AFA0-750B83F800D0}.Debug|x64.ActiveCfg = Debug|Win32
{0B094121-DC64-4D74-AFA0-750B83F800D0}.Release|Win32.ActiveCfg = Release|Win32
{0B094121-DC64-4D74-AFA0-750B83F800D0}.Release|Win32.Build.0 = Release|Win32
{0B094121-DC64-4D74-AFA0-750B83F800D0}.Release|x64.ActiveCfg = Release|Win32
{37C3DDAE-3A63-4C1C-A419-242141B262ED}.Debug|Win32.ActiveCfg = Debug|Win32
{37C3DDAE-3A63-4C1C-A419-242141B262ED}.Debug|Win32.Build.0 = Debug|Win32
{37C3DDAE-3A63-4C1C-A419-242141B262ED}.Debug|x64.ActiveCfg = Debug|Win32
{37C3DDAE-3A63-4C1C-A419-242141B262ED}.Release|Win32.ActiveCfg = Release|Win32
{37C3DDAE-3A63-4C1C-A419-242141B262ED}.Release|Win32.Build.0 = Release|Win32
{37C3DDAE-3A63-4C1C-A419-242141B262ED}.Release|x64.ActiveCfg = Release|Win32
{99683594-420F-4DD9-BB41-7DC48278B931}.Debug|Win32.ActiveCfg = Debug|Win32
{99683594-420F-4DD9-BB41-7DC48278B931}.Debug|Win32.Build.0 = Debug|Win32
{99683594-420F-4DD9-BB41-7DC48278B931}.Debug|x64.ActiveCfg = Debug|Win32
{99683594-420F-4DD9-BB41-7DC48278B931}.Release|Win32.ActiveCfg = Release|Win32
{99683594-420F-4DD9-BB41-7DC48278B931}.Release|Win32.Build.0 = Release|Win32
{99683594-420F-4DD9-BB41-7DC48278B931}.Release|x64.ActiveCfg = Release|Win32
{A294C667-27A9-4125-82AF-5093447505EC}.Debug|Win32.ActiveCfg = Debug|Win32
{A294C667-27A9-4125-82AF-5093447505EC}.Debug|Win32.Build.0 = Debug|Win32
{A294C667-27A9-4125-82AF-5093447505EC}.Debug|x64.ActiveCfg = Debug|Win32
{A294C667-27A9-4125-82AF-5093447505EC}.Release|Win32.ActiveCfg = Release|Win32
{A294C667-27A9-4125-82AF-5093447505EC}.Release|Win32.Build.0 = Release|Win32
{A294C667-27A9-4125-82AF-5093447505EC}.Release|x64.ActiveCfg = Release|Win32
{21876C3B-F5A9-4AAA-9D58-F8DDDAF6F10C}.Debug|Win32.ActiveCfg = Debug|Win32
{21876C3B-F5A9-4AAA-9D58-F8DDDAF6F10C}.Debug|Win32.Build.0 = Debug|Win32
{21876C3B-F5A9-4AAA-9D58-F8DDDAF6F10C}.Debug|x64.ActiveCfg = Debug|Win32
{21876C3B-F5A9-4AAA-9D58-F8DDDAF6F10C}.Release|Win32.ActiveCfg = Release|Win32
{21876C3B-F5A9-4AAA-9D58-F8DDDAF6F10C}.Release|Win32.Build.0 = Release|Win32
{21876C3B-F5A9-4AAA-9D58-F8DDDAF6F10C}.Release|x64.ActiveCfg = Release|Win32
{8B0477F1-5D74-46C3-97B6-8879E2460A71}.Debug|Win32.ActiveCfg = Debug|Win32
{8B0477F1-5D74-46C3-97B6-8879E2460A71}.Debug|Win32.Build.0 = Debug|Win32
{8B0477F1-5D74-46C3-97B6-8879E2460A71}.Debug|x64.ActiveCfg = Debug|Win32
{8B0477F1-5D74-46C3-97B6-8879E2460A71}.Release|Win32.ActiveCfg = Release|Win32
{8B0477F1-5D74-46C3-97B6-8879E2460A71}.Release|Win32.Build.0 = Release|Win32
{8B0477F1-5D74-46C3-97B6-8879E2460A71}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F6953F85-8BF0-45D8-BFAA-DA516BDDEAED}
EndGlobalSection
EndGlobal

View File

@ -1,3 +1,3 @@
23 23
0 0
$mov|0|0|714|0|Movimenti di prima nota||| $mov|0|0|747|0|Movimenti di prima nota|||

View File

@ -1,5 +1,5 @@
23 23
68 71
ANNOES|9|4|0|Codice esercizio ANNOES|9|4|0|Codice esercizio
NUMREG|3|7|0|Numero di operazione NUMREG|3|7|0|Numero di operazione
DATAREG|5|8|0|Data operazione DATAREG|5|8|0|Data operazione
@ -68,6 +68,9 @@ DATADOCSDI|5|8|0|Data documento SDI
COLL_GOLEM|11|10|0|Documenti generici COLL_GOLEM|11|10|0|Documenti generici
CARTACEI|11|10|0|Documenti cartacei CARTACEI|11|10|0|Documenti cartacei
KEYPAF|1|80|0|Chiavi del PAFW300 [KEYPRGINVIO;KEYHEADERFATT;KEYBODYFATT] KEYPAF|1|80|0|Chiavi del PAFW300 [KEYPRGINVIO;KEYHEADERFATT;KEYBODYFATT]
XMLNAME|1|25|0|Nome del flie XML
PRGINVIO|1|7|0|Prgressivo invio
STATOSDI|1|1|0|Stato SDI
4 4
NUMREG| NUMREG|
DATAREG+NUMREG|X DATAREG+NUMREG|X

View File

@ -1,3 +1,3 @@
9 9
1 1
%nditte|0|0|758|0|Ditte||| %nditte|0|0|765|0|Ditte|||

View File

@ -1,5 +1,5 @@
9 9
65 69
CODDITTA|3|5|0| CODDITTA|3|5|0|
TIPOA|1|1|0| TIPOA|1|1|0|
CODANAGR|3|5|0| CODANAGR|3|5|0|
@ -34,6 +34,7 @@ RAPPR|3|5|0|
CARRAPP|2|1|0| CARRAPP|2|1|0|
DECCARINT|5|8|0| DECCARINT|5|8|0|
REGSTATSP|8|1|0| REGSTATSP|8|1|0|
TIPOF|1|1|0|Tipo anagrafico del firmatario
FIRMAT|3|5|0| FIRMAT|3|5|0|
AZCONIUG|8|1|0| AZCONIUG|8|1|0|
MESIREDD|2|2|0| MESIREDD|2|2|0|
@ -64,6 +65,9 @@ OGGETTI|11|10|0|Collegamenti esterni
CODEORI|1|15|0|Codice EORI Ditta CODEORI|1|15|0|Codice EORI Ditta
PEC|1|80|0|PEC PEC|1|80|0|PEC
PADESTIN|1|7|0|Codice destinatario SDI PADESTIN|1|7|0|Codice destinatario SDI
TITOLO|1|0|0|Titolo onorifico
TIPOEMITT|1|0|0|Tipo anagrafico del'emittente
EMITT|3|6|0|Codice dell'emittente
REGFISC|1|4|0|Regime fiscale REGFISC|1|4|0|Regime fiscale
4 4
CODDITTA| CODDITTA|

4442
src/xi01/xi.c Normal file

File diff suppressed because it is too large Load Diff

1534
src/xi01/xi.h Normal file

File diff suppressed because it is too large Load Diff

4014
src/xi01/xi2.c Normal file

File diff suppressed because it is too large Load Diff

40
src/xi01/xi_int.h Normal file
View File

@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#ifndef INCL_XI_INT
#define INCL_XI_INT
int
xi_scroll_internal( XI_OBJ * xi_obj, int nbr_lines, int percent,
BOOLEAN same_cell );
void
xi_control_event_scroll( XI_OBJ * xi_obj, int nbr_lines, int percent,
BOOLEAN same_cell );
void realloc_ptrs( void ***ptrs, int nbr_ptrs, void *parent );
BOOLEAN
xi_move_focus_internal( XI_OBJ * xi_obj, BOOLEAN make_callbacks,
BOOLEAN next_if_disabled,
int check_for_reenabled );
XI_OBJ *
xi_search_itf( XI_OBJ * xi_obj, XI_SEARCH_TYPE search_type,
int parm1 );
XI_OBJ *xi_find_next_obj( XI_OBJ * focus_obj, XI_NEXT_TYPE tab_type, long c );
void xi_remove_window_from_list( XinWindow win );
void xi_clear_lasts( void );
void xi_close_window_internal( XI_OBJ * itf );
BOOLEAN call_cb( XI_OBJ * itf, XI_EVENT * xiev );
void xi_hscroll_internal( XI_OBJ * xi_obj, int nbr_lines, int pos );
void XVT_CALLCONV1 xi_hscroll
XVT_CC_ARGS( ( XI_OBJ * xi_obj,
int nbr_columns ) );
void xi_draw_field_button( XI_OBJ * xi_obj );
void xi_field_set_rect_internal( XI_OBJ *xi_obj, XinRect *rect );
void xi_container_set_rect_internal( XI_OBJ *xi_obj, XinRect *rect );
void xi_set_rect_internal( XI_OBJ *xi_obj, XinRect *rect );
#endif

284
src/xi01/xibitmap.c Normal file
View File

@ -0,0 +1,284 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#define XI_INTERNAL
#define XI_R3_COMPAT
#include "xi.h"
#include "xiutils.h"
#if XIWS != XIWS_MAC && XIWS != XIWS_XM && XIWS != XIWS_WXGTK
#include <io.h>
#endif
#if XIWS == XIWS_XM || XIWS == XIWS_WXGTK
#include <unistd.h>
#endif
XI_BITMAP *
xi_bitmap_create( char *filename, XI_BITMAP_MODE mode )
{
XI_BITMAP *bitmap;
bitmap = XinMemoryZeroAlloc( sizeof( XI_BITMAP ) );
if ( filename != NULL )
{
#if XIWS != XIWS_MAC
if ( access( filename, 0 ) != -1 )
#endif
bitmap->xin_bitmap = XinBitmapRead( filename );
if ( bitmap->xin_bitmap == NULL )
{
XinMemoryFree( bitmap );
return NULL;
}
}
bitmap->mode = mode;
bitmap->ref_count = 1;
return bitmap;
}
XI_BITMAP *
xi_bitmap_create_res( short id, XI_BITMAP_MODE mode )
{
XI_BITMAP *bitmap;
bitmap = XinMemoryZeroAlloc( sizeof( XI_BITMAP ) );
if ( id != 0 )
{
bitmap->xin_bitmap = XinBitmapReadRes( id );
if ( bitmap->xin_bitmap == NULL )
{
XinMemoryFree( bitmap );
return NULL;
}
}
bitmap->mode = mode;
bitmap->ref_count = 1;
return bitmap;
}
XI_BITMAP *
xi_bitmap_copy( XI_BITMAP * bitmap )
{
if ( bitmap != NULL )
bitmap->ref_count++;
return bitmap;
}
void
xi_bitmap_destroy( XI_BITMAP * bitmap )
{
if ( bitmap != NULL && --bitmap->ref_count == 0 )
{
if ( bitmap->xin_bitmap != NULL )
XinBitmapDestroy( bitmap->xin_bitmap );
XinMemoryFree( bitmap );
}
}
static void
normal_bitmap( XI_BITMAP * bitmap, XinWindow win, XinRect * rct )
{
short width,
height;
int x,
y;
XinRect src;
XinRect dest;
int full_width,
full_height;
XinBrush brush;
if ( bitmap->xin_bitmap == NULL )
width = height = 0;
else
XinBitmapSizeGet( bitmap->xin_bitmap, &width, &height );
full_width = rct->right - rct->left;
full_height = rct->bottom - rct->top;
if ( bitmap->hcenter )
{
if ( width > full_width )
x = 0;
else
x = ( full_width - width ) / 2;
}
else
x = bitmap->x_offset;
if ( bitmap->vcenter )
{
if ( height > full_height )
y = 0;
else
y = ( full_height - height ) / 2;
}
else
y = bitmap->y_offset;
if ( x + width > full_width )
width = full_width - x;
if ( y + height > full_height )
height = full_height - y;
if ( bitmap->xin_bitmap != 0 )
{
dest.top = rct->top + y;
dest.left = rct->left + x;
dest.bottom = dest.top + height;
dest.right = dest.left + width;
src.top = src.left = 0;
src.right = width;
src.bottom = height;
XinWindowBitmapDraw( win, bitmap->xin_bitmap, &dest, &src );
}
/* Draw background color around bitmap */
XinWindowPenSet( win, &hollow_cpen );
brush.pattern = XinBrushSolid;
brush.fore_color = bitmap->background;
XinWindowBrushSet( win, &brush );
if ( y > 0 )
{ /* Draw top rectangle */
dest.top = rct->top;
dest.left = rct->left;
dest.bottom = rct->top + y;
dest.right = rct->right;
xi_draw_rect( win, &dest );
}
if ( x > 0 )
{ /* Draw left rectangle */
dest.top = rct->top + y;
dest.left = rct->left;
dest.bottom = dest.top + height;
dest.right = rct->left + x;
xi_draw_rect( win, &dest );
}
if ( x + width < full_width )
{ /* Draw right rectangle */
dest.top = rct->top + y;
dest.left = rct->left + x + width;
dest.bottom = dest.top + height;
dest.right = rct->right;
xi_draw_rect( win, &dest );
}
if ( y + height < full_height )
{ /* Draw bottom rectangle */
dest.top = rct->top + y + height;
dest.left = rct->left;
dest.bottom = rct->bottom;
dest.right = rct->right;
xi_draw_rect( win, &dest );
}
}
static void
resize_bitmap( XI_BITMAP * bitmap, XinWindow win, XinRect * rct )
{
short width,
height;
XinRect src;
XinBitmapSizeGet( bitmap->xin_bitmap, &width, &height );
src.top = src.left = 0;
src.right = width;
src.bottom = height;
XinWindowBitmapDraw( win, bitmap->xin_bitmap, rct, &src );
}
static void
tile_bitmap( XI_BITMAP * bitmap, XinWindow win, XinRect * rct, XinRect * clip_rct, BOOLEAN on_update )
{
short width,
height;
XinRect src;
XinRect dest;
int full_width,
full_height;
int x,
y;
XinBitmapSizeGet( bitmap->xin_bitmap, &width, &height );
full_width = rct->right - rct->left;
full_height = rct->bottom - rct->top;
src.top = 0;
src.left = 0;
src.bottom = height;
for ( y = 0; y < full_height; y += height )
{
dest.top = rct->top + y;
if ( clip_rct != NULL )
{
if ( dest.top > clip_rct->bottom )
break;
if ( dest.top + height < clip_rct->top )
continue;
}
if ( y + height > full_height )
src.bottom = full_height - y;
src.right = width;
for ( x = 0; x < full_width; x += width )
{
if ( x + width > full_width )
src.right = full_width - x;
dest.left = rct->left + x;
dest.right = dest.left + src.right;
dest.bottom = dest.top + src.bottom;
if ( clip_rct != NULL )
{
if ( dest.left > clip_rct->right )
break;
if ( dest.right < clip_rct->left )
continue;
}
if ( !on_update || XinWindowPaintNeeds( win, &dest ) )
XinWindowBitmapDraw( win, bitmap->xin_bitmap, &dest, &src );
}
}
}
void
xi_bitmap_draw( XI_BITMAP * bitmap, XinWindow win, XinRect * rct,
XinRect * clip_rct, BOOLEAN in_paint_event )
{
XI_BITMAP_MODE mode;
if ( bitmap == NULL )
return;
if ( bitmap->xin_bitmap == NULL )
mode = XI_BITMAP_NORMAL;
else
mode = bitmap->mode;
XinWindowClipSet( win, clip_rct );
switch ( mode )
{
case XI_BITMAP_NORMAL:
normal_bitmap( bitmap, win, rct );
break;
case XI_BITMAP_RESIZE:
resize_bitmap( bitmap, win, rct );
break;
case XI_BITMAP_TILE:
tile_bitmap( bitmap, win, rct, clip_rct, in_paint_event );
break;
}
}
void
xi_bitmap_size_get( XI_BITMAP * bitmap, short *width, short *height )
{
if ( bitmap != NULL && bitmap->xin_bitmap != NULL )
XinBitmapSizeGet( bitmap->xin_bitmap, width, height );
}
BOOLEAN
xi_bitmap_draw_all_on_resize( XI_BITMAP * bitmap )
{
if ( bitmap == NULL || bitmap->xin_bitmap == NULL )
return FALSE;
return ( ( bitmap->mode == XI_BITMAP_NORMAL && ( bitmap->vcenter || bitmap->hcenter ) )
|| bitmap->mode == XI_BITMAP_RESIZE );
}

1344
src/xi01/xicf.c Normal file

File diff suppressed because it is too large Load Diff

478
src/xi01/xidbg.c Normal file
View File

@ -0,0 +1,478 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#define XI_INTERNAL
#define XI_R3_COMPAT
#include "xi.h"
#include "xiutils.h"
#define UNDEFINED 1000
#define BUFFERLEN 200
static char *
bool_to_str( BOOLEAN b )
{
if ( b )
return "TRUE";
else
return "FALSE";
}
void
xi_event_debug( char *tag, XI_EVENT * xiev, char *s, int len )
{
char *tmp;
char str[BUFFERLEN],
str2[BUFFERLEN];
int i,
k;
int j;
XI_OBJ *xi_obj;
static struct
{
int type;
char *desc;
} event_text[] =
{
{
XIE_CHAR_FIELD, "XIE_CHAR_FIELD "
},
{
XIE_DBL_FIELD, "XIE_DBL_FIELD "
},
{
XIE_CHG_FIELD, "XIE_CHG_FIELD "
},
{
XIE_OFF_FIELD, "XIE_OFF_FIELD "
},
{
XIE_ON_FIELD, "XIE_ON_FIELD "
},
{
XIE_OFF_GROUP, "XIE_OFF_GROUP "
},
{
XIE_ON_GROUP, "XIE_ON_GROUP "
},
{
XIE_OFF_FORM, "XIE_OFF_FORM "
},
{
XIE_ON_FORM, "XIE_ON_FORM "
},
{
XIE_VIR_PAN, "XIE_VIR_PAN "
},
{
XIE_XVT_EVENT, "XIE_XVT_EVENT "
},
{
XIE_XVT_POST_EVENT, "XIE_XVT_POST_EVENT"
},
{
XIE_XIN_EVENT, "XIE_XIN_EVENT "
},
{
XIE_XIN_POST_EVENT, "XIE_XIN_POST_EVENT"
},
{
XIE_INIT, "XIE_INIT "
},
{
XIE_BUTTON, "XIE_BUTTON "
},
{
XIE_CHAR_CELL, "XIE_CHAR_CELL "
},
{
XIE_CLEANUP, "XIE_CLEANUP "
},
{
XIE_CLOSE, "XIE_CLOSE "
},
{
XIE_COMMAND, "XIE_COMMAND "
},
{
XIE_DBL_CELL, "XIE_DBL_CELL "
},
{
XIE_GET_FIRST, "XIE_GET_FIRST "
},
{
XIE_GET_LAST, "XIE_GET_LAST "
},
{
XIE_GET_NEXT, "XIE_GET_NEXT "
},
{
XIE_GET_PERCENT, "XIE_GET_PERCENT "
},
{
XIE_GET_PREV, "XIE_GET_PREV "
},
{
XIE_CELL_REQUEST, "XIE_CELL_REQUEST"
},
{
XIE_CHG_CELL, "XIE_CHG_CELL "
},
{
XIE_OFF_CELL, "XIE_OFF_CELL "
},
{
XIE_ON_CELL, "XIE_ON_CELL "
},
{
XIE_OFF_ROW, "XIE_OFF_ROW "
},
{
XIE_ON_ROW, "XIE_ON_ROW "
},
{
XIE_OFF_COLUMN, "XIE_OFF_COLUMN "
},
{
XIE_ON_COLUMN, "XIE_ON_COLUMN "
},
{
XIE_OFF_LIST, "XIE_OFF_LIST "
},
{
XIE_ON_LIST, "XIE_ON_LIST "
},
{
XIE_REC_ALLOCATE, "XIE_REC_ALLOCATE"
},
{
XIE_REC_FREE, "XIE_REC_FREE "
},
{
XIE_ROW_SIZE, "XIE_ROW_SIZE "
},
{
XIE_SELECT, "XIE_SELECT "
},
{
XIE_UPDATE, "XIE_UPDATE "
},
{
XIE_COL_DELETE, "XIE_COL_DELETE "
},
{
XIE_COL_MOVE, "XIE_COL_MOVE "
},
{
XIE_COL_SIZE, "XIE_COL_SIZE "
},
{
XIE_POST_NAVIGATION, "XIE_POST_NAVIGATION"
},
{
UNDEFINED, "Unknown XI Event"
}
};
static struct
{
XinEventType type;
char *desc;
} xin_event_text[] =
{
{
XinEventCreate, "XinEventCreate"
},
{
XinEventDestroy, "XinEventDestroy"
},
{
XinEventFocus, "XinEventFocus"
},
{
XinEventResize, "XinEventResize"
},
{
XinEventPaint, "XinEventPaint"
},
{
XinEventCloseButton, "XinEventCloseButton"
},
{
XinEventMouseDown, "XinEventMouseDown"
},
{
XinEventMouseUp, "XinEventMouseUp"
},
{
XinEventMouseMove, "XinEventMouseMove"
},
{
XinEventMouseDouble, "XinEventMouseDouble"
},
{
XinEventCharacter, "XinEventCharacter"
},
{
XinEventVScroll, "XinEventVScroll"
},
{
XinEventHScroll, "XinEventHScroll"
},
{
XinEventMenuCommand, "XinEventMenuCommand"
},
{
XinEventControl, "XinEventControl"
},
{
XinEventTimer, "XinEventTimer"
},
{
XinEventQuit, "XinEventQuit"
},
{
XinEventHelp, "XinEventHelp"
},
{
XinEventFont, "XinEventFont"
},
{
(XinEventType)UNDEFINED, "Unknown Xin Event"
}
};
static struct
{
int type;
char *desc;
} object_type[] =
{
{
XIT_BTN, "XIT_BTN"
},
{
XIT_CONTAINER, "XIT_CONTAINER"
},
{
XIT_FORM, "XIT_FORM"
},
{
XIT_FIELD, "XIT_FIELD"
},
{
XIT_GROUP, "XIT_GROUP"
},
{
XIT_LINE, "XIT_LINE"
},
{
XIT_RECT, "XIT_RECT"
},
{
XIT_TEXT, "XIT_TEXT"
},
{
XIT_CELL, "XIT_CELL"
},
{
XIT_COLUMN, "XIT_COLUMN"
},
{
XIT_ITF, "XIT_ITF"
},
{
XIT_LIST, "XIT_LIST"
},
{
XIT_ROW, "XIT_ROW"
},
{
UNDEFINED, "Unknown XI Object Type"
}
};
for ( i = 0; event_text[i].type != xiev->type &&
event_text[i].type != UNDEFINED; ++i )
;
sprintf( str, "%s: %s", tag, event_text[i].desc );
*str2 = '\0';
switch ( xiev->type )
{
#ifdef XI_USE_XVT
case XIE_XVT_EVENT:
case XIE_XVT_POST_EVENT:
sprintf( str2, " %s", XinXvtEventTextGet( &xiev->v.xvte ) );
break;
#endif
case XIE_XIN_EVENT:
case XIE_XIN_POST_EVENT:
for ( j = 0; xin_event_text[j].type != xiev->v.xin_event.type &&
xin_event_text[j].type != UNDEFINED; ++j )
;
sprintf( str2, " %s", xin_event_text[j].desc );
break;
case XIE_COMMAND:
sprintf( str2, " tag %d, shift %s, control %s", xiev->v.cmd.tag,
bool_to_str( xiev->v.cmd.shift ), bool_to_str( xiev->v.cmd.control ) );
break;
case XIE_INIT:
case XIE_BUTTON:
case XIE_CLOSE:
case XIE_DBL_CELL:
case XIE_DBL_FIELD:
case XIE_CHG_FIELD:
case XIE_OFF_FIELD:
case XIE_ON_FIELD:
case XIE_OFF_GROUP:
case XIE_ON_GROUP:
case XIE_OFF_FORM:
case XIE_ON_FORM:
case XIE_CHG_CELL:
case XIE_OFF_CELL:
case XIE_ON_CELL:
case XIE_OFF_ROW:
case XIE_ON_ROW:
case XIE_OFF_COLUMN:
case XIE_ON_COLUMN:
case XIE_OFF_LIST:
case XIE_ON_LIST:
case XIE_CLEANUP:
xi_obj = xiev->v.xi_obj;
for ( k = 0; object_type[k].type != xi_obj->type &&
object_type[k].type != UNDEFINED; ++k )
;
switch ( xi_obj->type )
{
case XIT_CELL:
sprintf( str2, " cid %3d, type %s r %d c %d v %d",
xi_obj->cid, object_type[k].desc, xi_obj->v.cell.row,
xi_obj->v.cell.column, !xi_obj->v.cell.is_vert_scrolled );
break;
case XIT_ROW:
sprintf( str2, " cid %3d, type %s r %d", xi_obj->cid,
object_type[k].desc, xi_obj->v.row );
break;
default:
sprintf( str2, " cid %3d, type %s", xi_obj->cid,
object_type[k].desc );
break;
}
break;
case XIE_CHAR_CELL:
case XIE_CHAR_FIELD:
{
char char_str[20];
int ch;
ch = xiev->v.chr.ch;
switch ( ch )
{
case XI_KEY_CLEAR:
strcpy( char_str, "XI_KEY_CLEAR" );
break;
case XI_KEY_DEL:
strcpy( char_str, "XI_KEY_DEL" );
break;
case '\b':
strcpy( char_str, "BS" );
break;
default:
char_str[0] = ( char ) ch;
char_str[1] = '\0';
break;
}
xi_obj = xiev->v.chr.xi_obj;
for ( k = 0; object_type[k].type != xi_obj->type &&
object_type[k].type != UNDEFINED; ++k )
;
switch ( xi_obj->type )
{
case XIT_CELL:
sprintf( str2,
" cid %3d type %s r %d c %d ch %s shft %d ctrl %d alt %d",
xi_obj->cid, object_type[k].desc, xi_obj->v.cell.row,
xi_obj->v.cell.column, char_str, xiev->v.chr.shift,
xiev->v.chr.control, xiev->v.chr.alt );
break;
case XIT_FIELD:
sprintf( str2, " cid %3d type %s ch %s shft %d ctrl %d alt %d", xi_obj->cid,
object_type[k].desc, char_str, xiev->v.chr.shift,
xiev->v.chr.control, xiev->v.chr.alt );
break;
default:
break;
}
break;
}
case XIE_GET_FIRST:
case XIE_GET_LAST:
sprintf( str2, " data_rec %08.8lx", ( long ) xiev->v.rec_request.data_rec );
break;
case XIE_GET_NEXT:
case XIE_GET_PREV:
sprintf( str2, " spec_rec %08.8lx, data_rec %08.8lx",
( long ) xiev->v.rec_request.spec_rec, ( long ) xiev->v.rec_request.data_rec );
break;
case XIE_CELL_REQUEST:
sprintf( str2, " c %2d, rec %08.8lx, len %3d",
( int ) xiev->v.cell_request.col_nbr, ( long ) xiev->v.cell_request.rec,
xiev->v.cell_request.len );
break;
case XIE_GET_PERCENT:
sprintf( str2, " list->cid %d, record %08.8lx",
xiev->v.get_percent.list->cid,
( long ) xiev->v.get_percent.record );
break;
case XIE_SELECT:
sprintf( str2, " row %d, selected %d, dbl_click %d shift %d control %d column %d",
xiev->v.select.xi_obj->v.row, xiev->v.select.selected,
xiev->v.select.dbl_click, xiev->v.select.shift, xiev->v.select.control, xiev->v.select.column );
break;
case XIE_REC_ALLOCATE:
sprintf( str2, " list cid %d", xiev->v.rec_allocate.list->cid );
break;
case XIE_REC_FREE:
sprintf( str2, " list cid %d, record %08.8lx", xiev->v.rec_free.list->cid, xiev->v.rec_free.record );
break;
case XIE_ROW_SIZE:
sprintf( str2, " row %d, new_size %d", xiev->v.row_size.xi_obj->v.row, xiev->v.row_size.new_row_height );
break;
case XIE_VIR_PAN:
sprintf( str2, " delta_x %d, delta_y %d, before_pan %d",
xiev->v.vir_pan.delta_x, xiev->v.vir_pan.delta_y,
xiev->v.vir_pan.before_pan );
break;
case XIE_COL_DELETE:
sprintf( str2, " list cid %d, col_nbr %d",
xiev->v.column.list->cid, xiev->v.column.col_nbr );
break;
case XIE_COL_MOVE:
sprintf( str2, " list cid %d, col_nbr %d, new_col_nbr %d",
xiev->v.column.list->cid, xiev->v.column.col_nbr,
xiev->v.column.new_col_nbr );
break;
case XIE_COL_SIZE:
sprintf( str2, " list cid %d, col_nbr %d, new_col_width %d, new_col_pixel_width %d",
xiev->v.column.list->cid, xiev->v.column.col_nbr,
xiev->v.column.new_col_width, xiev->v.column.new_col_pixel_width );
break;
default:
break;
}
tmp = ( char * ) xi_tree_malloc( strlen( str ) + strlen( str2 ) + 2, NULL );
strcpy( tmp, str );
strcat( tmp, str2 );
if ( ( int ) strlen( tmp ) >= len )
tmp[len] = '\0';
strcpy( s, tmp );
xi_tree_free( tmp );
}

34
src/xi01/xidisply.h Normal file
View File

@ -0,0 +1,34 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#define C_UL 218 /* upper left */
#define C_UR 191 /* upper right */
#define C_LL 192 /* lower left */
#define C_LR 217 /* lower right */
#define C_XD 194 /* T-intersection down */
#define C_XU 193 /* T-intersection up */
#define C_XR 195 /* T-intersection right */
#define C_XL 180 /* T-intersection left */
#define C_XX 197 /* 4-way intersection */
#define C_H 196 /* horizontal line */
#define C_V 179 /* vertical line */
#define C_ULD 201 /* next group same as above, but double */
#define C_URD 187
#define C_LLD 200
#define C_LRD 188
#define C_XDD 203
#define C_XUD 202
#define C_XRD 204
#define C_XLD 185
#define C_XXD 206
#define C_HD 205
#define C_VD 186
#define C_HATCH 176 /* hatching */
#define C_SPACE 255

316
src/xi01/xierr.c Normal file
View File

@ -0,0 +1,316 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#include "xi.h"
static struct s_error_entry
{
int errcode;
char *text;
} error_table[] =
{
{
1000, "Error: Problem 1000"
},
{
1001, "Warning: Problem 1001"
},
{
1002, "Error: XI_TEXT internal error"
},
{
20001, "XI: internal object deletion error"
},
{
20002, "Internal XI error"
},
{
20003, "Internal error"
},
{
20004, "Internal XI error"
},
{
20005, "Internal error"
},
{
20006, "Attempting to move to disabled or invisible object"
},
{
20007, "Attempting to move to disabled or invisible object"
},
{
20008, "XI: unknown STX callback"
},
{
20009, "XI: unknown LM callback"
},
{
20010, "Non-column object sent to xi_column_set_pixel_width"
},
{
20011, "Can't create empty container"
},
{
20012, "Containers can only contain buttons"
},
{
20013, "Can't mix button types in a container"
},
{
20014, "Not enough room in container for buttons"
},
{
20015, "Internal XI error"
},
{
20016, "xi_create: Invalid XI_OBJ_TYPE"
},
{
20017, "Invalid XI object passed to xi_delete"
},
{
20018, "Invalid object passed to xi_get_attrib"
},
{
20019, "xi_get_def_rect: Invalid XI_OBJ_TYPE in tree"
},
{
20020, "Non-list object passed to xi_get_list_info"
},
{
20021, "xi_get_rect: Invalid XI_OBJ_TYPE in tree"
},
{
20022, "Invalid object passed to xi_get_sel"
},
{
20023, "xi_get_text not implemented for XIT_ROW"
},
{
20024, "Invalidate object passed to xi_scroll_rec"
},
{
20025, "Invalidate object passed to xi_delete_row"
},
{
20026, "Invalidate object passed to xi_insert_row"
},
{
20027, "Invalid object passed to xi_set_attrib"
},
{
20028, "Invalid object passed to xi_set_sel"
},
{
20029, "xi_set_text not implemented for XIT_ROW"
},
{
20030, "Internal focus error"
},
{
20031, "Non-list object sent to xi_set_fixed_columns"
},
{
20032, "button height exceeds container height"
},
{
20033, "button width exceeds container width"
},
{
20034, "height must be at least 8 form units"
},
{
20035, "Buttons won't fit in container"
},
{
20036, "xi_container_reorient() passed wrong object type"
},
{
20037, "Invalidate object passed to xi_scroll_internal"
},
{
20038, "Non-list object sent to xi_get_fixed_columns"
},
{
20039, "Non-interface object sent to xi_itf_closing_is"
},
{
20050, "xi_create: Rectangles cannot have children"
},
{
20051, "xi_create: Lines cannot have children"
},
{
20052, "xi_create: Buttons cannot have children"
},
{
20053, "xi_create: Fields cannot have children"
},
{
20055, "xi_create: Static text controls cannot have children"
},
{
20056, "xi_create: Columns cannot have children"
},
{
20088, "xi_set_icon: Invalid object"
},
{
20089, "Too many radio buttons in a container"
},
{
20090, "create_window returned NULL"
},
{
20091, "Window information corrupt"
},
{
20092, "Window information corrupt"
},
{
20094, "Window information corrupt"
},
{
20095, "XinAppSystemSetupInit was not provided."
},
{
20101, "Invalid interface passed to xi_add_form_def"
},
{
20102, "Invalid interface passed to xi_add_list_def"
},
{
20103, "Invalid list passed to xi_add_column_def"
},
{
20104, "Invalid form passed to xi_add_field_def"
},
{
20105, "Invalid interface passed to xi_add_container_def"
},
{
20106, "Invalid parent passed to xi_add_button_def"
},
{
20107, "Invalid interface passed to xi_add_text_def"
},
{
20108, "Invalid interface passed to xi_add_line_def"
},
{
20109, "Groups must have at least one member"
},
{
20110, "Invalid interface passed to xi_add_group_def"
},
{
20111, "Invalid interface passed to xi_add_rect_def"
},
{
20112, "Invalid field buffer size"
},
{
20201, "Out of memory"
},
{
20907, "lm_get_attrib: Invalid LM part"
},
{
20908, "Attempting to get text from an invalid cell"
},
{
20915, "Invalid column number passed to lm_delete_column"
},
{
20917, "lm_set_buf_size: Invalid LM part"
},
{
20918, "lm_cell_request: Invalid LM part"
},
{
20919, "xi_insert_row called with get_all_records set to TRUE"
},
{
20920, "xi_delete_row called with get_all_records set to TRUE"
},
{
20921, "lm_focus_cell_set called when list does not have focus"
},
{
30101, "Internal focus error"
},
{
30201, "Internal TEXT error"
},
{
30202, "Internal TEXT error"
},
{
30203, "Internal error"
},
{
30205, "txt_caret called with disabled field"
},
{
30206, "Invalid TXT passed to txt_event"
},
{
30207, "xi_get_obj: Invalid cid"
},
{
30208, "width or height required with grid"
},
{
30209, "lm_start_edit: Internal error, called with focus not poperly set"
},
{
0, "Unknown Error"
}
};
char *
XinErrorCodeLookup( int errcode )
{
struct s_error_entry *entry;
static char temp[30];
for ( entry = error_table; entry->errcode != 0 && entry->errcode != errcode;
entry++ )
;
if ( entry->errcode == 0 )
{
sprintf( temp, "XIN Error %d", errcode );
return temp;
}
return entry->text;
}
BOOLEAN
XinErrorDefaultHandler( int errcode, XinSeverity severity, long app_data )
{
BOOLEAN terminate = FALSE;
NOREF( app_data );
if ( severity == XinSeverityFatal )
{
terminate = TRUE;
XinDialogError( "%s", XinErrorCodeLookup( errcode ) );
}
else
{
if ( XinDialogAsk( "Continue", "Terminate", NULL, "%s",
XinErrorCodeLookup( errcode ) ) == XinResponse2 )
terminate = TRUE;
}
return terminate;
}

65
src/xi01/xiextend.h Normal file
View File

@ -0,0 +1,65 @@
/*******************************************************************************
* Copyright 1991-1995 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. *
*******************************************************************************/
#ifdef WSWIN
#define NOCOMM
#define NOMINMAX
#define NOGDICAPMASKS
#define NOVIRTUALKEYCODES
#define NOWINMESSAGES
#define NOWINSTYLES
#define NOSYSMETRICS
#define NOMENUS
#define NOICONS
#define NOKEYSTATES
#define NOSYSCOMMANDS
#define NORASTEROPS
#define NOSHOWWINDOW
#define OEMRESOURCE
#define NOATOM
#define NOCLIPBOARD
#define NOCOLOR
#define NOCTLMGR
#define NODRAWTEXT
#define NOGDI
#define NOKERNEL
/* #define NOUSER */
#define NOMB
#define NOMEMMGR
#define NOMETAFILE
#define NOMINMAX
#define NOMSG
#define NOOPENFILE
#define NOSCROLL
#define NOSOUND
#define NOTEXTMETRIC
#define NOWH
#define NOWINOFFSETS
#define NOCOMM
#define NOKANJI
#define NOHELP
#define NOPROFILER
#define NODEFERWINDOWPOS
#include <windows.h>
#define INTERNAL
#endif
#ifdef OSOS2
#define INCL_DOS
#define INCL_WIN
#define INCL_GPI
#define COLOR pm_COLOR
#define UINT pm_UINT
#define ULONG pm_ULONG
#include <os2.h>
#undef COLOR
#undef UINT
#undef ULONG
#define INTERNAL
#endif

59
src/xi01/xiheap.c Normal file
View File

@ -0,0 +1,59 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#define XI_INTERNAL
#include "xi.h"
#include "xiheap.h"
#ifdef DEBUG
int nbr_malloc,
nbr_free;
#endif
void *
heap_malloc( size_t size )
{
void *p;
#ifdef DEBUG
nbr_malloc++;
#endif
p = XinMemoryAlloc( size );
if ( p != NULL )
memset( ( char * ) p, '\0', ( size_t ) size );
return ( p );
}
void
heap_free( void *p )
{
#ifdef DEBUG
nbr_free++;
#endif
XinMemoryFree( ( char * ) p );
}
void *
heap_realloc( void *p, size_t size )
{
return ( XinMemoryRealloc( ( char * ) p, size ) );
}
void
heap_dbg( char *title )
{
#ifdef DEBUG
XinDebugPrintf( "heap check (%Fs): malloc's=%u, free's=%u", title, nbr_malloc, nbr_free );
#else
NOREF( title );
#endif
}

49
src/xi01/xiheap.h Normal file
View File

@ -0,0 +1,49 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
/******************************************************************
Heap module
******************************************************************/
void *heap_malloc( size_t size );
void heap_free( void *p );
void *heap_realloc( void *p, size_t size );
void heap_dbg( char *title );
#define MAX_NODE_SIZE 16000
#define HEAP_SIZE 32000
#define NODE_SET_MAGIC(node) (node->size = 0xFFFF)
#define NODE_IS_MAGIC(node) (node->size == 0xFFFF)
#define NODE_MARK_ALLOCATED(node) (node->size |= 0x8000)
#define NODE_MARK_FREE(node) (node->size &= 0x7FFF)
#define NODE_IS_FREE(node) ( (node->size & 0x8000) == 0 )
#define NODE_SET_SIZE(node, n) (node->size = (node->size & 0x8000) | (n))
#define NODE_GET_SIZE(node) (node->size & 0x7FFF)
#define PTR_IS_GLOBAL(p) ((PTR_LONG(p) & 0xFFFF) == 0)
#define NEXT_NODE(node) ( (NODE *)((char *)node + sizeof(NODE) + NODE_GET_SIZE(node)))
#define PTR_TO_NODE(p) ((NODE *)(p) - 1)
#define NODE_TO_PTR(node) ((char *)(node + 1))
typedef struct _s_node
{
unsigned short size;
} NODE;
typedef struct _s_enode
{
unsigned short size; /* equal to NODE_MAGIC */
struct _s_node *next; /* pointer to next heap */
} E_NODE;
#define ALIGNMENT (sizeof(NODE))

48
src/xi01/xil.h Normal file
View File

@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#ifndef INCL_XIL
#define INCL_XIL
#include "xi.h"
#include "xvtcm.h"
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct
{
XVTCM_CONTROL_INFO ci;
XI_OBJ *itf;
XI_EVENT *xiev;
} XIL_DATA;
WINDOW XVT_CALLCONV1 xil_create XVT_CC_ARGS( ( int cid, int left, int top,
int right, int bottom, int prop_count,
char **prop_list, WINDOW parent_win,
int parent_rid, long parent_flags,
char *parent_class ) );
XI_OBJ_DEF *XVT_CALLCONV1 xil_parse XVT_CC_ARGS( ( int cid, int prop_count,
char **prop_list ) );
WINDOW XVT_CALLCONV1 xis_create XVT_CC_ARGS( ( int cid, int left, int top,
int right, int bottom, int prop_count,
char **prop_list, WINDOW parent_win,
int parent_rid, long parent_flags,
char *parent_class ) );
#ifdef __cplusplus
}
// End of extern "C"
#endif
#endif

1622
src/xi01/xilm.c Normal file

File diff suppressed because it is too large Load Diff

679
src/xi01/xilm.h Normal file
View File

@ -0,0 +1,679 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
/******************************************************************
LM module
******************************************************************/
#define LM_ATR_ENABLED XI_ATR_ENABLED
#define LM_ATR_VISIBLE XI_ATR_VISIBLE
#define LM_ATR_NAVIGATE XI_ATR_NAVIGATE
#define LM_ATR_TABWRAP XI_ATR_TABWRAP
/*-------------------------------------------------------------------------
function: lm_adj_v
lmp: current lmp
v: to vertical coord to convert
-------------------------------------------------------------------------*/
#define lm_adj_v(lmp, v) (v = v + lmp->mlr.top + lmp->rrr_offset)
typedef enum _lm_cb_type
{
LM_CB_CHAR,
LM_CB_CHANGE,
LM_CB_DBL,
LM_CB_FOCUS,
LM_CB_TEXT,
LM_CB_SELECT,
LM_CB_CELL_BTN,
LM_CB_GET_FIRST,
LM_CB_GET_NEXT,
LM_CB_GET_PREV,
LM_CB_GET_LAST,
LM_CB_GET_PERCENT,
LM_CB_REC_ALLOCATE,
LM_CB_REC_FREE,
LM_CB_ROW_SIZE,
LM_CB_COL_DELETE,
LM_CB_COL_MOVE,
LM_CB_COL_SIZE,
LM_CB_DROP_ROW
}
LM_CB_TYPE;
typedef struct _lm_cb_data
{
LM lm;
LM_CB_TYPE cb_type;
int cid;
XinWindow win;
int row;
int column;
long rec;
union
{
struct
{
long spec_rec;
long data_rec;
int percent;
unsigned long attrib;
XinColor color;
BOOLEAN refused;
int row_height;
BOOLEAN has_focus;
} rec_request;
struct
{
int new_row_height;
BOOLEAN refused;
} row_size;
struct
{
long record;
} rec_allocate;
struct
{
long record;
} rec_free;
struct
{
long record;
int percent;
} get_percent;
struct
{
char *text;
int len;
int icon_rid;
XI_BITMAP* bitmap;
unsigned long attrib;
XinColor color;
XinColor back_color;
XinFont *font;
BOOLEAN button;
BOOLEAN button_on_left;
BOOLEAN button_on_focus;
BOOLEAN button_full_cell;
int button_icon_rid;
XI_BITMAP* button_bitmap;
void *font_id;
} text;
BOOLEAN refused;
struct
{
int ch;
BOOLEAN shift;
BOOLEAN control;
BOOLEAN alt;
BOOLEAN is_paste;
BOOLEAN refused;
} chr;
struct
{
BOOLEAN dbl_click;
BOOLEAN selected;
BOOLEAN refused;
BOOLEAN shift;
BOOLEAN control;
int column;
} select;
struct
{
BOOLEAN shift;
BOOLEAN control;
} cell_btn;
struct
{
int new_col_nbr;
BOOLEAN in_fixed;
int new_col_width;
int new_col_pixel_width;
BOOLEAN refused;
} column;
struct
{
XI_OBJ* src_list;
long src_rec;
BOOLEAN after_all_rows;
BOOLEAN delete_row;
BOOLEAN shift;
BOOLEAN control;
} drop_row;
/* nothing for LM_CB_CHANGE */
} v;
} LM_CB_DATA;
typedef void ( *LM_CB ) ( LM_CB_DATA * lm_cb_data );
#define LM_COL_ATR_ENABLED XI_ATR_ENABLED
#define LM_COL_ATR_EDITMENU XI_ATR_EDITMENU
#define LM_COL_ATR_AUTOSELECT XI_ATR_AUTOSELECT
#define LM_COL_ATR_AUTOSCROLL XI_ATR_AUTOSCROLL
#define LM_COL_ATR_RJUST XI_ATR_RJUST
#define LM_COL_ATR_READONLY XI_ATR_READONLY
#define LM_COL_ATR_PASSWORD XI_ATR_PASSWORD
#define LM_COL_ATR_SELECTED XI_ATR_SELECTED
#define LM_COL_ATR_SELECTABLE XI_ATR_SELECTABLE
#define LM_COL_ATR_COL_SELECTABLE XI_ATR_COL_SELECTABLE
#define LM_COL_ATR_VISIBLE XI_ATR_VISIBLE
#define LM_ROW_ATR_ENABLED XI_ATR_ENABLED
#define LM_ROW_ATR_SELECTED XI_ATR_SELECTED
#define LM_CELL_ATR_SELECTED XI_ATR_SELECTED
#define LM_CELL_ATR_RJUST XI_ATR_RJUST
#define LM_CELL_ATR_HCENTER XI_ATR_HCENTER
typedef struct _lm_column_data
{
unsigned long attrib;
short pix_width;
short x_pix_pos;
short text_size;
char *heading_text;
short width;
BOOLEAN center_heading;
BOOLEAN heading_well;
BOOLEAN heading_platform;
BOOLEAN column_well;
BOOLEAN column_platform;
XinFont *font;
int icon_rid;
short icon_x;
short icon_y;
XI_BITMAP* bitmap;
BOOLEAN size_rows;
BOOLEAN suppress_update_heading;
BOOLEAN suppress_update_cells;
BOOLEAN vertical_align_center;
BOOLEAN vertical_align_bottom;
BOOLEAN wrap_text;
BOOLEAN wrap_text_scrollbar;
BOOLEAN cr_ok;
BOOLEAN var_len_text;
BOOLEAN auto_tab;
XI_ICON_MODE_TYPE icon_mode;
BOOLEAN pushed;
/* temporary variables - don't assume this is good */
XinRect column_rct; /* used for caching column rectangles to speed
* drawing */
XinRect prct; /* physical rect */
BOOLEAN XinWindowPaintNeeds;
} LM_COLUMN_DATA;
typedef struct _lm_column_def
{
unsigned long attrib;
short position;
short pix_width; /* pixels */
short text_size;
char *heading_text;
BOOLEAN center_heading;
BOOLEAN heading_well;
BOOLEAN heading_platform;
BOOLEAN column_well;
BOOLEAN column_platform;
XinFont *font;
int icon_rid;
short icon_x;
short icon_y;
XI_BITMAP* bitmap;
BOOLEAN size_rows;
BOOLEAN suppress_update_heading;
BOOLEAN suppress_update_cells;
BOOLEAN vertical_align_center;
BOOLEAN vertical_align_bottom;
BOOLEAN wrap_text;
BOOLEAN wrap_text_scrollbar;
BOOLEAN cr_ok;
BOOLEAN var_len_text;
BOOLEAN auto_tab;
XI_ICON_MODE_TYPE icon_mode;
} LM_COLUMN_DEF;
typedef struct _lm_def
{
int cid;
XI_OBJ *list_obj;
XI_OBJ *itf_obj;
/* XI may specify this */
XinPoint pnt;
short pixel_height;
/* If absolute height is set, then the height of the list will be exactly
* height pixels high */
BOOLEAN absolute_height;
short pixel_width;
short pix_char_width;
unsigned long attrib;
LM_CB lm_cb;
XinFont *font;
BOOLEAN is_list_font; /* False, if "font" is from the interface or system */
XinColor enabled_color; /* but inactive */
XinColor back_color;
XinColor disabled_color;
XinColor disabled_back_color;
XinColor active_color;
XinColor active_back_color;
XinColor white_space_color;
XinColor rule_color;
char *parent;
BOOLEAN no_heading;
BOOLEAN one_row_list;
int nbr_rows;
int realized_rows_array_len;
BOOLEAN sizable_columns;
BOOLEAN movable_columns;
short fixed_columns;
short min_cell_height;
short min_heading_height;
BOOLEAN no_horz_lines;
BOOLEAN no_vert_lines;
int first_vis_column;
BOOLEAN drop_and_delete;
BOOLEAN select_cells;
BOOLEAN fixed_row_height;
BOOLEAN sizable_rows;
BOOLEAN get_all_records;
BOOLEAN resize_with_window;
int horz_sync_list;
int vert_sync_list;
BOOLEAN row_focus_border;
XinColor row_focus_border_color;
int max_lines_in_cell;
BOOLEAN single_select;
BOOLEAN retain_back_color_on_select;
BOOLEAN drag_and_drop_rows;
BOOLEAN drag_rows_autoscroll;
BOOLEAN button_on_cell_focus;
int position_by_typing_cid;
} LM_DEF;
#define LM_HEADING_TEXT 1001
typedef enum
{
LM_LIST,
LM_ROW,
LM_COLUMN,
LM_CELL
}
LM_PART;
typedef struct _lm_cell_data
{
unsigned long attrib;
XinFont *font;
XinColor color;
XinColor back_color;
int icon_rid;
XI_BITMAP* bitmap;
BOOLEAN button;
BOOLEAN button_on_left;
BOOLEAN button_on_focus;
BOOLEAN button_full_cell;
int button_icon_rid;
XI_BITMAP* button_bitmap;
BOOLEAN valid_data;
int font_height;
XI_TEXT *xi_text;
} LM_CELL_DATA;
typedef struct _lm_data
{
int cid;
XinWindow win;
XinRect rct;
short pix_top;
short pix_hdr_bottom;
short pix_row1_top;
short pix_char_width;
short pix_cell_height;
short pix_row_spacing;
unsigned long attrib;
short nbr_columns;
LM_COLUMN_DATA **lm_column_data;
XinColor back_color;
XinColor enabled_color; /* but inactive */
XinColor disabled_color;
XinColor disabled_back_color;
XinColor active_color;
XinColor active_back_color;
XinColor white_space_color;
XinColor rule_color;
BOOLEAN no_heading;
BOOLEAN sizable_columns;
BOOLEAN movable_columns;
short fixed_columns;
short pixel_width;
short pixel_height;
BOOLEAN moving_column;
BOOLEAN sizing_column;
int column_being_sized;
short min_cell_height;
short min_heading_height;
BOOLEAN no_horz_lines;
BOOLEAN no_vert_lines;
BOOLEAN drop_and_delete;
BOOLEAN select_cells;
BOOLEAN selecting_text;
BOOLEAN sizing_row;
BOOLEAN resize_with_window;
int row_being_sized;
int horz_sync_list;
int vert_sync_list;
BOOLEAN row_focus_border;
XinColor row_focus_border_color;
int max_lines_in_cell;
BOOLEAN single_select;
BOOLEAN retain_back_color_on_select;
BOOLEAN drag_and_drop_rows;
BOOLEAN drag_rows_autoscroll;
BOOLEAN button_on_cell_focus;
int position_by_typing_cid;
/* run time data */
LM_CB lm_cb;
XI_OBJ *list_obj;
XI_OBJ *itf_obj;
XinFont *font;
BOOLEAN is_list_font; /* False, if "font" is from the interface or system */
BOOLEAN have_mouse;
int column_being_moved;
int last_x;
int last_y;
BOOLEAN down_in_hscrolling;
BOOLEAN in_hscrolling;
BOOLEAN last_in_hscrolling;
XI_OBJ* last_itf;
int org_x;
int org_y;
int ascent;
int descent;
int leading;
BOOLEAN selecting_cells;
int down_row;
int down_column;
int cur_row;
int cur_column;
BOOLEAN down_on_disabled;
int delta_x;
int first_vis;
int last_vis;
int vir_left;
int vir_right;
BOOLEAN btn_down; /* or up */
BOOLEAN down_in_btn;
int btn_down_row;
int btn_down_col;
int update_rows_at_top;
int update_rows_at_bottom;
BOOLEAN update_cells_only;
BOOLEAN text_scrolling;
int old_row_height;
BOOLEAN horizontally_scrolling_list;
struct _lm_focus_state *focus_state;
XinFont *cur_font;
BOOLEAN have_last_rec;
long last_rec;
BOOLEAN down_in_heading;
/* vertical scrolling information */
XinRect mlr;
int mlr_height;
int rrr_offset; /* offset of mlr */
int rrr_bottom; /* total number of vertical pixels in realized
* row rect */
int nbr_rows; /* visible, specified by XI */
int realized_rows_array_len; /* also specified by XI */
int nbr_realized_rows; /* number of rows actually used in realized row
* array */
int first_fully_vis;
int last_fully_vis;
BOOLEAN fixed_row_height;
BOOLEAN sizable_rows;
BOOLEAN get_all_records;
BOOLEAN in_cell_request; /* Hold on to text for a cell, in case application wants */
int cell_request_row; /* to know what we had last. */
int cell_request_col;
char *cell_request_text;
/* the following arrays are all allocated to the length of
* realized_rows_array_len */
long *recs;
int *pix_offsets; /* pixel offsets of each row */
int *pix_heights; /* pixel heights of each row */
BOOLEAN *set_heights;
unsigned long *row_attribs;
XinColor *row_colors;
LM_CELL_DATA **cell_data;
/* Drag and Drop Rows information */
XinPoint down_pt;
BOOLEAN down_in_row;
BOOLEAN dragging_row;
long rec_being_moved;
int drag_row_height;
BOOLEAN delay_select;
int delay_row;
int delay_column;
BOOLEAN delay_dbl;
char *position_by_typing_buf;
} LM_DATA;
#define NULL_LM (LM)0
/*
Activities to test
1. Resize list
2. Resize column
3. Move columns around
4. Add columns
5. Delete columns
6. xi_cell_request
7. Tab around
8. Horizontal scroll
9. Vertical scroll
10. Drop horizontal thumb
11. Drop vertical thumb
12. Select range of cells
13. Set font on range of cells
14. Click on partially vis column
15. Size row
16. Change wrapping of text in cell
*/
typedef struct _lm_scroll_arg
{
LM lm;
int nbr_lines;
int percent;
BOOLEAN same_cell;
long rec;
BOOLEAN have_rec;
XinColor color;
unsigned long attrib;
int row_height;
BOOLEAN rec_at_top;
int pixels_scrolled; /* this is a return value from lm_scroll */
} LM_SCROLL_ARG;
void calculate_pix_offsets( LM_DATA * lmp, BOOLEAN draw_changes );
void calculate_visibles( LM_DATA * lmp );
void calc_x_pix_pos( LM lm, LM_COLUMN_DATA * lcdata, int position );
BOOLEAN
do_lm_cb( LM lm, LM_CB_TYPE cb_reason, int row, int column,
XinEvent * ep, int *percent, int pixels );
BOOLEAN
do_lm_cb_get( LM lm, LM_CB_TYPE cb_reason, long *spec_rec,
long *data_rec, int percent, XinColor * color,
unsigned long *attrib, int *row_height );
void do_lm_cb_text( LM_DATA * lmp, int row, int col, BOOLEAN preserve_focus );
void do_scroll_bar( XI_LIST_DATA * listdata );
BOOLEAN lm_adj_h( LM_DATA * lmp, short *h );
void lm_allocate_rec_info( LM_DATA * lmp, int realized_rows_array_len );
void lm_calc_last_vis( LM_DATA * lmp );
int lm_calculate_row_height( LM_DATA * lmp, int row );
void lm_cell_request( LM lm, LM_PART lm_part, int idx1, int idx2 );
void lm_column_set_pixel_width( LM lm, int idx, int width );
LM lm_create( XinWindow win, LM_DEF * lm_def, void *parent );
void
lm_create_column( LM lm, LM_COLUMN_DEF * lm_column_def,
BOOLEAN do_cell_requests, BOOLEAN in_hscrolling );
void lm_cleanup( LM lm );
void lm_delete( LM lm );
void lm_delete_column( LM lm, int column_nbr, BOOLEAN adjust_hscrolling );
BOOLEAN lm_delete_row( LM lm, int row );
void lm_draw_line( LM_DATA * lmp, XinPoint p, BOOLEAN adj_v, BOOLEAN adj_h );
int lm_event( XI_OBJ* itf, LM lm, XinEvent * ep );
void
lm_focus_cb( long lm, int row, int column, BOOLEAN invisible,
BOOLEAN set );
unsigned long
lm_get_attrib( LM lm, LM_PART lm_part, int idx, int idx2,
BOOLEAN invisible );
int lm_get_buf_size( LM lm, LM_PART part, int idx );
int lm_get_cid( LM lm );
XinRect *
lm_get_cell_rect( XinRect * rctp, LM lm, int row, int col, BOOLEAN inner,
BOOLEAN physical_rct );
int lm_get_col_spacing( void );
int lm_get_fixed_columns( LM lm );
int lm_get_left_most_far_right_col( LM_DATA * lmp, int nbr_columns );
long *lm_get_list_info( LM lm, int *nbr_recs );
XI_OBJ *lm_get_list_obj( LM lm );
XinRect *lm_get_list_rct( LM_DATA * lmp, XinRect * r );
void
lm_get_metrics( XI_OBJ_DEF * obj_def, int *hborder, int *column_div,
int *list_bottom );
XinRect *lm_get_rect( LM lm, LM_PART part, int idx, XinRect * rct );
XinRect *lm_get_row_rect( XinRect * rctp, LM lm, int row );
void lm_get_sel( LM lm, int *c1, int *c2 );
char *
lm_get_text( LM lm, char *s, int len, int row, int column,
BOOLEAN invisible );
void
lm_get_vertical_metrics( XI_OBJ_DEF * obj_def, int *first_row_y,
int *row_spacing, int *client_height,
int *title_height );
void lm_get_visible_columns( LM lm, int *first_vis, int *last_vis );
int lm_get_visible_rows( LM lm, int *first_vis, int *last_vis );
int lm_hit_test( LM lm, XinEvent* ep, XinEvent* oevt, int* rowp, int* columnp,
BOOLEAN* is_vis, BOOLEAN* is_hit, BOOLEAN* is_part_vis );
void lm_hscroll( LM lm, int nbr_columns, int pos );
BOOLEAN lm_insert_row( LM lm, int row );
void lm_invalidate_rect( LM_DATA * lmp, XinRect * rctp, BOOLEAN adj_h );
void
lm_invalidate_rect2( LM_DATA * lmp, XinRect * rct_to_invalidate,
BOOLEAN adj_left );
void
lm_invalidate_rows( LM lm, int row_start, int row_end,
BOOLEAN invalidate );
void
lm_invalidate_rows_internal( LM lm, int row_start, int row_end,
BOOLEAN redraw, int column,
BOOLEAN preserve_focus_text );
void lm_local_hscroll( LM lm, int nbr_columns );
void lm_move_event( LM_DATA * lmp, XinEvent * ep );
void lm_drag_row_event( XI_OBJ* itf, LM_DATA* lmp, XinEvent* ep, XinEvent* oevp );
void lm_move_to( LM_DATA * lmp, XinPoint p, BOOLEAN adj_v, BOOLEAN adj_h );
void lm_recalc_metrics( LM lm );
void lm_redraw_row( LM_DATA * lmp, int row, BOOLEAN update );
void lm_remove_all_rows( LM_DATA * lm, BOOLEAN delete_focus );
BOOLEAN lm_row_has_focus( LM_DATA * lmp, int row, BOOLEAN is_vert_scrolled );
int lm_scroll( LM_SCROLL_ARG * arg );
void lm_scroll_rect( LM_DATA * lmp, XinRect * rctp, int dh, int dv );
void lm_set_fixed_columns( LM lm, int new_fixed_count );
void
lm_set_attrib( LM lm, LM_PART lm_part, int idx, int idx2,
BOOLEAN invisible, unsigned long attrib,
int half_baked );
void lm_set_buf_size( LM lm, LM_PART part, int idx, int size );
void lm_set_column_bitmap( LM lm, XI_BITMAP* bitmap, int cid );
void lm_set_column_icon( LM lm, int icon_rid, int cid );
void lm_set_column_width( LM lm, int idx, int width );
void
lm_set_color( LM lm, LM_PART part, int row, int column,
BOOLEAN invisible, XinColor color, BOOLEAN half_baked );
void lm_set_fixed_columns( LM lm, int new_fixed_count );
void lm_set_hscroll_bar( LM lm );
void lm_set_hscroll_range( LM lm );
void lm_set_bitmap( LM lm, XI_BITMAP* bitmap, int row, int column );
void lm_set_icon( LM lm, int icon_rid, int row, int column );
void lm_set_focus( LM lm, int row, int column );
void lm_set_font( LM lm, LM_PART part, int idx, int idx2, XinFont * font );
void lm_set_list_size( LM lm, int height, int width );
void lm_set_rect( LM lm, XinRect *rect );
void
lm_set_row_height( LM lm, int row, int height, BOOLEAN set_height,
int old_height, BOOLEAN only_update );
void
lm_set_sel( LM lm, int row, int column, BOOLEAN invisible, int c1,
int c2 );
void lm_set_text( LM lm, const char *s, int row, int column, BOOLEAN invisible );
void lm_size_event( LM_DATA * lmp, XinEvent * ep );
void lm_text_scrolling( XI_OBJ * xi_obj );
void lm_wrap_text( LM_DATA * lmp, int row, int col, BOOLEAN set_font );
int lm_make_rrr_room_pix( LM_DATA * lmp, int pixels, BOOLEAN do_redraw );
BOOLEAN navigate_char_event( LM lm, XinEvent * ep );
void redraw_cell( LM lm, int row, int col, BOOLEAN update );
void
draw_cell_range( LM_DATA * lmp, int first_row, int last_row,
int first_col, int last_col,
BOOLEAN in_event_update );
XinRect *lm_get_scroll_rct( LM_DATA * lmp, XinRect * r );
void lm_do_rec_event( LM_DATA * lmp, int row, XI_EVENT_TYPE type );
void lm_row_copy( LM_DATA * lmp, int source_row, int dest_row );
void lm_adjust_rows( LM_DATA * lmp, int delta );
void set_focus_cell_rct( LM_DATA * lmp, int row, int col, BOOLEAN in_update_event );
XI_TEXT *lm_xi_text_focus_get( LM lm );
void lm_calculate_pix_offsets( LM lm );
void lm_xi_text_prect_get( LM_DATA * lmp, LM_COLUMN_DATA * column_data,
LM_CELL_DATA * cell_data, int row, int col, int col_offset,
int leading, int ascent, int descent, XinRect * rctp );
BOOLEAN lm_cr_is_ok( LM lm, int row, int col, BOOLEAN v_scrolled );
BOOLEAN lm_is_button_full_cell( LM lm, int row, int col );
void lm_xi_text_construct( LM_DATA * lmp, int row, int column );
#define LMP(l) ((LM_DATA *)(l))
#if XIWS == XIWS_WM
#define RULE_Y_OFFSET_TOP 0
#define RULE_Y_OFFSET_BOTTOM 0
#define BORDER_WIDTH 8
#define RULE_WIDTH_V 8 /* width of vertical lines */
#define RULE_WIDTH_H 0 /* width of horz lines */
#define HPIX_PER_CH 8
#define VPIX_PER_CH 8
#else
#define RULE_Y_OFFSET_TOP 1
#define RULE_Y_OFFSET_BOTTOM 1
#define BORDER_WIDTH 2
#define RULE_WIDTH_V 1
#define RULE_WIDTH_H 1
#define WIDTHLOOP(idx, wid) for (idx = 0; idx < wid; idx++)
#endif
#define CELL_IS_ENABLED(lm, row, col) (LIST_IS_ENABLED(lm) && COLUMN_IS_ENABLED(lm, col))
#define CELL_IS_SELECTED(lm, row, col) ((LMP(lm)->row_attribs[row] & LM_ROW_ATR_SELECTED) || (LMP(lm)->lm_column_data[col]->attrib & LM_COL_ATR_SELECTED) || \
(LMP(lm)->cell_data[row][col].attrib & LM_CELL_ATR_SELECTED))
#define CELL_IS_SELECTABLE(lm, row, col) (LMP(lm)->lm_column_data[col]->attrib & LM_COL_ATR_SELECTABLE)
#define LIST_IS_ENABLED(lm) ((LMP(lm)->attrib & (LM_ATR_ENABLED | LM_ATR_VISIBLE)) == (LM_ATR_ENABLED | LM_ATR_VISIBLE))
#define COLUMN_IS_ENABLED(lm, col) (LMP(lm)->lm_column_data[col]->attrib & LM_COL_ATR_ENABLED)
#define COLUMN_IS_SELECTABLE(lm, col) (LMP(lm)->lm_column_data[col]->attrib & LM_COL_ATR_COL_SELECTABLE)
#define COLUMN_IS_SELECTED(lm, col) (LMP(lm)->lm_column_data[col]->attrib & LM_COL_ATR_SELECTED)
#define COLUMN_IS_PUSHED(lm, col) (LMP(lm)->lm_column_data[col]->pushed)

5291
src/xi01/xilm2.c Normal file

File diff suppressed because it is too large Load Diff

4899
src/xi01/xilm3.c Normal file

File diff suppressed because it is too large Load Diff

915
src/xi01/xilmst.c Normal file
View File

@ -0,0 +1,915 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#define XI_INTERNAL
#include "xi.h"
#include "xitext.h"
#include "xilm.h"
#include "xilmst.h"
#include "xiutils.h"
#include "xidisply.h"
#include <limits.h>
void
lm_focus_set( long lm, int row, int column, BOOLEAN v_scrolled, BOOLEAN set )
{
LM_DATA *lmp = ( LM_DATA * ) lm;
if ( set )
{
LM_FOCUS_CELL_VISIBLE_FORCE_ARGS args;
MEMCLEAR( args );
args.lmp = lmp;
args.row = row;
args.column = column;
args.vert_scrolled = v_scrolled;
lm_focus_cell_visible_force( &args );
}
else
{
lm_focus_remove( lmp, row, column, v_scrolled );
}
}
void
lm_focus_cell_visible_force( LM_FOCUS_CELL_VISIBLE_FORCE_ARGS * args )
{
/*
LM_DATA *lmp;
int row;
int column;
int vert_scrolled;
*/
LM_DATA *lmp = args->lmp;
LM_COLUMN_DATA *lmcdp;
unsigned long attrib,
cell_attrib;
int c;
XinRect mr;
int focus_row,
focus_column;
BOOLEAN v_scrolled;
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
if ( focus_row == args->row &&
focus_column == args->column &&
v_scrolled == FALSE &&
lm_focus_state_get( lmp ) == LM_FOCUS_VISIBLE )
return;
/* force a vertically scrolled row to be visible */
if ( lm_focus_state_get( lmp ) == LM_FOCUS_VERTICALLY_SCROLLED )
{
LM_SCROLL_ARG lm_scroll_arg;
int row;
BOOLEAN found = FALSE;
for ( row = 0; row < lmp->nbr_realized_rows; ++row )
{
if ( lmp->focus_state->focus_rec == lmp->recs[row] )
{
found = TRUE;
break;
}
}
if ( !found )
{
MEMCLEAR( lm_scroll_arg );
lm_scroll_arg.lm = ( LM ) lmp;
/* lm_scroll_arg.nbr_lines = 0; lm_scroll_arg.percent = 0;
* lm_scroll_arg.same_cell = 0; */
lm_scroll_arg.rec = lmp->focus_state->focus_rec;
lm_scroll_arg.have_rec = TRUE;
lm_scroll_arg.color = lmp->focus_state->focus_rec_color;
lm_scroll_arg.attrib = lmp->focus_state->focus_rec_attrib;
lm_scroll_arg.row_height = lmp->focus_state->focus_rec_height;
lm_scroll_arg.rec_at_top = lmp->focus_state->focus_rec_is_above;
lm_scroll( &lm_scroll_arg );
XinWindowPaintForce( lmp->win );
}
}
mr = lmp->mlr;
if ( lmp->pixel_width )
mr.right = mr.left + lmp->pixel_width + BORDER_WIDTH;
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
lmcdp = lmp->lm_column_data[focus_column];
attrib = lmcdp->attrib;
cell_attrib = lm_get_attrib( ( LM ) lmp, LM_CELL, focus_row, focus_column,
v_scrolled ) & ( XI_ATR_HCENTER | XI_ATR_RJUST );
if ( cell_attrib )
{
attrib &= ~( XI_ATR_HCENTER | XI_ATR_RJUST );
attrib |= cell_attrib;
}
/* force cell to be visible */
c = min( focus_column, lmp->nbr_columns - 1 );
if ( c >= lmp->fixed_columns && c < lmp->first_vis )
lm_local_hscroll( ( LM ) lmp, c - lmp->first_vis );
else
{
if ( c > lmp->last_vis )
{
int first_col;
c++;
c = min( c, lmp->nbr_columns );
first_col = lm_get_left_most_far_right_col( lmp, c );
lm_local_hscroll( ( LM ) lmp, first_col - lmp->first_vis );
}
}
#if 0
/* this should never get executed */
if ( focus_row < lmp->first_fully_vis )
{
int delta,
idx2,
pix2,
old_pix;
XinRect tmp_rct;
make_room_rows( lmp, focus_row - lmp->first_fully_vis, FALSE );
idx2 = focus_row;
pix2 = lmp->pix_offsets[idx2];
old_pix = -lmp->rrr_offset;
delta = old_pix - pix2;
lmp->rrr_offset += delta;
calculate_pix_offsets( lmp, FALSE );
if ( !lmp->itf_obj->v.itf->half_baked )
XinWindowPaintForce( lmp->win );
xi_set_update_obj( lmp->list_obj );
lm_get_scroll_rct( lmp, &tmp_rct );
xi_scroll_rect( lmp->win, &tmp_rct, 0, delta );
do_scroll_bar( lmp->list_obj->v.list );
}
#endif
if ( focus_row > lmp->last_fully_vis )
{
int pix,
delta;
XinRect tmp_rct;
delta = 0;
while ( TRUE )
{
if ( focus_row <= lmp->last_fully_vis )
break;
pix = lmp->pix_heights[0];
delta += pix;
lm_make_rrr_room_pix( lmp, pix, FALSE );
lmp->rrr_offset -= pix;
calculate_pix_offsets( lmp, FALSE );
calculate_visibles( lmp );
}
if ( !lmp->itf_obj->v.itf->half_baked )
XinWindowPaintForce( lmp->win );
xi_set_update_obj( lmp->list_obj );
lm_get_scroll_rct( lmp, &tmp_rct );
xi_scroll_rect( lmp->win, &tmp_rct, 0, -delta );
do_scroll_bar( lmp->list_obj->v.list );
if ( !lmp->get_all_records )
{
int nbr_to_free,
cnt,
i,
idx;
nbr_to_free = lmp->first_fully_vis;
if ( nbr_to_free > 0 )
{
for ( cnt = 0; cnt < nbr_to_free; cnt++ )
{
lmp->rrr_offset += lmp->pix_heights[cnt];
lm_do_rec_event( lmp, cnt, XIE_REC_FREE );
}
for ( idx = nbr_to_free; idx < lmp->nbr_realized_rows; ++idx )
lm_row_copy( lmp, idx, idx - nbr_to_free );
lm_adjust_rows( lmp, -nbr_to_free );
lmp->nbr_realized_rows -= cnt;
}
/* free any unnecessary records at the end of the list */
nbr_to_free = lmp->nbr_realized_rows - ( lmp->last_fully_vis + 2 );
if ( nbr_to_free > 0 )
{
for ( i = lmp->nbr_realized_rows - nbr_to_free, cnt = 0; cnt < nbr_to_free;
i++, cnt++ )
lm_do_rec_event( lmp, i, XIE_REC_FREE );
lmp->nbr_realized_rows -= cnt;
}
calculate_pix_offsets( lmp, TRUE );
}
}
if ( lm_focus_state_get( lmp ) != LM_FOCUS_VISIBLE )
lm_focus_cell_visible_attempt( lmp );
}
void
lm_focus_cell_text_set( LM_DATA * lmp, BOOLEAN preserve_focus_text, const char *s,
int row, int col, BOOLEAN v_scrolled )
{
int focus_row,
focus_column;
BOOLEAN focus_v_scrolled;
if ( lm_focus_list_has( lmp ) )
{
lm_focus_cell_get( lmp, &focus_row, &focus_column, &focus_v_scrolled );
if ( lm_focus_state_get( lmp ) != LM_FOCUS_VISIBLE &&
row == focus_row &&
col == focus_column &&
v_scrolled == focus_v_scrolled &&
preserve_focus_text != TRUE )
{
int len;
LM_COLUMN_DATA *lm_column_data;
int pix_spacing;
LM_CELL_DATA *cell_data;
len = strlen( s ) + 1;
if ( lmp->focus_state->focus_cell_text )
lmp->focus_state->focus_cell_text = ( char * ) xi_tree_realloc( lmp->focus_state->focus_cell_text, len );
else
lmp->focus_state->focus_cell_text = ( char * ) xi_tree_malloc( len, lmp );
strcpy( lmp->focus_state->focus_cell_text, s );
lm_column_data = lmp->lm_column_data[focus_column];
cell_data = &lmp->cell_data[focus_row][focus_column];
pix_spacing = lm_column_data->pix_width -
( cell_data->button ? lmp->pix_row_spacing : 0 );
xi_text_pix_width_and_text_set( cell_data->xi_text, lmp->focus_state->focus_cell_text,
pix_spacing, TRUE );
if ( lmp->lm_column_data[col]->attrib | XI_ATR_AUTOSELECT )
{
lmp->focus_state->focus_cell_ip1 = 0;
lmp->focus_state->focus_cell_ip2 = strlen( s );
}
else
{
lmp->focus_state->focus_cell_ip1 = 0;
lmp->focus_state->focus_cell_ip2 = 0;
}
lmp->focus_state->button = cell_data->button;
lmp->focus_state->button_full_cell = cell_data->button_full_cell;
}
}
}
long
lm_focus_rec_get( LM_DATA * lmp )
{
return lmp->focus_state->focus_rec;
}
BOOLEAN
lm_focus_cell_has( LM_DATA * lmp, int row, int column, BOOLEAN v_scrolled )
{
XI_ITF_DATA *itf;
XI_OBJ *focus_obj;
XI_CELL_DATA *cd;
if ( lm_focus_state_get( lmp ) != LM_FOCUS_VISIBLE )
return FALSE;
itf = lmp->itf_obj->v.itf;
focus_obj = itf->focus_obj;
if ( focus_obj != NULL && focus_obj->parent == lmp->list_obj &&
focus_obj->type == XIT_CELL )
{
cd = &focus_obj->v.cell;
return ( cd->row == row && cd->column == column
&& cd->is_vert_scrolled == v_scrolled );
}
return FALSE;
}
void
lm_focus_rec_color_set( LM_DATA * lmp, XinColor color )
{
lmp->focus_state->focus_rec_color = color;
}
void
lm_focus_cell_attrib_set( LM_DATA * lmp, unsigned long attrib )
{
lmp->focus_state->focus_cell_attrib = attrib;
}
void
lm_focus_selection_get( LM_DATA * lmp, int *c1, int *c2 )
{
if ( lm_focus_list_has( lmp ) )
{
XI_TEXT *text;
text = xi_text_focus_get( lmp->win );
if ( text )
xi_text_selection_get( text, c1, c2 );
}
else
*c1 = *c2 = 0;
}
char *
lm_focus_cell_text_get( LM_DATA * lmp )
{
return lmp->focus_state->focus_cell_text;
}
LM_FOCUS
lm_focus_state_get( LM_DATA * lmp )
{
return lmp->focus_state->where;
}
/*-------------------------------------------------------------------------
function: lm_stop_edit
lm: current lm
-------------------------------------------------------------------------*/
static void
lm_stop_edit( LM lm, BOOLEAN do_update, int row, int column, LM_FOCUS state_was )
{
LM_DATA *lmp = LMP( lm );
XI_TEXT *text;
LM_CELL_DATA *cell_data;
cell_data = &lmp->cell_data[row][column];
text = cell_data->xi_text;
if ( text && !cell_data->button_full_cell )
{
xi_text_editing_stop( text );
XinWindowPaintForce( lmp->win );
}
/* if lmp->row_focus_border is TRUE, don't redraw, because old focus row will
* be invalidated */
if ( ( do_update && state_was == LM_FOCUS_VISIBLE ) ||
(do_update && cell_data->button_full_cell))
redraw_cell( lm, row, column, FALSE );
}
/* ------------------------------------------------------------------- */
/* lm_focus_cell_is_visible */
/* ------------------------------------------------------------------- */
/*
TODO it is possible here that focus has been moved such that it is now
visible, but the state still indicates that it is not.
*/
BOOLEAN
lm_focus_cell_is_visible( LM_DATA * lmp, BOOLEAN * is_hscrolled )
{
if ( is_hscrolled )
*is_hscrolled = FALSE;
if ( lm_focus_state_get( lmp ) == LM_FOCUS_HORIZONTALLY_SCROLLED )
{
*is_hscrolled = TRUE;
return FALSE;
}
return ( lm_focus_state_get( lmp ) == LM_FOCUS_VISIBLE );
}
/*
Semantics: this function attempts to make the focus be visible.
It then sets the state as appropriate. If it succeeded, then
it sets state to LM_FOCUS_VISIBLE. If it failed, then it sets
focus to LM_FOCUS_VERTICALLY_SCROLLED or LM_FOCUS_HORIZONTALLY_SCROLLED.
*/
void
lm_focus_cell_visible_attempt( LM_DATA * lmp )
{
int focus_row,
focus_column;
BOOLEAN v_scrolled;
if ( !lm_focus_list_has( lmp ) )
return;
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
if ( focus_column < lmp->fixed_columns ||
( focus_column >= lmp->first_vis &&
focus_column <= lmp->last_vis ) )
{
LM_COLUMN_DATA *lm_column_data;
XinRect cell_r;
unsigned long attrib,
cell_attrib;
LM_CELL_DATA *cell_data;
XinRect mr;
BOOLEAN text_was_invisible;
LM_FOCUS focus;
int leading,
ascent,
descent;
int col_offset;
col_offset = ( int ) xi_get_pref( XI_PREF_COLUMN_OFFSET );
if ( lm_focus_state_get( lmp ) == LM_FOCUS_VERTICALLY_SCROLLED ||
lm_focus_state_get( lmp ) == LM_FOCUS_TEMP_INVISIBLE )
{
int cnt;
for ( cnt = 0; cnt < lmp->nbr_realized_rows; ++cnt )
{
if ( lmp->recs[cnt] == lmp->focus_state->focus_rec )
{
if ( cnt <= lmp->last_fully_vis )
{
lm_focus_cell_set( lmp, cnt, focus_column, FALSE );
focus_row = cnt;
}
break;
}
}
if ( cnt > lmp->last_fully_vis )
{
lmp->focus_state->where = LM_FOCUS_VERTICALLY_SCROLLED;
return;
}
}
focus = lm_focus_state_get( lmp );
text_was_invisible = FALSE;
if ( focus == LM_FOCUS_HORIZONTALLY_SCROLLED ||
focus == LM_FOCUS_VERTICALLY_SCROLLED ||
focus == LM_FOCUS_TEMP_INVISIBLE )
text_was_invisible = TRUE;
mr = lmp->mlr;
if ( lmp->pixel_width )
mr.right = mr.left + lmp->pixel_width;
lm_column_data = lmp->lm_column_data[focus_column];
attrib = lm_column_data->attrib;
cell_data = &lmp->cell_data[focus_row][focus_column];
if ( cell_data->xi_text != NULL )
xi_text_clip_set( cell_data->xi_text, &mr );
if ( text_was_invisible )
{
cell_data->attrib = lmp->focus_state->focus_cell_attrib;
if ( cell_data->font )
XinFontDestroy( cell_data->font );
if ( lmp->focus_state->focus_cell_font )
{
XinFontCopy( &cell_data->font, lmp->focus_state->focus_cell_font );
if ( cell_data->xi_text != NULL )
xi_text_font_set( cell_data->xi_text, cell_data->font );
} else
cell_data->font = NULL;
cell_data->color = lmp->focus_state->focus_cell_color;
cell_data->back_color = lmp->focus_state->focus_cell_back_color;
cell_data->button = lmp->focus_state->button;
cell_data->button_full_cell = lmp->focus_state->button_full_cell;
cell_data->button_on_left = lmp->focus_state->button_on_left;
cell_data->button_icon_rid = lmp->focus_state->button_icon_rid;
cell_data->button_bitmap = lmp->focus_state->button_bitmap;
}
cell_attrib = cell_data->attrib & ( XI_ATR_HCENTER | XI_ATR_RJUST );
if ( cell_attrib )
{
attrib &= ~( XI_ATR_HCENTER | XI_ATR_RJUST );
attrib |= cell_attrib;
}
/* Create the focus cell */
if ( cell_data->button_full_cell )
{
lmp->cur_font = lmp->font;
lmp->old_row_height = lmp->pix_heights[focus_row];
lmp->focus_state->focus_rec = 0L;
lmp->focus_state->where = LM_FOCUS_VISIBLE;
redraw_cell( ( LM ) lmp, focus_row, focus_column, FALSE );
}
else
{
lmp->cur_font = lmp->font;
XinFontMetricsGet( lmp->cur_font, &leading, &ascent, &descent );
lm_xi_text_prect_get( lmp, lm_column_data, cell_data, focus_row, focus_column,
col_offset, leading, ascent, descent, &cell_r );
if ( !lm_column_data->wrap_text )
xi_text_pix_width_set( cell_data->xi_text, lm_column_data->pix_width -
( cell_data->button ? lmp->pix_row_spacing : 0 ) );
xi_text_prect_set( cell_data->xi_text, &cell_r );
xi_text_color_fore_set( cell_data->xi_text, lmp->active_color );
xi_text_color_back_set( cell_data->xi_text, lmp->active_back_color );
if ( cell_data->back_color )
xi_text_color_back_set( cell_data->xi_text, cell_data->back_color );
if ( text_was_invisible )
{
xi_text_set( cell_data->xi_text, lmp->focus_state->focus_cell_text );
}
cell_data->valid_data = TRUE;
lmp->old_row_height = lmp->pix_heights[focus_row];
lmp->focus_state->focus_rec = 0L;
if ( text_was_invisible )
{
LM_COLUMN_DATA *lm_column_data;
int pix_spacing;
lm_column_data = lmp->lm_column_data[focus_column];
pix_spacing = lm_column_data->pix_width -
( cell_data->button ? lmp->pix_row_spacing : 0 );
xi_text_pix_width_and_text_set( cell_data->xi_text, lmp->focus_state->focus_cell_text,
pix_spacing, TRUE );
xi_text_selection_set_internal( cell_data->xi_text,
lmp->focus_state->focus_cell_ip1,
lmp->focus_state->focus_cell_ip2,
lmp->focus_state->focus_cell_start_ip, TRUE, TRUE );
}
else
{
if ( lmp->have_mouse )
{
if ( ( lm_column_data->attrib & ( LM_COL_ATR_AUTOSELECT | LM_COL_ATR_READONLY ) ) ==
( LM_COL_ATR_AUTOSELECT | LM_COL_ATR_READONLY ) )
xi_text_selection_set( cell_data->xi_text, 0, SHRT_MAX );
else if ( ( lm_column_data->attrib & LM_COL_ATR_AUTOSELECT ) && xi_get_pref( XI_PREF_AUTOSEL_ON_MOUSE ) )
xi_text_selection_set( cell_data->xi_text, 0, SHRT_MAX );
else
xi_text_selection_set( cell_data->xi_text, 0, 0 );
}
else
{
if ( lm_column_data->attrib & LM_COL_ATR_AUTOSELECT )
xi_text_selection_set( cell_data->xi_text, 0, SHRT_MAX );
else
xi_text_selection_set( cell_data->xi_text, 0, 0 );
}
}
xi_text_editing_start( cell_data->xi_text );
}
lmp->focus_state->where = LM_FOCUS_VISIBLE;
redraw_cell( ( LM ) lmp, focus_row, focus_column, FALSE );
}
else
{
if ( lm_focus_state_get( lmp ) != LM_FOCUS_VERTICALLY_SCROLLED )
{
lmp->focus_state->where = LM_FOCUS_HORIZONTALLY_SCROLLED;
if ( lmp->focus_state->focus_rec )
{
int cnt;
/* the following loop should *always* find a row, because the only
* reason the cell is not visible is because the list is horizontally
* scrolled. */
for ( cnt = 0; cnt < lmp->nbr_realized_rows; ++cnt )
{
if ( lmp->recs[cnt] == lmp->focus_state->focus_rec )
{
lm_focus_cell_set( lmp, cnt, focus_column, FALSE );
break;
}
}
if ( cnt == lmp->nbr_realized_rows )
lmp->focus_state->where = LM_FOCUS_VERTICALLY_SCROLLED;
}
}
}
}
unsigned long
lm_focus_rec_attrib_get( LM_DATA * lmp )
{
return lmp->focus_state->focus_rec_attrib;
}
unsigned long
lm_focus_cell_attrib_get( LM_DATA * lmp )
{
return lmp->focus_state->focus_cell_attrib;
}
void
lm_focus_cell_invis_make( LM_DATA * lmp )
{
XI_TEXT *text;
if ( !lm_focus_list_has( lmp ) )
return;
if ( lm_focus_state_get( lmp ) != LM_FOCUS_VISIBLE )
return;
text = xi_text_focus_get( lmp->win );
if ( text && xi_text_editing_is( text ) )
{
int focus_row,
focus_column;
int ip1,
ip2,
start_ip;
BOOLEAN v_scrolled;
LM_CELL_DATA *cell_data;
XI_TEXT *text;
lmp->focus_state->where = LM_FOCUS_TEMP_INVISIBLE;
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
lmp->focus_state->focus_rec = lmp->recs[focus_row];
lmp->focus_state->focus_rec_color = lmp->row_colors[focus_row];
lmp->focus_state->focus_rec_attrib = lmp->row_attribs[focus_row];
lmp->focus_state->focus_rec_height = lmp->pix_heights[focus_row];
cell_data = &lmp->cell_data[focus_row][focus_column];
if ( lmp->focus_state->focus_cell_font )
{
XinFontDestroy( lmp->focus_state->focus_cell_font );
lmp->focus_state->focus_cell_font = NULL;
}
if ( cell_data->font )
XinFontCopy( &lmp->focus_state->focus_cell_font, cell_data->font );
lmp->focus_state->focus_cell_color = cell_data->color;
lmp->focus_state->focus_cell_back_color = cell_data->back_color;
lmp->focus_state->focus_cell_attrib = cell_data->attrib;
xi_text_selection_get_internal( cell_data->xi_text, &ip1, &ip2, &start_ip );
lm_focus_cell_text_set( lmp, FALSE, xi_text_get( cell_data->xi_text ), focus_row,
focus_column, FALSE );
lmp->focus_state->focus_cell_ip1 = ip1;
lmp->focus_state->focus_cell_ip2 = ip2;
lmp->focus_state->focus_cell_start_ip = start_ip;
lmp->focus_state->button = cell_data->button;
lmp->focus_state->button_full_cell = cell_data->button_full_cell;
lmp->focus_state->button_on_left = cell_data->button_on_left;
lmp->focus_state->button_icon_rid = cell_data->button_icon_rid;
lmp->focus_state->button_bitmap = cell_data->button_bitmap;
if ( lmp->focus_state->focus_cell_ip1 != lmp->focus_state->focus_cell_ip2 )
redraw_cell( ( LM ) lmp, focus_row, focus_column, FALSE );
text = xi_text_focus_get( lmp->win );
xi_text_editing_stop( text );
}
}
BOOLEAN
lm_focus_list_has( LM_DATA * lmp )
{
XI_ITF_DATA *itf;
BOOLEAN retval;
itf = lmp->itf_obj->v.itf;
retval = ( itf->focus_obj != NULL && itf->focus_obj->parent == lmp->list_obj );
return retval;
}
BOOLEAN
lm_focus_cell_get( LM_DATA * lmp, int *rowp, int *columnp, BOOLEAN * is_vert_scrolled )
{
XI_ITF_DATA *itf;
XI_OBJ *focus_obj;
XI_CELL_DATA *cd;
itf = lmp->itf_obj->v.itf;
focus_obj = itf->focus_obj;
if ( focus_obj != NULL && focus_obj->parent == lmp->list_obj &&
focus_obj->type == XIT_CELL )
{
cd = &focus_obj->v.cell;
*rowp = cd->row;
*columnp = cd->column;
*is_vert_scrolled = cd->is_vert_scrolled;
return TRUE;
}
*rowp = 0;
*columnp = 0;
*is_vert_scrolled = FALSE;
return FALSE;
}
void
lm_focus_cell_set( LM_DATA * lmp, int row, int column, BOOLEAN is_vert_scrolled )
{
XI_ITF_DATA *itf;
XI_OBJ *focus_obj;
XI_CELL_DATA *cd;
itf = lmp->itf_obj->v.itf;
focus_obj = itf->focus_obj;
if ( focus_obj != NULL && focus_obj->parent == lmp->list_obj &&
focus_obj->type == XIT_CELL )
{
cd = &focus_obj->v.cell;
cd->row = row;
cd->column = column;
cd->is_vert_scrolled = ( unsigned char ) is_vert_scrolled;
return;
}
XinError( 20921, XinSeverityFatal, 0L );
return;
}
#if 0
/*-------------------------------------------------------------------------
function: lm_start_edit
lm: current lm
row: relevant row
column: relevant column
notes: create a text core edit field in the position of the
cell of interest, and copy in the necessary attributes
and text from the list
-------------------------------------------------------------------------*/
static void
lm_start_edit( LM lm, int row, int column )
{
LM_DATA *lmp = LMP( lm );
int focus_row,
focus_column;
BOOLEAN v_scrolled;
LM_FOCUS_CELL_VISIBLE_FORCE_ARGS args;
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
if ( !( focus_row == row && focus_column == column ) )
XinError( 30209, XinSeverityFatal, 0L );
MEMCLEAR( args );
args.lmp = lmp;
args.row = row;
args.column = column;
args.vert_scrolled = v_scrolled;
lm_focus_cell_visible_force( &args );
}
#endif
void
lm_focus_create_temp_row( LM_DATA * lmp )
{
int idx,
focus_row,
focus_column, i;
BOOLEAN v_scrolled;
LM_CELL_DATA *cell_data;
lm_allocate_rec_info( lmp, lmp->realized_rows_array_len + 1 );
++lmp->nbr_realized_rows;
idx = lmp->nbr_realized_rows - 1;
lmp->recs[idx] = lm_focus_rec_get( lmp );
/* cell_data_construct */
cell_data = lmp->cell_data[idx];
for ( i = 0; i < lmp->nbr_columns; ++i, ++cell_data )
{
memset( ( char * ) cell_data, '\0', sizeof( LM_CELL_DATA ) );
lm_xi_text_construct( lmp, idx, i );
}
lmp->focus_state->saved_focus_rec = lm_focus_rec_get( lmp );
lmp->focus_state->focus_rec = 0L;
lm_focus_cell_get( lmp, &focus_row, &focus_column, &v_scrolled );
focus_row = idx;
lm_focus_cell_set( lmp, focus_row, focus_column, TRUE );
lm_invalidate_rows_internal( ( LM ) lmp, focus_row, focus_row, FALSE,
focus_column, TRUE );
calculate_pix_offsets( lmp, FALSE );
calculate_visibles( lmp );
}
void
lm_focus_rec_free( LM_DATA * lmp )
{
LM_CB_DATA lm_cb_data;
lm_cb_data.lm = ( LM ) lmp;
lm_cb_data.cb_type = LM_CB_REC_FREE;
lm_cb_data.cid = lmp->cid;
lm_cb_data.win = lmp->win;
lm_cb_data.v.rec_free.record = lmp->focus_state->saved_focus_rec;
( *lmp->lm_cb ) ( &lm_cb_data );
lm_allocate_rec_info( lmp, lmp->nbr_realized_rows - 1 );
--lmp->nbr_realized_rows;
lmp->focus_state->focus_rec = 0L;
}
void
lm_focus_remove( LM_DATA * lmp, int row, int column, BOOLEAN v_scrolled )
{
int idx;
BOOLEAN found = FALSE;
LM_FOCUS where_focus_was;
where_focus_was = lmp->focus_state->where;
lmp->focus_state->where = LM_FOCUS_NOWHERE;
if ( where_focus_was != LM_FOCUS_NOWHERE &&
where_focus_was != LM_FOCUS_TEMP_INVISIBLE &&
!v_scrolled )
lm_stop_edit( ( LM ) lmp, TRUE, row, column, where_focus_was );
if ( lmp->focus_state->focus_rec )
{
for ( idx = 0; idx < lmp->nbr_realized_rows; ++idx )
{
if ( lmp->recs[idx] == lmp->focus_state->focus_rec )
{
found = TRUE;
break;
}
}
if ( found )
{
lmp->focus_state->focus_rec = 0L;
}
else
{
LM_CB_DATA lm_cb_data;
lm_cb_data.lm = ( LM ) lmp;
lm_cb_data.cb_type = LM_CB_REC_FREE;
lm_cb_data.cid = lmp->cid;
lm_cb_data.win = lmp->win;
lm_cb_data.v.rec_free.record = lmp->focus_state->focus_rec;
( *lmp->lm_cb ) ( &lm_cb_data );
lmp->focus_state->focus_rec = 0L;
}
}
}
void
lm_focus_cell_selection_get( LM_DATA * lmp, int *c1, int *c2 )
{
LM_FOCUS state;
state = lm_focus_state_get( lmp );
if ( state == LM_FOCUS_VISIBLE )
{
XI_TEXT *text;
text = xi_text_focus_get( lmp->win );
if ( text && xi_text_editing_is( text ) )
xi_text_selection_get( text, c1, c2 );
else
{
*c1 = 0;
*c2 = 0;
}
}
else
{
if ( state == LM_FOCUS_HORIZONTALLY_SCROLLED ||
state == LM_FOCUS_VERTICALLY_SCROLLED )
{
*c1 = lmp->focus_state->focus_cell_ip1;
*c2 = lmp->focus_state->focus_cell_ip2;
}
else
{
*c1 = 0;
*c2 = 0;
}
}
}
void
lm_focus_cell_selection_set( LM_DATA * lmp, int c1, int c2 )
{
LM_FOCUS state;
state = lm_focus_state_get( lmp );
if ( state == LM_FOCUS_VISIBLE )
{
XI_TEXT *text;
text = xi_text_focus_get( lmp->win );
if ( text )
xi_text_selection_set( text, c1, c2 );
}
else
{
if ( state == LM_FOCUS_HORIZONTALLY_SCROLLED ||
state == LM_FOCUS_VERTICALLY_SCROLLED )
{
lmp->focus_state->focus_cell_ip1 = c1;
lmp->focus_state->focus_cell_ip2 = c2;
}
}
}
void
lm_focus_rec_is_above_set( LM_DATA * lmp, BOOLEAN is_above )
{
lmp->focus_state->focus_rec_is_above = is_above;
}
BOOLEAN
lm_focus_rec_is_above_get( LM_DATA * lmp )
{
return lmp->focus_state->focus_rec_is_above;
}
void
lm_focus_rec_set( LM_DATA * lmp, long focus_rec )
{
lmp->focus_state->focus_rec = focus_rec;
}
long
lm_focus_rec_saved_get( LM_DATA * lmp )
{
return lmp->focus_state->saved_focus_rec;
}
BOOLEAN
lm_focus_cell_is_button_full_cell( LM_DATA * lmp )
{
return lmp->focus_state->button_full_cell;
}

96
src/xi01/xilmst.h Normal file
View File

@ -0,0 +1,96 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
typedef enum
{
LM_FOCUS_NOWHERE,
LM_FOCUS_VISIBLE,
LM_FOCUS_HORIZONTALLY_SCROLLED,
LM_FOCUS_VERTICALLY_SCROLLED,
LM_FOCUS_TEMP_INVISIBLE
} LM_FOCUS;
typedef struct _lm_focus_state
{
LM_FOCUS where;
long focus_rec;
long saved_focus_rec;
BOOLEAN focus_rec_is_above;
XinColor focus_rec_color;
unsigned long focus_rec_attrib;
unsigned long focus_cell_attrib;
XinFont *focus_cell_font;
XinColor focus_cell_color;
XinColor focus_cell_back_color;
int focus_rec_height;
char *focus_cell_text;
int focus_cell_ip1;
int focus_cell_ip2;
int focus_cell_start_ip;
BOOLEAN button;
BOOLEAN button_full_cell;
BOOLEAN button_on_left;
BOOLEAN button_on_focus;
int button_icon_rid;
XI_BITMAP* button_bitmap;
} LM_FOCUS_STATE;
typedef struct
{
LM_DATA *lmp;
LM_FOCUS focus;
int row;
int column;
int vert_scrolled;
} LM_FOCUS_STATE_SET_ARGS;
typedef struct
{
LM_DATA *lmp;
int row;
int column;
int vert_scrolled;
} LM_FOCUS_CELL_VISIBLE_FORCE_ARGS;
unsigned long lm_focus_cell_attrib_get( LM_DATA * lmp );
void lm_focus_cell_attrib_set( LM_DATA * lmp, unsigned long attrib );
BOOLEAN lm_focus_cell_get( LM_DATA * lmp, int *row, int *col, BOOLEAN * v_scrolled );
BOOLEAN lm_focus_cell_is_visible( LM_DATA * lmp, BOOLEAN * is_hscrolled );
void lm_focus_cell_set( LM_DATA * lmp, int row, int col, BOOLEAN v_scrolled );
BOOLEAN lm_focus_cell_has( LM_DATA * lmp, int row, int col, BOOLEAN v_scrolled );
void lm_focus_cell_selection_get( LM_DATA * lmp, int *c1, int *c2 );
void lm_focus_cell_selection_set( LM_DATA * lmp, int c1, int c2 );
char *lm_focus_cell_text_get( LM_DATA * lmp );
void
lm_focus_cell_text_set( LM_DATA * lmp, BOOLEAN preserve_focus_text,
const char *text, int row, int col, BOOLEAN v_scrolled );
BOOLEAN lm_focus_list_has( LM_DATA * lmp );
unsigned long lm_focus_rec_attrib_get( LM_DATA * lmp );
void lm_focus_rec_color_set( LM_DATA * lmp, XinColor color );
long lm_focus_rec_get( LM_DATA * lmp );
void lm_focus_rec_set( LM_DATA * lmp, long focus_rec );
void lm_focus_rec_is_above_set( LM_DATA * lmp, BOOLEAN is_above );
BOOLEAN lm_focus_rec_is_above_get( LM_DATA * lmp );
void lm_focus_rec_free( LM_DATA * lmp );
long lm_focus_rec_saved_get( LM_DATA * lmp );
LM_FOCUS lm_focus_state_get( LM_DATA * lmp );
/* State changing functions */
void lm_focus_cell_visible_attempt( LM_DATA * lmp );
void lm_focus_cell_visible_force( LM_FOCUS_CELL_VISIBLE_FORCE_ARGS * args );
void lm_focus_cell_invis_make( LM_DATA * lmp );
void lm_focus_remove( LM_DATA * lmp, int row, int column, BOOLEAN v_scrolled );
void lm_focus_create_temp_row( LM_DATA * lmp );
void lm_focus_set( long lm, int row, int column, BOOLEAN v_scrolled,
BOOLEAN set );
BOOLEAN lm_focus_cell_is_button_full_cell( LM_DATA * lmp );

5911
src/xi01/xiport.c Normal file

File diff suppressed because it is too large Load Diff

871
src/xi01/xiport.h Normal file
View File

@ -0,0 +1,871 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
/*==============================================================================
* Note: Portions not implemented on Motif are commented NOTIMP.
* Portions removed from the header are commented out and marked REMOVED
* New parts are marked with NEW
*============================================================================*/
#ifndef XIN_INCL_XIPORT_H
#define XIN_INCL_XIPORT_H
#ifdef WIN32
#if XIAGADLL == 1
#define XIDLL __declspec(dllexport)
#else
#define XIDLL __declspec(dllimport)
#endif
#else
#define XIDLL
#endif
#define R4
#include "xires.h"
#include "stdio.h"
#include "assert.h"
#include "string.h"
#include "math.h"
#include "stdlib.h"
#include "ctype.h"
/* This code is not needed when using the XVT define for native
#if XIWS == XIWS_PM
#define INCL_DOS
#define INCL_WIN
#define INCL_GPI
#define COLOR pm_COLOR
#define UINT pm_UINT
#define ULONG pm_ULONG
#include <os2.h>
#undef COLOR
#undef UINT
#undef ULONG
#define INTERNAL
#endif
*/
/*
We don't really use the following, we just define them so that they are removed
from the XI source code when we don't use XVT.
*/
#ifndef XVT_CALLCONV1
#define XVT_CALLCONV1
#endif
#ifndef XVT_CC_ARGS
#define XVT_CC_ARGS(a) a
#endif
/* Set an object's memory to all zeros */
#define XIN_CLEAR(obj) memset(&obj, 0, sizeof(obj));
#define XIN_INC_TYPE( s_T, T ) typedef struct s_T T
#define XIN_INC_PTR_TYPE( s_T, T ) typedef struct s_T *T
#define XIN_FAKE_TYPE( s_T, T ) typedef struct s_T {int x;} T
#define XIN_FAKE_PTR_TYPE( s_T, T ) typedef struct s_T {int x;} *T
#ifndef BOOLEAN
#define BOOLEAN short
#define FALSE 0
#define TRUE 1
#endif
typedef enum
{
XinFlagNotSet,
XinFlagTrue,
XinFlagFalse
} XinFlag;
typedef enum
{
XinClipboardFormatText,
XinClipboardFormatBitmap /* NOTIMP */
} XinClipboardFormat;
typedef struct
{
short v;
short h;
} XinPoint;
typedef struct
{
short top;
short left;
short bottom;
short right;
} XinRect;
typedef unsigned long XinColor;
#ifdef XIN_INTERNAL_WINDOW
XIN_INC_PTR_TYPE( s_XinWindow, XinWindow );
#else
XIN_FAKE_PTR_TYPE( s_XinWindow, XinWindow );
#endif
#define XI_NULL_WINDOW ((XinWindow)0L)
typedef enum
{
XinEventCreate,
XinEventDestroy,
XinEventFocus,
XinEventResize,
XinEventPaint,
XinEventCloseButton,
XinEventMouseDown,
XinEventMouseUp,
XinEventMouseMove,
XinEventMouseDouble,
XinEventCharacter,
XinEventVScroll, /* NOTIMP */
XinEventHScroll, /* NOTIMP */
XinEventMenuCommand,
XinEventControl,
XinEventTimer,
XinEventQuit,
XinEventHelp, /* NOTIMP */
XinEventFont, /* NOTIMP */
XinEventUser
} XinEventType;
typedef enum
{
XinScrollBarActionNone,
XinScrollBarActionLineUp,
XinScrollBarActionLineDown,
XinScrollBarActionPageUp,
XinScrollBarActionPageDown,
XinScrollBarActionThumb,
XinScrollBarActionThumbTrack
} XinScrollBarAction;
typedef int XinMenuTag;
/* NEW */
typedef enum
{
XinBorderDouble,
XinBorderSingle,
XinBorderSizable,
XinBorderFixed,
XinBorderNone /* NOTIMP -- requires child window support */
} XinBorderStyle;
/* NEW */
typedef enum
{
XinModeless,
XinModalReturn,
XinModalWait,
XinModalAutoclose
} XinWindowMode;
typedef enum
{
XinWindowTypeDocument,
XinWindowTypePrint,
XinWindowTypeTask,
XinWindowTypeScreen,
XinWindowTypeButton, /* NOTIMP */
XinWindowTypeRadioButton, /* NOTIMP */
XinWindowTypeCheckBox, /* NOTIMP */
XinWindowTypeHorizontalScrollBar,
XinWindowTypeVerticalScrollBar
} XinWindowType;
typedef struct
{
XinWindowType type;
XinWindow win;
union
{
struct
{
XinScrollBarAction action;
short position;
} scroll;
} v;
} XinControlInformation;
typedef enum
{
XinScrollBarTypeHorizontal, /* NOTIMP -- no scrollbars on window borders */
XinScrollBarTypeVertical, /* NOTIMP -- no scrollbars on window borders */
XinScrollBarTypeEither
} XinScrollBarType;
typedef enum
{
XinFontFamilySystem,
XinFontFamilyFixed,
XinFontFamilyTimes,
XinFontFamilyHelvetica,
XinFontFamilyOther
} XinFontFamily;
#ifdef XIN_INTERNAL_FONT
/* Use an incomplete type so that complete type can be defined internally */
XIN_INC_TYPE( s_XinFont, XinFont );
#else
/* Use a complete but fake type, so that Borland does not complain */
XIN_FAKE_TYPE( s_XinFont, XinFont );
#endif
#ifdef XIN_INTERNAL_BITMAP
XIN_INC_TYPE( s_XinBitmap, XinBitmap );
#else
XIN_FAKE_TYPE( s_XinBitmap, XinBitmap );
#endif
typedef struct
{
XinEventType type;
union
{
struct
{
XinPoint where;
BOOLEAN shift;
BOOLEAN control;
BOOLEAN alt;
short button;
} mouse;
struct
{
short ch;
BOOLEAN shift;
BOOLEAN control;
BOOLEAN alt;
BOOLEAN consumed; /* For internal use only */
} character;
struct
{
BOOLEAN active;
} focus;
struct
{
BOOLEAN query; /* NOTIMP -- always FALSE on Motif */
} quit;
struct
{
XinScrollBarAction action;
short position;
} scroll;
struct
{
XinMenuTag tag;
BOOLEAN shift;
BOOLEAN control;
} menu_command;
struct
{
BOOLEAN minimized;
short height;
short width;
} resize;
struct
{
short control_id;
XinControlInformation ctrl_info;
} control;
struct
{
XinRect rect;
} paint;
struct
{
long id;
} timer;
struct
{
XinFont *font;
} font;
struct
{
XinWindow obj;
XinMenuTag tag;
long topic_id;
} help;
struct
{
long id;
void *ptr;
} user;
} v;
} XinEvent;
#ifdef __cplusplus
extern "C"
{
#endif
typedef void ( *XinWindowEventHandler ) ( XinWindow win, XinEvent * ep );
typedef BOOLEAN( *XinPrintHandler ) ( long app_data );
#ifdef __cplusplus
}
#endif
typedef struct s_XinMenuItem
{
XinMenuTag tag;
char *text; /* ~ in text indicates mnemonic */
BOOLEAN enabled;
BOOLEAN checked;
BOOLEAN checkable;
BOOLEAN separator;
int nbr_children;
struct s_XinMenuItem *children;
} XinMenuItem;
/* NEW */
typedef struct
{
int nbr_items;
XinMenuItem *items;
} XinMenu;
typedef struct
{
int control_id;
XinWindowType type;
XinRect *p_rect;
char *title; /* NEW -- NULL means no titlebar */
XinBorderStyle border_style; /* NEW */
BOOLEAN vertical_scroll_bar; /* NOTIMP */
BOOLEAN horizontal_scroll_bar;/* NOTIMP */
BOOLEAN close_button;
BOOLEAN visible;
BOOLEAN enabled;
BOOLEAN iconizable;
BOOLEAN iconized;
BOOLEAN maximized;
XinWindowMode mode; /* NEW */
XinWindow parent; /* See note1 below */
XinMenu *menu; /* New -- no menubar if NULL */
int menu_bar_rid; /* NOTIMP */
int icon_rid; /* Implemented via XPM on Motif -- requires
* linkage of icons */
long app_data;
XinWindowEventHandler eh;
XinColor back_color; /* NEW -- window's default background.
* Influences caret color */
XinFont *font; /* NEW -- only used for native controls */
} XinWindowDef;
/*
{
XinWindowDef Def;
MEMCLEAR(Def);
Def.control_id = ;
Def.type = ;
Def.p_rect = ;
Def.title = ;
Def.border_style = ;
Def.vertical_scroll_bar = ;
Def.horizontal_scroll_bar = ;
Def.close_button = ;
Def.visible = ;
Def.enabled = ;
Def.iconizable = ;
Def.iconized = ;
Def.maximized = ;
Def.mode = ;
Def.parent = ;
Def.menu = ;
Def.menu_bar_rid = ;
Def.icon_rid = ;
Def.app_data = ;
Def.eh = ;
Def.back_color = ;
}
*/
/* Note1: if mode ==
* XinModeless, then parent argument may be task, screen or toplevel window. Setting the
* parent to toplevel window enforfces stack-above-parent and iconize-with-parent.
* XinModalReturn or XinModalWait, then parent argument may be task, screen or toplevel window.
* Task or screen window is application-modal (although windows may still be closed).
* XinModalAutoclose, then parent must be a toplevel window. Autoclose windows are closed before
* any user input is sent to the parent window.
*/
typedef struct
{
char *task_win_title; /* NOTIMP */
char *appl_name; /* NOTIMP */
int menu_bar_rid; /* NOTIMP */
XinWindowEventHandler eh;
XinRect *p_rect; /* NOTIMP */
BOOLEAN iconized; /* NOTIMP */
BOOLEAN maximized; /* NOTIMP */
BOOLEAN use_mdi; /* NOTIMP */
BOOLEAN drawable_task_win;
BOOLEAN app_is_unique; /* Don't allow multiple instances of the application to run. */
int argc;
char **argv;
} XinSystemSetup;
typedef unsigned long XinCursor;
/* NEW */
typedef enum
{
XinPenHollow,
XinPenSolid,
XinPenDashed,
XinPenDotted, // Added by Guy
} XinPenPattern;
/* NEW */
typedef enum
{
XinBrushHollow,
XinBrushSolid,
XinBrushHatch
} XinBrushPattern;
typedef struct
{
short width;
XinPenPattern pattern; /* Changed to XinPenPattern */
XinColor fore_color; /* NEW color of pen */
} XinPen;
typedef struct
{
XinBrushPattern pattern; /* Changed to XinBrushPattern */
XinColor fore_color; /* NEW fore_color allows future back_color with
* hatched brushes */
} XinBrush;
typedef enum
{
XinDrawModeCopy,
XinDrawModeXor /* See Note2 */
} XinDrawMode;
/* Note2: XOR mode, if drawn on pixels equalling the back_color of the window, will attempt
* to produce the fore_color of the tool (pen/brush/text). Drawing on pixels of fore_color
* will attempt to produce back_color. The operation is self-reversing.
*/
typedef struct
{
XinPen pen;
XinBrush brush;
XinDrawMode draw_mode;
XinColor text_fore_color;
XinColor text_back_color;
BOOLEAN opaque_text;
} XinDrawTools;
typedef enum
{
XinResponse1,
XinResponse2,
XinResponse3
} XinResponse;
typedef enum
{
XinMetricIconHeight, /* Will pick a constant reflecting the WM
* restirctions */
XinMetricIconWidth, /* Will pick a constant reflecting the WM
* restirctions */
XinMetricHorizontalScrollBarHeight,
XinMetricVerticalScrollBarWidth,
XinMetricScreenHeight,
XinMetricScreenWidth,
XinMetricSizableFrameHeight, /* Guess on Motif */
XinMetricSizableFrameWidth, /* Guess on Motif */
XinMetricDoubleFrameHeight, /* Guess on Motif */
XinMetricDoubleFrameWidth, /* Guess on Motif */
XinMetricFrameHeight, /* Guess on Motif */
XinMetricFrameWidth, /* Guess on Motif */
XinMetricMenuHeight, /* Guess on Motif */
XinMetricTitleHeight, /* Guess on Motif */
XinMetricVerticalStagger,
XinMetricHorizontalStagger,
XinMetricScreenHRes,
XinMetricScreenVRes
} XinMetricType;
#define XI_FILE_MAX 256
typedef char XinDirectory[XI_FILE_MAX + 1];
typedef enum
{
XinFileGood,
XinFileCancel,
XinFileBad
} XinFileResult;
typedef enum
{
XinOpenFileDialog,
XinSaveFileDialog
} XinFileDialogType;
typedef struct
{
char *type;
XinDirectory directory;
char file_name[XI_FILE_MAX + 1];
} XinFileSpec;
typedef struct
{
char *type;
char *pattern;
BOOLEAN include_dirs;
BOOLEAN dirs_only;
} XinFileListSpec;
typedef struct
{
int nbr_files;
char **file_names;
} XinFileList;
#ifdef XIN_INTERNAL_PRINT_RECORD
/* Use an incomplete type so that complete type can be defined internally */
XIN_INC_TYPE( s_XinPrintRecord, XinPrintRecord );
#else
/* Use a complete but fake type, so that Borland does not complain */
XIN_FAKE_TYPE( s_XinPrintRecord, XinPrintRecord );
#endif
#ifndef NOREF
#define NOREF(a) a = a
#endif
#ifndef assert4
#define assert4(a, b, c, d) if (!(a)) XinError( (c),XinSeverityFatal,0L )
#endif
#define XI_KEY_DEL 127
#define XI_KEY_UP 301
#define XI_KEY_DOWN 302
#define XI_KEY_RIGHT 303
#define XI_KEY_LEFT 304
#define XI_KEY_PREV 305
#define XI_KEY_NEXT 306
#define XI_KEY_LHOME 307
#define XI_KEY_LEND 308
#define XI_KEY_HOME 309
#define XI_KEY_END 310
#define XI_KEY_WLEFT 313
#define XI_KEY_WRIGHT 314
#define XI_KEY_BTAB 315
#define XI_KEY_CLEAR 317
#define XI_KEY_F1 331
#define XI_KEY_F2 332
#define XI_KEY_F3 333
#define XI_KEY_F4 334
#define XI_KEY_F5 335
#define XI_KEY_F6 336
#define XI_KEY_F7 337
#define XI_KEY_F8 338
#define XI_KEY_F9 339
#define XI_KEY_F10 340
#define XI_KEY_F11 341
#define XI_KEY_F12 342
#define XI_CURSOR_ARROW 0
#define XI_CURSOR_IBEAM 1
#define XI_CURSOR_CROSS 2
#define XI_CURSOR_WAIT 3
#define XI_COLOR_RED 0x00FF0000L
#define XI_COLOR_GREEN 0x0000FF00L
#define XI_COLOR_BLUE 0x000000FFL
#define XI_COLOR_CYAN 0x0000FFFFL
#define XI_COLOR_MAGENTA 0x00FF00FFL
#define XI_COLOR_YELLOW 0x00FFFF00L
#define XI_COLOR_BLACK 0x80000000L
#define XI_COLOR_DKGRAY 0x00404040L
#define XI_COLOR_GRAY 0x00808080L
#define XI_COLOR_LTGRAY 0x00C0C0C0L
#define XI_COLOR_WHITE 0x00FFFFFFL
/* New -- values for Motif */
#if XIWS == XIWS_XM
#define XI_CLIP_EOL "\012"
#else
#define XI_CLIP_EOL "\015\012"
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/* Memory */
void *XinMemoryAlloc( size_t size );
void XinMemoryFree( void *ptr );
void *XinMemoryRealloc( void *ptr, size_t size );
void *XinMemoryZeroAlloc( size_t size );
/* Dialogs */
XinResponse XinDialogAsk( char *btn_text_1, char *btn_text_2,
char *btn_text_3, char *fmt,... );
void XinDialogError( char *format,... );
void XinDialogFatal( char *format,... );
XinFileResult XinDialogFile( char *message, XinFileSpec * spec,
XinFileDialogType type );
BOOLEAN XinDialogFont( XinFont * font );
void XinDialogNote( char *format,... );
BOOLEAN XinDialogPrinterSetup( XinPrintRecord * rec );
char *XinDialogStringPrompt( char *message, char *response,
int size_response );
/* Rectangles */
BOOLEAN XinRectEmpty( XinRect * rect );
XinRect *XinRectIntersect( XinRect * result, XinRect * r1, XinRect * r2 );
BOOLEAN XinRectPointContained( XinRect * rect, XinPoint * point );
XinRect *XinRectEnclose( XinRect * dst, XinRect * src1, XinRect * src2 );
/* Windows and drawing */
long XinWindowAppDataGet( XinWindow win );
void XinWindowAppDataSet( XinWindow win, long app_data );
void XinWindowArcDraw( XinWindow win, XinRect* ellipse, XinPoint* start, XinPoint* stop );
void XinWindowBitmapDraw( XinWindow win, XinBitmap * bitmap, XinRect * dest,
XinRect * source );
void XinWindowBrushSet( XinWindow win, XinBrush * brush );
void XinWindowCaretOff( XinWindow win );
void XinWindowCaretOn( XinWindow win, int x, int y, int height,
XinColor assumed_back_color, XinRect * clip_rct );
void XinWindowCheckBox( XinWindow win, BOOLEAN check ); /* NOTIMP */
void XinWindowCheckRadioButton( XinWindow win, XinWindow * wins, /* NOTIMP */
int nbr_windows );
BOOLEAN XinWindowClipGet( XinWindow win, XinRect * rect );
void XinWindowClipSet( XinWindow Win, XinRect * rect );
void XinWindowColorTextBackSet( XinWindow win, XinColor color ); /* Added Text */
void XinWindowColorTextForeSet( XinWindow win, XinColor color ); /* Added Text */
XinWindow XinWindowCreate( XinWindowDef * def );
void XinWindowCursorSet( XinWindow win, XinCursor cursor );
void XinWindowDestroy( XinWindow win );
XinDrawMode XinWindowDrawModeGet( XinWindow win );
void XinWindowDrawModeSet( XinWindow win, XinDrawMode mode );
XinDrawTools *XinWindowDrawToolsGet( XinWindow win, XinDrawTools * tools );
XinDrawTools *XinWindowDrawToolsNormalGet( XinDrawTools * tools );
void XinWindowDrawToolsSet( XinWindow win, XinDrawTools * tools );
XinWindow XinWindowDropDownParentGet( XinWindow creating_win );
void XinWindowEllipseDraw( XinWindow win, XinRect* rect );
void XinWindowEnable( XinWindow win, BOOLEAN enable ); /* NOTIMP */
void XinWindowEventUserSend( XinWindow win, long id, void *ptr );
void XinWindowFontMap( XinWindow win, XinFont * font );
XinWindow XinWindowFocusGet( void );
void XinWindowFocusSet( XinWindow win ); /* May be ineffective */
void XinWindowFrontSet( XinWindow win );
void XinWindowHotkeySet( XinWindow win, char ch );
void XinWindowIconDraw( XinWindow win, int x, int y, int icon_rid,
XinColor fore_color, XinColor back_color );
void XinWindowLineDraw( XinWindow win, XinPoint * point );
void XinWindowLineMoveTo( XinWindow win, XinPoint * point );
void XinWindowMouseRelease( void );
void XinWindowMouseTrap( XinWindow win,
BOOLEAN continuous_mouse_moves );
long XinWindowNativeGet( XinWindow win );
void XinWindowPaintForce( XinWindow win );
BOOLEAN XinWindowPaintNeeds( XinWindow win, XinRect * p_rect );
XinWindow XinWindowParentGet( XinWindow win );
void XinWindowPenSet( XinWindow win, XinPen * pen );
void XinWindowPieDraw( XinWindow win, XinRect* ellipse, XinPoint* start, XinPoint* stop );
void XinWindowPointsTranslate( XinWindow from_win, XinWindow to_win,
XinPoint * points, int nbr_points );
void XinWindowPolygonDraw( XinWindow win, XinPoint* points, int nbr_points );
void XinWindowRectDraw( XinWindow win, XinRect * rect );
void XinWindowDottedRectDraw( XinWindow win, XinRect * rect ); /* Added by Guy */
void XinWindowRoundRectDraw( XinWindow win, XinRect * rect, int rh, int rv ); /* Added by Guy */
void XinWindowShadedRectDraw( XinWindow win, XinRect * rect ); /* Added by Guy */
void XinWindowCheckMarkDraw( XinWindow win, XinRect * rect ); /* Added by Guy */
XinRect *XinWindowRectGet( XinWindow win, XinRect * p_rect );
void XinWindowRectInvalidate( XinWindow win, XinRect * rect );
XinRect *XinWindowRectOuterGet( XinWindow win, XinRect * p_rect );
void XinWindowRectScroll( XinWindow win, XinRect * p_rect,
int dh, int dv );
void XinWindowRectSet( XinWindow win, XinRect * rect );
void XinWindowRectTranslate( XinWindow from_win, XinWindow to_win,
XinRect * rect );
XinWindow XinWindowScreenGet( void );
void XinWindowShow( XinWindow win, BOOLEAN show );
XinWindow XinWindowTaskGet( void );
void XinWindowTextOpaqueSet( XinWindow win, BOOLEAN opaque );
void XinWindowTextDraw( XinWindow win, XinFont * font, int x, int y,
char *buf, int len );
void XinWindowTextRotateDraw( XinWindow win, XinFont* font, int x, int y,
int rotation, char* buf, int len );
void XinWindowTimerKill( XinWindow win, long timer_id );
long XinWindowTimerSet( XinWindow win, long millisecs );
char *XinWindowTitleGet( XinWindow win );
void XinWindowTitleSet( XinWindow win, const char *title );
#if XIWS == XIWS_XM
long XinWindowGetWidget( XinWindow win ); /* Return value is really a
* Widget */
#endif
/* Scroll Bars */
int XinScrollBarPositionGet( XinWindow win, XinScrollBarType type );
void XinScrollBarPositionSet( XinWindow win, XinScrollBarType type,
int position );
int XinScrollBarProportionGet( XinWindow win, XinScrollBarType type );
void XinScrollBarRangeGet( XinWindow win, XinScrollBarType type,
int *p_min, int *p_max );
void XinScrollBarSet( XinWindow win, XinScrollBarType type,
int min_val, int max_val,
int proportion, int pos );
/* Clip Board */
BOOLEAN XinClipboardFormatAvail( XinClipboardFormat format );
void *XinClipboardGet( XinClipboardFormat format, long *size );
void XinClipboardPut( XinClipboardFormat format, long size,
void *data );
/* Application */
void XinAppCleanup( void );
void XinAppQuitOk( void ); /* NOP on Motif */
void XinAppTerminate( void );
void XinAppSystemSetupInit( XinSystemSetup * setup );
void XinDebugPrintf( char *format,... ); /* NOTIMP */
void XinPendingEventsProcess( void );
/* Miscellaneous */
void XinBeep( void );
XinColor XinColorMake( int red, int green, int blue );
BOOLEAN XinStringMatch( char *string, char *pattern,
BOOLEAN case_sensitive );
void XinCursorWait( void );
long XinMetricGet( XinMetricType type );
void XinCoalesceInvalidates( XinWindow win, BOOLEAN coalesce );
void XinInitBuffer( void );
#ifdef XI_USE_XVT
void XinXvtEventGet( void *xvtp );
char *XinXvtEventTextGet( void *xvtp );
void XinXvtWindowRegister( XinWindow win, XinWindowEventHandler eh );
#endif
/* Menus */
XinMenuItem *XinMenuAdd( XinMenu * menu, int index, XinMenuItem * item );
XinMenu *XinMenuCreate( void );
BOOLEAN XinMenuDelete( XinMenu * menu, int index );
XinMenu *XinMenuDuplicate( XinMenu * menu );
void XinMenuFree( XinMenu * menu );
XinMenuItem *XinMenuItemAdd( XinMenuItem * item, int index,
XinMenuItem * child );
XinMenuItem *XinMenuItemCreate( char *text );
XinMenuItem *XinMenuItemDuplicate( XinMenuItem * item );
BOOLEAN XinMenuItemDelete( XinMenuItem * item, int index );
void XinMenuItemFree( XinMenuItem * item );
void XinMenuItemTextSet( XinMenuItem * item, char *text );
void XinWindowMenuFontSet( XinWindow win, XinFont * font ); /* NOTIMP */
XinMenu *XinWindowMenuGet( XinWindow win, XinMenuTag tag ); /* menubar if tag==0 */
void XinWindowMenuItemCheck( XinWindow win, XinMenuTag tag,
BOOLEAN check );
void XinWindowMenuItemEnable( XinWindow win, XinMenuTag tag,
BOOLEAN enable );
XinMenuItem *XinWindowMenuItemGet( XinWindow win, XinMenuTag tag );
BOOLEAN XinWindowMenuItemIsChecked( XinWindow win, XinMenuTag tag );
BOOLEAN XinWindowMenuItemIsEnabled( XinWindow win, XinMenuTag tag );
char *XinWindowMenuItemTextGet( XinWindow win, XinMenuTag tag );
void XinWindowMenuItemTextSet( XinWindow win, XinMenuTag tag, char *text );
void XinWindowMenuReplace( XinWindow win, XinMenuTag tag, XinMenu * menu ); /* menubar if tag==0 */
/* Fonts */
BOOLEAN XinFontBoldGet( XinFont * font );
void XinFontBoldSet( XinFont * font, BOOLEAN flag );
BOOLEAN XinFontCompare( XinFont * font1, XinFont * font2 );
void XinFontCopy( XinFont ** to, XinFont * from );
XinFont *XinFontCreate( void );
void XinFontDestroy( XinFont * font );
XinFontFamily XinFontFamilyGet( XinFont * font );
void XinFontFamilySet( XinFont * font, XinFontFamily family );
BOOLEAN XinFontIsMapped( XinFont * font );
BOOLEAN XinFontItalicGet( XinFont * font );
void XinFontItalicSet( XinFont * font, BOOLEAN flag );
void XinFontMetricsGet( XinFont * font, int *p_leading, int *p_ascent,
int *p_descent );
int XinFontSizeGet( XinFont * font );
void XinFontSizeSet( XinFont * font, int size );
int XinFontTextWidthGet( XinFont * font, char *text, int len );
void XinFontNativeConvert( XinFont * font );
#ifdef XI_USE_XVT
XinFont *XinFontXvtConvert( void *font_id );
void *XinFontXvtConvertBack( XinFont * font_id );
void XinFontXvtDestroy( void* font_id );
#endif
void XinFontUnmap( XinFont* font_id ); /* RGM: Font unmap hack */
/* Bitmaps */
void XinBitmapDestroy( XinBitmap * bitmap );
XinBitmap *XinBitmapRead( char *filename );
XinBitmap *XinBitmapReadRes( short id );
void XinBitmapSizeGet( XinBitmap * bitmap, short *pwidth, short *pheight );
/* Printing */
XinRect *XinPrintBandNext( void );
BOOLEAN XinPrintPageEnd( XinPrintRecord * rec );
BOOLEAN XinPrintPageStart( XinPrintRecord * rec );
XinPrintRecord *XinPrintRecordCreate( int *p_size );
void XinPrintRecordDestroy( XinPrintRecord * rec );
BOOLEAN XinPrintRecordValidate( XinPrintRecord * rec );
BOOLEAN XinPrintThreadStart( XinPrintHandler func, long app_data );
XinWindow XinPrintWindowCreate( XinPrintRecord * rec, char *title );
void XinPrintWindowDestroy( XinWindow win );
void XinPrintRecordMetricsGet( XinPrintRecord * rec, long * height, long * width,
long * vres, long * hres );
/* Files and Directories */
BOOLEAN XinDirectoryAbsoluteGet( char *full_name, XinDirectory * dir );
BOOLEAN XinDirectoryCurrentGet( XinDirectory * dir );
BOOLEAN XinDirectoryCurrentSet( XinDirectory * dir );
XinFileList *XinFileListGet( XinFileListSpec * spec );
/* NEW error handling */
typedef enum
{
XinSeverityWarning, XinSeverityFatal
} XinSeverity;
typedef BOOLEAN( *XinErrorHandler ) ( int errocde, XinSeverity severity, long app_data );
/* Note: return value of error handler is TRUE if app should terminate, FALSE to continue */
void XinError( int errcode, XinSeverity severity, long app_data );
XinErrorHandler XinErrorHandlerGet( void );
void XinErrorHandlerSet( XinErrorHandler handler );
BOOLEAN XinErrorDefaultHandler( int errcode, XinSeverity severity,
long app_data );
void XinIconSizeGet( int icon_rid, int *widthp, int *heightp );
/* Native help (only implemented on Windows - these calls do nothing elsewhere) */
void XinHelpFileNameSet( char *filename );
char *XinHelpFileNameGet();
BOOLEAN XinNativeHelp( XinWindow win, char *help_key );
#ifdef __cplusplus
} /* End of extern "C" */
#endif
/* Range of errors used internally by Xin */
#define XIN_ERRCODE_INTERNAL_MIN 1000
#define XIN_ERRCODE_INTERNAL_MAX 2000
#endif

17
src/xi01/xiport2.h Normal file
View File

@ -0,0 +1,17 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#define TEMP_BUFFER_SIZE 10000
extern XinWindowEventHandler xin_teh;
extern char *xin_buffer;
extern BOOLEAN xin_use_mdi_flag;
extern BOOLEAN xin_xvt_initialized;
XIDLL long XinXvtEventHandler( WINDOW win, EVENT * ep );

105
src/xi01/xires.h Normal file
View File

@ -0,0 +1,105 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#define XIWS_WIN 101
#define XIWS_XM 102
#define XIWS_MAC 103
#define XIWS_PM 104
#define XIWS_WM 105
#define XIWS_WXGTK 106
#if !defined(XI_USE_XVT) && !defined(XI_USE_XM) && !defined(XI_USE_WIN)
#define XI_USE_XVT
#endif
#ifdef LINUX
#define XVTWS WXGTKWS
#endif
#ifdef XI_USE_XVT
#include "xvt_env.h"
#ifndef XI_R4_API
#undef XIWS_WIN
#define XIWS_WIN WINWS
#undef XIWS_XM
#define XIWS_XM MTFWS
#undef XIWS_MAC
#define XIWS_MAC MACWS
#undef XIWS_PM
#define XIWS_PM PMWS
#undef XIWS_WM
#define XIWS_WM WMWS
#endif
#if XVTWS == MACWS
#define XIWS XIWS_MAC
#elif XVTWS == PMWS
#define XIWS XIWS_PM
#elif XVTWS == WIN32WS || XVTWS == WIN16WS
#define XIWS XIWS_WIN
#elif XVTWS == WMWS
#define XIWS XIWS_WM
#elif XVTWS == MTFWS || XVTWS == XOLWS
#define XIWS XIWS_XM
#elif XVTWS == WXGTKWS
#define XIWS XIWS_WXGTK
#endif
#endif
#ifdef XI_USE_XM
#define XIWS XIWS_XM
#define EOL_SEQ "\n"
#define SZ_FNAME 256
#endif
#ifdef XI_USE_WIN
#define XIWS XIWS_WIN
#define EOL_SEQ "\n"
#define SZ_FNAME 256
#endif
#define XI_CURSOR_RESIZE 8001
#define XI_CURSOR_HAND 8002
#define XI_CURSOR_VRESIZE 8003
#ifndef COMBO_ICON
#define COMBO_ICON 1026
#endif
#define NULL_MENU_RID 8000
#define XI_MENU_FILE 32000
#define XI_MENU_FILE_NEW (XI_MENU_FILE+1)
#define XI_MENU_FILE_OPEN (XI_MENU_FILE+2)
#define XI_MENU_FILE_CLOSE (XI_MENU_FILE+3)
#define XI_MENU_FILE_SAVE (XI_MENU_FILE+4)
#define XI_MENU_FILE_SAVE_AS (XI_MENU_FILE+5)
#define XI_MENU_FILE_REVERT (XI_MENU_FILE+6)
#define XI_MENU_FILE_PG_SETUP (XI_MENU_FILE+7)
#define XI_MENU_FILE_PRINT (XI_MENU_FILE+8)
#define XI_MENU_FILE_QUIT (XI_MENU_FILE+9)
#define XI_MENU_FILE_ABOUT (XI_MENU_FILE+10)
#define XI_MENU_EDIT 32025
#define XI_MENU_EDIT_UNDO (XI_MENU_EDIT+1)
#define XI_MENU_EDIT_CUT (XI_MENU_EDIT+2)
#define XI_MENU_EDIT_COPY (XI_MENU_EDIT+3)
#define XI_MENU_EDIT_PASTE (XI_MENU_EDIT+4)
#define XI_MENU_EDIT_CLEAR (XI_MENU_EDIT+5)
#define XI_MENU_FONT 32030
#define XI_MENU_FONT_SELECT 32031
#define XI_MENU_WIN 32100
#define XI_MENU_WIN_CASCADE (XI_MENU_WIN+1)
#define XI_MENU_WIN_TILE_HORZ (XI_MENU_WIN+2)
#define XI_MENU_WIN_TILE_VERT (XI_MENU_WIN+3)
#define XI_MENU_WIN_CLOSE_ALL (XI_MENU_WIN+4)

20
src/xi01/xisetup.c Normal file
View File

@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#include "xiport.h"
void
XinAppSystemSetupInit( XinSystemSetup * SystemSetup )
{
SystemSetup->task_win_title = "DUMMY";
SystemSetup->appl_name = "dummy";
SystemSetup->menu_bar_rid = 0;
SystemSetup->eh = NULL;
}

1698
src/xi01/xistx.c Normal file

File diff suppressed because it is too large Load Diff

157
src/xi01/xistx.h Normal file
View File

@ -0,0 +1,157 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#define NULL_STX (STX)0
typedef enum
{
STX_CB_CHAR,
STX_CB_CHANGE,
STX_CB_DBL,
STX_CB_FOCUS
}
STX_CB_TYPE;
typedef struct _stx_cb_data
{
STX stx;
STX_CB_TYPE cb_type;
int cid;
XinWindow win;
union
{
/* nothing for change notify */
BOOLEAN refused;
struct
{
int ch;
BOOLEAN shift;
BOOLEAN control;
BOOLEAN alt;
BOOLEAN is_paste;
BOOLEAN refused;
} chr;
} v;
} STX_CB_DATA;
typedef void ( *STX_CB ) ( STX_CB_DATA * stx_cb_data );
typedef struct _stx_def
{
int cid;
XinPoint pnt;
short pixel_width;
short pix_char_width;
unsigned long attrib;
short text_size;
XinFont *font;
XinColor back_color;
XinColor enabled_color; /* but inactive */
XinColor disabled_color;
XinColor active_color;
XinColor active_back_color;
XinColor disabled_back_color;
XinColor hilight_color; /* for well and platform fields */
XinColor shadow_color; /* for well and platform fields */
XinRect xi_rct;
STX_CB stx_cb;
long app_data;
char *parent;
BOOLEAN well;
BOOLEAN platform;
BOOLEAN auto_tab;
BOOLEAN scroll_bar;
BOOLEAN cr_ok;
BOOLEAN var_len_text;
XI_OBJ *parent_obj;
BOOLEAN button;
BOOLEAN button_on_left;
XinRect button_rect;
XinFlag no_button_space;
int button_width;
} STX_DEF;
typedef struct _stx_data
{
int cid;
XinWindow win;
XinRect rct;
XinRect edit_rect;
unsigned long attrib;
short pixel_width;
short pix_baseline;
XinFont *font;
XinColor back_color;
XinColor enabled_color; /* but inactive */
XinColor disabled_color;
XinColor disabled_back_color;
XinColor active_color;
XinColor active_back_color;
XinColor hilight_color; /* for well and platform fields */
XinColor shadow_color; /* for well and platform fields */
STX_CB stx_cb;
short text_size;
long app_data;
BOOLEAN have_mouse;
XI_TEXT *xi_text;
BOOLEAN multi_line;
BOOLEAN well;
BOOLEAN platform;
BOOLEAN auto_tab;
BOOLEAN scroll_bar;
BOOLEAN cr_ok;
BOOLEAN var_len_text;
char *buf;
BOOLEAN has_focus;
XI_OBJ *parent_obj;
BOOLEAN button;
BOOLEAN button_on_left;
XinRect button_rect;
XinFlag no_button_space;
int button_width;
#ifdef XI_USE_TX_SUPPORT
BOOLEAN use_text_edit;
long txedit;
#endif
} STX_DATA;
#define STX_LOSE_FOCUS NULL_STX
STX stx_create( XinWindow win, STX_DEF * stx_def, XinRect *field_button );
void stx_delete( STX stx, BOOLEAN destroy_font );
void stx_destroy_font( STX stx );
BOOLEAN stx_event( STX stx, XinEvent * ep );
void stx_focus_set( long stx, BOOLEAN set );
unsigned long stx_get_attrib( STX stx );
int stx_get_cid( STX stx );
long stx_get_app_data( STX stx );
void stx_get_sel( STX stx, int *c1, int *c2 );
XinRect *stx_get_rect( STX stx, XinRect * rct );
XinRect *stx_get_inside_rect( STX stx, XinRect * rect );
char *stx_get_text( STX stx, char *s, int len );
void stx_set_app_data( STX stx, long data );
void stx_set_attrib( STX stx, unsigned long attrib );
void stx_set_bufsize( STX stx, short size );
void stx_set_focus( STX stx );
void stx_set_pos( STX stx, XinPoint p );
void stx_set_rect( XinWindow win, STX stx, XinRect *new_rect, XinRect *field_button );
void stx_set_sel( STX stx, int c1, int c2 );
void stx_set_text( STX stx, const char *s );
XI_TEXT *stx_xi_text_get( STX stx );
BOOLEAN stx_cr_is_ok( STX stx );
void stx_update_colors( STX stx );
void stx_set_font( STX stx, XinFont* font );
#ifdef XI_USE_TX_SUPPORT
BOOLEAN xi_is_txedit( XI_OBJ * xi_obj );
BOOLEAN xi_xvt_tx_event( XinWindow win, XinEvent * ep );
void xi_tx_edit_move( XI_OBJ * xi_obj );
#endif

3390
src/xi01/xitext.c Normal file

File diff suppressed because it is too large Load Diff

132
src/xi01/xitext.h Normal file
View File

@ -0,0 +1,132 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
/*
The font in the text may be just a copy of a font pointer that
is elsewhere, in which case, it will be freed when the interface
goes away. It also could be an instantiated copy of a font, in
which case, the font will have been put into the interface font list,
so that it will be freed when the interface goes away.
*/
typedef struct
{
int line_break;
int ip1; /* -1 is null value */
int ip2; /* -1 is null value */
int active_ip;
} XI_TEXT_LINE_BREAK;
typedef struct
{
/* edit control info */
char *string; /* current text of edit control */
int pix_width; /* pix width as specified by user of text */
int internal_pix_width; /* pix_width - scroll bar width - sb delta */
int min_buffer_size;
int buffer_size;
int allocated_length;
BOOLEAN var_len_text;
int font_height;
int leading;
int ascent;
int descent;
XinFont *font;
XinWindow win;
XI_OBJ *parent_obj;
XinRect prect; /* physical rectangle of edit control */
XinRect clip_rect; /* clipping is intersected with this rect */
XinColor fore_color;
XinColor back_color;
XinColor fore_color_in_use;
XinColor back_color_in_use;
BOOLEAN multi_line; /* selection of multi or single line editing */
BOOLEAN right_justify; /* selection of right or left justified text */
BOOLEAN password;
BOOLEAN read_only;
BOOLEAN cr_ok;
/* multiline edit control info */
int nbr_lines;
XI_TEXT_LINE_BREAK *line_breaks;
int max_lines_to_draw;
BOOLEAN scrollbar;
XinWindow sb_win;
int sb_width;
int cid; /* used for scrollbar, same as parent's. */
BOOLEAN scrollbar_always_visible; /* true for fields, false for cells. */
XI_OBJ* itf;
BOOLEAN visible;
/* editing state */
BOOLEAN editing;
int selection_start_ip;
int ip1;
int ip2;
BOOLEAN selecting;
BOOLEAN double_selecting;
int double_selecting_start_ip;
BOOLEAN timer_set;
long timer_id;
BOOLEAN initialized;
/* multiline editing state */
int delta_y; /* number of lines scrolled vertically */
/* singleline editing state */
int delta_x; /* number of characters scrolled horizontally */
} XI_TEXT;
#define xi_text_nbr_lines_get( text ) text->nbr_lines
#define xi_text_line_break_get( text, cnt ) ( text->line_breaks[ cnt ].line_break )
#define xi_text_font_height_get( text ) text->font_height
#define xi_text_clip_set( text, rctp ) ( text->clip_rect = *(rctp))
#define xi_text_max_lines_to_draw_set( text, max_lines_to_draw_arg ) ( text->max_lines_to_draw = max_lines_to_draw_arg )
#define xi_text_color_fore_set( text, color ) ( text->fore_color = color )
#define xi_text_color_back_set( text, color ) ( text->back_color = color )
#define xi_text_get( text ) text->string
#define xi_text_parent_obj_set( text, obj ) ( text->parent_obj = obj )
#define xi_text_scrollbar_set( text, has_scroll_bar ) ( text->scrollbar = has_scroll_bar )
#define xi_text_password_set( text, is_pw ) ( text->password = is_pw )
#define xi_text_read_only_set( text, flag ) ( text->read_only = flag )
#define xi_text_editing_is( text ) text->editing
#define xi_text_buffer_set( text, buffer ) ( text->string = buffer )
#define xi_text_cr_ok_set( text, is_ok ) ( text->cr_ok = is_ok )
#define xi_text_initialized_set( text, set ) ( text->initialized = set )
#define xi_text_buffer_size_get( text ) ( text->buffer_size )
#define xi_text_min_buffer_size_set( text, set ) ( text->min_buffer_size = set )
#define xi_text_var_len_text_set( text, set ) ( text->var_len_text = set )
#define xi_text_font_get( text ) text->font
void xi_text_set( XI_TEXT * text, const char *string );
void xi_text_wrap( XI_TEXT * text );
void xi_text_pix_width_set( XI_TEXT * text, int pix_width );
void xi_text_pix_width_and_text_set( XI_TEXT * text, char *string, int pix_width, BOOLEAN set_font );
void xi_text_destruct( XI_TEXT * text );
XI_TEXT *xi_text_construct( XinWindow win, int pix_width, XinFont * font, void *parent,
BOOLEAN multi_line, int cid, BOOLEAN scrollbar_always_visible );
void xi_text_draw( XI_TEXT * text, XinColor color, XinColor back_color, BOOLEAN update );
void xi_text_selection_set( XI_TEXT * text, int ip1, int ip2 );
void xi_text_selection_get( XI_TEXT * text, int *ip1, int *ip2 );
void xi_text_selection_get_internal( XI_TEXT * text, int *ip1, int *ip2, int *start_ip );
void xi_text_selection_set_internal( XI_TEXT * text, int ip1, int ip2,
int selection_start_ip, BOOLEAN do_carets, BOOLEAN map_font );
void xi_text_editing_start( XI_TEXT * text );
void xi_text_editing_stop( XI_TEXT * text );
BOOLEAN xi_text_event( XI_TEXT * text, XinEvent * ep, BOOLEAN gaining_focus, BOOLEAN *changed );
void xi_text_prect_set( XI_TEXT * text, XinRect * rectp );
XI_TEXT *xi_text_focus_get( XinWindow win );
void xi_text_buffer_size_set( XI_TEXT* text, int size );
void xi_text_font_set( XI_TEXT* text, XinFont* font );
void xi_text_visible_set( XI_TEXT* text, BOOLEAN visible );
XinRect* xi_text_rect_get_adjusted( XI_TEXT * text, XinRect * rcta );
void xi_text_paste_internal( XI_TEXT * text, char *string );
void xi_text_right_justify_set( XI_TEXT* text, BOOLEAN flag );
void xi_text_reinitialize( XI_TEXT* text );

506
src/xi01/xitree.c Normal file
View File

@ -0,0 +1,506 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
/* ERROR CODES 20201-20201 */
#define XI_INTERNAL
#include "xi.h"
#include "xiheap.h"
#include "xiutils.h"
#define PADCHAR ((char)0x8e)
#define MAGIC 0xe8
/*
constants to define for more debugging
PAD - pad allocations with N bytes of magic and check magic number when
xi_tree_check_sanity is called
FENCE - call xi_tree_check_sanity on every Nth xi_tree_* call
PREPAD - put an extra N bytes between the node struct and the data.
This padding is never checked.
sample usage:
#define PAD 20
#define FENCE 10
#define PREPAD 10
*/
/*
#define PAD 100
#define FENCE 1
*/
typedef struct _tree_node
{
struct _tree_node *parent;
struct _tree_node *sibling;
struct _tree_node *child;
#ifdef TREEDEBUG
int line;
char *file;
int magic; /* for sanity checks */
int size;
#ifdef PREPAD
char prepad[PREPAD];
#endif
#endif
} TREE_NODE;
/* This code automatically determines the proper size for TREE_NODE so that
the data following it is always correctly aligned. */
static struct
{
TREE_NODE node;
double data;
} dummy_header;
#define SIZEOF_TREE_NODE ((int)( (char*)&dummy_header.data - (char*)&dummy_header.node ))
#ifdef TREEDEBUG
#undef xi_tree_malloc
#undef xi_tree_realloc
#define xi_tree_malloc_body xi_tree_malloc_d
#define xi_tree_realloc_body xi_tree_realloc_d
#define xi_tree_malloc_stub xi_tree_malloc
#define xi_tree_realloc_stub xi_tree_realloc
#else
#define xi_tree_malloc_body xi_tree_malloc
#define xi_tree_realloc_body xi_tree_realloc
#define xi_tree_malloc_stub xi_tree_malloc_d
#define xi_tree_realloc_stub xi_tree_realloc_d
#endif
#define VOIDPTR_TO_TREEPTR(p) ((TREE_NODE *)((long)(p) - SIZEOF_TREE_NODE))
#define TREEPTR_TO_VOIDPTR(t) ((void *)((long)(t) + SIZEOF_TREE_NODE))
#define DBGTAB 3
static TREE_NODE topnode =
{
NULL, &topnode, NULL
#ifdef TREEDEBUG
,0, "TOPNODE", MAGIC, 0
#endif
};
static TREE_NODE *top = &topnode;
#ifdef TREEDEBUG
#ifdef FENCE
static int fence_count;
#endif
static int node_count = 1; /* start with just top node */
#endif
static void
dflt_error_fcn( void )
{
NOREF( dummy_header.data );
XinError( 20201, XinSeverityFatal, 0L );
}
static void ( *error_fcn ) ( void ) = dflt_error_fcn;
#ifdef TREEDEBUG
void xi_tree_check_fence( void );
void
xi_tree_check_fence( void )
{
#ifdef FENCE
static int fence_count;
fence_count++;
if ( fence_count % FENCE == 0 )
xi_tree_check_sanity( "FENCE CHECK" );
#endif
}
static void
adjust_size( size_t * size )
{
NOREF( size );
#ifdef PAD
*size += PAD;
#endif
}
static void
validate_node( void *p )
{
if ( p != NULL && VOIDPTR_TO_TREEPTR( p )->magic != MAGIC )
XinDialogFatal( "Bad tree node detected: file %s, line %d",
VOIDPTR_TO_TREEPTR( p )->file, VOIDPTR_TO_TREEPTR( p )->line );
}
#endif
static void
remove_from_siblings_and_parent( TREE_NODE * remove_t )
{
TREE_NODE *tp;
/* remove from sibling list */
tp = remove_t;
while ( tp->sibling != remove_t )
tp = tp->sibling;
tp->sibling = remove_t->sibling;
/* adjust parent pointers */
if ( remove_t->parent->child == remove_t )
{
remove_t->parent->child = ( ( remove_t->sibling == remove_t ) ?
NULL : remove_t->sibling );
}
}
static void
xi_tree_free_internal( TREE_NODE * remove_t, BOOLEAN toplevel )
{
TREE_NODE *tp;
TREE_NODE *nexttp;
if ( toplevel )
{
remove_from_siblings_and_parent( remove_t );
remove_t->sibling = NULL;
}
/* free all child nodes */
tp = remove_t->child;
if ( tp != NULL )
do
{
/* store next pointer before nuking node */
nexttp = tp->sibling;
xi_tree_free_internal( tp, FALSE );
tp = nexttp;
} while ( tp != remove_t->child );
/* free underlying heap manager memory */
#ifdef TREEDEBUG
heap_free( remove_t->file );
node_count--;
#endif
heap_free( remove_t );
}
void
xi_tree_reparent( void *p, void *parent )
{
TREE_NODE *tn;
#ifdef TREEDEBUG
xi_tree_check_fence( );
validate_node( p );
#endif
remove_from_siblings_and_parent( VOIDPTR_TO_TREEPTR( p ) );
tn = VOIDPTR_TO_TREEPTR( p );
if ( parent == NULL )
parent = TREEPTR_TO_VOIDPTR( top );
tn->parent = VOIDPTR_TO_TREEPTR( parent );
if ( tn->parent->child == NULL )
{
tn->parent->child = tn;
tn->sibling = tn;
}
else
{
/* insert tn in the sibling list */
tn->sibling = tn->parent->child->sibling;
tn->parent->child->sibling = tn;
}
}
void
xi_tree_free( void *p )
{
#ifdef TREEDEBUG
xi_tree_check_fence( );
validate_node( p );
#endif
xi_tree_free_internal( VOIDPTR_TO_TREEPTR( p ), TRUE );
}
void *
xi_tree_get_parent( void *p )
{
TREE_NODE *parent;
#ifdef TREEDEBUG
validate_node( p );
#endif
parent = VOIDPTR_TO_TREEPTR( p )->parent;
return ( ( parent == top ) ? NULL : TREEPTR_TO_VOIDPTR( parent ) );
}
void *
xi_tree_malloc_body( size_t size, void *parent
#ifdef TREEDEBUG
,int line, char *file
#endif
)
{
TREE_NODE *tn;
#ifdef TREEDEBUG
size_t orig_size = size;
xi_tree_check_fence( );
validate_node( parent );
adjust_size( &size );
#endif
tn = ( TREE_NODE * ) heap_malloc( size + SIZEOF_TREE_NODE );
if ( !tn )
{
( *error_fcn ) ( );
return NULL;
}
#ifdef TREEDEBUG
memset( ( char * ) tn + SIZEOF_TREE_NODE + orig_size,
PADCHAR, ( long ) ( size - orig_size ) );
tn->file = ( char * ) heap_malloc( strlen( file ) + 1 );
if ( !tn->file )
{
( *error_fcn ) ( );
return NULL;
}
strcpy( tn->file, file );
tn->line = line;
tn->magic = MAGIC;
tn->size = size;
node_count++;
#endif
tn->child = NULL;
tn->sibling = tn;
if ( parent == NULL )
parent = TREEPTR_TO_VOIDPTR( top );
tn->parent = VOIDPTR_TO_TREEPTR( parent );
if ( tn->parent->child == NULL )
tn->parent->child = tn;
else
{
/* insert tn in the sibling list */
tn->sibling = tn->parent->child->sibling;
tn->parent->child->sibling = tn;
}
return ( TREEPTR_TO_VOIDPTR( tn ) );
}
void *
xi_tree_realloc_body( void *p, size_t size
#ifdef TREEDEBUG
,int line, char *file
#endif
)
{
TREE_NODE *old_t;
TREE_NODE *new_t;
TREE_NODE *tp;
#ifdef TREEDEBUG
size_t orig_size = size;
xi_tree_check_fence( );
adjust_size( &size );
#endif
old_t = VOIDPTR_TO_TREEPTR( p );
#ifdef TREEDEBUG
validate_node( p );
#endif
new_t = ( TREE_NODE * ) heap_realloc( old_t, ( size + SIZEOF_TREE_NODE ) );
#ifdef TREEDEBUG
if ( !new_t )
{
( *error_fcn ) ( );
return NULL;
}
memset( ( char * ) new_t + SIZEOF_TREE_NODE + orig_size,
PADCHAR, ( long ) ( size - orig_size ) );
new_t->line = line;
new_t->size = size;
heap_free( new_t->file );
new_t->file = ( char * ) heap_malloc( strlen( file ) + 1 );
if ( !new_t->file )
{
( *error_fcn ) ( );
return NULL;
}
strcpy( new_t->file, file );
#endif
if ( new_t != old_t )
{
/* change parent pointer */
if ( new_t->parent->child == old_t )
new_t->parent->child = new_t;
/* change sibling pointers */
for ( tp = new_t; tp->sibling != old_t; tp = tp->sibling )
;
tp->sibling = new_t;
/* change children pointers */
tp = new_t->child;
if ( tp != NULL )
do
{
tp->parent = new_t;
tp = tp->sibling;
} while ( tp != new_t->child );
}
return ( TREEPTR_TO_VOIDPTR( new_t ) )
;
}
static void
xi_tree_dbg_internal( TREE_NODE * tn, int level )
{
char buf[150];
char *s;
TREE_NODE *tn2;
int i,
l;
if ( tn == NULL )
return;
/* print tab indent indicating level */
s = buf;
for ( l = level; l; l-- )
{
for ( i = 0; i < DBGTAB; i++ )
*s++ = ' ';
}
#ifdef TREEDEBUG
sprintf( s, "node %08lx: par=%08lx, sib=%08lx, ch=%08lx, file=%s, line=%d",
( long ) ( tn ), ( long ) ( tn->parent ), ( long ) ( tn->sibling ),
( long ) ( tn->child ), tn->file, tn->line );
#else
sprintf( s, "node %08lx: par=%08lx, sib=%08lx, ch=%08lx",
( long ) tn, ( long ) ( tn->parent ), ( long ) ( tn->sibling ),
( long ) ( tn->child ) );
#endif
xi_dbg( buf );
tn2 = tn->child;
if ( tn2 != NULL )
do
{
xi_tree_dbg_internal( tn2, level + 1 );
tn2 = tn2->sibling;
} while ( tn2 != tn->child );
}
void
xi_tree_dbg( char *title )
{
char buf[100];
sprintf( buf, "TREE MEMORY DEBUG TRACE (%s)", title );
xi_dbg( buf );
xi_dbg( "=======================" );
xi_tree_dbg_internal( top, 0 );
heap_dbg( title );
xi_tree_check_sanity( title );
}
static void
xi_tree_check_sanity_internal( TREE_NODE * tn, char *title,
int *count )
{
TREE_NODE *tn2;
#ifdef TREEDEBUG
#ifdef PAD
int i;
/* check pad bytes for node */
if ( tn != &topnode )
for ( i = tn->size - PAD; i < tn->size; i++ )
if ( *( ( char * ) tn + SIZEOF_TREE_NODE + i ) != PADCHAR )
XinDialogFatal( "xi_tree_node padding corrupted: node=%08lx, file=%s, line=%d",
( long ) ( tn ), tn->file, tn->line );
#endif
#endif
/* check that all children point to this node */
tn2 = tn->child;
( *count )++;
if ( tn2 != NULL )
do
{
if ( tn2->parent != tn )
XinDialogFatal( "memory check %s: tree node %08lx has bad parent",
title, ( long ) ( tn2 ) );
xi_tree_check_sanity_internal( tn2, title, count );
tn2 = tn2->sibling;
} while ( tn2 != tn->child );
}
void
xi_tree_check_sanity( char *title )
{
int count = 0;
xi_tree_check_sanity_internal( top, title, &count );
#ifdef TREEDEBUG
if ( count != node_count )
XinDialogFatal( "tree sanity check failed: tree count=%d, allocation count=%d",
count, node_count );
#endif
}
#ifdef TREEDEBUG
void *xi_tree_malloc_stub( size_t size, void *parent );
void *
xi_tree_malloc_stub( size_t size, void *parent )
{
return ( xi_tree_malloc_body( size, parent, 0, "(unknown)" ) );
}
void *xi_tree_realloc_stub( void *p, size_t size );
void *
xi_tree_realloc_stub( void *p, size_t size )
{
return ( xi_tree_realloc_body( p, size, 0, "(unknown)" ) );
}
#else
void *
xi_tree_malloc_stub( size_t size, void *parent,
int line, char *file );
void *
xi_tree_malloc_stub( size_t size, void *parent,
int line, char *file )
{
NOREF( line );
NOREF( file );
return ( xi_tree_malloc_body( size, parent ) );
}
void *
xi_tree_realloc_stub( void *p, size_t size,
int line, char *file );
void *
xi_tree_realloc_stub( void *p, size_t size,
int line, char *file )
{
NOREF( line );
NOREF( file );
return ( xi_tree_realloc_body( p, size ) );
}
#endif
void
xi_tree_reg_error_fcn( void ( *fcn ) ( void ) )
{
error_fcn = fcn;
}

4160
src/xi01/xiutils.c Normal file

File diff suppressed because it is too large Load Diff

133
src/xi01/xiutils.h Normal file
View File

@ -0,0 +1,133 @@
/*******************************************************************************
* Copyright 1991-1996 by ORCA Software, Inc. *
* *
* All rights reserved. May not be reproduced or distributed, in printed or *
* electronic form, without permission of ORCA Software, Inc. May not be *
* distributed as object code, separately or linked with other object modules, *
* without permission. *
*******************************************************************************/
#ifdef WIN32
#if XIAGADLL == 1
#define XIDLL __declspec(dllexport)
#else
#define XIDLL __declspec(dllimport)
#endif
#else
#define XIDLL
#endif
extern XinBrush ltgray_cbrush;
extern XinBrush gray_cbrush;
extern XinBrush hollow_cbrush;
extern XinFont *xi_sysfont;
extern XinRect big_clip;
/* DIMENSIONS FOR FIELD OBJET BORDER */
#define XI_FLD_XBORDER XI_FU_MULTIPLE /* may change for OL implementation */
#define XI_MULTILINE_SCROLLBAR_CID 31000
XIDLL XinRect *adjust_rect( XinRect * rct, int pwid );
XIDLL int clip( int val, int mn, int mx );
XIDLL void dbg_rct( char *tag, XinRect * rct );
XIDLL void order_ints( int *ip1, int *ip2 );
/*
char* gstrncpy(char *dst, char *src, int n);
*/
XIDLL char *tstrncpy( char *dst, const char *src, int n );
XIDLL void xi_adjust_sb_vir_itf( XinWindow win, XI_OBJ * itf );
XIDLL void xi_button_rect_calc( XI_OBJ * btn_obj, int sequence );
XIDLL void xi_container_rect_calc( XI_OBJ * cnt_obj, int max_text_len,
XI_BTN_TYPE btn_type );
XIDLL XinFont *xi_def_get_font( XI_OBJ_DEF * obj_def );
XIDLL BOOLEAN xi_get_xil_pref( XI_OBJ * obj );
XIDLL void xi_draw_clipped_text( XinWindow win, XinFont * font, char *s,
XinRect * bound_rct,
XinRect * clip_rct, unsigned long attrib,
BOOLEAN set_the_cpen, int rule_and_space,
int len, char mnemonic, short mnemonic_instance, int *baseline );
XIDLL void xi_dbg( char *buf );
XIDLL void xi_draw_button( XI_OBJ * xi_obj, XinRect * rct,
BOOLEAN enabled, BOOLEAN visible, BOOLEAN focus,
BOOLEAN down, BOOLEAN dflt, BOOLEAN checked, BOOLEAN box_only,
BOOLEAN draw_border );
XIDLL BOOLEAN xi_eh( XinWindow win, XinEvent * ep );
XIDLL void xi_even_fu( int *f );
XIDLL void xi_even_fu_pnt( XinPoint * p );
XIDLL XinRect *xi_inflate_rect( XinRect * rct, int amount );
XIDLL void xi_fu_to_pu_font( XinFont * font, XinPoint * pnt, int nbr_pnts );
XIDLL XinRect *xi_get_enclosing_rect( XinRect * dst, XinRect * src1, XinRect * src2 );
XIDLL void xi_get_font_metrics_font( XinFont * font, int *leading, int *ascent,
int *descent, int *char_width );
XIDLL int xi_get_fu_height( XI_OBJ * itf );
XIDLL int xi_get_fu_height_font( XinFont * font );
XIDLL int xi_get_fu_width( XI_OBJ * itf );
XIDLL int xi_get_fu_width_font( XinFont * font );
XIDLL void xi_get_hsb_rect( XI_OBJ * xi_obj, XinRect * rctp );
XIDLL XI_OBJ *xi_get_itf_from_id( int id );
XIDLL XinRect *xi_get_rect_internal( XI_OBJ * xi_obj, XinRect * rctp, XinRect * old_win_rct,
XinRect * new_win_rct );
XIDLL void xi_get_sb_rect( XI_OBJ * xi_obj, XinRect * rctp );
XIDLL void xi_move_to( XinWindow win, XinPoint pnt );
XIDLL void xi_draw_line( XinWindow win, XinPoint pnt );
XIDLL void xi_scroll_rect( XinWindow win, XinRect * rct, int delta_x, int delta_y );
XIDLL BOOLEAN xi_pt_in_rect( XinRect * rct, XinPoint pnt );
XIDLL BOOLEAN xi_half_baked( XinWindow win );
XIDLL void xi_init_sysvals( void );
XIDLL void xi_make_obj_visible( XI_OBJ * xi_obj );
XIDLL void xi_menu_enable( XI_OBJ * itf, int tag, BOOLEAN enable );
XIDLL void xi_move_column_internal( XI_OBJ * column, int position,
BOOLEAN in_hscrolling );
XIDLL void xi_move_list_hscroll_bar( XI_OBJ * xi_obj );
XIDLL void xi_move_list_scroll_bar( XI_OBJ * xi_obj );
XIDLL int xi_obj_to_idx( XI_OBJ * xi_obj );
XIDLL void xi_realloc_array( void **ptr, int nbr, size_t sz, void *parent );
XIDLL void xi_set_sysval( XI_SV_TYPE valtype, int value );
XIDLL void xi_set_trap_obj( XI_OBJ * obj );
XIDLL void xi_set_update_obj( XI_OBJ * xi_obj );
XIDLL int xi_get_text_width( XinFont * font, char *s, int len, unsigned long attrib );
XIDLL char *xi_get_text_string( char *src, unsigned long attrib );
XIDLL BOOLEAN xi_cr_is_ok( XI_OBJ * xi_obj );
XIDLL BOOLEAN xi_focus_obj_is_cell_button( XI_OBJ * focus_obj );
XIDLL void xi_draw_foc_and_dflt( XI_OBJ * focus_obj );
XIDLL void xi_draw_foc_and_dflt_if_necessary( XI_OBJ * focus_obj, XI_OBJ * next_obj );
XIDLL BOOLEAN xi_get_native_controls( XI_OBJ * obj );
XIDLL BOOLEAN xi_XinWindowPaintNeeds( XinWindow win, XinRect * rct );
#ifdef TREEDEBUG
#define xi_tree_realloc2(o, s, p) xi_tree_realloc_d2(o, s, p, __LINE__, __FILE__)
char *
XIDLL xi_tree_realloc_d2( char *oldp, size_t size, char *parent, int line,
char *filename );
#else
XIDLL char *xi_tree_realloc2( char *oldp, size_t size, char *parent );
#endif
XIDLL void xi_draw_icon( XinWindow win, int x, int y, int rid, XinColor fore_color, XinColor back_color );
XIDLL void xi_draw_text( XinWindow win, XinFont * font, int x, int y, char *s, int len );
XIDLL BOOLEAN font_compare( XinFont * f1, XinFont * f2 );
#ifdef XI_USE_TX_SUPPORT
XIDLL void xi_caret_off( XinWindow win );
#endif
XIDLL void xi_caret_on( XinWindow win, int x, int y, int height, XinRect * clip_rect );
XIDLL void xi_set_clip( XinWindow win, XinRect * clip );
XIDLL void xi_draw_dotted_rect( XinWindow win, XinRect * rctp );
XIDLL XI_OBJ* xi_get_drag_list_obj( void );
XIDLL void xi_set_drag_list_obj( XI_OBJ* obj );
XIDLL BOOLEAN xi_is_obj( XI_OBJ* obj, XI_OBJ* itf );
/*********************************************************************/
extern XinPen hollow_cpen;
extern XinPen black_cpen;
extern XinPen rubber_cpen;
extern XinBrush white_cbrush;
extern XinBrush hollow_cbrush;
extern XinFont normal_font;
/*********************************************************************/