Beispiel #1
0
String ExternalProcess::WorkingDirectory() const
{
   size_type len = 0;
   (*API->ExternalProcess->GetExternalProcessWorkingDirectory)( handle, 0, &len );

   String dirPath;
   if ( len > 0 )
   {
      dirPath.SetLength( len );
      if ( (*API->ExternalProcess->GetExternalProcessWorkingDirectory)( handle, dirPath.c_str(), &len ) == api_false )
         throw APIFunctionError( "GetExternalProcessWorkingDirectory" );
      dirPath.ResizeToNullTerminated();
   }
   return dirPath;
}
Beispiel #2
0
String FileFormat::Description() const
{
   size_type len = 0;
   (*API->FileFormat->GetFileFormatDescription)( m_data->handle, 0, &len );

   String description;
   if ( len > 0 )
   {
      description.SetLength( len );
      if ( (*API->FileFormat->GetFileFormatDescription)( m_data->handle, description.Begin(), &len ) == api_false )
         throw APIFunctionError( "GetFileFormatDescription" );
      description.ResizeToNullTerminated();
   }
   return description;
}
Beispiel #3
0
String Edit::SelectedText() const
{
   size_type len = 0;
   (*API->Edit->GetEditSelectedText)( handle, 0, &len );

   String text;
   if ( len > 0 )
   {
      text.SetLength( len );
      if ( (*API->Edit->GetEditSelectedText)( handle, text.Begin(), &len ) == api_false )
         throw APIFunctionError( "GetEditSelectedText" );
      text.ResizeToNullTerminated();
   }
   return text;
}
Beispiel #4
0
String TreeBox::Node::ToolTip( int col ) const
{
   size_type len = 0;
   (*API->TreeBox->GetTreeBoxNodeColToolTip)( handle, col, 0, &len );

   String tip;
   if ( len > 0 )
   {
      tip.SetLength( len );
      if ( (*API->TreeBox->GetTreeBoxNodeColToolTip)( handle, col, tip.Begin(), &len ) == api_false )
         throw APIFunctionError( "GetTreeBoxNodeColToolTip" );
      tip.ResizeToNullTerminated();
   }
   return tip;
}
Beispiel #5
0
String TabBox::PageLabel( int idx ) const
{
   size_type len = 0;
   (*API->TabBox->GetTabBoxPageLabel)( handle, idx, 0, &len );

   String label;
   if ( len > 0 )
   {
      label.SetLength( len );
      if ( (*API->TabBox->GetTabBoxPageLabel)( handle, idx, label.Begin(), &len ) == api_false )
         throw APIFunctionError( "GetTabBoxPageLabel" );
      label.ResizeToNullTerminated();
   }
   return label;
}
Beispiel #6
0
String TabBox::PageToolTip( int idx ) const
{
   size_type len = 0;
   (*API->TabBox->GetTabBoxPageToolTip)( handle, idx, 0, &len );

   String tip;
   if ( len > 0 )
   {
      tip.SetLength( len );
      if ( (*API->TabBox->GetTabBoxPageToolTip)( handle, idx, tip.Begin(), &len ) == api_false )
         throw APIFunctionError( "GetTabBoxPageToolTip" );
      tip.ResizeToNullTerminated();
   }
   return tip;
}
Beispiel #7
0
String FileFormatInstance::ImageProperties() const
{
   size_type len = 0;
   (*API->FileFormat->GetImageProperties)( handle, 0, &len );

   String properties;
   if ( len > 0 )
   {
      properties.SetLength( len );
      if ( (*API->FileFormat->GetImageProperties)( handle, properties.Begin(), &len ) == api_false )
         throw APIFunctionError( "GetImageProperties" );
      properties.ResizeToNullTerminated();
   }
   return properties;
}
Beispiel #8
0
String Label::Text() const
{
   size_type len = 0;
   (*API->Label->GetLabelText)( handle, 0, &len );

   String text;
   if ( len > 0 )
   {
      text.SetLength( len );
      if ( (*API->Label->GetLabelText)( handle, text.c_str(), &len ) == api_false )
         throw APIFunctionError( "GetLabelText" );
      text.ResizeToNullTerminated();
   }
   return text;
}
Beispiel #9
0
String ComboBox::ItemText( int idx ) const
{
   size_type len = 0;
   (*API->ComboBox->GetComboBoxItemText)( handle, idx, 0, &len );

   String text;
   if ( len > 0 )
   {
      text.SetLength( len );
      if ( (*API->ComboBox->GetComboBoxItemText)( handle, idx, text.c_str(), &len ) == api_false )
         throw APIFunctionError( "GetComboBoxItemText" );
      text.ResizeToNullTerminated();
   }
   return text;
}
Beispiel #10
0
String FileFormatInstance::FilePath() const
{
   size_type len = 0;
   (*API->FileFormat->GetImageFilePath)( handle, 0, &len );

   String path;
   if ( len > 0 )
   {
      path.SetLength( len );
      if ( (*API->FileFormat->GetImageFilePath)( handle, path.Begin(), &len ) == api_false )
         throw APIFunctionError( "GetImageFilePath" );
      path.ResizeToNullTerminated();
   }
   return path;
}
Beispiel #11
0
String SpinBox::MinimumValueText() const
{
   size_type len = 0;
   (*API->SpinBox->GetSpinBoxMinimumValueText)( handle, 0, &len );

   String text;
   if ( len > 0 )
   {
      text.SetLength( len );
      if ( (*API->SpinBox->GetSpinBoxMinimumValueText)( handle, text.Begin(), &len ) == api_false )
         throw APIFunctionError( "GetSpinBoxMinimumValueText" );
      text.ResizeToNullTerminated();
   }
   return text;
}
Beispiel #12
0
String SpinBox::Suffix() const
{
   size_type len = 0;
   (*API->SpinBox->GetSpinBoxSuffix)( handle, 0, &len );

   String suffix;
   if ( len > 0 )
   {
      suffix.SetLength( len );
      if ( (*API->SpinBox->GetSpinBoxSuffix)( handle, suffix.Begin(), &len ) == api_false )
         throw APIFunctionError( "GetSpinBoxSuffix" );
      suffix.ResizeToNullTerminated();
   }
   return suffix;
}
Beispiel #13
0
String ProcessParameter::ScriptComment() const
{
   size_type len = 0;
   (*API->Process->GetParameterScriptComment)( m_data->handle, 0, &len );

   String comment;
   if ( len > 0 )
   {
      comment.SetLength( len );
      if ( (*API->Process->GetParameterScriptComment)( m_data->handle, comment.c_str(), &len ) == api_false )
         throw APIFunctionError( "GetParameterScriptComment" );
      comment.ResizeToNullTerminated();
   }
   return comment;
}
Beispiel #14
0
String FileFormat::Status() const
{
   size_type len = 0;
   (*API->FileFormat->GetFileFormatStatus)( m_data->handle, 0, &len, 0/*reserved*/ );

   String status;
   if ( len > 0 )
   {
      status.SetLength( len );
      if ( (*API->FileFormat->GetFileFormatStatus)( m_data->handle, status.Begin(), &len, 0/*reserved*/ ) == api_false )
         throw APIFunctionError( "GetFileFormatStatus" );
      status.ResizeToNullTerminated();
   }
   return status;
}
Beispiel #15
0
String ProcessParameter::Description() const
{
   size_type len = 0;
   (*API->Process->GetParameterDescription)( m_data->handle, 0, &len );

   String description;
   if ( len > 0 )
   {
      description.SetLength( len );
      if ( (*API->Process->GetParameterDescription)( m_data->handle, description.c_str(), &len ) == api_false )
         throw APIFunctionError( "GetParameterDescription" );
      description.ResizeToNullTerminated();
   }
   return description;
}
Beispiel #16
0
String FileFormat::Implementation() const
{
   size_type len = 0;
   (*API->FileFormat->GetFileFormatImplementation)( m_data->handle, 0, &len );

   String implementation;
   if ( len > 0 )
   {
      implementation.SetLength( len );
      if ( (*API->FileFormat->GetFileFormatImplementation)( m_data->handle, implementation.c_str(), &len ) == api_false )
         throw APIFunctionError( "GetFileFormatImplementation" );
      implementation.ResizeToNullTerminated();
   }
   return implementation;
}
Beispiel #17
0
String TreeBox::Node::Text( int col ) const
{
   size_type len = 0;
   (*API->TreeBox->GetTreeBoxNodeColText)( handle, col, 0, &len );

   String text;
   if ( len > 0 )
   {
      text.SetLength( len );
      if ( (*API->TreeBox->GetTreeBoxNodeColText)( handle, col, text.Begin(), &len ) == api_false )
         throw APIFunctionError( "GetTreeBoxNodeColText" );
      text.ResizeToNullTerminated();
   }
   return text;
}
Beispiel #18
0
String SVG::Description() const
{
   if ( !IsNull() )
   {
      size_type len = 0;
      (*API->SVG->GetSVGDescription)( handle, 0, &len );
      if ( len > 0 )
      {
         String description;
         description.SetLength( len );
         if ( (*API->SVG->GetSVGDescription)( handle, description.c_str(), &len ) == api_false )
            throw APIFunctionError( "GetSVGDescription" );
         description.ResizeToNullTerminated();
         return description;
      }
   }

   return String();
}
Beispiel #19
0
String SVG::Title() const
{
   if ( !IsNull() )
   {
      size_type len = 0;
      (*API->SVG->GetSVGTitle)( handle, 0, &len );
      if ( len > 0 )
      {
         String title;
         title.SetLength( len );
         if ( (*API->SVG->GetSVGTitle)( handle, title.c_str(), &len ) == api_false )
            throw APIFunctionError( "GetSVGTitle" );
         title.ResizeToNullTerminated();
         return title;
      }
   }

   return String();
}
Beispiel #20
0
String SVG::FilePath() const
{
   if ( !IsNull() )
   {
      size_type len = 0;
      (*API->SVG->GetSVGFilePath)( handle, 0, &len );
      if ( len > 0 )
      {
         String path;
         path.SetLength( len );
         if ( (*API->SVG->GetSVGFilePath)( handle, path.c_str(), &len ) == api_false )
            throw APIFunctionError( "GetSVGFilePath" );
         path.ResizeToNullTerminated();
         return path;
      }
   }

   return String();
}
Beispiel #21
0
bool OpenFileDialog::Execute()
{
   q->fileNames.Clear();

   String apiFilters = p->MakeAPIFilters();

   String fileName;
   fileName.Reserve( 8192 );
   *fileName.c_str() = CharTraits::Null();

   if ( q->multipleSelections )
   {
      if ( (*API->Dialog->ExecuteOpenMultipleFilesDialog)( fileName.c_str(),
               AddFileNameToList, &q->fileNames,
               p->caption.c_str(),
               p->initialPath.c_str(), apiFilters.c_str(), p->fileExtension.c_str() ) == api_false )
      {
         return false;
      }
   }
   else
   {
      if ( (*API->Dialog->ExecuteOpenFileDialog)( fileName.c_str(),
               p->caption.c_str(),
               p->initialPath.c_str(), apiFilters.c_str(), p->fileExtension.c_str() ) == api_false )
      {
         return false;
      }

      fileName.ResizeToNullTerminated();
      if ( !fileName.IsEmpty() )
         q->fileNames.Add( fileName );
   }

   if ( !q->fileNames.IsEmpty() )
   {
      p->fileExtension = File::ExtractExtension( *q->fileNames );
      return true;
   }

   return false;
}
Beispiel #22
0
String ProcessParameter::AllowedCharacters() const
{
   String allowed;

   if ( IsString() )
   {
      size_type len = 0;
      (*API->Process->GetParameterAllowedCharacters)( m_data->handle, 0, &len );

      if ( len > 0 )
      {
         allowed.SetLength( len );
         if ( (*API->Process->GetParameterAllowedCharacters)( m_data->handle, allowed.c_str(), &len ) == api_false )
            throw APIFunctionError( "GetParameterAllowedCharacters" );
         allowed.ResizeToNullTerminated();
      }
   }

   return allowed;
}
Beispiel #23
0
bool FileFormatInstance::ReadColorFilterArray( ColorFilterArray& cfa )
{
   try
   {
      cfa = ColorFilterArray();

      if ( (*API->FileFormat->BeginColorFilterArrayExtraction)( handle ) == api_false )
         return false;

      size_type patternLen = 0, nameLen = 0;
      (*API->FileFormat->GetImageColorFilterArray)( handle, 0, &patternLen, 0, 0, 0, &nameLen );

      bool ok = true;
      if ( patternLen > 0 )
      {
         IsoString pattern;
         pattern.SetLength( patternLen );
         String name;
         if ( nameLen > 0 )
            name.SetLength( nameLen );
         int32 width, height;
         ok = (*API->FileFormat->GetImageColorFilterArray)( handle,
                              pattern.Begin(), &patternLen, &width, &height, name.Begin(), &nameLen ) != api_false;
         if ( ok )
         {
            pattern.ResizeToNullTerminated();
            name.ResizeToNullTerminated();
            cfa = ColorFilterArray( pattern, width, height, name );
         }
      }

      (*API->FileFormat->EndColorFilterArrayExtraction)( handle );
      return ok;
   }
   catch ( ... )
   {
      (*API->FileFormat->EndColorFilterArrayExtraction)( handle );
      throw;
   }
}
Beispiel #24
0
Variant ProcessParameter::DefaultValue() const
{
   if ( IsNull() )
      return Variant();

   uint32 apiType = (*API->Process->GetParameterType)( m_data->handle );
   if ( apiType == 0 )
      throw APIFunctionError( "GetParameterType" );

   apiType &= PTYPE_TYPE_MASK;

   if ( apiType == PTYPE_TABLE )
      throw Error( "ProcessParameter::DefaultValue(): Invoked for a table parameter" );

   if ( apiType == PTYPE_BLOCK )
      return ByteArray();

   if ( apiType == PTYPE_STRING )
   {
      size_type len = 0;
      (*API->Process->GetParameterDefaultValue)( m_data->handle, 0, &len );

      String value;
      if ( len > 0 )
      {
         value.SetLength( len );
         if ( (*API->Process->GetParameterDefaultValue)( m_data->handle, value.c_str(), &len ) == api_false )
            throw APIFunctionError( "GetParameterDefaultValue" );
         value.ResizeToNullTerminated();
      }
      return value;
   }

   if ( apiType == PTYPE_ENUM )
   {
      int index = (*API->Process->GetParameterDefaultElementIndex)( m_data->handle );
      if ( index < 0 )
         throw APIFunctionError( "GetParameterDefaultElementIndex" );
      return index;
   }

   union
   {
      uint8    u8;
      int8     i8;
      uint16   u16;
      int16    i16;
      uint32   u32;
      int32    i32;
      uint64   u64;
      int64    i64;
      float    f;
      double   d;
      api_bool b;
   }
   value;

   if ( (*API->Process->GetParameterDefaultValue)( m_data->handle, &value, 0 ) == api_false )
      throw APIFunctionError( "GetParameterDefaultValue" );

   switch ( apiType )
   {
   case PTYPE_UINT8:  return value.u8;
   case PTYPE_INT8:   return value.i8;
   case PTYPE_UINT16: return value.u16;
   case PTYPE_INT16:  return value.i16;
   case PTYPE_UINT32: return value.u32;
   case PTYPE_INT32:  return value.i32;
   case PTYPE_UINT64: return value.u64;
   case PTYPE_INT64:  return value.i64;
   case PTYPE_FLOAT:  return value.f;
   case PTYPE_DOUBLE: return value.d;
   case PTYPE_BOOL:   return value.b != api_false;
   default:
      throw Error( "ProcessParameter::DefaultValue(): Internal error: Unknown parameter type" );
   }
}
void ICCProfileTransformation::CreateTransformation( bool floatingPoint ) const
{
   CloseTransformation();

   if ( m_profiles.Length() < 2 )
      throw Error( "Insufficient profiles to create an ICC color transformation." );

   if ( m_proofingTransformation && m_profiles.Length() != 3 )
      throw Error( "A proofing ICC color transformation requires three ICC profiles." );

   for ( size_type i = 0; i < m_profiles.Length(); ++i )
      if ( m_profiles[i] == 0 )
         throw Error( "Cannot create an ICC color transformation due to invalid or undefined ICC profile(s)." );

   m_srcRGB = (*API->ColorManagement->GetProfileColorSpace)( *m_profiles.Begin() ) != int32( ICCColorSpace::Gray );
   m_dstRGB = (*API->ColorManagement->GetProfileColorSpace)( *m_profiles.ReverseBegin() ) != int32( ICCColorSpace::Gray );

   m_floatingPoint = floatingPoint;

   int32 srcFormat = m_srcRGB ?
      (m_floatingPoint ? ColorManagementContext::RGB_F64 : ColorManagementContext::RGB_I16) :
      (m_floatingPoint ? ColorManagementContext::Gray_F64 : ColorManagementContext::Gray_I16);

   int32 dstFormat = m_dstRGB ?
      (m_floatingPoint ? ColorManagementContext::RGB_F64 : ColorManagementContext::RGB_I16) :
      (m_floatingPoint ? ColorManagementContext::Gray_F64 : ColorManagementContext::Gray_I16);

   uint32 flags = 0;

   if ( m_blackPointCompensation )
      flags |= ColorManagementContext::BlackPointCompensation;

   if ( m_highResolutionCLUT )
      flags |= ColorManagementContext::HighResolutionCLUT;
   else if ( m_lowResolutionCLUT )
      flags |= ColorManagementContext::LowResolutionCLUT;

   if ( m_gamutCheck )
      flags |= ColorManagementContext::GamutCheck;

   if ( m_proofingTransformation )
      m_transformation = (*API->ColorManagement->CreateProofingTransformation)(
                                       m_profiles[0],
                                       m_profiles[2],
                                       m_profiles[1],
                                       srcFormat,
                                       dstFormat,
                                       m_intent,
                                       m_proofingIntent,
                                       flags );
   else if ( m_profiles.Length() == 2 )
      m_transformation = (*API->ColorManagement->CreateTransformation)(
                                       m_profiles[0],
                                       m_profiles[1],
                                       srcFormat,
                                       dstFormat,
                                       m_intent,
                                       flags );
   else
      m_transformation = (*API->ColorManagement->CreateMultiprofileTransformation)(
                                       (icc_profile_handle*)m_profiles.Begin(),
                                       uint32( m_profiles.Length() ),
                                       srcFormat,
                                       dstFormat,
                                       m_intent,
                                       flags );

   if ( m_transformation == nullptr )
   {
      size_type len;
      (void)(*API->ColorManagement->GetLastErrorMessage)( 0, &len );

      String apiMessage;
      if ( len > 0 )
      {
         apiMessage.SetLength( len );
         if ( (*API->ColorManagement->GetLastErrorMessage)( apiMessage.c_str(), &len ) == api_false )
            apiMessage.Clear();
         else
            apiMessage.ResizeToNullTerminated();
      }

      if ( apiMessage.IsEmpty() )
         apiMessage = '.';
      else
         apiMessage.Prepend( ": " );

      throw Error( "Error initializing ICC color profile transformation" + apiMessage );
   }
}