Skip to content

Commit

Permalink
support ANSI cell values
Browse files Browse the repository at this point in the history
  • Loading branch information
miyako committed Dec 9, 2013
1 parent d96baaa commit f205871
Show file tree
Hide file tree
Showing 88 changed files with 5,315 additions and 3,194 deletions.
472 changes: 300 additions & 172 deletions XLS II/4D Plugin API/4DPluginAPI.cpp

Large diffs are not rendered by default.

39 changes: 28 additions & 11 deletions XLS II/4D Plugin API/4DPluginAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@
#endif

#include "C_TEXT.h"
//#include "C_INTEGER.h"
#include "C_INTEGER.h"
#include "C_LONGINT.h"
//#include "C_TIME.h"
//#include "C_DATE.h"
#include "C_TIME.h"
#include "C_DATE.h"
#include "C_REAL.h"
//#include "C_BLOB.h"
//#include "C_PICTURE.h"
#include "C_BLOB.h"
#include "C_PICTURE.h"
#include "C_POINTER.h"

//#include "ARRAY_TEXT.h"
//#include "ARRAY_INTEGER.h"
//#include "ARRAY_LONGINT.h"
//#include "ARRAY_REAL.h"
#include "ARRAY_TEXT.h"
#include "ARRAY_INTEGER.h"
#include "ARRAY_LONGINT.h"
#include "ARRAY_REAL.h"
#include "ARRAY_BOOLEAN.h"

//some external libraries assume first load; include this file after them
#if VERSIONWIN
Expand Down Expand Up @@ -457,6 +459,7 @@ PA_AreaEvent PA_GetAreaEvent ( PA_PluginParameters params );
PA_Rect PA_GetAreaRect ( PA_PluginParameters params );
PA_Unistring* PA_GetAreaName ( PA_PluginParameters params );
void PA_GetPluginProperties ( PA_PluginParameters params, PA_PluginProperties* properties );
// If PA_GetPluginProperties needed please call it first.
void PA_SetAreaReference ( PA_PluginParameters params, void* ref );
void* PA_GetAreaReference ( PA_PluginParameters params );
void PA_SetAreaFocusable ( PA_PluginParameters params, char focusable );
Expand All @@ -480,8 +483,16 @@ void PA_GotoNextField ( PA_PluginParameters params );
void PA_GotoPreviousField ( PA_PluginParameters params );
void PA_GetPageChange ( PA_PluginParameters params, short *pageFrom, short *pageTo );
void PA_RequestRedraw ( PA_PluginParameters params );
void PA_RedrawArea ( PA_PluginParameters params, char inNow,PA_Rect* inRect);
PA_Rect PA_GetAreaPortBounds ( PA_PluginParameters params);

// ---------------------------------------------------------------
// CGContext tools
// ---------------------------------------------------------------

void PA_UseQuartzAxis( PA_PluginParameters params, short *outAreaX, short *outAreaY, short* outAreaWidth, short *outAreaHeight);
void PA_UseQuickdrawAxis( PA_PluginParameters params, short *outAreaX, short *outAreaY, short* outAreaWidth, short *outAreaHeight);

// -----------------------------------------------------
// manage dropping events on a plugin area
// -----------------------------------------------------
Expand Down Expand Up @@ -597,25 +608,31 @@ void PA_ResizeArray ( PA_Variable* ar, unsigned int nb );//miyako; array
long PA_GetArrayCurrent ( PA_Variable ar );
void PA_SetArrayCurrent ( PA_Variable* ar, long current );

char PA_IsArrayVariable ( PA_Variable* ar );

// Reading values on arrays
short PA_GetIntegerInArray ( PA_Variable ar, long i );
long PA_GetLongintInArray ( PA_Variable ar, long i );
double PA_GetRealInArray ( PA_Variable ar, long i );
void PA_GetDateInArray ( PA_Variable ar, long i, short* day, short* month, short* year );
long PA_GetTimeInArray ( PA_Variable ar, long i );
PA_Picture PA_GetPictureInArray ( PA_Variable ar, long i );
PA_Unistring PA_GetStringInArray ( PA_Variable ar, long i );
char PA_GetBooleanInArray ( PA_Variable ar, long i );
PA_Blob PA_GetBlobInArray ( PA_Variable ar, long i );
PA_Variable PA_GetArrayInArray ( PA_Variable ar, long i );
PointerBlock PA_GetPointerInArray ( PA_Variable ar, long i );

// Setting values on arrays
void PA_SetIntegerInArray ( PA_Variable ar, long i, short value );
void PA_SetLongintInArray ( PA_Variable ar, long i, long value );
void PA_SetTimeInArray ( PA_Variable ar, long i, long inMilliseconds );
void PA_SetRealInArray ( PA_Variable ar, long i, double value );
void PA_SetDateInArray ( PA_Variable ar, long i, short day, short month, short year );
void PA_SetStringInArray ( PA_Variable ar, long i, PA_Unistring* ustr );
void PA_SetPictureInArray ( PA_Variable ar, long i, PA_Picture picture );
void PA_SetBooleanInArray ( PA_Variable ar, long i, char value );
void PA_SetBlobInArray ( PA_Variable ar, long i, PA_Blob value );
void PA_SetArrayInArray ( PA_Variable ar, long i, PA_Variable value );
void PA_SetPointerInArray ( PA_Variable ar, long i, PointerBlock value );

Expand Down Expand Up @@ -801,8 +818,8 @@ void PA_SetWindowFocused ( PA_WindowRef windowRef );
char PA_IsWindowFocused ( PA_WindowRef windowRef );

void PA_UpdateVariables ( );
long PA_GetHWND ( PA_WindowRef windowRef );
long PA_GetWindowPtr ( PA_WindowRef windowRef );
sLONG_PTR PA_GetHWND ( PA_WindowRef windowRef );
sLONG_PTR PA_GetWindowPtr ( PA_WindowRef windowRef );
void PA_ClosePluginWindow ( PA_PluginRef pluginRef );
void PA_SetPluginWindowTitle ( PA_PluginRef pluginRef, PA_Unichar* windowTitle );
void PA_SetPluginAreaClipMode ( PA_PluginRef pluginRef, char clipChildren );
Expand Down
139 changes: 139 additions & 0 deletions XLS II/4D Plugin API/Classes/ARRAY_BOOLEAN.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
* ARRAY_BOOLEAN.cpp
* 4D Plugin
*
* Created by miyako on 11/01/03.
*
*/

#include "ARRAY_BOOLEAN.h"

static unsigned char tabTrue [ 8 ] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };

static bool GetBitInTable( unsigned char *bitTable, long index)
{
return (bool) ( ( *( bitTable + ( index >> 3 ) ) & tabTrue[ index & 7 ] ) ? 1 : 0 );
}

void ARRAY_BOOLEAN::fromParamAtIndex(PackagePtr pParams, uint16_t index)
{
if(index)
{
PA_Variable arr = *((PA_Variable*) pParams[index - 1]);

this->setSize(0);

if(arr.fType == eVK_ArrayBoolean)
{
uint32_t i;

bool booleanValue;

for(i = 0; i <= (uint32_t)arr.uValue.fArray.fNbElements; i++)
{
booleanValue = GetBitInTable( *(unsigned char**) (arr.uValue.fArray.fData), i );
this->_CboolArray->push_back(booleanValue);
}

}

}

}

void ARRAY_BOOLEAN::toParamAtIndex(PackagePtr pParams, uint16_t index)
{
if(index)
{
PA_Variable arr = *((PA_Variable*) pParams[index - 1]);
PA_Variable *param = ((PA_Variable *)pParams[index - 1]);

switch (arr.fType)
{
case eVK_ArrayBoolean:
break;
case eVK_Undefined:
PA_ClearVariable(&arr);
arr = PA_CreateVariable(eVK_ArrayBoolean);
param->fType = arr.fType;
break;

default:
break;
}

if(arr.fType == eVK_ArrayBoolean)
{

PA_ResizeArray(&arr, this->_CboolArray->empty() ? 0 : (uint32_t)(this->_CboolArray->size() - 1));

uint32_t i;

for(i = 0; i < this->_CboolArray->size(); i++)
{
PA_SetBooleanInArray(arr, i, this->_CboolArray->at(i));
}

param->fFiller = 0;
param->uValue.fArray.fCurrent = arr.uValue.fArray.fCurrent;
param->uValue.fArray.fNbElements = arr.uValue.fArray.fNbElements;
param->uValue.fArray.fData = arr.uValue.fArray.fData;

}

}

}

void ARRAY_BOOLEAN::appendBooleanValue(bool booleanValue)
{
this->_CboolArray->push_back(booleanValue);
}

void ARRAY_BOOLEAN::setBooleanValueAtIndex(bool booleanValue, uint32_t index)
{
if(index < this->_CboolArray->size())
{

std::vector<bool>::iterator it = this->_CboolArray->begin();
it += index;

this->_CboolArray->insert(this->_CboolArray->erase(it), booleanValue);

}
}

bool ARRAY_BOOLEAN::getBooleanValueAtIndex(uint32_t index)
{

bool booleanValue = 0;

if(index < this->_CboolArray->size())
{

booleanValue = this->_CboolArray->at(index);
}

return booleanValue;

}

uint32_t ARRAY_BOOLEAN::getSize()
{
return (uint32_t)this->_CboolArray->size();
}

void ARRAY_BOOLEAN::setSize(uint32_t size)
{
this->_CboolArray->resize(size);
}

ARRAY_BOOLEAN::ARRAY_BOOLEAN() : _CboolArray(new CboolArray)
{

}

ARRAY_BOOLEAN::~ARRAY_BOOLEAN()
{
delete _CboolArray;
}
49 changes: 49 additions & 0 deletions XLS II/4D Plugin API/Classes/ARRAY_BOOLEAN.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* ARRAY_BOOLEAN.h
* 4D Plugin
*
* Created by miyako on 11/01/03.
*
*/

#ifndef __ARRAY_BOOLEAN_H__
#define __ARRAY_BOOLEAN_H__ 1

#include "4DPluginAPI.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef std::vector<bool> CboolArray;

class ARRAY_BOOLEAN
{

private:

CboolArray* _CboolArray;

public:

void fromParamAtIndex(PackagePtr pParams, uint16_t index);
void toParamAtIndex(PackagePtr pParams, uint16_t index);

void appendBooleanValue(bool booleanValue);

void setBooleanValueAtIndex(bool booleanValue, uint32_t index);
bool getBooleanValueAtIndex(uint32_t index);

uint32_t getSize();
void setSize(uint32_t size);

ARRAY_BOOLEAN();
~ARRAY_BOOLEAN();

};

#ifdef __cplusplus
}
#endif

#endif
Loading

0 comments on commit f205871

Please sign in to comment.